summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/include/acpiosxf.h4
-rw-r--r--drivers/cdrom/sonycd535.c4
-rw-r--r--drivers/char/agp/Kconfig1
-rw-r--r--drivers/char/agp/amd-k8-agp.c3
-rw-r--r--drivers/char/agp/backend.c14
-rw-r--r--drivers/char/agp/frontend.c302
-rw-r--r--drivers/char/agp/via-agp.c2
-rw-r--r--drivers/char/stallion.c4
-rw-r--r--drivers/fc4/soc.c6
-rw-r--r--drivers/fc4/socal.c6
-rw-r--r--drivers/hotplug/ibmphp_res.c2
-rw-r--r--drivers/i2c/i2c-adap-ite.c6
-rw-r--r--drivers/i2c/i2c-philips-par.c16
-rw-r--r--drivers/i2c/i2c-proc.c10
-rw-r--r--drivers/ide/pci/pdc202xx_old.h2
-rw-r--r--drivers/isdn/capi/kcapi.c2
-rw-r--r--drivers/md/raid1.c2
-rw-r--r--drivers/media/dvb/av7110/av7110.c4
-rw-r--r--drivers/media/video/cpia.c2
-rw-r--r--drivers/mtd/maps/pcmciamtd.c2
-rw-r--r--drivers/net/e100/e100_main.c2
-rw-r--r--drivers/net/hamradio/baycom_epp.c4
-rw-r--r--drivers/net/hamradio/baycom_ser_fdx.c2
-rw-r--r--drivers/net/hamradio/baycom_ser_hdx.c4
-rw-r--r--drivers/net/ioc3-eth.c2
-rw-r--r--drivers/net/lp486e.c2
-rw-r--r--drivers/net/mac89x0.c8
-rw-r--r--drivers/net/plip.c2
-rw-r--r--drivers/net/wan/cosa.c2
-rw-r--r--drivers/parport/parport_pc.c2
-rw-r--r--drivers/pcmcia/i82365.c26
-rw-r--r--drivers/pnp/card.c14
-rw-r--r--drivers/pnp/core.c3
-rw-r--r--drivers/pnp/driver.c16
-rw-r--r--drivers/pnp/idlist.h3
-rw-r--r--drivers/pnp/interface.c20
-rw-r--r--drivers/pnp/isapnp/Makefile4
-rw-r--r--drivers/pnp/isapnp/compat.c25
-rw-r--r--drivers/pnp/isapnp/core.c58
-rw-r--r--drivers/pnp/isapnp/proc.c1
-rw-r--r--drivers/pnp/pnpbios/core.c31
-rw-r--r--drivers/pnp/resource.c107
-rw-r--r--drivers/scsi/Makefile1
-rw-r--r--drivers/scsi/aic7xxx/Kconfig.aic79xx16
-rw-r--r--drivers/scsi/aic7xxx/Kconfig.aic7xxx4
-rw-r--r--drivers/scsi/aic7xxx/aic7770_osm.c9
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c9
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c75
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.h12
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm_pci.c8
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c7
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c84
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.h12
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c5
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c4
-rw-r--r--drivers/scsi/aic7xxx/aiclib.c12
-rw-r--r--drivers/scsi/aic7xxx/aiclib.h4
-rw-r--r--drivers/scsi/atari_NCR5380.c17
-rw-r--r--drivers/scsi/megaraid.c2
-rw-r--r--drivers/serial/68360serial.c2
-rw-r--r--drivers/serial/8250_pnp.c9
-rw-r--r--drivers/usb/core/hcd.c38
-rw-r--r--drivers/usb/core/hcd.h1
-rw-r--r--drivers/usb/core/hub.c47
-rw-r--r--drivers/usb/core/usb.c26
-rw-r--r--drivers/usb/host/ohci-dbg.c64
-rw-r--r--drivers/usb/host/ohci-hcd.c29
-rw-r--r--drivers/usb/host/ohci-hub.c7
-rw-r--r--drivers/usb/host/ohci-q.c7
-rw-r--r--drivers/usb/host/uhci-debug.c4
-rw-r--r--drivers/usb/host/uhci-hcd.c2
-rw-r--r--drivers/usb/misc/speedtouch.c18
-rw-r--r--drivers/video/sticore.h2
-rw-r--r--drivers/video/tgafb.c255
74 files changed, 955 insertions, 569 deletions
diff --git a/drivers/acpi/include/acpiosxf.h b/drivers/acpi/include/acpiosxf.h
index 2326fda0e434..2bf4e3f0e9a4 100644
--- a/drivers/acpi/include/acpiosxf.h
+++ b/drivers/acpi/include/acpiosxf.h
@@ -235,14 +235,14 @@ acpi_os_write_memory (
acpi_status
acpi_os_read_pci_configuration (
acpi_pci_id *pci_id,
- u32 register,
+ u32 reg,
void *value,
u32 width);
acpi_status
acpi_os_write_pci_configuration (
acpi_pci_id *pci_id,
- u32 register,
+ u32 reg,
acpi_integer value,
u32 width);
diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
index cf9a687b24d2..b42342634205 100644
--- a/drivers/cdrom/sonycd535.c
+++ b/drivers/cdrom/sonycd535.c
@@ -1657,8 +1657,8 @@ __setup("sonycd535=", sonycd535_setup);
#endif /* MODULE */
-void __exit
-static sony535_exit(void)
+static void __exit
+sony535_exit(void)
{
int i;
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
index c7174f4d93ea..b27355fe0135 100644
--- a/drivers/char/agp/Kconfig
+++ b/drivers/char/agp/Kconfig
@@ -31,6 +31,7 @@ config AGP_GART
config AGP3
bool "AGP 3.0 compliance (EXPERIMENTAL)"
+ depends on AGP
config AGP_INTEL
tristate "Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860 support"
diff --git a/drivers/char/agp/amd-k8-agp.c b/drivers/char/agp/amd-k8-agp.c
index b5512012e086..f7a2a3f81d0b 100644
--- a/drivers/char/agp/amd-k8-agp.c
+++ b/drivers/char/agp/amd-k8-agp.c
@@ -15,7 +15,6 @@
#include "agp.h"
extern int agp_memory_reserved;
-extern __u32 *agp_gatt_table;
static u_int64_t pci_read64 (struct pci_dev *dev, int reg)
{
@@ -521,6 +520,8 @@ static int __init agp_amdk8_init(void)
if (ret_val)
agp_bridge.type = NOT_SUPPORTED;
+ agp_bridge.type = AMD_8151;
+
return ret_val;
}
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index 929737e336ce..a901a2af7cdb 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -49,13 +49,10 @@ int agp_backend_acquire(void)
if (agp_bridge.type == NOT_SUPPORTED)
return -EINVAL;
- atomic_inc(&agp_bridge.agp_in_use);
-
- if (atomic_read(&agp_bridge.agp_in_use) != 1) {
- atomic_dec(&agp_bridge.agp_in_use);
+ if (atomic_read(&agp_bridge.agp_in_use) != 0)
return -EBUSY;
- }
- MOD_INC_USE_COUNT;
+
+ atomic_inc(&agp_bridge.agp_in_use);
return 0;
}
@@ -65,7 +62,6 @@ void agp_backend_release(void)
return;
atomic_dec(&agp_bridge.agp_in_use);
- MOD_DEC_USE_COUNT;
}
struct agp_max_table {
@@ -73,7 +69,7 @@ struct agp_max_table {
int agp;
};
-static struct agp_max_table maxes_table[9] __initdata =
+static struct agp_max_table maxes_table[9] =
{
{0, 0},
{32, 4},
@@ -86,7 +82,7 @@ static struct agp_max_table maxes_table[9] __initdata =
{4096, 3932}
};
-static int __init agp_find_max (void)
+static int agp_find_max (void)
{
long memory, index, result;
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index c332db2887aa..46f7d16c9f65 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -43,15 +43,14 @@ static agp_memory *agp_find_mem_by_key(int key)
{
agp_memory *curr;
- if (agp_fe.current_controller == NULL) {
+ if (agp_fe.current_controller == NULL)
return NULL;
- }
+
curr = agp_fe.current_controller->pool;
while (curr != NULL) {
- if (curr->key == key) {
+ if (curr->key == key)
return curr;
- }
curr = curr->next;
}
@@ -71,14 +70,14 @@ static void agp_remove_from_pool(agp_memory * temp)
if (prev != NULL) {
prev->next = next;
- if (next != NULL) {
+ if (next != NULL)
next->prev = prev;
- }
+
} else {
/* This is the first item on the list */
- if (next != NULL) {
+ if (next != NULL)
next->prev = NULL;
- }
+
agp_fe.current_controller->pool = next;
}
}
@@ -116,9 +115,8 @@ static agp_segment_priv *agp_find_seg_in_client(const agp_client * client,
static void agp_remove_seg_from_client(agp_client * client)
{
if (client->segments != NULL) {
- if (*(client->segments) != NULL) {
+ if (*(client->segments) != NULL)
kfree(*(client->segments));
- }
kfree(client->segments);
}
}
@@ -130,9 +128,9 @@ static void agp_add_seg_to_client(agp_client * client,
prev_seg = client->segments;
- if (prev_seg != NULL) {
+ if (prev_seg != NULL)
agp_remove_seg_from_client(client);
- }
+
client->num_segments = num_segments;
client->segments = seg;
}
@@ -175,8 +173,7 @@ static int agp_create_segment(agp_client * client, agp_region * region)
agp_segment *user_seg;
int i;
- seg = kmalloc((sizeof(agp_segment_priv) * region->seg_count),
- GFP_KERNEL);
+ seg = kmalloc((sizeof(agp_segment_priv) * region->seg_count), GFP_KERNEL);
if (seg == NULL) {
kfree(region->seg_list);
return -ENOMEM;
@@ -227,9 +224,8 @@ agp_file_private *agp_find_private(pid_t pid)
curr = agp_fe.file_priv_list;
while (curr != NULL) {
- if (curr->my_pid == pid) {
+ if (curr->my_pid == pid)
return curr;
- }
curr = curr->next;
}
@@ -242,9 +238,8 @@ void agp_insert_file_private(agp_file_private * priv)
prev = agp_fe.file_priv_list;
- if (prev != NULL) {
+ if (prev != NULL)
prev->prev = priv;
- }
priv->next = prev;
agp_fe.file_priv_list = priv;
}
@@ -260,13 +255,13 @@ void agp_remove_file_private(agp_file_private * priv)
if (prev != NULL) {
prev->next = next;
- if (next != NULL) {
+ if (next != NULL)
next->prev = prev;
- }
+
} else {
- if (next != NULL) {
+ if (next != NULL)
next->prev = NULL;
- }
+
agp_fe.file_priv_list = next;
}
}
@@ -289,9 +284,9 @@ static agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type)
memory = agp_allocate_memory(pg_count, type);
printk(KERN_DEBUG "agp_allocate_memory: %p\n", memory);
- if (memory == NULL) {
+ if (memory == NULL)
return NULL;
- }
+
agp_insert_into_pool(memory);
return memory;
}
@@ -308,9 +303,8 @@ static agp_controller *agp_find_controller_by_pid(pid_t id)
controller = agp_fe.controllers;
while (controller != NULL) {
- if (controller->pid == id) {
+ if (controller->pid == id)
return controller;
- }
controller = controller->next;
}
@@ -323,9 +317,9 @@ static agp_controller *agp_create_controller(pid_t id)
controller = kmalloc(sizeof(agp_controller), GFP_KERNEL);
- if (controller == NULL) {
+ if (controller == NULL)
return NULL;
- }
+
memset(controller, 0, sizeof(agp_controller));
controller->pid = id;
@@ -339,9 +333,9 @@ static int agp_insert_controller(agp_controller * controller)
prev_controller = agp_fe.controllers;
controller->next = prev_controller;
- if (prev_controller != NULL) {
+ if (prev_controller != NULL)
prev_controller->prev = controller;
- }
+
agp_fe.controllers = controller;
return 0;
@@ -394,13 +388,13 @@ static int agp_remove_controller(agp_controller * controller)
if (prev_controller != NULL) {
prev_controller->next = next_controller;
- if (next_controller != NULL) {
+ if (next_controller != NULL)
next_controller->prev = prev_controller;
- }
+
} else {
- if (next_controller != NULL) {
+ if (next_controller != NULL)
next_controller->prev = NULL;
- }
+
agp_fe.controllers = next_controller;
}
@@ -450,9 +444,9 @@ static void agp_controller_release_current(agp_controller * controller,
priv = agp_find_private(clients->pid);
- if (priv != NULL) {
+ if (priv != NULL)
clear_bit(AGP_FF_IS_VALID, &priv->access_flags);
- }
+
clients = clients->next;
}
@@ -471,15 +465,14 @@ static agp_client *agp_find_client_in_controller(agp_controller * controller,
{
agp_client *client;
- if (controller == NULL) {
+ if (controller == NULL)
return NULL;
- }
+
client = controller->clients;
while (client != NULL) {
- if (client->pid == id) {
+ if (client->pid == id)
return client;
- }
client = client->next;
}
@@ -493,9 +486,8 @@ static agp_controller *agp_find_controller_for_client(pid_t id)
controller = agp_fe.controllers;
while (controller != NULL) {
- if ((agp_find_client_in_controller(controller, id)) != NULL) {
+ if ((agp_find_client_in_controller(controller, id)) != NULL)
return controller;
- }
controller = controller->next;
}
@@ -506,9 +498,9 @@ static agp_client *agp_find_client_by_pid(pid_t id)
{
agp_client *temp;
- if (agp_fe.current_controller == NULL) {
+ if (agp_fe.current_controller == NULL)
return NULL;
- }
+
temp = agp_find_client_in_controller(agp_fe.current_controller, id);
return temp;
}
@@ -520,9 +512,9 @@ static void agp_insert_client(agp_client * client)
prev_client = agp_fe.current_controller->clients;
client->next = prev_client;
- if (prev_client != NULL) {
+ if (prev_client != NULL)
prev_client->prev = client;
- }
+
agp_fe.current_controller->clients = client;
agp_fe.current_controller->num_clients++;
}
@@ -533,9 +525,9 @@ static agp_client *agp_create_client(pid_t id)
new_client = kmalloc(sizeof(agp_client), GFP_KERNEL);
- if (new_client == NULL) {
+ if (new_client == NULL)
return NULL;
- }
+
memset(new_client, 0, sizeof(agp_client));
new_client->pid = id;
agp_insert_client(new_client);
@@ -550,27 +542,24 @@ static int agp_remove_client(pid_t id)
agp_controller *controller;
controller = agp_find_controller_for_client(id);
-
- if (controller == NULL) {
+ if (controller == NULL)
return -EINVAL;
- }
- client = agp_find_client_in_controller(controller, id);
- if (client == NULL) {
+ client = agp_find_client_in_controller(controller, id);
+ if (client == NULL)
return -EINVAL;
- }
+
prev_client = client->prev;
next_client = client->next;
if (prev_client != NULL) {
prev_client->next = next_client;
- if (next_client != NULL) {
+ if (next_client != NULL)
next_client->prev = prev_client;
- }
+
} else {
- if (next_client != NULL) {
+ if (next_client != NULL)
next_client->prev = NULL;
- }
controller->clients = next_client;
}
@@ -595,14 +584,12 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
AGP_LOCK();
- if (agp_fe.backend_acquired != TRUE) {
- AGP_UNLOCK();
- return -EPERM;
- }
- if (!(test_bit(AGP_FF_IS_VALID, &priv->access_flags))) {
- AGP_UNLOCK();
- return -EPERM;
- }
+ if (agp_fe.backend_acquired != TRUE)
+ goto out_eperm;
+
+ if (!(test_bit(AGP_FF_IS_VALID, &priv->access_flags)))
+ goto out_eperm;
+
agp_copy_info(&kerninfo);
size = vma->vm_end - vma->vm_start;
current_size = kerninfo.aper_size;
@@ -610,45 +597,48 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
offset = vma->vm_pgoff << PAGE_SHIFT;
if (test_bit(AGP_FF_IS_CLIENT, &priv->access_flags)) {
- if ((size + offset) > current_size) {
- AGP_UNLOCK();
- return -EINVAL;
- }
+ if ((size + offset) > current_size)
+ goto out_inval;
+
client = agp_find_client_by_pid(current->pid);
- if (client == NULL) {
- AGP_UNLOCK();
- return -EPERM;
- }
- if (!agp_find_seg_in_client(client, offset,
- size, vma->vm_page_prot)) {
- AGP_UNLOCK();
- return -EINVAL;
- }
- if (remap_page_range(vma, vma->vm_start,
- (kerninfo.aper_base + offset),
+ if (client == NULL)
+ goto out_eperm;
+
+ if (!agp_find_seg_in_client(client, offset, size, vma->vm_page_prot))
+ goto out_inval;
+
+ if (remap_page_range(vma, vma->vm_start, (kerninfo.aper_base + offset),
size, vma->vm_page_prot)) {
- AGP_UNLOCK();
- return -EAGAIN;
+ goto out_again;
}
AGP_UNLOCK();
return 0;
}
+
if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) {
- if (size != current_size) {
- AGP_UNLOCK();
- return -EINVAL;
- }
+ if (size != current_size)
+ goto out_inval;
+
if (remap_page_range(vma, vma->vm_start, kerninfo.aper_base,
size, vma->vm_page_prot)) {
- AGP_UNLOCK();
- return -EAGAIN;
+ goto out_again;
}
AGP_UNLOCK();
return 0;
}
+
+out_eperm:
AGP_UNLOCK();
return -EPERM;
+
+out_inval:
+ AGP_UNLOCK();
+ return -EINVAL;
+
+out_again:
+ AGP_UNLOCK();
+ return -EAGAIN;
}
static int agp_release(struct inode *inode, struct file *file)
@@ -751,26 +741,28 @@ static int agpioc_info_wrap(agp_file_private * priv, unsigned long arg)
userinfo.pg_total = userinfo.pg_system = kerninfo.max_memory;
userinfo.pg_used = kerninfo.current_memory;
- if (copy_to_user((void *) arg, &userinfo, sizeof(agp_info))) {
+ if (copy_to_user((void *) arg, &userinfo, sizeof(agp_info)))
return -EFAULT;
- }
+
return 0;
}
static int agpioc_acquire_wrap(agp_file_private * priv, unsigned long arg)
{
+ int ret;
+
agp_controller *controller;
- if (!(test_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags))) {
+ if (!(test_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags)))
return -EPERM;
- }
- if (agp_fe.current_controller != NULL) {
+
+ if (agp_fe.current_controller != NULL)
return -EBUSY;
- }
- if ((agp_backend_acquire()) == 0) {
+
+ ret = agp_backend_acquire();
+ if (ret == 0)
agp_fe.backend_acquired = TRUE;
- } else {
- return -EBUSY;
- }
+ else
+ return ret;
controller = agp_find_controller_by_pid(priv->my_pid);
@@ -816,10 +808,9 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
agp_client *client;
agp_file_private *client_priv;
-
- if (copy_from_user(&reserve, (void *) arg, sizeof(agp_region))) {
+ if (copy_from_user(&reserve, (void *) arg, sizeof(agp_region)))
return -EFAULT;
- }
+
if ((unsigned) reserve.seg_count >= ~0U/sizeof(agp_segment))
return -EFAULT;
@@ -849,9 +840,9 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
segment = kmalloc((sizeof(agp_segment) * reserve.seg_count),
GFP_KERNEL);
- if (segment == NULL) {
+ if (segment == NULL)
return -ENOMEM;
- }
+
if (copy_from_user(segment, (void *) reserve.seg_list,
sizeof(agp_segment) * reserve.seg_count)) {
kfree(segment);
@@ -895,14 +886,14 @@ static int agpioc_allocate_wrap(agp_file_private * priv, unsigned long arg)
agp_memory *memory;
agp_allocate alloc;
- if (copy_from_user(&alloc, (void *) arg, sizeof(agp_allocate))) {
+ if (copy_from_user(&alloc, (void *) arg, sizeof(agp_allocate)))
return -EFAULT;
- }
+
memory = agp_allocate_memory_wrap(alloc.pg_count, alloc.type);
- if (memory == NULL) {
+ if (memory == NULL)
return -ENOMEM;
- }
+
alloc.key = memory->key;
alloc.physical = memory->physical;
@@ -919,9 +910,9 @@ static int agpioc_deallocate_wrap(agp_file_private * priv, unsigned long arg)
memory = agp_find_mem_by_key((int) arg);
- if (memory == NULL) {
+ if (memory == NULL)
return -EINVAL;
- }
+
agp_free_memory_wrap(memory);
return 0;
}
@@ -931,14 +922,14 @@ static int agpioc_bind_wrap(agp_file_private * priv, unsigned long arg)
agp_bind bind_info;
agp_memory *memory;
- if (copy_from_user(&bind_info, (void *) arg, sizeof(agp_bind))) {
+ if (copy_from_user(&bind_info, (void *) arg, sizeof(agp_bind)))
return -EFAULT;
- }
+
memory = agp_find_mem_by_key(bind_info.key);
- if (memory == NULL) {
+ if (memory == NULL)
return -EINVAL;
- }
+
return agp_bind_memory(memory, bind_info.pg_start);
}
@@ -947,14 +938,14 @@ static int agpioc_unbind_wrap(agp_file_private * priv, unsigned long arg)
agp_memory *memory;
agp_unbind unbind;
- if (copy_from_user(&unbind, (void *) arg, sizeof(agp_unbind))) {
+ if (copy_from_user(&unbind, (void *) arg, sizeof(agp_unbind)))
return -EFAULT;
- }
+
memory = agp_find_mem_by_key(unbind.key);
- if (memory == NULL) {
+ if (memory == NULL)
return -EINVAL;
- }
+
return agp_unbind_memory(memory);
}
@@ -977,8 +968,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
goto ioctl_out;
}
if (cmd != AGPIOC_ACQUIRE) {
- if (!(test_bit(AGP_FF_IS_CONTROLLER,
- &curr_priv->access_flags))) {
+ if (!(test_bit(AGP_FF_IS_CONTROLLER, &curr_priv->access_flags))) {
ret_val = -EPERM;
goto ioctl_out;
}
@@ -990,59 +980,49 @@ static int agp_ioctl(struct inode *inode, struct file *file,
goto ioctl_out;
}
}
+
switch (cmd) {
case AGPIOC_INFO:
- {
- ret_val = agpioc_info_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_info_wrap(curr_priv, arg);
+ break;
+
case AGPIOC_ACQUIRE:
- {
- ret_val = agpioc_acquire_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_acquire_wrap(curr_priv, arg);
+ break;
+
case AGPIOC_RELEASE:
- {
- ret_val = agpioc_release_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_release_wrap(curr_priv, arg);
+ break;
+
case AGPIOC_SETUP:
- {
- ret_val = agpioc_setup_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_setup_wrap(curr_priv, arg);
+ break;
+
case AGPIOC_RESERVE:
- {
- ret_val = agpioc_reserve_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_reserve_wrap(curr_priv, arg);
+ break;
+
case AGPIOC_PROTECT:
- {
- ret_val = agpioc_protect_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_protect_wrap(curr_priv, arg);
+ break;
+
case AGPIOC_ALLOCATE:
- {
- ret_val = agpioc_allocate_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_allocate_wrap(curr_priv, arg);
+ break;
+
case AGPIOC_DEALLOCATE:
- {
- ret_val = agpioc_deallocate_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_deallocate_wrap(curr_priv, arg);
+ break;
+
case AGPIOC_BIND:
- {
- ret_val = agpioc_bind_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_bind_wrap(curr_priv, arg);
+ break;
+
case AGPIOC_UNBIND:
- {
- ret_val = agpioc_unbind_wrap(curr_priv, arg);
- goto ioctl_out;
- }
+ ret_val = agpioc_unbind_wrap(curr_priv, arg);
+ break;
}
-
+
ioctl_out:
AGP_UNLOCK();
return ret_val;
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index 3a08a2302021..a6b774459075 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -168,7 +168,7 @@ static int __init via_kt400_setup(struct pci_dev *pdev)
agp_bridge.resume = agp_generic_resume;
agp_bridge.cant_use_aperture = 0;
- pci_read_config_byte(agp_bridge.dev, VIA_AGPSEL, &reg);
+ pci_read_config_byte(pdev, VIA_AGPSEL, &reg);
if ((reg & (1<<1))==1) {
/* AGP 2.0 compatability mode. */
agp_bridge.agp_enable = agp_generic_agp_enable;
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 9a990ab0c00b..cb16472e3afc 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -2503,7 +2503,7 @@ static inline int stl_initeio(stlbrd_t *brdp)
* dealing with all types of ECH board.
*/
-static int inline stl_initech(stlbrd_t *brdp)
+static inline int stl_initech(stlbrd_t *brdp)
{
stlpanel_t *panelp;
unsigned int status, nxtid, ioaddr, conflict;
@@ -5222,7 +5222,7 @@ static void stl_sc26198rxisr(stlport_t *portp, unsigned int iack)
* Process an RX bad character.
*/
-static void inline stl_sc26198rxbadch(stlport_t *portp, unsigned char status, char ch)
+static inline void stl_sc26198rxbadch(stlport_t *portp, unsigned char status, char ch)
{
struct tty_struct *tty;
unsigned int ioaddr;
diff --git a/drivers/fc4/soc.c b/drivers/fc4/soc.c
index 2d1b2e4da698..03b72bf668a4 100644
--- a/drivers/fc4/soc.c
+++ b/drivers/fc4/soc.c
@@ -104,7 +104,7 @@ static void soc_reset(fc_channel *fc)
soc_enable(s);
}
-static void inline soc_solicited (struct soc *s)
+static inline void soc_solicited (struct soc *s)
{
fc_hdr fchdr;
soc_rsp *hwrsp;
@@ -165,7 +165,7 @@ static void inline soc_solicited (struct soc *s)
}
}
-static void inline soc_request (struct soc *s, u32 cmd)
+static inline void soc_request (struct soc *s, u32 cmd)
{
SOC_SETIMASK(s, s->imask & ~(cmd & SOC_CMD_REQ_QALL));
SOD(("imask %08lx %08lx\n", s->imask, sbus_readl(s->regs + IMASK)));
@@ -184,7 +184,7 @@ static void inline soc_request (struct soc *s, u32 cmd)
s->curr_port ^= 1;
}
-static void inline soc_unsolicited (struct soc *s)
+static inline void soc_unsolicited (struct soc *s)
{
soc_rsp *hwrsp, *hwrspc;
soc_cq *sw_cq;
diff --git a/drivers/fc4/socal.c b/drivers/fc4/socal.c
index b00c94f6db25..ef18d4c92edd 100644
--- a/drivers/fc4/socal.c
+++ b/drivers/fc4/socal.c
@@ -133,7 +133,7 @@ static void socal_reset(fc_channel *fc)
socal_enable(s);
}
-static void inline socal_solicited(struct socal *s, unsigned long qno)
+static inline void socal_solicited(struct socal *s, unsigned long qno)
{
socal_rsp *hwrsp;
socal_cq *sw_cq;
@@ -225,7 +225,7 @@ static void inline socal_solicited(struct socal *s, unsigned long qno)
}
}
-static void inline socal_request (struct socal *s, u32 cmd)
+static inline void socal_request (struct socal *s, u32 cmd)
{
SOCAL_SETIMASK(s, s->imask & ~(cmd & SOCAL_CMD_REQ_QALL));
SOD(("imask %08x %08x\n", s->imask, sbus_readl(s->regs + IMASK)));
@@ -242,7 +242,7 @@ static void inline socal_request (struct socal *s, u32 cmd)
s->curr_port ^= 1;
}
-static void inline socal_unsolicited (struct socal *s, unsigned long qno)
+static inline void socal_unsolicited (struct socal *s, unsigned long qno)
{
socal_rsp *hwrsp, *hwrspc;
socal_cq *sw_cq;
diff --git a/drivers/hotplug/ibmphp_res.c b/drivers/hotplug/ibmphp_res.c
index 762ad60c71a7..27cccc156b70 100644
--- a/drivers/hotplug/ibmphp_res.c
+++ b/drivers/hotplug/ibmphp_res.c
@@ -1889,7 +1889,7 @@ void ibmphp_print_test (void)
debug_pci ("***********************END***********************\n");
}
-int static range_exists_already (struct range_node * range, struct bus_node * bus_cur, u8 type)
+static int range_exists_already (struct range_node * range, struct bus_node * bus_cur, u8 type)
{
struct range_node * range_cur = NULL;
switch (type) {
diff --git a/drivers/i2c/i2c-adap-ite.c b/drivers/i2c/i2c-adap-ite.c
index 2c7b5103806c..28352ac46df6 100644
--- a/drivers/i2c/i2c-adap-ite.c
+++ b/drivers/i2c/i2c-adap-ite.c
@@ -61,11 +61,7 @@ static int own = 0;
static int i2c_debug=0;
static struct iic_ite gpi;
-#if (LINUX_VERSION_CODE < 0x020301)
-static struct wait_queue *iic_wait = NULL;
-#else
static wait_queue_head_t iic_wait;
-#endif
static int iic_pending;
/* ----- global defines ----------------------------------------------- */
@@ -236,9 +232,7 @@ static int __init iic_ite_init(void)
piic->iic_own = own;
iic_ite_data.data = (void *)piic;
-#if (LINUX_VERSION_CODE >= 0x020301)
init_waitqueue_head(&iic_wait);
-#endif
if (iic_hw_resrc_init() == 0) {
if (i2c_iic_add_bus(&iic_ite_ops) < 0)
return -ENODEV;
diff --git a/drivers/i2c/i2c-philips-par.c b/drivers/i2c/i2c-philips-par.c
index ce2258a20447..b489b5f37114 100644
--- a/drivers/i2c/i2c-philips-par.c
+++ b/drivers/i2c/i2c-philips-par.c
@@ -228,41 +228,25 @@ static void i2c_parport_detach (struct parport *port)
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,4)
static struct parport_driver i2c_driver = {
"i2c-philips-par",
i2c_parport_attach,
i2c_parport_detach,
NULL
};
-#endif
int __init i2c_bitlp_init(void)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,4)
- struct parport *port;
-#endif
printk(KERN_INFO "i2c-philips-par.o: i2c Philips parallel port adapter module version %s (%s)\n", I2C_VERSION, I2C_DATE);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,4)
parport_register_driver(&i2c_driver);
-#else
- for (port = parport_enumerate(); port; port=port->next)
- i2c_parport_attach(port);
-#endif
return 0;
}
void __exit i2c_bitlp_exit(void)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,4)
parport_unregister_driver(&i2c_driver);
-#else
- struct parport *port;
- for (port = parport_enumerate(); port; port=port->next)
- i2c_parport_detach(port);
-#endif
}
MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
diff --git a/drivers/i2c/i2c-proc.c b/drivers/i2c/i2c-proc.c
index 785e9c5f3716..3b97e96de669 100644
--- a/drivers/i2c/i2c-proc.c
+++ b/drivers/i2c/i2c-proc.c
@@ -23,7 +23,6 @@
This driver puts entries in /proc/sys/dev/sensors for each I2C device
*/
-#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
@@ -31,14 +30,10 @@
#include <linux/sysctl.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
-#include <asm/uaccess.h>
#include <linux/i2c.h>
#include <linux/i2c-proc.h>
#include <linux/init.h>
-
-#ifndef THIS_MODULE
-#define THIS_MODULE NULL
-#endif
+#include <asm/uaccess.h>
static int i2c_create_name(char **name, const char *prefix,
struct i2c_adapter *adapter, int addr);
@@ -56,7 +51,6 @@ static int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
#define SENSORS_ENTRY_MAX 20
static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX];
-static unsigned short i2c_inodes[SENSORS_ENTRY_MAX];
static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX];
@@ -197,8 +191,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return id;
}
#endif /* DEBUG */
- i2c_inodes[id - 256] =
- new_header->ctl_table->child->child->de->low_ino;
new_header->ctl_table->child->child->de->owner = controlling_mod;
return id;
diff --git a/drivers/ide/pci/pdc202xx_old.h b/drivers/ide/pci/pdc202xx_old.h
index a91915c8c7a1..b3b5388a5b80 100644
--- a/drivers/ide/pci/pdc202xx_old.h
+++ b/drivers/ide/pci/pdc202xx_old.h
@@ -14,7 +14,7 @@
#define PDC202XX_DEBUG_DRIVE_INFO 0
#define PDC202XX_DECODE_REGISTER_INFO 0
-const static char *pdc_quirk_drives[] = {
+static const char *pdc_quirk_drives[] = {
"QUANTUM FIREBALLlct08 08",
"QUANTUM FIREBALLP KA6.4",
"QUANTUM FIREBALLP KA9.1",
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 0e07e706a576..a679f52a0912 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -267,7 +267,7 @@ static void notify_down(u32 contr)
/* ------------------------------------------------------------ */
-static void inline notify_doit(struct capi_notifier *np)
+static inline void notify_doit(struct capi_notifier *np)
{
switch (np->cmd) {
case KCI_CONTRUP:
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 0c7838de3289..55e9a01d4e29 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -250,7 +250,7 @@ static void raid_end_bio_io(r1bio_t *r1_bio, int uptodate)
/*
* Update disk head position estimator based on IRQ completion info.
*/
-static void inline update_head_pos(int disk, r1bio_t *r1_bio)
+static inline void update_head_pos(int disk, r1bio_t *r1_bio)
{
conf_t *conf = mddev_to_conf(r1_bio->mddev);
diff --git a/drivers/media/dvb/av7110/av7110.c b/drivers/media/dvb/av7110/av7110.c
index 0a8971b2f017..4df0e077f88a 100644
--- a/drivers/media/dvb/av7110/av7110.c
+++ b/drivers/media/dvb/av7110/av7110.c
@@ -2245,7 +2245,7 @@ VidMode(av7110_t *av7110, int mode)
}
-static int inline
+static inline int
vidcom(av7110_t *av7110, u32 com, u32 arg)
{
return outcom(av7110, 0x80, 0x02, 4,
@@ -2253,7 +2253,7 @@ vidcom(av7110_t *av7110, u32 com, u32 arg)
(arg>>16), (arg&0xffff));
}
-static int inline
+static inline int
audcom(av7110_t *av7110, u32 com)
{
return outcom(av7110, 0x80, 0x03, 4,
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index af042ec7b2ad..4ddef3f99205 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -1634,7 +1634,7 @@ static int free_frame_buf(struct cam_data *cam)
}
-static void inline free_frames(struct cpia_frame frame[FRAME_NUM])
+static inline void free_frames(struct cpia_frame frame[FRAME_NUM])
{
int i;
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index fb87cdd8b873..6259fe17c681 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -107,7 +107,7 @@ MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)")
-static void inline cs_error(client_handle_t handle, int func, int ret)
+static inline void cs_error(client_handle_t handle, int func, int ret)
{
error_info_t err = { func, ret };
CardServices(ReportError, handle, &err);
diff --git a/drivers/net/e100/e100_main.c b/drivers/net/e100/e100_main.c
index d118a1585ca0..3f38f62ada89 100644
--- a/drivers/net/e100/e100_main.c
+++ b/drivers/net/e100/e100_main.c
@@ -1812,7 +1812,7 @@ e100intr(int irq, void *dev_inst, struct pt_regs *regs)
*
* This routine frees resources of TX skbs.
*/
-static void inline
+static inline void
e100_tx_skb_free(struct e100_private *bdp, tcb_t *tcb)
{
if (tcb->tcb_skb) {
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 2d8c089d5c93..93237b2af18a 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -342,7 +342,7 @@ static inline int calc_crc_ccitt(const unsigned char *buf, int cnt)
/* --------------------------------------------------------------------- */
-static void inline baycom_int_freq(struct baycom_state *bc)
+static inline void baycom_int_freq(struct baycom_state *bc)
{
#ifdef BAYCOM_DEBUG
unsigned long cur_jiffies = jiffies;
@@ -431,7 +431,7 @@ static void epp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
/* ---------------------------------------------------------------------- */
-static void inline do_kiss_params(struct baycom_state *bc,
+static inline void do_kiss_params(struct baycom_state *bc,
unsigned char *data, unsigned long len)
{
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c
index 64eea939a50e..d46e75c34c95 100644
--- a/drivers/net/hamradio/baycom_ser_fdx.c
+++ b/drivers/net/hamradio/baycom_ser_fdx.c
@@ -152,7 +152,7 @@ struct baycom_state {
/* --------------------------------------------------------------------- */
-static void inline baycom_int_freq(struct baycom_state *bc)
+static inline void baycom_int_freq(struct baycom_state *bc)
{
#ifdef BAYCOM_DEBUG
unsigned long cur_jiffies = jiffies;
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c
index 14e18b0b1df0..92644c2089ab 100644
--- a/drivers/net/hamradio/baycom_ser_hdx.c
+++ b/drivers/net/hamradio/baycom_ser_hdx.c
@@ -143,7 +143,7 @@ struct baycom_state {
/* --------------------------------------------------------------------- */
-static void inline baycom_int_freq(struct baycom_state *bc)
+static inline void baycom_int_freq(struct baycom_state *bc)
{
#ifdef BAYCOM_DEBUG
unsigned long cur_jiffies = jiffies;
@@ -166,7 +166,7 @@ static void inline baycom_int_freq(struct baycom_state *bc)
* ===================== SER12 specific routines =========================
*/
-static void inline ser12_set_divisor(struct net_device *dev,
+static inline void ser12_set_divisor(struct net_device *dev,
unsigned char divisor)
{
outb(0x81, LCR(dev->base_addr)); /* DLAB = 1 */
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index 7587ce3f2ecb..da2719f5fef8 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1479,7 +1479,7 @@ static inline int ioc3_is_menet(struct pci_dev *pdev)
&& dev->device == PCI_DEVICE_ID_SGI_IOC3;
}
-static void inline ioc3_serial_probe(struct pci_dev *pdev,
+static inline void ioc3_serial_probe(struct pci_dev *pdev,
struct ioc3 *ioc3)
{
struct serial_struct req;
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c
index d677e1832497..1d2793c8f350 100644
--- a/drivers/net/lp486e.c
+++ b/drivers/net/lp486e.c
@@ -1061,7 +1061,7 @@ err_out:
return ret;
}
-static void inline
+static inline void
i596_handle_CU_completion(struct net_device *dev,
volatile struct i596_private *lp,
unsigned short status,
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c
index 95f72759aa0f..f2be232c4de1 100644
--- a/drivers/net/mac89x0.c
+++ b/drivers/net/mac89x0.c
@@ -141,14 +141,14 @@ static int set_mac_address(struct net_device *dev, void *addr);
#define tx_done(dev) 1
/* For reading/writing registers ISA-style */
-static int inline
+static inline int
readreg_io(struct net_device *dev, int portno)
{
nubus_writew(swab16(portno), dev->base_addr + ADD_PORT);
return swab16(nubus_readw(dev->base_addr + DATA_PORT));
}
-static void inline
+static inline void
writereg_io(struct net_device *dev, int portno, int value)
{
nubus_writew(swab16(portno), dev->base_addr + ADD_PORT);
@@ -156,13 +156,13 @@ writereg_io(struct net_device *dev, int portno, int value)
}
/* These are for reading/writing registers in shared memory */
-static int inline
+static inline int
readreg(struct net_device *dev, int portno)
{
return swab16(nubus_readw(dev->mem_start + portno));
}
-static void inline
+static inline void
writereg(struct net_device *dev, int portno, int value)
{
nubus_writew(swab16(value), dev->mem_start + portno);
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index 3551dc49874f..ae3c088214fd 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -1282,7 +1282,7 @@ MODULE_PARM_DESC(parport, "List of parport device numbers to use by plip");
static struct net_device *dev_plip[PLIP_MAX] = { NULL, };
-static int inline
+static inline int
plip_searchfor(int list[], int a)
{
int i;
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index f3b5ef9ae502..dbcbebe706fe 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -1933,7 +1933,7 @@ reject: /* Reject the packet */
spin_unlock_irqrestore(&cosa->lock, flags);
}
-static void inline eot_interrupt(struct cosa_data *cosa, int status)
+static inline void eot_interrupt(struct cosa_data *cosa, int status)
{
unsigned long flags, flags1;
spin_lock_irqsave(&cosa->lock, flags);
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 71c48db5f3ec..f803b5919c4f 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -114,7 +114,7 @@ static void frob_econtrol (struct parport *pb, unsigned char m,
outb ((ectr & ~m) ^ v, ECONTROL (pb));
}
-static void __inline__ frob_set_mode (struct parport *p, int mode)
+static __inline__ void frob_set_mode (struct parport *p, int mode)
{
frob_econtrol (p, ECR_MODE_MASK, mode << 5);
}
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index 8c2cd91ad6c3..893561738443 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -814,7 +814,7 @@ static void __init add_pcic(int ns, int type)
#ifdef CONFIG_ISA
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
static struct isapnp_device_id id_table[] __initdata = {
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('P', 'N', 'P'),
ISAPNP_FUNCTION(0x0e00), (unsigned long) "Intel 82365-Compatible" },
@@ -826,32 +826,28 @@ static struct isapnp_device_id id_table[] __initdata = {
};
MODULE_DEVICE_TABLE(isapnp, id_table);
-static struct pci_dev *i82365_pnpdev;
+static struct pnp_dev *i82365_pnpdev;
#endif
static void __init isa_probe(void)
{
int i, j, sock, k, ns, id;
ioaddr_t port;
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
struct isapnp_device_id *devid;
- struct pci_dev *dev;
+ struct pnp_dev *dev;
for (devid = id_table; devid->vendor; devid++) {
- if ((dev = isapnp_find_dev(NULL, devid->vendor, devid->function, NULL))) {
- printk("ISAPNP ");
+ if ((dev = pnp_find_dev(NULL, devid->vendor, devid->function, NULL))) {
+ printk("PNP ");
- if (dev->prepare && dev->prepare(dev) < 0) {
- printk("prepare failed\n");
- break;
- }
-
- if (dev->activate && dev->activate(dev) < 0) {
+ if (pnp_activate_dev(dev, NULL) < 0) {
printk("activate failed\n");
break;
}
- if ((i365_base = pci_resource_start(dev, 0))) {
+ i365_base = pnp_port_start(dev, 0);
+ if (i365_base) {
printk("no resources ?\n");
break;
}
@@ -1644,8 +1640,8 @@ static void __exit exit_i82365(void)
release_region(socket[i].ioaddr, 2);
}
#if defined(CONFIG_ISA) && defined(__ISAPNP__)
- if (i82365_pnpdev && i82365_pnpdev->deactivate)
- i82365_pnpdev->deactivate(i82365_pnpdev);
+ if (i82365_pnpdev)
+ pnp_disable_dev(i82365_pnpdev);
#endif
} /* exit_i82365 */
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index e591e906049d..914c1e2628ee 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -192,6 +192,7 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id,
{
struct list_head *pos;
struct pnp_dev *dev;
+ struct pnpc_driver *cdrv;
if (!card || !id)
goto done;
if (!from) {
@@ -212,9 +213,16 @@ done:
return NULL;
found:
- if (dev->active == 0)
- if(pnp_activate_dev(dev)<0)
- return NULL;
+ cdrv = to_pnpc_driver(card->dev.driver);
+ if (dev->active == 0) {
+ if (!(cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE)) {
+ if(pnp_activate_dev(dev,NULL)<0)
+ return NULL;
+ }
+ } else {
+ if ((cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE))
+ pnp_disable_dev(dev);
+ }
spin_lock(&pnp_lock);
list_add_tail(&dev->rdev_list, &card->rdevs);
spin_unlock(&pnp_lock);
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index 7eed8f4f8163..979cccd2a128 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -115,7 +115,8 @@ int __pnp_add_device(struct pnp_dev *dev)
int error = 0;
pnp_name_device(dev);
pnp_fixup_device(dev);
- strcpy(dev->dev.name,dev->name);
+ strncpy(dev->dev.name,dev->name,DEVICE_NAME_SIZE-1);
+ dev->dev.name[DEVICE_NAME_SIZE-1] = '\0';
dev->dev.bus = &pnp_bus_type;
dev->dev.release = &pnp_release_device;
error = device_register(&dev->dev);
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 8676d7941b00..e954b11ae931 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -66,7 +66,7 @@ static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct
static int pnp_device_probe(struct device *dev)
{
- int error = 0;
+ int error;
struct pnp_driver *pnp_drv;
struct pnp_dev *pnp_dev;
const struct pnp_device_id *dev_id = NULL;
@@ -75,9 +75,17 @@ static int pnp_device_probe(struct device *dev)
pnp_dbg("pnp: match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
- if (pnp_dev->active == 0)
- if(pnp_activate_dev(pnp_dev)<0)
- return -1;
+ if (pnp_dev->active == 0) {
+ if (!(pnp_drv->flags & PNP_DRIVER_DO_NOT_ACTIVATE)) {
+ error = pnp_activate_dev(pnp_dev, NULL);
+ if (error < 0)
+ return error;
+ }
+ } else {
+ if ((pnp_drv->flags & PNP_DRIVER_DO_NOT_ACTIVATE))
+ pnp_disable_dev(pnp_dev);
+ }
+ error = 0;
if (pnp_drv->probe && pnp_dev->active) {
dev_id = match_device(pnp_drv, pnp_dev);
if (dev_id != NULL)
diff --git a/drivers/pnp/idlist.h b/drivers/pnp/idlist.h
index c75698a68f5c..aa2272fbd652 100644
--- a/drivers/pnp/idlist.h
+++ b/drivers/pnp/idlist.h
@@ -5,6 +5,7 @@ ID("CSC0003", "Crystal Semiconductor CS423x sound -- MPU401")
ID("IBM3780", "IBM pointing device")
ID("IBM0071", "IBM infrared communications device")
ID("IBM3760", "IBM DSP")
+ID("NSC6001", "National Semiconductor Serial Port with Fast IR")
ID("PNP0000", "AT Interrupt Controller")
ID("PNP0001", "EISA Interrupt Controller")
ID("PNP0002", "MCA Interrupt Controller")
@@ -54,6 +55,7 @@ ID("PNP0602", "Plus Hardcard IIXL/EZ")
ID("PNP0603", "Generic IDE supporting Microsoft Device Bay Specification")
ID("PNP0700", "PC standard floppy disk controller")
ID("PNP0701", "Standard floppy controller supporting MS Device Bay Spec")
+ID("PNP0802", "Microsoft Sound System or Compatible Device (obsolete)")
ID("PNP0900", "VGA Compatible")
ID("PNP0901", "Video Seven VRAM/VRAM II/1024i")
ID("PNP0902", "8514/A Compatible")
@@ -151,7 +153,6 @@ ID("PNP0f1c", "Compaq LTE Trackball PS/2-style Mouse")
ID("PNP0f1d", "Compaq LTE Trackball Serial Mouse")
ID("PNP0f1e", "Microsoft Kids Trackball Mouse")
ID("PNP8001", "Novell/Anthem NE3200")
-ID("PNP0802", "Microsoft Sound System or Compatible Device (obsolete)")
ID("PNP8004", "Compaq NE3200")
ID("PNP8006", "Intel EtherExpress/32")
ID("PNP8008", "HP EtherTwist EISA LAN Adapter/32 (HP27248A)")
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 8746323da744..b7ad96265091 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -295,12 +295,28 @@ pnp_set_current_resources(struct device * dmdev, const char * buf, size_t count,
num_args = sscanf(buf,"%10s %i %10s",command,&depnum,type);
if (!num_args)
goto done;
+ if (!strnicmp(command,"lock",4)) {
+ if (dev->active) {
+ dev->lock_resources = 1;
+ } else {
+ error = -EINVAL;
+ }
+ goto done;
+ }
+ if (!strnicmp(command,"unlock",6)) {
+ if (dev->lock_resources) {
+ dev->lock_resources = 0;
+ } else {
+ error = -EINVAL;
+ }
+ goto done;
+ }
if (!strnicmp(command,"disable",7)) {
error = pnp_disable_dev(dev);
goto done;
}
if (!strnicmp(command,"auto",4)) {
- error = pnp_activate_dev(dev);
+ error = pnp_activate_dev(dev,NULL);
goto done;
}
if (!strnicmp(command,"manual",6)) {
@@ -308,7 +324,7 @@ pnp_set_current_resources(struct device * dmdev, const char * buf, size_t count,
goto done;
if (!strnicmp(type,"static",6))
mode = PNP_STATIC;
- error = pnp_raw_set_dev(dev,depnum,mode);
+ error = pnp_raw_set_dev(dev,depnum,NULL,mode);
goto done;
}
done:
diff --git a/drivers/pnp/isapnp/Makefile b/drivers/pnp/isapnp/Makefile
index 62c36dd5df7e..1539195169db 100644
--- a/drivers/pnp/isapnp/Makefile
+++ b/drivers/pnp/isapnp/Makefile
@@ -2,8 +2,8 @@
# Makefile for the kernel ISAPNP driver.
#
-export-objs := core.o
+export-objs := core.o compat.o
isapnp-proc-$(CONFIG_PROC_FS) = proc.o
-obj-y := core.o $(isapnp-proc-y)
+obj-y := core.o compat.o $(isapnp-proc-y)
diff --git a/drivers/pnp/isapnp/compat.c b/drivers/pnp/isapnp/compat.c
index 862c21feba05..834a4ee8b4a9 100644
--- a/drivers/pnp/isapnp/compat.c
+++ b/drivers/pnp/isapnp/compat.c
@@ -26,21 +26,20 @@ static void pnp_convert_id(char *buf, unsigned short vendor, unsigned short devi
}
struct pnp_card *pnp_find_card(unsigned short vendor,
- unsigned short device,
- struct pnp_card *from)
+ unsigned short device,
+ struct pnp_card *from)
{
char id[7];
char any[7];
struct list_head *list;
pnp_convert_id(id, vendor, device);
pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
- list = isapnp_cards.next;
- if (from)
- list = from->node.next;
- while (list != &isapnp_cards) {
- struct pnp_card *card = to_pnp_card(list);
- if (compare_pnp_id(&card->ids,id) || (memcmp(id,any,7)==0))
+ list = from ? from->global_list.next : pnp_cards.next;
+
+ while (list != &pnp_cards) {
+ struct pnp_card *card = global_to_pnp_card(list);
+ if (compare_pnp_id(card->id,id) || (memcmp(id,any,7)==0))
return card;
list = list->next;
}
@@ -48,9 +47,9 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
}
struct pnp_dev *pnp_find_dev(struct pnp_card *card,
- unsigned short vendor,
- unsigned short function,
- struct pnp_dev *from)
+ unsigned short vendor,
+ unsigned short function,
+ struct pnp_dev *from)
{
char id[7];
char any[7];
@@ -65,7 +64,7 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
while (list != &pnp_global) {
struct pnp_dev *dev = global_to_pnp_dev(list);
- if (compare_pnp_id(&dev->ids,id) || (memcmp(id,any,7)==0))
+ if (compare_pnp_id(dev->id,id) || (memcmp(id,any,7)==0))
return dev;
list = list->next;
}
@@ -80,7 +79,7 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
}
while (list != &card->devices) {
struct pnp_dev *dev = card_to_pnp_dev(list);
- if (compare_pnp_id(&dev->ids,id))
+ if (compare_pnp_id(dev->id,id))
return dev;
list = list->next;
}
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index b60bea187852..fa683efd00a3 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -42,12 +42,8 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/isapnp.h>
-#include <linux/pnp.h>
#include <asm/io.h>
-LIST_HEAD(isapnp_cards);
-LIST_HEAD(isapnp_devices);
-
#if 0
#define ISAPNP_REGION_OK
#endif
@@ -106,6 +102,8 @@ static int isapnp_detected;
/* some prototypes */
static int isapnp_config_prepare(struct pnp_dev *dev);
+extern struct pnp_protocol isapnp_card_protocol;
+extern struct pnp_protocol isapnp_protocol;
static inline void write_data(unsigned char x)
{
@@ -521,7 +519,7 @@ static void __init isapnp_add_port_resource(struct pnp_dev *dev,
port->max = (tmp[4] << 8) | tmp[3];
port->align = tmp[5];
port->size = tmp[6];
- port->flags = tmp[0] ? ISAPNP_PORT_FLAG_16BITADDR : 0;
+ port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0;
pnp_add_port_resource(dev,depnum,port);
return;
}
@@ -543,7 +541,7 @@ static void __init isapnp_add_fixed_port_resource(struct pnp_dev *dev,
port->min = port->max = (tmp[1] << 8) | tmp[0];
port->size = tmp[2];
port->align = 0;
- port->flags = ISAPNP_PORT_FLAG_FIXED;
+ port->flags = PNP_PORT_FLAG_FIXED;
pnp_add_port_resource(dev,depnum,port);
return;
}
@@ -631,7 +629,7 @@ isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
*/
static int __init isapnp_create_device(struct pnp_card *card,
- unsigned short size)
+ unsigned short size)
{
int number = 0, skip = 0, depnum = 0, dependent = 0, compat = 0;
unsigned char type, tmp[17];
@@ -686,7 +684,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
case _STAG_STARTDEP:
if (size > 1)
goto __skip;
- dependent = 0x100 | ISAPNP_RES_PRIORITY_ACCEPTABLE;
+ dependent = 0x100 | PNP_RES_PRIORITY_ACCEPTABLE;
if (size > 0) {
isapnp_peek(tmp, size);
dependent = 0x100 | tmp[0];
@@ -891,7 +889,7 @@ static int __init isapnp_build_device_list(void)
if (isapnp_checksum_value != 0x00)
printk(KERN_ERR "isapnp: checksum for device %i is not valid (0x%x)\n", csn, isapnp_checksum_value);
card->checksum = isapnp_checksum_value;
- card->protocol = &isapnp_protocol;
+ card->protocol = &isapnp_card_protocol;
pnpc_add_card(card);
}
return 0;
@@ -903,7 +901,12 @@ static int __init isapnp_build_device_list(void)
int isapnp_present(void)
{
- return !list_empty(&isapnp_devices);
+ struct pnp_card *card;
+ pnp_for_each_card(card) {
+ if (card->protocol == &isapnp_card_protocol)
+ return 1;
+ }
+ return 0;
}
int isapnp_cfg_begin(int csn, int logdev)
@@ -947,7 +950,7 @@ static int isapnp_config_prepare(struct pnp_dev *dev)
int idx;
if (dev == NULL)
return -EINVAL;
- if (dev->active || dev->ro)
+ if (dev->active || dev->lock_resources)
return -EBUSY;
for (idx = 0; idx < DEVICE_COUNT_IRQ; idx++) {
dev->irq_resource[idx].name = NULL;
@@ -970,24 +973,11 @@ static int isapnp_config_prepare(struct pnp_dev *dev)
return 0;
}
-void isapnp_resource_change(struct resource *resource,
- unsigned long start,
- unsigned long size)
-{
- if (resource == NULL)
- return;
- resource->flags &= ~IORESOURCE_AUTO;
- resource->start = start;
- resource->end = start + size - 1;
-}
-
/*
* Inititialization.
*/
-EXPORT_SYMBOL(isapnp_cards);
-EXPORT_SYMBOL(isapnp_devices);
EXPORT_SYMBOL(isapnp_present);
EXPORT_SYMBOL(isapnp_cfg_begin);
EXPORT_SYMBOL(isapnp_cfg_end);
@@ -999,7 +989,6 @@ EXPORT_SYMBOL(isapnp_write_word);
EXPORT_SYMBOL(isapnp_write_dword);
EXPORT_SYMBOL(isapnp_wake);
EXPORT_SYMBOL(isapnp_device);
-EXPORT_SYMBOL(isapnp_resource_change);
static int isapnp_get_resources(struct pnp_dev *dev)
{
@@ -1053,8 +1042,15 @@ static int isapnp_disable_resources(struct pnp_dev *dev)
return 0;
}
+struct pnp_protocol isapnp_card_protocol = {
+ .name = "ISA Plug and Play - card",
+ .get = NULL,
+ .set = NULL,
+ .disable = NULL,
+};
+
struct pnp_protocol isapnp_protocol = {
- .name = "ISA Plug and Play",
+ .name = "ISA Plug and Play - device",
.get = isapnp_get_resources,
.set = isapnp_set_resources,
.disable = isapnp_disable_resources,
@@ -1064,6 +1060,7 @@ int __init isapnp_init(void)
{
int cards;
struct pnp_card *card;
+ struct pnp_dev *dev;
if (isapnp_disable) {
isapnp_detected = 0;
@@ -1084,6 +1081,9 @@ int __init isapnp_init(void)
return -EBUSY;
}
+ if(pnp_register_protocol(&isapnp_card_protocol)<0)
+ return -EBUSY;
+
if(pnp_register_protocol(&isapnp_protocol)<0)
return -EBUSY;
@@ -1126,13 +1126,11 @@ int __init isapnp_init(void)
protocol_for_each_card(&isapnp_protocol,card) {
cards++;
if (isapnp_verbose) {
- struct list_head *devlist;
printk(KERN_INFO "isapnp: Card '%s'\n", card->name[0]?card->name:"Unknown");
if (isapnp_verbose < 2)
continue;
- for (devlist = card->devices.next; devlist != &card->devices; devlist = devlist->next) {
- struct pci_dev *dev = pci_dev_b(devlist);
- printk(KERN_INFO "isapnp: Device '%s'\n", dev->dev.name[0]?card->name:"Unknown");
+ pnp_card_for_each_dev(card,dev) {
+ printk(KERN_INFO "isapnp: Device '%s'\n", dev->name[0]?dev->name:"Unknown");
}
}
}
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c
index f3427d078367..2330ee03f808 100644
--- a/drivers/pnp/isapnp/proc.c
+++ b/drivers/pnp/isapnp/proc.c
@@ -28,6 +28,7 @@
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
+extern struct pnp_protocol isapnp_protocol;
static struct proc_dir_entry *isapnp_proc_bus_dir = NULL;
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 2f11e1b5f746..fadd276ccd95 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -1035,7 +1035,7 @@ static unsigned char *node_possible_resource_data_to_dev(unsigned char *p, struc
#define CHAR(id,a) (0x40 + (((id)>>a) & 31))
//
-static void inline pnpid32_to_pnpid(u32 id, char *str)
+static inline void pnpid32_to_pnpid(u32 id, char *str)
{
const char *hex = "0123456789abcdef";
@@ -1058,6 +1058,7 @@ static void inline pnpid32_to_pnpid(u32 id, char *str)
static void node_id_data_to_dev(unsigned char *p, struct pnp_bios_node *node, struct pnp_dev *dev)
{
int len;
+ char id[8];
struct pnp_id *dev_id;
if ((char *)p == NULL)
@@ -1083,7 +1084,9 @@ static void node_id_data_to_dev(unsigned char *p, struct pnp_bios_node *node, st
dev_id = pnpbios_kmalloc(sizeof (struct pnp_id), GFP_KERNEL);
if (!dev_id)
return;
- pnpid32_to_pnpid(p[1] | p[2] << 8 | p[3] << 16 | p[4] << 24,dev_id->id);
+ memset(dev_id, 0, sizeof(struct pnp_id));
+ pnpid32_to_pnpid(p[1] | p[2] << 8 | p[3] << 16 | p[4] << 24,id);
+ memcpy(&dev_id->id, id, 7);
pnp_add_id(dev_id, dev);
break;
}
@@ -1258,7 +1261,7 @@ static int pnpbios_get_resources(struct pnp_dev *dev)
struct pnp_bios_node * node;
/* just in case */
- if(dev->driver)
+ if(pnp_dev_has_driver(dev))
return -EBUSY;
if(!pnp_is_dynamic(dev))
return -EPERM;
@@ -1281,7 +1284,7 @@ static int pnpbios_set_resources(struct pnp_dev *dev, struct pnp_cfg *config, ch
struct pnp_bios_node * node;
/* just in case */
- if(dev->driver)
+ if(pnp_dev_has_driver(dev))
return -EBUSY;
if (flags == PNP_DYNAMIC && !pnp_is_dynamic(dev))
return -EPERM;
@@ -1335,7 +1338,7 @@ static int pnpbios_disable_resources(struct pnp_dev *dev)
if (!config)
return -1;
/* just in case */
- if(dev->driver)
+ if(pnp_dev_has_driver(dev))
return -EBUSY;
if(dev->flags & PNP_NO_DISABLE || !pnp_is_dynamic(dev))
return -EPERM;
@@ -1380,7 +1383,7 @@ static struct pnp_protocol pnpbios_protocol = {
.disable = pnpbios_disable_resources,
};
-static int inline insert_device(struct pnp_dev *dev)
+static inline int insert_device(struct pnp_dev *dev)
{
struct list_head * pos;
struct pnp_dev * pnp_dev;
@@ -1396,7 +1399,7 @@ static int inline insert_device(struct pnp_dev *dev)
static void __init build_devlist(void)
{
u8 nodenum;
- char id[7];
+ char id[8];
unsigned char *pos;
unsigned int nodes_got = 0;
unsigned int devs = 0;
@@ -1432,14 +1435,15 @@ static void __init build_devlist(void)
break;
memset(dev,0,sizeof(struct pnp_dev));
dev_id = pnpbios_kmalloc(sizeof (struct pnp_id), GFP_KERNEL);
- if (!dev_id)
+ if (!dev_id) {
+ kfree(dev);
break;
+ }
memset(dev_id,0,sizeof(struct pnp_id));
dev->number = thisnodenum;
- memcpy(dev->name,"Unknown Device",13);
- dev->name[14] = '\0';
+ strcpy(dev->name,"Unknown Device");
pnpid32_to_pnpid(node->eisa_id,id);
- memcpy(dev_id->id,id,8);
+ memcpy(dev_id->id,id,7);
pnp_add_id(dev_id, dev);
pos = node_current_resource_data_to_dev(node,dev);
pos = node_possible_resource_data_to_dev(pos,node,dev);
@@ -1448,9 +1452,10 @@ static void __init build_devlist(void)
dev->protocol = &pnpbios_protocol;
- if(insert_device(dev)<0)
+ if(insert_device(dev)<0) {
+ kfree(dev_id);
kfree(dev);
- else
+ } else
devs++;
if (nodenum <= thisnodenum) {
printk(KERN_ERR "PnPBIOS: build_devlist: Node number 0x%x is out of sequence following node 0x%x. Aborting.\n", (unsigned int)nodenum, (unsigned int)thisnodenum);
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index d8648efb72b3..d447461caa14 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -588,45 +588,65 @@ static int pnp_generate_dma(struct pnp_cfg *config, int num)
return -ENOENT;
}
-static int pnp_prepare_request(struct pnp_cfg *config)
+int pnp_init_res_cfg(struct pnp_res_cfg *res_config)
{
- struct pnp_dev *dev;
int idx;
- if (!config)
- return -EINVAL;
- dev = &config->request;
- if (dev == NULL)
+
+ if (!res_config)
return -EINVAL;
- if (dev->active || dev->ro)
- return -EBUSY;
for (idx = 0; idx < DEVICE_COUNT_IRQ; idx++) {
- dev->irq_resource[idx].name = NULL;
- dev->irq_resource[idx].start = -1;
- dev->irq_resource[idx].end = -1;
- dev->irq_resource[idx].flags = 0;
+ res_config->irq_resource[idx].start = -1;
+ res_config->irq_resource[idx].end = -1;
+ res_config->irq_resource[idx].flags = 0;
}
for (idx = 0; idx < DEVICE_COUNT_DMA; idx++) {
- dev->dma_resource[idx].name = NULL;
- dev->dma_resource[idx].start = -1;
- dev->dma_resource[idx].end = -1;
- dev->dma_resource[idx].flags = 0;
+ res_config->dma_resource[idx].name = NULL;
+ res_config->dma_resource[idx].start = -1;
+ res_config->dma_resource[idx].end = -1;
+ res_config->dma_resource[idx].flags = 0;
}
for (idx = 0; idx < DEVICE_COUNT_RESOURCE; idx++) {
- dev->resource[idx].name = NULL;
- dev->resource[idx].start = 0;
- dev->resource[idx].end = 0;
- dev->resource[idx].flags = 0;
+ res_config->resource[idx].name = NULL;
+ res_config->resource[idx].start = 0;
+ res_config->resource[idx].end = 0;
+ res_config->resource[idx].flags = 0;
}
return 0;
}
-static int pnp_generate_request(struct pnp_cfg *config)
+static int pnp_prepare_request(struct pnp_dev *dev, struct pnp_cfg *config, struct pnp_res_cfg *template)
{
- int i;
+ int idx, err;
if (!config)
return -EINVAL;
- if (pnp_prepare_request<0)
- return -ENOENT;
+ if (dev->lock_resources)
+ return -EPERM;
+ if (dev->active)
+ return -EBUSY;
+ err = pnp_init_res_cfg(&config->request);
+ if (err < 0)
+ return err;
+ if (!template)
+ return 0;
+ for (idx = 0; idx < DEVICE_COUNT_IRQ; idx++)
+ if (template->irq_resource[idx].start >= 0)
+ config->request.irq_resource[idx] = template->irq_resource[idx];
+ for (idx = 0; idx < DEVICE_COUNT_DMA; idx++)
+ if (template->dma_resource[idx].start >= 0)
+ config->request.dma_resource[idx] = template->dma_resource[idx];
+ for (idx = 0; idx < DEVICE_COUNT_RESOURCE; idx++)
+ if (template->resource[idx].start > 0)
+ config->request.resource[idx] = template->resource[idx];
+ return 0;
+}
+
+static int pnp_generate_request(struct pnp_dev *dev, struct pnp_cfg *config, struct pnp_res_cfg *template)
+{
+ int i, err;
+ if (!config)
+ return -EINVAL;
+ if ((err = pnp_prepare_request(dev, config, template))<0)
+ return err;
for (i=0; i<=7; i++)
{
if(pnp_generate_port(config,i)<0)
@@ -745,7 +765,7 @@ static struct pnp_cfg * pnp_generate_config(struct pnp_dev *dev, int depnum)
* finds the best resource configuration and then informs the correct pnp protocol
*/
-int pnp_activate_dev(struct pnp_dev *dev)
+int pnp_activate_dev(struct pnp_dev *dev, struct pnp_res_cfg *template)
{
int depnum, max;
struct pnp_cfg *config;
@@ -754,7 +774,7 @@ int pnp_activate_dev(struct pnp_dev *dev)
max = pnp_get_max_depnum(dev);
if (dev->active)
return -EBUSY;
- if (dev->driver){
+ if (pnp_dev_has_driver(dev)){
printk(KERN_INFO "pnp: Automatic configuration failed because the PnP device '%s' is busy\n", dev->dev.bus_id);
return -EINVAL;
}
@@ -767,7 +787,7 @@ int pnp_activate_dev(struct pnp_dev *dev)
config = pnp_generate_config(dev,depnum);
if (!config)
return -EINVAL;
- if (pnp_generate_request(config)==0)
+ if (pnp_generate_request(dev,config,template)==0)
goto done;
kfree(config);
}
@@ -794,10 +814,12 @@ int pnp_disable_dev(struct pnp_dev *dev)
{
if (!dev)
return -EINVAL;
- if (dev->driver){
+ if (pnp_dev_has_driver(dev)){
printk(KERN_INFO "pnp: Disable failed becuase the PnP device '%s' is busy\n", dev->dev.bus_id);
return -EINVAL;
}
+ if (dev->lock_resources)
+ return -EPERM;
if (!dev->protocol->disable || !dev->active)
return -EINVAL;
pnp_dbg("the device '%s' has been disabled", dev->dev.bus_id);
@@ -812,21 +834,21 @@ int pnp_disable_dev(struct pnp_dev *dev)
*
*/
-int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, int mode)
+int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template, int mode)
{
struct pnp_cfg *config;
if (!dev)
return -EINVAL;
- config = pnp_generate_config(dev,depnum);
- if (dev->driver){
- printk(KERN_INFO "pnp: Unable to set resources becuase the PnP device '%s' is busy\n", dev->dev.bus_id);
+ if (pnp_dev_has_driver(dev)){
+ printk(KERN_INFO "pnp: Unable to set resources because the PnP device '%s' is busy\n", dev->dev.bus_id);
return -EINVAL;
}
if (!dev->protocol->get || !dev->protocol->set)
return -EINVAL;
+ config = pnp_generate_config(dev,depnum);
if (!config)
return -EINVAL;
- if (pnp_generate_request(config)==0)
+ if (pnp_generate_request(dev,config,template)==0)
goto done;
kfree(config);
printk(KERN_ERR "pnp: Manual configuration failed for device '%s' due to resource conflicts\n", dev->dev.bus_id);
@@ -840,6 +862,23 @@ int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, int mode)
return 0;
}
+/**
+ * pnp_resource_change - change one resource
+ * @resource: pointer to resource to be changed
+ * @start: start of region
+ * @size: size of region
+ *
+ */
+
+void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size)
+{
+ if (resource == NULL)
+ return;
+ resource->flags &= ~IORESOURCE_AUTO;
+ resource->start = start;
+ resource->end = start + size - 1;
+}
+
EXPORT_SYMBOL(pnp_build_resource);
EXPORT_SYMBOL(pnp_find_resources);
EXPORT_SYMBOL(pnp_get_max_depnum);
@@ -848,9 +887,11 @@ EXPORT_SYMBOL(pnp_add_dma_resource);
EXPORT_SYMBOL(pnp_add_port_resource);
EXPORT_SYMBOL(pnp_add_mem_resource);
EXPORT_SYMBOL(pnp_add_mem32_resource);
+EXPORT_SYMBOL(pnp_init_res_cfg);
EXPORT_SYMBOL(pnp_activate_dev);
EXPORT_SYMBOL(pnp_disable_dev);
EXPORT_SYMBOL(pnp_raw_set_dev);
+EXPORT_SYMBOL(pnp_resource_change);
/* format is: allowdma0 */
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index ddfd46f701fc..18eefd83915e 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -58,6 +58,7 @@ obj-$(CONFIG_SCSI_AHA152X) += aha152x.o
obj-$(CONFIG_SCSI_AHA1542) += aha1542.o
obj-$(CONFIG_SCSI_AHA1740) += aha1740.o
obj-$(CONFIG_SCSI_AIC7XXX) += aic7xxx/
+obj-$(CONFIG_SCSI_AIC79XX) += aic7xxx/
obj-$(CONFIG_SCSI_AACRAID) += aacraid/
obj-$(CONFIG_SCSI_AIC7XXX_OLD) += aic7xxx_old.o
obj-$(CONFIG_SCSI_IPS) += ips.o
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic79xx b/drivers/scsi/aic7xxx/Kconfig.aic79xx
index 0b6c04b23581..70b49a9ba691 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic79xx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic79xx
@@ -1,6 +1,6 @@
#
# AIC79XX 2.5.X Kernel configuration File.
-# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic79xx#2 $
+# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic79xx#3 $
#
config SCSI_AIC79XX
tristate "Adaptec AIC79xx U320 support"
@@ -76,20 +76,20 @@ config AIC79XX_DEBUG_ENABLE
driver errors.
config AIC79XX_DEBUG_MASK
- int "Debug code enable mask (16383 for all debugging)"
- depends on SCSI_AIC79XX
- default "0"
- help
+ int "Debug code enable mask (16383 for all debugging)"
+ depends on SCSI_AIC79XX
+ default "0"
+ help
Bit mask of debug options that is only valid if the
CONFIG_AIC79XX_DEBUG_ENBLE option is enabled. The bits in this mask
are defined in the drivers/scsi/aic7xxx/aic79xx.h - search for the
variable ahd_debug in that file to find them.
config AIC79XX_REG_PRETTY_PRINT
- bool "Decode registers during diagnostics"
- depends on SCSI_AIC79XX && SCSI_AIC7XXX_BUILD_FIRMWARE
+ bool "Decode registers during diagnostics"
+ depends on SCSI_AIC79XX
default y
- help
+ help
Compile in register value tables for the output of expanded register
contents in diagnostics. This make it much easier to understand debug
output without having to refer to a data book and/or the aic7xxx.reg
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic7xxx b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
index 9d9a9e4b02c7..869922fd34af 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic7xxx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
@@ -1,6 +1,6 @@
#
# AIC7XXX and AIC79XX 2.5.X Kernel configuration File.
-# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic7xxx#4 $
+# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic7xxx#5 $
#
config SCSI_AIC7XXX
tristate "Adaptec AIC7xxx Fast -> U160 support (New Driver)"
@@ -92,7 +92,7 @@ config AIC7XXX_DEBUG_MASK
config AIC7XXX_REG_PRETTY_PRINT
bool "Decode registers during diagnostics"
- depends on SCSI_AIC7XXX && SCSI_AIC7XXX_BUILD_FIRMWARE
+ depends on SCSI_AIC7XXX
default y
help
Compile in register value tables for the output of expanded register
diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c
index 80d25528e95c..0646072850b9 100644
--- a/drivers/scsi/aic7xxx/aic7770_osm.c
+++ b/drivers/scsi/aic7xxx/aic7770_osm.c
@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#11 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#12 $
*/
#include "aic7xxx_osm.h"
@@ -61,8 +61,14 @@ aic7770_linux_probe(Scsi_Host_Template *template)
uint32_t eisa_id;
size_t id_size;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
if (check_region(eisaBase, AHC_EISA_IOSIZE) != 0)
continue;
+ request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx");
+#else
+ if (request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx") != 0)
+ continue;
+#endif
eisa_id = 0;
id_size = sizeof(eisa_id);
@@ -72,6 +78,7 @@ aic7770_linux_probe(Scsi_Host_Template *template)
eisa_id |= inb(eisaBase + IDOFFSET + i)
<< ((id_size-i-1) * 8);
}
+ release_region(eisaBase, AHC_EISA_IOSIZE);
if (eisa_id & 0x80000000)
continue; /* no EISA card in slot */
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 5c0951af77c6..a288ed9f9b3e 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#147 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#148 $
*
* $FreeBSD$
*/
@@ -3416,8 +3416,10 @@ reswitch:
*/
if (ahd->msgout_len != 0) {
#ifdef AHD_DEBUG
- if ((ahd_debug & AHD_SHOW_MESSAGES) != 0)
+ if ((ahd_debug & AHD_SHOW_MESSAGES) != 0) {
+ ahd_print_devinfo(ahd, &devinfo);
printf("Asserting ATN for response\n");
+ }
#endif
ahd_assert_atn(ahd);
}
@@ -7521,8 +7523,7 @@ ahd_stat_timer(void *arg)
"now %sabled. Cmds %d\n",
ahd_name(ahd),
(enint_coal & ENINT_COALESS) ? "en" : "dis",
- ahd->cmdcmplt_total,
- ahd->cmdcmplt_counts[ahd->cmdcmplt_bucket]);
+ ahd->cmdcmplt_total);
#endif
}
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 8fb69cd8f90f..02a7612a7efd 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1,7 +1,7 @@
/*
* Adaptec AIC79xx device driver for Linux.
*
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#100 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#103 $
*
* --------------------------------------------------------------------------
* Copyright (c) 1994-2000 Justin T. Gibbs.
@@ -1339,7 +1339,7 @@ Scsi_Host_Template aic79xx_driver_template = {
*/
.max_sectors = 8192,
#endif
-#if defined CONFIG_HIGHIO
+#if defined CONFIG_HIGHIO || LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
/* Assume RedHat Distribution with its different HIGHIO conventions. */
.can_dma_32 = 1,
@@ -2486,8 +2486,25 @@ ahd_linux_dv_thread(void *data)
printf("In DV Thread\n");
#endif
+ /*
+ * Don't care about any signals.
+ */
+ siginitsetinv(&current->blocked, 0);
+
+ /*
+ * Complete thread creation.
+ */
+ lock_kernel();
+ daemonize();
+ sprintf(current->comm, "ahd_dv_%d", ahd->unit);
+ unlock_kernel();
+
while (1) {
- down(&ahd->platform_data->dv_sem);
+ /*
+ * Use down_interruptible() rather than down() to
+ * avoid inclusion in the load average.
+ */
+ down_interruptible(&ahd->platform_data->dv_sem);
/* Check to see if we've been signaled to exit */
ahd_lock(ahd, &s);
@@ -2510,7 +2527,7 @@ ahd_linux_dv_thread(void *data)
while (LIST_FIRST(&ahd->pending_scbs) != NULL) {
ahd->platform_data->flags |= AHD_DV_WAIT_SIMQ_EMPTY;
ahd_unlock(ahd, &s);
- down(&ahd->platform_data->dv_sem);
+ down_interruptible(&ahd->platform_data->dv_sem);
ahd_lock(ahd, &s);
}
@@ -2521,7 +2538,7 @@ ahd_linux_dv_thread(void *data)
while (AHD_DV_SIMQ_FROZEN(ahd) == 0) {
ahd->platform_data->flags |= AHD_DV_WAIT_SIMQ_RELEASE;
ahd_unlock(ahd, &s);
- down(&ahd->platform_data->dv_sem);
+ down_interruptible(&ahd->platform_data->dv_sem);
ahd_lock(ahd, &s);
}
ahd_unlock(ahd, &s);
@@ -2623,6 +2640,7 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset)
AHD_TRANS_GOAL, /*paused*/FALSE);
ahd_unlock(ahd, &s);
timeout = 10 * HZ;
+ targ->flags &= ~AHD_INQ_VALID;
/* FALLTHROUGH */
case AHD_DV_STATE_INQ_VERIFY:
{
@@ -2686,7 +2704,7 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
ahd_unlock(ahd, &s);
#endif
- down(&ahd->platform_data->dv_cmd_sem);
+ down_interruptible(&ahd->platform_data->dv_cmd_sem);
/*
* Wait for the SIMQ to be released so that DV is the
* only reason the queue is frozen.
@@ -2695,7 +2713,7 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset)
while (AHD_DV_SIMQ_FROZEN(ahd) == 0) {
ahd->platform_data->flags |= AHD_DV_WAIT_SIMQ_RELEASE;
ahd_unlock(ahd, &s);
- down(&ahd->platform_data->dv_sem);
+ down_interruptible(&ahd->platform_data->dv_sem);
ahd_lock(ahd, &s);
}
ahd_unlock(ahd, &s);
@@ -2704,6 +2722,25 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset)
}
out:
+ if ((targ->flags & AHD_INQ_VALID) != 0
+ && ahd_linux_get_device(ahd, devinfo.channel - 'A',
+ devinfo.target, devinfo.lun,
+ /*alloc*/FALSE) == NULL) {
+ /*
+ * The DV state machine failed to configure this device.
+ * This is normal if DV is disabled. Since we have inquiry
+ * data, filter it and use the "optimistic" negotiation
+ * parameters found in the inquiry string.
+ */
+ ahd_linux_filter_inquiry(ahd, &devinfo);
+ if ((targ->flags & (AHD_BASIC_DV|AHD_ENHANCED_DV)) != 0) {
+ ahd_print_devinfo(ahd, &devinfo);
+ printf("DV failed to configure device. "
+ "Please file a bug report against "
+ "this driver.\n");
+ }
+ }
+
if (cmd != NULL)
free(cmd, M_DEVBUF);
@@ -2789,24 +2826,21 @@ ahd_linux_dv_transition(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
break;
}
- if (ahd_linux_user_dv_setting(ahd) == 0) {
- ahd_linux_filter_inquiry(ahd, devinfo);
- AHD_SET_DV_STATE(ahd, targ, AHD_DV_STATE_EXIT);
+ AHD_SET_DV_STATE(ahd, targ, targ->dv_state+1);
+ targ->flags |= AHD_INQ_VALID;
+ if (ahd_linux_user_dv_setting(ahd) == 0)
break;
- }
spi3data = targ->inq_data->spi3data;
switch (spi3data & SID_SPI_CLOCK_DT_ST) {
default:
case SID_SPI_CLOCK_ST:
/* Assume only basic DV is supported. */
- ahd_linux_filter_inquiry(ahd, devinfo);
- AHD_SET_DV_STATE(ahd, targ,
- AHD_DV_STATE_INQ_VERIFY);
+ targ->flags |= AHD_BASIC_DV;
break;
case SID_SPI_CLOCK_DT:
case SID_SPI_CLOCK_DT_ST:
- AHD_SET_DV_STATE(ahd, targ, AHD_DV_STATE_REBD);
+ targ->flags |= AHD_ENHANCED_DV;
break;
}
break;
@@ -2902,8 +2936,15 @@ ahd_linux_dv_transition(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
case AHD_DV_STATE_TUR:
switch (status & SS_MASK) {
case SS_NOP:
- AHD_SET_DV_STATE(ahd, targ,
- AHD_DV_STATE_INQ_ASYNC);
+ if ((targ->flags & AHD_BASIC_DV) != 0) {
+ ahd_linux_filter_inquiry(ahd, devinfo);
+ AHD_SET_DV_STATE(ahd, targ,
+ AHD_DV_STATE_INQ_VERIFY);
+ } else if ((targ->flags & AHD_ENHANCED_DV) != 0) {
+ AHD_SET_DV_STATE(ahd, targ, AHD_DV_STATE_REBD);
+ } else {
+ AHD_SET_DV_STATE(ahd, targ, AHD_DV_STATE_EXIT);
+ }
break;
case SS_RETRY:
case SS_TUR:
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
index 46d34b111c53..a3377dcc6f50 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#96 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#99 $
*
*/
#ifndef _AIC79XX_LINUX_H_
@@ -48,6 +48,7 @@
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/pci.h>
+#include <linux/smp_lock.h>
#include <linux/version.h>
#ifndef AHD_MODVERSION_FILE
#define __NO_VERSION__
@@ -287,7 +288,7 @@ ahd_scb_timer_reset(struct scb *scb, u_int usec)
#include <linux/smp.h>
#endif
-#define AIC79XX_DRIVER_VERSION "1.3.0.ALPHA5"
+#define AIC79XX_DRIVER_VERSION "1.3.0.ALPHA6"
/**************************** Front End Queues ********************************/
/*
@@ -424,16 +425,19 @@ struct ahd_linux_device {
};
typedef enum {
- AHD_DV_REQUIRED = 0x01
+ AHD_DV_REQUIRED = 0x01,
+ AHD_INQ_VALID = 0x02,
+ AHD_BASIC_DV = 0x04,
+ AHD_ENHANCED_DV = 0x08
} ahd_linux_targ_flags;
/* DV States */
typedef enum {
AHD_DV_STATE_EXIT = 0,
AHD_DV_STATE_INQ_SHORT_ASYNC,
- AHD_DV_STATE_TUR,
AHD_DV_STATE_INQ_ASYNC,
AHD_DV_STATE_INQ_ASYNC_VERIFY,
+ AHD_DV_STATE_TUR,
AHD_DV_STATE_REBD,
AHD_DV_STATE_INQ_VERIFY,
AHD_DV_STATE_WEB,
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
index fe598eba390d..115fcbf89e65 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#18 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#19 $
*/
#include "aic79xx_osm.h"
@@ -240,10 +240,8 @@ ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, u_long *base,
if (check_region(*base, 256) != 0
|| check_region(*base2, 256) != 0)
return (ENOMEM);
- else {
- request_region(*base, 256, "aic79xx");
- request_region(*base2, 256, "aic79xx");
- }
+ request_region(*base, 256, "aic79xx");
+ request_region(*base2, 256, "aic79xx");
#else
if (request_region(*base, 256, "aic79xx") == 0)
return (ENOMEM);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index d67bed4e6795..a69c1194203e 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#104 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#105 $
*
* $FreeBSD$
*/
@@ -2772,9 +2772,12 @@ reswitch:
*/
if (ahc->msgout_len != 0) {
#ifdef AHC_DEBUG
- if ((ahc_debug & AHC_SHOW_MESSAGES) != 0)
+ if ((ahc_debug & AHC_SHOW_MESSAGES) != 0) {
+ ahc_print_devinfo(ahc, &devinfo);
printf("Asserting ATN for response\n");
+ }
#endif
+ ahc_assert_atn(ahc);
}
} else
ahc->msgin_index++;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 69f6593b6072..e8e2a4e91527 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1,7 +1,7 @@
/*
* Adaptec AIC7xxx device driver for Linux.
*
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#163 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#166 $
*
* Copyright (c) 1994 John Aycock
* The University of Calgary Department of Computer Science.
@@ -2336,8 +2336,25 @@ ahc_linux_dv_thread(void *data)
printf("Launching DV Thread\n");
#endif
+ /*
+ * Don't care about any signals.
+ */
+ siginitsetinv(&current->blocked, 0);
+
+ /*
+ * Complete thread creation.
+ */
+ lock_kernel();
+ daemonize();
+ sprintf(current->comm, "ahc_dv_%d", ahc->unit);
+ unlock_kernel();
+
while (1) {
- down(&ahc->platform_data->dv_sem);
+ /*
+ * Use down_interruptible() rather than down() to
+ * avoid inclusion in the load average.
+ */
+ down_interruptible(&ahc->platform_data->dv_sem);
/* Check to see if we've been signaled to exit */
ahc_lock(ahc, &s);
@@ -2360,7 +2377,7 @@ ahc_linux_dv_thread(void *data)
while (LIST_FIRST(&ahc->pending_scbs) != NULL) {
ahc->platform_data->flags |= AHC_DV_WAIT_SIMQ_EMPTY;
ahc_unlock(ahc, &s);
- down(&ahc->platform_data->dv_sem);
+ down_interruptible(&ahc->platform_data->dv_sem);
ahc_lock(ahc, &s);
}
@@ -2371,7 +2388,7 @@ ahc_linux_dv_thread(void *data)
while (AHC_DV_SIMQ_FROZEN(ahc) == 0) {
ahc->platform_data->flags |= AHC_DV_WAIT_SIMQ_RELEASE;
ahc_unlock(ahc, &s);
- down(&ahc->platform_data->dv_sem);
+ down_interruptible(&ahc->platform_data->dv_sem);
ahc_lock(ahc, &s);
}
ahc_unlock(ahc, &s);
@@ -2473,6 +2490,7 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset)
AHC_TRANS_GOAL, /*paused*/FALSE);
ahc_unlock(ahc, &s);
timeout = 10 * HZ;
+ targ->flags &= ~AHC_INQ_VALID;
/* FALLTHROUGH */
case AHC_DV_STATE_INQ_VERIFY:
{
@@ -2536,7 +2554,7 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
ahc_unlock(ahc, &s);
#endif
- down(&ahc->platform_data->dv_cmd_sem);
+ down_interruptible(&ahc->platform_data->dv_cmd_sem);
/*
* Wait for the SIMQ to be released so that DV is the
* only reason the queue is frozen.
@@ -2545,7 +2563,7 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset)
while (AHC_DV_SIMQ_FROZEN(ahc) == 0) {
ahc->platform_data->flags |= AHC_DV_WAIT_SIMQ_RELEASE;
ahc_unlock(ahc, &s);
- down(&ahc->platform_data->dv_sem);
+ down_interruptible(&ahc->platform_data->dv_sem);
ahc_lock(ahc, &s);
}
ahc_unlock(ahc, &s);
@@ -2554,6 +2572,25 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset)
}
out:
+ if ((targ->flags & AHC_INQ_VALID) != 0
+ && ahc_linux_get_device(ahc, devinfo.channel - 'A',
+ devinfo.target, devinfo.lun,
+ /*alloc*/FALSE) == NULL) {
+ /*
+ * The DV state machine failed to configure this device.
+ * This is normal if DV is disabled. Since we have inquiry
+ * data, filter it and use the "optimistic" negotiation
+ * parameters found in the inquiry string.
+ */
+ ahc_linux_filter_inquiry(ahc, &devinfo);
+ if ((targ->flags & (AHC_BASIC_DV|AHC_ENHANCED_DV)) != 0) {
+ ahc_print_devinfo(ahc, &devinfo);
+ printf("DV failed to configure device. "
+ "Please file a bug report against "
+ "this driver.\n");
+ }
+ }
+
if (cmd != NULL)
free(cmd, M_DEVBUF);
@@ -2639,24 +2676,21 @@ ahc_linux_dv_transition(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
break;
}
- if (ahc_linux_user_dv_setting(ahc) == 0) {
- ahc_linux_filter_inquiry(ahc, devinfo);
- AHC_SET_DV_STATE(ahc, targ, AHC_DV_STATE_EXIT);
+ AHC_SET_DV_STATE(ahc, targ, targ->dv_state+1);
+ targ->flags |= AHC_INQ_VALID;
+ if (ahc_linux_user_dv_setting(ahc) == 0)
break;
- }
spi3data = targ->inq_data->spi3data;
switch (spi3data & SID_SPI_CLOCK_DT_ST) {
default:
case SID_SPI_CLOCK_ST:
/* Assume only basic DV is supported. */
- ahc_linux_filter_inquiry(ahc, devinfo);
- AHC_SET_DV_STATE(ahc, targ,
- AHC_DV_STATE_INQ_VERIFY);
+ targ->flags |= AHC_BASIC_DV;
break;
case SID_SPI_CLOCK_DT:
case SID_SPI_CLOCK_DT_ST:
- AHC_SET_DV_STATE(ahc, targ, AHC_DV_STATE_REBD);
+ targ->flags |= AHC_ENHANCED_DV;
break;
}
break;
@@ -2752,8 +2786,15 @@ ahc_linux_dv_transition(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
case AHC_DV_STATE_TUR:
switch (status & SS_MASK) {
case SS_NOP:
- AHC_SET_DV_STATE(ahc, targ,
- AHC_DV_STATE_INQ_ASYNC);
+ if ((targ->flags & AHC_BASIC_DV) != 0) {
+ ahc_linux_filter_inquiry(ahc, devinfo);
+ AHC_SET_DV_STATE(ahc, targ,
+ AHC_DV_STATE_INQ_VERIFY);
+ } else if ((targ->flags & AHC_ENHANCED_DV) != 0) {
+ AHC_SET_DV_STATE(ahc, targ, AHC_DV_STATE_REBD);
+ } else {
+ AHC_SET_DV_STATE(ahc, targ, AHC_DV_STATE_EXIT);
+ }
break;
case SS_RETRY:
case SS_TUR:
@@ -4373,6 +4414,17 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
memset(&cmd->sense_buffer[sense_size], 0,
sizeof(cmd->sense_buffer) - sense_size);
cmd->result |= (DRIVER_SENSE << 24);
+#ifdef AHC_DEBUG
+ if (ahc_debug & AHC_SHOW_SENSE) {
+ int i;
+
+ printf("Copied %d bytes of sense data:",
+ sense_size);
+ for (i = 0; i < sense_size; i++)
+ printf(" 0x%x", cmd->sense_buffer[i]);
+ printf("\n");
+ }
+#endif
}
break;
}
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h
index 65ff6384a9a4..3e8f383baf9d 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.h
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h
@@ -53,7 +53,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#111 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#114 $
*
*/
#ifndef _AIC7XXX_LINUX_H_
@@ -65,6 +65,7 @@
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/pci.h>
+#include <linux/smp_lock.h>
#include <linux/version.h>
#ifndef AHC_MODVERSION_FILE
#define __NO_VERSION__
@@ -300,7 +301,7 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec)
#include <linux/smp.h>
#endif
-#define AIC7XXX_DRIVER_VERSION "6.2.24"
+#define AIC7XXX_DRIVER_VERSION "6.2.25"
/**************************** Front End Queues ********************************/
/*
@@ -437,16 +438,19 @@ struct ahc_linux_device {
};
typedef enum {
- AHC_DV_REQUIRED = 0x01
+ AHC_DV_REQUIRED = 0x01,
+ AHC_INQ_VALID = 0x02,
+ AHC_BASIC_DV = 0x04,
+ AHC_ENHANCED_DV = 0x08
} ahc_linux_targ_flags;
/* DV States */
typedef enum {
AHC_DV_STATE_EXIT = 0,
AHC_DV_STATE_INQ_SHORT_ASYNC,
- AHC_DV_STATE_TUR,
AHC_DV_STATE_INQ_ASYNC,
AHC_DV_STATE_INQ_ASYNC_VERIFY,
+ AHC_DV_STATE_TUR,
AHC_DV_STATE_REBD,
AHC_DV_STATE_INQ_VERIFY,
AHC_DV_STATE_WEB,
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index 05b12228dc10..fcc865041b62 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#41 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#42 $
*/
#include "aic7xxx_osm.h"
@@ -232,8 +232,7 @@ ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc, u_long *base)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
if (check_region(*base, 256) != 0)
return (ENOMEM);
- else
- request_region(*base, 256, "aic7xxx");
+ request_region(*base, 256, "aic7xxx");
#else
if (request_region(*base, 256, "aic7xxx") == 0)
return (ENOMEM);
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
index 2e766b85c1aa..f1f448dff569 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
@@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_symbol.c#23 $
+ * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_symbol.c#24 $
*
* $FreeBSD$
*/
@@ -546,7 +546,7 @@ symtable_dump(FILE *ofile, FILE *dfile)
if (num_entries == 0)
aic_print_reg_dump_start(dfile,
curnode);
- else
+ else if (dfile != NULL)
fputs(",\n", dfile);
num_entries++;
aic_print_reg_dump_entry(dfile, fieldnode);
diff --git a/drivers/scsi/aic7xxx/aiclib.c b/drivers/scsi/aic7xxx/aiclib.c
index 50270d5483fd..8b9929c58927 100644
--- a/drivers/scsi/aic7xxx/aiclib.c
+++ b/drivers/scsi/aic7xxx/aiclib.c
@@ -541,12 +541,18 @@ static struct asc_table_entry asc_table[] = {
"Rounded parameter") },
/* DTL WRSOMCAE */{SST(0x39, 0x00, SS_RDEF,
"Saving parameters not supported") },
-/* DTL WRSOM */{SST(0x3A, 0x00, SS_FATAL|ENXIO,
+/* DTL WRSOM */{SST(0x3A, 0x00, SS_NOP,
"Medium not present") },
-/* DT WR OM */{SST(0x3A, 0x01, SS_FATAL|ENXIO,
+/* DT WR OM */{SST(0x3A, 0x01, SS_NOP,
"Medium not present - tray closed") },
-/* DT WR OM */{SST(0x3A, 0x02, SS_FATAL|ENXIO,
+/* DT WR OM */{SST(0x3A, 0x01, SS_NOP,
"Medium not present - tray open") },
+/* DT WR OM */{SST(0x3A, 0x03, SS_NOP,
+ "Medium not present - Loadable") },
+/* DT WR OM */{SST(0x3A, 0x04, SS_NOP,
+ "Medium not present - medium auxiliary "
+ "memory accessible") },
+/* DT WR OM */{SST(0x3A, 0xFF, SS_NOP, NULL) },/* Range 0x05->0xFF */
/* TL */{SST(0x3B, 0x00, SS_RDEF,
"Sequential positioning error") },
/* T */{SST(0x3B, 0x01, SS_RDEF,
diff --git a/drivers/scsi/aic7xxx/aiclib.h b/drivers/scsi/aic7xxx/aiclib.h
index c13774fedac2..a06167a85fa7 100644
--- a/drivers/scsi/aic7xxx/aiclib.h
+++ b/drivers/scsi/aic7xxx/aiclib.h
@@ -827,12 +827,16 @@ extern const char *scsi_sense_key_text[];
/************************* Large Disk Handling ********************************/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+static __inline int aic_sector_div(u_long capacity, int heads, int sectors);
+
static __inline int
aic_sector_div(u_long capacity, int heads, int sectors)
{
return (capacity / (heads * sectors));
}
#else
+static __inline int aic_sector_div(sector_t capacity, int heads, int sectors);
+
static __inline int
aic_sector_div(sector_t capacity, int heads, int sectors)
{
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 70da49bc0372..f7a944485be2 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -309,13 +309,8 @@ static Scsi_Host_Template *the_template = NULL;
#undef TAG_NONE
#define TAG_NONE 0xff
-/* For the m68k, the number of bits in 'allocated' must be a multiple of 32! */
-#if (MAX_TAGS % 32) != 0
-#error "MAX_TAGS must be a multiple of 32!"
-#endif
-
typedef struct {
- long allocated[MAX_TAGS/32];
+ DECLARE_BITMAP(allocated, MAX_TAGS);
int nr_allocated;
int queue_size;
} TAG_ALLOC;
@@ -334,7 +329,7 @@ static void __init init_tags( void )
for( target = 0; target < 8; ++target ) {
for( lun = 0; lun < 8; ++lun ) {
ta = &TagAlloc[target][lun];
- memset( &ta->allocated, 0, MAX_TAGS/8 );
+ CLEAR_BITMAP( ta->allocated, MAX_TAGS );
ta->nr_allocated = 0;
/* At the beginning, assume the maximum queue size we could
* support (MAX_TAGS). This value will be decreased if the target
@@ -394,8 +389,8 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
else {
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun];
- cmd->tag = find_first_zero_bit( &ta->allocated, MAX_TAGS );
- set_bit( cmd->tag, &ta->allocated );
+ cmd->tag = find_first_zero_bit( ta->allocated, MAX_TAGS );
+ set_bit( cmd->tag, ta->allocated );
ta->nr_allocated++;
TAG_PRINTK( "scsi%d: using tag %d for target %d lun %d "
"(now %d tags in use)\n",
@@ -424,7 +419,7 @@ static void cmd_free_tag( Scsi_Cmnd *cmd )
}
else {
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun];
- clear_bit( cmd->tag, &ta->allocated );
+ clear_bit( cmd->tag, ta->allocated );
ta->nr_allocated--;
TAG_PRINTK( "scsi%d: freed tag %d for target %d lun %d\n",
H_NO(cmd), cmd->tag, cmd->target, cmd->lun );
@@ -443,7 +438,7 @@ static void free_all_tags( void )
for( target = 0; target < 8; ++target ) {
for( lun = 0; lun < 8; ++lun ) {
ta = &TagAlloc[target][lun];
- memset( &ta->allocated, 0, MAX_TAGS/8 );
+ CLEAR_BITMAP( ta->allocated, MAX_TAGS );
ta->nr_allocated = 0;
}
}
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 283998c0c6d5..eb24cfde6960 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1738,7 +1738,7 @@ static int mega_driver_ioctl (mega_host_config * megaCfg, Scsi_Cmnd * SCpnt)
return 1;
}
-static void inline set_mbox_xfer_addr (mega_host_config * megaCfg, mega_scb * pScb,
+static inline void set_mbox_xfer_addr (mega_host_config * megaCfg, mega_scb * pScb,
mega_ioctl_mbox * mbox, u32 direction)
{
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
index dc4399609d44..0eaded61130b 100644
--- a/drivers/serial/68360serial.c
+++ b/drivers/serial/68360serial.c
@@ -2134,7 +2134,7 @@ static int rs_360_open(struct tty_struct *tty, struct file * filp)
* /proc fs routines....
*/
-static int inline line_info(char *buf, struct serial_state *state)
+static inline int line_info(char *buf, struct serial_state *state)
{
#ifdef notdef
struct async_struct *info = state->info, scr_info;
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index aa599f3385d2..63f8871a2ae9 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -313,7 +313,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
-static void inline avoid_irq_share(struct pnp_dev *dev)
+static inline void avoid_irq_share(struct pnp_dev *dev)
{
unsigned int map = 0x1FF8;
struct pnp_irq *irq;
@@ -360,7 +360,7 @@ static int serial_pnp_guess_board(struct pnp_dev *dev, int *flags)
struct pnp_resources *res = dev->res;
struct pnp_resources *resa;
- if (!(check_name(dev->name) || check_name(dev->card->name)))
+ if (!(check_name(dev->name) || (dev->card && check_name(dev->card->name))))
return -ENODEV;
if (!res)
@@ -385,8 +385,11 @@ serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
{
struct serial_struct serial_req;
int ret, line, flags = dev_id->driver_data;
- if (flags & UNKNOWN_DEV)
+ if (flags & UNKNOWN_DEV) {
ret = serial_pnp_guess_board(dev, &flags);
+ if (ret < 0)
+ return ret;
+ }
if (flags & SPCI_FL_NO_SHIRQ)
avoid_irq_share(dev);
memset(&serial_req, 0, sizeof(serial_req));
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 624beac700b4..bc59f1c31e6a 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -346,7 +346,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
/* FALLTHROUGH */
case DeviceOutRequest | USB_REQ_CLEAR_FEATURE:
case DeviceOutRequest | USB_REQ_SET_FEATURE:
- dbg ("no device features yet yet");
+ dev_dbg (*hcd->controller, "no device features yet yet\n");
break;
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
ubuf [0] = 1;
@@ -404,7 +404,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
/* FALLTHROUGH */
case EndpointOutRequest | USB_REQ_CLEAR_FEATURE:
case EndpointOutRequest | USB_REQ_SET_FEATURE:
- dbg ("no endpoint features yet");
+ dev_dbg (*hcd->controller, "no endpoint features yet\n");
break;
/* CLASS REQUESTS (and errors) */
@@ -418,12 +418,12 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
error:
/* "protocol stall" on error */
urb->status = -EPIPE;
- dbg ("unsupported hub control message (maxchild %d)",
+ dev_dbg (*hcd->controller, "unsupported hub control message (maxchild %d)\n",
urb->dev->maxchild);
}
if (urb->status) {
urb->actual_length = 0;
- dbg ("CTRL: TypeReq=0x%x val=0x%x idx=0x%x len=%d ==> %d",
+ dev_dbg (*hcd->controller, "CTRL: TypeReq=0x%x val=0x%x idx=0x%x len=%d ==> %d\n",
typeReq, wValue, wIndex, wLength, urb->status);
}
if (bufp) {
@@ -456,7 +456,7 @@ static int rh_status_urb (struct usb_hcd *hcd, struct urb *urb)
if (timer_pending (&hcd->rh_timer)
|| urb->status != -EINPROGRESS
|| urb->transfer_buffer_length < len) {
- dbg ("not queuing status urb, stat %d", urb->status);
+ dev_dbg (*hcd->controller, "not queuing status urb, stat %d\n", urb->status);
return -EINVAL;
}
@@ -667,7 +667,7 @@ void usb_register_bus(struct usb_bus *bus)
usbfs_add_bus (bus);
- info ("new USB bus registered, assigned bus number %d", bus->busnum);
+ dev_info (*bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum);
}
EXPORT_SYMBOL (usb_register_bus);
@@ -681,7 +681,7 @@ EXPORT_SYMBOL (usb_register_bus);
*/
void usb_deregister_bus (struct usb_bus *bus)
{
- info ("USB bus %d deregistered", bus->busnum);
+ dev_info (*bus->controller, "USB bus %d deregistered\n", bus->busnum);
/*
* NOTE: make sure that all the devices are removed by the
@@ -824,7 +824,7 @@ int usb_check_bandwidth (struct usb_device *dev, struct urb *urb)
#else
"would have ";
#endif
- dbg ("usb_check_bandwidth %sFAILED: %d + %ld = %d usec",
+ dev_dbg (dev->dev, "usb_check_bandwidth %sFAILED: %d + %ld = %d usec\n",
mode, old_alloc, bustime, new_alloc);
#endif
#ifdef CONFIG_USB_BANDWIDTH
@@ -863,7 +863,7 @@ void usb_claim_bandwidth (struct usb_device *dev, struct urb *urb, int bustime,
urb->bandwidth = bustime;
#ifdef USB_BANDWIDTH_MESSAGES
- dbg ("bandwidth alloc increased by %d (%s) to %d for %d requesters",
+ dev_dbg (dev->dev, "bandwidth alloc increased by %d (%s) to %d for %d requesters\n",
bustime,
isoc ? "ISOC" : "INTR",
dev->bus->bandwidth_allocated,
@@ -892,7 +892,7 @@ void usb_release_bandwidth (struct usb_device *dev, struct urb *urb, int isoc)
dev->bus->bandwidth_int_reqs--;
#ifdef USB_BANDWIDTH_MESSAGES
- dbg ("bandwidth alloc reduced by %d (%s) to %d for %d requesters",
+ dev_dbg (dev->dev, "bandwidth alloc reduced by %d (%s) to %d for %d requesters\n",
urb->bandwidth,
isoc ? "ISOC" : "INTR",
dev->bus->bandwidth_allocated,
@@ -1153,7 +1153,7 @@ static int hcd_unlink_urb (struct urb *urb)
*/
if (!(urb->transfer_flags & URB_ASYNC_UNLINK)) {
if (in_interrupt ()) {
- dbg ("non-async unlink in_interrupt");
+ dev_dbg (*hcd->controller, "non-async unlink in_interrupt");
retval = -EWOULDBLOCK;
goto done;
}
@@ -1233,7 +1233,7 @@ static int hcd_free_dev (struct usb_device *udev)
/* device driver problem with refcounts? */
if (!list_empty (&dev->urb_list)) {
- dbg ("free busy dev, %s devnum %d (bug!)",
+ dev_dbg (*hcd->controller, "free busy dev, %s devnum %d (bug!)\n",
hcd->self.bus_name, udev->devnum);
return -EINVAL;
}
@@ -1339,6 +1339,12 @@ EXPORT_SYMBOL (usb_hcd_irq);
/*-------------------------------------------------------------------------*/
+static void hcd_panic (void *_hcd)
+{
+ struct usb_hcd *hcd = _hcd;
+ hcd->driver->stop (hcd);
+}
+
/**
* usb_hc_died - report abnormal shutdown of a host controller (bus glue)
* @hcd: pointer to the HCD representing the controller
@@ -1360,7 +1366,7 @@ void usb_hc_died (struct usb_hcd *hcd)
dev = list_entry (devlist, struct hcd_dev, dev_list);
list_for_each (urblist, &dev->urb_list) {
urb = list_entry (urblist, struct urb, urb_list);
- dbg ("shutdown %s urb %p pipe %x, current status %d",
+ dev_dbg (*hcd->controller, "shutdown %s urb %p pipe %x, current status %d\n",
hcd->self.bus_name, urb, urb->pipe, urb->status);
if (urb->status == -EINPROGRESS)
urb->status = -ESHUTDOWN;
@@ -1371,9 +1377,9 @@ void usb_hc_died (struct usb_hcd *hcd)
urb->status = -ESHUTDOWN;
spin_unlock_irqrestore (&hcd_data_lock, flags);
- if (urb)
- usb_rh_status_dequeue (hcd, urb);
- hcd->driver->stop (hcd);
+ /* hcd->stop() needs a task context */
+ INIT_WORK (&hcd->work, hcd_panic, hcd);
+ (void) schedule_work (&hcd->work);
}
EXPORT_SYMBOL (usb_hc_died);
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 99cb0f4b2c84..a3d924e2e34c 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -67,6 +67,7 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */
struct timer_list rh_timer; /* drives root hub */
struct list_head dev_list; /* devices on this bus */
+ struct work_struct work;
/*
* hardware info/state
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index d013ec009f87..d185edba0fa6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -263,7 +263,8 @@ static void usb_hub_power_on(struct usb_hub *hub)
int i;
/* Enable power to the ports */
- dbg("enabling power on all ports");
+ dev_dbg(*hubdev(interface_to_usbdev(hub->intf)),
+ "enabling power on all ports\n");
dev = interface_to_usbdev(hub->intf);
for (i = 0; i < hub->descriptor->bNbrPorts; i++)
usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
@@ -276,6 +277,7 @@ static int usb_hub_configure(struct usb_hub *hub,
struct usb_endpoint_descriptor *endpoint)
{
struct usb_device *dev = interface_to_usbdev (hub->intf);
+ struct device *hub_dev;
struct usb_hub_status hubstatus;
unsigned int pipe;
int maxp, ret;
@@ -303,8 +305,9 @@ static int usb_hub_configure(struct usb_hub *hub,
goto fail;
}
+ hub_dev = hubdev(dev);
dev->maxchild = hub->descriptor->bNbrPorts;
- dev_info (*hubdev (dev), "%d port%s detected\n", dev->maxchild,
+ dev_info (*hub_dev, "%d port%s detected\n", dev->maxchild,
(dev->maxchild == 1) ? "" : "s");
le16_to_cpus(&hub->descriptor->wHubCharacteristics);
@@ -318,33 +321,33 @@ static int usb_hub_configure(struct usb_hub *hub,
[((i + 1) / 8)] & (1 << ((i + 1) % 8))
? 'F' : 'R';
portstr[dev->maxchild] = 0;
- dbg("compound device; port removable status: %s", portstr);
+ dev_dbg(*hub_dev, "compound device; port removable status: %s\n", portstr);
} else
- dbg("standalone hub");
+ dev_dbg(*hub_dev, "standalone hub\n");
switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) {
case 0x00:
- dbg("ganged power switching");
+ dev_dbg(*hub_dev, "ganged power switching\n");
break;
case 0x01:
- dbg("individual port power switching");
+ dev_dbg(*hub_dev, "individual port power switching\n");
break;
case 0x02:
case 0x03:
- dbg("unknown reserved power switching mode");
+ dev_dbg(*hub_dev, "unknown reserved power switching mode\n");
break;
}
switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_OCPM) {
case 0x00:
- dbg("global over-current protection");
+ dev_dbg(*hub_dev, "global over-current protection\n");
break;
case 0x08:
- dbg("individual port over-current protection");
+ dev_dbg(*hub_dev, "individual port over-current protection\n");
break;
case 0x10:
case 0x18:
- dbg("no over-current protection");
+ dev_dbg(*hub_dev, "no over-current protection\n");
break;
}
@@ -355,16 +358,16 @@ static int usb_hub_configure(struct usb_hub *hub,
case 0:
break;
case 1:
- dbg("Single TT");
+ dev_dbg(*hub_dev, "Single TT\n");
hub->tt.hub = dev;
break;
case 2:
- dbg("TT per port");
+ dev_dbg(*hub_dev, "TT per port\n");
hub->tt.hub = dev;
hub->tt.multi = 1;
break;
default:
- dbg("Unrecognized hub protocol %d",
+ dev_dbg(*hub_dev, "Unrecognized hub protocol %d\n",
dev->descriptor.bDeviceProtocol);
break;
}
@@ -372,26 +375,26 @@ static int usb_hub_configure(struct usb_hub *hub,
switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_TTTT) {
case 0x00:
if (dev->descriptor.bDeviceProtocol != 0)
- dbg("TT requires at most 8 FS bit times");
+ dev_dbg(*hub_dev, "TT requires at most 8 FS bit times\n");
break;
case 0x20:
- dbg("TT requires at most 16 FS bit times");
+ dev_dbg(*hub_dev, "TT requires at most 16 FS bit times\n");
break;
case 0x40:
- dbg("TT requires at most 24 FS bit times");
+ dev_dbg(*hub_dev, "TT requires at most 24 FS bit times\n");
break;
case 0x60:
- dbg("TT requires at most 32 FS bit times");
+ dev_dbg(*hub_dev, "TT requires at most 32 FS bit times\n");
break;
}
- dbg("Port indicators are %s supported",
+ dev_dbg(*hub_dev, "Port indicators are %s supported\n",
(hub->descriptor->wHubCharacteristics & HUB_CHAR_PORTIND)
? "" : "not");
- dbg("power on to power good time: %dms",
+ dev_dbg(*hub_dev, "power on to power good time: %dms\n",
hub->descriptor->bPwrOn2PwrGood * 2);
- dbg("hub controller current requirement: %dmA",
+ dev_dbg(*hub_dev, "hub controller current requirement: %dmA\n",
hub->descriptor->bHubContrCurrent);
ret = usb_get_hub_status(dev, &hubstatus);
@@ -402,11 +405,11 @@ static int usb_hub_configure(struct usb_hub *hub,
le16_to_cpus(&hubstatus.wHubStatus);
- dbg("local power source is %s",
+ dev_dbg(*hub_dev, "local power source is %s\n",
(hubstatus.wHubStatus & HUB_STATUS_LOCAL_POWER)
? "lost (inactive)" : "good");
- dbg("%sover-current condition exists",
+ dev_dbg(*hub_dev, "%sover-current condition exists\n",
(hubstatus.wHubStatus & HUB_STATUS_OVERCURRENT) ? "" : "no ");
/* Start the interrupt endpoint */
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index c367260c4d98..1ca898312c5e 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -84,19 +84,19 @@ int usb_device_probe(struct device *dev)
const struct usb_device_id *id;
int error = -ENODEV;
- dbg("%s", __FUNCTION__);
+ dev_dbg(*dev, "%s\n", __FUNCTION__);
if (!driver->probe)
return error;
if (!try_module_get(driver->owner)) {
- err ("Can't get a module reference for %s", driver->name);
+ dev_err (*dev, "Can't get a module reference for %s\n", driver->name);
return error;
}
id = usb_match_id (intf, driver->id_table);
if (id) {
- dbg ("%s - got id", __FUNCTION__);
+ dev_dbg (*dev, "%s - got id\n", __FUNCTION__);
down (&driver->serialize);
error = driver->probe (intf, id);
up (&driver->serialize);
@@ -118,7 +118,7 @@ int usb_device_remove(struct device *dev)
driver = to_usb_driver(dev->driver);
if (!driver) {
- err("%s does not have a valid driver to work with!",
+ dev_err(*dev, "%s does not have a valid driver to work with!",
__FUNCTION__);
return -ENODEV;
}
@@ -126,7 +126,7 @@ int usb_device_remove(struct device *dev)
if (!try_module_get(driver->owner)) {
// FIXME this happens even when we just rmmod
// drivers that aren't in active use...
- err("Dieing driver still bound to device.\n");
+ dev_err(*dev, "Dieing driver still bound to device.\n");
return -EIO;
}
@@ -1042,7 +1042,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
wait_ms(200);
}
if (err < 0) {
- err("USB device not accepting new address=%d (error=%d)",
+ dev_err(dev->dev, "USB device not accepting new address=%d (error=%d)\n",
dev->devnum, err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1;
@@ -1060,9 +1060,9 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
if (err < 8) {
if (err < 0)
- err("USB device not responding, giving up (error=%d)", err);
+ dev_err(dev->dev, "USB device not responding, giving up (error=%d)\n", err);
else
- err("USB device descriptor short read (expected %i, got %i)", 8, err);
+ dev_err(dev->dev, "USB device descriptor short read (expected %i, got %i)\n", 8, err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1;
return 1;
@@ -1077,9 +1077,9 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
err = usb_get_device_descriptor(dev);
if (err < (signed)sizeof(dev->descriptor)) {
if (err < 0)
- err("unable to get device descriptor (error=%d)", err);
+ dev_err(dev->dev, "unable to get device descriptor (error=%d)\n", err);
else
- err("USB device descriptor short read (expected %Zi, got %i)",
+ dev_err(dev->dev, "USB device descriptor short read (expected %Zi, got %i)\n",
sizeof(dev->descriptor), err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
@@ -1089,7 +1089,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
err = usb_get_configuration(dev);
if (err < 0) {
- err("unable to get device %d configuration (error=%d)",
+ dev_err(dev->dev, "unable to get device %d configuration (error=%d)\n",
dev->devnum, err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1;
@@ -1099,7 +1099,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
/* we set the default configuration here */
err = usb_set_configuration(dev, dev->config[0].desc.bConfigurationValue);
if (err) {
- err("failed to set device %d default configuration (error=%d)",
+ dev_err(dev->dev, "failed to set device %d default configuration (error=%d)\n",
dev->devnum, err);
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1;
@@ -1151,7 +1151,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
dev->bus->bus_name, dev->devpath,
desc->bInterfaceNumber);
}
- dbg ("%s - registering %s", __FUNCTION__, interface->dev.bus_id);
+ dev_dbg (dev->dev, "%s - registering interface %s\n", __FUNCTION__, interface->dev.bus_id);
device_add (&interface->dev);
usb_create_driverfs_intf_files (interface);
}
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index 0e0362bedb13..5ab762bd73b3 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -73,9 +73,9 @@ urb_print (struct urb * urb, char * str, int small)
#endif
}
-static void ohci_dump_intr_mask (char *label, __u32 mask)
+static void ohci_dump_intr_mask (struct device *dev, char *label, __u32 mask)
{
- dbg ("%s: 0x%08x%s%s%s%s%s%s%s%s%s",
+ dev_dbg (*dev, "%s: 0x%08x%s%s%s%s%s%s%s%s%s\n",
label,
mask,
(mask & OHCI_INTR_MIE) ? " MIE" : "",
@@ -90,10 +90,10 @@ static void ohci_dump_intr_mask (char *label, __u32 mask)
);
}
-static void maybe_print_eds (char *label, __u32 value)
+static void maybe_print_eds (struct device *dev, char *label, __u32 value)
{
if (value)
- dbg ("%s %08x", label, value);
+ dev_dbg (*dev, "%s %08x\n", label, value);
}
static char *hcfs2string (int state)
@@ -111,15 +111,16 @@ static char *hcfs2string (int state)
static void ohci_dump_status (struct ohci_hcd *controller)
{
struct ohci_regs *regs = controller->regs;
+ struct device *dev = controller->hcd.controller;
__u32 temp;
temp = readl (&regs->revision) & 0xff;
- dbg ("OHCI %d.%d, %s legacy support registers",
+ dev_dbg (*dev, "OHCI %d.%d, %s legacy support registers\n",
0x03 & (temp >> 4), (temp & 0x0f),
(temp & 0x10) ? "with" : "NO");
temp = readl (&regs->control);
- dbg ("control: 0x%08x%s%s%s HCFS=%s%s%s%s%s CBSR=%d", temp,
+ dev_dbg (*dev, "control: 0x%08x%s%s%s HCFS=%s%s%s%s%s CBSR=%d\n", temp,
(temp & OHCI_CTRL_RWE) ? " RWE" : "",
(temp & OHCI_CTRL_RWC) ? " RWC" : "",
(temp & OHCI_CTRL_IR) ? " IR" : "",
@@ -132,7 +133,7 @@ static void ohci_dump_status (struct ohci_hcd *controller)
);
temp = readl (&regs->cmdstatus);
- dbg ("cmdstatus: 0x%08x SOC=%d%s%s%s%s", temp,
+ dev_dbg (*dev, "cmdstatus: 0x%08x SOC=%d%s%s%s%s\n", temp,
(temp & OHCI_SOC) >> 16,
(temp & OHCI_OCR) ? " OCR" : "",
(temp & OHCI_BLF) ? " BLF" : "",
@@ -140,20 +141,20 @@ static void ohci_dump_status (struct ohci_hcd *controller)
(temp & OHCI_HCR) ? " HCR" : ""
);
- ohci_dump_intr_mask ("intrstatus", readl (&regs->intrstatus));
- ohci_dump_intr_mask ("intrenable", readl (&regs->intrenable));
+ ohci_dump_intr_mask (dev, "intrstatus", readl (&regs->intrstatus));
+ ohci_dump_intr_mask (dev, "intrenable", readl (&regs->intrenable));
// intrdisable always same as intrenable
- // ohci_dump_intr_mask ("intrdisable", readl (&regs->intrdisable));
+ // ohci_dump_intr_mask (dev, "intrdisable", readl (&regs->intrdisable));
- maybe_print_eds ("ed_periodcurrent", readl (&regs->ed_periodcurrent));
+ maybe_print_eds (dev, "ed_periodcurrent", readl (&regs->ed_periodcurrent));
- maybe_print_eds ("ed_controlhead", readl (&regs->ed_controlhead));
- maybe_print_eds ("ed_controlcurrent", readl (&regs->ed_controlcurrent));
+ maybe_print_eds (dev, "ed_controlhead", readl (&regs->ed_controlhead));
+ maybe_print_eds (dev, "ed_controlcurrent", readl (&regs->ed_controlcurrent));
- maybe_print_eds ("ed_bulkhead", readl (&regs->ed_bulkhead));
- maybe_print_eds ("ed_bulkcurrent", readl (&regs->ed_bulkcurrent));
+ maybe_print_eds (dev, "ed_bulkhead", readl (&regs->ed_bulkhead));
+ maybe_print_eds (dev, "ed_bulkcurrent", readl (&regs->ed_bulkcurrent));
- maybe_print_eds ("donehead", readl (&regs->donehead));
+ maybe_print_eds (dev, "donehead", readl (&regs->donehead));
}
static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
@@ -166,7 +167,8 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
ndp = (temp & RH_A_NDP);
if (verbose) {
- dbg ("roothub.a: %08x POTPGT=%d%s%s%s%s%s NDP=%d", temp,
+ dev_dbg (*controller->hcd.controller,
+ "roothub.a: %08x POTPGT=%d%s%s%s%s%s NDP=%d\n", temp,
((temp & RH_A_POTPGT) >> 24) & 0xff,
(temp & RH_A_NOCP) ? " NOCP" : "",
(temp & RH_A_OCPM) ? " OCPM" : "",
@@ -176,13 +178,15 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
ndp
);
temp = roothub_b (controller);
- dbg ("roothub.b: %08x PPCM=%04x DR=%04x",
+ dev_dbg (*controller->hcd.controller,
+ "roothub.b: %08x PPCM=%04x DR=%04x\n",
temp,
(temp & RH_B_PPCM) >> 16,
(temp & RH_B_DR)
);
temp = roothub_status (controller);
- dbg ("roothub.status: %08x%s%s%s%s%s%s",
+ dev_dbg (*controller->hcd.controller,
+ "roothub.status: %08x%s%s%s%s%s%s\n",
temp,
(temp & RH_HS_CRWE) ? " CRWE" : "",
(temp & RH_HS_OCIC) ? " OCIC" : "",
@@ -201,12 +205,14 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
static void ohci_dump (struct ohci_hcd *controller, int verbose)
{
- dbg ("OHCI controller %s state", controller->hcd.self.bus_name);
+ dev_dbg (*controller->hcd.controller,
+ "OHCI controller state\n");
// dumps some of the state we know about
ohci_dump_status (controller);
if (controller->hcca)
- dbg ("hcca frame #%04x", controller->hcca->frame_no);
+ dev_dbg (*controller->hcd.controller,
+ "hcca frame #%04x\n", controller->hcca->frame_no);
ohci_dump_roothub (controller, 1);
}
@@ -312,16 +318,13 @@ ohci_dump_ed (struct ohci_hcd *ohci, char *label, struct ed *ed, int verbose)
}
}
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,32)
-# define DRIVERFS_DEBUG_FILES
-#endif
+#else
+static inline void ohci_dump (struct ohci_hcd *controller, int verbose) {}
#endif /* DEBUG */
/*-------------------------------------------------------------------------*/
-#ifdef DRIVERFS_DEBUG_FILES
-
static ssize_t
show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
{
@@ -510,7 +513,7 @@ static inline void create_debug_files (struct ohci_hcd *bus)
device_create_file (bus->hcd.controller, &dev_attr_async);
device_create_file (bus->hcd.controller, &dev_attr_periodic);
// registers
- dbg ("%s: created debug files", bus->hcd.self.bus_name);
+ dev_dbg (*bus->hcd.controller, "created debug files\n");
}
static inline void remove_debug_files (struct ohci_hcd *bus)
@@ -519,12 +522,5 @@ static inline void remove_debug_files (struct ohci_hcd *bus)
device_remove_file (bus->hcd.controller, &dev_attr_periodic);
}
-#else /* empty stubs for creating those files */
-
-static inline void create_debug_files (struct ohci_hcd *bus) { }
-static inline void remove_debug_files (struct ohci_hcd *bus) { }
-
-#endif /* DRIVERFS_DEBUG_FILES */
-
/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 17a794b3ce54..46d8beaf6b8b 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -71,6 +71,13 @@
*/
#include <linux/config.h>
+
+#ifdef CONFIG_USB_DEBUG
+# define DEBUG
+#else
+# undef DEBUG
+#endif
+
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
@@ -84,13 +91,6 @@
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h> /* for in_interrupt () */
-
-#ifdef CONFIG_USB_DEBUG
-# define DEBUG
-#else
-# undef DEBUG
-#endif
-
#include <linux/usb.h>
#include <linux/version.h>
#include "../core/hcd.h"
@@ -383,7 +383,7 @@ static int hc_reset (struct ohci_hcd *ohci)
/* SMM owns the HC? not for long! */
if (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
- dbg ("USB HC TakeOver from BIOS/SMM");
+ dev_dbg (*ohci->hcd.controller, "USB HC TakeOver from BIOS/SMM\n");
/* this timeout is arbitrary. we make it long, so systems
* depending on usb keyboards may be usable even if the
@@ -396,7 +396,7 @@ static int hc_reset (struct ohci_hcd *ohci)
while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
wait_ms (10);
if (--temp == 0) {
- err ("USB HC TakeOver failed!");
+ dev_err (*ohci->hcd.controller, "USB HC TakeOver failed!\n");
return -1;
}
}
@@ -405,7 +405,7 @@ static int hc_reset (struct ohci_hcd *ohci)
/* Disable HC interrupts */
writel (OHCI_INTR_MIE, &ohci->regs->intrdisable);
- dbg ("USB HC reset_hc %s: ctrl = 0x%x ;",
+ dev_dbg (*ohci->hcd.controller, "USB HC reset_hc %s: ctrl = 0x%x ;\n",
ohci->hcd.self.bus_name,
readl (&ohci->regs->control));
@@ -422,7 +422,7 @@ static int hc_reset (struct ohci_hcd *ohci)
temp = 30; /* ... allow extra time */
while ((readl (&ohci->regs->cmdstatus) & OHCI_HCR) != 0) {
if (--temp == 0) {
- err ("USB HC reset timed out!");
+ dev_err (*ohci->hcd.controller, "USB HC reset timed out!");
return -1;
}
udelay (1);
@@ -562,9 +562,7 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
hcd->self.bus_name);
// e.g. due to PCI Master/Target Abort
-#ifdef DEBUG
ohci_dump (ohci, 1);
-#endif
hc_reset (ohci);
}
@@ -596,14 +594,11 @@ static void ohci_stop (struct usb_hcd *hcd)
{
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
- dbg ("%s: stop %s controller%s",
- hcd->self.bus_name,
+ dev_dbg (*hcd->controller, "stop %s controller%s\n",
hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
ohci->disabled ? " (disabled)" : ""
);
-#ifdef DEBUG
ohci_dump (ohci, 1);
-#endif
if (!ohci->disabled)
hc_reset (ohci);
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 9fd76677717d..167f732be345 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -41,9 +41,10 @@ static u32 roothub_portstatus (struct ohci_hcd *hc, int i)
/*-------------------------------------------------------------------------*/
#define dbg_port(hc,label,num,value) \
- dbg ("%s: %s roothub.portstatus [%d] " \
- "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s", \
- hc->hcd.self.bus_name, label, num, temp, \
+ dev_dbg (*hc->hcd.controller, \
+ "%s roothub.portstatus [%d] " \
+ "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \
+ label, num, temp, \
(temp & RH_PS_PRSC) ? " PRSC" : "", \
(temp & RH_PS_OCIC) ? " OCIC" : "", \
(temp & RH_PS_PSSC) ? " PSSC" : "", \
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
index b5bcac0df2d1..1c965df28434 100644
--- a/drivers/usb/host/ohci-q.c
+++ b/drivers/usb/host/ohci-q.c
@@ -206,8 +206,8 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed)
default:
branch = balance (ohci, ed->interval, ed->load);
if (branch < 0) {
- dbg ("%s: ERR %d, interval %d msecs, load %d",
- ohci->hcd.self.bus_name,
+ dev_dbg (*ohci->hcd.controller,
+ "ERR %d, interval %d msecs, load %d\n",
branch, ed->interval, ed->load);
// FIXME if there are TDs queued, fail them!
return branch;
@@ -786,7 +786,8 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
}
/* help for troubleshooting: */
- dbg ("urb %p usb-%s-%s ep-%d-%s cc %d --> status %d",
+ dev_dbg (urb->dev->dev,
+ "urb %p usb-%s-%s ep-%d-%s cc %d --> status %d\n",
urb,
urb->dev->bus->bus_name, urb->dev->devpath,
usb_pipeendpoint (urb->pipe),
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index 4a0e09a4851c..af2b94ac94ac 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -18,7 +18,7 @@
#include "uhci-hcd.h"
/* Handle REALLY large printk's so we don't overflow buffers */
-static void inline lprintk(char *buf)
+static inline void lprintk(char *buf)
{
char *p;
@@ -34,7 +34,7 @@ static void inline lprintk(char *buf)
}
}
-static int inline uhci_is_skeleton_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
+static inline int uhci_is_skeleton_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
{
int i;
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 3b5768ee1812..b3a8d06d6c19 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -165,7 +165,7 @@ static struct uhci_td *uhci_alloc_td(struct uhci_hcd *uhci, struct usb_device *d
return td;
}
-static void inline uhci_fill_td(struct uhci_td *td, __u32 status,
+static inline void uhci_fill_td(struct uhci_td *td, __u32 status,
__u32 token, __u32 buffer)
{
td->status = cpu_to_le32(status);
diff --git a/drivers/usb/misc/speedtouch.c b/drivers/usb/misc/speedtouch.c
index 645591463439..601686c3b71c 100644
--- a/drivers/usb/misc/speedtouch.c
+++ b/drivers/usb/misc/speedtouch.c
@@ -1007,7 +1007,7 @@ static void udsl_usb_disconnect (struct usb_interface *intf)
*
****************************************************************************/
-int udsl_usb_init (void)
+static int udsl_usb_init (void)
{
int i;
@@ -1022,25 +1022,15 @@ int udsl_usb_init (void)
return usb_register (&udsl_usb_driver);
}
-int udsl_usb_cleanup (void)
+static void udsl_usb_cleanup (void)
{
/* killing threads */
udsl_atm_sar_stop ();
usb_deregister (&udsl_usb_driver);
- return 0;
-}
-
-#ifdef MODULE
-int init_module (void)
-{
- return udsl_usb_init ();
}
-int cleanup_module (void)
-{
- return udsl_usb_cleanup ();
-}
-#endif
+module_init(udsl_usb_init);
+module_exit(udsl_usb_cleanup);
#ifdef DEBUG_PACKET
/*******************************************************************************
diff --git a/drivers/video/sticore.h b/drivers/video/sticore.h
index 0572f4fb1d5e..7e7e1546f6e7 100644
--- a/drivers/video/sticore.h
+++ b/drivers/video/sticore.h
@@ -42,7 +42,7 @@
#define STI_PTR(p) (p)
#define PTR_STI(p) (p)
-static int inline STI_CALL( unsigned long func,
+static inline int STI_CALL( unsigned long func,
void *flags, void *inptr, void *outptr, void *glob_cfg )
{
int (*f)(void *,void *,void *,void *);
diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c
index 230f0c971e66..8cc9094311e6 100644
--- a/drivers/video/tgafb.c
+++ b/drivers/video/tgafb.c
@@ -39,6 +39,9 @@ static int tgafb_setcolreg(unsigned, unsigned, unsigned, unsigned,
unsigned, struct fb_info *);
static int tgafb_blank(int, struct fb_info *);
static void tgafb_init_fix(struct fb_info *);
+
+static void tgafb_imageblit(struct fb_info *, struct fb_image *);
+
static int tgafb_pci_register(struct pci_dev *, const struct pci_device_id *);
#ifdef MODULE
static void tgafb_pci_unregister(struct pci_dev *);
@@ -59,7 +62,7 @@ static struct fb_ops tgafb_ops = {
.fb_blank = tgafb_blank,
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
- .fb_imageblit = cfb_imageblit,
+ .fb_imageblit = tgafb_imageblit,
.fb_cursor = soft_cursor,
};
@@ -500,6 +503,256 @@ tgafb_blank(int blank, struct fb_info *info)
/*
+ * Acceleration.
+ */
+
+static void
+tgafb_imageblit(struct fb_info *info, struct fb_image *image)
+{
+ static unsigned char const bitrev[256] = {
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
+ };
+
+ struct tga_par *par = (struct tga_par *) info->par;
+ u32 fgcolor, bgcolor, dx, dy, width, height, vxres, vyres, pixelmask;
+ unsigned long rincr, line_length, shift, pos, is8bpp;
+ unsigned long i, j, k;
+ const unsigned char *data;
+ void *regs_base, *fb_base;
+
+ dx = image->dx;
+ dy = image->dy;
+ width = image->width;
+ height = image->height;
+ vxres = info->var.xres_virtual;
+ vyres = info->var.yres_virtual;
+ line_length = info->fix.line_length;
+ rincr = (width + 7) / 8;
+
+ /* Crop the image to the screen. */
+ if (dx > vxres || dy > vyres)
+ return;
+ if (dx + width > vxres)
+ width = vxres - dx;
+ if (dy + height > vyres)
+ height = vyres - dy;
+
+ /* For copies that aren't pixel expansion, there's little we
+ can do better than the generic code. */
+ /* ??? There is a DMA write mode; I wonder if that could be
+ made to pull the data from the image buffer... */
+ if (image->depth > 1) {
+ cfb_imageblit(info, image);
+ return;
+ }
+
+ regs_base = par->tga_regs_base;
+ fb_base = par->tga_fb_base;
+ is8bpp = par->tga_type == TGA_TYPE_8PLANE;
+
+ /* Expand the color values to fill 32-bits. */
+ /* ??? Would be nice to notice colour changes elsewhere, so
+ that we can do this only when necessary. */
+ fgcolor = image->fg_color;
+ bgcolor = image->bg_color;
+ if (is8bpp) {
+ fgcolor |= fgcolor << 8;
+ fgcolor |= fgcolor << 16;
+ bgcolor |= bgcolor << 8;
+ bgcolor |= bgcolor << 16;
+ } else {
+ fgcolor = ((u32 *)info->pseudo_palette)[fgcolor];
+ bgcolor = ((u32 *)info->pseudo_palette)[bgcolor];
+ }
+ __raw_writel(fgcolor, regs_base + TGA_FOREGROUND_REG);
+ __raw_writel(bgcolor, regs_base + TGA_BACKGROUND_REG);
+
+ /* Acquire proper alignment; set up the PIXELMASK register
+ so that we only write the proper character cell. */
+ pos = dy * line_length + dx;
+ if (is8bpp) {
+ shift = pos & 3;
+ pos &= -4;
+ } else {
+ shift = (pos & 7) >> 2;
+ pos &= -8;
+ }
+
+ data = (const unsigned char *) image->data;
+
+ /* Enable opaque stipple mode. */
+ __raw_writel((is8bpp
+ ? TGA_MODE_SBM_8BPP | TGA_MODE_OPAQUE_STIPPLE
+ : TGA_MODE_SBM_24BPP | TGA_MODE_OPAQUE_STIPPLE),
+ regs_base + TGA_MODE_REG);
+
+ if (width + shift <= 32) {
+ unsigned long bwidth;
+
+ /* Handle common case of imaging a single character, in
+ a font less than 32 pixels wide. */
+
+ pixelmask = (1 << width) - 1;
+ pixelmask <<= shift;
+ __raw_writel(pixelmask, regs_base + TGA_PIXELMASK_REG);
+ wmb();
+
+ bwidth = (width + 7) / 8;
+
+ for (i = 0; i < height; ++i) {
+ u32 mask = 0;
+
+ /* The image data is bit big endian; we need
+ little endian. */
+ for (j = 0; j < bwidth; ++j)
+ mask |= bitrev[data[j]] << (j * 8);
+
+ __raw_writel(mask << shift, fb_base + pos);
+
+ pos += line_length;
+ data += rincr;
+ }
+ wmb();
+ __raw_writel(0xffffffff, regs_base + TGA_PIXELMASK_REG);
+ } else if (shift == 0) {
+ unsigned long pos0 = pos;
+ const unsigned char *data0 = data;
+ unsigned long bincr = (is8bpp ? 8 : 8*4);
+ unsigned long bwidth;
+
+ /* Handle another common case in which accel_putcs
+ generates a large bitmap, which happens to be aligned.
+ Allow the tail to be misaligned. This case is
+ interesting because we've not got to hold partial
+ bytes across the words being written. */
+
+ wmb();
+
+ bwidth = (width / 8) & -4;
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < bwidth; j += 4) {
+ u32 mask = 0;
+ for (k = 0; k < 4; ++k)
+ mask |= bitrev[data[j+k]] << (k * 8);
+ __raw_writel(mask, fb_base + pos + j*bincr);
+ }
+ pos += line_length;
+ data += rincr;
+ }
+ wmb();
+
+ pixelmask = (1ul << (width & 31)) - 1;
+ if (pixelmask) {
+ __raw_writel(pixelmask, regs_base + TGA_PIXELMASK_REG);
+ wmb();
+
+ pos = pos0 + bwidth*bincr;
+ data = data0 + bwidth;
+ bwidth = ((width & 31) + 7) / 8;
+
+ for (i = 0; i < height; ++i) {
+ u32 mask = 0;
+ for (k = 0; k < bwidth; ++k)
+ mask |= bitrev[data[k]] << (k * 8);
+ __raw_writel(mask, fb_base + pos);
+ pos += line_length;
+ data += rincr;
+ }
+ wmb();
+ __raw_writel(0xffffffff, regs_base + TGA_PIXELMASK_REG);
+ }
+ } else {
+ unsigned long pos0 = pos;
+ const unsigned char *data0 = data;
+ unsigned long bincr = (is8bpp ? 8 : 8*4);
+ unsigned long bwidth;
+
+ /* Finally, handle the generic case of misaligned start.
+ Here we split the write into 16-bit spans. This allows
+ us to use only one pixel mask, instead of four as would
+ be required by writing 24-bit spans. */
+
+ pixelmask = 0xffff << shift;
+ __raw_writel(pixelmask, regs_base + TGA_PIXELMASK_REG);
+ wmb();
+
+ bwidth = (width / 8) & -2;
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < bwidth; j += 2) {
+ u32 mask;
+ mask = bitrev[data[j]];
+ mask |= bitrev[data[j+1]] << 8;
+ mask <<= shift;
+ __raw_writel(mask, fb_base + pos + j*bincr);
+ }
+ pos += line_length;
+ data += rincr;
+ }
+ wmb();
+
+ pixelmask = ((1ul << (width & 15)) - 1) << shift;
+ if (pixelmask) {
+ __raw_writel(pixelmask, regs_base + TGA_PIXELMASK_REG);
+ wmb();
+
+ pos = pos0 + bwidth*bincr;
+ data = data0 + bwidth;
+ bwidth = (width & 15) > 8;
+
+ for (i = 0; i < height; ++i) {
+ u32 mask = bitrev[data[0]];
+ if (bwidth)
+ mask |= bitrev[data[1]] << 8;
+ mask <<= shift;
+ __raw_writel(mask, fb_base + pos);
+ pos += line_length;
+ data += rincr;
+ }
+ wmb();
+ }
+ __raw_writel(0xffffffff, regs_base + TGA_PIXELMASK_REG);
+ }
+
+ /* Disable opaque stipple mode. */
+ __raw_writel((is8bpp
+ ? TGA_MODE_SBM_8BPP | TGA_MODE_SIMPLE
+ : TGA_MODE_SBM_24BPP | TGA_MODE_SIMPLE),
+ regs_base + TGA_MODE_REG);
+}
+
+
+/*
* Initialisation
*/