Commit 5001f861 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
  ACPI: EC: Don't parse DSDT for EC early init on Compal
  ACPI: EC: Rewrite DMI checks
  ACPI: dock: fix "sibiling" typo
  ACPI: kill overly verbose "throttling states" log messages
  ACPI: Fix bound checks for copy_from_user in the acpi /proc code
  ACPI: fix bus scanning memory leaks
  ACPI: EC: Restart command even if no interrupts from EC
  sony-laptop: Don't unregister the SPIC driver if it wasn't registered
  sony-laptop: remove _INI call at init time
  sony-laptop: SPIC unset IRQF_SHARED, set IRQF_DISABLED
  sony-laptop: remove device_ctrl and the SPIC mini drivers
parents 663cc813 c7db7ba5
...@@ -67,7 +67,7 @@ struct dock_station { ...@@ -67,7 +67,7 @@ struct dock_station {
struct list_head dependent_devices; struct list_head dependent_devices;
struct list_head hotplug_devices; struct list_head hotplug_devices;
struct list_head sibiling; struct list_head sibling;
struct platform_device *dock_device; struct platform_device *dock_device;
}; };
static LIST_HEAD(dock_stations); static LIST_HEAD(dock_stations);
...@@ -275,7 +275,7 @@ int is_dock_device(acpi_handle handle) ...@@ -275,7 +275,7 @@ int is_dock_device(acpi_handle handle)
if (is_dock(handle)) if (is_dock(handle))
return 1; return 1;
list_for_each_entry(dock_station, &dock_stations, sibiling) { list_for_each_entry(dock_station, &dock_stations, sibling) {
if (find_dock_dependent_device(dock_station, handle)) if (find_dock_dependent_device(dock_station, handle))
return 1; return 1;
} }
...@@ -619,7 +619,7 @@ register_hotplug_dock_device(acpi_handle handle, struct acpi_dock_ops *ops, ...@@ -619,7 +619,7 @@ register_hotplug_dock_device(acpi_handle handle, struct acpi_dock_ops *ops,
* make sure this handle is for a device dependent on the dock, * make sure this handle is for a device dependent on the dock,
* this would include the dock station itself * this would include the dock station itself
*/ */
list_for_each_entry(dock_station, &dock_stations, sibiling) { list_for_each_entry(dock_station, &dock_stations, sibling) {
/* /*
* An ATA bay can be in a dock and itself can be ejected * An ATA bay can be in a dock and itself can be ejected
* seperately, so there are two 'dock stations' which need the * seperately, so there are two 'dock stations' which need the
...@@ -651,7 +651,7 @@ void unregister_hotplug_dock_device(acpi_handle handle) ...@@ -651,7 +651,7 @@ void unregister_hotplug_dock_device(acpi_handle handle)
if (!dock_station_count) if (!dock_station_count)
return; return;
list_for_each_entry(dock_station, &dock_stations, sibiling) { list_for_each_entry(dock_station, &dock_stations, sibling) {
dd = find_dock_dependent_device(dock_station, handle); dd = find_dock_dependent_device(dock_station, handle);
if (dd) if (dd)
dock_del_hotplug_device(dock_station, dd); dock_del_hotplug_device(dock_station, dd);
...@@ -787,7 +787,7 @@ static int acpi_dock_notifier_call(struct notifier_block *this, ...@@ -787,7 +787,7 @@ static int acpi_dock_notifier_call(struct notifier_block *this,
if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK
&& event != ACPI_NOTIFY_EJECT_REQUEST) && event != ACPI_NOTIFY_EJECT_REQUEST)
return 0; return 0;
list_for_each_entry(dock_station, &dock_stations, sibiling) { list_for_each_entry(dock_station, &dock_stations, sibling) {
if (dock_station->handle == handle) { if (dock_station->handle == handle) {
struct dock_data *dock_data; struct dock_data *dock_data;
...@@ -958,7 +958,7 @@ static int dock_add(acpi_handle handle) ...@@ -958,7 +958,7 @@ static int dock_add(acpi_handle handle)
dock_station->last_dock_time = jiffies - HZ; dock_station->last_dock_time = jiffies - HZ;
INIT_LIST_HEAD(&dock_station->dependent_devices); INIT_LIST_HEAD(&dock_station->dependent_devices);
INIT_LIST_HEAD(&dock_station->hotplug_devices); INIT_LIST_HEAD(&dock_station->hotplug_devices);
INIT_LIST_HEAD(&dock_station->sibiling); INIT_LIST_HEAD(&dock_station->sibling);
spin_lock_init(&dock_station->dd_lock); spin_lock_init(&dock_station->dd_lock);
mutex_init(&dock_station->hp_lock); mutex_init(&dock_station->hp_lock);
ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list); ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list);
...@@ -1044,7 +1044,7 @@ static int dock_add(acpi_handle handle) ...@@ -1044,7 +1044,7 @@ static int dock_add(acpi_handle handle)
add_dock_dependent_device(dock_station, dd); add_dock_dependent_device(dock_station, dd);
dock_station_count++; dock_station_count++;
list_add(&dock_station->sibiling, &dock_stations); list_add(&dock_station->sibling, &dock_stations);
return 0; return 0;
dock_add_err_unregister: dock_add_err_unregister:
...@@ -1149,7 +1149,7 @@ static void __exit dock_exit(void) ...@@ -1149,7 +1149,7 @@ static void __exit dock_exit(void)
struct dock_station *tmp; struct dock_station *tmp;
unregister_acpi_bus_notifier(&dock_acpi_notifier); unregister_acpi_bus_notifier(&dock_acpi_notifier);
list_for_each_entry_safe(dock_station, tmp, &dock_stations, sibiling) list_for_each_entry_safe(dock_station, tmp, &dock_stations, sibling)
dock_remove(dock_station); dock_remove(dock_station);
} }
......
...@@ -119,6 +119,8 @@ static struct acpi_ec { ...@@ -119,6 +119,8 @@ static struct acpi_ec {
} *boot_ec, *first_ec; } *boot_ec, *first_ec;
static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */ static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */
static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */
static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Transaction Management Transaction Management
...@@ -232,10 +234,8 @@ static int ec_poll(struct acpi_ec *ec) ...@@ -232,10 +234,8 @@ static int ec_poll(struct acpi_ec *ec)
} }
advance_transaction(ec, acpi_ec_read_status(ec)); advance_transaction(ec, acpi_ec_read_status(ec));
} while (time_before(jiffies, delay)); } while (time_before(jiffies, delay));
if (!ec->curr->irq_count || if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)
(acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF))
break; break;
/* try restart command if we get any false interrupts */
pr_debug(PREFIX "controller reset, restart transaction\n"); pr_debug(PREFIX "controller reset, restart transaction\n");
spin_lock_irqsave(&ec->curr_lock, flags); spin_lock_irqsave(&ec->curr_lock, flags);
start_transaction(ec); start_transaction(ec);
...@@ -899,6 +899,44 @@ static const struct acpi_device_id ec_device_ids[] = { ...@@ -899,6 +899,44 @@ static const struct acpi_device_id ec_device_ids[] = {
{"", 0}, {"", 0},
}; };
/* Some BIOS do not survive early DSDT scan, skip it */
static int ec_skip_dsdt_scan(const struct dmi_system_id *id)
{
EC_FLAGS_SKIP_DSDT_SCAN = 1;
return 0;
}
/* ASUStek often supplies us with broken ECDT, validate it */
static int ec_validate_ecdt(const struct dmi_system_id *id)
{
EC_FLAGS_VALIDATE_ECDT = 1;
return 0;
}
/* MSI EC needs special treatment, enable it */
static int ec_flag_msi(const struct dmi_system_id *id)
{
EC_FLAGS_MSI = 1;
EC_FLAGS_VALIDATE_ECDT = 1;
return 0;
}
static struct dmi_system_id __initdata ec_dmi_table[] = {
{
ec_skip_dsdt_scan, "Compal JFL92", {
DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
DMI_MATCH(DMI_BOARD_NAME, "JFL92") }, NULL},
{
ec_flag_msi, "MSI hardware", {
DMI_MATCH(DMI_BIOS_VENDOR, "Micro-Star"),
DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star") }, NULL},
{
ec_validate_ecdt, "ASUS hardware", {
DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL},
{},
};
int __init acpi_ec_ecdt_probe(void) int __init acpi_ec_ecdt_probe(void)
{ {
acpi_status status; acpi_status status;
...@@ -911,11 +949,7 @@ int __init acpi_ec_ecdt_probe(void) ...@@ -911,11 +949,7 @@ int __init acpi_ec_ecdt_probe(void)
/* /*
* Generate a boot ec context * Generate a boot ec context
*/ */
if (dmi_name_in_vendors("Micro-Star") || dmi_check_system(ec_dmi_table);
dmi_name_in_vendors("Notebook")) {
pr_info(PREFIX "Enabling special treatment for EC from MSI.\n");
EC_FLAGS_MSI = 1;
}
status = acpi_get_table(ACPI_SIG_ECDT, 1, status = acpi_get_table(ACPI_SIG_ECDT, 1,
(struct acpi_table_header **)&ecdt_ptr); (struct acpi_table_header **)&ecdt_ptr);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
...@@ -926,7 +960,7 @@ int __init acpi_ec_ecdt_probe(void) ...@@ -926,7 +960,7 @@ int __init acpi_ec_ecdt_probe(void)
boot_ec->handle = ACPI_ROOT_OBJECT; boot_ec->handle = ACPI_ROOT_OBJECT;
acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
/* Don't trust ECDT, which comes from ASUSTek */ /* Don't trust ECDT, which comes from ASUSTek */
if (!dmi_name_in_vendors("ASUS") && EC_FLAGS_MSI == 0) if (!EC_FLAGS_VALIDATE_ECDT)
goto install; goto install;
saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
if (!saved_ec) if (!saved_ec)
...@@ -934,6 +968,10 @@ int __init acpi_ec_ecdt_probe(void) ...@@ -934,6 +968,10 @@ int __init acpi_ec_ecdt_probe(void)
memcpy(saved_ec, boot_ec, sizeof(struct acpi_ec)); memcpy(saved_ec, boot_ec, sizeof(struct acpi_ec));
/* fall through */ /* fall through */
} }
if (EC_FLAGS_SKIP_DSDT_SCAN)
return -ENODEV;
/* This workaround is needed only on some broken machines, /* This workaround is needed only on some broken machines,
* which require early EC, but fail to provide ECDT */ * which require early EC, but fail to provide ECDT */
printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
......
...@@ -398,6 +398,8 @@ acpi_system_write_wakeup_device(struct file *file, ...@@ -398,6 +398,8 @@ acpi_system_write_wakeup_device(struct file *file,
if (len > 4) if (len > 4)
len = 4; len = 4;
if (len < 0)
return -EFAULT;
if (copy_from_user(strbuf, buffer, len)) if (copy_from_user(strbuf, buffer, len))
return -EFAULT; return -EFAULT;
......
...@@ -863,13 +863,6 @@ static int acpi_processor_add(struct acpi_device *device) ...@@ -863,13 +863,6 @@ static int acpi_processor_add(struct acpi_device *device)
goto err_remove_sysfs; goto err_remove_sysfs;
} }
if (pr->flags.throttling) {
printk(KERN_INFO PREFIX "%s [%s] (supports",
acpi_device_name(device), acpi_device_bid(device));
printk(" %d throttling states", pr->throttling.state_count);
printk(")\n");
}
return 0; return 0;
err_remove_sysfs: err_remove_sysfs:
......
...@@ -1052,6 +1052,8 @@ static void acpi_device_set_id(struct acpi_device *device) ...@@ -1052,6 +1052,8 @@ static void acpi_device_set_id(struct acpi_device *device)
device->flags.bus_address = 1; device->flags.bus_address = 1;
} }
kfree(info);
/* /*
* Some devices don't reliably have _HIDs & _CIDs, so add * Some devices don't reliably have _HIDs & _CIDs, so add
* synthetic HIDs to make sure drivers can find them. * synthetic HIDs to make sure drivers can find them.
...@@ -1325,13 +1327,8 @@ static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops, ...@@ -1325,13 +1327,8 @@ static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops,
struct acpi_device **child) struct acpi_device **child)
{ {
acpi_status status; acpi_status status;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
void *device = NULL; void *device = NULL;
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
printk(KERN_INFO PREFIX "Enumerating devices from [%s]\n",
(char *) buffer.pointer);
status = acpi_bus_check_add(handle, 0, ops, &device); status = acpi_bus_check_add(handle, 0, ops, &device);
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status))
acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
......
...@@ -1211,15 +1211,6 @@ static int sony_nc_add(struct acpi_device *device) ...@@ -1211,15 +1211,6 @@ static int sony_nc_add(struct acpi_device *device)
} }
} }
/* try to _INI the device if such method exists (ACPI spec 3.0-6.5.1
* should be respected as we already checked for the device presence above */
if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, METHOD_NAME__INI, &handle))) {
dprintk("Invoking _INI\n");
if (ACPI_FAILURE(acpi_evaluate_object(sony_nc_acpi_handle, METHOD_NAME__INI,
NULL, NULL)))
dprintk("_INI Method failed\n");
}
if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "ECON", if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "ECON",
&handle))) { &handle))) {
if (acpi_callsetfunc(sony_nc_acpi_handle, "ECON", 1, NULL)) if (acpi_callsetfunc(sony_nc_acpi_handle, "ECON", 1, NULL))
...@@ -1399,27 +1390,20 @@ struct sonypi_eventtypes { ...@@ -1399,27 +1390,20 @@ struct sonypi_eventtypes {
struct sonypi_event *events; struct sonypi_event *events;
}; };
struct device_ctrl { struct sony_pic_dev {
struct acpi_device *acpi_dev;
struct sony_pic_irq *cur_irq;
struct sony_pic_ioport *cur_ioport;
struct list_head interrupts;
struct list_head ioports;
struct mutex lock;
struct sonypi_eventtypes *event_types;
int (*handle_irq)(const u8, const u8);
int model; int model;
int (*handle_irq)(const u8, const u8);
u16 evport_offset; u16 evport_offset;
u8 has_camera; u8 camera_power;
u8 has_bluetooth; u8 bluetooth_power;
u8 has_wwan; u8 wwan_power;
struct sonypi_eventtypes *event_types;
};
struct sony_pic_dev {
struct device_ctrl *control;
struct acpi_device *acpi_dev;
struct sony_pic_irq *cur_irq;
struct sony_pic_ioport *cur_ioport;
struct list_head interrupts;
struct list_head ioports;
struct mutex lock;
u8 camera_power;
u8 bluetooth_power;
u8 wwan_power;
}; };
static struct sony_pic_dev spic_dev = { static struct sony_pic_dev spic_dev = {
...@@ -1427,6 +1411,8 @@ static struct sony_pic_dev spic_dev = { ...@@ -1427,6 +1411,8 @@ static struct sony_pic_dev spic_dev = {
.ioports = LIST_HEAD_INIT(spic_dev.ioports), .ioports = LIST_HEAD_INIT(spic_dev.ioports),
}; };
static int spic_drv_registered;
/* Event masks */ /* Event masks */
#define SONYPI_JOGGER_MASK 0x00000001 #define SONYPI_JOGGER_MASK 0x00000001
#define SONYPI_CAPTURE_MASK 0x00000002 #define SONYPI_CAPTURE_MASK 0x00000002
...@@ -1724,27 +1710,6 @@ static int type3_handle_irq(const u8 data_mask, const u8 ev) ...@@ -1724,27 +1710,6 @@ static int type3_handle_irq(const u8 data_mask, const u8 ev)
return 1; return 1;
} }
static struct device_ctrl spic_types[] = {
{
.model = SONYPI_DEVICE_TYPE1,
.handle_irq = NULL,
.evport_offset = SONYPI_TYPE1_OFFSET,
.event_types = type1_events,
},
{
.model = SONYPI_DEVICE_TYPE2,
.handle_irq = NULL,
.evport_offset = SONYPI_TYPE2_OFFSET,
.event_types = type2_events,
},
{
.model = SONYPI_DEVICE_TYPE3,
.handle_irq = type3_handle_irq,
.evport_offset = SONYPI_TYPE3_OFFSET,
.event_types = type3_events,
},
};
static void sony_pic_detect_device_type(struct sony_pic_dev *dev) static void sony_pic_detect_device_type(struct sony_pic_dev *dev)
{ {
struct pci_dev *pcidev; struct pci_dev *pcidev;
...@@ -1752,48 +1717,63 @@ static void sony_pic_detect_device_type(struct sony_pic_dev *dev) ...@@ -1752,48 +1717,63 @@ static void sony_pic_detect_device_type(struct sony_pic_dev *dev)
pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82371AB_3, NULL); PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
if (pcidev) { if (pcidev) {
dev->control = &spic_types[0]; dev->model = SONYPI_DEVICE_TYPE1;
dev->evport_offset = SONYPI_TYPE1_OFFSET;
dev->event_types = type1_events;
goto out; goto out;
} }
pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_ICH6_1, NULL); PCI_DEVICE_ID_INTEL_ICH6_1, NULL);
if (pcidev) { if (pcidev) {
dev->control = &spic_types[2]; dev->model = SONYPI_DEVICE_TYPE2;
dev->evport_offset = SONYPI_TYPE2_OFFSET;
dev->event_types = type2_events;
goto out; goto out;
} }
pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_ICH7_1, NULL); PCI_DEVICE_ID_INTEL_ICH7_1, NULL);
if (pcidev) { if (pcidev) {
dev->control = &spic_types[2]; dev->model = SONYPI_DEVICE_TYPE3;
dev->handle_irq = type3_handle_irq;
dev->evport_offset = SONYPI_TYPE3_OFFSET;
dev->event_types = type3_events;
goto out; goto out;
} }
pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_ICH8_4, NULL); PCI_DEVICE_ID_INTEL_ICH8_4, NULL);
if (pcidev) { if (pcidev) {
dev->control = &spic_types[2]; dev->model = SONYPI_DEVICE_TYPE3;
dev->handle_irq = type3_handle_irq;
dev->evport_offset = SONYPI_TYPE3_OFFSET;
dev->event_types = type3_events;
goto out; goto out;
} }
pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_ICH9_1, NULL); PCI_DEVICE_ID_INTEL_ICH9_1, NULL);
if (pcidev) { if (pcidev) {
dev->control = &spic_types[2]; dev->model = SONYPI_DEVICE_TYPE3;
dev->handle_irq = type3_handle_irq;
dev->evport_offset = SONYPI_TYPE3_OFFSET;
dev->event_types = type3_events;
goto out; goto out;
} }
/* default */ /* default */
dev->control = &spic_types[1]; dev->model = SONYPI_DEVICE_TYPE2;
dev->evport_offset = SONYPI_TYPE2_OFFSET;
dev->event_types = type2_events;
out: out:
if (pcidev) if (pcidev)
pci_dev_put(pcidev); pci_dev_put(pcidev);
printk(KERN_INFO DRV_PFX "detected Type%d model\n", printk(KERN_INFO DRV_PFX "detected Type%d model\n",
dev->control->model == SONYPI_DEVICE_TYPE1 ? 1 : dev->model == SONYPI_DEVICE_TYPE1 ? 1 :
dev->control->model == SONYPI_DEVICE_TYPE2 ? 2 : 3); dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3);
} }
/* camera tests and poweron/poweroff */ /* camera tests and poweron/poweroff */
...@@ -2566,7 +2546,7 @@ static int sony_pic_enable(struct acpi_device *device, ...@@ -2566,7 +2546,7 @@ static int sony_pic_enable(struct acpi_device *device,
buffer.pointer = resource; buffer.pointer = resource;
/* setup Type 1 resources */ /* setup Type 1 resources */
if (spic_dev.control->model == SONYPI_DEVICE_TYPE1) { if (spic_dev.model == SONYPI_DEVICE_TYPE1) {
/* setup io resources */ /* setup io resources */
resource->res1.type = ACPI_RESOURCE_TYPE_IO; resource->res1.type = ACPI_RESOURCE_TYPE_IO;
...@@ -2649,29 +2629,28 @@ static irqreturn_t sony_pic_irq(int irq, void *dev_id) ...@@ -2649,29 +2629,28 @@ static irqreturn_t sony_pic_irq(int irq, void *dev_id)
data_mask = inb_p(dev->cur_ioport->io2.minimum); data_mask = inb_p(dev->cur_ioport->io2.minimum);
else else
data_mask = inb_p(dev->cur_ioport->io1.minimum + data_mask = inb_p(dev->cur_ioport->io1.minimum +
dev->control->evport_offset); dev->evport_offset);
dprintk("event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n", dprintk("event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n",
ev, data_mask, dev->cur_ioport->io1.minimum, ev, data_mask, dev->cur_ioport->io1.minimum,
dev->control->evport_offset); dev->evport_offset);
if (ev == 0x00 || ev == 0xff) if (ev == 0x00 || ev == 0xff)
return IRQ_HANDLED; return IRQ_HANDLED;
for (i = 0; dev->control->event_types[i].mask; i++) { for (i = 0; dev->event_types[i].mask; i++) {
if ((data_mask & dev->control->event_types[i].data) != if ((data_mask & dev->event_types[i].data) !=
dev->control->event_types[i].data) dev->event_types[i].data)
continue; continue;
if (!(mask & dev->control->event_types[i].mask)) if (!(mask & dev->event_types[i].mask))
continue; continue;
for (j = 0; dev->control->event_types[i].events[j].event; j++) { for (j = 0; dev->event_types[i].events[j].event; j++) {
if (ev == dev->control->event_types[i].events[j].data) { if (ev == dev->event_types[i].events[j].data) {
device_event = device_event =
dev->control-> dev->event_types[i].events[j].event;
event_types[i].events[j].event;
goto found; goto found;
} }
} }
...@@ -2679,13 +2658,12 @@ static irqreturn_t sony_pic_irq(int irq, void *dev_id) ...@@ -2679,13 +2658,12 @@ static irqreturn_t sony_pic_irq(int irq, void *dev_id)
/* Still not able to decode the event try to pass /* Still not able to decode the event try to pass
* it over to the minidriver * it over to the minidriver
*/ */
if (dev->control->handle_irq && if (dev->handle_irq && dev->handle_irq(data_mask, ev) == 0)
dev->control->handle_irq(data_mask, ev) == 0)
return IRQ_HANDLED; return IRQ_HANDLED;
dprintk("unknown event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n", dprintk("unknown event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n",
ev, data_mask, dev->cur_ioport->io1.minimum, ev, data_mask, dev->cur_ioport->io1.minimum,
dev->control->evport_offset); dev->evport_offset);
return IRQ_HANDLED; return IRQ_HANDLED;
found: found:
...@@ -2816,7 +2794,7 @@ static int sony_pic_add(struct acpi_device *device) ...@@ -2816,7 +2794,7 @@ static int sony_pic_add(struct acpi_device *device)
/* request IRQ */ /* request IRQ */
list_for_each_entry_reverse(irq, &spic_dev.interrupts, list) { list_for_each_entry_reverse(irq, &spic_dev.interrupts, list) {
if (!request_irq(irq->irq.interrupts[0], sony_pic_irq, if (!request_irq(irq->irq.interrupts[0], sony_pic_irq,
IRQF_SHARED, "sony-laptop", &spic_dev)) { IRQF_DISABLED, "sony-laptop", &spic_dev)) {
dprintk("IRQ: %d - triggering: %d - " dprintk("IRQ: %d - triggering: %d - "
"polarity: %d - shr: %d\n", "polarity: %d - shr: %d\n",
irq->irq.interrupts[0], irq->irq.interrupts[0],
...@@ -2949,6 +2927,7 @@ static int __init sony_laptop_init(void) ...@@ -2949,6 +2927,7 @@ static int __init sony_laptop_init(void)
"Unable to register SPIC driver."); "Unable to register SPIC driver.");
goto out; goto out;
} }
spic_drv_registered = 1;
} }
result = acpi_bus_register_driver(&sony_nc_driver); result = acpi_bus_register_driver(&sony_nc_driver);
...@@ -2960,7 +2939,7 @@ static int __init sony_laptop_init(void) ...@@ -2960,7 +2939,7 @@ static int __init sony_laptop_init(void)
return 0; return 0;
out_unregister_pic: out_unregister_pic:
if (!no_spic) if (spic_drv_registered)
acpi_bus_unregister_driver(&sony_pic_driver); acpi_bus_unregister_driver(&sony_pic_driver);
out: out:
return result; return result;
...@@ -2969,7 +2948,7 @@ static int __init sony_laptop_init(void) ...@@ -2969,7 +2948,7 @@ static int __init sony_laptop_init(void)
static void __exit sony_laptop_exit(void) static void __exit sony_laptop_exit(void)
{ {
acpi_bus_unregister_driver(&sony_nc_driver); acpi_bus_unregister_driver(&sony_nc_driver);
if (!no_spic) if (spic_drv_registered)
acpi_bus_unregister_driver(&sony_pic_driver); acpi_bus_unregister_driver(&sony_pic_driver);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment