Commit 2020eb67 authored by Paul Mackerras's avatar Paul Mackerras

Merge samba.org:/home/paulus/kernel/linux-2.5

into samba.org:/home/paulus/kernel/for-linus-ppc
parents aeffbd1b b4274bcf
Sony Programmable I/O Control Device Driver Readme
--------------------------------------------------
Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
Copyright (C) 2001-2002 Alcôve <www.alcove.com>
Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
Copyright (C) 2001 Junichi Morita <jun1m@mars.dti.ne.jp>
......@@ -44,7 +44,7 @@ Several options can be passed to the sonypi driver, either by adding them
to /etc/modules.conf file, when the driver is compiled as a module or by
adding the following to the kernel command line (in your bootloader):
sonypi=minor[,verbose[,fnkeyinit[,camera[,compat[,mask]]]]]
sonypi=minor[,verbose[,fnkeyinit[,camera[,compat[,mask[,useinput]]]]]]
where:
......@@ -97,6 +97,11 @@ where:
SONYPI_MEYE_MASK 0x0400
SONYPI_MEMORYSTICK_MASK 0x0800
useinput: if set (which is the default) jogdial events are
forwarded to the input subsystem as mouse wheel
events.
Module use:
-----------
......
Vaio Picturebook Motion Eye Camera Driver Readme
------------------------------------------------
Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
Copyright (C) 2001-2002 Alcôve <www.alcove.com>
Copyright (C) 2000 Andrew Tridgell <tridge@samba.org>
......
......@@ -39,12 +39,12 @@ cflags-$(CONFIG_MPENTIUM4) += $(call check_gcc,-march=pentium4,-march=i686)
cflags-$(CONFIG_MK6) += $(call check_gcc,-march=k6,-march=i586)
cflags-$(CONFIG_MK7) += $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
cflags-$(CONFIG_MK8) += $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 -malign-functions=4))
cflags-$(CONFIG_MCRUSOE) += -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
cflags-$(CONFIG_MCRUSOE) += -march=i686
cflags-$(CONFIG_MCRUSOE) += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
cflags-$(CONFIG_MWINCHIPC6) += $(call check_gcc,-march=winchip-c6,-march=i586)
cflags-$(CONFIG_MWINCHIP2) += $(call check_gcc,-march=winchip2,-march=i586)
cflags-$(CONFIG_MWINCHIP3D) += -march=i586
cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-march=c3,-march=i486)
# The alignment flags change with gcc 3.2
cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
cflags-$(CONFIG_MVIAC3_2) += $(call check_gcc,-march=c3-2,-march=i686)
......
......@@ -196,21 +196,35 @@ static struct pci_ops pci_direct_conf2 = {
static int __devinit pci_sanity_check(struct pci_ops *o)
{
u32 x = 0;
struct pci_bus bus; /* Fake bus and device */
struct pci_dev dev;
int retval = 0;
struct pci_bus *bus; /* Fake bus and device */
struct pci_dev *dev;
if (pci_probe & PCI_NO_CHECKS)
return 1;
bus.number = 0;
dev.bus = &bus;
for(dev.devfn=0; dev.devfn < 0x100; dev.devfn++)
if ((!o->read(&bus, dev.devfn, PCI_CLASS_DEVICE, 2, &x) &&
bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
dev = kmalloc(sizeof(*dev), GFP_ATOMIC);
if (!bus || !dev) {
printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
goto exit;
}
bus->number = 0;
dev->bus = bus;
for(dev->devfn=0; dev->devfn < 0x100; dev->devfn++)
if ((!o->read(bus, dev->devfn, PCI_CLASS_DEVICE, 2, &x) &&
(x == PCI_CLASS_BRIDGE_HOST || x == PCI_CLASS_DISPLAY_VGA)) ||
(!o->read(&bus, dev.devfn, PCI_VENDOR_ID, 2, &x) &&
(x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ)))
return 1;
(!o->read(bus, dev->devfn, PCI_VENDOR_ID, 2, &x) &&
(x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) {
retval = 1;
goto exit;
}
DBG("PCI: Sanity check failed\n");
return 0;
exit:
kfree(dev);
kfree(bus);
return retval;
}
static int __init pci_direct_init(void)
......
......@@ -12,28 +12,39 @@
static void __devinit pcibios_fixup_peer_bridges(void)
{
int n;
struct pci_bus bus;
struct pci_dev dev;
struct pci_bus *bus;
struct pci_dev *dev;
u16 l;
if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff)
return;
DBG("PCI: Peer bridge fixup\n");
bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
dev = kmalloc(sizeof(*dev), GFP_ATOMIC);
if (!bus || !dev) {
printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
goto exit;
}
for (n=0; n <= pcibios_last_bus; n++) {
if (pci_bus_exists(&pci_root_buses, n))
continue;
bus.number = n;
bus.ops = pci_root_ops;
dev.bus = &bus;
for(dev.devfn=0; dev.devfn<256; dev.devfn += 8)
if (!pci_read_config_word(&dev, PCI_VENDOR_ID, &l) &&
bus->number = n;
bus->ops = pci_root_ops;
dev->bus = bus;
for (dev->devfn=0; dev->devfn<256; dev->devfn += 8)
if (!pci_read_config_word(dev, PCI_VENDOR_ID, &l) &&
l != 0x0000 && l != 0xffff) {
DBG("Found device at %02x:%02x [%04x]\n", n, dev.devfn, l);
DBG("Found device at %02x:%02x [%04x]\n", n, dev->devfn, l);
printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n);
pci_scan_bus(n, pci_root_ops, NULL);
break;
}
}
exit:
kfree(dev);
kfree(bus);
}
static int __init pci_legacy_init(void)
......
......@@ -613,18 +613,6 @@ static void request_events(void *send_info)
atomic_set(&kcs_info->req_events, 1);
}
static int new_user(void *send_info)
{
if (!try_module_get(THIS_MODULE))
return -EBUSY;
return 0;
}
static void user_left(void *send_info)
{
module_put(THIS_MODULE);
}
/* Call every 10 ms. */
#define KCS_TIMEOUT_TIME_USEC 10000
#define KCS_USEC_PER_JIFFY (1000000/HZ)
......@@ -718,11 +706,10 @@ static void kcs_irq_handler(int irq, void *data, struct pt_regs *regs)
static struct ipmi_smi_handlers handlers =
{
sender: sender,
request_events: request_events,
new_user: new_user,
user_left: user_left,
set_run_to_completion: set_run_to_completion
.owner = THIS_MODULE,
.sender = sender,
.request_events = request_events,
.set_run_to_completion = set_run_to_completion,
};
static unsigned char ipmi_kcs_dev_rev;
......
......@@ -485,13 +485,14 @@ int ipmi_create_user(unsigned int if_num,
new_user->intf = ipmi_interfaces[if_num];
new_user->gets_events = 0;
rv = new_user->intf->handlers->new_user(new_user->intf->send_info);
if (rv)
if (!try_module_get(new_user->intf->handlers->owner)) {
rv = -ENODEV;
goto out_unlock;
}
write_lock_irqsave(&(new_user->intf->users_lock), flags);
list_add_tail(&(new_user->link), &(new_user->intf->users));
write_unlock_irqrestore(&(new_user->intf->users_lock), flags);
write_lock_irqsave(&new_user->intf->users_lock, flags);
list_add_tail(&new_user->link, &new_user->intf->users);
write_unlock_irqrestore(&new_user->intf->users_lock, flags);
out_unlock:
if (rv) {
......@@ -563,12 +564,12 @@ int ipmi_destroy_user(ipmi_user_t user)
unsigned long flags;
down_read(&interfaces_sem);
write_lock_irqsave(&(intf->users_lock), flags);
write_lock_irqsave(&intf->users_lock, flags);
rv = ipmi_destroy_user_nolock(user);
if (!rv)
intf->handlers->user_left(intf->send_info);
module_put(intf->handlers->owner);
write_unlock_irqrestore(&(intf->users_lock), flags);
write_unlock_irqrestore(&intf->users_lock, flags);
up_read(&interfaces_sem);
return rv;
}
......
/*
* Sony Programmable I/O Control Device driver for VAIO
*
* Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
* Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
*
* Copyright (C) 2001-2002 Alcve <www.alcove.com>
*
......@@ -33,6 +33,7 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/input.h>
#include <linux/pci.h>
#include <linux/sched.h>
#include <linux/init.h>
......@@ -56,6 +57,7 @@ static int verbose; /* = 0 */
static int fnkeyinit; /* = 0 */
static int camera; /* = 0 */
static int compat; /* = 0 */
static int useinput = 1;
static unsigned long mask = 0xffffffff;
/* Inits the queue */
......@@ -335,6 +337,22 @@ void sonypi_irq(int irq, void *dev_id, struct pt_regs *regs) {
return;
found:
#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
if (useinput) {
struct input_dev *jog_dev = &sonypi_device.jog_dev;
if (event == SONYPI_EVENT_JOGDIAL_PRESSED)
input_report_key(jog_dev, BTN_MIDDLE, 1);
else if (event == SONYPI_EVENT_ANYBUTTON_RELEASED)
input_report_key(jog_dev, BTN_MIDDLE, 0);
else if ((event == SONYPI_EVENT_JOGDIAL_UP) ||
(event == SONYPI_EVENT_JOGDIAL_UP_PRESSED))
input_report_rel(jog_dev, REL_WHEEL, 1);
else if ((event == SONYPI_EVENT_JOGDIAL_DOWN) ||
(event == SONYPI_EVENT_JOGDIAL_DOWN_PRESSED))
input_report_rel(jog_dev, REL_WHEEL, -1);
input_sync(jog_dev);
}
#endif /* CONFIG_INPUT || CONFIG_INPUT_MODULE */
sonypi_pushq(event);
}
......@@ -579,7 +597,7 @@ struct miscdevice sonypi_misc_device = {
-1, "sonypi", &sonypi_misc_fops
};
#if CONFIG_PM
#ifdef CONFIG_PM
static int sonypi_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data) {
static int old_camera_power;
......@@ -594,14 +612,14 @@ static int sonypi_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
sonypi_type2_dis();
else
sonypi_type1_dis();
#if !defined(CONFIG_ACPI)
#ifndef CONFIG_ACPI
/* disable ACPI mode */
if (fnkeyinit)
outb(0xf1, 0xb2);
#endif
break;
case PM_RESUME:
#if !defined(CONFIG_ACPI)
#ifndef CONFIG_ACPI
/* Enable ACPI mode to get Fn key events */
if (fnkeyinit)
outb(0xf0, 0xb2);
......@@ -692,7 +710,7 @@ static int __devinit sonypi_probe(struct pci_dev *pcidev) {
goto out3;
}
#if !defined(CONFIG_ACPI)
#ifndef CONFIG_ACPI
/* Enable ACPI mode to get Fn key events */
if (fnkeyinit)
outb(0xf0, 0xb2);
......@@ -715,14 +733,15 @@ static int __devinit sonypi_probe(struct pci_dev *pcidev) {
SONYPI_DRIVER_MINORVERSION);
printk(KERN_INFO "sonypi: detected %s model, "
"verbose = %d, fnkeyinit = %s, camera = %s, "
"compat = %s, mask = 0x%08lx\n",
"compat = %s, mask = 0x%08lx, useinput = %s\n",
(sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE1) ?
"type1" : "type2",
verbose,
fnkeyinit ? "on" : "off",
camera ? "on" : "off",
compat ? "on" : "off",
mask);
mask,
useinput ? "on" : "off");
printk(KERN_INFO "sonypi: enabled at irq=%d, port1=0x%x, port2=0x%x\n",
sonypi_device.irq,
sonypi_device.ioport1, sonypi_device.ioport2);
......@@ -730,7 +749,24 @@ static int __devinit sonypi_probe(struct pci_dev *pcidev) {
printk(KERN_INFO "sonypi: device allocated minor is %d\n",
sonypi_misc_device.minor);
#if CONFIG_PM
#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
if (useinput) {
/* Initialize the Input Drivers: */
sonypi_device.jog_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
sonypi_device.jog_dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_MIDDLE);
sonypi_device.jog_dev.relbit[0] = BIT(REL_WHEEL);
sonypi_device.jog_dev.name = (char *) kmalloc(
sizeof(SONYPI_INPUTNAME), GFP_KERNEL);
sprintf(sonypi_device.jog_dev.name, SONYPI_INPUTNAME);
sonypi_device.jog_dev.id.bustype = BUS_ISA;
sonypi_device.jog_dev.id.vendor = PCI_VENDOR_ID_SONY;
input_register_device(&sonypi_device.jog_dev);
printk(KERN_INFO "%s installed.\n", sonypi_device.jog_dev.name);
}
#endif /* CONFIG_INPUT || CONFIG_INPUT_MODULE */
#ifdef CONFIG_PM
sonypi_device.pm = pm_register(PM_PCI_DEV, 0, sonypi_pm_callback);
#endif
......@@ -746,18 +782,26 @@ static int __devinit sonypi_probe(struct pci_dev *pcidev) {
static void __devexit sonypi_remove(void) {
#if CONFIG_PM
#ifdef CONFIG_PM
pm_unregister(sonypi_device.pm);
#endif
sonypi_call2(0x81, 0); /* make sure we don't get any more events */
#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
if (useinput) {
input_unregister_device(&sonypi_device.jog_dev);
kfree(sonypi_device.jog_dev.name);
}
#endif /* CONFIG_INPUT || CONFIG_INPUT_MODULE */
if (camera)
sonypi_camera_off();
if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2)
sonypi_type2_dis();
else
sonypi_type1_dis();
#if !defined(CONFIG_ACPI)
#ifndef CONFIG_ACPI
/* disable ACPI mode */
if (fnkeyinit)
outb(0xf1, 0xb2);
......@@ -787,7 +831,7 @@ static void __exit sonypi_cleanup_module(void) {
#ifndef MODULE
static int __init sonypi_setup(char *str) {
int ints[7];
int ints[8];
str = get_options(str, ARRAY_SIZE(ints), ints);
if (ints[0] <= 0)
......@@ -808,6 +852,9 @@ static int __init sonypi_setup(char *str) {
if (ints[0] == 5)
goto out;
mask = ints[6];
if (ints[0] == 6)
goto out;
useinput = ints[7];
out:
return 1;
}
......@@ -836,5 +883,7 @@ MODULE_PARM(compat,"i");
MODULE_PARM_DESC(compat, "set this if you want to enable backward compatibility mode");
MODULE_PARM(mask, "i");
MODULE_PARM_DESC(mask, "set this to the mask of event you want to enable (see doc)");
MODULE_PARM(useinput, "i");
MODULE_PARM_DESC(useinput, "if you have a jogdial, set this if you would like it to use the modern Linux Input Driver system");
EXPORT_SYMBOL(sonypi_camera_command);
/*
* Sony Programmable I/O Control Device driver for VAIO
*
* Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
* Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
*
* Copyright (C) 2001-2002 Alcve <www.alcove.com>
*
......@@ -37,7 +37,7 @@
#ifdef __KERNEL__
#define SONYPI_DRIVER_MAJORVERSION 1
#define SONYPI_DRIVER_MINORVERSION 17
#define SONYPI_DRIVER_MINORVERSION 18
#define SONYPI_DEVICE_MODEL_TYPE1 1
#define SONYPI_DEVICE_MODEL_TYPE2 2
......@@ -45,6 +45,7 @@
#include <linux/config.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/input.h>
#include <linux/pm.h>
#include <linux/acpi.h>
#include "linux/sonypi.h"
......@@ -334,6 +335,9 @@ struct sonypi_queue {
unsigned char buf[SONYPI_BUF_SIZE];
};
/* The name of the Jog Dial for the input device drivers */
#define SONYPI_INPUTNAME "Sony VAIO Jog Dial"
struct sonypi_device {
struct pci_dev *dev;
u16 irq;
......@@ -347,7 +351,10 @@ struct sonypi_device {
struct sonypi_queue queue;
int open_count;
int model;
#if CONFIG_PM
#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
struct input_dev jog_dev;
#endif
#ifdef CONFIG_PM
struct pm_dev *pm;
#endif
};
......@@ -363,7 +370,7 @@ struct sonypi_device {
printk(KERN_WARNING "sonypi command failed at %s : %s (line %d)\n", __FILE__, __FUNCTION__, __LINE__); \
}
#if !defined(CONFIG_ACPI)
#ifndef CONFIG_ACPI
extern int verbose;
static inline int ec_write(u8 addr, u8 value) {
......
......@@ -153,7 +153,7 @@ static void go_sync(struct super_block *sb, int remount_flag)
if (remount_flag) { /* Remount R/O */
int ret, flags;
struct list_head *p;
struct file *file;
if (sb->s_flags & MS_RDONLY) {
printk("R/O\n");
......@@ -161,8 +161,7 @@ static void go_sync(struct super_block *sb, int remount_flag)
}
file_list_lock();
for (p = sb->s_files.next; p != &sb->s_files; p = p->next) {
struct file *file = list_entry(p, struct file, f_list);
list_for_each_entry(file, &sb->s_files, f_list) {
if (file->f_dentry && file_count(file)
&& S_ISREG(file->f_dentry->d_inode->i_mode))
file->f_mode &= ~2;
......@@ -205,15 +204,11 @@ void do_emergency_sync(void) {
remount_flag = (emergency_sync_scheduled == EMERG_REMOUNT);
emergency_sync_scheduled = 0;
for (sb = sb_entry(super_blocks.next);
sb != sb_entry(&super_blocks);
sb = sb_entry(sb->s_list.next))
list_for_each_entry(sb, &super_blocks, s_list)
if (sb->s_bdev && is_local_disk(sb->s_bdev))
go_sync(sb, remount_flag);
for (sb = sb_entry(super_blocks.next);
sb != sb_entry(&super_blocks);
sb = sb_entry(sb->s_list.next))
list_for_each_entry(sb, &super_blocks, s_list)
if (sb->s_bdev && !is_local_disk(sb->s_bdev))
go_sync(sb, remount_flag);
......
......@@ -239,14 +239,13 @@ config BLK_DEV_CMD640_ENHANCED
and your BIOS does not already do this for you, then say Y here.
Otherwise say N.
config BLK_DEV_ISAPNP
bool "ISA-PNP EIDE support"
depends on BLK_DEV_IDE && ISAPNP
config BLK_DEV_IDEPNP
bool "PNP EIDE support"
depends on BLK_DEV_IDE && PNP
help
If you have an ISA EIDE card that is PnP (Plug and Play) and
requires setup first before scanning for devices, say Y here.
If unsure, say N.
If you have a PnP (Plug and Play) compatible EIDE card and
would like the kernel to automatically detect and activate
it, say Y here.
config BLK_DEV_IDEPCI
bool "PCI IDE chipset support" if PCI
......
......@@ -21,7 +21,7 @@ obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o
obj-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
obj-$(CONFIG_BLK_DEV_IDEDMA_PCI) += ide-dma.o
obj-$(CONFIG_BLK_DEV_IDE_TCQ) += ide-tcq.o
obj-$(CONFIG_BLK_DEV_ISAPNP) += ide-pnp.o
obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
ifeq ($(CONFIG_BLK_DEV_IDE),y)
obj-$(CONFIG_PROC_FS) += ide-proc.o
......
......@@ -19,9 +19,7 @@
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/isapnp.h>
#define DEV_NAME(dev) (dev->name)
#include <linux/pnp.h>
#define GENERIC_HD_DATA 0
#define GENERIC_HD_ERROR 1
......@@ -32,31 +30,27 @@
#define GENERIC_HD_SELECT 6
#define GENERIC_HD_STATUS 7
static int generic_ide_offsets[IDE_NR_PORTS] __initdata = {
static int generic_ide_offsets[IDE_NR_PORTS] = {
GENERIC_HD_DATA, GENERIC_HD_ERROR, GENERIC_HD_NSECTOR,
GENERIC_HD_SECTOR, GENERIC_HD_LCYL, GENERIC_HD_HCYL,
GENERIC_HD_SELECT, GENERIC_HD_STATUS, -1, -1
};
/* ISA PnP device table entry */
struct pnp_dev_t {
unsigned short card_vendor, card_device, vendor, device;
int (*init_fn)(struct pnp_dev *dev, int enable);
/* Add your devices here :)) */
struct pnp_device_id idepnp_devices[] = {
/* Generic ESDI/IDE/ATA compatible hard disk controller */
{.id = "PNP0600", .driver_data = 0},
{.id = ""}
};
/* Generic initialisation function for ISA PnP IDE interface */
static int __init pnpide_generic_init(struct pnp_dev *dev, int enable)
static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
{
hw_regs_t hw;
ide_hwif_t *hwif;
int index;
if (!enable)
return 0;
if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0)))
return 1;
return -1;
ide_setup_ports(&hw, (unsigned long) pnp_port_start(dev, 0),
generic_ide_offsets,
......@@ -68,82 +62,36 @@ static int __init pnpide_generic_init(struct pnp_dev *dev, int enable)
index = ide_register_hw(&hw, &hwif);
if (index != -1) {
printk(KERN_INFO "ide%d: %s IDE interface\n", index, DEV_NAME(dev));
printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
pnp_set_drvdata(dev,hwif);
hwif->pnp_dev = dev;
return 0;
}
return 1;
return -1;
}
/* Add your devices here :)) */
struct pnp_dev_t idepnp_devices[] __initdata = {
/* Generic ESDI/IDE/ATA compatible hard disk controller */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID,
ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0x0600),
pnpide_generic_init },
{ 0 }
};
static void idepnp_remove(struct pnp_dev * dev)
{
ide_hwif_t *hwif = pnp_get_drvdata(dev);
if (hwif) {
ide_unregister(hwif->index);
} else
printk(KERN_ERR "idepnp: Unable to remove device, please report.\n");
}
#define NR_PNP_DEVICES 8
struct pnp_dev_inst {
struct pnp_dev *dev;
struct pnp_dev_t *dev_type;
static struct pnp_driver idepnp_driver = {
.name = "ide",
.id_table = idepnp_devices,
.probe = idepnp_probe,
.remove = idepnp_remove,
};
static struct pnp_dev_inst devices[NR_PNP_DEVICES];
static int pnp_ide_dev_idx = 0;
/*
* Probe for ISA PnP IDE interfaces.
*/
void __init pnpide_init(int enable)
void pnpide_init(int enable)
{
struct pnp_dev *dev = NULL;
struct pnp_dev_t *dev_type;
if (!isapnp_present())
return;
/* Module unload, deactivate all registered devices. */
if (!enable) {
int i;
for (i = 0; i < pnp_ide_dev_idx; i++) {
dev = devices[i].dev;
devices[i].dev_type->init_fn(dev, 0);
pnp_device_detach(dev);
}
return;
}
for (dev_type = idepnp_devices; dev_type->vendor; dev_type++) {
while ((dev = pnp_find_dev(NULL, dev_type->vendor,
dev_type->device, dev))) {
if (pnp_device_attach(dev) < 0)
continue;
if (pnp_activate_dev(dev, NULL) < 0) {
printk(KERN_ERR"ide: %s activate failed\n", DEV_NAME(dev));
continue;
}
/* Call device initialization function */
if (dev_type->init_fn(dev, 1)) {
pnp_device_detach(dev);
} else {
#ifdef MODULE
/*
* Register device in the array to
* deactivate it on a module unload.
*/
if (pnp_ide_dev_idx >= NR_PNP_DEVICES)
return;
devices[pnp_ide_dev_idx].dev = dev;
devices[pnp_ide_dev_idx].dev_type = dev_type;
pnp_ide_dev_idx++;
#endif
}
}
}
if(enable)
pnp_register_driver(&idepnp_driver);
else
pnp_unregister_driver(&idepnp_driver);
}
......@@ -818,6 +818,7 @@ void ide_unregister (unsigned int index)
EXPORT_SYMBOL(ide_unregister);
/**
* ide_setup_ports - set up IDE interface ports
* @hw: register descriptions
......@@ -2145,12 +2146,12 @@ static void __init probe_for_hwifs (void)
buddha_init();
}
#endif /* CONFIG_BLK_DEV_BUDDHA */
#if defined(CONFIG_BLK_DEV_ISAPNP) && defined(CONFIG_ISAPNP)
#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP)
{
extern void pnpide_init(int enable);
pnpide_init(1);
}
#endif /* CONFIG_BLK_DEV_ISAPNP */
#endif /* CONFIG_BLK_DEV_IDEPNP */
}
void __init ide_init_builtin_drivers (void)
......@@ -2321,9 +2322,9 @@ int ide_unregister_subdriver (ide_drive_t *drive)
spin_unlock_irqrestore(&ide_lock, flags);
return 1;
}
#if defined(CONFIG_BLK_DEV_ISAPNP) && defined(CONFIG_ISAPNP) && defined(MODULE)
#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP) && defined(MODULE)
pnpide_init(0);
#endif /* CONFIG_BLK_DEV_ISAPNP */
#endif /* CONFIG_BLK_DEV_IDEPNP */
#ifdef CONFIG_PROC_FS
ide_remove_proc_entries(drive->proc, DRIVER(drive)->proc);
ide_remove_proc_entries(drive->proc, generic_subdriver_entries);
......
......@@ -11,6 +11,7 @@
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/init.h>
......@@ -69,8 +70,10 @@ int hpsb_ref_host(struct hpsb_host *host)
spin_lock_irqsave(&hosts_lock, flags);
list_for_each(lh, &hosts) {
if (host == list_entry(lh, struct hpsb_host, host_list)) {
if (host->driver->devctl(host, MODIFY_USAGE, 1)) {
host->driver->devctl(host, MODIFY_USAGE, 1);
if (try_module_get(host->driver->owner)) {
/* we're doing this twice and don't seem
to undo it.. --hch */
(void)try_module_get(host->driver->owner);
host->refcount++;
retval = 1;
}
......@@ -95,7 +98,7 @@ void hpsb_unref_host(struct hpsb_host *host)
{
unsigned long flags;
host->driver->devctl(host, MODIFY_USAGE, 0);
module_put(host->driver->owner);
spin_lock_irqsave(&hosts_lock, flags);
host->refcount--;
......
......@@ -92,12 +92,6 @@ enum devctl_cmd {
* Return void. */
CANCEL_REQUESTS,
/* Decrease host usage count if arg == 0, increase otherwise. Return
* 1 for success, 0 for failure. Increase usage may fail if the driver
* is in the process of shutting itself down. Decrease usage can not
* fail. */
MODIFY_USAGE,
/* Start or stop receiving isochronous channel in arg. Return void.
* This acts as an optimization hint, hosts are not required not to
* listen on unrequested channels. */
......@@ -147,6 +141,7 @@ enum reset_types {
};
struct hpsb_host_driver {
struct module *owner;
const char *name;
/* This function must store a pointer to the configuration ROM into the
......
......@@ -966,16 +966,6 @@ static int ohci_devctl(struct hpsb_host *host, enum devctl_cmd cmd, int arg)
dma_trm_reset(&ohci->at_resp_context);
break;
case MODIFY_USAGE:
if (arg) {
if (try_module_get(THIS_MODULE))
retval = 1;
} else {
module_put(THIS_MODULE);
retval = 1;
}
break;
case ISO_LISTEN_CHANNEL:
{
u64 mask;
......@@ -3202,6 +3192,7 @@ static quadlet_t ohci_hw_csr_reg(struct hpsb_host *host, int reg,
}
static struct hpsb_host_driver ohci1394_driver = {
.owner = THIS_MODULE,
.name = OHCI1394_DRIVER_NAME,
.get_rom = ohci_get_rom,
.transmit_packet = ohci_transmit,
......
......@@ -801,17 +801,6 @@ static int lynx_devctl(struct hpsb_host *host, enum devctl_cmd cmd, int arg)
break;
case MODIFY_USAGE:
if (arg) {
if (try_module_get(THIS_MODULE))
retval = 1;
} else {
module_put(THIS_MODULE);
retval = 1;
}
break;
case ISO_LISTEN_CHANNEL:
spin_lock_irqsave(&lynx->iso_rcv.lock, flags);
......@@ -1904,6 +1893,7 @@ static struct pci_driver lynx_pci_driver = {
};
static struct hpsb_host_driver lynx_driver = {
.owner = THIS_MODULE,
.name = PCILYNX_DRIVER_NAME,
.get_rom = get_lynx_rom,
.transmit_packet = lynx_transmit,
......
/* radio-cadet.c - A video4linux driver for the ADS Cadet AM/FM Radio Card
/* radio-cadet.c - A video4linux driver for the ADS Cadet AM/FM Radio Card
*
* by Fred Gleason <fredg@wava.com>
* Version 0.3.3
......@@ -20,6 +20,9 @@
* Removed dead CONFIG_RADIO_CADET_PORT code
* PnP detection on load is now default (no args necessary)
*
* 2002-01-17 Adam Belay <ambx1@neo.rr.com>
* Updated to latest pnp code
*
*/
#include <linux/module.h> /* Modules */
......@@ -30,7 +33,7 @@
#include <asm/uaccess.h> /* copy to/from user */
#include <linux/videodev.h> /* kernel radio structs */
#include <linux/param.h>
#include <linux/isapnp.h>
#include <linux/pnp.h>
#define RDS_BUFFER 256
......@@ -47,8 +50,6 @@ static unsigned char rdsbuf[RDS_BUFFER];
static int cadet_lock=0;
static int cadet_probe(void);
static struct pnp_dev *dev = NULL;
static int isapnp_cadet_probe(void);
/*
* Signal Strength Threshold Values
......@@ -152,7 +153,7 @@ static unsigned cadet_gettune(void)
*/
outb(curvol,io+1);
cadet_lock--;
return fifo;
}
......@@ -541,22 +542,23 @@ static struct video_device cadet_radio=
.fops = &cadet_fops,
};
static int isapnp_cadet_probe(void)
{
dev = pnp_find_dev (NULL, ISAPNP_VENDOR('M','S','M'),
ISAPNP_FUNCTION(0x0c24), NULL);
static struct pnp_device_id cadet_pnp_devices[] = {
/* ADS Cadet AM/FM Radio Card */
{.id = "MSM0c24", .driver_data = 0},
{.id = ""}
};
MODULE_DEVICE_TABLE(pnp, id_table);
static int cadet_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
{
if (!dev)
return -ENODEV;
if (pnp_device_attach(dev) < 0)
return -EAGAIN;
if (pnp_activate_dev(dev, NULL) < 0) {
printk ("radio-cadet: pnp configure failed (out of resources?)\n");
pnp_device_detach(dev);
return -EIO;
}
/* only support one device */
if (io > 0)
return -EBUSY;
if (!pnp_port_valid(dev, 0)) {
pnp_device_detach(dev);
return -ENODEV;
}
......@@ -567,6 +569,13 @@ static int isapnp_cadet_probe(void)
return io;
}
static struct pnp_driver cadet_pnp_driver = {
.name = "radio-cadet",
.id_table = cadet_pnp_devices,
.probe = cadet_pnp_probe,
.remove = NULL,
};
static int cadet_probe(void)
{
static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e};
......@@ -597,7 +606,7 @@ static int __init cadet_init(void)
* If a probe was requested then probe ISAPnP first (safest)
*/
if (io < 0)
io = isapnp_cadet_probe();
pnp_register_driver(&cadet_pnp_driver);
/*
* If that fails then probe unsafely if probe is requested
*/
......@@ -612,16 +621,19 @@ static int __init cadet_init(void)
#ifdef MODULE
printk(KERN_ERR "You must set an I/O address with io=0x???\n");
#endif
return -EINVAL;
goto fail;
}
if (!request_region(io,2,"cadet"))
return -EBUSY;
goto fail;
if(video_register_device(&cadet_radio,VFL_TYPE_RADIO,radio_nr)==-1) {
release_region(io,2);
return -EINVAL;
goto fail;
}
printk(KERN_INFO "ADS Cadet Radio Card at 0x%x\n",io);
return 0;
fail:
pnp_unregister_driver(&cadet_pnp_driver);
return -1;
}
......@@ -634,21 +646,11 @@ MODULE_PARM(io, "i");
MODULE_PARM_DESC(io, "I/O address of Cadet card (0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e)");
MODULE_PARM(radio_nr, "i");
static struct isapnp_device_id id_table[] __devinitdata = {
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID,
ISAPNP_VENDOR('M','S','M'), ISAPNP_FUNCTION(0x0c24), 0 },
{0}
};
MODULE_DEVICE_TABLE(isapnp, id_table);
static void __exit cadet_cleanup_module(void)
{
video_unregister_device(&cadet_radio);
release_region(io,2);
if (dev)
pnp_device_detach(dev);
pnp_unregister_driver(&cadet_pnp_driver);
}
module_init(cadet_init);
......
/*
* Motion Eye video4linux driver for Sony Vaio PictureBook
*
* Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
* Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
*
* Copyright (C) 2001-2002 Alcve <www.alcove.com>
*
......@@ -1225,6 +1225,42 @@ static struct video_device meye_template = {
.fops = &meye_fops,
};
#ifdef CONFIG_PM
static int meye_suspend(struct pci_dev *pdev, u32 state)
{
pci_save_state(pdev, meye.pm_state);
meye.pm_mchip_mode = meye.mchip_mode;
mchip_hic_stop();
mchip_set(MCHIP_MM_INTA, 0x0);
return 0;
}
static int meye_resume(struct pci_dev *pdev)
{
pci_restore_state(pdev, meye.pm_state);
pci_write_config_word(meye.mchip_dev, MCHIP_PCI_SOFTRESET_SET, 1);
mchip_delay(MCHIP_HIC_CMD, 0);
mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE);
wait_ms(1);
mchip_set(MCHIP_VRJ_SOFT_RESET, 1);
wait_ms(1);
mchip_set(MCHIP_MM_PCI_MODE, 5);
wait_ms(1);
mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK);
switch (meye.pm_mchip_mode) {
case MCHIP_HIC_MODE_CONT_OUT:
mchip_continuous_start();
break;
case MCHIP_HIC_MODE_CONT_COMP:
mchip_cont_compression_start();
break;
}
return 0;
}
#endif
static int __devinit meye_probe(struct pci_dev *pcidev,
const struct pci_device_id *ent) {
int ret;
......@@ -1391,6 +1427,10 @@ static struct pci_driver meye_driver = {
.id_table = meye_pci_tbl,
.probe = meye_probe,
.remove = __devexit_p(meye_remove),
#ifdef CONFIG_PM
.suspend = meye_suspend,
.resume = meye_resume,
#endif
};
static int __init meye_init_module(void) {
......
/*
* Motion Eye video4linux driver for Sony Vaio PictureBook
*
* Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
* Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
*
* Copyright (C) 2001-2002 Alcve <www.alcove.com>
*
......@@ -31,7 +31,13 @@
#define _MEYE_PRIV_H_
#define MEYE_DRIVER_MAJORVERSION 1
#define MEYE_DRIVER_MINORVERSION 5
#define MEYE_DRIVER_MINORVERSION 6
#include <linux/config.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/sonypi.h>
#include <linux/meye.h>
/****************************************************************************/
/* Motion JPEG chip registers */
......@@ -309,6 +315,10 @@ struct meye {
struct video_device video_dev; /* video device parameters */
struct video_picture picture; /* video picture parameters */
struct meye_params params; /* additional parameters */
#ifdef CONFIG_PM
u32 pm_state[16]; /* PCI configuration space */
u8 pm_mchip_mode; /* old mchip mode */
#endif
};
#endif
......@@ -91,6 +91,7 @@
MODULE_AUTHOR(MODULEAUTHOR);
MODULE_DESCRIPTION(my_NAME);
MODULE_LICENSE("GPL");
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
int __init isense_init(void)
......
......@@ -270,6 +270,13 @@ static __inline__ int __get_order(unsigned long size)
#define mptscsih_sync_irq(_irq) synchronize_irq()
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,58)
#define mpt_inc_use_count()
#define mpt_dec_use_count()
#else
#define mpt_inc_use_count() MOD_INC_USE_COUNT
#define mpt_dec_use_count() MOD_DEC_USE_COUNT
#endif
/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
......@@ -184,7 +184,7 @@ typedef struct _MSG_SCSI_IO_RAID_PT_REPLY
/****************************************************************************/
/* Mailbox request structure */
/* Mailbox reqeust structure */
/****************************************************************************/
typedef struct _MSG_MAILBOX_REQUEST
......
......@@ -49,7 +49,7 @@
* (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com)
*
* $Id: mptbase.c,v 1.125 2002/12/03 21:26:32 pdelaney Exp $
* $Id: mptbase.c,v 1.126 2002/12/16 15:28:45 pdelaney Exp $
*/
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
......@@ -123,8 +123,10 @@ MODULE_LICENSE("GPL");
/*
* cmd line parameters
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,59)
MODULE_PARM(PortIo, "0-1i");
MODULE_PARM_DESC(PortIo, "[0]=Use mmap, 1=Use port io");
#endif
static int PortIo = 0;
#ifdef MFCNT
......@@ -580,8 +582,6 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
dcprintk((MYIOC_s_INFO_FMT "config_complete (mf=%p,mr=%p)\n",
ioc->name, mf, reply));
DBG_DUMP_REPLY_FRAME(reply)
pCfg = * ((CONFIGPARMS **)((u8 *) mf + ioc->req_sz - sizeof(void *)));
if (pCfg) {
......@@ -686,7 +686,7 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
MptEvHandlers[i] = NULL;
last_drv_idx = i;
if (cbfunc != mpt_base_reply) {
MOD_INC_USE_COUNT;
mpt_inc_use_count();
}
break;
}
......@@ -706,7 +706,7 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
void
mpt_deregister(int cb_idx)
{
if (cb_idx && (cb_idx < MPT_MAX_PROTOCOL_DRIVERS)) {
if ((cb_idx >= 0) && (cb_idx < MPT_MAX_PROTOCOL_DRIVERS)) {
MptCallbacks[cb_idx] = NULL;
MptDriverClass[cb_idx] = MPTUNKNOWN_DRIVER;
MptEvHandlers[cb_idx] = NULL;
......@@ -716,7 +716,7 @@ mpt_deregister(int cb_idx)
isense_idx++;
if (cb_idx != mpt_base_index) {
MOD_DEC_USE_COUNT;
mpt_dec_use_count();
}
}
}
......@@ -2107,9 +2107,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
* Loop here waiting for IOC to come READY.
*/
ii = 0;
cntdn = HZ * 15;
if (sleepFlag != CAN_SLEEP)
cntdn *= 10; /* 1500 iterations @ 1msec per */
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 15; /* 15 seconds */
while ((ioc_state = mpt_GetIocState(ioc, 1)) != MPI_IOC_STATE_READY) {
if (ioc_state == MPI_IOC_STATE_OPERATIONAL) {
......@@ -2483,9 +2481,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
* LoopInit and TargetDiscovery!
*/
count = 0;
cntdn = HZ * 60; /* chg'd from 30 to 60 seconds */
if (sleepFlag != CAN_SLEEP)
cntdn *= 10; /* scale for 1msec delays */
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 60; /* 60 seconds */
state = mpt_GetIocState(ioc, 1);
while (state != MPI_IOC_STATE_OPERATIONAL && --cntdn) {
if (sleepFlag == CAN_SLEEP) {
......@@ -3478,10 +3474,8 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag)
/* FW ACK'd request, wait for READY state
*/
cntdn = HZ * 15;
count = 0;
if (sleepFlag != CAN_SLEEP)
cntdn *= 10; /* 1500 iterations @ 1msec per */
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 15; /* 15 seconds */
while ((state = mpt_GetIocState(ioc, 1)) != MPI_IOC_STATE_READY) {
cntdn--;
......@@ -3640,9 +3634,6 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
}
spin_unlock_irqrestore(&ioc->FreeQlock, flags);
#ifdef MFCNT
ioc->mfcnt = 0;
#endif
if (ioc->sense_buf_pool == NULL) {
sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC);
......@@ -3822,10 +3813,12 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
static int
WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
{
int cntdn = HZ * howlong;
int cntdn;
int count = 0;
u32 intstat;
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * howlong;
if (sleepFlag == CAN_SLEEP) {
while (--cntdn) {
intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
......@@ -3836,7 +3829,6 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
count++;
}
} else {
cntdn *= 10; /* convert to msec */
while (--cntdn) {
intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
if (! (intstat & MPI_HIS_IOP_DOORBELL_STATUS))
......@@ -3844,7 +3836,6 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
mdelay (1);
count++;
}
count /= 10;
}
if (cntdn) {
......@@ -3873,10 +3864,11 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
static int
WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
{
int cntdn = HZ * howlong;
int cntdn;
int count = 0;
u32 intstat;
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * howlong;
if (sleepFlag == CAN_SLEEP) {
while (--cntdn) {
intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
......@@ -3887,7 +3879,6 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
count++;
}
} else {
cntdn *= 10; /* convert to msec */
while (--cntdn) {
intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
if (intstat & MPI_HIS_DOORBELL_INTERRUPT)
......@@ -3895,7 +3886,6 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
mdelay(1);
count++;
}
count /= 10;
}
if (cntdn) {
......@@ -4953,7 +4943,6 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
/* Search the configQ for internal commands.
* Flush the Q, and wake up all suspended threads.
*/
#if 1
spin_lock_irqsave(&ioc->FreeQlock, flags);
if (! Q_IS_EMPTY(&ioc->configQ)){
pCfg = (CONFIGPARMS *)ioc->configQ.head;
......@@ -4970,23 +4959,6 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
} while (pCfg != (CONFIGPARMS *)&ioc->configQ);
}
spin_unlock_irqrestore(&ioc->FreeQlock, flags);
#else
while (1) {
spin_lock_irqsave(&ioc->FreeQlock, flags);
if (! Q_IS_EMPTY(&ioc->configQ)){
spin_unlock_irqrestore(&ioc->FreeQlock, flags);
break;
}
pCfg = (CONFIGPARMS *)ioc->configQ.head;
Q_DEL_ITEM(&pCfg->linkage);
spin_unlock_irqrestore(&ioc->FreeQlock, flags);
pCfg->status = MPT_CONFIG_ERROR;
pCfg->wait_done = 1;
wake_up(&mpt_waitq);
}
#endif
}
return 1; /* currently means nothing really */
......@@ -5845,7 +5817,7 @@ mpt_register_ascqops_strings(void *ascqTable, int ascqtbl_sz, const char **opsTa
isense_idx = last_drv_idx;
r = 1;
}
MOD_INC_USE_COUNT;
mpt_inc_use_count();
return r;
}
......@@ -5864,7 +5836,7 @@ mpt_deregister_ascqops_strings(void)
mpt_ScsiOpcodesPtr = NULL;
printk(KERN_INFO MYNAM ": English readable SCSI-3 strings disabled)-:\n");
isense_idx = -1;
MOD_DEC_USE_COUNT;
mpt_dec_use_count();
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
......@@ -13,7 +13,7 @@
* (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com)
*
* $Id: mptbase.h,v 1.141 2002/12/03 21:26:32 pdelaney Exp $
* $Id: mptbase.h,v 1.144 2003/01/28 21:31:56 pdelaney Exp $
*/
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
......@@ -80,8 +80,8 @@
#define COPYRIGHT "Copyright (c) 1999-2002 " MODULEAUTHOR
#endif
#define MPT_LINUX_VERSION_COMMON "2.03.01.01"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-2.03.01.01"
#define MPT_LINUX_VERSION_COMMON "2.05.00.03"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-2.05.00.03"
#define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \
......@@ -383,12 +383,9 @@ typedef struct _VirtDevice {
u8 maxWidth; /* 0 if narrow, 1 if wide*/
u8 negoFlags; /* bit field, 0 if WDTR/SDTR/QAS allowed */
u8 raidVolume; /* set, if RAID Volume */
#ifdef ABORT_FIX
u8 numAborts;
#else
u8 rsvd;
#endif
u16 rsvd1raid;
u8 type; /* byte 0 of Inquiry data */
u8 cflags; /* controller flags */
u8 rsvd1raid;
int npaths;
u16 fc_phys_lun;
u16 fc_xlat_lun;
......@@ -400,11 +397,8 @@ typedef struct _VirtDevice {
ScsiCmndTracker WaitQ;
ScsiCmndTracker SentQ;
ScsiCmndTracker DoneQ;
u32 num_luns;
//--- LUN split here?
#ifdef MPT_SAVE_AUTOSENSE
u8 sense[SCSI_STD_SENSE_BYTES]; /* 18 */
u8 rsvd2[2]; /* alignment */
#endif
u32 luns; /* Max LUNs is 32 */
u8 inq_data[SCSI_STD_INQUIRY_BYTES]; /* 36 */
u8 pad0[4];
......@@ -428,13 +422,15 @@ typedef struct _VirtDevice {
* Fibre Channel (SCSI) target device and associated defines...
*/
#define MPT_TARGET_DEFAULT_DV_STATUS 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,55)
#define MPT_TARGET_FLAGS_CONFIGURED 0x02
#define MPT_TARGET_FLAGS_Q_YES 0x08
#else
#define MPT_TARGET_FLAGS_VALID_NEGO 0x01
#define MPT_TARGET_FLAGS_VALID_INQUIRY 0x02
#ifdef MPT_SAVE_AUTOSENSE
#define MPT_TARGET_FLAGS_VALID_SENSE 0x04
#endif
#define MPT_TARGET_FLAGS_Q_YES 0x08
#define MPT_TARGET_FLAGS_VALID_56 0x10
#endif
#define MPT_TARGET_NO_NEGO_WIDE 0x01
#define MPT_TARGET_NO_NEGO_SYNC 0x02
......@@ -603,7 +599,7 @@ typedef struct _MPT_ADAPTER
dma_addr_t sense_buf_pool_dma;
u32 sense_buf_low_dma;
int mtrr_reg;
struct pci_dev *pcidev;
struct pci_dev *pcidev; /* struct pci_dev pointer */
u8 *memmap; /* mmap address */
struct Scsi_Host *sh; /* Scsi Host pointer */
ScsiCfgData spi_data; /* Scsi config. data */
......@@ -764,6 +760,13 @@ typedef struct _mpt_sge {
#define dcprintk(x)
#endif
#if defined(MPT_DEBUG_SCSI) || defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
#define dsprintk(x) printk x
#else
#define dsprintk(x)
#endif
#define MPT_INDEX_2_MFPTR(ioc,idx) \
(MPT_FRAME_HDR*)( (u8*)(ioc)->req_frames + (ioc)->req_sz * (idx) )
......@@ -1050,7 +1053,7 @@ extern int mpt_ASCQ_TableSz;
#define offsetof(t, m) ((size_t) (&((t *)0)->m))
#endif
#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__)
#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__) || defined(__x86_64__)
#define CAST_U32_TO_PTR(x) ((void *)(u64)x)
#define CAST_PTR_TO_U32(x) ((u32)(u64)x)
#else
......
......@@ -102,6 +102,9 @@
#define my_VERSION MPT_LINUX_VERSION_COMMON
#define MYNAM "mptctl"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,62)
EXPORT_NO_SYMBOLS;
#endif
MODULE_AUTHOR(MODULEAUTHOR);
MODULE_DESCRIPTION(my_NAME);
MODULE_LICENSE("GPL");
......@@ -135,7 +138,7 @@ static int mptctl_eventreport (unsigned long arg);
static int mptctl_replace_fw (unsigned long arg);
static int mptctl_do_reset(unsigned long arg);
static int mptctl_hp_hostinfo(unsigned long arg);
static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd);
static int mptctl_hp_targetinfo(unsigned long arg);
/*
......@@ -658,25 +661,19 @@ mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
dctlprintk((MYIOC_s_INFO_FMT ": mptctl_ioctl()\n", iocp->name));
switch(cmd) {
case MPTFWDOWNLOAD:
if (cmd == MPTFWDOWNLOAD)
ret = mptctl_fw_download(arg);
break;
case MPTCOMMAND:
else if (cmd == MPTCOMMAND)
ret = mptctl_mpt_command(arg);
break;
case MPTHARDRESET:
else if (cmd == MPTHARDRESET)
ret = mptctl_do_reset(arg);
break;
case HP_GETHOSTINFO:
ret = mptctl_hp_hostinfo(arg);
break;
case HP_GETTARGETINFO:
else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK))
ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd));
else if (cmd == HP_GETTARGETINFO)
ret = mptctl_hp_targetinfo(arg);
break;
default:
else
ret = -EINVAL;
}
up(&mptctl_syscall_sem_ioc[iocp->id]);
......@@ -873,7 +870,7 @@ mptctl_do_fw_download(int ioc, char *ufwbuf, size_t fwlen)
* 96 8
* 64 4
*/
maxfrags = (iocp->req_sz - sizeof(MPIHeader_t) - sizeof(FWDownloadTCSGE_t))
maxfrags = (iocp->req_sz - sizeof(MPIHeader_t) - sizeof(FWDownloadTCSGE_t))
/ (sizeof(dma_addr_t) + sizeof(u32));
if (numfrags > maxfrags) {
ret = -EMLINK;
......@@ -1227,10 +1224,16 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
u8 revision;
dctlprintk((": mptctl_getiocinfo called.\n"));
if (data_size == sizeof(struct mpt_ioctl_iocinfo))
cim_rev = 1;
else if (data_size == (sizeof(struct mpt_ioctl_iocinfo) - sizeof(struct mpt_ioctl_pci_info)))
/* Add of PCI INFO results in unaligned access for
* IA64 and Sparc. Reset long to int. Return no PCI
* data for obsolete format.
*/
if (data_size == sizeof(struct mpt_ioctl_iocinfo_rev0))
cim_rev = 0;
else if (data_size == sizeof(struct mpt_ioctl_iocinfo))
cim_rev = 1;
else if (data_size == (sizeof(struct mpt_ioctl_iocinfo_rev0)+12))
cim_rev = 0; /* obsolete */
else
return -EFAULT;
......@@ -1414,7 +1417,7 @@ mptctl_gettargetinfo (unsigned long arg)
/* Get number of devices
*/
if ( (sh = ioc->sh) != NULL) {
if ((sh = ioc->sh) != NULL) {
max_id = sh->max_id - 1;
hd = (MPT_SCSI_HOST *) sh->hostdata;
......@@ -1437,9 +1440,8 @@ mptctl_gettargetinfo (unsigned long arg)
pdata++;
if (maxWordsLeft <= 0) {
if (maxWordsLeft <= 0)
break;
}
}
}
}
......@@ -1712,7 +1714,7 @@ mptctl_replace_fw (unsigned long arg)
/* Allocate memory for the new FW image
*/
newFwSize = karg.newImageSize;
fwmem = mpt_alloc_fw_memory(ioc, newFwSize, &num_frags, &alloc_sz);
fwmem = mpt_alloc_fw_memory(ioc, newFwSize, &num_frags, &alloc_sz);
if (fwmem == NULL)
return -ENOMEM;
......@@ -1732,7 +1734,7 @@ mptctl_replace_fw (unsigned long arg)
}
/* Free the old FW image
/* Free the old FW image
*/
if (ioc->cached_fw) {
mpt_free_fw_memory(ioc, 0);
......@@ -1905,6 +1907,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
case MPI_FUNCTION_FW_UPLOAD:
case MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR:
case MPI_FUNCTION_FW_DOWNLOAD:
case MPI_FUNCTION_FC_PRIMITIVE_SEND:
break;
case MPI_FUNCTION_SCSI_IO_REQUEST:
......@@ -2032,7 +2035,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
break;
case MPI_FUNCTION_SCSI_TASK_MGMT:
{
{
MPT_SCSI_HOST *hd = NULL;
if ((ioc->sh == NULL) || ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL)) {
printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
......@@ -2065,7 +2068,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
}
if ((pInit->Flags != 0) || (pInit->MaxDevices != ioc->facts.MaxDevices) ||
(pInit->MaxBuses != ioc->facts.MaxBuses) ||
(pInit->MaxBuses != ioc->facts.MaxBuses) ||
(pInit->ReplyFrameSize != cpu_to_le16(ioc->reply_sz)) ||
(pInit->HostMfaHighAddr != high_addr) ||
(pInit->SenseBufferHighAddr != sense_high)) {
......@@ -2097,7 +2100,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
MPI_FUNCTION_FC_LINK_SRVC_BUF_POST
MPI_FUNCTION_FC_LINK_SRVC_RSP
MPI_FUNCTION_FC_ABORT
MPI_FUNCTION_FC_PRIMITIVE_SEND
MPI_FUNCTION_LAN_SEND
MPI_FUNCTION_LAN_RECEIVE
MPI_FUNCTION_LAN_RESET
......@@ -2395,7 +2397,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
* -ENOMEM if memory allocation error
*/
static int
mptctl_hp_hostinfo(unsigned long arg)
mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
{
hp_host_info_t *uarg = (hp_host_info_t *) arg;
MPT_ADAPTER *ioc;
......@@ -2406,9 +2408,18 @@ mptctl_hp_hostinfo(unsigned long arg)
CONFIGPARMS cfg;
ConfigPageHeader_t hdr;
int iocnum;
int rc;
int rc, cim_rev;
dctlprintk((": mptctl_hp_hostinfo called.\n"));
/* Reset long to int. Should affect IA64 and SPARC only
*/
if (data_size == sizeof(hp_host_info_t))
cim_rev = 1;
else if (data_size == (sizeof(hp_host_info_t) + 12))
cim_rev = 0; /* obsolete */
else
return -EFAULT;
if (copy_from_user(&karg, uarg, sizeof(hp_host_info_t))) {
printk(KERN_ERR "%s@%d::mptctl_hp_host_info - "
"Unable to read in hp_host_info struct @ %p\n",
......@@ -2438,7 +2449,7 @@ mptctl_hp_hostinfo(unsigned long arg)
karg.bus = pdev->bus->number;
/* Save the SCSI host no. if
* SCSI driver loaded
* SCSI driver loaded
*/
if (ioc->sh != NULL)
karg.host_no = ioc->sh->host_no;
......@@ -2526,7 +2537,7 @@ mptctl_hp_hostinfo(unsigned long arg)
if (ioc->sh != NULL) {
MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata;
if (hd) {
if (hd && (cim_rev == 1)) {
karg.hard_resets = hd->hard_resets;
karg.soft_resets = hd->soft_resets;
karg.timeouts = hd->timeouts;
......@@ -2620,7 +2631,7 @@ mptctl_hp_targetinfo(unsigned long arg)
if ((rc = mpt_config(ioc, &cfg)) == 0) {
np = le32_to_cpu(pg0_alloc->NegotiatedParameters);
karg.negotiated_width = np & MPI_SCSIDEVPAGE0_NP_WIDE ?
karg.negotiated_width = np & MPI_SCSIDEVPAGE0_NP_WIDE ?
HP_BUS_WIDTH_16 : HP_BUS_WIDTH_8;
if (np & MPI_SCSIDEVPAGE0_NP_NEG_SYNC_OFFSET_MASK) {
......@@ -2699,7 +2710,7 @@ mptctl_hp_targetinfo(unsigned long arg)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,51)
#define owner_THIS_MODULE owner: THIS_MODULE,
#define owner_THIS_MODULE .owner = THIS_MODULE,
#else
#define owner_THIS_MODULE
#endif
......@@ -2885,6 +2896,8 @@ int __init mptctl_init(void)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) /*{*/
err = register_ioctl32_conversion(MPTIOCINFO, NULL);
if (++where && err) goto out_fail;
err = register_ioctl32_conversion(MPTIOCINFO1, NULL);
if (++where && err) goto out_fail;
err = register_ioctl32_conversion(MPTTARGETINFO, NULL);
if (++where && err) goto out_fail;
err = register_ioctl32_conversion(MPTTEST, NULL);
......@@ -2945,6 +2958,7 @@ int __init mptctl_init(void)
printk(KERN_ERR MYNAM ": ERROR: Failed to register ioctl32_conversion!"
" (%d:err=%d)\n", where, err);
unregister_ioctl32_conversion(MPTIOCINFO);
unregister_ioctl32_conversion(MPTIOCINFO1);
unregister_ioctl32_conversion(MPTTARGETINFO);
unregister_ioctl32_conversion(MPTTEST);
unregister_ioctl32_conversion(MPTEVENTQUERY);
......
......@@ -90,6 +90,7 @@
#endif /*}*/
#define MPTIOCINFO _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
#define MPTIOCINFO1 _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
#define MPTTARGETINFO _IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
#define MPTTEST _IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
#define MPTEVENTQUERY _IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
......@@ -99,7 +100,7 @@
#define MPTFWREPLACE _IOWR(MPT_MAGIC_NUMBER,25,struct mpt_ioctl_replace_fw)
/*
* SPARC PLATFORM REMARK:
* SPARC PLATFORM REMARKS:
* IOCTL data structures that contain pointers
* will have different sizes in the driver and applications
* (as the app. will not use 8-byte pointers).
......@@ -107,6 +108,8 @@
* The driver will convert data from
* mpt_fw_xfer32 (mpt_ioctl_command32) to mpt_fw_xfer (mpt_ioctl_command)
* internally.
*
* If data structures change size, must handle as in IOCGETINFO.
*/
struct mpt_fw_xfer {
unsigned int iocnum; /* IOC unit number */
......@@ -154,11 +157,11 @@ struct mpt_ioctl_diag_reset {
struct mpt_ioctl_pci_info {
union {
struct {
unsigned long deviceNumber : 5;
unsigned long functionNumber : 3;
unsigned long busNumber : 24;
unsigned int deviceNumber : 5;
unsigned int functionNumber : 3;
unsigned int busNumber : 24;
} bits;
unsigned long asUlong;
unsigned int asUlong;
} u;
};
......@@ -189,6 +192,27 @@ struct mpt_ioctl_iocinfo {
struct mpt_ioctl_pci_info pciInfo; /* Added Rev 1 */
};
/* Original structure, must always accept these
* IOCTLs. 4 byte pads can occur based on arch with
* above structure. Wish to re-align, but cannot.
*/
struct mpt_ioctl_iocinfo_rev0 {
mpt_ioctl_header hdr;
int adapterType; /* SCSI or FCP */
int port; /* port number */
int pciId; /* PCI Id. */
int hwRev; /* hardware revision */
int subSystemDevice; /* PCI subsystem Device ID */
int subSystemVendor; /* PCI subsystem Vendor ID */
int numDevices; /* number of devices */
int FWVersion; /* FW Version (integer) */
int BIOSVersion; /* BIOS Version (integer) */
char driverVersion[MPT_IOCTL_VERSION_LENGTH]; /* Driver Version (string) */
char busChangeEvent;
char hostId;
char rsvd[2];
};
/*
* Device Information Page
* Report the number of, and ids of, all targets
......@@ -330,7 +354,7 @@ typedef struct _hp_header {
unsigned int lun;
} hp_header_t;
/*
/*
* Header:
* iocnum required (input)
* host ignored
......@@ -353,12 +377,12 @@ typedef struct _hp_host_info {
u32 bus_phys_width;
u32 base_io_addr;
u32 rsvd;
unsigned long hard_resets; /* driver initiated resets */
unsigned long soft_resets; /* ioc, external resets */
unsigned long timeouts; /* num timeouts */
unsigned int hard_resets; /* driver initiated resets */
unsigned int soft_resets; /* ioc, external resets */
unsigned int timeouts; /* num timeouts */
} hp_host_info_t;
/*
/*
* Header:
* iocnum required (input)
* host required
......
......@@ -154,7 +154,7 @@ static int mpt_lan_open(struct net_device *dev);
static int mpt_lan_reset(struct net_device *dev);
static int mpt_lan_close(struct net_device *dev);
static void mpt_lan_post_receive_buckets(void *dev_id);
static void mpt_lan_wake_post_buckets_task(struct net_device *dev,
static void mpt_lan_wake_post_buckets_task(struct net_device *dev,
int priority);
static int mpt_lan_receive_post_turbo(struct net_device *dev, u32 tmsg);
static int mpt_lan_receive_post_reply(struct net_device *dev,
......@@ -868,7 +868,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static inline void
mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority)
/*
/*
* @priority: 0 = put it on the timer queue, 1 = put it on the immediate queue
*/
{
......@@ -878,8 +878,6 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority)
if (priority) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
schedule_work(&priv->post_buckets_task);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
schedule_task(&priv->post_buckets_task);
#else
queue_task(&priv->post_buckets_task, &tq_immediate);
mark_bh(IMMEDIATE_BH);
......@@ -887,8 +885,6 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority)
} else {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
schedule_delayed_work(&priv->post_buckets_task, 1);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
schedule_task(&priv->post_buckets_task);
#else
queue_task(&priv->post_buckets_task, &tq_timer);
#endif
......@@ -1191,7 +1187,7 @@ mpt_lan_receive_post_reply(struct net_device *dev,
remaining, atomic_read(&priv->buckets_out));
if ((remaining < priv->bucketthresh) &&
((atomic_read(&priv->buckets_out) - remaining) >
((atomic_read(&priv->buckets_out) - remaining) >
MPT_LAN_BUCKETS_REMAIN_MISMATCH_THRESH)) {
printk (KERN_WARNING MYNAM " Mismatch between driver's "
......@@ -1525,7 +1521,7 @@ mpt_lan_init (void)
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
void __init mpt_lan_exit(void)
static void mpt_lan_exit(void)
{
int i;
......@@ -1534,10 +1530,11 @@ void __init mpt_lan_exit(void)
for (i = 0; mpt_landev[i] != NULL; i++) {
struct net_device *dev = mpt_landev[i];
printk (KERN_INFO MYNAM ": %s/%s: Fusion MPT LAN device unregistered\n",
printk (KERN_INFO ": %s/%s: Fusion MPT LAN device unregistered\n",
IOC_AND_NETDEV_NAMES_s_s(dev));
unregister_fcdev(dev);
mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */
//mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */
mpt_landev[i] = NULL;
}
if (LanCtx >= 0) {
......@@ -1550,9 +1547,10 @@ void __init mpt_lan_exit(void)
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,59)
MODULE_PARM(tx_max_out_p, "i");
MODULE_PARM(max_buckets_out, "i"); // Debug stuff. FIXME!
#endif
module_init(mpt_lan_init);
module_exit(mpt_lan_exit);
......
......@@ -21,11 +21,7 @@
#include <linux/miscdevice.h>
#include <linux/spinlock.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
#include <linux/tqueue.h>
#else
#include <linux/workqueue.h>
#endif
#include <linux/delay.h>
// #include <linux/trdevice.h>
......
This diff is collapsed.
......@@ -72,7 +72,7 @@
/*
* Try to keep these at 2^N-1
*/
#define MPT_FC_CAN_QUEUE 63
#define MPT_FC_CAN_QUEUE 127
#if defined MPT_SCSI_USE_NEW_EH
#define MPT_SCSI_CAN_QUEUE 127
#else
......@@ -148,59 +148,18 @@ struct mptscsih_driver_setup
* Issue discovered 20001213 by: sshirron
*/
#define MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS 1
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,0)
# if LINUX_VERSION_CODE == KERNEL_VERSION(2,4,0)
/*
* Super HACK! -by sralston:-(
* (good grief; heaven help me!)
*/
# include <linux/capability.h>
# if !defined(CAP_LEASE) && !defined(MODULE)
# undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
# endif
# else
# ifndef MODULE
# undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
# endif
# endif
#endif
/*
* tq_scheduler disappeared @ lk-2.4.0-test12
* (right when <linux/sched.h> newly defined TQ_ACTIVE)
* tq_struct reworked in 2.5.41. Include workqueue.h.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
# include <linux/sched.h>
# include <linux/workqueue.h>
#define SCHEDULE_TASK(x) \
if (schedule_work(x) == 0) { \
/*MOD_DEC_USE_COUNT*/; \
}
#else
#define HAVE_TQ_SCHED 1
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
# include <linux/sched.h>
# ifdef TQ_ACTIVE
# undef HAVE_TQ_SCHED
# endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
# undef HAVE_TQ_SCHED
#endif
#endif
#ifdef HAVE_TQ_SCHED
#define SCHEDULE_TASK(x) \
/*MOD_INC_USE_COUNT*/; \
(x)->next = NULL; \
queue_task(x, &tq_scheduler)
#else
#define SCHEDULE_TASK(x) \
/*MOD_INC_USE_COUNT*/; \
if (schedule_task(x) == 0) { \
/*MOD_DEC_USE_COUNT*/; \
}
#endif
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......@@ -217,11 +176,9 @@ struct mptscsih_driver_setup
#define x_scsi_taskmgmt_bh mptscsih_taskmgmt_bh
#define x_scsi_old_abort mptscsih_old_abort
#define x_scsi_old_reset mptscsih_old_reset
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
#define x_scsi_slave_alloc mptscsih_slave_alloc
#define x_scsi_slave_configure mptscsih_slave_configure
#else
#define x_scsi_select_queue_depths mptscsih_select_queue_depths
#endif
#define x_scsi_slave_destroy mptscsih_slave_destroy
#define x_scsi_proc_info mptscsih_proc_info
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......@@ -232,41 +189,19 @@ extern int x_scsi_detect(Scsi_Host_Template *);
extern int x_scsi_release(struct Scsi_Host *host);
extern const char *x_scsi_info(struct Scsi_Host *);
extern int x_scsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
#ifdef MPT_SCSI_USE_NEW_EH
extern int x_scsi_abort(Scsi_Cmnd *);
extern int x_scsi_bus_reset(Scsi_Cmnd *);
extern int x_scsi_dev_reset(Scsi_Cmnd *);
extern int x_scsi_host_reset(Scsi_Cmnd *);
#else
extern int x_scsi_old_abort(Scsi_Cmnd *);
extern int x_scsi_old_reset(Scsi_Cmnd *, unsigned int);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
extern int x_scsi_bios_param(struct scsi_device * sdev, struct block_device *bdev,
sector_t capacity, int *ip);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28)
extern int x_scsi_bios_param(Disk *, struct block_device *, int *);
#else
extern int x_scsi_bios_param(Disk *, kdev_t, int *);
#endif
extern void x_scsi_taskmgmt_bh(void *);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
extern int x_scsi_slave_alloc(Scsi_Device *);
extern int x_scsi_slave_configure(Scsi_Device *);
#else
extern void x_scsi_select_queue_depths(struct Scsi_Host *, Scsi_Device *);
#endif
extern void x_scsi_slave_destroy(Scsi_Device *);
extern int x_scsi_proc_info(char *, char **, off_t, int, int, int);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
#define PROC_SCSI_DECL
#else
#define PROC_SCSI_DECL proc_name: "mptscsih",
#endif
#ifdef MPT_SCSI_USE_NEW_EH
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
#define PROC_SCSI_DECL .proc_name = "mptscsih",
#define MPT_SCSIHOST { \
PROC_SCSI_DECL \
......@@ -277,7 +212,9 @@ extern int x_scsi_proc_info(char *, char **, off_t, int, int, int);
.info = x_scsi_info, \
.command = NULL, \
.queuecommand = x_scsi_queuecommand, \
.slave_alloc = x_scsi_slave_alloc, \
.slave_configure = x_scsi_slave_configure, \
.slave_destroy = x_scsi_slave_destroy, \
.eh_strategy_handler = NULL, \
.eh_abort_handler = x_scsi_abort, \
.eh_device_reset_handler = x_scsi_dev_reset, \
......@@ -293,58 +230,6 @@ extern int x_scsi_proc_info(char *, char **, off_t, int, int, int);
.use_clustering = ENABLE_CLUSTERING, \
}
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
#define MPT_SCSIHOST { \
.next = NULL, \
PROC_SCSI_DECL \
.proc_info = x_scsi_proc_info, \
.name = "MPT SCSI Host", \
.detect = x_scsi_detect, \
.release = x_scsi_release, \
.info = x_scsi_info, \
.command = NULL, \
.queuecommand = x_scsi_queuecommand, \
.eh_strategy_handler = NULL, \
.eh_abort_handler = x_scsi_abort, \
.eh_device_reset_handler = x_scsi_dev_reset, \
.eh_bus_reset_handler = x_scsi_bus_reset, \
.eh_host_reset_handler = NULL, \
.bios_param = x_scsi_bios_param, \
.can_queue = MPT_SCSI_CAN_QUEUE, \
.this_id = -1, \
.sg_tablesize = MPT_SCSI_SG_DEPTH, \
.cmd_per_lun = MPT_SCSI_CMD_PER_LUN, \
.unchecked_isa_dma = 0, \
.use_clustering = ENABLE_CLUSTERING, \
.use_new_eh_code = 1 \
}
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
#else /* MPT_SCSI_USE_NEW_EH */
#define MPT_SCSIHOST { \
.next = NULL, \
PROC_SCSI_DECL \
.name = "MPT SCSI Host", \
.detect = x_scsi_detect, \
.release = x_scsi_release, \
.info = x_scsi_info, \
.command = NULL, \
.queuecommand = x_scsi_queuecommand, \
.abort = x_scsi_old_abort, \
.reset = x_scsi_old_reset, \
.bios_param = x_scsi_bios_param, \
.can_queue = MPT_SCSI_CAN_QUEUE, \
.this_id = -1, \
.sg_tablesize = MPT_SCSI_SG_DEPTH, \
.cmd_per_lun = MPT_SCSI_CMD_PER_LUN, \
.unchecked_isa_dma = 0, \
.use_clustering = ENABLE_CLUSTERING \
}
#endif /* MPT_SCSI_USE_NEW_EH */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
......@@ -172,44 +172,6 @@ int pci_visit_dev (struct pci_visit *fn, struct pci_dev_wrapped *wrapped_dev,
}
EXPORT_SYMBOL(pci_visit_dev);
/**
* pci_is_dev_in_use - query devices' usage
* @dev: PCI device to query
*
* Queries whether a given PCI device is in use by a driver or not.
* Returns 1 if the device is in use, 0 if it is not.
*/
int pci_is_dev_in_use(struct pci_dev *dev)
{
/*
* dev->driver will be set if the device is in use by a new-style
* driver -- otherwise, check the device's regions to see if any
* driver has claimed them.
*/
int i;
int inuse = 0;
if (dev->driver) {
/* Assume driver feels responsible */
return 1;
}
for (i = 0; !dev->driver && !inuse && (i < 6); i++) {
if (!pci_resource_start(dev, i))
continue;
if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
inuse = check_region(pci_resource_start(dev, i),
pci_resource_len(dev, i));
} else if (pci_resource_flags(dev, i) & IORESOURCE_MEM) {
inuse = check_mem_region(pci_resource_start(dev, i),
pci_resource_len(dev, i));
}
}
return inuse;
}
EXPORT_SYMBOL(pci_is_dev_in_use);
/**
* pci_remove_device_safe - remove an unused hotplug device
* @dev: the device to remove
......@@ -221,9 +183,8 @@ EXPORT_SYMBOL(pci_is_dev_in_use);
*/
int pci_remove_device_safe(struct pci_dev *dev)
{
if (pci_is_dev_in_use(dev)) {
if (pci_dev_driver(dev))
return -EBUSY;
}
pci_remove_device(dev);
return 0;
}
......
......@@ -505,23 +505,30 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
{
unsigned int devfn, max, pass;
struct list_head *ln;
struct pci_dev *dev, dev0;
struct pci_dev *dev;
dev = kmalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) {
printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
return 0;
}
DBG("Scanning bus %02x\n", bus->number);
max = bus->secondary;
/* Create a device template */
memset(&dev0, 0, sizeof(dev0));
dev0.bus = bus;
dev0.sysdata = bus->sysdata;
dev0.dev.parent = bus->dev;
dev0.dev.bus = &pci_bus_type;
memset(dev, 0, sizeof(*dev));
dev->bus = bus;
dev->sysdata = bus->sysdata;
dev->dev.parent = bus->dev;
dev->dev.bus = &pci_bus_type;
/* Go find them, Rover! */
for (devfn = 0; devfn < 0x100; devfn += 8) {
dev0.devfn = devfn;
pci_scan_slot(&dev0);
dev->devfn = devfn;
pci_scan_slot(dev);
}
kfree(dev);
/*
* After performing arch-dependent fixup of the bus, look behind
......@@ -549,10 +556,9 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
int __devinit pci_bus_exists(const struct list_head *list, int nr)
{
const struct list_head *l;
const struct pci_bus *b;
for(l=list->next; l != list; l = l->next) {
const struct pci_bus *b = pci_bus_b(l);
list_for_each_entry(b, list, node) {
if (b->number == nr || pci_bus_exists(&b->children, nr))
return 1;
}
......
......@@ -39,14 +39,13 @@
static int __devinit
pbus_assign_resources_sorted(struct pci_bus *bus)
{
struct list_head *ln;
struct pci_dev *dev;
struct resource *res;
struct resource_list head, *list, *tmp;
int idx, found_vga = 0;
head.next = NULL;
for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
struct pci_dev *dev = pci_dev_b(ln);
list_for_each_entry(dev, &bus->devices, bus_list) {
u16 class = dev->class >> 8;
if (class == PCI_CLASS_DISPLAY_VGA
......@@ -201,15 +200,14 @@ pci_bridge_check_ranges(struct pci_bus *bus)
static void __devinit
pbus_size_io(struct pci_bus *bus)
{
struct list_head *ln;
struct pci_dev *dev;
struct resource *b_res = bus->resource[0];
unsigned long size = 0, size1 = 0;
if (!(b_res->flags & IORESOURCE_IO))
return;
for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
struct pci_dev *dev = pci_dev_b(ln);
list_for_each_entry(dev, &bus->devices, bus_list) {
int i;
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
......@@ -250,7 +248,7 @@ pbus_size_io(struct pci_bus *bus)
static void __devinit
pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type)
{
struct list_head *ln;
struct pci_dev *dev;
unsigned long min_align, align, size;
unsigned long aligns[12]; /* Alignments from 1Mb to 2Gb */
int order, max_order;
......@@ -261,8 +259,7 @@ pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type)
max_order = 0;
size = 0;
for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
struct pci_dev *dev = pci_dev_b(ln);
list_for_each_entry(dev, &bus->devices, bus_list) {
int i;
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
......@@ -322,11 +319,12 @@ pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type)
void __devinit
pci_bus_size_bridges(struct pci_bus *bus)
{
struct list_head *ln;
struct pci_bus *b;
unsigned long mask, type;
for (ln=bus->children.next; ln != &bus->children; ln=ln->next)
pci_bus_size_bridges(pci_bus_b(ln));
list_for_each_entry(b, &bus->children, node) {
pci_bus_size_bridges(b);
}
/* The root bus? */
if (!bus->self)
......@@ -350,20 +348,16 @@ EXPORT_SYMBOL(pci_bus_size_bridges);
void __devinit
pci_bus_assign_resources(struct pci_bus *bus)
{
struct list_head *ln;
struct pci_bus *b;
int found_vga = pbus_assign_resources_sorted(bus);
if (found_vga) {
struct pci_bus *b;
/* Propagate presence of the VGA to upstream bridges */
for (b = bus; b->parent; b = b->parent) {
b->resource[0]->flags |= IORESOURCE_BUS_HAS_VGA;
}
}
for (ln=bus->children.next; ln != &bus->children; ln=ln->next) {
struct pci_bus *b = pci_bus_b(ln);
list_for_each_entry(b, &bus->children, node) {
pci_bus_assign_resources(b);
pci_setup_bridge(b);
}
......
......@@ -244,7 +244,14 @@ static const lookup_t service_table[] = {
static int register_callback(socket_info_t *s, void (*handler)(void *, unsigned int), void * info)
{
return s->ss_entry->register_callback(s->sock, handler, info);
int error;
if (handler && !try_module_get(s->ss_entry->owner))
return -ENODEV;
error = s->ss_entry->register_callback(s->sock, handler, info);
if (!handler)
module_put(s->ss_entry->owner);
return error;
}
static int get_socket_status(socket_info_t *s, int *val)
......
......@@ -394,11 +394,6 @@ static int hs_register_callback(unsigned int sock,
DPRINTK("hs_register_callback(%d)\n", sock);
sp->handler = handler;
sp->handler_info = info;
if (handler == 0) {
MOD_DEC_USE_COUNT;
} else {
MOD_INC_USE_COUNT;
}
return 0;
}
......@@ -891,18 +886,19 @@ static void hs_interrupt(int irq, void *dev, struct pt_regs *regs)
/*============================================================*/
static struct pccard_operations hs_operations = {
hs_init,
hs_suspend,
hs_register_callback,
hs_inquire_socket,
hs_get_status,
hs_get_socket,
hs_set_socket,
hs_get_io_map,
hs_set_io_map,
hs_get_mem_map,
hs_set_mem_map,
hs_proc_setup
.owner = THIS_MODULE,
.init = hs_init,
.suspend = hs_suspend,
.register_callback = hs_register_callback,
.inquire_socket = hs_inquire_socket,
.get_status = hs_get_status,
.get_socket = hs_get_socket,
.set_socket = hs_set_socket,
.get_io_map = hs_get_io_map,
.set_io_map = hs_set_io_map,
.get_mem_map = hs_get_mem_map,
.set_mem_map = hs_set_mem_map,
.proc_setup = hs_proc_setup,
};
static int hs_init_socket(hs_socket_t *sp, int irq, unsigned long mem_base,
......
......@@ -55,6 +55,7 @@ static struct pci_driver i82092aa_pci_drv = {
/* the pccard structure and its functions */
static struct pccard_operations i82092aa_operations = {
.owner = THIS_MODULE,
.init = i82092aa_init,
.suspend = i82092aa_suspend,
.register_callback = i82092aa_register_callback,
......@@ -465,11 +466,6 @@ static int i82092aa_register_callback(unsigned int sock, void (*handler)(void *,
enter("i82092aa_register_callback");
sockets[sock].handler = handler;
sockets[sock].info = info;
if (handler == NULL) {
MOD_DEC_USE_COUNT;
} else {
MOD_INC_USE_COUNT;
}
leave("i82092aa_register_callback");
return 0;
} /* i82092aa_register_callback */
......
......@@ -1018,11 +1018,6 @@ static int pcic_register_callback(unsigned int sock, void (*handler)(void *, uns
{
socket[sock].handler = handler;
socket[sock].info = info;
if (handler == NULL) {
MOD_DEC_USE_COUNT;
} else {
MOD_INC_USE_COUNT;
}
return 0;
} /* pcic_register_callback */
......@@ -1568,18 +1563,19 @@ static int pcic_suspend(unsigned int sock)
}
static struct pccard_operations pcic_operations = {
pcic_init,
pcic_suspend,
pcic_register_callback,
pcic_inquire_socket,
pcic_get_status,
pcic_get_socket,
pcic_set_socket,
pcic_get_io_map,
pcic_set_io_map,
pcic_get_mem_map,
pcic_set_mem_map,
pcic_proc_setup
.owner = THIS_MODULE,
.init = pcic_init,
.suspend = pcic_suspend,
.register_callback = pcic_register_callback,
.inquire_socket = pcic_inquire_socket,
.get_status = pcic_get_status,
.get_socket = pcic_get_socket,
.set_socket = pcic_set_socket,
.get_io_map = pcic_get_io_map,
.set_io_map = pcic_set_io_map,
.get_mem_map = pcic_get_mem_map,
.set_mem_map = pcic_set_mem_map,
.proc_setup = pcic_proc_setup,
};
/*====================================================================*/
......
......@@ -66,10 +66,6 @@ static int pci_register_callback(unsigned int sock, void (*handler)(void *, unsi
socket->handler = handler;
socket->info = info;
if (handler)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
return 0;
}
......@@ -154,18 +150,19 @@ static void pci_proc_setup(unsigned int sock, struct proc_dir_entry *base)
}
static struct pccard_operations pci_socket_operations = {
pci_init_socket,
pci_suspend_socket,
pci_register_callback,
pci_inquire_socket,
pci_get_status,
pci_get_socket,
pci_set_socket,
pci_get_io_map,
pci_set_io_map,
pci_get_mem_map,
pci_set_mem_map,
pci_proc_setup
.owner = THIS_MODULE,
.init = pci_init_socket,
.suspend = pci_suspend_socket,
.register_callback = pci_register_callback,
.inquire_socket = pci_inquire_socket,
.get_status = pci_get_status,
.get_socket = pci_get_socket,
.set_socket = pci_set_socket,
.get_io_map = pci_get_io_map,
.set_io_map = pci_set_io_map,
.get_mem_map = pci_get_mem_map,
.set_mem_map = pci_set_mem_map,
.proc_setup = pci_proc_setup,
};
static int __devinit add_pci_socket(int nr, struct pci_dev *dev, struct pci_socket_ops *ops)
......
......@@ -380,9 +380,7 @@ sa1100_pcmcia_register_callback(unsigned int sock,
if (handler == NULL) {
skt->handler = NULL;
MOD_DEC_USE_COUNT;
} else {
MOD_INC_USE_COUNT;
skt->handler_info = info;
skt->handler = handler;
}
......@@ -854,6 +852,7 @@ sa1100_pcmcia_proc_setup(unsigned int sock, struct proc_dir_entry *base)
#endif /* defined(CONFIG_PROC_FS) */
static struct pccard_operations sa1100_pcmcia_operations = {
.owner = THIS_MODULE,
.init = sa1100_pcmcia_sock_init,
.suspend = sa1100_pcmcia_suspend,
.register_callback = sa1100_pcmcia_register_callback,
......
......@@ -638,11 +638,6 @@ static int tcic_register_callback(unsigned int lsock, void (*handler)(void *, un
{
socket_table[lsock].handler = handler;
socket_table[lsock].info = info;
if (handler == NULL) {
MOD_DEC_USE_COUNT;
} else {
MOD_INC_USE_COUNT;
}
return 0;
} /* tcic_register_callback */
......@@ -1003,6 +998,7 @@ static int tcic_suspend(unsigned int sock)
}
static struct pccard_operations tcic_operations = {
.owner = THIS_MODULE,
.init = tcic_init,
.suspend = tcic_suspend,
.register_callback = tcic_register_callback,
......
......@@ -4,8 +4,7 @@
pnp-card-$(CONFIG_PNP_CARD) = card.o
obj-y := core.o driver.o resource.o interface.o quirks.o names.o system.o $(pnp-card-y)
obj-y := core.o driver.o resource.o manager.o support.o interface.o quirks.o names.o system.o $(pnp-card-y)
obj-$(CONFIG_PNPBIOS) += pnpbios/
obj-$(CONFIG_ISAPNP) += isapnp/
extern struct bus_type pnp_bus_type;
extern spinlock_t pnp_lock;
extern void *pnp_alloc(long size);
extern int pnp_interface_attach_device(struct pnp_dev *dev);
extern void pnp_name_device(struct pnp_dev *dev);
extern void pnp_fixup_device(struct pnp_dev *dev);
extern void pnp_free_resources(struct pnp_resources *resources);
extern int __pnp_add_device(struct pnp_dev *dev);
extern void __pnp_remove_device(struct pnp_dev *dev);
void *pnp_alloc(long size);
int pnp_interface_attach_device(struct pnp_dev *dev);
void pnp_name_device(struct pnp_dev *dev);
void pnp_fixup_device(struct pnp_dev *dev);
void pnp_free_resources(struct pnp_resources *resources);
int __pnp_add_device(struct pnp_dev *dev);
void __pnp_remove_device(struct pnp_dev *dev);
/* resource conflict types */
#define CONFLICT_TYPE_NONE 0x0000 /* there are no conflicts, other than those in the link */
#define CONFLICT_TYPE_RESERVED 0x0001 /* the resource requested was reserved */
#define CONFLICT_TYPE_IN_USE 0x0002 /* there is a conflict because the resource is in use */
#define CONFLICT_TYPE_PCI 0x0004 /* there is a conflict with a pci device */
#define CONFLICT_TYPE_INVALID 0x0008 /* the resource requested is invalid */
#define CONFLICT_TYPE_INTERNAL 0x0010 /* resources within the device conflict with each ohter */
#define CONFLICT_TYPE_PNP_WARM 0x0020 /* there is a conflict with a pnp device that is active */
#define CONFLICT_TYPE_PNP_COLD 0x0040 /* there is a conflict with a pnp device that is disabled */
/* conflict search modes */
#define SEARCH_WARM 1 /* check for conflicts with active devices */
#define SEARCH_COLD 0 /* check for conflicts with disabled devices */
struct pnp_dev * pnp_check_port_conflicts(struct pnp_dev * dev, int idx, int mode);
int pnp_check_port(struct pnp_dev * dev, int idx);
struct pnp_dev * pnp_check_mem_conflicts(struct pnp_dev * dev, int idx, int mode);
int pnp_check_mem(struct pnp_dev * dev, int idx);
struct pnp_dev * pnp_check_irq_conflicts(struct pnp_dev * dev, int idx, int mode);
int pnp_check_irq(struct pnp_dev * dev, int idx);
struct pnp_dev * pnp_check_dma_conflicts(struct pnp_dev * dev, int idx, int mode);
int pnp_check_dma(struct pnp_dev * dev, int idx);
......@@ -22,9 +22,9 @@
LIST_HEAD(pnp_cards);
static const struct pnp_card_device_id * match_card(struct pnpc_driver *drv, struct pnp_card *card)
static const struct pnp_card_id * match_card(struct pnpc_driver *drv, struct pnp_card *card)
{
const struct pnp_card_device_id *drv_id = drv->id_table;
const struct pnp_card_id *drv_id = drv->id_table;
while (*drv_id->id){
if (compare_pnp_id(card->id,drv_id->id))
return drv_id;
......@@ -43,8 +43,8 @@ static int card_bus_match(struct device *dev, struct device_driver *drv)
}
struct bus_type pnpc_bus_type = {
name: "pnp_card",
match: card_bus_match,
.name = "pnp_card",
.match = card_bus_match,
};
......@@ -106,7 +106,6 @@ int pnpc_add_card(struct pnp_card *card)
return -EINVAL;
sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, card->number);
INIT_LIST_HEAD(&card->rdevs);
strcpy(card->dev.name,card->name);
card->dev.parent = &card->protocol->dev;
card->dev.bus = &pnpc_bus_type;
card->dev.release = &pnp_release_card;
......@@ -144,7 +143,6 @@ void pnpc_remove_card(struct pnp_card *card)
list_for_each_safe(pos,temp,&card->devices){
struct pnp_dev *dev = card_to_pnp_dev(pos);
pnpc_remove_device(dev);
__pnp_remove_device(dev);
}
}
......@@ -221,7 +219,7 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id,
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) {
if(pnp_activate_dev(dev)<0) {
pnp_device_detach(dev);
return NULL;
}
......@@ -286,7 +284,7 @@ static int pnpc_card_probe(struct device *dev)
int error = 0;
struct pnpc_driver *drv = to_pnpc_driver(dev->driver);
struct pnp_card *card = to_pnp_card(dev);
const struct pnp_card_device_id *card_id = NULL;
const struct pnp_card_id *card_id = NULL;
pnp_dbg("pnp: match found with the PnP card '%s' and the driver '%s'", dev->bus_id,drv->name);
......
......@@ -104,31 +104,29 @@ static void pnp_free_ids(struct pnp_dev *dev)
static void pnp_release_device(struct device *dmdev)
{
struct pnp_dev * dev = to_pnp_dev(dmdev);
if (dev->res)
pnp_free_resources(dev->res);
if (dev->possible)
pnp_free_resources(dev->possible);
pnp_free_ids(dev);
kfree(dev);
}
int __pnp_add_device(struct pnp_dev *dev)
{
int error = 0;
int ret;
pnp_name_device(dev);
pnp_fixup_device(dev);
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;
dev->status = PNP_READY;
error = device_register(&dev->dev);
if (error == 0){
spin_lock(&pnp_lock);
list_add_tail(&dev->global_list, &pnp_global);
list_add_tail(&dev->protocol_list, &dev->protocol->devices);
spin_unlock(&pnp_lock);
spin_lock(&pnp_lock);
list_add_tail(&dev->global_list, &pnp_global);
list_add_tail(&dev->protocol_list, &dev->protocol->devices);
spin_unlock(&pnp_lock);
pnp_auto_config_dev(dev);
ret = device_register(&dev->dev);
if (ret == 0)
pnp_interface_attach_device(dev);
}
return error;
return ret;
}
/*
......@@ -172,7 +170,7 @@ void pnp_remove_device(struct pnp_dev *dev)
static int __init pnp_init(void)
{
printk(KERN_INFO "Linux Plug and Play Support v0.94 (c) Adam Belay\n");
printk(KERN_INFO "Linux Plug and Play Support v0.95 (c) Adam Belay\n");
return bus_register(&pnp_bus_type);
}
......
......@@ -95,7 +95,7 @@ static int pnp_device_probe(struct device *dev)
pnp_dev = to_pnp_dev(dev);
pnp_drv = to_pnp_driver(dev->driver);
pnp_dbg("pnp: match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
pnp_dbg("match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
error = pnp_device_attach(pnp_dev);
if (error < 0)
......@@ -103,13 +103,10 @@ static int pnp_device_probe(struct device *dev)
if (pnp_dev->active == 0) {
if (!(pnp_drv->flags & PNP_DRIVER_DO_NOT_ACTIVATE)) {
error = pnp_activate_dev(pnp_dev, NULL);
error = pnp_activate_dev(pnp_dev);
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) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -30,10 +30,10 @@ void
pnp_name_device(struct pnp_dev *dev)
{
int i;
char *name = dev->name;
char *name = dev->dev.name;
for(i=0; i<sizeof(pnp_id_eisaid)/sizeof(pnp_id_eisaid[0]); i++){
if (compare_pnp_id(dev->id,pnp_id_eisaid[i])){
sprintf(name, "%s", pnp_id_names[i]);
snprintf(name, DEVICE_NAME_SIZE, "%s", pnp_id_names[i]);
return;
}
}
......
This diff is collapsed.
......@@ -29,7 +29,7 @@
static void quirk_awe32_resources(struct pnp_dev *dev)
{
struct pnp_port *port, *port2, *port3;
struct pnp_resources *res = dev->res->dep;
struct pnp_resources *res = dev->possible->dep;
/*
* Unfortunately the isapnp_add_port_resource is too tightly bound
......@@ -57,7 +57,7 @@ static void quirk_awe32_resources(struct pnp_dev *dev)
static void quirk_cmi8330_resources(struct pnp_dev *dev)
{
struct pnp_resources *res = dev->res->dep;
struct pnp_resources *res = dev->possible->dep;
for ( ; res ; res = res->dep ) {
......@@ -77,7 +77,7 @@ static void quirk_cmi8330_resources(struct pnp_dev *dev)
static void quirk_sb16audio_resources(struct pnp_dev *dev)
{
struct pnp_port *port;
struct pnp_resources *res = dev->res->dep;
struct pnp_resources *res = dev->possible->dep;
int changed = 0;
/*
......@@ -115,7 +115,7 @@ static void quirk_opl3sax_resources(struct pnp_dev *dev)
*/
struct pnp_resources *res;
int max;
res = dev->res;
res = dev->possible;
max = 0;
for (res = res->dep; res; res = res->dep) {
if (res->dma->map > max)
......
This diff is collapsed.
This diff is collapsed.
......@@ -53,7 +53,7 @@ static void __init reserve_resources_of_dev( struct pnp_dev *dev )
{
int i;
for (i=0;i<DEVICE_COUNT_IO;i++) {
for (i=0;i<PNP_MAX_PORT;i++) {
if (pnp_port_valid(dev, i))
/* end of resources */
continue;
......@@ -93,6 +93,7 @@ static int system_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *de
static struct pnp_driver system_pnp_driver = {
.name = "system",
.flags = PNP_DRIVER_DO_NOT_ACTIVATE,
.id_table = pnp_dev_table,
.probe = system_pnp_probe,
.remove = NULL,
......
......@@ -317,7 +317,7 @@ static inline void avoid_irq_share(struct pnp_dev *dev)
{
unsigned int map = 0x1FF8;
struct pnp_irq *irq;
struct pnp_resources *res = dev->res;
struct pnp_resources *res = dev->possible;
serial8250_get_irq_map(&map);
......@@ -357,10 +357,10 @@ static int __devinit check_name(char *name)
*/
static int serial_pnp_guess_board(struct pnp_dev *dev, int *flags)
{
struct pnp_resources *res = dev->res;
struct pnp_resources *res = dev->possible;
struct pnp_resources *resa;
if (!(check_name(dev->name) || (dev->card && check_name(dev->card->name))))
if (!(check_name(dev->dev.name) || (dev->card && check_name(dev->card->dev.name))))
return -ENODEV;
if (!res)
......
......@@ -52,16 +52,6 @@ static struct biovec_pool bvec_array[BIOVEC_NR_POOLS] = {
};
#undef BV
static void *slab_pool_alloc(int gfp_mask, void *data)
{
return kmem_cache_alloc(data, gfp_mask);
}
static void slab_pool_free(void *ptr, void *data)
{
kmem_cache_free(data, ptr);
}
static inline struct bio_vec *bvec_alloc(int gfp_mask, int nr, unsigned long *idx)
{
struct biovec_pool *bp;
......@@ -749,8 +739,8 @@ static void __init biovec_init_pools(void)
if (i >= scale)
pool_entries >>= 1;
bp->pool = mempool_create(pool_entries, slab_pool_alloc,
slab_pool_free, bp->slab);
bp->pool = mempool_create(pool_entries, mempool_alloc_slab,
mempool_free_slab, bp->slab);
if (!bp->pool)
panic("biovec: can't init mempool\n");
......@@ -766,7 +756,7 @@ static int __init init_bio(void)
SLAB_HWCACHE_ALIGN, NULL, NULL);
if (!bio_slab)
panic("bio: can't create slab cache\n");
bio_pool = mempool_create(BIO_POOL_SIZE, slab_pool_alloc, slab_pool_free, bio_slab);
bio_pool = mempool_create(BIO_POOL_SIZE, mempool_alloc_slab, mempool_free_slab, bio_slab);
if (!bio_pool)
panic("bio: can't create mempool\n");
......
......@@ -120,15 +120,6 @@ static inline void free_metapage(struct metapage *mp)
mempool_free(mp, metapage_mempool);
}
static void *mp_mempool_alloc(int gfp_mask, void *pool_data)
{
return kmem_cache_alloc(metapage_cache, gfp_mask);
}
static void mp_mempool_free(void *element, void *pool_data)
{
return kmem_cache_free(metapage_cache, element);
}
int __init metapage_init(void)
{
/*
......@@ -139,8 +130,8 @@ int __init metapage_init(void)
if (metapage_cache == NULL)
return -ENOMEM;
metapage_mempool = mempool_create(METAPOOL_MIN_PAGES, mp_mempool_alloc,
mp_mempool_free, NULL);
metapage_mempool = mempool_create(METAPOOL_MIN_PAGES, mempool_alloc_slab,
mempool_free_slab, metapage_cache);
if (metapage_mempool == NULL) {
kmem_cache_destroy(metapage_cache);
......
......@@ -1705,6 +1705,7 @@ static inline void ide_release_dma(ide_hwif_t *drive) {;}
#endif
extern void hwif_unregister(ide_hwif_t *);
extern void ide_unregister (unsigned int index);
extern void export_ide_init_queue(ide_drive_t *);
extern u8 export_probe_for_drive(ide_drive_t *);
......
......@@ -77,6 +77,7 @@ struct resource_list {
#define IORESOURCE_MEM_8BIT (0<<3)
#define IORESOURCE_MEM_16BIT (1<<3)
#define IORESOURCE_MEM_8AND16BIT (2<<3)
#define IORESOURCE_MEM_32BIT (3<<3)
#define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */
#define IORESOURCE_MEM_EXPANSIONROM (1<<6)
......
......@@ -78,6 +78,8 @@ struct ipmi_smi_msg
struct ipmi_smi_handlers
{
struct module *owner;
/* Called to enqueue an SMI message to be sent. This
operation is not allowed to fail. If an error occurs, it
should report back the error in a received message. It may
......@@ -93,15 +95,6 @@ struct ipmi_smi_handlers
events from the BMC we are attached to. */
void (*request_events)(void *send_info);
/* Called when someone is using the interface, so the module can
adjust it's use count. Return zero if successful, or an
errno if not. */
int (*new_user)(void *send_info);
/* Called when someone is no longer using the interface, so the
module can adjust it's use count. */
void (*user_left)(void *send_info);
/* Called when the interface should go into "run to
completion" mode. If this call sets the value to true, the
interface should make sure that all messages are flushed
......
/*
* Motion Eye video4linux driver for Sony Vaio PictureBook
*
* Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
* Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
*
* Copyright (C) 2001-2002 Alcve <www.alcove.com>
*
......
This diff is collapsed.
/*
* Sony Programmable I/O Control Device driver for VAIO
*
* Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
* Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
*
* Copyright (C) 2001-2002 Alcve <www.alcove.com>
*
......
......@@ -84,6 +84,7 @@ struct rpc_auth {
* Client authentication ops
*/
struct rpc_authops {
struct module *owner;
rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */
#ifdef RPC_DEBUG
char * au_name;
......
......@@ -126,6 +126,7 @@ typedef struct cb_bridge_map {
* Socket operations.
*/
struct pccard_operations {
struct module *owner;
int (*init)(unsigned int sock);
int (*suspend)(unsigned int sock);
int (*register_callback)(unsigned int sock, void (*handler)(void *, unsigned int), void * info);
......
......@@ -66,12 +66,7 @@ void release_task(struct task_struct * p)
BUG_ON(p->state < TASK_ZOMBIE);
if (p != current)
wait_task_inactive(p);
atomic_dec(&p->user->processes);
security_task_free(p);
free_uid(p->user);
write_lock_irq(&tasklist_lock);
if (unlikely(p->ptrace))
__ptrace_unlink(p);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment