netdev.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: Randy Dunlap <rdunlap@infradead.org>,
	Jonathan Cameron <jic23@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	<prabhakar.csengg@gmail.com>, <santosh.shilimkar@ti.com>,
	Sekhar Nori <nsekhar@ti.com>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<davinci-linux-open-source@linux.davincidsp.com>
Subject: Re: [PATCH v2 1/4] mdio_bus: implement devm_mdiobus_alloc/devm_mdiobus_free
Date: Wed, 30 Apr 2014 15:25:52 +0300	[thread overview]
Message-ID: <5360EBD0.80704@ti.com> (raw)
In-Reply-To: <53516650.3000405@cogentembedded.com>

On 04/18/2014 08:52 PM, Sergei Shtylyov wrote:
> On 04/18/2014 09:24 PM, 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.
> 
>> Cc: Florian Fainelli <f.fainelli@gmail.com>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> [...]
> 
>> index 76f54b3..6412beb 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)
> [...]
>> +/**
>> + * devm_mdiobus_alloc - Resource-managed mdiobus_alloc_size()
>> + * @dev:        Device to allocate mii_bus for
>> + * @sizeof_priv:    Space to allocate for private structure.
>> + *
>> + * Managed mdiobus_alloc_size. mii_bus allocated with this function is
>> + * automatically freed on driver detach.
>> + *
>> + * If an mii_bus allocated with this function needs to be freed 
>> separately,
>> + * devm_mdiobus_free() must be used.
>> + *
>> + * RETURNS:
>> + * Pointer to allocated mii_bus on success, NULL on failure.
>> + */
>> +struct mii_bus *devm_mdiobus_alloc(struct device *dev, int sizeof_priv)
>> +{
>> +    struct mii_bus **ptr, *bus;
>> +
>> +    ptr = devres_alloc(_devm_mdiobus_free, sizeof(*ptr),
>> +               GFP_KERNEL);
>> +    if (!ptr)
>> +        return NULL;
>> +
>> +    /* use raw alloc_dr for kmalloc caller tracing */
>> +    bus = mdiobus_alloc_size(sizeof_priv);
> 
>     Since the wrapped function is called mdiobus_alloc_size(), not 
> mdiobus_alloc(), perhaps it's better to call the wrapper 
> devm_mdiobus_alloc_size()?

Agree. I've just sent v3.

Regards,
-grygorii


  reply	other threads:[~2014-04-30 12:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-18 17:24 [PATCH v2 0/4] introduce devm_mdiobus_alloc/free and clean up davinci mdio Grygorii Strashko
     [not found] ` <1397841897-9170-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-04-18 17:24   ` [PATCH v2 1/4] mdio_bus: implement devm_mdiobus_alloc/devm_mdiobus_free Grygorii Strashko
2014-04-18 17:48     ` Sergei Shtylyov
2014-04-18 17:52     ` Sergei Shtylyov
2014-04-30 12:25       ` Grygorii Strashko [this message]
2014-04-18 17:24   ` [PATCH v2 2/4] net: davinci_mdio: use devm_* api Grygorii Strashko
2014-04-18 17:24 ` [PATCH v2 3/4] net: davinci_mdio: drop pinctrl_pm_select_default_state from probe Grygorii Strashko
2014-04-18 17:24 ` [PATCH 4/4] net: davinci_mdio: simplify IO memory mapping Grygorii Strashko
2014-04-19 12:32 ` [PATCH v2 0/4] introduce devm_mdiobus_alloc/free and clean up davinci mdio Prabhakar Lad

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=5360EBD0.80704@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=nsekhar@ti.com \
    --cc=prabhakar.csengg@gmail.com \
    --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).