diff mbox series

[v1,2/2] media: atomisp: Replace open-coded i2c_find_device_by_fwnode()

Message ID 20240326202813.1425431-3-andriy.shevchenko@linux.intel.com
State New
Headers show
Series media: atomisp: Fix and refactor PMIC I��C discovery | expand

Commit Message

Andy Shevchenko March 26, 2024, 8:27 p.m. UTC
gmin_i2c_dev_exists() is using open-coded variant of
i2c_find_device_by_fwnode(). Replace it with a corresponding call.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Hans de Goede April 10, 2024, 10:35 a.m. UTC | #1
Hi Andy,

Thank you for the patch.

On 3/26/24 9:27 PM, Andy Shevchenko wrote:
> gmin_i2c_dev_exists() is using open-coded variant of
> i2c_find_device_by_fwnode(). Replace it with a corresponding call.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
> index 80aa2211cdc3..b7c477280986 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
> @@ -394,12 +394,10 @@ static struct i2c_client *gmin_i2c_dev_exists(struct device *dev, char *name,
>  	if (!adev)
>  		return NULL;
>  
> -	d = bus_find_device_by_acpi_dev(&i2c_bus_type, adev);
> +	d = get_device(acpi_get_first_physical_node(adev));
>  	acpi_dev_put(adev);
> -	if (!d)
> -		return NULL;
>  
> -	*client = i2c_verify_client(d);
> +	*client = i2c_find_device_by_fwnode(dev_fwnode(d));
>  	put_device(d);
>  
>  	dev_dbg(dev, "found '%s' at address 0x%02x, adapter %d\n",

If we are ging to simplify this I think the change should be:
Andy Shevchenko April 10, 2024, 1:35 p.m. UTC | #2
On Wed, Apr 10, 2024 at 12:35:29PM +0200, Hans de Goede wrote:
> On 3/26/24 9:27 PM, Andy Shevchenko wrote:

...

> I'm going to merge this variant into my media-atomisp branch
> instead of the orignal.

Thanks!

This explains why changelog made the commit message.
Was it done deliberately?
Hans de Goede April 10, 2024, 1:41 p.m. UTC | #3
Hi Andy,

On 4/10/24 3:35 PM, Andy Shevchenko wrote:
> On Wed, Apr 10, 2024 at 12:35:29PM +0200, Hans de Goede wrote:
>> On 3/26/24 9:27 PM, Andy Shevchenko wrote:
> 
> ...
> 
>> I'm going to merge this variant into my media-atomisp branch
>> instead of the orignal.
> 
> Thanks!
> 
> This explains why changelog made the commit message.
> Was it done deliberately?

Oops, no that was by accident. I normally git send-email
+ git am my patches and then git am cuts it off...

I just send out a pull-request with this minor wart in it
(after testing), so unless there are other reasons to respin
I guess we'll have to live with it.

Regards,

Hans
Andy Shevchenko April 10, 2024, 1:49 p.m. UTC | #4
On Wed, Apr 10, 2024 at 03:41:15PM +0200, Hans de Goede wrote:
> On 4/10/24 3:35 PM, Andy Shevchenko wrote:
> > On Wed, Apr 10, 2024 at 12:35:29PM +0200, Hans de Goede wrote:
> >> On 3/26/24 9:27 PM, Andy Shevchenko wrote:

...

> >> I'm going to merge this variant into my media-atomisp branch
> >> instead of the orignal.
> > 
> > Thanks!
> > 
> > This explains why changelog made the commit message.
> > Was it done deliberately?
> 
> Oops, no that was by accident. I normally git send-email
> + git am my patches and then git am cuts it off...
> 
> I just send out a pull-request with this minor wart in it
> (after testing), so unless there are other reasons to respin
> I guess we'll have to live with it.

You might check the linux-next scripts or ask Stephen if this is an issue.
In any case we will know sooner or later :-)
diff mbox series

Patch

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 80aa2211cdc3..b7c477280986 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -394,12 +394,10 @@  static struct i2c_client *gmin_i2c_dev_exists(struct device *dev, char *name,
 	if (!adev)
 		return NULL;
 
-	d = bus_find_device_by_acpi_dev(&i2c_bus_type, adev);
+	d = get_device(acpi_get_first_physical_node(adev));
 	acpi_dev_put(adev);
-	if (!d)
-		return NULL;
 
-	*client = i2c_verify_client(d);
+	*client = i2c_find_device_by_fwnode(dev_fwnode(d));
 	put_device(d);
 
 	dev_dbg(dev, "found '%s' at address 0x%02x, adapter %d\n",