[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201130191856.GX4077@smile.fi.intel.com>
Date: Mon, 30 Nov 2020 21:18:56 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: Daniel Scally <djrscally@...il.com>, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-media@...r.kernel.org,
devel@...ica.org, rjw@...ysocki.net, lenb@...nel.org,
gregkh@...uxfoundation.org, mika.westerberg@...ux.intel.com,
linus.walleij@...aro.org, bgolaszewski@...libre.com,
wsa@...nel.org, yong.zhi@...el.com, sakari.ailus@...ux.intel.com,
bingbu.cao@...el.com, tian.shu.qiu@...el.com, mchehab@...nel.org,
robert.moore@...el.com, erik.kaneda@...el.com, pmladek@...e.com,
rostedt@...dmis.org, sergey.senozhatsky@...il.com,
linux@...musvillemoes.dk, kieran.bingham+renesas@...asonboard.com,
jacopo+renesas@...ndi.org,
laurent.pinchart+renesas@...asonboard.com,
jorhand@...ux.microsoft.com, kitakar@...il.com,
heikki.krogerus@...ux.intel.com
Subject: Re: [PATCH 16/18] i2c: i2c-core-base: Use the new
i2c_acpi_dev_name() in i2c_set_dev_name()
On Mon, Nov 30, 2020 at 07:12:41PM +0200, Laurent Pinchart wrote:
> On Mon, Nov 30, 2020 at 01:31:27PM +0000, Daniel Scally wrote:
> > From: Dan Scally <djrscally@...il.com>
> >
> > To make sure the new i2c_acpi_dev_name() always reflects the name of i2c
> > devices sourced from ACPI, use it in i2c_set_dev_name().
> >
> > Signed-off-by: Dan Scally <djrscally@...il.com>
>
> I'd squash this with 15/18, which would make it clear there's a memory
> leak :-)
...
> > if (adev) {
> > - dev_set_name(&client->dev, "i2c-%s", acpi_dev_name(adev));
> > + dev_set_name(&client->dev, i2c_acpi_dev_name(adev));
> > return;
But you split pattern used in i2c_dev_set_name().
What you need is to provide something like this
#define I2C_DEV_NAME_FORMAT "i2c-%s"
const char *i2c_acpi_get_dev_name(...)
{
return kasprintf(..., I2C_DEV_NAME_FORMAT, ...);
}
(Possible in the future if anybody needs
const char *i2c_dev_get_name_by_bus_and_addr(int bus, unsigned short addr)
)
And here
- dev_set_name(&client->dev, "i2c-%s", info->dev_name);
+ dev_set_name(&client->dev, I2C_DEV_NAME_FORMAT, info->dev_name);
- dev_set_name(&client->dev, "i2c-%s", acpi_dev_name(adev));
+ dev_set_name(&client->dev, I2C_DEV_NAME_FORMAT, acpi_dev_name(adev));
--
With Best Regards,
Andy Shevchenko;
Powered by blists - more mailing lists