Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1451875
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: Why do we need reset_control_get_optional() ? |
| Date | 2016-07-28 13:00 +0200 |
| Message-ID | <rZRcK-577-15@gated-at.bofh.it> (permalink) |
| References | <rY3i1-2br-15@gated-at.bofh.it> <rZQ70-4pS-17@gated-at.bofh.it> <rZQA1-4S8-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Arnd,
2016-07-28 19:09 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> On Thursday, July 28, 2016 11:43:00 AM CEST Philipp Zabel wrote:
>> > I want to deprecate _optional variants in the following steps:
>> >
>> > [1] Add "depends on RESET_CONTROLLER" to drivers
>> > for which reset_control is mandatory.
>> >
>> > We can find those driver easily by grepping
>> > the reference to non-optional reset_control_get().
>>
>> Since we have the stubs, the RESET_CONTROLLER dependency is only at
>> runtime, not at build time.
>>
>> I think Arnd wanted to move this in the opposite direction and remove
>> the configurable RESET_CONTROLLER symbol. Maybe we should let all
>> drivers that currently request non-optional resets have:
>> depends on (ARCH_HAS_)RESET_CONTROLLER || COMPILE_TEST
>> ?
>
> There are various ways to improve the current situation.
>
> I think it's important that a driver that has an optional
> reset line behaves in exactly the same way whether the reset
> subsystem is enabled or disabled when no reset line is
> provided for a machine.
>
> When a driver requires a reset line, we can either have a
> build-time failure when the reset subsystem is disabled
> (enforcing the Kconfig dependency), or cause a runtime
> failure if either there is no reset line or the subsystem
> is disabled.
Yes. I am suggesting the "enforcing the Kconfig dependency".
"I will let you build this driver, but it would never work"
is not the right thing to do, I think.
> In my experimental patch, I make the _optional functions
> return NULL if no "resets" property is provided but return
> an error if there are reset lines but the subsystem is
> disabled, i.e. an optional reset must be used if it's in the
> DT, but can be ignored otherwise.
I do not like this idea.
reset_control_get() (or variants) should not return NULL, it is ambiguous.
It should return ERR_PTR(-ENOENT) if no "resets" property.
I only want two types for functions that return a pointer.
[1] return a valid pointer on success, or return NULL on failure
(for example, kmalloc())
[2] return a valid pointer on success, or return error pointer on failure
(many of _register() functions)
Mixing [1] and [2] will be a mess.
--
Best Regards
Masahiro Yamada
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Why do we need reset_control_get_optional() ? Philipp Zabel <p.zabel@pengutronix.de> - 2016-07-28 11:50 +0200
Re: Why do we need reset_control_get_optional() ? Arnd Bergmann <arnd@arndb.de> - 2016-07-28 12:20 +0200
Re: Why do we need reset_control_get_optional() ? Philipp Zabel <p.zabel@pengutronix.de> - 2016-07-28 13:00 +0200
Re: Why do we need reset_control_get_optional() ? Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-07-28 13:00 +0200
Re: Why do we need reset_control_get_optional() ? Philipp Zabel <p.zabel@pengutronix.de> - 2016-07-28 13:10 +0200
Re: Why do we need reset_control_get_optional() ? Arnd Bergmann <arnd@arndb.de> - 2016-08-05 18:00 +0200
Re: Why do we need reset_control_get_optional() ? Philipp Zabel <p.zabel@pengutronix.de> - 2016-08-08 18:40 +0200
Re: Why do we need reset_control_get_optional() ? Arnd Bergmann <arnd@arndb.de> - 2016-08-08 23:50 +0200
Re: Why do we need reset_control_get_optional() ? Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-07-28 12:40 +0200
Re: Why do we need reset_control_get_optional() ? Philipp Zabel <p.zabel@pengutronix.de> - 2016-07-29 15:10 +0200
Re: Why do we need reset_control_get_optional() ? Arnd Bergmann <arnd@arndb.de> - 2016-07-30 22:20 +0200
Re: Why do we need reset_control_get_optional() ? Philipp Zabel <p.zabel@pengutronix.de> - 2016-08-05 11:00 +0200
Re: Why do we need reset_control_get_optional() ? Arnd Bergmann <arnd@arndb.de> - 2016-08-05 17:40 +0200
Re: Why do we need reset_control_get_optional() ? Philipp Zabel <p.zabel@pengutronix.de> - 2016-08-08 19:30 +0200
csiph-web