From patchwork Thu Oct 29 16:42:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 310958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFBB2C56201 for ; Thu, 29 Oct 2020 16:43:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DD0621481 for ; Thu, 29 Oct 2020 16:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989825; bh=GSDOjTR7peYfwSlpauy3HGAZKOaKNwfpUcNoAOlkj1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cGmydF7gQ2GZAEyZtfYCRAWVI06jf/tK1VS1QyH3Zy80AP97RW/J+5W1KMNj1SUOK VF8fblQIx2xRkJElbDtNCAFa8ppNMPtrL12pAUTnDNDNRpteo9wom/6uZ2bDjk6LmC VxwBFSQBwjkoJ2yQLzj8hRptehbwZcV2f6DS9cRA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727363AbgJ2Qno (ORCPT ); Thu, 29 Oct 2020 12:43:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:52230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727293AbgJ2Qnm (ORCPT ); Thu, 29 Oct 2020 12:43:42 -0400 Received: from localhost.localdomain (adsl-84-226-167-205.adslplus.ch [84.226.167.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D296B206F4; Thu, 29 Oct 2020 16:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989821; bh=GSDOjTR7peYfwSlpauy3HGAZKOaKNwfpUcNoAOlkj1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLWaCB4DlMjUuHn0jZSdm8YgVo6GXkfT/3mZ7STvnJd670wZPkeCoDesbsk3lE9vn gcuorfquBMhdOag0phYBHiQkz49EiPPLUvdBTvFZs3UrsqrkEt6YLb6Ot2/GLiX3ch FwdkHdDLk7mMiVx8gas1pBYtqL2Vh9MF6bnbs+3o= From: Krzysztof Kozlowski To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , Lars-Peter Clausen , Tianshu Qiu , Dongchun Zhu , Shawn Tu , Ricardo Ribalda , Dave Stevenson , Manivannan Sadhasivam , Bingbu Cao , Rui Miguel Silva , Shunqian Zheng , Chiranjeevi Rapolu , Hyungwoo Yang , Wenyou Yang , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [RESEND PATCH 13/25] media: i2c: et8ek8: simplify getting state container Date: Thu, 29 Oct 2020 17:42:27 +0100 Message-Id: <20201029164239.84240-13-krzk@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201029164239.84240-1-krzk@kernel.org> References: <20201029164239.84240-1-krzk@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The pointer to 'struct v4l2_subdev' is stored in drvdata via v4l2_i2c_subdev_init() so there is no point of a dance like: struct i2c_client *client = to_i2c_client(struct device *dev) struct v4l2_subdev *sd = i2c_get_clientdata(client); This allows to remove local variable 'client' and few pointer dereferences. Signed-off-by: Krzysztof Kozlowski --- drivers/media/i2c/et8ek8/et8ek8_driver.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/et8ek8/et8ek8_driver.c b/drivers/media/i2c/et8ek8/et8ek8_driver.c index 256acf73d5ea..122af761c8e3 100644 --- a/drivers/media/i2c/et8ek8/et8ek8_driver.c +++ b/drivers/media/i2c/et8ek8/et8ek8_driver.c @@ -1237,7 +1237,7 @@ static ssize_t et8ek8_priv_mem_read(struct device *dev, struct device_attribute *attr, char *buf) { - struct v4l2_subdev *subdev = i2c_get_clientdata(to_i2c_client(dev)); + struct v4l2_subdev *subdev = dev_get_drvdata(dev); struct et8ek8_sensor *sensor = to_et8ek8_sensor(subdev); #if PAGE_SIZE < ET8EK8_PRIV_MEM_SIZE @@ -1374,8 +1374,7 @@ static const struct v4l2_subdev_internal_ops et8ek8_internal_ops = { */ static int __maybe_unused et8ek8_suspend(struct device *dev) { - struct i2c_client *client = to_i2c_client(dev); - struct v4l2_subdev *subdev = i2c_get_clientdata(client); + struct v4l2_subdev *subdev = dev_get_drvdata(dev); struct et8ek8_sensor *sensor = to_et8ek8_sensor(subdev); if (!sensor->power_count) @@ -1386,8 +1385,7 @@ static int __maybe_unused et8ek8_suspend(struct device *dev) static int __maybe_unused et8ek8_resume(struct device *dev) { - struct i2c_client *client = to_i2c_client(dev); - struct v4l2_subdev *subdev = i2c_get_clientdata(client); + struct v4l2_subdev *subdev = dev_get_drvdata(dev); struct et8ek8_sensor *sensor = to_et8ek8_sensor(subdev); if (!sensor->power_count)