diff mbox series

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

Message ID 20221118185617.33908-1-andriy.shevchenko@linux.intel.com
State Accepted
Commit 1c856b4b114331d13ee01e92d3fa638797759748
Headers show
Series [v1,1/4] media: ipu3-cio2: Don't dereference fwnode handle | expand

Commit Message

Andy Shevchenko Nov. 18, 2022, 6:56 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>
---
 drivers/media/pci/intel/ipu3/cio2-bridge.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Heikki Krogerus Nov. 21, 2022, 9:02 a.m. UTC | #1
On Fri, Nov 18, 2022 at 08:56:14PM +0200, Andy Shevchenko wrote:
> 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>
> ---
>  drivers/media/pci/intel/ipu3/cio2-bridge.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> 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);
>  

This and also the others look good to me. FWIW, for the series:

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

thanks,
diff mbox series

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);