linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Binding <sbinding@opensource.cirrus.com>
To: "'Rafael J. Wysocki'" <rafael@kernel.org>
Cc: 'Platform Driver' <platform-driver-x86@vger.kernel.org>,
	"'moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER
	MANAGEM...'"  <alsa-devel@alsa-project.org>,
	'ACPI Devel Maling List' <linux-acpi@vger.kernel.org>,
	'Linux Kernel Mailing List' <linux-kernel@vger.kernel.org>,
	'Takashi Iwai' <tiwai@suse.com>,
	'Mark Gross' <markgross@kernel.org>,
	'Hans de Goede' <hdegoede@redhat.com>,
	'Mark Brown' <broonie@kernel.org>,
	<patches@opensource.cirrus.com>,
	'linux-spi' <linux-spi@vger.kernel.org>,
	'Len Brown' <lenb@kernel.org>
Subject: RE: [PATCH v5 7/9] platform/x86: serial-multi-instantiate: Add SPI support
Date: Wed, 26 Jan 2022 15:19:05 +0000	[thread overview]
Message-ID: <005d01d812c8$0ea9ae30$2bfd0a90$@opensource.cirrus.com> (raw)
In-Reply-To: <CAJZ5v0j+DkX+-P1XxZ=HAnUzPjdkNFkXRTjJzhSH27KfDFAGDQ@mail.gmail.com>



> -----Original Message-----
> From: Alsa-devel <alsa-devel-bounces@alsa-project.org> On Behalf Of
> Rafael J. Wysocki
> Sent: 21 January 2022 17:15
> To: Stefan Binding <sbinding@opensource.cirrus.com>
> Cc: Platform Driver <platform-driver-x86@vger.kernel.org>; moderated
> list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM... <alsa-
> devel@alsa-project.org>; ACPI Devel Maling List <linux-
> acpi@vger.kernel.org>; Rafael J. Wysocki <rafael@kernel.org>; Linux Kernel
> Mailing List <linux-kernel@vger.kernel.org>; Takashi Iwai <tiwai@suse.com>;
> Mark Gross <markgross@kernel.org>; Hans de Goede
> <hdegoede@redhat.com>; Mark Brown <broonie@kernel.org>;
> patches@opensource.cirrus.com; linux-spi <linux-spi@vger.kernel.org>; Len
> Brown <lenb@kernel.org>
> 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


  reply	other threads:[~2022-01-26 15:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 14:32 [PATCH v5 0/9] Support Spi in i2c-multi-instantiate driver Stefan Binding
2022-01-21 14:32 ` [PATCH v5 1/9] spi: Make spi_alloc_device and spi_add_device public again Stefan Binding
2022-01-21 14:32 ` [PATCH v5 2/9] spi: Create helper API to lookup ACPI info for spi device Stefan Binding
2022-01-21 14:32 ` [PATCH v5 3/9] spi: Support selection of the index of the ACPI Spi Resource before alloc Stefan Binding
2022-01-21 14:32 ` [PATCH v5 4/9] spi: Add API to count spi acpi resources Stefan Binding
2022-01-21 14:32 ` [PATCH v5 5/9] platform/x86: i2c-multi-instantiate: Rename it for a generic serial driver name Stefan Binding
2022-01-21 15:12   ` Rafael J. Wysocki
2022-01-21 14:32 ` [PATCH v5 6/9] platform/x86: serial-multi-instantiate: Reorganize I2C functions Stefan Binding
2022-01-21 15:27   ` Rafael J. Wysocki
2022-01-21 14:32 ` [PATCH v5 7/9] platform/x86: serial-multi-instantiate: Add SPI support Stefan Binding
2022-01-21 15:31   ` Rafael J. Wysocki
2022-01-21 16:55     ` Stefan Binding
2022-01-21 17:14       ` Rafael J. Wysocki
2022-01-26 15:19         ` Stefan Binding [this message]
2022-01-21 14:32 ` [PATCH v5 8/9] ALSA: hda/realtek: Add support for HP Laptops Stefan Binding
2022-01-21 14:44   ` Takashi Iwai
2022-01-21 14:32 ` [PATCH v5 9/9] ACPI / scan: Create platform device for CS35L41 Stefan Binding
2022-01-21 16:02   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='005d01d812c8$0ea9ae30$2bfd0a90$@opensource.cirrus.com' \
    --to=sbinding@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).