From: "Sverdlin, Alexander" <alexander.sverdlin@siemens.com>
To: "linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
"andriy.shevchenko@linux.intel.com"
<andriy.shevchenko@linux.intel.com>,
"broonie@kernel.org" <broonie@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "lukas@wunner.de" <lukas@wunner.de>
Subject: Re: [PATCH v1 3/3] spidev: Simplify SPI_IOC_RD_MODE* cases in spidev_ioctl()
Date: Fri, 25 Aug 2023 07:17:42 +0000 [thread overview]
Message-ID: <fd0b4e1736a46a427d980a703fb99b9205bc4f84.camel@siemens.com> (raw)
In-Reply-To: <20230824162209.2890440-4-andriy.shevchenko@linux.intel.com>
Hi!
On Thu, 2023-08-24 at 19:22 +0300, Andy Shevchenko wrote:
> The temporary variable tmp is not used outside of the
> SPI_IOC_RD_MODE* cases, hence we can optimize its use.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
> drivers/spi/spidev.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
> index e324b42c658c..c5450217528b 100644
> --- a/drivers/spi/spidev.c
> +++ b/drivers/spi/spidev.c
> @@ -391,17 +391,15 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> /* read requests */
> case SPI_IOC_RD_MODE:
> case SPI_IOC_RD_MODE32:
> - tmp = spi->mode;
> + tmp = spi->mode & SPI_MODE_MASK;
>
> if (ctlr->use_gpio_descriptors && spi_get_csgpiod(spi, 0))
> tmp &= ~SPI_CS_HIGH;
>
> if (cmd == SPI_IOC_RD_MODE)
> - retval = put_user(tmp & SPI_MODE_MASK,
> - (__u8 __user *)arg);
> + retval = put_user(tmp, (__u8 __user *)arg);
> else
> - retval = put_user(tmp & SPI_MODE_MASK,
> - (__u32 __user *)arg);
> + retval = put_user(tmp, (__u32 __user *)arg);
> break;
> case SPI_IOC_RD_LSB_FIRST:
> retval = put_user((spi->mode & SPI_LSB_FIRST) ? 1 : 0,
--
Alexander Sverdlin
Siemens AG
www.siemens.com
next prev parent reply other threads:[~2023-08-25 7:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 16:22 [PATCH v1 0/3] spidev: A few cleanups Andy Shevchenko
2023-08-24 16:22 ` [PATCH v1 1/3] spidev: Decrease indentation level in spidev_ioctl() SPI_IOC_RD_MODE* Andy Shevchenko
2023-08-25 7:17 ` Sverdlin, Alexander
2023-08-24 16:22 ` [PATCH v1 2/3] spidev: Switch to use spi_get_csgpiod() Andy Shevchenko
2023-08-25 7:17 ` Sverdlin, Alexander
2023-08-24 16:22 ` [PATCH v1 3/3] spidev: Simplify SPI_IOC_RD_MODE* cases in spidev_ioctl() Andy Shevchenko
2023-08-25 7:17 ` Sverdlin, Alexander [this message]
2023-09-12 11:37 ` [PATCH v1 0/3] spidev: A few cleanups Mark Brown
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=fd0b4e1736a46a427d980a703fb99b9205bc4f84.camel@siemens.com \
--to=alexander.sverdlin@siemens.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=lukas@wunner.de \
/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).