* [PATCH] i2c: ACPI: Replace acpi_bus_get_device()
@ 2022-02-01 18:00 Rafael J. Wysocki
2022-02-01 18:43 ` Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2022-02-01 18:00 UTC (permalink / raw)
To: Wolfram Sang
Cc: LKML, Linux ACPI, Andy Shevchenko, Mika Westerberg, linux-i2c
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Replace acpi_bus_get_device() that is going to be dropped with
acpi_fetch_acpi_dev().
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/i2c/i2c-core-acpi.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
Index: linux-pm/drivers/i2c/i2c-core-acpi.c
===================================================================
--- linux-pm.orig/drivers/i2c/i2c-core-acpi.c
+++ linux-pm/drivers/i2c/i2c-core-acpi.c
@@ -236,7 +236,8 @@ static int i2c_acpi_get_info(struct acpi
struct acpi_device *adapter_adev;
/* The adapter must be present */
- if (acpi_bus_get_device(lookup.adapter_handle, &adapter_adev))
+ adapter_adev = acpi_fetch_acpi_dev(lookup.adapter_handle);
+ if (!adapter_adev)
return -ENODEV;
if (acpi_bus_get_status(adapter_adev) ||
!adapter_adev->status.present)
@@ -275,13 +276,10 @@ static acpi_status i2c_acpi_add_device(a
void *data, void **return_value)
{
struct i2c_adapter *adapter = data;
- struct acpi_device *adev;
+ struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
struct i2c_board_info info;
- if (acpi_bus_get_device(handle, &adev))
- return AE_OK;
-
- if (i2c_acpi_get_info(adev, &info, adapter, NULL))
+ if (!adev || i2c_acpi_get_info(adev, &info, adapter, NULL))
return AE_OK;
i2c_acpi_register_device(adapter, adev, &info);
@@ -341,12 +339,9 @@ static acpi_status i2c_acpi_lookup_speed
void *data, void **return_value)
{
struct i2c_acpi_lookup *lookup = data;
- struct acpi_device *adev;
-
- if (acpi_bus_get_device(handle, &adev))
- return AE_OK;
+ struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
- if (i2c_acpi_do_lookup(adev, lookup))
+ if (!adev || i2c_acpi_do_lookup(adev, lookup))
return AE_OK;
if (lookup->search_handle != lookup->adapter_handle)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: ACPI: Replace acpi_bus_get_device()
2022-02-01 18:00 [PATCH] i2c: ACPI: Replace acpi_bus_get_device() Rafael J. Wysocki
@ 2022-02-01 18:43 ` Andy Shevchenko
2022-02-01 19:01 ` Rafael J. Wysocki
2022-02-02 14:46 ` Mika Westerberg
2022-02-07 16:01 ` Wolfram Sang
2 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2022-02-01 18:43 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Wolfram Sang, LKML, Linux ACPI, Mika Westerberg, linux-i2c
On Tue, Feb 01, 2022 at 07:00:42PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Replace acpi_bus_get_device() that is going to be dropped with
> acpi_fetch_acpi_dev().
>
> No intentional functional impact.
...
> + if (!adev || i2c_acpi_get_info(adev, &info, adapter, NULL))
AFAICS the !adev check is redundant since acpi_device_enumerated() does it.
> return AE_OK;
...
> + struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
>
> - if (i2c_acpi_do_lookup(adev, lookup))
> + if (!adev || i2c_acpi_do_lookup(adev, lookup))
> return AE_OK;
Here we need it indeed.
Dunno, if acpi_dev_ready_for_enumeration() can gain the check itself.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: ACPI: Replace acpi_bus_get_device()
2022-02-01 18:43 ` Andy Shevchenko
@ 2022-02-01 19:01 ` Rafael J. Wysocki
2022-02-01 20:18 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2022-02-01 19:01 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Rafael J. Wysocki, Wolfram Sang, LKML, Linux ACPI,
Mika Westerberg, linux-i2c
On Tue, Feb 1, 2022 at 7:44 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Tue, Feb 01, 2022 at 07:00:42PM +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > Replace acpi_bus_get_device() that is going to be dropped with
> > acpi_fetch_acpi_dev().
> >
> > No intentional functional impact.
>
> ...
>
> > + if (!adev || i2c_acpi_get_info(adev, &info, adapter, NULL))
>
> AFAICS the !adev check is redundant since acpi_device_enumerated() does it.
No.
acpi_device_enumerated() returns false if adev is NULL, so without
this extra check i2c_acpi_get_info() will end up passing NULL to
i2c_acpi_do_lookup().
> > return AE_OK;
>
> ...
>
> > + struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
> >
> > - if (i2c_acpi_do_lookup(adev, lookup))
> > + if (!adev || i2c_acpi_do_lookup(adev, lookup))
> > return AE_OK;
>
> Here we need it indeed.
> Dunno, if acpi_dev_ready_for_enumeration() can gain the check itself.
Well, acpi_bus_get_status() would need it too.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: ACPI: Replace acpi_bus_get_device()
2022-02-01 19:01 ` Rafael J. Wysocki
@ 2022-02-01 20:18 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2022-02-01 20:18 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Rafael J. Wysocki, Wolfram Sang, LKML, Linux ACPI,
Mika Westerberg, linux-i2c
On Tue, Feb 01, 2022 at 08:01:46PM +0100, Rafael J. Wysocki wrote:
> On Tue, Feb 1, 2022 at 7:44 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Tue, Feb 01, 2022 at 07:00:42PM +0100, Rafael J. Wysocki wrote:
> > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > >
> > > Replace acpi_bus_get_device() that is going to be dropped with
> > > acpi_fetch_acpi_dev().
> > >
> > > No intentional functional impact.
> >
> > ...
> >
> > > + if (!adev || i2c_acpi_get_info(adev, &info, adapter, NULL))
> >
> > AFAICS the !adev check is redundant since acpi_device_enumerated() does it.
>
> No.
>
> acpi_device_enumerated() returns false if adev is NULL, so without
> this extra check i2c_acpi_get_info() will end up passing NULL to
> i2c_acpi_do_lookup().
I see now.
The patch LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > return AE_OK;
> >
> > ...
> >
> > > + struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
> > >
> > > - if (i2c_acpi_do_lookup(adev, lookup))
> > > + if (!adev || i2c_acpi_do_lookup(adev, lookup))
> > > return AE_OK;
> >
> > Here we need it indeed.
> > Dunno, if acpi_dev_ready_for_enumeration() can gain the check itself.
>
> Well, acpi_bus_get_status() would need it too.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: ACPI: Replace acpi_bus_get_device()
2022-02-01 18:00 [PATCH] i2c: ACPI: Replace acpi_bus_get_device() Rafael J. Wysocki
2022-02-01 18:43 ` Andy Shevchenko
@ 2022-02-02 14:46 ` Mika Westerberg
2022-02-07 16:01 ` Wolfram Sang
2 siblings, 0 replies; 6+ messages in thread
From: Mika Westerberg @ 2022-02-02 14:46 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Wolfram Sang, LKML, Linux ACPI, Andy Shevchenko, linux-i2c
On Tue, Feb 01, 2022 at 07:00:42PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Replace acpi_bus_get_device() that is going to be dropped with
> acpi_fetch_acpi_dev().
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] i2c: ACPI: Replace acpi_bus_get_device()
2022-02-01 18:00 [PATCH] i2c: ACPI: Replace acpi_bus_get_device() Rafael J. Wysocki
2022-02-01 18:43 ` Andy Shevchenko
2022-02-02 14:46 ` Mika Westerberg
@ 2022-02-07 16:01 ` Wolfram Sang
2 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2022-02-07 16:01 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: LKML, Linux ACPI, Andy Shevchenko, Mika Westerberg, linux-i2c
[-- Attachment #1: Type: text/plain, Size: 468 bytes --]
On Tue, Feb 01, 2022 at 07:00:42PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Replace acpi_bus_get_device() that is going to be dropped with
> acpi_fetch_acpi_dev().
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Applied to for-next, thanks! Let me know if you need it in for-current
instead to get rid of the to-be-deprecated function earlier.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-07 16:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 18:00 [PATCH] i2c: ACPI: Replace acpi_bus_get_device() Rafael J. Wysocki
2022-02-01 18:43 ` Andy Shevchenko
2022-02-01 19:01 ` Rafael J. Wysocki
2022-02-01 20:18 ` Andy Shevchenko
2022-02-02 14:46 ` Mika Westerberg
2022-02-07 16:01 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).