From patchwork Thu Oct 29 16:42:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866837 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D51D6A2 for ; Thu, 29 Oct 2020 16:43:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29A4420FC3 for ; Thu, 29 Oct 2020 16:43:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989811; bh=9fPuwg7DNgdETVrJPGqkZie1vv8h93KMLXIhmpA0GmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0NFwHg1AYpO3p9g6JcmA47yKLTL3wZEHju6NNk+CWMC/OkebBOzXa0x3hPLPKVtjp 3XAhiEg1vekc3hwSl25DoNJm0FD0JU+L4fs88p2wUoDLCPv2hRBFeq0SoJlH1+aaYG 03DUP+BZRgyxxX2U1e+0xHzvlyHcF1D77EAZmynk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727072AbgJ2Qn0 (ORCPT ); Thu, 29 Oct 2020 12:43:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:51902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727177AbgJ2QnZ (ORCPT ); Thu, 29 Oct 2020 12:43:25 -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 5D62621582; Thu, 29 Oct 2020 16:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989804; bh=9fPuwg7DNgdETVrJPGqkZie1vv8h93KMLXIhmpA0GmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=au0Gf/S0F4lSxB/viRxMRgwaCMFOK/YOGC/r5WXPccAOJJinYJlg5GdHgzDv+/joK 0Yh1LIoVG3GS2VKEqjJtUci8Rf49j1Q4og7zvz3Ps9dNW4SQFx559qOT4P8RVZB8R5 hgKn0QXnVqDfN2AutH3oNOrS1frmV7WGi/SzcVwI= 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 09/25] media: i2c: adp1653: simplify getting state container Date: Thu, 29 Oct 2020 17:42:23 +0100 Message-Id: <20201029164239.84240-9-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/adp1653.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c index 694125a59f64..522a0b10e415 100644 --- a/drivers/media/i2c/adp1653.c +++ b/drivers/media/i2c/adp1653.c @@ -379,8 +379,7 @@ static const struct v4l2_subdev_internal_ops adp1653_internal_ops = { static int adp1653_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 adp1653_flash *flash = to_adp1653_flash(subdev); if (!flash->power_count) @@ -391,8 +390,7 @@ static int adp1653_suspend(struct device *dev) static int adp1653_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 adp1653_flash *flash = to_adp1653_flash(subdev); if (!flash->power_count)