[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZC2OOWBEUEv7RiiK@smile.fi.intel.com>
Date: Wed, 5 Apr 2023 18:05:29 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Chanwoo Choi <cwchoi00@...il.com>
Cc: Bumwoo Lee <bw365.lee@...sung.com>, linux-kernel@...r.kernel.org,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>
Subject: Re: [PATCH v1 08/14] extcon: Switch to use kasprintf_strarray()
On Wed, Apr 05, 2023 at 11:16:36AM +0300, Andy Shevchenko wrote:
> On Mon, Apr 03, 2023 at 11:58:41PM +0900, Chanwoo Choi wrote:
> > On 23. 3. 22. 23:39, Andy Shevchenko wrote:
> > > Since we have a generic helper, switch the module to use it.
> > > No functional change intended.
...
> > > + edev->cable_names = kasprintf_strarray(GFP_KERNEL, "cable", edev->max_supported);
> > > + if (!edev->cable_names) {
> > > + kfree(edev->cables);
> > > + return -ENOMEM;
> > > + }
> > > +
> > > for (index = 0; index < edev->max_supported; index++) {
> > > cable = &edev->cables[index];
> > >
>
> > > + str = edev->cable_names[index];
> > > + strreplace(str, '-', '.');
> > >
> > > cable->edev = edev;
> > > cable->cable_index = index;
>
> ...
>
> > > /* /sys/class/extcon/.../cable.n/... */
> > > struct device_type extcon_dev_type;
> > > struct extcon_cable *cables;
> > > + char **cable_names;
> >
> > The extcon cable information should be included in struct extcon_cable
> > in order to gather information into one point like encapsulation.
> >
> > I don't prefer to add 'cable_names'.
>
> I don't get this. The idea is to allocate the cable names in one call,
> we have already API for that. The cable names are kept in the struct
> extcon_cable as before. So, functionally it doesn't change anything,
> it is a simple cleanup.
Okay, I see now your point. I can redo this a bit better I think.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists