From: John.Youn@synopsys.com (John Youn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] reset: Put back *_optional variants
Date: Mon, 30 May 2016 22:53:18 -0700 [thread overview]
Message-ID: <da7e41b2-de80-c692-e7ec-ba8231dadb0a@synopsys.com> (raw)
In-Reply-To: <5cf9f346-9b6e-d521-612c-9edd167aa759@redhat.com>
On 5/30/2016 4:32 AM, Hans de Goede wrote:
> Hi,
>
> On 30-05-16 12:18, Philipp Zabel wrote:
>> Hi,
>>
>> Am Freitag, den 27.05.2016, 09:06 +0200 schrieb Hans de Goede:
>> [...]
>>>>> So IMHO the following change would be a better way to fix this:
>>>>>
>>>>> --- a/include/linux/reset.h
>>>>> +++ b/include/linux/reset.h
>>>>> @@ -65,14 +65,14 @@ static inline struct reset_control *__of_reset_control_get(
>>>>> struct device_node *node,
>>>>> const char *id, int index, int shared)
>>>>> {
>>>>> - return ERR_PTR(-EINVAL);
>>>>> + return ERR_PTR(-ENOTSUPP);
>>>>> }
>>>>>
>>>>> static inline struct reset_control *__devm_reset_control_get(
>>>>> struct device *dev,
>>>>> const char *id, int index, int shared)
>>>>> {
>>>>> - return ERR_PTR(-EINVAL);
>>>>> + return ERR_PTR(-ENOTSUPP);
>>>>> }
>>>>>
>>>>> #endif /* CONFIG_RESET_CONTROLLER */
>>>>
>>>>
>>>> I'm good with this. However, per Philipp on a previous thread, the
>>>> intended behavior is to return -EINVAL for the non-optional functions.
>>>>
>>>> http://marc.info/?l=linux-usb&m=146156945528848&w=2
>>
>> Adding Dinh to Cc: because he wanted this changed from -EINVAL.
>> My point then was that WARN_ON + -EINVAL is indented in this case.
>>
>> Given that the warning backtrace already helps to identify the issue
>> (CONFIG_RESET_CONTROLLER disabled), and that changing the return value
>> to -ENOTSUPP improves consistency with the rest of the API and reduces
>> the amount of inline wrappers, I concur.
>>
>>> As Philipp rightfully points out, calling the non-optional functions
>>> without CONFIG_RESET_CONTROLLER is a no-no, so IMHO we should not have to
>>> care too much about the error code in that case, as long as we return
>>> an error.
>>>
>>> Also note that even before my patch things were already inconsistent
>>> with the of_...get... functions already always returning
>>> -ENOTSUPP when CONFIG_RESET_CONTROLLER was not set, to me it seems
>>> best and also KISS to just return -ENOTSUPP from all get functions
>>> when CONFIG_RESET_CONTROLLER is not set.
>>>
>>> Anyways this is Philipp's call, this is all just my 2 cents.
>>
>> Let the stubs return -ENOTSUPP consistently. A quick grep doesn't show
>> any driver handling -EINVAL explicitly either.
>
> Great.
>
> John Youn, can you submit a patch changing the return of the stubs
> from -EINVAL to -ENOTSUPP please ?
>
Sure. I'll send a patch tomorrow.
Regards,
John
prev parent reply other threads:[~2016-05-31 5:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-26 1:15 [PATCH] reset: Put back *_optional variants John Youn
2016-05-26 20:25 ` Hans de Goede
2016-05-26 21:44 ` John Youn
2016-05-27 7:06 ` Hans de Goede
2016-05-30 10:18 ` Philipp Zabel
2016-05-30 11:32 ` Hans de Goede
2016-05-30 12:11 ` Philipp Zabel
2016-05-31 5:53 ` John Youn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da7e41b2-de80-c692-e7ec-ba8231dadb0a@synopsys.com \
--to=john.youn@synopsys.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.