* [PATCH 01/13] acpi: utils: Cleanup acpi_dev_match_cb [not found] <1559747630-28065-1-git-send-email-suzuki.poulose@arm.com> @ 2019-06-05 15:13 ` Suzuki K Poulose 2019-06-06 9:14 ` Rafael J. Wysocki 2019-06-05 15:13 ` [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device Suzuki K Poulose 1 sibling, 1 reply; 9+ messages in thread From: Suzuki K Poulose @ 2019-06-05 15:13 UTC (permalink / raw) To: linux-kernel Cc: gregkh, rafael, suzuki.poulose, Rafael J. Wysocki, Len Brown, linux-acpi acpi_dev_match_cb match function modifies the "data" argument to pass on a result which could be easily deduced from the result of the bus_find_device() call at the caller site. Clean this up in preparation to convert the "match" argument for bus_find_device to accept a "const" data pointer, similar to class_find_device. This would allow consolidating the match routines for these two APIs. Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Len Brown <lenb@kernel.org> Cc: linux-acpi@vger.kernel.org Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> --- drivers/acpi/utils.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 7def63a..1391b63 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -725,8 +725,6 @@ bool acpi_dev_found(const char *hid) EXPORT_SYMBOL(acpi_dev_found); struct acpi_dev_match_info { - const char *dev_name; - struct acpi_device *adev; struct acpi_device_id hid[2]; const char *uid; s64 hrv; @@ -746,9 +744,6 @@ static int acpi_dev_match_cb(struct device *dev, void *data) strcmp(adev->pnp.unique_id, match->uid))) return 0; - match->dev_name = acpi_dev_name(adev); - match->adev = adev; - if (match->hrv == -1) return 1; @@ -818,7 +813,7 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) match.hrv = hrv; dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); - return dev ? match.adev : NULL; + return dev ? to_acpi_device(dev) : NULL; } EXPORT_SYMBOL(acpi_dev_get_first_match_dev); -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 01/13] acpi: utils: Cleanup acpi_dev_match_cb 2019-06-05 15:13 ` [PATCH 01/13] acpi: utils: Cleanup acpi_dev_match_cb Suzuki K Poulose @ 2019-06-06 9:14 ` Rafael J. Wysocki 2019-06-06 9:21 ` Suzuki K Poulose 0 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2019-06-06 9:14 UTC (permalink / raw) To: Suzuki K Poulose Cc: Linux Kernel Mailing List, Greg Kroah-Hartman, Rafael J. Wysocki, Rafael J. Wysocki, Len Brown, ACPI Devel Maling List On Wed, Jun 5, 2019 at 5:14 PM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: > > acpi_dev_match_cb match function modifies the "data" argument > to pass on a result which could be easily deduced from the result > of the bus_find_device() call at the caller site. Clean this > up in preparation to convert the "match" argument for bus_find_device > to accept a "const" data pointer, similar to class_find_device. This > would allow consolidating the match routines for these two APIs. This changelog can be improved IMO. In fact, the final goal here is to pass (const void *) as the second argument to acpi_dev_match_cb() (which you could do right away in this patch if I'm not mistaken) which is because you want to modify the prototype of bus_find_device(). So why don't you write something like this in the changelog: "The prototype of bus_find_device() will be unified with that of class_find_device() subsequently, but for this purpose the callback functions passed to it need to take (const void *) as the second argument. Consequently, they cannot modify the memory pointed to by that argument which currently is not the case for acpi_dev_match_cb(). However, acpi_dev_match_cb() really need not modify the "match" object passed to it, because acpi_dev_get_first_match_dev() which uses it via bus_find_device() can easily convert the result of bus_find_device() into the pointer to return. For this reason, update acpi_dev_match_cb() to avoid the redundant memory updates and change the type of its second argument to (const void *)." > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> > Cc: Len Brown <lenb@kernel.org> > Cc: linux-acpi@vger.kernel.org > Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> > --- > drivers/acpi/utils.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c > index 7def63a..1391b63 100644 > --- a/drivers/acpi/utils.c > +++ b/drivers/acpi/utils.c > @@ -725,8 +725,6 @@ bool acpi_dev_found(const char *hid) > EXPORT_SYMBOL(acpi_dev_found); > > struct acpi_dev_match_info { > - const char *dev_name; > - struct acpi_device *adev; > struct acpi_device_id hid[2]; > const char *uid; > s64 hrv; > @@ -746,9 +744,6 @@ static int acpi_dev_match_cb(struct device *dev, void *data) And why not to change the type of the second arg to "const void *data" here? > strcmp(adev->pnp.unique_id, match->uid))) > return 0; > > - match->dev_name = acpi_dev_name(adev); > - match->adev = adev; > - > if (match->hrv == -1) > return 1; > > @@ -818,7 +813,7 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) > match.hrv = hrv; > > dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); > - return dev ? match.adev : NULL; > + return dev ? to_acpi_device(dev) : NULL; > } > EXPORT_SYMBOL(acpi_dev_get_first_match_dev); > > -- ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 01/13] acpi: utils: Cleanup acpi_dev_match_cb 2019-06-06 9:14 ` Rafael J. Wysocki @ 2019-06-06 9:21 ` Suzuki K Poulose 0 siblings, 0 replies; 9+ messages in thread From: Suzuki K Poulose @ 2019-06-06 9:21 UTC (permalink / raw) To: rafael; +Cc: linux-kernel, gregkh, rjw, lenb, linux-acpi Hi Rafael, On 06/06/2019 10:14, Rafael J. Wysocki wrote: > On Wed, Jun 5, 2019 at 5:14 PM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: >> >> acpi_dev_match_cb match function modifies the "data" argument >> to pass on a result which could be easily deduced from the result >> of the bus_find_device() call at the caller site. Clean this >> up in preparation to convert the "match" argument for bus_find_device >> to accept a "const" data pointer, similar to class_find_device. This >> would allow consolidating the match routines for these two APIs. > > This changelog can be improved IMO. I agree. Will update it. > > In fact, the final goal here is to pass (const void *) as the second > argument to acpi_dev_match_cb() (which you could do right away in this > patch if I'm not mistaken) which is because you want to modify the > prototype of bus_find_device(). > > So why don't you write something like this in the changelog: > > "The prototype of bus_find_device() will be unified with that of > class_find_device() subsequently, but for this purpose the callback > functions passed to it need to take (const void *) as the second > argument. Consequently, they cannot modify the memory pointed to by > that argument which currently is not the case for acpi_dev_match_cb(). > However, acpi_dev_match_cb() really need not modify the "match" object > passed to it, because acpi_dev_get_first_match_dev() which uses it via > bus_find_device() can easily convert the result of bus_find_device() > into the pointer to return. Sure. > For this reason, update acpi_dev_match_cb() to avoid the redundant > memory updates and change the type of its second argument to (const > void *)." We can't do that quite yet, until we unify the prototype of the bus_find_device(). >> >> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> >> Cc: Len Brown <lenb@kernel.org> >> Cc: linux-acpi@vger.kernel.org >> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> >> --- >> drivers/acpi/utils.c | 7 +------ >> 1 file changed, 1 insertion(+), 6 deletions(-) >> >> diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c >> index 7def63a..1391b63 100644 >> --- a/drivers/acpi/utils.c >> +++ b/drivers/acpi/utils.c >> @@ -725,8 +725,6 @@ bool acpi_dev_found(const char *hid) >> EXPORT_SYMBOL(acpi_dev_found); >> >> struct acpi_dev_match_info { >> - const char *dev_name; >> - struct acpi_device *adev; >> struct acpi_device_id hid[2]; >> const char *uid; >> s64 hrv; >> @@ -746,9 +744,6 @@ static int acpi_dev_match_cb(struct device *dev, void *data) > > And why not to change the type of the second arg to "const void *data" here? Because, that would conflict with what bus_find_device() expects now. We make the change only later. Since this change was a bit more intrusive than simply changing the type of the parameter, I kept it as a preparatory patch. Thanks for the review ! Suzuki ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device [not found] <1559747630-28065-1-git-send-email-suzuki.poulose@arm.com> 2019-06-05 15:13 ` [PATCH 01/13] acpi: utils: Cleanup acpi_dev_match_cb Suzuki K Poulose @ 2019-06-05 15:13 ` Suzuki K Poulose 2019-06-06 9:17 ` Rafael J. Wysocki 1 sibling, 1 reply; 9+ messages in thread From: Suzuki K Poulose @ 2019-06-05 15:13 UTC (permalink / raw) To: linux-kernel Cc: gregkh, rafael, suzuki.poulose, Len Brown, linux-acpi, linux-spi, Mark Brown Add a generic helper to match a device by the acpi device. Cc: Len Brown <lenb@kernel.org> Cc: linux-acpi@vger.kernel.org Cc: linux-spi@vger.kernel.org Cc: Mark Brown <broonie@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> --- drivers/base/core.c | 6 ++++++ include/linux/device.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index b827ca1..597095b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3346,3 +3346,9 @@ int device_match_devt(struct device *dev, const void *pdevt) return dev->devt == *(dev_t *)pdevt; } EXPORT_SYMBOL_GPL(device_match_devt); + +int device_match_acpi_dev(struct device *dev, const void *adev) +{ + return ACPI_COMPANION(dev) == adev; +} +EXPORT_SYMBOL(device_match_acpi_dev); diff --git a/include/linux/device.h b/include/linux/device.h index f315692..a03b50d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -166,6 +166,7 @@ void subsys_dev_iter_exit(struct subsys_dev_iter *iter); int device_match_of_node(struct device *dev, const void *np); int device_match_fwnode(struct device *dev, const void *fwnode); int device_match_devt(struct device *dev, const void *pdevt); +int device_match_acpi_dev(struct device *dev, const void *adev); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device 2019-06-05 15:13 ` [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device Suzuki K Poulose @ 2019-06-06 9:17 ` Rafael J. Wysocki 2019-06-06 9:28 ` Suzuki K Poulose 0 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2019-06-06 9:17 UTC (permalink / raw) To: Suzuki K Poulose Cc: Linux Kernel Mailing List, Greg Kroah-Hartman, Rafael J. Wysocki, Len Brown, ACPI Devel Maling List, linux-spi, Mark Brown On Wed, Jun 5, 2019 at 5:14 PM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: > > Add a generic helper to match a device by the acpi device. "by its ACPI companion device object", please. Also, it would be good to combine this patch with the patch(es) that cause device_match_acpi_dev() to be actually used. Helpers without any users are arguably not useful. > > Cc: Len Brown <lenb@kernel.org> > Cc: linux-acpi@vger.kernel.org > Cc: linux-spi@vger.kernel.org > Cc: Mark Brown <broonie@kernel.org> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: "Rafael J. Wysocki" <rafael@kernel.org> > Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> > --- > drivers/base/core.c | 6 ++++++ > include/linux/device.h | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/drivers/base/core.c b/drivers/base/core.c > index b827ca1..597095b 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -3346,3 +3346,9 @@ int device_match_devt(struct device *dev, const void *pdevt) > return dev->devt == *(dev_t *)pdevt; > } > EXPORT_SYMBOL_GPL(device_match_devt); > + > +int device_match_acpi_dev(struct device *dev, const void *adev) > +{ > + return ACPI_COMPANION(dev) == adev; > +} > +EXPORT_SYMBOL(device_match_acpi_dev); > diff --git a/include/linux/device.h b/include/linux/device.h > index f315692..a03b50d 100644 > --- a/include/linux/device.h > +++ b/include/linux/device.h > @@ -166,6 +166,7 @@ void subsys_dev_iter_exit(struct subsys_dev_iter *iter); > int device_match_of_node(struct device *dev, const void *np); > int device_match_fwnode(struct device *dev, const void *fwnode); > int device_match_devt(struct device *dev, const void *pdevt); > +int device_match_acpi_dev(struct device *dev, const void *adev); > > int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, > int (*fn)(struct device *dev, void *data)); > -- > 2.7.4 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device 2019-06-06 9:17 ` Rafael J. Wysocki @ 2019-06-06 9:28 ` Suzuki K Poulose 2019-06-06 9:57 ` Rafael J. Wysocki 0 siblings, 1 reply; 9+ messages in thread From: Suzuki K Poulose @ 2019-06-06 9:28 UTC (permalink / raw) To: rafael; +Cc: linux-kernel, gregkh, lenb, linux-acpi, linux-spi, broonie On 06/06/2019 10:17, Rafael J. Wysocki wrote: > On Wed, Jun 5, 2019 at 5:14 PM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: >> >> Add a generic helper to match a device by the acpi device. > > "by its ACPI companion device object", please. Sure. > > Also, it would be good to combine this patch with the patch(es) that > cause device_match_acpi_dev() to be actually used. > > Helpers without any users are arguably not useful. Sure, the helpers will be part of the part2 of the whole series, which will actually have the individual subsystems consuming the new helpers. For your reference, it is available here : http://linux-arm.org/git?p=linux-skp.git;a=shortlog;h=refs/heads/driver-cleanup/v2 e.g: http://linux-arm.org/git?p=linux-skp.git;a=commit;h=59534e843e2f214f1f29659993f6e423bef16b28 I could simply pull those patches into this part, if you prefer that. However, that would be true for the other patches in the part2. I am open to suggestions, on how to split the series. Cheers Suzuki ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device 2019-06-06 9:28 ` Suzuki K Poulose @ 2019-06-06 9:57 ` Rafael J. Wysocki 2019-06-12 9:43 ` Suzuki K Poulose 0 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2019-06-06 9:57 UTC (permalink / raw) To: Suzuki K Poulose Cc: Rafael J. Wysocki, Linux Kernel Mailing List, Greg Kroah-Hartman, Len Brown, ACPI Devel Maling List, linux-spi, Mark Brown On Thu, Jun 6, 2019 at 11:28 AM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: > > > > On 06/06/2019 10:17, Rafael J. Wysocki wrote: > > On Wed, Jun 5, 2019 at 5:14 PM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: > >> > >> Add a generic helper to match a device by the acpi device. > > > > "by its ACPI companion device object", please. > > Sure. > > > > > Also, it would be good to combine this patch with the patch(es) that > > cause device_match_acpi_dev() to be actually used. > > > > Helpers without any users are arguably not useful. > > Sure, the helpers will be part of the part2 of the whole series, > which will actually have the individual subsystems consuming the > new helpers. For your reference, it is available here : > > http://linux-arm.org/git?p=linux-skp.git;a=shortlog;h=refs/heads/driver-cleanup/v2 > > e.g: > http://linux-arm.org/git?p=linux-skp.git;a=commit;h=59534e843e2f214f1f29659993f6e423bef16b28 > > I could simply pull those patches into this part, if you prefer that. Not really. I'd rather do it the other way around: push the introduction of the helpers to part 2. > However, that would be true for the other patches in the part2. > I am open to suggestions, on how to split the series. You can introduce each helper along with its users in one patch. This way the total number of patches will be reduced and they will be easier to review IMO. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device 2019-06-06 9:57 ` Rafael J. Wysocki @ 2019-06-12 9:43 ` Suzuki K Poulose 2019-06-12 22:07 ` Rafael J. Wysocki 0 siblings, 1 reply; 9+ messages in thread From: Suzuki K Poulose @ 2019-06-12 9:43 UTC (permalink / raw) To: rafael; +Cc: linux-kernel, gregkh, lenb, linux-acpi, linux-spi, broonie Hi Rafael, On 06/06/2019 10:57, Rafael J. Wysocki wrote: > On Thu, Jun 6, 2019 at 11:28 AM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: >> >> >> >> On 06/06/2019 10:17, Rafael J. Wysocki wrote: >>> On Wed, Jun 5, 2019 at 5:14 PM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: >>>> >>>> Add a generic helper to match a device by the acpi device. >>> >>> "by its ACPI companion device object", please. >> >> Sure. >> >>> >>> Also, it would be good to combine this patch with the patch(es) that >>> cause device_match_acpi_dev() to be actually used. >>> >>> Helpers without any users are arguably not useful. >> >> Sure, the helpers will be part of the part2 of the whole series, >> which will actually have the individual subsystems consuming the >> new helpers. For your reference, it is available here : >> >> http://linux-arm.org/git?p=linux-skp.git;a=shortlog;h=refs/heads/driver-cleanup/v2 >> >> e.g: >> http://linux-arm.org/git?p=linux-skp.git;a=commit;h=59534e843e2f214f1f29659993f6e423bef16b28 >> >> I could simply pull those patches into this part, if you prefer that. > > Not really. > > I'd rather do it the other way around: push the introduction of the > helpers to part 2. Sure, I will do that. > >> However, that would be true for the other patches in the part2. >> I am open to suggestions, on how to split the series. > > You can introduce each helper along with its users in one patch. > > This way the total number of patches will be reduced and they will be > easier to review IMO. > Wouldn't it make the merging complicated ? I am still not clear how we plan to merge the part 2 ? Cheers Suzuki ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device 2019-06-12 9:43 ` Suzuki K Poulose @ 2019-06-12 22:07 ` Rafael J. Wysocki 0 siblings, 0 replies; 9+ messages in thread From: Rafael J. Wysocki @ 2019-06-12 22:07 UTC (permalink / raw) To: Suzuki K Poulose Cc: rafael, linux-kernel, gregkh, lenb, linux-acpi, linux-spi, broonie On Wednesday, June 12, 2019 11:43:38 AM CEST Suzuki K Poulose wrote: > Hi Rafael, > > On 06/06/2019 10:57, Rafael J. Wysocki wrote: > > On Thu, Jun 6, 2019 at 11:28 AM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: > >> > >> > >> > >> On 06/06/2019 10:17, Rafael J. Wysocki wrote: > >>> On Wed, Jun 5, 2019 at 5:14 PM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: > >>>> > >>>> Add a generic helper to match a device by the acpi device. > >>> > >>> "by its ACPI companion device object", please. > >> > >> Sure. > >> > >>> > >>> Also, it would be good to combine this patch with the patch(es) that > >>> cause device_match_acpi_dev() to be actually used. > >>> > >>> Helpers without any users are arguably not useful. > >> > >> Sure, the helpers will be part of the part2 of the whole series, > >> which will actually have the individual subsystems consuming the > >> new helpers. For your reference, it is available here : > >> > >> http://linux-arm.org/git?p=linux-skp.git;a=shortlog;h=refs/heads/driver-cleanup/v2 > >> > >> e.g: > >> http://linux-arm.org/git?p=linux-skp.git;a=commit;h=59534e843e2f214f1f29659993f6e423bef16b28 > >> > >> I could simply pull those patches into this part, if you prefer that. > > > > Not really. > > > > I'd rather do it the other way around: push the introduction of the > > helpers to part 2. > > Sure, I will do that. > > > > >> However, that would be true for the other patches in the part2. > >> I am open to suggestions, on how to split the series. > > > > You can introduce each helper along with its users in one patch. > > > > This way the total number of patches will be reduced and they will be > > easier to review IMO. > > > > Wouldn't it make the merging complicated ? I am still not clear how we plan > to merge the part 2 ? I wouldn't worry about it that much. Without review, you have nothing to merge anyway. Technically, every patch with a new helper and its users can go in via the Greg's tree as long as it has been ACKed by the maintainers of the code touched by it. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-06-13 17:12 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1559747630-28065-1-git-send-email-suzuki.poulose@arm.com> 2019-06-05 15:13 ` [PATCH 01/13] acpi: utils: Cleanup acpi_dev_match_cb Suzuki K Poulose 2019-06-06 9:14 ` Rafael J. Wysocki 2019-06-06 9:21 ` Suzuki K Poulose 2019-06-05 15:13 ` [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device Suzuki K Poulose 2019-06-06 9:17 ` Rafael J. Wysocki 2019-06-06 9:28 ` Suzuki K Poulose 2019-06-06 9:57 ` Rafael J. Wysocki 2019-06-12 9:43 ` Suzuki K Poulose 2019-06-12 22:07 ` Rafael J. Wysocki
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).