From patchwork Thu Oct 29 16:42:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866833 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 B1D341130 for ; Thu, 29 Oct 2020 16:43:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F710206F4 for ; Thu, 29 Oct 2020 16:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989803; bh=/PhWGtLaUqAhIL6pjZ4RRJC/Ld6+3IHAy/qhMj/KVuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=K9Yh3bLXM94uHxG27JjKJ22N+iZqa9euPWZvAf17EPKPpXLo6pekr3SiEf1iNQlmY TQuMM5GeIMC+Jp4IjwXjV+GA/5f7kbDAKAjAKp+EyqNtkHQHvgChByid+FLEmY/bqJ BW35iE6/cCRjfZR3VLy0ZRW8/FZ0YR1olOHckniE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726626AbgJ2QnG (ORCPT ); Thu, 29 Oct 2020 12:43:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:51468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726407AbgJ2QnE (ORCPT ); Thu, 29 Oct 2020 12:43:04 -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 9BCD921534; Thu, 29 Oct 2020 16:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989783; bh=/PhWGtLaUqAhIL6pjZ4RRJC/Ld6+3IHAy/qhMj/KVuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GtILGhiZjQO5w9VqKWe1E2ucPa1gcwtrKe62K5/JS+GRPija5grspK2kClqD7bLsk +m6ThTIVOffquq6gEev5gOAOrijUywD0GmMRYIHRr2ObUAd/OGpGcZ52tU9FEdOic4 SCC6ScGHo7abQOUuRnHUMNbiing14xipZH3agVL4= 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 04/25] media: i2c: imx319: simplify getting state container Date: Thu, 29 Oct 2020 17:42:18 +0100 Message-Id: <20201029164239.84240-4-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/imx319.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/imx319.c b/drivers/media/i2c/imx319.c index 17c2e4b41221..8b86fc65364e 100644 --- a/drivers/media/i2c/imx319.c +++ b/drivers/media/i2c/imx319.c @@ -2179,8 +2179,7 @@ static int imx319_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused imx319_suspend(struct device *dev) { - struct i2c_client *client = to_i2c_client(dev); - struct v4l2_subdev *sd = i2c_get_clientdata(client); + struct v4l2_subdev *sd = dev_get_drvdata(dev); struct imx319 *imx319 = to_imx319(sd); if (imx319->streaming) @@ -2191,8 +2190,7 @@ static int __maybe_unused imx319_suspend(struct device *dev) static int __maybe_unused imx319_resume(struct device *dev) { - struct i2c_client *client = to_i2c_client(dev); - struct v4l2_subdev *sd = i2c_get_clientdata(client); + struct v4l2_subdev *sd = dev_get_drvdata(dev); struct imx319 *imx319 = to_imx319(sd); int ret;