Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp788140lqt; Thu, 6 Jun 2024 20:26:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWa6742LZNaB8Zf0/ycCSNYgQn9dgvWK15Q/CDnI7kZjliZLLg0ZDgFJLfjVby8o6/fX41gJ0RHECch+EOqwnPT7XRIdbYOBg7cPoePlQ== X-Google-Smtp-Source: AGHT+IEj/C70UQtebmeRIrgdheOd+gGo9ChnRZhmuhv4I0HQ5O4cy+H5FM56Cs90eXMA3YZZm4cU X-Received: by 2002:a05:6a20:6a24:b0:1af:ccd8:c118 with SMTP id adf61e73a8af0-1b2f9a16390mr1650939637.22.1717730803889; Thu, 06 Jun 2024 20:26:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717730803; cv=pass; d=google.com; s=arc-20160816; b=Tu0g5GWF4cNmQr4gGN5BxywE9qAYdPjBeDPKlXGgkSw8y0lqN6Loa/iT0I2wWckQvp 9kCt+Q1RCTaOvHbGr6oghX0dmyOwCNQcy8ghBHlbxGKzOPv3KMOR5sxnv6YjkhjhP+c/ giyktfAtuz2aincZngMtAfF0kVblGtlF7reeBdf9D3B3eax9sWXpqDetGF3TrMrw+aw2 FlNxuCFYsK1y77mfy8Jc8wMW4snIzwAuLzYSlyyDmzp+FQmiUVF4G7FCW4G7EWpxtfoO J6gW+2iwdcBJA0SHzjSBSh8GXCd7Hkcd0bGoQ5b9Yxkud2Uz+mT3uKzcbiMQGOtNbsq/ cnWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=oRHXhwV5J6FLgsfFL2J905n4RcD+iK2n31FrCkpHF6A=; fh=uMTZ1zml88w1kBCMz9kMqg4FK9BreDrTLWQUqY7aEfA=; b=KbonUIJGgN9QH4hHtaOpjARFkpTgSfXWGHtd19pjOywjuIeHO8N2TkbdQvCnWPfnDE jd6NyHi0bQyDsJwBJfd3o9HBKc9Hk02QvUnocUpWghN0zGeltnUCK5SvPIIDQtnRm2HZ pmDp3BfCcrZu4n0xf2jPL0Q6dI51sHGZOQ9hGg4z+YNF8A7r4k5bjRouUKuuep9oz71c T+gxsfMCB26bH0r6fy4lKujW/BjaParp8DgxdJ7bc1Rt6xqWWV8szEdm2xDdDFhr4cw3 7SRNUcQy8pCdHKWiWqNrxWITH53R6RSZ9+E9rOJnXi8oTASfE8dkv8QhEiI4FtO75fma 683A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-205267-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205267-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c29c378d3bsi2246503a91.116.2024.06.06.20.26.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 20:26:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205267-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-205267-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205267-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id CC9DCB214D1 for ; Fri, 7 Jun 2024 03:26:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38BCE1804F; Fri, 7 Jun 2024 03:26:28 +0000 (UTC) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 2DD9112B73; Fri, 7 Jun 2024 03:26:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717730787; cv=none; b=SnlDNbOGijQHCjMNfgTsppf/ubh85aTKy2wZqVVhQ9EZpwfqJG9nmRRYgzxlquCFauEv3dzBdOXlq+VgdqHjPvW6hWBHo9N50wOqf+YoLUM5lLc74IWZbTtmDe6QhYZIety3aJ0eP4Yv4w9H4xgsXcfhXx1VqxqpKtPXU9mPSwA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717730787; c=relaxed/simple; bh=og1W7CQ5dnT/fxo+VgP79WpVi3mZdb507tWx9OolfGo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GW+J5b+tsAwfcjdg+fUjvlzWpcvYWwSnaS10RIN3UHlsE4CU4pldvJc4ZsPezk1VE1wFRTHJreOZ5qkvsCE+pYnqLDkIicWHlCpm4In/Qkmq9OBxj4l016oK1cXyAxFrG7evR+cFewi0ZCKqaSde57IUGgCkpAwVud17q+Pc51Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1f68834bfdfso13070705ad.3; Thu, 06 Jun 2024 20:26:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717730785; x=1718335585; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oRHXhwV5J6FLgsfFL2J905n4RcD+iK2n31FrCkpHF6A=; b=nlskBK4kyU+QCtqgI0F2vqhUQvddldDhXR84XmNtxZPNN8RMB4NlS4FZ5rYW+D0Le6 xoYGMFSZ1qFSidIxNEDDrg/GyaZHJ5gBfVE7O7VbjcMzctlIDabt13ab39Mob1sKHKDb ySkk/2EYJQImmuGmZPxzAtujCHYxO/BMfhPMSTQbN4YoU2xVUE/sKF7PAbDTFNyQw+AM nwHyRA86IDCDwFV7rbWJ2vtngOvHecIbid/0FMCEl4xCpvnk1YgL+h6Iszhpeeg7Xf3T S8Yy7UT5CRAoaAwFCfz1xAsnjSAy9NwB/W8fKATQrjxZBR5lAkGAcEgDUjx8xQEDA3lr BM7w== X-Forwarded-Encrypted: i=1; AJvYcCX8v+Es8ODsJjbg8lsIe/xPN/scSUj+rSdhF/BLGUxFs7tjnPxyOLjVoabFXUIUMiSgfRY0ZqmTnrNb03+2p3hS3f7FptGF9LOViEPDRKItnhpsKuF51ApgH2lAmIdvTf1yVg5LG2NxaHwIQqV3EC6QgVbqGX2THVJQw9NSerj8 X-Gm-Message-State: AOJu0Ywqdk9MQNj5vxMRy7/oM13IYGaGxWgMSWj+wDJitzi+uk7HiHf2 PC0SMsYZsHsvLFrT3kRHQfilW0d8+lZvh+b9ZMQa9yNFBGnvFm+jRHAo2Z8ljUwJk4+lIL83HoV MRphVgxfdo9hJcmJE1yd7Uu8qHXs= X-Received: by 2002:a17:903:2b0e:b0:1f4:5dc0:5fe8 with SMTP id d9443c01a7336-1f6d02e22efmr16652065ad.15.1717730785287; Thu, 06 Jun 2024 20:26:25 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240606142424.129709-1-krzysztof.kozlowski@linaro.org> In-Reply-To: <20240606142424.129709-1-krzysztof.kozlowski@linaro.org> From: Vincent MAILHOL Date: Fri, 7 Jun 2024 12:26:13 +0900 Message-ID: Subject: Re: [PATCH net-next 1/3] can: hi311x: simplify with spi_get_device_match_data() To: Krzysztof Kozlowski Cc: Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Manivannan Sadhasivam , Thomas Kopp , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Krzysztof, On Thu. 6 Jun. 2024 =C3=A0 23:24, Krzysztof Kozlowski wrote: > Use spi_get_device_match_data() helper to simplify a bit the driver. Thanks for this clean up. > Signed-off-by: Krzysztof Kozlowski > --- > drivers/net/can/spi/hi311x.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c > index e1b8533a602e..5d2c80f05611 100644 > --- a/drivers/net/can/spi/hi311x.c > +++ b/drivers/net/can/spi/hi311x.c > @@ -830,7 +830,6 @@ static int hi3110_can_probe(struct spi_device *spi) > struct device *dev =3D &spi->dev; > struct net_device *net; > struct hi3110_priv *priv; > - const void *match; > struct clk *clk; > u32 freq; > int ret; > @@ -874,11 +873,7 @@ static int hi3110_can_probe(struct spi_device *spi) > CAN_CTRLMODE_LISTENONLY | > CAN_CTRLMODE_BERR_REPORTING; > > - match =3D device_get_match_data(dev); > - if (match) > - priv->model =3D (enum hi3110_model)(uintptr_t)match; > - else > - priv->model =3D spi_get_device_id(spi)->driver_data; > + priv->model =3D (enum hi3110_model)spi_get_device_match_data(spi)= ; Here, you are dropping the (uintptr_t) cast. Casting a pointer to an enum type can trigger a zealous -Wvoid-pointer-to-enum-cast clang warning, and the (uintptr_t) cast is the defacto standard to silence such warnings, thus the double (enum hi3110_model)(uintptr_t) cast in the initial version. Refer to this thread for examples: https://lore.kernel.org/linux-can/20210527084532.1384031-12-mkl@pengutron= ix.de/ Unless you are able to add a rationale in the patch description of why this cast can now be removed, I suggest you to keep it: priv->model =3D (enum hi3110_model)(uintptr_t)spi_get_device_match_data(spi); > priv->net =3D net; > priv->clk =3D clk; Yours sincerely, Vincent Mailhol