public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] ACPI: bus: Introduce acpi_bus_for_each_dev()
Date: Wed, 2 Mar 2022 13:21:49 +0200	[thread overview]
Message-ID: <Yh9TTb6rBeTAw0iB@kuha.fi.intel.com> (raw)
In-Reply-To: <11943345.O9o76ZdvQC@kreacher>

On Tue, Feb 22, 2022 at 08:51:42PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> In order to avoid exposing acpi_bus_type to modules, introduce an
> acpi_bus_for_each_dev() helper for iterating over all ACPI device
> objects and make typec_link_ports() use it instead of the raw
> bus_for_each_dev() along with acpi_bus_type.
> 
> Having done that, drop the acpi_bus_type export.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

FWIW:

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

> ---
>  drivers/acpi/bus.c              |    7 ++++++-
>  drivers/usb/typec/port-mapper.c |    2 +-
>  include/acpi/acpi_bus.h         |    2 ++
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> Index: linux-pm/drivers/acpi/bus.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/bus.c
> +++ linux-pm/drivers/acpi/bus.c
> @@ -1043,7 +1043,12 @@ struct bus_type acpi_bus_type = {
>  	.remove		= acpi_device_remove,
>  	.uevent		= acpi_device_uevent,
>  };
> -EXPORT_SYMBOL_GPL(acpi_bus_type);
> +
> +int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data)
> +{
> +	return bus_for_each_dev(&acpi_bus_type, NULL, data, fn);
> +}
> +EXPORT_SYMBOL_GPL(acpi_bus_for_each_dev);
>  
>  /* --------------------------------------------------------------------------
>                               Initialization/Cleanup
> Index: linux-pm/include/acpi/acpi_bus.h
> ===================================================================
> --- linux-pm.orig/include/acpi/acpi_bus.h
> +++ linux-pm/include/acpi/acpi_bus.h
> @@ -480,6 +480,8 @@ void acpi_initialize_hp_context(struct a
>  /* acpi_device.dev.bus == &acpi_bus_type */
>  extern struct bus_type acpi_bus_type;
>  
> +int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data);
> +
>  /*
>   * Events
>   * ------
> Index: linux-pm/drivers/usb/typec/port-mapper.c
> ===================================================================
> --- linux-pm.orig/drivers/usb/typec/port-mapper.c
> +++ linux-pm/drivers/usb/typec/port-mapper.c
> @@ -59,7 +59,7 @@ int typec_link_ports(struct typec_port *
>  	if (!has_acpi_companion(&con->dev))
>  		return 0;
>  
> -	bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match);
> +	acpi_bus_for_each_dev(typec_port_match, &arg);
>  	if (!arg.match)
>  		return 0;
>  
> 
> 

-- 
heikki

      parent reply	other threads:[~2022-03-02 11:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 19:51 [PATCH v1] ACPI: bus: Introduce acpi_bus_for_each_dev() Rafael J. Wysocki
2022-02-23  6:53 ` Greg Kroah-Hartman
2022-03-02 11:21 ` Heikki Krogerus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yh9TTb6rBeTAw0iB@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox