Linux kernel staging patches
 help / color / mirror / Atom feed
From: Supreet Singh <singh.supreet14@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Viresh Kumar <vireshk@kernel.org>,
	Rui Miguel Silva <rmfrfs@gmail.com>,
	 Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
	greybus-dev@lists.linaro.org,  linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] staging: greybus: spilib: Handle SPI device types with a switch statement
Date: Tue, 1 Sep 2026 17:01:28 +0530	[thread overview]
Message-ID: <apa3N5Z7VCWMSZju@dio> (raw)
In-Reply-To: <2026090143-skincare-slacks-540b@gregkh>

Understandable. Thanks for your time and review.

Thanks
Supreet

On Tue, Sep 01, 2026 at 11:44:26AM +0200, Greg Kroah-Hartman wrote:
> On Fri, Aug 07, 2026 at 12:45:42PM +0530, singh.supreet14@gmail.com wrote:
> > From: Supreet Singh <singh.supreet14@gmail.com>
> > 
> > Replace the if/else chain that selects the SPI device type with a switch
> > statement. This makes the code easier to extend when additional device
> > types are introduced and improves readability.
> 
> But let's deal with that when it happens, you are adding more code here
> than removing:
> 
> > 
> > Signed-off-by: Supreet Singh <singh.supreet14@gmail.com>
> > ---
> > Changes in v3:
> > - Fixed the memcpy indentation issue
> > - Removed the extra blank line in the commit message
> > 
> >  drivers/staging/greybus/spilib.c | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> So it's not really a benefit overall, right?
> 
> > 
> > diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c
> > index e4d1ae8308aa..39d5bf234c61 100644
> > --- a/drivers/staging/greybus/spilib.c
> > +++ b/drivers/staging/greybus/spilib.c
> > @@ -458,17 +458,22 @@ static int gb_spi_setup_device(struct gb_spilib *spi, u8 cs)
> >  
> >  	dev_type = response.device_type;
> >  
> > -	if (dev_type == GB_SPI_SPI_DEV)
> > +	switch (dev_type) {
> > +	case GB_SPI_SPI_DEV:
> >  		strscpy(spi_board.modalias, "spidev",
> >  			sizeof(spi_board.modalias));
> > -	else if (dev_type == GB_SPI_SPI_NOR)
> > +		break;
> > +	case GB_SPI_SPI_NOR:
> >  		strscpy(spi_board.modalias, "spi-nor",
> >  			sizeof(spi_board.modalias));
> > -	else if (dev_type == GB_SPI_SPI_MODALIAS)
> > +		break;
> > +	case GB_SPI_SPI_MODALIAS:
> >  		memcpy(spi_board.modalias, response.name,
> >  		       sizeof(spi_board.modalias));
> > -	else
> > +		break;
> > +	default:
> >  		return -EINVAL;
> > +	}
> 
> thanks,
> 
> greg k-h

      reply	other threads:[~2026-09-01 11:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 11:19 [PATCH] staging: greybus: spilib: Handle SPI device types with a switch statement singh.supreet14
2026-08-05 11:28 ` Greg Kroah-Hartman
2026-08-05 12:19   ` Supreet Singh
2026-08-06 10:11 ` [PATCH v2] " singh.supreet14
2026-08-06 15:46   ` Dan Carpenter
2026-08-07  7:15   ` [PATCH v3] " singh.supreet14
2026-09-01  9:44     ` Greg Kroah-Hartman
2026-09-01 11:31       ` Supreet Singh [this message]

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=apa3N5Z7VCWMSZju@dio \
    --to=singh.supreet14@gmail.com \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=rmfrfs@gmail.com \
    --cc=vireshk@kernel.org \
    /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