diff mbox series

[v2,1/2] PCI: acpiphp: Allow built-in attention drivers

Message ID 20230930002036.6491-1-scott@os.amperecomputing.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series [v2,1/2] PCI: acpiphp: Allow built-in attention drivers | expand

Commit Message

D Scott Phillips Sept. 30, 2023, 12:20 a.m. UTC
Starting from the introduction of the attention callback in acpiphp, a
non-zero struct module *owner field has been required in
acpiphp_register_attention(). Then intent seemed to be that the core code
could then hold a refcount on the module while invoking a callback.

This check accidentally precludes the possiblity of attention callbacks to
drivers which are built-in.

Remove the check on `struct module *owner` in acpiphp_register_attention()
so that attention callbacks can also be registered from built-in drivers.

Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
---
Changes since v1:
- new patch in the series

 drivers/pci/hotplug/acpiphp_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

D Scott Phillips Oct. 11, 2023, 12:13 a.m. UTC | #1
D Scott Phillips <scott@os.amperecomputing.com> writes:

> Starting from the introduction of the attention callback in acpiphp, a
> non-zero struct module *owner field has been required in
> acpiphp_register_attention(). Then intent seemed to be that the core code
> could then hold a refcount on the module while invoking a callback.
>
> This check accidentally precludes the possiblity of attention callbacks to
> drivers which are built-in.
>
> Remove the check on `struct module *owner` in acpiphp_register_attention()
> so that attention callbacks can also be registered from built-in drivers.

Hi Bjorn, ping on these, thanks

Scott

>
> Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
> ---
> Changes since v1:
> - new patch in the series
>
>  drivers/pci/hotplug/acpiphp_core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
> index c02257f4b61c4..9dad14e80bcf2 100644
> --- a/drivers/pci/hotplug/acpiphp_core.c
> +++ b/drivers/pci/hotplug/acpiphp_core.c
> @@ -78,8 +78,7 @@ int acpiphp_register_attention(struct acpiphp_attention_info *info)
>  {
>  	int retval = -EINVAL;
>  
> -	if (info && info->owner && info->set_attn &&
> -			info->get_attn && !attention_info) {
> +	if (info && info->set_attn && info->get_attn && !attention_info) {
>  		retval = 0;
>  		attention_info = info;
>  	}
> -- 
> 2.41.0
diff mbox series

Patch

diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
index c02257f4b61c4..9dad14e80bcf2 100644
--- a/drivers/pci/hotplug/acpiphp_core.c
+++ b/drivers/pci/hotplug/acpiphp_core.c
@@ -78,8 +78,7 @@  int acpiphp_register_attention(struct acpiphp_attention_info *info)
 {
 	int retval = -EINVAL;
 
-	if (info && info->owner && info->set_attn &&
-			info->get_attn && !attention_info) {
+	if (info && info->set_attn && info->get_attn && !attention_info) {
 		retval = 0;
 		attention_info = info;
 	}