Re: [PATCH 02/14] soundwire: Add SoundWire bus type
From: Vinod Koul
Date: Fri Oct 20 2017 - 11:42:38 EST
On Fri, Oct 20, 2017 at 08:59:42AM +0200, Takashi Iwai wrote:
> On Fri, 20 Oct 2017 07:11:01 +0200,
> Vinod Koul wrote:
> >
> > On Thu, Oct 19, 2017 at 09:40:06AM +0200, Takashi Iwai wrote:
> > > On Thu, 19 Oct 2017 05:03:18 +0200,
> > > Vinod Koul wrote:
> > > > +
> > > > +config SOUNDWIRE_BUS
> > > > + tristate
> > > > + default SOUNDWIRE
> > > > +
> > >
> > > Does it make sense to be tristate?
> > > Since CONFIG_SOUNDWIRE is a bool, the above would be also only either
> > > Y or N. If it's Y and others select M, it'll be still Y.
> >
> > hmmm good point. I think would make sense to make SOUNDWIRE as tristate too,
> > just like SOUND :)
>
> It's one option. Another would be to simply drop the "default" line.
Okay good suggestion
> > > > + * The match is done by comparing the mfg_id and part_id from the
> > > > + * struct sdw_device_id. class_id is unused, as it is a placeholder
> > > > + * in MIPI Spec.
> > > > + */
> > > > +static const struct sdw_device_id *
> > > > +sdw_get_device_id(struct sdw_slave *slave, struct sdw_driver *drv)
> > > > +{
> > > > + const struct sdw_device_id *id = drv->id_table;
> > > > +
> > > > + while (id && id->mfg_id) {
> > > > + if (slave->id.mfg_id == id->mfg_id &&
> > > > + slave->id.part_id == id->part_id) {
> > >
> > > Please indentation properly.
> >
> > what do you advise?
> >
> > if (slave->id.mfg_id == id->mfg_id &&
> > slave->id.part_id == id->part_id) {
> >
> > would mean below one is at same indent. Some people use:
> >
> > if (slave->id.mfg_id == id->mfg_id &&
> > slave->id.part_id == id->part_id) {
> >
> > Is it Documented anywhere...
>
> This is a matter of taste. The latter is the way Emacs or indent does
> as default.
okay as vi user I will try to do above :)
>
> > > > --- a/include/linux/mod_devicetable.h
> > > > +++ b/include/linux/mod_devicetable.h
> > > > @@ -228,6 +228,13 @@ struct hda_device_id {
> > > > unsigned long driver_data;
> > > > };
> > > >
> > > > +struct sdw_device_id {
> > > > + __u16 mfg_id;
> > > > + __u16 part_id;
> > > > + __u8 class_id;
> > > > + kernel_ulong_t driver_data;
> > >
> > > Better to think of alignment.
> >
> > sorry not quite clear, do you mind elaborating which ones to align?
>
> kernel_ulong_t may be aligned to 4 or 8 bytes, depending on
> architecture, so there can be a hole between class_id and driver_data.
> It's not an ABI, so we don't have to care too much, but it's still
> something exposed, hence better to be conscious about alignment.
ah :) is that why hda is unsigned long :) Btw doesnt that cause compat
issues, should we not do something like u64 here?
--
~Vinod