RE: [PATCH v5 7/9] platform/x86: serial-multi-instantiate: Add SPI support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Alsa-devel <alsa-devel-bounces@xxxxxxxxxxxxxxxx> On Behalf Of
> Rafael J. Wysocki
> Sent: 21 January 2022 17:15
> To: Stefan Binding <sbinding@xxxxxxxxxxxxxxxxxxxxx>
> Cc: Platform Driver <platform-driver-x86@xxxxxxxxxxxxxxx>; moderated
> list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM... <alsa-
> devel@xxxxxxxxxxxxxxxx>; ACPI Devel Maling List <linux-
> acpi@xxxxxxxxxxxxxxx>; Rafael J. Wysocki <rafael@xxxxxxxxxx>; Linux Kernel
> Mailing List <linux-kernel@xxxxxxxxxxxxxxx>; Takashi Iwai <tiwai@xxxxxxxx>;
> Mark Gross <markgross@xxxxxxxxxx>; Hans de Goede
> <hdegoede@xxxxxxxxxx>; Mark Brown <broonie@xxxxxxxxxx>;
> patches@xxxxxxxxxxxxxxxxxxxxx; linux-spi <linux-spi@xxxxxxxxxxxxxxx>; Len
> Brown <lenb@xxxxxxxxxx>
> Subject: Re: [PATCH v5 7/9] platform/x86: serial-multi-instantiate: Add SPI
> support


> 
> > > > @@ -146,7 +247,21 @@ static int smi_probe(struct platform_device
> *pdev)
> > > >
> > > >         platform_set_drvdata(pdev, smi);
> > > >
> > > > -       return smi_i2c_probe(pdev, adev, smi, inst_array);
> > > > +       switch (node->bus_type) {
> > > > +       case SMI_I2C:
> > > > +               return smi_i2c_probe(pdev, adev, smi, node->instances);
> > > > +       case SMI_SPI:
> > > > +               return smi_spi_probe(pdev, adev, smi, node->instances);
> > > > +       case SMI_AUTO_DETECT:
> > > > +               if (i2c_acpi_client_count(adev) > 0)
> > > > +                       return smi_i2c_probe(pdev, adev, smi, node->instances);
> > > > +               else
> > > > +                       return smi_spi_probe(pdev, adev, smi, node->instances);
> > > > +       default:
> > > > +               break;
> > >
> > > Why is this needed?
> >
> > This return code is attempting to ensure that we don’t try to guess
> whether we
> > expect devices to be I2C or SPI - especially with regards to existing devices.
> > We wanted to maintain compatibility with existing devices, which would all
> be
> > I2C.
> > For the device for which we are adding, the same HID is used by both the
> same
> > chip for both I2C and SPI, so we also needed a way to support both.
> 
> I meant why was the "default" case needed.  Sorry for the confusion.

I added a default case here purely for static analysis reasons. I don’t think it necessarily required, and I can remove it if necessary.

Thanks,
Stefan





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux