From patchwork Mon Sep 21 16:23:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11790453 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 2C0BC618 for ; Mon, 21 Sep 2020 16:25:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EA3F2376F for ; Mon, 21 Sep 2020 16:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600705533; bh=iWt+HCqN9lt08hfnz9Wn/u7/fja0NtAm0HPkLZW6+Xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IqNRsZasfha7PqIU8QC1a/XSah3zdgK334P/kgsb12aTtx4TGF4aMiZ7I2zfnNaaM UvqKEPB/tx7st0rDn4m39gglrgvliQ2sHw92SIYwr4u7NfP3lz9HiFyDeHQXw6+B+Z XRIaqdp++Br9OZRUJlTSQDfDQBXXhrzlNklhJ5so= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728394AbgIUQZ2 (ORCPT ); Mon, 21 Sep 2020 12:25:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:52328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728183AbgIUQZ0 (ORCPT ); Mon, 21 Sep 2020 12:25:26 -0400 Received: from localhost.localdomain (unknown [194.230.155.191]) (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 CF270238A0; Mon, 21 Sep 2020 16:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600705525; bh=iWt+HCqN9lt08hfnz9Wn/u7/fja0NtAm0HPkLZW6+Xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlxAbkS98LIF16sc3n79ISdP399BBhzFh/XK6j2ggs5ZQUvf39tBCw+QrwHfIdv3s 4tPsWaisINhi+5PdCN+sOCfn510zk6Hg4/fUKTxpitIZjfVTOe+6o3PQ+Wo2nFCaow K6J6FRCw6KJldq5k8JOj78ZQcJ9gguGdPg0BwOzE= 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 , Marco Felsch , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 12/25] media: i2c: dw9768: simplify getting state container Date: Mon, 21 Sep 2020 18:23:29 +0200 Message-Id: <20200921162342.7348-12-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200921162342.7348-1-krzk@kernel.org> References: <20200921162342.7348-1-krzk@kernel.org> 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/dw9768.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c index 45cdd924b565..8b8cb4b077b5 100644 --- a/drivers/media/i2c/dw9768.c +++ b/drivers/media/i2c/dw9768.c @@ -315,8 +315,7 @@ static int dw9768_release(struct dw9768 *dw9768) static int dw9768_runtime_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 dw9768 *dw9768 = sd_to_dw9768(sd); dw9768_release(dw9768); @@ -328,8 +327,7 @@ static int dw9768_runtime_suspend(struct device *dev) static int dw9768_runtime_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 dw9768 *dw9768 = sd_to_dw9768(sd); int ret;