* [PATCH v2] mmc: host: use of_property_read_bool()
@ 2015-08-06 22:06 Sergei Shtylyov
2015-08-25 12:05 ` Ulf Hansson
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2015-08-06 22:06 UTC (permalink / raw)
To: ulf.hansson, linux-mmc; +Cc: linux-kernel
Use more compact of_property_read_bool() calls instead of the of_find_property()
calls.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
The patch is against Ulf Hansson's 'mmc.git' repo's 'next' branch.
Changes in version 2:
- fixed the function name in the summary.
drivers/mmc/core/host.c | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
Index: mmc/drivers/mmc/core/host.c
===================================================================
--- mmc.orig/drivers/mmc/core/host.c
+++ mmc/drivers/mmc/core/host.c
@@ -398,7 +398,7 @@ int mmc_of_parse(struct mmc_host *host)
{
struct device_node *np;
u32 bus_width;
- int len, ret;
+ int ret;
bool cd_cap_invert, cd_gpio_invert = false;
bool ro_cap_invert, ro_gpio_invert = false;
@@ -445,12 +445,12 @@ int mmc_of_parse(struct mmc_host *host)
*/
/* Parse Card Detection */
- if (of_find_property(np, "non-removable", &len)) {
+ if (of_property_read_bool(np, "non-removable")) {
host->caps |= MMC_CAP_NONREMOVABLE;
} else {
cd_cap_invert = of_property_read_bool(np, "cd-inverted");
- if (of_find_property(np, "broken-cd", &len))
+ if (of_property_read_bool(np, "broken-cd"))
host->caps |= MMC_CAP_NEEDS_POLL;
ret = mmc_gpiod_request_cd(host, "cd", 0, true,
@@ -491,41 +491,41 @@ int mmc_of_parse(struct mmc_host *host)
if (ro_cap_invert ^ ro_gpio_invert)
host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
- if (of_find_property(np, "cap-sd-highspeed", &len))
+ if (of_property_read_bool(np, "cap-sd-highspeed"))
host->caps |= MMC_CAP_SD_HIGHSPEED;
- if (of_find_property(np, "cap-mmc-highspeed", &len))
+ if (of_property_read_bool(np, "cap-mmc-highspeed"))
host->caps |= MMC_CAP_MMC_HIGHSPEED;
- if (of_find_property(np, "sd-uhs-sdr12", &len))
+ if (of_property_read_bool(np, "sd-uhs-sdr12"))
host->caps |= MMC_CAP_UHS_SDR12;
- if (of_find_property(np, "sd-uhs-sdr25", &len))
+ if (of_property_read_bool(np, "sd-uhs-sdr25"))
host->caps |= MMC_CAP_UHS_SDR25;
- if (of_find_property(np, "sd-uhs-sdr50", &len))
+ if (of_property_read_bool(np, "sd-uhs-sdr50"))
host->caps |= MMC_CAP_UHS_SDR50;
- if (of_find_property(np, "sd-uhs-sdr104", &len))
+ if (of_property_read_bool(np, "sd-uhs-sdr104"))
host->caps |= MMC_CAP_UHS_SDR104;
- if (of_find_property(np, "sd-uhs-ddr50", &len))
+ if (of_property_read_bool(np, "sd-uhs-ddr50"))
host->caps |= MMC_CAP_UHS_DDR50;
- if (of_find_property(np, "cap-power-off-card", &len))
+ if (of_property_read_bool(np, "cap-power-off-card"))
host->caps |= MMC_CAP_POWER_OFF_CARD;
- if (of_find_property(np, "cap-sdio-irq", &len))
+ if (of_property_read_bool(np, "cap-sdio-irq"))
host->caps |= MMC_CAP_SDIO_IRQ;
- if (of_find_property(np, "full-pwr-cycle", &len))
+ if (of_property_read_bool(np, "full-pwr-cycle"))
host->caps2 |= MMC_CAP2_FULL_PWR_CYCLE;
- if (of_find_property(np, "keep-power-in-suspend", &len))
+ if (of_property_read_bool(np, "keep-power-in-suspend"))
host->pm_caps |= MMC_PM_KEEP_POWER;
- if (of_find_property(np, "enable-sdio-wakeup", &len))
+ if (of_property_read_bool(np, "enable-sdio-wakeup"))
host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
- if (of_find_property(np, "mmc-ddr-1_8v", &len))
+ if (of_property_read_bool(np, "mmc-ddr-1_8v"))
host->caps |= MMC_CAP_1_8V_DDR;
- if (of_find_property(np, "mmc-ddr-1_2v", &len))
+ if (of_property_read_bool(np, "mmc-ddr-1_2v"))
host->caps |= MMC_CAP_1_2V_DDR;
- if (of_find_property(np, "mmc-hs200-1_8v", &len))
+ if (of_property_read_bool(np, "mmc-hs200-1_8v"))
host->caps2 |= MMC_CAP2_HS200_1_8V_SDR;
- if (of_find_property(np, "mmc-hs200-1_2v", &len))
+ if (of_property_read_bool(np, "mmc-hs200-1_2v"))
host->caps2 |= MMC_CAP2_HS200_1_2V_SDR;
- if (of_find_property(np, "mmc-hs400-1_8v", &len))
+ if (of_property_read_bool(np, "mmc-hs400-1_8v"))
host->caps2 |= MMC_CAP2_HS400_1_8V | MMC_CAP2_HS200_1_8V_SDR;
- if (of_find_property(np, "mmc-hs400-1_2v", &len))
+ if (of_property_read_bool(np, "mmc-hs400-1_2v"))
host->caps2 |= MMC_CAP2_HS400_1_2V | MMC_CAP2_HS200_1_2V_SDR;
host->dsr_req = !of_property_read_u32(np, "dsr", &host->dsr);
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] mmc: host: use of_property_read_bool()
2015-08-06 22:06 [PATCH v2] mmc: host: use of_property_read_bool() Sergei Shtylyov
@ 2015-08-25 12:05 ` Ulf Hansson
2015-08-25 16:32 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2015-08-25 12:05 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linux-mmc, linux-kernel@vger.kernel.org
On 7 August 2015 at 00:06, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Use more compact of_property_read_bool() calls instead of the of_find_property()
> calls.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Thanks, applied for next!
Next, time please run checkpatch to remove errors/warnings.
Kind regards
Uffe
>
> ---
> The patch is against Ulf Hansson's 'mmc.git' repo's 'next' branch.
>
> Changes in version 2:
> - fixed the function name in the summary.
>
> drivers/mmc/core/host.c | 42 +++++++++++++++++++++---------------------
> 1 file changed, 21 insertions(+), 21 deletions(-)
>
> Index: mmc/drivers/mmc/core/host.c
> ===================================================================
> --- mmc.orig/drivers/mmc/core/host.c
> +++ mmc/drivers/mmc/core/host.c
> @@ -398,7 +398,7 @@ int mmc_of_parse(struct mmc_host *host)
> {
> struct device_node *np;
> u32 bus_width;
> - int len, ret;
> + int ret;
> bool cd_cap_invert, cd_gpio_invert = false;
> bool ro_cap_invert, ro_gpio_invert = false;
>
> @@ -445,12 +445,12 @@ int mmc_of_parse(struct mmc_host *host)
> */
>
> /* Parse Card Detection */
> - if (of_find_property(np, "non-removable", &len)) {
> + if (of_property_read_bool(np, "non-removable")) {
> host->caps |= MMC_CAP_NONREMOVABLE;
> } else {
> cd_cap_invert = of_property_read_bool(np, "cd-inverted");
>
> - if (of_find_property(np, "broken-cd", &len))
> + if (of_property_read_bool(np, "broken-cd"))
> host->caps |= MMC_CAP_NEEDS_POLL;
>
> ret = mmc_gpiod_request_cd(host, "cd", 0, true,
> @@ -491,41 +491,41 @@ int mmc_of_parse(struct mmc_host *host)
> if (ro_cap_invert ^ ro_gpio_invert)
> host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
>
> - if (of_find_property(np, "cap-sd-highspeed", &len))
> + if (of_property_read_bool(np, "cap-sd-highspeed"))
> host->caps |= MMC_CAP_SD_HIGHSPEED;
> - if (of_find_property(np, "cap-mmc-highspeed", &len))
> + if (of_property_read_bool(np, "cap-mmc-highspeed"))
> host->caps |= MMC_CAP_MMC_HIGHSPEED;
> - if (of_find_property(np, "sd-uhs-sdr12", &len))
> + if (of_property_read_bool(np, "sd-uhs-sdr12"))
> host->caps |= MMC_CAP_UHS_SDR12;
> - if (of_find_property(np, "sd-uhs-sdr25", &len))
> + if (of_property_read_bool(np, "sd-uhs-sdr25"))
> host->caps |= MMC_CAP_UHS_SDR25;
> - if (of_find_property(np, "sd-uhs-sdr50", &len))
> + if (of_property_read_bool(np, "sd-uhs-sdr50"))
> host->caps |= MMC_CAP_UHS_SDR50;
> - if (of_find_property(np, "sd-uhs-sdr104", &len))
> + if (of_property_read_bool(np, "sd-uhs-sdr104"))
> host->caps |= MMC_CAP_UHS_SDR104;
> - if (of_find_property(np, "sd-uhs-ddr50", &len))
> + if (of_property_read_bool(np, "sd-uhs-ddr50"))
> host->caps |= MMC_CAP_UHS_DDR50;
> - if (of_find_property(np, "cap-power-off-card", &len))
> + if (of_property_read_bool(np, "cap-power-off-card"))
> host->caps |= MMC_CAP_POWER_OFF_CARD;
> - if (of_find_property(np, "cap-sdio-irq", &len))
> + if (of_property_read_bool(np, "cap-sdio-irq"))
> host->caps |= MMC_CAP_SDIO_IRQ;
> - if (of_find_property(np, "full-pwr-cycle", &len))
> + if (of_property_read_bool(np, "full-pwr-cycle"))
> host->caps2 |= MMC_CAP2_FULL_PWR_CYCLE;
> - if (of_find_property(np, "keep-power-in-suspend", &len))
> + if (of_property_read_bool(np, "keep-power-in-suspend"))
> host->pm_caps |= MMC_PM_KEEP_POWER;
> - if (of_find_property(np, "enable-sdio-wakeup", &len))
> + if (of_property_read_bool(np, "enable-sdio-wakeup"))
> host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
> - if (of_find_property(np, "mmc-ddr-1_8v", &len))
> + if (of_property_read_bool(np, "mmc-ddr-1_8v"))
> host->caps |= MMC_CAP_1_8V_DDR;
> - if (of_find_property(np, "mmc-ddr-1_2v", &len))
> + if (of_property_read_bool(np, "mmc-ddr-1_2v"))
> host->caps |= MMC_CAP_1_2V_DDR;
> - if (of_find_property(np, "mmc-hs200-1_8v", &len))
> + if (of_property_read_bool(np, "mmc-hs200-1_8v"))
> host->caps2 |= MMC_CAP2_HS200_1_8V_SDR;
> - if (of_find_property(np, "mmc-hs200-1_2v", &len))
> + if (of_property_read_bool(np, "mmc-hs200-1_2v"))
> host->caps2 |= MMC_CAP2_HS200_1_2V_SDR;
> - if (of_find_property(np, "mmc-hs400-1_8v", &len))
> + if (of_property_read_bool(np, "mmc-hs400-1_8v"))
> host->caps2 |= MMC_CAP2_HS400_1_8V | MMC_CAP2_HS200_1_8V_SDR;
> - if (of_find_property(np, "mmc-hs400-1_2v", &len))
> + if (of_property_read_bool(np, "mmc-hs400-1_2v"))
> host->caps2 |= MMC_CAP2_HS400_1_2V | MMC_CAP2_HS200_1_2V_SDR;
>
> host->dsr_req = !of_property_read_u32(np, "dsr", &host->dsr);
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] mmc: host: use of_property_read_bool()
2015-08-25 12:05 ` Ulf Hansson
@ 2015-08-25 16:32 ` Sergei Shtylyov
2015-08-25 21:19 ` Ulf Hansson
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2015-08-25 16:32 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, linux-kernel@vger.kernel.org
On 08/25/2015 03:05 PM, Ulf Hansson wrote:
>> Use more compact of_property_read_bool() calls instead of the of_find_property()
>> calls.
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Thanks, applied for next!
Thanks to you! :-)
> Next, time please run checkpatch to remove errors/warnings.
Hum, I just did and the patch seems clean:
[headless@wasted mmc]$ scripts/checkpatch.pl
patches/mmc-host-use-of_property_read_bool.patch
total: 0 errors, 0 warnings, 81 lines checked
patches/mmc-host-use-of_property_read_bool.patch has no obvious style problems
and is ready for submission.
What do you mean?
> Kind regards
> Uffe
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] mmc: host: use of_property_read_bool()
2015-08-25 16:32 ` Sergei Shtylyov
@ 2015-08-25 21:19 ` Ulf Hansson
2015-08-25 21:49 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2015-08-25 21:19 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linux-mmc, linux-kernel@vger.kernel.org
On 25 August 2015 at 18:32, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> On 08/25/2015 03:05 PM, Ulf Hansson wrote:
>
>>> Use more compact of_property_read_bool() calls instead of the
>>> of_find_property()
>>> calls.
>
>
>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
>
>> Thanks, applied for next!
>
>
> Thanks to you! :-)
>
>> Next, time please run checkpatch to remove errors/warnings.
>
>
> Hum, I just did and the patch seems clean:
>
> [headless@wasted mmc]$ scripts/checkpatch.pl
> patches/mmc-host-use-of_property_read_bool.patch
> total: 0 errors, 0 warnings, 81 lines checked
>
> patches/mmc-host-use-of_property_read_bool.patch has no obvious style
> problems and is ready for submission.
>
> What do you mean?
WARNING: Possible unwrapped commit description (prefer a maximum 75
chars per line)
#12:
Use more compact of_property_read_bool() calls instead of the of_find_property()
total: 0 errors, 1 warnings, 81 lines checked
I suspect we might use different versions of the checkpatch script.
Mine is from 4.2rc7.
No worries then!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mmc: host: use of_property_read_bool()
2015-08-25 21:19 ` Ulf Hansson
@ 2015-08-25 21:49 ` Sergei Shtylyov
0 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-08-25 21:49 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, linux-kernel@vger.kernel.org
On 08/26/2015 12:19 AM, Ulf Hansson wrote:
>>>> Use more compact of_property_read_bool() calls instead of the
>>>> of_find_property()
>>>> calls.
>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>
>>> Thanks, applied for next!
>>
>> Thanks to you! :-)
>>
>>> Next, time please run checkpatch to remove errors/warnings.
>>
>> Hum, I just did and the patch seems clean:
>>
>> [headless@wasted mmc]$ scripts/checkpatch.pl
>> patches/mmc-host-use-of_property_read_bool.patch
>> total: 0 errors, 0 warnings, 81 lines checked
>>
>> patches/mmc-host-use-of_property_read_bool.patch has no obvious style
>> problems and is ready for submission.
>>
>> What do you mean?
> WARNING: Possible unwrapped commit description (prefer a maximum 75
> chars per line)
> #12:
> Use more compact of_property_read_bool() calls instead of the of_find_property()
> total: 0 errors, 1 warnings, 81 lines checked
> I suspect we might use different versions of the checkpatch script.
> Mine is from 4.2rc7.
Tried several variants, the last one was in your repo's 'next' branch
(4.2-rc7 based). No warning. :-)
> No worries then!
> Kind regards
> Uffe
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-25 21:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-06 22:06 [PATCH v2] mmc: host: use of_property_read_bool() Sergei Shtylyov
2015-08-25 12:05 ` Ulf Hansson
2015-08-25 16:32 ` Sergei Shtylyov
2015-08-25 21:19 ` Ulf Hansson
2015-08-25 21:49 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).