Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp854624lqt; Thu, 6 Jun 2024 23:54:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUOMCpLNr0ekCIqHLPGs3YKIfj0V0A8UxfY5f1P4Be+2NDBCd99+BzB4LpDW2iCrrYhpi3n4PY6BR7+gDUoRbyQ7efa0n82dd3nE7Y2Ew== X-Google-Smtp-Source: AGHT+IGP3tjHVYSP6g2MPjYNa4eUw/2xYbxZzRqk3Jf8W3ko73jXccSNzRU3fx3uDawlgFZukNu7 X-Received: by 2002:a05:622a:2ca:b0:43b:6fb:8bfd with SMTP id d75a77b69052e-44041c5227bmr20516791cf.20.1717743271259; Thu, 06 Jun 2024 23:54:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717743271; cv=pass; d=google.com; s=arc-20160816; b=pDG7cyBU3ofP//LpoBpzGKtKWfYck3rqt8iACEdxoP/t6X7sjWkxB6/9f5tyfuiA8/ 6uRhWRAFGkR47fhFm0vYV1A50O42n5ilBvhWaU4xS31lccNfj5PmitvTLLy8Uf2QrTS5 0lsLbuX+IYcfG7ER92ElB5D6Ls7ZvMiun100hoaxdx21Ap/wPifcC8G762FRnD8/F6Iy pzbuWQDS6hAKeib01nY3W1MjPDWF/ZlXUMVNJeqywCtKo60TbF1IERx/PGZssdtYBKIN Hv81FA6G3LrtO99eq4NgnCHTJigga9s7BbhPpowd8KTnkc/U3rIUibR5p7gta45DpQX2 0muQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=6oy9paXt3y1M6rnKNIikFuvNbwWD5iuAyif14OquD/E=; fh=rN2tC/WQQTO2zKvFX4iu4U1RgiN261kdq+9JD2xGcUM=; b=AoiALU6UfPjOw1TeHHokwAnWAIOqseztnZqjBDE04XrZZH7eYIVqJD77oCAtWzYOnH L+Gzkx0KM/zQ78NJBT4dY7UVmJS0dpUlTzDn/XFOLj71uxjyxIoD5b9TuRpNm7Ej0xOY 5cRKt2MFmp4RVBrcLT0SsEd2+vJDbIHXxJaDbqrQKEJ7QQnP+eQWihvHMCbti8Di8KqI aRGVKqn0mXrOau1fSicREt9SQoXbx3iSx1Eq8BDs4QSatJJe2wH5I6kPfMD6mQIRy8I0 RBRgS5YRC/y3DkVdOXG8TclUsbExZ6xivcYcqwpLsbiZ4/JUZjicjtbCBKY+2+ZDLxTL csSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fsvoWktV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-205468-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205468-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44038b61c18si33596811cf.586.2024.06.06.23.54.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 23:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205468-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fsvoWktV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-205468-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205468-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5AA7B1C24C9C for ; Fri, 7 Jun 2024 06:53:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3B7315357A; Fri, 7 Jun 2024 06:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fsvoWktV" Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3381B1CA85 for ; Fri, 7 Jun 2024 06:53:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717743229; cv=none; b=RFI5otdIDBz4VeVTtzugwHY//Pogl9puVaGIgTkj3+ymqd2mv/3Brp/61gZlJPeuRIx8HI6Bgvcf+rWZQDA2tGAL+e2oJ1+Wj9Zjo7poObsq6xAY6pNmEpP2VvXroSdXMKcujfooX9RmeS1MllZUOBlVXhia/QVbMggJ1VsY6d4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717743229; c=relaxed/simple; bh=KNGyQXdTnutaMvHHVdH0giLjLucmMgCVt/J+Na13hSg=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=fH7kALKu6zrgYIyCvMNRko1OEUM/V2aqP5w1tpPysToile0KlkavFVcld9zfGN0dYX+jCGMlMukLj4aLdhx+mltd8VXVtUPaBLtj6BsbLg+o4Op6EemPa0IFvS0aPdP+t9O+BNQhol7mJqNv3BkXoLKTztfWBiHauA/O/Ld+cRA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=fsvoWktV; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-421572bb0f0so17933635e9.0 for ; Thu, 06 Jun 2024 23:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717743226; x=1718348026; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6oy9paXt3y1M6rnKNIikFuvNbwWD5iuAyif14OquD/E=; b=fsvoWktVwTaWqYZNsf7Lq3m9fTPvqExM1TMNO0b0mtSosIub2tBvVYjeZ+xo05H21d fdKOYRS0jIx9gG0pkfg7XdFx40hhPLIh1cO4eIlarnX+k5pWB4pjqVOktbvoHJ9R34x3 KRUc7iLmCWlUCnBZvFNvski68q2izOdlNXcP7ammjT8czxN3+0yk2iCqO96TudCA7uq8 x7f1UVSFtOKXuC6jUZNtHWR3WBaZN4P7hXLNmFSBGDqZI3mOHa8pCnEnJcV53tDvDNt9 rdYHpzV2Wgb1yJnbE5IxVLS/iMfi9ZE7NK1sZE3avm/S4uqgMAtvfSrGX88n0i8kk+uB qC0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717743226; x=1718348026; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6oy9paXt3y1M6rnKNIikFuvNbwWD5iuAyif14OquD/E=; b=A2HM4zC6yWNiM235mUZqdoa12Xj7quvC7282Z5KqfTJ25lvq5Ih/rD1+0ZHyYQKKX2 94lB0kv4n0fwuUzDDkn3YqZRAQn1iSsCatwyg5oQXWzhT5g43O8wuAcncm1pTHQ62xEY 5/aVqCS4cYPeP34H2F9+P2bFYlvZ0WJ6GoEAyKcErWOYuVNkYTXd2FCU4nY0SrXW9gaj 1MF0XJNN6XzMbQva/eRRAnBRu3xXigYRhcBMVgXsKSdZGO6cyrQkHZFkI0RITfxRUZsW Yrs38OybJiWTE3h9aoeDR6aNQPaOoPaD8+IOgCqSzGzUpoGKAi/gXi0vDZNP0CrpjRGp 1k4w== X-Forwarded-Encrypted: i=1; AJvYcCVBzSS63mo/4ag4Y9Ff9iLipprDr3Kgs+VB5epOZT/i/t4FZHeuUVRrZYca3BqWra2KmkOIfzSpSS0DxSxvQJJKMw1saY/tWX3A7lOT X-Gm-Message-State: AOJu0YzyHYS4mNNYbDpfBNn3VgjvMhQiddzI74vGY21w1vasAES9eWEZ E5lkT31i2e/wes27VdqN+Hn3TfNSaJ4Z2f8Pxo9vZpoJBdnXcHimhKVy24G0qzI= X-Received: by 2002:a05:600c:35c3:b0:41b:d4a3:ad6a with SMTP id 5b1f17b1804b1-42164a02b99mr14690295e9.17.1717743226409; Thu, 06 Jun 2024 23:53:46 -0700 (PDT) Received: from [192.168.2.24] ([110.93.11.116]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-421581490cesm77164715e9.31.2024.06.06.23.53.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jun 2024 23:53:45 -0700 (PDT) Message-ID: <22de160e-d925-4295-8208-f03a44f026bc@linaro.org> Date: Fri, 7 Jun 2024 08:53:45 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] hwmon: lm70: simplify with spi_get_device_match_data() To: Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240606142515.132504-1-krzysztof.kozlowski@linaro.org> <32a542a9-e338-4f8a-af24-a32c8426e619@roeck-us.net> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzTRLcnp5c3p0b2Yg S296bG93c2tpIDxrcnp5c3p0b2Yua296b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8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <32a542a9-e338-4f8a-af24-a32c8426e619@roeck-us.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 06/06/2024 17:56, Guenter Roeck wrote: > 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 >> --- >> 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. Yeah, they should not be 0. I think Jonathan also brought it some time ago for iio drivers: https://lore.kernel.org/linux-iio/20240226192555.14aa178e@jic23-huawei/ but if all the ID tables are complete, the 0 will work fine: https://lore.kernel.org/all/20240413154511.52576-1-krzysztof.kozlowski@linaro.org/ Best regards, Krzysztof