From patchwork Thu Oct 29 16:42:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866821 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 A0CF56A2 for ; Thu, 29 Oct 2020 16:42:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6EBA121534 for ; Thu, 29 Oct 2020 16:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989775; bh=rufIZfzUwOusZfJ1S3FbaAtyMqLXFNBtqVRmnNQKp9A=; h=From:To:Cc:Subject:Date:List-ID:From; b=WGpjtZKDib9Lzzff/dtuv53dGWw/L04nM28pLS0Hl1voi/2erycvI8xVn/OtyHc8F LqlLlRGa3emV3/qwS2Pxpb1NkEGZpoloQDYQM+lqE7P/qVmEHjq6Cnts2AcpH2z/AH nZ21yAfEALY7lS3f1fIvpoOZiQadQcvYQazvwxWs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725892AbgJ2Qmw (ORCPT ); Thu, 29 Oct 2020 12:42:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:51242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbgJ2Qmw (ORCPT ); Thu, 29 Oct 2020 12:42:52 -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 4DDC7206F4; Thu, 29 Oct 2020 16:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989771; bh=rufIZfzUwOusZfJ1S3FbaAtyMqLXFNBtqVRmnNQKp9A=; h=From:To:Cc:Subject:Date:From; b=kIpUB8eIpOBHJ3mcZyOKOz9gfjlmEbM7nNA0P7TO76BruUFneh5kRmB55KrisMZha p/6XZa2/8dIf51hsJbyZnd/VdMtE5xwKWdSVj5JeRdhkUbi180AT+27R/IgIEh5hY9 zLRoQLiEP7u3oUNEJUhJNsO19gBeiAzip6QZbx/s= 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 01/25] media: i2c: imx214: simplify getting state container Date: Thu, 29 Oct 2020 17:42:15 +0100 Message-Id: <20201029164239.84240-1-krzk@kernel.org> X-Mailer: git-send-email 2.25.1 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. White at it, use 'dev' directly instead of 'imx214->dev'. Signed-off-by: Krzysztof Kozlowski --- drivers/media/i2c/imx214.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index 1ef5af9a8c8b..dc27c3678f18 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -431,14 +431,13 @@ static inline struct imx214 *to_imx214(struct v4l2_subdev *sd) static int __maybe_unused imx214_power_on(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 imx214 *imx214 = to_imx214(sd); int ret; ret = regulator_bulk_enable(IMX214_NUM_SUPPLIES, imx214->supplies); if (ret < 0) { - dev_err(imx214->dev, "failed to enable regulators: %d\n", ret); + dev_err(dev, "failed to enable regulators: %d\n", ret); return ret; } @@ -447,7 +446,7 @@ static int __maybe_unused imx214_power_on(struct device *dev) ret = clk_prepare_enable(imx214->xclk); if (ret < 0) { regulator_bulk_disable(IMX214_NUM_SUPPLIES, imx214->supplies); - dev_err(imx214->dev, "clk prepare enable failed\n"); + dev_err(dev, "clk prepare enable failed\n"); return ret; } @@ -459,8 +458,7 @@ static int __maybe_unused imx214_power_on(struct device *dev) static int __maybe_unused imx214_power_off(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 imx214 *imx214 = to_imx214(sd); gpiod_set_value_cansleep(imx214->enable_gpio, 0); @@ -910,8 +908,7 @@ static int imx214_parse_fwnode(struct device *dev) static int __maybe_unused imx214_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 imx214 *imx214 = to_imx214(sd); if (imx214->streaming) @@ -922,8 +919,7 @@ static int __maybe_unused imx214_suspend(struct device *dev) static int __maybe_unused imx214_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 imx214 *imx214 = to_imx214(sd); int ret; From patchwork Thu Oct 29 16:42:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866823 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 466BA1130 for ; Thu, 29 Oct 2020 16:43:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2430B20FC3 for ; Thu, 29 Oct 2020 16:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989781; bh=62tbWUZhtwhdx/5WGWfElJ9O7gQqjsCzRSN58mpUCJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fUWcHvgxfVmq+PEAYH/19+1neTJ50q7txQ3Z92ZJZF6Q0C2HT3JKGCV+HwpsSESgU 9CXOdI/nV9oWu1u2BMV1tv6TeF9+zOkSP8TLrJqlf/N4w4AX3h1yKveKoRJJKBCMeW WSj1VYHK+2AwT2jobaRzoLR8hwNofZRlIYDi63Is= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726211AbgJ2Qm5 (ORCPT ); Thu, 29 Oct 2020 12:42:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:51308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726051AbgJ2Qmz (ORCPT ); Thu, 29 Oct 2020 12:42:55 -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 6917D20EDD; Thu, 29 Oct 2020 16:42:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989775; bh=62tbWUZhtwhdx/5WGWfElJ9O7gQqjsCzRSN58mpUCJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zjhAhCudL6oHOXDXyTrQ7CrZlAAYuHsMUUyo8E1s1AqBt2OoIIKsy0M+HGM0Xj/YR bgkWMGEWdoheuTvEIq7hcDHrs08j0WO1mmKepLaWDTLZBXjmGGABEUXYO5VMMNe896 nZAXbZPQYyQiGUsyBgBcaIvXUl3gAT6GiWwOHdqc= 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 02/25] media: i2c: imx219: simplify getting state container Date: Thu, 29 Oct 2020 17:42:16 +0100 Message-Id: <20201029164239.84240-2-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/imx219.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 1cee45e35355..d5349d1ca485 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1114,22 +1114,21 @@ static int imx219_set_stream(struct v4l2_subdev *sd, int enable) /* Power/clock management functions */ static int imx219_power_on(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 imx219 *imx219 = to_imx219(sd); int ret; ret = regulator_bulk_enable(IMX219_NUM_SUPPLIES, imx219->supplies); if (ret) { - dev_err(&client->dev, "%s: failed to enable regulators\n", + dev_err(dev, "%s: failed to enable regulators\n", __func__); return ret; } ret = clk_prepare_enable(imx219->xclk); if (ret) { - dev_err(&client->dev, "%s: failed to enable clock\n", + dev_err(dev, "%s: failed to enable clock\n", __func__); goto reg_off; } @@ -1148,8 +1147,7 @@ static int imx219_power_on(struct device *dev) static int imx219_power_off(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 imx219 *imx219 = to_imx219(sd); gpiod_set_value_cansleep(imx219->reset_gpio, 0); @@ -1161,8 +1159,7 @@ static int imx219_power_off(struct device *dev) static int __maybe_unused imx219_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 imx219 *imx219 = to_imx219(sd); if (imx219->streaming) @@ -1173,8 +1170,7 @@ static int __maybe_unused imx219_suspend(struct device *dev) static int __maybe_unused imx219_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 imx219 *imx219 = to_imx219(sd); int ret; From patchwork Thu Oct 29 16:42:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866825 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 43FF06A2 for ; Thu, 29 Oct 2020 16:43:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21356214F1 for ; Thu, 29 Oct 2020 16:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989785; bh=uk9rGJ4+N1u1qnJ9IKKuVxqrudCSLJSlLDbCV6jBqDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Y3BX4BPvX5EGTgi4/N9GZnWRVBUb2GvQ/3WWyiSTcTOPlG0JubX9fo0vQCxC4eGA0 1KTE0eKf9TBWT3oY+RfSTsmBqfaoz7PVMMZ6bfu7qtvm07Z7qQihJ42oygGmJYgfiY otBMZtjmIODSKoDpIHrDlUFoy541O3DoqZQ1Pukc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726517AbgJ2QnA (ORCPT ); Thu, 29 Oct 2020 12:43:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:51386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726407AbgJ2QnA (ORCPT ); Thu, 29 Oct 2020 12:43:00 -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 82C9E21548; Thu, 29 Oct 2020 16:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989779; bh=uk9rGJ4+N1u1qnJ9IKKuVxqrudCSLJSlLDbCV6jBqDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IDjw44w21QmtZs1Au7YBvPinl2v59/UfgZdJ6gUgSAyG4kGzRVgLLrsKD80VsEaXH O9ETMzUMQDGluL+ppSjn8H0mKqTpgLb08+0g3fq+LmlKuT1Zw7O6diSTDLwC2wbd1U IyvNV1PDqqEjiIibbDVfeKIco4b4h67lq8S3f5N8= 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 03/25] media: i2c: imx290: simplify getting state container Date: Thu, 29 Oct 2020 17:42:17 +0100 Message-Id: <20201029164239.84240-3-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. White at it, use 'dev' directly instead of 'imx290->dev'. Signed-off-by: Krzysztof Kozlowski --- drivers/media/i2c/imx290.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c index adcddf3204f7..6319a42057d2 100644 --- a/drivers/media/i2c/imx290.c +++ b/drivers/media/i2c/imx290.c @@ -842,20 +842,19 @@ static int imx290_set_data_lanes(struct imx290 *imx290) static int imx290_power_on(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 imx290 *imx290 = to_imx290(sd); int ret; ret = clk_prepare_enable(imx290->xclk); if (ret) { - dev_err(imx290->dev, "Failed to enable clock\n"); + dev_err(dev, "Failed to enable clock\n"); return ret; } ret = regulator_bulk_enable(IMX290_NUM_SUPPLIES, imx290->supplies); if (ret) { - dev_err(imx290->dev, "Failed to enable regulators\n"); + dev_err(dev, "Failed to enable regulators\n"); clk_disable_unprepare(imx290->xclk); return ret; } @@ -872,8 +871,7 @@ static int imx290_power_on(struct device *dev) static int imx290_power_off(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 imx290 *imx290 = to_imx290(sd); clk_disable_unprepare(imx290->xclk); 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; From patchwork Thu Oct 29 16:42:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866827 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 A9E7D1130 for ; Thu, 29 Oct 2020 16:43:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87B7421481 for ; Thu, 29 Oct 2020 16:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989789; bh=Dhl956BimS53xTQsVQBFS9A2KaCmEJWe4BIHgTaal0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tv6gUal4krDfu59sStB7vb69i5Pdbg9pfqDk31UwNWIQvyws1r0ixBk9lJruZOsT7 ZWTnh7hJ7KtAvMq8ebToyB74ai/A0re2xucze5pvHM8bvsUedG9A559c4Zhu4QN+bR oA3vowx2JbQ0bCOgWsfAZ1e7s3iS2pxZdUB/yLwc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726719AbgJ2QnI (ORCPT ); Thu, 29 Oct 2020 12:43:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:51566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbgJ2QnI (ORCPT ); Thu, 29 Oct 2020 12:43:08 -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 D8AEA214DB; Thu, 29 Oct 2020 16:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989787; bh=Dhl956BimS53xTQsVQBFS9A2KaCmEJWe4BIHgTaal0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZlZTvl+l+UQ9Y5MJfNXWbQ2IbOG1PPAS5ROOyG/OP31KzyTfIYDMVetjXuhhn0VwD tb4ny9BwSaFwb32dpX+QkrqvH/8ODHurSTXaCa3hZtd3TJjXUc+9hnQWz9Ow4Bvfra ViodVUPWNwAzli//4GySrMwWZkq/IheEG8RCDM/Q= 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 05/25] media: i2c: imx319: silence unused acpi_device_id warning Date: Thu, 29 Oct 2020 17:42:19 +0100 Message-Id: <20201029164239.84240-5-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 If driver is built without ACPI, the struct acpi_device_id won't be used: drivers/media/i2c/imx319.c:2536:36: warning: 'imx319_acpi_ids' defined but not used [-Wunused-const-variable=] Signed-off-by: Krzysztof Kozlowski --- drivers/media/i2c/imx319.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx319.c b/drivers/media/i2c/imx319.c index 8b86fc65364e..8473c0bbb35d 100644 --- a/drivers/media/i2c/imx319.c +++ b/drivers/media/i2c/imx319.c @@ -2533,7 +2533,7 @@ static const struct dev_pm_ops imx319_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(imx319_suspend, imx319_resume) }; -static const struct acpi_device_id imx319_acpi_ids[] = { +static const struct acpi_device_id imx319_acpi_ids[] __maybe_unused = { { "SONY319A" }, { /* sentinel */ } }; From patchwork Thu Oct 29 16:42:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866829 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 9E0306A2 for ; Thu, 29 Oct 2020 16:43:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B4BA20EDD for ; Thu, 29 Oct 2020 16:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989795; bh=pinI95xWUP99dzSPLLOMtjZAp20HyaSQuf5bSlgypKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rj698GM4WdUt77LDrmZuMWqdVLlZ+s0TsjlKC8ET1zpmUaIOPtm8mx/fJGKzcCAv+ UorEqx0yhf5loCbVYEfJ3/HI35Jh7+pYuBR0FiXZ2o7kVqmLwWQ47O/sqs5RFXxFun AG4buwdvmYgWHtm1vF7rMNDIPfDO/HgRwVUejkfE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726848AbgJ2QnN (ORCPT ); Thu, 29 Oct 2020 12:43:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:51624 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbgJ2QnM (ORCPT ); Thu, 29 Oct 2020 12:43:12 -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 04B772151B; Thu, 29 Oct 2020 16:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989791; bh=pinI95xWUP99dzSPLLOMtjZAp20HyaSQuf5bSlgypKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0gJbmqFXkrSakg8xtkvd6xch7tPo/UdXcAvlnOkbsW0vzS89ZcHRByv4xJzwQk5vV GXOIKvjceSZ6fBquCWF/Ee2vD32YSV6ModkPas9QVV4wfQCihPmMo7hqaQ0pa0+uzL uKG36oioclt1Yy7G7mtBBA0+YoI5sTK0Ia1iZNBw= 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 06/25] media: i2c: imx355: simplify getting state container Date: Thu, 29 Oct 2020 17:42:20 +0100 Message-Id: <20201029164239.84240-6-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/imx355.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c index bed293b60e50..51245e71b411 100644 --- a/drivers/media/i2c/imx355.c +++ b/drivers/media/i2c/imx355.c @@ -1480,8 +1480,7 @@ static int imx355_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused imx355_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 imx355 *imx355 = to_imx355(sd); if (imx355->streaming) @@ -1492,8 +1491,7 @@ static int __maybe_unused imx355_suspend(struct device *dev) static int __maybe_unused imx355_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 imx355 *imx355 = to_imx355(sd); int ret; From patchwork Thu Oct 29 16:42:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866831 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 AF42E6A2 for ; Thu, 29 Oct 2020 16:43:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C70820FC3 for ; Thu, 29 Oct 2020 16:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989798; bh=h9SB15vQcHhQIm0U5uWXO0OnZemAUauo1TeT1Ot+yDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xI2nd3WSpKZ+WPFp6xePtV1OyvT17s9eNRfW+6U9NgC9dIC2LWg2smKSuFjjFHtWn YvBllulTW5+9QtjBqUP8isOjnnEq9dmmhW3/utPIPTq3D+BeAJAdoY7SsbPU23nOoF kxZX6BNQdEUcBMLSSL2PedCKx/NWG/RS0DgJ6+oA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727096AbgJ2QnR (ORCPT ); Thu, 29 Oct 2020 12:43:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:51742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727030AbgJ2QnQ (ORCPT ); Thu, 29 Oct 2020 12:43:16 -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 2456820825; Thu, 29 Oct 2020 16:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989795; bh=h9SB15vQcHhQIm0U5uWXO0OnZemAUauo1TeT1Ot+yDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7k8MpSA7DcTpfxKTOSq6g/xvw/BQKjnrsg0tH+lVKEKux8lxnSmbO3unOK8MyU58 QgfgEfm8B16Gp+qJa2cJ/2OTWO6tc+bFNb2l7SKBSXmKhl3s6Xb94kKZz9C2WspzvH 3ymwVtvz7TADdKBF9VoEke8RAxGjl42CS7Pv9T2s= 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 07/25] media: i2c: imx355: silence unused acpi_device_id warning Date: Thu, 29 Oct 2020 17:42:21 +0100 Message-Id: <20201029164239.84240-7-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 If driver is built without ACPI, the struct acpi_device_id won't be used: drivers/media/i2c/imx355.c:1836:36: warning: 'imx355_acpi_ids' defined but not used [-Wunused-const-variable=] Signed-off-by: Krzysztof Kozlowski --- drivers/media/i2c/imx355.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c index 51245e71b411..700f7467fb31 100644 --- a/drivers/media/i2c/imx355.c +++ b/drivers/media/i2c/imx355.c @@ -1833,7 +1833,7 @@ static const struct dev_pm_ops imx355_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(imx355_suspend, imx355_resume) }; -static const struct acpi_device_id imx355_acpi_ids[] = { +static const struct acpi_device_id imx355_acpi_ids[] __maybe_unused = { { "SONY355A" }, { /* sentinel */ } }; From patchwork Thu Oct 29 16:42:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866835 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 7D74A1130 for ; Thu, 29 Oct 2020 16:43:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A2AA206F4 for ; Thu, 29 Oct 2020 16:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989807; bh=5bLbINpg3KaAkH1MQB5b16lyTj6CxApVEoBZlrf1etw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=U5dUxsXPXtInV82ngwE7jJvjFZpvb7NCKiS9GbE/zgcPJY2QnnMJJCz9t+puGTgik 7idcn28imbrwlV7ggEQKcfsk+FVNWwUY24f+18F0qj5PBGAFUO/8q8W8sfA9YG5LUC 1oR3lrNkMquGIbNxqPOURAoQULVeRzIsdMhkRc1A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726790AbgJ2QnW (ORCPT ); Thu, 29 Oct 2020 12:43:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:51824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgJ2QnU (ORCPT ); Thu, 29 Oct 2020 12:43:20 -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 3DC0321548; Thu, 29 Oct 2020 16:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989799; bh=5bLbINpg3KaAkH1MQB5b16lyTj6CxApVEoBZlrf1etw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O5lr8OfrssYk8MvUkl77C8xecQGo+J9jLCmny0QKZwbesuTwhGkocnHTQTZJmwDMg 1M7LG4IeggVKG+5KvjJNwbG7AymwchDA6/DfL3E1S9PBosuv81QW7YUAZFb+1Uc9H2 pL1L6a282t6CLVbIPFGpjrxMDAfv+K6nW53eQQiY= 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 08/25] media: i2c: ad5820: simplify getting state container Date: Thu, 29 Oct 2020 17:42:22 +0100 Message-Id: <20201029164239.84240-8-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/ad5820.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index 19c74db0649f..2958a4694461 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -270,8 +270,7 @@ static const struct v4l2_subdev_internal_ops ad5820_internal_ops = { */ static int __maybe_unused ad5820_suspend(struct device *dev) { - struct i2c_client *client = container_of(dev, struct i2c_client, dev); - struct v4l2_subdev *subdev = i2c_get_clientdata(client); + struct v4l2_subdev *subdev = dev_get_drvdata(dev); struct ad5820_device *coil = to_ad5820_device(subdev); if (!coil->power_count) @@ -282,8 +281,7 @@ static int __maybe_unused ad5820_suspend(struct device *dev) static int __maybe_unused ad5820_resume(struct device *dev) { - struct i2c_client *client = container_of(dev, struct i2c_client, dev); - struct v4l2_subdev *subdev = i2c_get_clientdata(client); + struct v4l2_subdev *subdev = dev_get_drvdata(dev); struct ad5820_device *coil = to_ad5820_device(subdev); if (!coil->power_count) 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) From patchwork Thu Oct 29 16:42:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866839 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 E10BE14B7 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 BF3142151B 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=M9OkRSe1IB/IvBo2pbX48CkeYtZxfgjwWQKbtDopf68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GH9j5wrzYMkHtwViJbeg1AcuRRbyLd8P+QVBl53YgSIszwmx1BglYVvWPWUTiSOYr GyG+SsxfGSvTpjUoVi1D3GeAdhJqoDg4VoZ7D8b1P/gvGQVS99UrQitsAJ3ZkWvXDY Zn/FXfDzk16bp1P/HBDrr1nQlg3X1GC1egyHkey4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727143AbgJ2Qna (ORCPT ); Thu, 29 Oct 2020 12:43:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:51980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727141AbgJ2Qn3 (ORCPT ); Thu, 29 Oct 2020 12:43:29 -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 EF5C0214DB; Thu, 29 Oct 2020 16:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989808; bh=M9OkRSe1IB/IvBo2pbX48CkeYtZxfgjwWQKbtDopf68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ISPt386+hBOa1mmOshodzbJWwYt7DxJRKV5hMXSM5bbWgxoeJxJzwg71SD65yM2OY ZJ2hjjGUwvBaIbgiK23tLfiUr0IDr+ZYzsjaHYvwS6Uj/PG6riBqJvXdsCuRpWLyPg fkTkxwxQ3r7IF2gEpqg2tp5la3tnqAvYMgJtHeV4= 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 10/25] media: i2c: adv7180: simplify getting state container Date: Thu, 29 Oct 2020 17:42:24 +0100 Message-Id: <20201029164239.84240-10-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/adv7180.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 4498d14d3429..44bb6fe85644 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -1454,8 +1454,7 @@ MODULE_DEVICE_TABLE(i2c, adv7180_id); #ifdef CONFIG_PM_SLEEP static int adv7180_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 adv7180_state *state = to_state(sd); return adv7180_set_power(state, false); @@ -1463,8 +1462,7 @@ static int adv7180_suspend(struct device *dev) static int adv7180_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 adv7180_state *state = to_state(sd); int ret; From patchwork Thu Oct 29 16:42:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866845 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 A519B1130 for ; Thu, 29 Oct 2020 16:43:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 81DDC20FC3 for ; Thu, 29 Oct 2020 16:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989824; bh=Mk2QkU4k0+ab8zrpFEJUmQfk4RBoALQPIS97PfxH0fM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yEZhRAlVF8su1wrvfVMvt5RFjz6/xlmLnFFACGVn1Inr5yJkYe+D86ifvfHarzAU+ S793/gBoVLKyaTmsv/qLsfv3/vYz/blUOvblD3DZSsB4Z2oioSs7Ojq7QsIQ8JGeio bLWpSiB1ghO5kJzojryTFL8Yg8WviEO5As7RyMmM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727274AbgJ2Qng (ORCPT ); Thu, 29 Oct 2020 12:43:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:52064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727141AbgJ2Qnd (ORCPT ); Thu, 29 Oct 2020 12:43:33 -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 17CD321481; Thu, 29 Oct 2020 16:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989812; bh=Mk2QkU4k0+ab8zrpFEJUmQfk4RBoALQPIS97PfxH0fM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KDfDNIfQjM+rgHtKxMdrU8x1S2Nub5dVLIVb6dPwjepQCPtSOt6kzCIWHJKyL5q7C ZyP8uqggGKDjwBjR4fa8fWpfqzo9uI1s/Sfaagy6RVuoVCdTjwWMfj+DWMu7v6EvX6 A1PWQtcBOo7L9YM3WNeDoLCUWzXd5FYqWDLckKrU= 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 11/25] media: i2c: ak7375: simplify getting state container Date: Thu, 29 Oct 2020 17:42:25 +0100 Message-Id: <20201029164239.84240-11-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/ak7375.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/ak7375.c b/drivers/media/i2c/ak7375.c index 7b14b11605ca..e1f94ee0f48f 100644 --- a/drivers/media/i2c/ak7375.c +++ b/drivers/media/i2c/ak7375.c @@ -196,9 +196,7 @@ static int ak7375_remove(struct i2c_client *client) */ static int __maybe_unused ak7375_vcm_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 ak7375_device *ak7375_dev = sd_to_ak7375_vcm(sd); int ret, val; @@ -233,8 +231,7 @@ static int __maybe_unused ak7375_vcm_suspend(struct device *dev) */ static int __maybe_unused ak7375_vcm_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 ak7375_device *ak7375_dev = sd_to_ak7375_vcm(sd); int ret, val; From patchwork Thu Oct 29 16:42:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866843 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 86AAB6A2 for ; Thu, 29 Oct 2020 16:43:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 656352151B for ; Thu, 29 Oct 2020 16:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989820; bh=LIRs0Nt888yt2brtcgTrviGruxEU5fhoxGKpmTlYdbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=heYuC9CZlcVWoZ8n0R1SAjlGw5oSDmr+lK+/FJWXhWhd5jnYxye+Nkhxx7HC8pI8H xjr0JHnq9Hhvp6M6YQPTcYQ3GReUQ7GU/z/rVdFAK5B2vJh71YNuqFyasMQmO0VSZR EcrR/iErtfJTn3Z5wcwwZ+KUqlXaWxlb65DkWX8Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727315AbgJ2Qnj (ORCPT ); Thu, 29 Oct 2020 12:43:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:52134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727293AbgJ2Qnh (ORCPT ); Thu, 29 Oct 2020 12:43:37 -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 320B621548; Thu, 29 Oct 2020 16:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989816; bh=LIRs0Nt888yt2brtcgTrviGruxEU5fhoxGKpmTlYdbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mKC3Zm0qWY2C2TwITtMB+sofFHNzL7J0silJg+Tq6ZRUyNQBRQCOX3+0jWDY7yIer yCeZiH/VYlZwYPY8+jI1lGOLSDUZ7Z7Fu+n1i4FMPs60x67drCx6cfqO8vXShNFO9Y Le4mUlO74M4pR12ZANG0f+yH/2syG6XuPvsAEe/8= 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 12/25] media: i2c: dw9768: simplify getting state container Date: Thu, 29 Oct 2020 17:42:26 +0100 Message-Id: <20201029164239.84240-12-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/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; 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: 11866847 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 8E97D1130 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 6D6E320FC3 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) From patchwork Thu Oct 29 16:42:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866849 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 7CB646A2 for ; Thu, 29 Oct 2020 16:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5AAF0221EB for ; Thu, 29 Oct 2020 16:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989828; bh=z8mPm98zLHjmSrGnZuAlqb0wRBU2ISL59+ICg2rKfmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sZnvWmacg07VhjcC2DTRScPM5UODI8SrfJvVEzWYh6wtwPFdDSosgjp4NOOI203zk oOJK/srHetfKnkaTqIOT/SpHKekjNLpsvkM2G9ou4+st/LW5a3WAe/u+OE6kDl2cxc JHeoyKgmSw7PsprrV/f+X2MtxCKilwfp3OrGC7JQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727382AbgJ2Qnr (ORCPT ); Thu, 29 Oct 2020 12:43:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:52338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbgJ2Qnq (ORCPT ); Thu, 29 Oct 2020 12:43:46 -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 F0C8221534; Thu, 29 Oct 2020 16:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989825; bh=z8mPm98zLHjmSrGnZuAlqb0wRBU2ISL59+ICg2rKfmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zeGydGcPTeBfHmU/cvkwDiDWGeN25ToabQ9DH/6KZEpVtcevLct7EiR9JQTaq+MkD zNI2ZLOirhRuaHe1DAqdiBEPbrZFzpyQQQtIjqy+KmEOW/JNx+GhEwes3ResQIsROS GOuSmK4cTbsBHV7pItrUfNMdj+1UnoujNkizUdfg= 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 14/25] media: i2c: hi556: simplify getting state container Date: Thu, 29 Oct 2020 17:42:28 +0100 Message-Id: <20201029164239.84240-14-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/hi556.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c index c66cd1446c0f..c74736845d7a 100644 --- a/drivers/media/i2c/hi556.c +++ b/drivers/media/i2c/hi556.c @@ -839,8 +839,7 @@ static int hi556_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused hi556_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 hi556 *hi556 = to_hi556(sd); mutex_lock(&hi556->mutex); @@ -854,8 +853,7 @@ static int __maybe_unused hi556_suspend(struct device *dev) static int __maybe_unused hi556_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 hi556 *hi556 = to_hi556(sd); int ret; From patchwork Thu Oct 29 16:42: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: 11866851 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 DDB641130 for ; Thu, 29 Oct 2020 16:43:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC50E20825 for ; Thu, 29 Oct 2020 16:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989836; bh=6mIHa/ObVyPo2R/u+eryKdODkXE97s7lir+Hh6dLp9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NuiJ0puDf+MTiLe04EsjQUZ3zKzSr0eZZvKD/kUbxdshPIV3KHWH2AtnrSHlZlSM9 MgN8ZFJoF97ffQY0iF4HwMUoMoZVBESHAUHW6CFTmm9FKk8KSJfFuRbVrJ/XPPt3g/ wYmlizXhIBBiUmJnDJ6P525shXa4cprVpKI45BVw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727373AbgJ2Qnw (ORCPT ); Thu, 29 Oct 2020 12:43:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:52456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727079AbgJ2Qnv (ORCPT ); Thu, 29 Oct 2020 12:43:51 -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 18B5721481; 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=1603989830; bh=6mIHa/ObVyPo2R/u+eryKdODkXE97s7lir+Hh6dLp9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m4hbIaDJE9digDF+r1MaUhczhUrRZoYSUwC56+Nr2KYzFydge2S3HIhvHLwQmiQQo FelxSebQLoKAFy8PSxJvfzJBH9kfFY2ugr1vI0z0Cd35RlzSgtGqauEu4dCRK7/ZVk TP9DUvjDZnXQ1P4cnZ0oJ/Ru2UE4HY7kOpu3CFuE= 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 15/25] media: i2c: ov13858: simplify getting state container Date: Thu, 29 Oct 2020 17:42:29 +0100 Message-Id: <20201029164239.84240-15-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/ov13858.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c index 236ad2c816b7..2f3be7a80cef 100644 --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -1505,8 +1505,7 @@ static int ov13858_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused ov13858_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 ov13858 *ov13858 = to_ov13858(sd); if (ov13858->streaming) @@ -1517,8 +1516,7 @@ static int __maybe_unused ov13858_suspend(struct device *dev) static int __maybe_unused ov13858_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 ov13858 *ov13858 = to_ov13858(sd); int ret; From patchwork Thu Oct 29 16:42:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866853 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 5354C1130 for ; Thu, 29 Oct 2020 16:43:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F60C20FC3 for ; Thu, 29 Oct 2020 16:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989838; bh=+YhrTdxTZ9IwtpRsXLWk8hGCvf874D+0Yy5rA92EFsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BVwdw13UzudP4FRB53MW2t8zSjnuNFphcVUB5anNzeaUg9wgRHZ6trZVxMlDJSFVc bHKX3qN8n8iKz1uVzNBn56POhIk5Ojt1TDmE/FMmCdv8Lt19eYqmSQpYZV1vRRNHjv YHEg0iIRQJfE4lkJE9Wb+LtdZs7acOFPSFCQrwVU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727445AbgJ2Qn4 (ORCPT ); Thu, 29 Oct 2020 12:43:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:52564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727000AbgJ2Qnz (ORCPT ); Thu, 29 Oct 2020 12:43:55 -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 93D3022228; Thu, 29 Oct 2020 16:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989834; bh=+YhrTdxTZ9IwtpRsXLWk8hGCvf874D+0Yy5rA92EFsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xVI7U1/ns8qtAZsNJz7jZMmDHaQXB3y7rJCQ4c9M+hNICGYdRmIRVF37lEZC8H4nN bPVQKXfduJPxWCN3UWNNA7ELc2WVhkoKZVn3kdkzuM2OKQljk0J84Lc+Nb1YFl9IbO thPKRa2Xk/+2Q31fWu9jdtri/mQ9MZtxniQjbSNY= 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 16/25] media: i2c: ov2680: simplify getting state container Date: Thu, 29 Oct 2020 17:42:30 +0100 Message-Id: <20201029164239.84240-16-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/ov2680.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 59cdbc33658c..178dfe985a25 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -1111,8 +1111,7 @@ static int ov2680_remove(struct i2c_client *client) static int __maybe_unused ov2680_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 ov2680_dev *sensor = to_ov2680_dev(sd); if (sensor->is_streaming) @@ -1123,8 +1122,7 @@ static int __maybe_unused ov2680_suspend(struct device *dev) static int __maybe_unused ov2680_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 ov2680_dev *sensor = to_ov2680_dev(sd); int ret; From patchwork Thu Oct 29 16:42:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866861 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 2BA681130 for ; Thu, 29 Oct 2020 16:44:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0822D2151B for ; Thu, 29 Oct 2020 16:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989859; bh=yn+fZIJ73/uxpxzu+DIH9FgNN9ZUes6fMN5U/XX2iUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZRtXamdMIdV0YuI5M1Hg6c+1yweLpAWRlPtgjQc8U4JTw3iSAXpo5PsOSHRUJEUnh 5fXOTcJZz5VSGtGE3ST91VckhXLkh84TSl3xBpb4Sot4zdIQLmvUVWsiEN5SoMYPnr GWSXOQJTnWjCGkqoBHcLdW1h9DWlN7A5MQoA47Bs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727562AbgJ2QoB (ORCPT ); Thu, 29 Oct 2020 12:44:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:52678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727000AbgJ2Qn7 (ORCPT ); Thu, 29 Oct 2020 12:43:59 -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 D765C20EDD; Thu, 29 Oct 2020 16:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989838; bh=yn+fZIJ73/uxpxzu+DIH9FgNN9ZUes6fMN5U/XX2iUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kf0OxlnjX6t0W5XG3QyV5/ylGzKpQuxxZt9J43hbcp3xga58Cw5+W5LYeMYpEycrR oKIoEoOrg5B+9hWla2LLhZkPs5WkFs7oKjwUDpkD/l2KCfo/Es+qJs/E3cYwYfyUxQ ynqj1asFtnKsOHyGjQQ2u7FRe4IGiAay/ku4r1tM= 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 17/25] media: i2c: ov2685: simplify getting state container Date: Thu, 29 Oct 2020 17:42:31 +0100 Message-Id: <20201029164239.84240-17-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/ov2685.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c index 6814583d9606..49a2dcedb347 100644 --- a/drivers/media/i2c/ov2685.c +++ b/drivers/media/i2c/ov2685.c @@ -506,8 +506,7 @@ static int ov2685_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) static int __maybe_unused ov2685_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 ov2685 *ov2685 = to_ov2685(sd); return __ov2685_power_on(ov2685); @@ -515,8 +514,7 @@ static int __maybe_unused ov2685_runtime_resume(struct device *dev) static int __maybe_unused ov2685_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 ov2685 *ov2685 = to_ov2685(sd); __ov2685_power_off(ov2685); From patchwork Thu Oct 29 16:42:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866855 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 56F131130 for ; Thu, 29 Oct 2020 16:44:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 340FC20825 for ; Thu, 29 Oct 2020 16:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989846; bh=SuIt2NTYlEXZUbdtnMvc08ktKW1WSPW8+MTUSEIg4Hk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LzYV22dw7k+mN4KGDCuOX2R8FnN9mAm7mP+GEeaUOpZGS/akGyXZDmWxXQ6lWEPut aCtjmEQcEJSJ34PAG+2a0w9Obh87lAtFl7fepvirnUVAWRTkWHyqBFtnRi27FZgHcb lVcKMBs1mw3DRvY+yU46+l1WW38BGQMxFaH4JusY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727533AbgJ2QoE (ORCPT ); Thu, 29 Oct 2020 12:44:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:52776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727000AbgJ2QoD (ORCPT ); Thu, 29 Oct 2020 12:44:03 -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 04F8F21534; Thu, 29 Oct 2020 16:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989842; bh=SuIt2NTYlEXZUbdtnMvc08ktKW1WSPW8+MTUSEIg4Hk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YhxTLC2h2Yv/HkDlinA1h5mUb4sopYz3JH0d82pcvu1yyQmVjGG/wL8Qh4LniHtNF bPg0KI95kyqsI1IYDKCpfY+rnzha06gujpUtmgWAjJ0o2Z1yV/qCj9y4QDnrmukb3U xKIEa1ovfk0O3tU39aGbHPElRu9p3yR2H90p9npk= 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 18/25] media: i2c: ov2740: simplify getting state container Date: Thu, 29 Oct 2020 17:42:32 +0100 Message-Id: <20201029164239.84240-18-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/ov2740.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index bd0d45b0d43f..0d32b0c0ca11 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -674,8 +674,7 @@ static int ov2740_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused ov2740_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 ov2740 *ov2740 = to_ov2740(sd); mutex_lock(&ov2740->mutex); @@ -689,8 +688,7 @@ static int __maybe_unused ov2740_suspend(struct device *dev) static int __maybe_unused ov2740_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 ov2740 *ov2740 = to_ov2740(sd); int ret = 0; From patchwork Thu Oct 29 16:42:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866857 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 DA9C31130 for ; Thu, 29 Oct 2020 16:44:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA29920825 for ; Thu, 29 Oct 2020 16:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989852; bh=DijZ5lC3aLUEvWxobBblQbGyxyqMYr/X7e4809HwSno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EmTD+gx+3Usf+QmOJvAHqCKF/vwPqexc4dm72c8S461PdjgRpEf7Rt6a9ADhpRaIF xd2rC7z1irW9RrPRQ8bZkQkKIpfcjFLK0HA/oFTMSiYa4Wbedlbn08Fus1Lj4N3xvB zyTRpcdMKQOlM+n1Zs/j4fJ4c++dmBcUmyNINxvo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727535AbgJ2QoI (ORCPT ); Thu, 29 Oct 2020 12:44:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:52890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727657AbgJ2QoH (ORCPT ); Thu, 29 Oct 2020 12:44:07 -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 215D920FC3; Thu, 29 Oct 2020 16:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989846; bh=DijZ5lC3aLUEvWxobBblQbGyxyqMYr/X7e4809HwSno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jib/Xj0gEHNKgdjJ16QAgjH/qP8LvaYuYhq3PMlu+h3N0hChVIAZXjI/GISMggj41 IoAcZkXW3hntbOn8bnCvmIFBu6SC+d7HlWmDizRxbb5FR6I6hu0TsIY6vkVB47i2WF owXLx+kFWjDzgQ8fK5KL4s6ZnCrsAp8LGDDlvQow= 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 19/25] media: i2c: ov5670: simplify getting state container Date: Thu, 29 Oct 2020 17:42:33 +0100 Message-Id: <20201029164239.84240-19-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/ov5670.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index f26252e35e08..148fd4e05029 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -2373,8 +2373,7 @@ static int ov5670_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused ov5670_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 ov5670 *ov5670 = to_ov5670(sd); if (ov5670->streaming) @@ -2385,8 +2384,7 @@ static int __maybe_unused ov5670_suspend(struct device *dev) static int __maybe_unused ov5670_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 ov5670 *ov5670 = to_ov5670(sd); int ret; From patchwork Thu Oct 29 16:42:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866859 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 E2C7B6A2 for ; Thu, 29 Oct 2020 16:44:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFF1120825 for ; Thu, 29 Oct 2020 16:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989857; bh=tIPGFWlADPB709R4a5C9btZOmQoIDyZFJQWdZFIJfUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=r0Irx7u946TcLc4Pa0wd81R4COAQqVX7dCbM7rv977Hj2BuUMpPjxKYImokikPWYj 0K3O7fAtC6QB/tzBJkbpCDKtN0K2lPTHDqLUPlrD0Ufjo7gNfoH/bJ/WDcO4IxylwC Sc4bmsTsaHlI8r9uB6JV0IM90//05KXKKuPg+iNQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727703AbgJ2QoN (ORCPT ); Thu, 29 Oct 2020 12:44:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:52994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727661AbgJ2QoL (ORCPT ); Thu, 29 Oct 2020 12:44:11 -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 36A4521481; Thu, 29 Oct 2020 16:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989850; bh=tIPGFWlADPB709R4a5C9btZOmQoIDyZFJQWdZFIJfUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qR0TqyazbYmiXLSiXbTwnLCoNiB0osG2MA0ZCK+ecvlXKqlmjS8eR2VcMg7n+owEs NFO4sQWUlJg3GD5CUp4ApHA3rZ16mHWHyjjgu1SwaUsbOagOLCnh9WbdusNiTCwnKx mm7JonKXzEWLFkJMBpv0Ng+WACDZ7LBDY+NT0xps= 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 20/25] media: i2c: ov5675: simplify getting state container Date: Thu, 29 Oct 2020 17:42:34 +0100 Message-Id: <20201029164239.84240-20-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/ov5675.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c index 9540ce8918f0..5e35808037ad 100644 --- a/drivers/media/i2c/ov5675.c +++ b/drivers/media/i2c/ov5675.c @@ -889,8 +889,7 @@ static int ov5675_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused ov5675_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 ov5675 *ov5675 = to_ov5675(sd); mutex_lock(&ov5675->mutex); @@ -904,8 +903,7 @@ static int __maybe_unused ov5675_suspend(struct device *dev) static int __maybe_unused ov5675_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 ov5675 *ov5675 = to_ov5675(sd); int ret; From patchwork Thu Oct 29 16:42:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866869 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 2D2476A2 for ; Thu, 29 Oct 2020 16:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AF6E206F4 for ; Thu, 29 Oct 2020 16:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989877; bh=ohN4jmPLLF9AI0D2GnfqRAKU399Z6v8OgaI8Km2IjrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sCtly4jkfAX0yNb7bdZnTlddPpxi9cb0ivQ9c4MHJZhK2AQC4E1Y6H7B3oFueapKN E+Is8868gE64Rz5aJc124Wkjwqzn8SzZ3bT4nsyTLSPkj94yX72ibz/TmSLx+UHxJI N6+nUij6N/FMDHQPou9LcbH7QWXcv4+JjWAnNGYk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727657AbgJ2QoS (ORCPT ); Thu, 29 Oct 2020 12:44:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:53118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727661AbgJ2QoQ (ORCPT ); Thu, 29 Oct 2020 12:44:16 -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 19230206F4; Thu, 29 Oct 2020 16:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989855; bh=ohN4jmPLLF9AI0D2GnfqRAKU399Z6v8OgaI8Km2IjrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=adRyuKQqJZsq8ejIs3fGkH+qCZXScN/2jIBjQyLj4gFrdOOpNAIUgRsXZ5+zpj/L5 poOwCKEVxvVtdSgM5CjisVpmCdztytf8gAC1it2t4SRierG4bZNtkuPRkMS6JjOWMp N7U/mmGkrMApBtcyh9SWcf/nHNfOQXowOvQWJnps= 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 21/25] media: i2c: ov5695: simplify getting state container Date: Thu, 29 Oct 2020 17:42:35 +0100 Message-Id: <20201029164239.84240-21-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/ov5695.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c index cc678d9d2e0d..bbccb6f9582f 100644 --- a/drivers/media/i2c/ov5695.c +++ b/drivers/media/i2c/ov5695.c @@ -1033,8 +1033,7 @@ static void __ov5695_power_off(struct ov5695 *ov5695) static int __maybe_unused ov5695_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 ov5695 *ov5695 = to_ov5695(sd); return __ov5695_power_on(ov5695); @@ -1042,8 +1041,7 @@ static int __maybe_unused ov5695_runtime_resume(struct device *dev) static int __maybe_unused ov5695_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 ov5695 *ov5695 = to_ov5695(sd); __ov5695_power_off(ov5695); From patchwork Thu Oct 29 16:42:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866863 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 06BE41130 for ; Thu, 29 Oct 2020 16:44:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D993820838 for ; Thu, 29 Oct 2020 16:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989862; bh=OfNTGOEcq6a2/mVQk8B8PLTOw1S/yOSkRUMbqD2Ij+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=phGSFiIHe8hxhAq3CLrSGB+Vm4Yo2CycFkKuVVWY2j3Wrbgo4Y8c2/v+6VWbwHxlo lOoicL/OoR2lTOw6bXRxBUM6G+gaKAJX5ssiVRkraGT5JLd7jGVNnrGNVXQirTTFSZ krcf0x+0OK9yE8lK/Thq5ZaviJp5Uad3D9PVdKGQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727839AbgJ2QoV (ORCPT ); Thu, 29 Oct 2020 12:44:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:53240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727800AbgJ2QoU (ORCPT ); Thu, 29 Oct 2020 12:44:20 -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 34246214F1; Thu, 29 Oct 2020 16:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989859; bh=OfNTGOEcq6a2/mVQk8B8PLTOw1S/yOSkRUMbqD2Ij+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fu/66TMz3LD2zCFiDWwXs6dubafZE+6inbeIL/cHUwz9WUOH2C1ow2cxbbis51PzL /+tdEAP92GIOI4dqCEYTy9UNb2xfXTdM367+F5bWrTIF8Zko7/ZryhMaxQtb4Fn16K hQwK8wIpflZe3NBfuuSHWi3YYQZJZI6UXI7CoMrQ= 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 22/25] media: i2c: ov7740: simplify getting state container Date: Thu, 29 Oct 2020 17:42:36 +0100 Message-Id: <20201029164239.84240-22-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/ov7740.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c index 5832461c032d..47a9003d29d6 100644 --- a/drivers/media/i2c/ov7740.c +++ b/drivers/media/i2c/ov7740.c @@ -1176,8 +1176,7 @@ static int ov7740_remove(struct i2c_client *client) static int __maybe_unused ov7740_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 ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); ov7740_set_power(ov7740, 0); @@ -1187,8 +1186,7 @@ static int __maybe_unused ov7740_runtime_suspend(struct device *dev) static int __maybe_unused ov7740_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 ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); return ov7740_set_power(ov7740, 1); From patchwork Thu Oct 29 16:42:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866865 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 6F8C21130 for ; Thu, 29 Oct 2020 16:44:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C8FA214DB for ; Thu, 29 Oct 2020 16:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989867; bh=/ufwUgDdAZelFPtH61EoRk+exJnD63S/BqZaAPwIBKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=P9IJbUSUg/RoUo4jbjKc88YYcJhEnO21Y0bhCQP0DC81tCXJ2s21/Jo4lm4AYKWNY Wgaejd/NMkDXVXs5SqxL4lA+QwZKwnd9WDiR+C+xBYxRcz374va1CF83T3mHnj0DKT lsXXgJ9yuD2dV7lT/TTmz4EofCVNSpxi+qoSfdPo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727928AbgJ2Qo0 (ORCPT ); Thu, 29 Oct 2020 12:44:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:53360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727915AbgJ2QoY (ORCPT ); Thu, 29 Oct 2020 12:44:24 -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 5066E20FC3; Thu, 29 Oct 2020 16:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989864; bh=/ufwUgDdAZelFPtH61EoRk+exJnD63S/BqZaAPwIBKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QCXn6g62S5H4ubvQYGNNgJBYMQ0Bx9MYgpnWcyMWUDP4D4VC8IznQWTae5A6IONE3 YRHa/PZRgpfYk4yo5Xx3LzQQYdRBFBtkeOXyfjMsNXOL5/iCcjS6oGfDUJdAcpM/go qbF084o63w87rAkcGcGg7QwOZbXsAydL42DSXRcQ= 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 23/25] media: i2c: ov8856: simplify getting state container Date: Thu, 29 Oct 2020 17:42:37 +0100 Message-Id: <20201029164239.84240-23-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/ov8856.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c index 2f4ceaa80593..d8cefd3d4045 100644 --- a/drivers/media/i2c/ov8856.c +++ b/drivers/media/i2c/ov8856.c @@ -1417,8 +1417,7 @@ static void __ov8856_power_off(struct ov8856 *ov8856) static int __maybe_unused ov8856_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 ov8856 *ov8856 = to_ov8856(sd); mutex_lock(&ov8856->mutex); @@ -1433,8 +1432,7 @@ static int __maybe_unused ov8856_suspend(struct device *dev) static int __maybe_unused ov8856_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 ov8856 *ov8856 = to_ov8856(sd); int ret; From patchwork Thu Oct 29 16:42:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866867 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 AE6D41130 for ; Thu, 29 Oct 2020 16:44:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8BF7F20838 for ; Thu, 29 Oct 2020 16:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989871; bh=3yDbRUPbvdZNMHVu/Vf0C06aok0ewXf5UT2lmCSYepc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=n/R/H3cPSxpVkEeF3feLHh2s+uNfV/NCGJo8dH9Qj4Mn868Vy8My0cx9khNoxhiPD FQG8hN5OXUR0xtpmb/UfkhztK2nwfO7NH2obLMuI1klJjFnS3lamre5JkW+5MsK9rm e8DFACpqKMhq7WnBQQtt7mshXrl/EyIw6MkuLG4s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727970AbgJ2Qoa (ORCPT ); Thu, 29 Oct 2020 12:44:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:53466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727966AbgJ2Qo3 (ORCPT ); Thu, 29 Oct 2020 12:44:29 -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 8E09E21481; Thu, 29 Oct 2020 16:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989868; bh=3yDbRUPbvdZNMHVu/Vf0C06aok0ewXf5UT2lmCSYepc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YeDGP13Tib1i6Uhp99lYc1nHS411vJokupNilZ7VtfNAs2++DOZqeUcawv4pLXzJk AiqkQ9gQ+//fIKqtM/wQ+awQfhsHsi0TDLoBC07zViBVSriyPHK8cNW+E/I1B9owih nqVgxa4GupKcBUiCA6zZqiaNthlz0aSarVUNwYT8= 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 24/25] media: i2c: smiapp: simplify getting state container Date: Thu, 29 Oct 2020 17:42:38 +0100 Message-Id: <20201029164239.84240-24-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/smiapp/smiapp-core.c | 28 ++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 6fc0680a93d0..105ef29152e8 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -1185,8 +1185,7 @@ static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor) static int smiapp_power_on(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 smiapp_subdev *ssd = to_smiapp_subdev(subdev); /* * The sub-device related to the I2C device is always the @@ -1199,14 +1198,14 @@ static int smiapp_power_on(struct device *dev) rval = regulator_enable(sensor->vana); if (rval) { - dev_err(&client->dev, "failed to enable vana regulator\n"); + dev_err(dev, "failed to enable vana regulator\n"); return rval; } usleep_range(1000, 1000); rval = clk_prepare_enable(sensor->ext_clk); if (rval < 0) { - dev_dbg(&client->dev, "failed to enable xclk\n"); + dev_dbg(dev, "failed to enable xclk\n"); goto out_xclk_fail; } usleep_range(1000, 1000); @@ -1230,7 +1229,7 @@ static int smiapp_power_on(struct device *dev) if (sensor->hwcfg->i2c_addr_alt) { rval = smiapp_change_cci_addr(sensor); if (rval) { - dev_err(&client->dev, "cci address change error\n"); + dev_err(dev, "cci address change error\n"); goto out_cci_addr_fail; } } @@ -1238,14 +1237,14 @@ static int smiapp_power_on(struct device *dev) rval = smiapp_write(sensor, SMIAPP_REG_U8_SOFTWARE_RESET, SMIAPP_SOFTWARE_RESET); if (rval < 0) { - dev_err(&client->dev, "software reset failed\n"); + dev_err(dev, "software reset failed\n"); goto out_cci_addr_fail; } if (sensor->hwcfg->i2c_addr_alt) { rval = smiapp_change_cci_addr(sensor); if (rval) { - dev_err(&client->dev, "cci address change error\n"); + dev_err(dev, "cci address change error\n"); goto out_cci_addr_fail; } } @@ -1253,7 +1252,7 @@ static int smiapp_power_on(struct device *dev) rval = smiapp_write(sensor, SMIAPP_REG_U16_COMPRESSION_MODE, SMIAPP_COMPRESSION_MODE_SIMPLE_PREDICTOR); if (rval) { - dev_err(&client->dev, "compression mode set failed\n"); + dev_err(dev, "compression mode set failed\n"); goto out_cci_addr_fail; } @@ -1261,28 +1260,28 @@ static int smiapp_power_on(struct device *dev) sensor, SMIAPP_REG_U16_EXTCLK_FREQUENCY_MHZ, sensor->hwcfg->ext_clk / (1000000 / (1 << 8))); if (rval) { - dev_err(&client->dev, "extclk frequency set failed\n"); + dev_err(dev, "extclk frequency set failed\n"); goto out_cci_addr_fail; } rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_LANE_MODE, sensor->hwcfg->lanes - 1); if (rval) { - dev_err(&client->dev, "csi lane mode set failed\n"); + dev_err(dev, "csi lane mode set failed\n"); goto out_cci_addr_fail; } rval = smiapp_write(sensor, SMIAPP_REG_U8_FAST_STANDBY_CTRL, SMIAPP_FAST_STANDBY_CTRL_IMMEDIATE); if (rval) { - dev_err(&client->dev, "fast standby set failed\n"); + dev_err(dev, "fast standby set failed\n"); goto out_cci_addr_fail; } rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_SIGNALLING_MODE, sensor->hwcfg->csi_signalling_mode); if (rval) { - dev_err(&client->dev, "csi signalling mode set failed\n"); + dev_err(dev, "csi signalling mode set failed\n"); goto out_cci_addr_fail; } @@ -1294,7 +1293,7 @@ static int smiapp_power_on(struct device *dev) rval = smiapp_call_quirk(sensor, post_poweron); if (rval) { - dev_err(&client->dev, "post_poweron quirks failed\n"); + dev_err(dev, "post_poweron quirks failed\n"); goto out_cci_addr_fail; } @@ -1312,8 +1311,7 @@ static int smiapp_power_on(struct device *dev) static int smiapp_power_off(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 smiapp_subdev *ssd = to_smiapp_subdev(subdev); struct smiapp_sensor *sensor = container_of(ssd, struct smiapp_sensor, ssds[0]); From patchwork Thu Oct 29 16:42:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11866871 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 6A1CA14B7 for ; Thu, 29 Oct 2020 16:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 493C52151B for ; Thu, 29 Oct 2020 16:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989877; bh=TjWTEHAKNXgYSoWlJazs0qqZ+iSuookZr6vyZ0KE8/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TVI2rGio0PzcG9SY5VseO07jhV/XsdXvFoii9Brt9jDQ5ZlUVng1KCZ+i+wMe/8OD 9akOqrzvY4p5hoaYLm5R36otykBmI1vozIHYuN4bCokWlVH55BUPfNab2ZzSKKfNNt 08tbG1nTw/Mwj1qYy9TtUZCATnIWzBlHSZ3Ab3WY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727993AbgJ2Qog (ORCPT ); Thu, 29 Oct 2020 12:44:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:53578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727966AbgJ2Qod (ORCPT ); Thu, 29 Oct 2020 12:44:33 -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 AC60421548; Thu, 29 Oct 2020 16:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603989872; bh=TjWTEHAKNXgYSoWlJazs0qqZ+iSuookZr6vyZ0KE8/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IL0HwMAquJCtdqq90LzjQXrojZJ9rje6lRt0XQf9g1/HWJ8OF0wfZ9M9FFTn3MjxA 6D3zgq7E+X4j2whUpHsTpyyZBXhNkd8FxD4MPr2jmQbC0cyM3MsOZXKhvemM+fGReo WYJ59WImmMdGmGL1vIbm5uKxVY/TbhHxFP5E3/34= 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 25/25] media: i2c: tvp5150: simplify getting state container Date: Thu, 29 Oct 2020 17:42:39 +0100 Message-Id: <20201029164239.84240-25-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/tvp5150.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index 7d9401219a3a..29f65bb6103d 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -1413,8 +1413,7 @@ static const struct media_entity_operations tvp5150_sd_media_ops = { ****************************************************************************/ static int __maybe_unused tvp5150_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 tvp5150 *decoder = to_tvp5150(sd); if (decoder->irq) @@ -1427,8 +1426,7 @@ static int __maybe_unused tvp5150_runtime_suspend(struct device *dev) static int __maybe_unused tvp5150_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 tvp5150 *decoder = to_tvp5150(sd); if (decoder->irq)