From: Guenter Roeck <linux@roeck-us.net>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Jean Delvare <jdelvare@suse.com>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: lm70: simplify with spi_get_device_match_data()
Date: Thu, 6 Jun 2024 08:56:25 -0700 [thread overview]
Message-ID: <32a542a9-e338-4f8a-af24-a32c8426e619@roeck-us.net> (raw)
In-Reply-To: <20240606142515.132504-1-krzysztof.kozlowski@linaro.org>
On 6/6/24 07:25, Krzysztof Kozlowski wrote:
> Use spi_get_device_match_data() helper to simplify a bit the driver.
> Also kernel_ulong_t type is preferred for kernel code over uintptr_t
> (needed for the cast).
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> drivers/hwmon/lm70.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
> index 481e4e1f8f4f..0d5a250cb672 100644
> --- a/drivers/hwmon/lm70.c
> +++ b/drivers/hwmon/lm70.c
> @@ -169,11 +169,7 @@ static int lm70_probe(struct spi_device *spi)
> struct lm70 *p_lm70;
> int chip;
>
> - if (dev_fwnode(&spi->dev))
> - chip = (int)(uintptr_t)device_get_match_data(&spi->dev);
> - else
> - chip = spi_get_device_id(spi)->driver_data;
> -
> + chip = (kernel_ulong_t)spi_get_device_match_data(spi);
>
> /* signaling is SPI_MODE_0 */
> if ((spi->mode & SPI_MODE_X_MASK) != SPI_MODE_0)
I'll apply this patch, but ...
I take it that the earlier claims that driver_data must not be
something like "(void *) LM70_CHIP_LM70", where LM70_CHIP_LM70 is 0,
was wrong. I'll start reverting all patches which changed starting
enum values from 0 to 1 based on that wrong claim.
Guenter
next prev parent reply other threads:[~2024-06-06 15:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 14:25 Krzysztof Kozlowski
2024-06-06 15:56 ` Guenter Roeck [this message]
2024-06-07 6:53 ` Krzysztof Kozlowski
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=32a542a9-e338-4f8a-af24-a32c8426e619@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®