Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp168183lqp; Sat, 8 Jun 2024 10:22:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUAkJTRJs4OzSBXG/dIvoMdcnaDPSbqhdlX6vRMhSDIQIALiqxy2bsqmHAUDI9uQeCvfXn8DdGD7COVuWI53oVWu7v2I7fbZmWU+OP3ww== X-Google-Smtp-Source: AGHT+IE9AsgAqbfal2Xud36skF5t5mEZBmyA+qUSaS8k6OXGM0/HOAZtlfb9bRZf8Oty7e26T5ti X-Received: by 2002:a50:c051:0:b0:57c:60e5:7d2c with SMTP id 4fb4d7f45d1cf-57c60e57dc1mr2351749a12.0.1717867377694; Sat, 08 Jun 2024 10:22:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717867377; cv=pass; d=google.com; s=arc-20160816; b=e0zetDU8veEfittz228974Or1dikrPYKgaWfwjINC5Rb3dx6f9fguHecbECHnMtIwM FsjitFPg6c43wMdv/az8if1Wwy2o2d5zooxgVE4ZK+7RBh0YdJd+A8dRqDurKLQ6M1hf 5TobpT32U6xDcu2MztYyZEVZsVRBAd4lJ4RN14iVR6cOyI4ART6g6BKkFjTXR9C6YCWr GdDXeBnSyD1TzdiJ2MQbeDs/muKqHlxWXCb6x12abIY5n3Qi+EG7WI0u14AHjUXxM+1m SZc4Hnp4DWKj3iGwAqQD14CAseavg0ybyLNiDP6FCGcgh+nZJfM6UxXn2IdrexWXS6Ne 5ryQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=DmvEyPL/vMziTximDVSr1oxIhz/l3tjRzvgyFh1vogk=; fh=Rn7UWSnWI+0P2H+HHf6ITKdrGsW4MECMythZULmCQrg=; b=D0Q6DZfMSLCe81bDyUwGjM8BGAkqC+O17SNBy95ncPiSDQvTdnbRpr6t9eYj+QlDXD 4yUpiWA9CqiEWrNuMstgEHw5DatP+78jh2WPhQVD9ZeDG4ujlNSVmMywW4d/5rajR5Fy tVIMzo4HMPBR8BT+373DDvrJQEZpQkUu6m15tyHcL44uW6nacB9KimC/JNg8Vc0OV3bf vOZ1D75wVjABkOnqIYcoGrNr61C78Mh/uACBj4LEB7uYP8jpRFkerkECx3L2l0ZSoKn8 osLu3PST02sh/nUnJ05myX5EnFS3o7NcKtLvq27teqx0dmhD96u21fxlrVjrdUHNd11a fcaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rytt0HL9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207158-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207158-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae0c622fsi2920157a12.44.2024.06.08.10.22.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 10:22:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207158-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rytt0HL9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207158-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207158-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 61ECC1F21B09 for ; Sat, 8 Jun 2024 17:22:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4495B17548; Sat, 8 Jun 2024 17:22:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Rytt0HL9" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C41F168B8; Sat, 8 Jun 2024 17:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717867369; cv=none; b=ji0XYCP0tnxq05QKH4tDYDa2RoyUy8yYSv63cVB2UismHiCMsovU3e39yTcVQL8lE3+ba73Ls1Uss0XN9scRTorYncl0FL6MH4DFHIEEnyJ2eTRkjq+9EIo0hDEE7CU25hFVjWvvA5nn4I1GwH/r6a0nzrr0DGd4GXb3msDoXhg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717867369; c=relaxed/simple; bh=n9FcOdQmyRPVSwb30UUcTQuU6re91ctYyxj2TcrRaUA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NtF1BsMGx94hXkvO9J89FVGO9PS0+gJZM99OGDLsy+FdR1gJ6bxVFtx186q+HcsqAGi91ryayk3viyEzk6OIHIKwXOygGfDdyYrkAhkmcbq5HPcIxeLJqVk3rrQhMxwWMd9FelMz5eifuFDE8SycX6jcdsrRpvpaJOqyZRe+2fw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Rytt0HL9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 709B1C2BD11; Sat, 8 Jun 2024 17:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717867369; bh=n9FcOdQmyRPVSwb30UUcTQuU6re91ctYyxj2TcrRaUA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Rytt0HL9O1Fg0TyVehQc/XOutd/VvayrxZx7iBET2X+sQaK3PKb/ydcVjbQZmRUPo 9qyvxFHocleE/VcLZaFoCv/AFjAD365hxV8/lCpPAUR/73UpoGgNyezN3srpf7cAYl 13gengO2/QQTKocYvQB51gxE/N7FnFr/UIzoxI1g5UAQL6n5zvffou1923+Xo/ZllH 3mG43b26A5bvLIqEj+N56jqbueCMKF/R+ulJO9lgwueOUjgnlaaie2E+1b5BQS8lN8 5DOfEOMuQUE6X7kAMVFvMDZjpvMaa4Lt5qdwW4AFwo5VoLwGqGIpiQmZWifGSbUm/D wijBcLtG67hjA== Date: Sat, 8 Jun 2024 18:22:40 +0100 From: Jonathan Cameron To: Krzysztof Kozlowski Cc: Nuno =?UTF-8?B?U8Oh?= , Lucas Stankus , Lars-Peter Clausen , Michael Hennerich , Puranjay Mohan , Ramona Bolboaca , Oleksij Rempel , kernel@pengutronix.de, Cosmin Tanislav , Marius Cristea , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/8] iio: accel: adxl313: simplify with spi_get_device_match_data() Message-ID: <20240608182240.1e3a8153@jic23-huawei> In-Reply-To: <69e1a5b1-e5ce-4bcc-a0c4-2d02e777c296@linaro.org> References: <20240606-spi-match-data-v1-0-320b291ee1fe@linaro.org> <20240606-spi-match-data-v1-1-320b291ee1fe@linaro.org> <7ecabb8e342b9bd4fc2552bce29dc8c7a98971ee.camel@gmail.com> <69e1a5b1-e5ce-4bcc-a0c4-2d02e777c296@linaro.org> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.42; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 7 Jun 2024 11:18:54 +0200 Krzysztof Kozlowski wrote: > On 07/06/2024 10:57, Nuno S=C3=A1 wrote: > > On Thu, 2024-06-06 at 16:26 +0200, Krzysztof Kozlowski wrote: =20 > >> Use spi_get_device_match_data() helper to simplify a bit the driver. > >> > >> Signed-off-by: Krzysztof Kozlowski > >> --- > >> =C2=A0drivers/iio/accel/adxl313_spi.c | 8 +------- > >> =C2=A01 file changed, 1 insertion(+), 7 deletions(-) > >> > >> diff --git a/drivers/iio/accel/adxl313_spi.c b/drivers/iio/accel/adxl3= 13_spi.c > >> index b7cc15678a2b..6f8d73f6e5a9 100644 > >> --- a/drivers/iio/accel/adxl313_spi.c > >> +++ b/drivers/iio/accel/adxl313_spi.c > >> @@ -72,13 +72,7 @@ static int adxl313_spi_probe(struct spi_device *spi) > >> =C2=A0 if (ret) > >> =C2=A0 return ret; > >> =C2=A0 > >> - /* > >> - * Retrieves device specific data as a pointer to a > >> - * adxl313_chip_info structure > >> - */ > >> - chip_data =3D device_get_match_data(&spi->dev); > >> - if (!chip_data) > >> - chip_data =3D (const struct adxl313_chip_info > >> *)spi_get_device_id(spi)->driver_data; > >> + chip_data =3D spi_get_device_match_data(spi); > >> =C2=A0 =20 > >=20 > > I understand you're sticking with the original code but since you're do= ing this, > > could we maybe add proper error checking for the call? Maybe Jonathan c= an even > > tweak that while applying... > >=20 > > (same comment for patch 3) =20 >=20 > I consider that a separate patch/work, because it would have functional > impact. Agreed. Though error checking on these is normally paranoia / readability t= hing as we probed from some firmware match and all those entries are present, so it should just work. >=20 > Best regards, > Krzysztof >=20