Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1469385

Re: [PATCH 2/2] reset: uniphier: use of_device_get_match_data() to get matched data

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Masahiro Yamada <yamada.masahiro@socionext.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] reset: uniphier: use of_device_get_match_data() to get matched data
Date Wed, 24 Aug 2016 14:40:02 +0200
Message-ID <s9FDk-2fA-5@gated-at.bofh.it> (permalink)
References <s9A0V-6Tr-3@gated-at.bofh.it> <s9A0V-6Tr-1@gated-at.bofh.it> <s9FtE-2aP-43@gated-at.bofh.it>
X-Original-To Philipp Zabel <p.zabel@pengutronix.de>
Dkim-Filter OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com u7OCTK5w029661
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1472041761; bh=A//SM+OHZ2AucYeUGAKZ52UnZVymRJLHToGe0k9GeiI=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=KzueHGCryVxvJDloKiomK370TBg+rXiinOtg4bsKeyQyhbUDNyvjuMqKv8TNTySHp hyq4SgOXdMFBhQyc7bUYeYolt8MYcaLSY7dL4d6jZNBIL+Q/0kMnwdg6zyJEiXektW kKBZZoxmrDtM/rf6IdVmvJ+fbD72Ovb8skNSq+a8a9yZBIZ0HGXKA4UaDzP1zJ8dn+ MwTYfkndobB7e3DtZaR6xgXs7Dj/V0Fypqx2D5zqjqDdWR6kniQstiPKJ5AdeWAl/m 5hbdSAn6bHm656shKlkH/mXc+7+66sFD3t7FsEWLFFT0gZ3wYulX67J6eOmypOPxax iDqDNUVZ5Q1HQ==
X-Nifty-Srcip [209.85.213.176]
X-Gm-Message-State AEkoouvD5EP44ANbxcB2i2CJJpKvye+RWj2rHAHAcv7+eMXHSMujGQBPJEbuVwX/F6dQpRC1UsFxRX4+A+lEVA==
X-Received by 10.37.96.69 with SMTP id u66mr2153489ybb.7.1472041760361; Wed, 24 Aug 2016 05:29:20 -0700 (PDT)
MIME-Version 1.0
X-Gmail-Original-Message-ID <CAK7LNASCtZNMdSO33z5K1jPac_DPTnt3aUaC+CCNrrUdm_hq9w@mail.gmail.com>
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 62
Organization linux.* mail to news gateway
X-Original-Cc Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
X-Original-Date Wed, 24 Aug 2016 21:29:19 +0900
X-Original-Message-ID <CAK7LNASCtZNMdSO33z5K1jPac_DPTnt3aUaC+CCNrrUdm_hq9w@mail.gmail.com>
X-Original-References <1472020830-16059-1-git-send-email-yamada.masahiro@socionext.com> <1472020830-16059-3-git-send-email-yamada.masahiro@socionext.com> <1472041622.5335.32.camel@pengutronix.de>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1469385

Show key headers only | View raw


Hi Philipp,

2016-08-24 21:27 GMT+09:00 Philipp Zabel <p.zabel@pengutronix.de>:
> Hi Masahiro,
>
> Am Mittwoch, den 24.08.2016, 15:40 +0900 schrieb Masahiro Yamada:
>> Use of_device_get_match_data() instead of of_match_node().  With
>> this, we can retrieve the .data field of the OF match table more
>> easily.  No more need to define (or declare) the match table before
>> the probe callback.  I prefer to collect boilerplates at the bottom
>> of the file, so moved it below.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>  drivers/reset/reset-uniphier.c | 81 +++++++++++++++++++++---------------------
>>  1 file changed, 40 insertions(+), 41 deletions(-)
>>
>> diff --git a/drivers/reset/reset-uniphier.c b/drivers/reset/reset-uniphier.c
>> index 41c62af..9b3f2cd 100644
>> --- a/drivers/reset/reset-uniphier.c
>> +++ b/drivers/reset/reset-uniphier.c
>> @@ -16,6 +16,7 @@
>>  #include <linux/mfd/syscon.h>
>>  #include <linux/module.h>
>>  #include <linux/of.h>
>> +#include <linux/of_device.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/regmap.h>
>>  #include <linux/reset-controller.h>
>> @@ -285,6 +286,45 @@ static const struct reset_control_ops uniphier_reset_ops = {
>>       .status = uniphier_reset_status,
>>  };
>>
>> +static int uniphier_reset_probe(struct platform_device *pdev)
>> +{
>> +     struct device *dev = &pdev->dev;
>> +     struct uniphier_reset_priv *priv;
>> +     const struct uniphier_reset_data *p, *data;
>> +     struct regmap *regmap;
>> +     struct device_node *parent;
>> +     unsigned int nr_resets = 0;
>> +
>> +     data = of_device_get_match_data(dev);
>> +     WARN_ON(!data);
>
> I know right now this can't happen anyway, but you did return -EINVAL
> here before. Maybe use:
>
>         if (WARN_ON(!data))
>                 return -EINVAL;
>
> instead? I can fix it up if you agree.

I agree.

Please fix it up.  Thanks!


-- 
Best Regards
Masahiro Yamada

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] reset: uniphier: use of_device_get_match_data() to get matched data Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-08-24 08:40 +0200
  Re: [PATCH 2/2] reset: uniphier: use of_device_get_match_data() to  get matched data Philipp Zabel <p.zabel@pengutronix.de> - 2016-08-24 14:30 +0200
    Re: [PATCH 2/2] reset: uniphier: use of_device_get_match_data() to  get matched data Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-08-24 14:40 +0200
      Re: [PATCH 2/2] reset: uniphier: use of_device_get_match_data() to  get matched data Philipp Zabel <p.zabel@pengutronix.de> - 2016-08-24 15:40 +0200

csiph-web