add/notify routines not called

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to write a kernel module that uses an acpi method to
communicate to a hardware device.

At this point I just want to load the driver and enumerate the devices
on the bus.

I found a fairly old but reasonable example on line, below is the
basic outline. I pretty much took the example verbatim just changing
names, I used acpidump to get the dsdt table get the correct device ID
etc.

The driver loads fine, but my add functions are not being called. My
suspicion is that I am missing a step to stimulate scanning the bus
after I register it. The example assumes the driver is loaded on boot.
Is there a way to request the bus be scanned after registering it such
that any devices attached to a registered bus will be added?
Understand that my suspicion may be wrong so if my assumptions are
wrong please correct me.

below is the source:

static int viking_acpi_add(struct acpi_device *device);
static int viking_acpi_remove(struct acpi_device *device);
static void viking_acpi_notify(struct acpi_device *adev, u32 event);

static const struct acpi_device_id nv_device_ids[] = {
    { "ACPI0012", 0},
    { "", 0},
};

MODULE_DEVICE_TABLE(acpi, nv_device_ids);

static struct acpi_driver nv_acpi_driver = {
    .name =         "NV NVDR",
    .class =        "NV",
    .ids =          nv_device_ids,
    .ops =          {
                            .add =          nv_acpi_add,
                            .remove =       nv_acpi_remove,
                            .notify =       nv_acpi_notify,
                       },
  .owner =    THIS_MODULE,
};

//static struct acpi_device acpi_dev;

static int nv_acpi_add(struct acpi_device *device)
{
    printk("NV: acpi bus add\n");
    return 0;
}

static int nv_remove(struct acpi_device *device)
{
    printk("NV: acpi bus remove\n");
    return 0;
}

static void nv_acpi_notify(struct acpi_device *adev, u32 event)
{
    device_lock(&adev->dev);
    printk("notification detected\n");
    device_unlock(&adev->dev);
}

static int __init nv_init(void)
{
    int result = 0;

    result = acpi_bus_register_driver(&nvt_driver);
    if (result < 0) {
        printk("Error registering driver\n");
        return -ENODEV;
    }

    return 0;
}

static void __exit nv_exit(void)
{
    acpi_bus_unregister_driver(&nv_driver);
}

module_init(nv_init);
module_exit(nv_exit);

Brian

-- 
CONFIDENTIALITY
This e-mail message and any attachments thereto, is intended only for use 
by the addressee(s) named herein and may contain legally privileged and/or 
confidential information. If you are not the intended recipient of this 
e-mail message, you are hereby notified that any dissemination, 
distribution or copying of this e-mail message, and any attachments 
thereto, is strictly prohibited. If you have received this e-mail message 
in error, please immediately notify the sender and permanently delete the 
original and any copies of this email and any prints thereof.
ABSENT AN EXPRESS STATEMENT TO THE CONTRARY HEREINABOVE, THIS E-MAIL IS NOT 
INTENDED AS A SUBSTITUTE FOR A WRITING. Notwithstanding the Uniform 
Electronic Transactions Act or the applicability of any other law of 
similar substance and effect, absent an express statement to the contrary 
hereinabove, this e-mail message its contents, and any attachments hereto 
are not intended to represent an offer or acceptance to enter into a 
contract and are not otherwise intended to bind the sender, Sanmina 
Corporation (or any of its subsidiaries), or any other person or entity.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux