linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	Florian Fainelli <f.fainelli@gmail.com>, <netdev@vger.kernel.org>
Cc: <davinci-linux-open-source@linux.davincidsp.com>,
	<linux-doc@vger.kernel.org>, Randy Dunlap <rdunlap@infradead.org>,
	<linux-kernel@vger.kernel.org>, <santosh.shilimkar@ti.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH 1/2] mdio_bus: implement devm_mdiobus_alloc/devm_mdiobus_free
Date: Tue, 8 Apr 2014 12:52:05 +0300	[thread overview]
Message-ID: <5343C6C5.2050502@ti.com> (raw)
In-Reply-To: <533EB077.6000005@cogentembedded.com>

On 04/04/2014 04:15 PM, Sergei Shtylyov wrote:
> Hello.
>
> On 04-04-2014 17:40, Grygorii Strashko wrote:
>
>> Add a resource managed devm_mdiobus_alloc()/devm_mdiobus_free()
>> to automatically clean up MDIO bus alocations made by MDIO drivers,
>> thus leading to simplified MDIO drivers code.
>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> [...]
>
>> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
>> index 76f54b3..fdcd6d1 100644
>> --- a/drivers/net/phy/mdio_bus.c
>> +++ b/drivers/net/phy/mdio_bus.c
>> @@ -69,6 +69,74 @@ struct mii_bus *mdiobus_alloc_size(size_t size)
>>   }
>>   EXPORT_SYMBOL(mdiobus_alloc_size);
>>
>> +static void _devm_mdiobus_free(struct device *dev, void *res)
>> +{
>> +    mdiobus_free(*(struct mii_bus **)res);
>> +}
>> +
>> +static int devm_mdiobus_match(struct device *dev, void *res, void *data)
>> +{
>> +    struct mii_bus **r = res;
>
>     Please insert an empty line after declaration.
>
>> +    if (!r || !*r) {
>> +        WARN_ON(!r || !*r);
>
>     Hm, why we need the duplicate check This condition is always true.

It can be replaced with:
	if (WARN_ON(!r || !*r))
		return 0;


I will wait for additional comments, then resend.

Regards,
- grygorii


  reply	other threads:[~2014-04-08  9:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04 13:40 [PATCH 0/2] introduce devm_mdiobus_alloc/devm_mdiobus_free Grygorii Strashko
2014-04-04 13:40 ` [PATCH 1/2] mdio_bus: implement devm_mdiobus_alloc/devm_mdiobus_free Grygorii Strashko
2014-04-04 13:15   ` Sergei Shtylyov
2014-04-08  9:52     ` Grygorii Strashko [this message]
2014-04-04 13:40 ` [PATCH 2/2] net: davinci_mdio: use devm_* api Grygorii Strashko
2014-04-04 13:18   ` Sergei Shtylyov
2014-04-11  4:55 ` [PATCH 0/2] introduce devm_mdiobus_alloc/devm_mdiobus_free Florian Fainelli
2014-04-11 11:05   ` Grygorii Strashko

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=5343C6C5.2050502@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=davem@davemloft.net \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=f.fainelli@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=santosh.shilimkar@ti.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    /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 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).