[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8fyonSp49QoAb8v@smile.fi.intel.com>
Date: Wed, 18 Jan 2023 15:22:42 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Marijn Suijten <marijn.suijten@...ainline.org>
Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Nuno Sá <nuno.sa@...log.com>,
linux-arm-msm@...r.kernel.org, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>
Subject: Re: [PATCH v2 1/1] iio: adc: qcom-spmi-adc5: Fix the channel name
On Wed, Jan 18, 2023 at 01:35:28PM +0100, Marijn Suijten wrote:
> On 2023-01-18 12:06:23, Andy Shevchenko wrote:
> > The node name can contain an address part which is unused
> > by the driver. Moreover, this string is propagated into
> > the userspace label, sysfs filenames *and breaking ABI*.
> >
> > Cut the address part out before assigning the channel name.
> >
> > Fixes: 4f47a236a23d ("iio: adc: qcom-spmi-adc5: convert to device properties")
> > Reported-by: Marijn Suijten <marijn.suijten@...ainline.org>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>
> Reviewed-by: Marijn Suijten <marijn.suijten@...ainline.org>
Thank you!
My answers below.
...
> > + name = devm_kasprintf(dev, GFP_KERNEL, "%pfwP", fwnode);
>
> Is this better/cleaner than copying the string from fwnode_get_name?
Coying to where? And what would be the lifetime of that string?
With devm_kasprintf():
- we don't care how long the string is
- we don't care about corner cases of lifetime as it's the same as
device itself (i.o.w. the same as the IIO device container)
...
> > + name[strchrnul(name, '@') - name] = '\0';
>
> This is the same as *strchrnul(name, '@') = '\0'; if I'm not mistaken.
Yes, But it's harder to read and understand. I believe the compiler has
enough power to optimize this to the same assembly code.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists