From: Bjorn Helgaas <bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
To: Karol Kozimor <sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
Cc: Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
julien.lerouge-GANU6spQydw@public.gmane.org,
acpi4asus-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] ACPI: make acpi_bus_register_driver() return zero for success, not device count
Date: Thu, 28 Jul 2005 10:07:53 -0600 [thread overview]
Message-ID: <200507281007.53805.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <200507280926.41472.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
On Thursday 28 July 2005 9:26 am, Bjorn Helgaas wrote:
> On Thursday 28 July 2005 5:58 am, Karol Kozimor wrote:
> > Ugh, not again... we've been there (early 2.6.x), done that and it was
> > absolutely confusing (I mean users reporting bogus bugs just because the
> > module was loaded type of confusing). Note that there's currently no easy
> > way to probe for a specific HID in ACPI namespace other than
> > acpi_bus_register_driver(), and unlike pci_register_driver() the former
> > has no hotplug mechanism to help.
>
> True. But your driver can use its own mechanism to determine whether
> it claimed any devices, and if not, call acpi_bus_unregister_driver()
> and then return -ENODEV from the module init function to cause the
> module to be unloaded.
Here's what I had in mind (untested). Would something like this
address your concern?
Index: work/drivers/acpi/asus_acpi.c
===================================================================
--- work.orig/drivers/acpi/asus_acpi.c 2005-07-27 13:52:21.000000000 -0600
+++ work/drivers/acpi/asus_acpi.c 2005-07-28 09:56:17.000000000 -0600
@@ -1111,6 +1111,8 @@
}
+static int __init asus_found;
+
static int __init asus_hotk_add(struct acpi_device *device)
{
acpi_status status = AE_OK;
@@ -1168,6 +1170,8 @@
}
}
+ asus_found = 1;
+
end:
if (result) {
kfree(hotk);
@@ -1221,6 +1225,12 @@
return -ENODEV;
}
+ if (!asus_found) {
+ acpi_bus_unregister_driver(&asus_hotk_driver);
+ remove_proc_entry(PROC_ASUS, acpi_root_dir);
+ return -ENODEV;
+ }
+
return 0;
}
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
next prev parent reply other threads:[~2005-07-28 16:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-27 22:28 [PATCH] ACPI: make acpi_bus_register_driver() return zero for success, not device count Bjorn Helgaas
[not found] ` <200507271628.25844.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-07-28 11:58 ` Karol Kozimor
[not found] ` <20050728115816.GA29744-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
2005-07-28 15:26 ` Bjorn Helgaas
[not found] ` <200507280926.41472.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-07-28 16:07 ` Bjorn Helgaas [this message]
[not found] ` <200507281007.53805.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-07-28 16:31 ` Karol Kozimor
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=200507281007.53805.bjorn.helgaas@hp.com \
--to=bjorn.helgaas-vxdhtt5mjny@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=acpi4asus-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=julien.lerouge-GANU6spQydw@public.gmane.org \
--cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org \
/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