[v2,1/4] media: ipu3-cio2: Don't dereference fwnode handle

Message ID 20221121152704.30180-1-andriy.shevchenko@linux.intel.com
State New
Headers
Series [v2,1/4] media: ipu3-cio2: Don't dereference fwnode handle |

Commit Message

Andy Shevchenko Nov. 21, 2022, 3:27 p.m. UTC
  Use acpi_fwnode_handle() instead of dereferencing an fwnode handle directly,
which is a better coding practice.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Daniel Scally <dan.scally@ideasonboard.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
---
v2: added tags (Heikki, Daniel)

 drivers/media/pci/intel/ipu3/cio2-bridge.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Andy Shevchenko Nov. 23, 2022, 6:01 p.m. UTC | #1
+ Cc: Petr, Sergey

On Mon, Nov 21, 2022 at 05:27:01PM +0200, Andy Shevchenko wrote:
> Use acpi_fwnode_handle() instead of dereferencing an fwnode handle directly,
> which is a better coding practice.

It appears that this series depends on fd070e8ceb90 ("test_printf: Refactor
fwnode_pointer() to make it more readable") which is in PRINTK tree.

Sakari, Mauro, if you are okay to route this via that tree, can we get your
tags for that? Otherwise we need to postpone this till v6.2-rc1 (but I would
like to decrease the chances to appear a new user of the to be removed API).
  
Andy Shevchenko Nov. 23, 2022, 7:10 p.m. UTC | #2
Dunno what happened to my previous reply to this. Okay, trying again...

+ Cc: Petr, Sergey

On Mon, Nov 21, 2022 at 05:27:01PM +0200, Andy Shevchenko wrote:
> Use acpi_fwnode_handle() instead of dereferencing an fwnode handle directly,
> which is a better coding practice.

It appears that this series depends on fd070e8ceb90 ("test_printf: Refactor
fwnode_pointer() to make it more readable") which is in PRINTK tree.

Sakari, Mauro, if you are okay to route this via that tree, can we get your
tags for that? Otherwise we need to postpone this till v6.2-rc1 (but I would
like to decrease the chances to appear a new user of the to be removed API).

Note, that Greg Acked v1 of the swnode patches (which are the same in v2).
  
Sakari Ailus Dec. 7, 2022, 9:02 a.m. UTC | #3
Hi Andy,

On Wed, Nov 23, 2022 at 09:10:58PM +0200, Andy Shevchenko wrote:
> Dunno what happened to my previous reply to this. Okay, trying again...
> 
> + Cc: Petr, Sergey
> 
> On Mon, Nov 21, 2022 at 05:27:01PM +0200, Andy Shevchenko wrote:
> > Use acpi_fwnode_handle() instead of dereferencing an fwnode handle directly,
> > which is a better coding practice.
> 
> It appears that this series depends on fd070e8ceb90 ("test_printf: Refactor
> fwnode_pointer() to make it more readable") which is in PRINTK tree.
> 
> Sakari, Mauro, if you are okay to route this via that tree, can we get your
> tags for that? Otherwise we need to postpone this till v6.2-rc1 (but I would
> like to decrease the chances to appear a new user of the to be removed API).
> 
> Note, that Greg Acked v1 of the swnode patches (which are the same in v2).

Sorry for the late reply. Feel free to do that if it's not too late, with:

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

I don't think the linkelihood for having a new user for this API is high.
  
Andy Shevchenko Dec. 7, 2022, 9:53 a.m. UTC | #4
On Wed, Dec 07, 2022 at 09:02:49AM +0000, Sakari Ailus wrote:
> On Wed, Nov 23, 2022 at 09:10:58PM +0200, Andy Shevchenko wrote:
> > Dunno what happened to my previous reply to this. Okay, trying again...
> > 
> > + Cc: Petr, Sergey
> > 
> > On Mon, Nov 21, 2022 at 05:27:01PM +0200, Andy Shevchenko wrote:
> > > Use acpi_fwnode_handle() instead of dereferencing an fwnode handle directly,
> > > which is a better coding practice.
> > 
> > It appears that this series depends on fd070e8ceb90 ("test_printf: Refactor
> > fwnode_pointer() to make it more readable") which is in PRINTK tree.
> > 
> > Sakari, Mauro, if you are okay to route this via that tree, can we get your
> > tags for that? Otherwise we need to postpone this till v6.2-rc1 (but I would
> > like to decrease the chances to appear a new user of the to be removed API).
> > 
> > Note, that Greg Acked v1 of the swnode patches (which are the same in v2).
> 
> Sorry for the late reply. Feel free to do that if it's not too late, with:
> 
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Thank you!
I think it's a bit late for printk tree to consume this. If it's the case
(Petr?) then I will submit a new version after v6.2-rc1 is out.

> I don't think the linkelihood for having a new user for this API is high.
  
Sakari Ailus Dec. 7, 2022, 2 p.m. UTC | #5
On Wed, Dec 07, 2022 at 11:53:12AM +0200, Andy Shevchenko wrote:
> On Wed, Dec 07, 2022 at 09:02:49AM +0000, Sakari Ailus wrote:
> > On Wed, Nov 23, 2022 at 09:10:58PM +0200, Andy Shevchenko wrote:
> > > Dunno what happened to my previous reply to this. Okay, trying again...
> > > 
> > > + Cc: Petr, Sergey
> > > 
> > > On Mon, Nov 21, 2022 at 05:27:01PM +0200, Andy Shevchenko wrote:
> > > > Use acpi_fwnode_handle() instead of dereferencing an fwnode handle directly,
> > > > which is a better coding practice.
> > > 
> > > It appears that this series depends on fd070e8ceb90 ("test_printf: Refactor
> > > fwnode_pointer() to make it more readable") which is in PRINTK tree.
> > > 
> > > Sakari, Mauro, if you are okay to route this via that tree, can we get your
> > > tags for that? Otherwise we need to postpone this till v6.2-rc1 (but I would
> > > like to decrease the chances to appear a new user of the to be removed API).
> > > 
> > > Note, that Greg Acked v1 of the swnode patches (which are the same in v2).
> > 
> > Sorry for the late reply. Feel free to do that if it's not too late, with:
> > 
> > Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

I intended to add this applies to the set.

> 
> Thank you!
> I think it's a bit late for printk tree to consume this. If it's the case
> (Petr?) then I will submit a new version after v6.2-rc1 is out.
> 
> > I don't think the linkelihood for having a new user for this API is high.
  
Petr Mladek Dec. 8, 2022, 10:35 a.m. UTC | #6
On Wed 2022-12-07 11:53:12, Andy Shevchenko wrote:
> On Wed, Dec 07, 2022 at 09:02:49AM +0000, Sakari Ailus wrote:
> > On Wed, Nov 23, 2022 at 09:10:58PM +0200, Andy Shevchenko wrote:
> > > Dunno what happened to my previous reply to this. Okay, trying again...
> > > 
> > > + Cc: Petr, Sergey
> > > 
> > > On Mon, Nov 21, 2022 at 05:27:01PM +0200, Andy Shevchenko wrote:
> > > > Use acpi_fwnode_handle() instead of dereferencing an fwnode handle directly,
> > > > which is a better coding practice.
> > > 
> > > It appears that this series depends on fd070e8ceb90 ("test_printf: Refactor
> > > fwnode_pointer() to make it more readable") which is in PRINTK tree.
> > > 
> > > Sakari, Mauro, if you are okay to route this via that tree, can we get your
> > > tags for that? Otherwise we need to postpone this till v6.2-rc1 (but I would
> > > like to decrease the chances to appear a new user of the to be removed API).
> > > 
> > > Note, that Greg Acked v1 of the swnode patches (which are the same in v2).
> > 
> > Sorry for the late reply. Feel free to do that if it's not too late, with:
> > 
> > Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> Thank you!
> I think it's a bit late for printk tree to consume this. If it's the case
> (Petr?) then I will submit a new version after v6.2-rc1 is out.

Yes, I am sorry but it is too late for the printk tree. I am going to
send the pull request for 6.2 today or tomorrow. Linus explicitly
asked to send the pull request early this time because the merge
window will be overlapping with the holidays.

On the positive side. There is a high chance that the changes from
the printk tree will be in the mainline early enough so that you
could manage to send this still during the merge window.

Best Regards,
Petr
  

Patch

diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.c b/drivers/media/pci/intel/ipu3/cio2-bridge.c
index df6c94da2f6a..18974a72e94a 100644
--- a/drivers/media/pci/intel/ipu3/cio2-bridge.c
+++ b/drivers/media/pci/intel/ipu3/cio2-bridge.c
@@ -263,7 +263,7 @@  static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg,
 				      struct cio2_bridge *bridge,
 				      struct pci_dev *cio2)
 {
-	struct fwnode_handle *fwnode;
+	struct fwnode_handle *fwnode, *primary;
 	struct cio2_sensor *sensor;
 	struct acpi_device *adev;
 	acpi_status status;
@@ -322,7 +322,9 @@  static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg,
 		}
 
 		sensor->adev = acpi_dev_get(adev);
-		adev->fwnode.secondary = fwnode;
+
+		primary = acpi_fwnode_handle(adev);
+		primary->secondary = fwnode;
 
 		cio2_bridge_instantiate_vcm_i2c_client(sensor);