Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2458935pxb; Sat, 25 Sep 2021 07:54:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPxcrMC42gOfT+/r/F3i6ZWw6SfH7cFRjgzOBYRGoXtZTzpf19SVyiDPe/f6ziTCu3SbAd X-Received: by 2002:a17:906:7053:: with SMTP id r19mr16931048ejj.476.1632581683828; Sat, 25 Sep 2021 07:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632581683; cv=none; d=google.com; s=arc-20160816; b=xNeXugtZT2vRTeQ1bRWkPs4AuUY1bjctlvLvXFef10zO5wZymGrafIxWNE3wjIJklX EeyJTTJEzvFKEgyDgc09bmGmJxrtrY1wBw/HUeBLt2B9Opbn+ARWfPLWsk4UC03dTepH Y8vn2lRhICMHFMPh1KT2PIWyz+ONZNtqzq5xtIXArSx1RMEK+NuAKRTta+QNnkSffYb8 m3CNsFjK4nW7TSMBpcl2F7kEYqeWSK6cJQRLc24xfJiQNQEI70GJYGjm5Cinn4ctnGmE 5GBB2rZrnmThNi+TTt8jLfi8ghzDCfcaGiKPO0uqvuYNcYQcn3PSppBq/rJA1NKncVQv NRGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=8eMYg+bvVtB217p3sPFP47HMztIzmVBZEwGbqJ0crt4=; b=YiNUBv6F+b7QEDHAjBHe/F7dy3nVLlYG8LlfdFID6Vwr+B2nFVN3mDjoqhHIvNjpVS A5zXXMNYrgqa5qbI7Ax/8AnM0FIK6eLallVvivF092ocuiGX2Ol/+/JaMQ5XPz97ErQG GSRhNVYcyVnxj9O1ucR6oEzO4IIwTrijjX2wpzMb8AX53vJpRmm9UeWAIZqVvMa1KbaO IpzE4I9Ts4g2Ym3sjBFBNebeS4TBsAcJmmBeLw58mq2AN+tEjspSu98nZMzOxhgagHcY MRqR2QXJhqEQ55tKS0LFOU1YwIeJf/KK6k+fkgsKYPE0JlKHimTFSoNgGcqP7XN6F/v6 +wKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dz18si15727165edb.452.2021.09.25.07.54.19; Sat, 25 Sep 2021 07:54:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343505AbhIYOwe (ORCPT + 99 others); Sat, 25 Sep 2021 10:52:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:39630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234173AbhIYOwd (ORCPT ); Sat, 25 Sep 2021 10:52:33 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D4030610CF; Sat, 25 Sep 2021 14:50:56 +0000 (UTC) Date: Sat, 25 Sep 2021 15:54:45 +0100 From: Jonathan Cameron To: Enric Balletbo i Serra Cc: Wolfram Sang , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Lars-Peter Clausen , Benson Leung , Guenter Roeck , linux-iio@vger.kernel.org Subject: Re: [PATCH 6/9] iio: common: cros_ec_sensors: simplify getting .driver_data Message-ID: <20210925155445.1edf4752@jic23-huawei> In-Reply-To: <716533b5-380d-be72-b45e-d9909f09286b@collabora.com> References: <20210920090522.23784-1-wsa+renesas@sang-engineering.com> <20210920090522.23784-7-wsa+renesas@sang-engineering.com> <716533b5-380d-be72-b45e-d9909f09286b@collabora.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Sep 2021 11:16:47 +0200 Enric Balletbo i Serra wrote: > Hi Wolfram, > > On 20/9/21 11:05, Wolfram Sang wrote: > > We should get 'driver_data' from 'struct device' directly. Going via > > platform_device is an unneeded step back and forth. > > > > Signed-off-by: Wolfram Sang > > Acked-by: Enric Balletbo i Serra > > I'm fine to pick this patch through chrome-platform tree if Jonathan is fine, or > can go through his tree. Fine by me, though a suggestion follows to take this a little further than done here. Acked-by: Jonathan Cameron It's not something that ever bothered me that much, but we have had debates in the past about whether there are semantic issues around this sort of cleanup as it mixes platform_set_drvdata() with device_get_drvdata() Whilst they access the same pointer today, in theory that isn't necessarily always going to be the case in future and it isn't necessarily apparent to the casual reader of the code. In this particular case you could tidy that up by using device_set_drvdata() in the first place, but then to keep things consistent there is one other place where platform_get_drvdata is used in a devm_add_action_or_reset() callback. That one is also easily fixed though if we want to be consistent throughout. Jonathan > > I plan also to pick patch "[PATCH 8/9] platform: chrome: cros_ec_sensorhub: > simplify getting .driver_data" > > Thanks, > Enric > > > --- > > > > Build tested only. buildbot is happy. > > > > drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c > > index 28bde13003b7..b2725c6adc7f 100644 > > --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c > > +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c > > @@ -831,8 +831,7 @@ EXPORT_SYMBOL_GPL(cros_ec_sensors_core_write); > > > > static int __maybe_unused cros_ec_sensors_resume(struct device *dev) > > { > > - struct platform_device *pdev = to_platform_device(dev); > > - struct iio_dev *indio_dev = platform_get_drvdata(pdev); > > + struct iio_dev *indio_dev = dev_get_drvdata(dev); > > struct cros_ec_sensors_core_state *st = iio_priv(indio_dev); > > int ret = 0; > > > >