Commit 237fad87 authored by Trond Myklebust's avatar Trond Myklebust

Merge bk://linux.bkbits.net/linux-2.5

into hostme.bitkeeper.com:/ua/repos/n/nfsclient/linux-2.5
parents 67435598 ac062f74
...@@ -1549,6 +1549,18 @@ S: Tallak 95 ...@@ -1549,6 +1549,18 @@ S: Tallak 95
S: 8103 Rein S: 8103 Rein
S: Austria S: Austria
N: Mitsuru Kanda
E: mk@linux-ipv6.org
E: mk@isl.rdc.toshiba.co.jp
E: mk@karaba.org
W: http://www.karaba.org/~mk/
P: 1024D/2EC7E30D 9A35 D378 F084 9EA4 EFBA 925B 1C93 B376 F0EF BE59
D: IPsec, IPv6
D: USAGI/WIDE Project, TOSHIBA CORPORATION
S: 2-47-8, Takinogawa,
S: Kita, Tokyo 114-0023
S: Japan
N: Jan Kara N: Jan Kara
E: jack@atrey.karlin.mff.cuni.cz E: jack@atrey.karlin.mff.cuni.cz
E: jack@suse.cz E: jack@suse.cz
...@@ -2200,6 +2212,17 @@ S: 7406 Wheat Field Rd ...@@ -2200,6 +2212,17 @@ S: 7406 Wheat Field Rd
S: Garland, Texas 75044 S: Garland, Texas 75044
S: USA S: USA
N: Kazunori Miyazawa
E: miyazawa@linux-ipv6.org
E: Kazunori.Miyazawa@jp.yokogawa.com
E: kazunori@miyazawa.org
W: http://www.miyazawa.org/~kazunori/
D: IPsec, IPv6
D: USAGI/WIDE Project, Yokogawa Electric Corporation
S: 2-20-4-203, Nakacho,
S: Musashino, Tokyo 180-0006
S: Japan
N: Patrick Mochel N: Patrick Mochel
E: mochel@osdl.org E: mochel@osdl.org
E: mochelp@infinity.powertie.org E: mochelp@infinity.powertie.org
...@@ -3442,6 +3465,17 @@ D: Workbit NinjaSCSI-3/32Bi PCMCIA driver ...@@ -3442,6 +3465,17 @@ D: Workbit NinjaSCSI-3/32Bi PCMCIA driver
D: Workbit NinjaSCSI-32Bi/UDE driver D: Workbit NinjaSCSI-32Bi/UDE driver
S: Japan S: Japan
N: Hideaki YOSHIFUJI
E: hideaki@yoshifuji.org
E: yoshfuji@linux-ipv6.org
W: http://www.yoshifuji.org/~hideaki/
P: 1024D/E0620EEA 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
D: IPv6 and other networking related stuff
D: USAGI/WIDE Project, The University of Tokyo
S: Green House #102, 1-15-5, Nishikata,
S: Bunkyo, Tokyo 113-0024
S: Japan
N: Eric Youngdale N: Eric Youngdale
E: eric@andante.org E: eric@andante.org
W: http://www.andante.org W: http://www.andante.org
......
...@@ -1278,6 +1278,8 @@ P: Pekka Savola (ipv6) ...@@ -1278,6 +1278,8 @@ P: Pekka Savola (ipv6)
M: pekkas@netcore.fi M: pekkas@netcore.fi
P: James Morris P: James Morris
M: jmorris@intercode.com.au M: jmorris@intercode.com.au
P: Hideaki YOSHIFUJI
M: yoshfuji@linux-ipv6.org
L: netdev@oss.sgi.com L: netdev@oss.sgi.com
S: Maintained S: Maintained
......
...@@ -119,7 +119,7 @@ void destroy_context(struct mm_struct *mm) ...@@ -119,7 +119,7 @@ void destroy_context(struct mm_struct *mm)
} }
} }
static int read_ldt(void * ptr, unsigned long bytecount) static int read_ldt(void __user * ptr, unsigned long bytecount)
{ {
int err; int err;
unsigned long size; unsigned long size;
...@@ -148,7 +148,7 @@ static int read_ldt(void * ptr, unsigned long bytecount) ...@@ -148,7 +148,7 @@ static int read_ldt(void * ptr, unsigned long bytecount)
return bytecount; return bytecount;
} }
static int read_default_ldt(void * ptr, unsigned long bytecount) static int read_default_ldt(void __user * ptr, unsigned long bytecount)
{ {
int err; int err;
unsigned long size; unsigned long size;
...@@ -167,7 +167,7 @@ static int read_default_ldt(void * ptr, unsigned long bytecount) ...@@ -167,7 +167,7 @@ static int read_default_ldt(void * ptr, unsigned long bytecount)
return err; return err;
} }
static int write_ldt(void * ptr, unsigned long bytecount, int oldmode) static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
{ {
struct mm_struct * mm = current->mm; struct mm_struct * mm = current->mm;
__u32 entry_1, entry_2, *lp; __u32 entry_1, entry_2, *lp;
...@@ -226,7 +226,7 @@ static int write_ldt(void * ptr, unsigned long bytecount, int oldmode) ...@@ -226,7 +226,7 @@ static int write_ldt(void * ptr, unsigned long bytecount, int oldmode)
return error; return error;
} }
asmlinkage int sys_modify_ldt(int func, void *ptr, unsigned long bytecount) asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
{ {
int ret = -ENOSYS; int ret = -ENOSYS;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* sys_pipe() is the normal C calling standard for creating * sys_pipe() is the normal C calling standard for creating
* a pipe. It's not the way Unix traditionally does this, though. * a pipe. It's not the way Unix traditionally does this, though.
*/ */
asmlinkage int sys_pipe(unsigned long * fildes) asmlinkage int sys_pipe(unsigned long __user * fildes)
{ {
int fd[2]; int fd[2];
int error; int error;
...@@ -88,7 +88,7 @@ struct mmap_arg_struct { ...@@ -88,7 +88,7 @@ struct mmap_arg_struct {
unsigned long offset; unsigned long offset;
}; };
asmlinkage int old_mmap(struct mmap_arg_struct *arg) asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
{ {
struct mmap_arg_struct a; struct mmap_arg_struct a;
int err = -EFAULT; int err = -EFAULT;
...@@ -106,15 +106,15 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg) ...@@ -106,15 +106,15 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
} }
extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); extern asmlinkage int sys_select(int, fd_set __user *, fd_set __user *, fd_set __user *, struct timeval __user *);
struct sel_arg_struct { struct sel_arg_struct {
unsigned long n; unsigned long n;
fd_set *inp, *outp, *exp; fd_set __user *inp, *outp, *exp;
struct timeval *tvp; struct timeval __user *tvp;
}; };
asmlinkage int old_select(struct sel_arg_struct *arg) asmlinkage int old_select(struct sel_arg_struct __user *arg)
{ {
struct sel_arg_struct a; struct sel_arg_struct a;
...@@ -130,7 +130,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg) ...@@ -130,7 +130,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
* This is really horribly ugly. * This is really horribly ugly.
*/ */
asmlinkage int sys_ipc (uint call, int first, int second, asmlinkage int sys_ipc (uint call, int first, int second,
int third, void *ptr, long fifth) int third, void __user *ptr, long fifth)
{ {
int version, ret; int version, ret;
...@@ -139,10 +139,10 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -139,10 +139,10 @@ asmlinkage int sys_ipc (uint call, int first, int second,
switch (call) { switch (call) {
case SEMOP: case SEMOP:
return sys_semtimedop (first, (struct sembuf *)ptr, second, NULL); return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
case SEMTIMEDOP: case SEMTIMEDOP:
return sys_semtimedop(first, (struct sembuf *)ptr, second, return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
(const struct timespec *)fifth); (const struct timespec __user *)fifth);
case SEMGET: case SEMGET:
return sys_semget (first, second, third); return sys_semget (first, second, third);
...@@ -150,13 +150,13 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -150,13 +150,13 @@ asmlinkage int sys_ipc (uint call, int first, int second,
union semun fourth; union semun fourth;
if (!ptr) if (!ptr)
return -EINVAL; return -EINVAL;
if (get_user(fourth.__pad, (void **) ptr)) if (get_user(fourth.__pad, (void * __user *) ptr))
return -EFAULT; return -EFAULT;
return sys_semctl (first, second, third, fourth); return sys_semctl (first, second, third, fourth);
} }
case MSGSND: case MSGSND:
return sys_msgsnd (first, (struct msgbuf *) ptr, return sys_msgsnd (first, (struct msgbuf __user *) ptr,
second, third); second, third);
case MSGRCV: case MSGRCV:
switch (version) { switch (version) {
...@@ -166,7 +166,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -166,7 +166,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
return -EINVAL; return -EINVAL;
if (copy_from_user(&tmp, if (copy_from_user(&tmp,
(struct ipc_kludge *) ptr, (struct ipc_kludge __user *) ptr,
sizeof (tmp))) sizeof (tmp)))
return -EFAULT; return -EFAULT;
return sys_msgrcv (first, tmp.msgp, second, return sys_msgrcv (first, tmp.msgp, second,
...@@ -174,35 +174,36 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -174,35 +174,36 @@ asmlinkage int sys_ipc (uint call, int first, int second,
} }
default: default:
return sys_msgrcv (first, return sys_msgrcv (first,
(struct msgbuf *) ptr, (struct msgbuf __user *) ptr,
second, fifth, third); second, fifth, third);
} }
case MSGGET: case MSGGET:
return sys_msgget ((key_t) first, second); return sys_msgget ((key_t) first, second);
case MSGCTL: case MSGCTL:
return sys_msgctl (first, second, (struct msqid_ds *) ptr); return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
case SHMAT: case SHMAT:
switch (version) { switch (version) {
default: { default: {
ulong raddr; ulong raddr;
ret = sys_shmat (first, (char *) ptr, second, &raddr); ret = sys_shmat (first, (char __user *) ptr, second, &raddr);
if (ret) if (ret)
return ret; return ret;
return put_user (raddr, (ulong *) third); return put_user (raddr, (ulong __user *) third);
} }
case 1: /* iBCS2 emulator entry point */ case 1: /* iBCS2 emulator entry point */
if (!segment_eq(get_fs(), get_ds())) if (!segment_eq(get_fs(), get_ds()))
return -EINVAL; return -EINVAL;
return sys_shmat (first, (char *) ptr, second, (ulong *) third); /* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
return sys_shmat (first, (char __user *) ptr, second, (ulong *) third);
} }
case SHMDT: case SHMDT:
return sys_shmdt ((char *)ptr); return sys_shmdt ((char __user *)ptr);
case SHMGET: case SHMGET:
return sys_shmget (first, second, third); return sys_shmget (first, second, third);
case SHMCTL: case SHMCTL:
return sys_shmctl (first, second, return sys_shmctl (first, second,
(struct shmid_ds *) ptr); (struct shmid_ds __user *) ptr);
default: default:
return -ENOSYS; return -ENOSYS;
} }
...@@ -211,7 +212,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -211,7 +212,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
/* /*
* Old cruft * Old cruft
*/ */
asmlinkage int sys_uname(struct old_utsname * name) asmlinkage int sys_uname(struct old_utsname __user * name)
{ {
int err; int err;
if (!name) if (!name)
...@@ -222,7 +223,7 @@ asmlinkage int sys_uname(struct old_utsname * name) ...@@ -222,7 +223,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
return err?-EFAULT:0; return err?-EFAULT:0;
} }
asmlinkage int sys_olduname(struct oldold_utsname * name) asmlinkage int sys_olduname(struct oldold_utsname __user * name)
{ {
int error; int error;
......
...@@ -170,7 +170,7 @@ static void mark_screen_rdonly(struct task_struct * tsk) ...@@ -170,7 +170,7 @@ static void mark_screen_rdonly(struct task_struct * tsk)
static int do_vm86_irq_handling(int subfunction, int irqnumber); static int do_vm86_irq_handling(int subfunction, int irqnumber);
static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk); static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk);
asmlinkage int sys_vm86old(struct vm86_struct * v86) asmlinkage int sys_vm86old(struct vm86_struct __user * v86)
{ {
struct kernel_vm86_struct info; /* declare this _on top_, struct kernel_vm86_struct info; /* declare this _on top_,
* this avoids wasting of stack space. * this avoids wasting of stack space.
...@@ -199,7 +199,7 @@ asmlinkage int sys_vm86old(struct vm86_struct * v86) ...@@ -199,7 +199,7 @@ asmlinkage int sys_vm86old(struct vm86_struct * v86)
} }
asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86) asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct __user * v86)
{ {
struct kernel_vm86_struct info; /* declare this _on top_, struct kernel_vm86_struct info; /* declare this _on top_,
* this avoids wasting of stack space. * this avoids wasting of stack space.
...@@ -239,7 +239,7 @@ asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86) ...@@ -239,7 +239,7 @@ asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86)
goto out; goto out;
info.regs32 = (struct pt_regs *) &subfunction; info.regs32 = (struct pt_regs *) &subfunction;
info.vm86plus.is_vm86pus = 1; info.vm86plus.is_vm86pus = 1;
tsk->thread.vm86_info = (struct vm86_struct *)v86; tsk->thread.vm86_info = (struct vm86_struct __user *)v86;
do_sys_vm86(&info, tsk); do_sys_vm86(&info, tsk);
ret = 0; /* we never return here */ ret = 0; /* we never return here */
out: out:
......
This diff is collapsed.
...@@ -371,13 +371,8 @@ struct he_vcc ...@@ -371,13 +371,8 @@ struct he_vcc
int rc_index; int rc_index;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
struct wait_queue *rx_waitq;
atruct wait_queue *tx_waitq;
#else
wait_queue_head_t rx_waitq; wait_queue_head_t rx_waitq;
wait_queue_head_t tx_waitq; wait_queue_head_t tx_waitq;
#endif
}; };
#define HE_VCC(vcc) ((struct he_vcc *)(vcc->dev_data)) #define HE_VCC(vcc) ((struct he_vcc *)(vcc->dev_data))
......
...@@ -2777,7 +2777,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) ...@@ -2777,7 +2777,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg)
if (!capable(CAP_NET_ADMIN)) return -EPERM; if (!capable(CAP_NET_ADMIN)) return -EPERM;
tmps = (u16 *)ia_cmds.buf; tmps = (u16 *)ia_cmds.buf;
for(i=0; i<0x80; i+=2, tmps++) for(i=0; i<0x80; i+=2, tmps++)
if(put_user(*(u16*)(iadev->seg_reg+i), tmps)) return -EFAULT; if(put_user((u16)(readl(iadev->seg_reg+i) & 0xffff), tmps)) return -EFAULT;
ia_cmds.status = 0; ia_cmds.status = 0;
ia_cmds.len = 0x80; ia_cmds.len = 0x80;
break; break;
...@@ -2785,7 +2785,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) ...@@ -2785,7 +2785,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg)
if (!capable(CAP_NET_ADMIN)) return -EPERM; if (!capable(CAP_NET_ADMIN)) return -EPERM;
tmps = (u16 *)ia_cmds.buf; tmps = (u16 *)ia_cmds.buf;
for(i=0; i<0x80; i+=2, tmps++) for(i=0; i<0x80; i+=2, tmps++)
if(put_user(*(u16*)(iadev->reass_reg+i), tmps)) return -EFAULT; if(put_user((u16)(readl(iadev->reass_reg+i) & 0xffff), tmps)) return -EFAULT;
ia_cmds.status = 0; ia_cmds.status = 0;
ia_cmds.len = 0x80; ia_cmds.len = 0x80;
break; break;
...@@ -2802,10 +2802,10 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) ...@@ -2802,10 +2802,10 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg)
rfL = &regs_local->rfredn; rfL = &regs_local->rfredn;
/* Copy real rfred registers into the local copy */ /* Copy real rfred registers into the local copy */
for (i=0; i<(sizeof (rfredn_t))/4; i++) for (i=0; i<(sizeof (rfredn_t))/4; i++)
((u_int *)rfL)[i] = ((u_int *)iadev->reass_reg)[i] & 0xffff; ((u_int *)rfL)[i] = readl(iadev->reass_reg + i) & 0xffff;
/* Copy real ffred registers into the local copy */ /* Copy real ffred registers into the local copy */
for (i=0; i<(sizeof (ffredn_t))/4; i++) for (i=0; i<(sizeof (ffredn_t))/4; i++)
((u_int *)ffL)[i] = ((u_int *)iadev->seg_reg)[i] & 0xffff; ((u_int *)ffL)[i] = readl(iadev->seg_reg + i) & 0xffff;
if (copy_to_user(ia_cmds.buf, regs_local,sizeof(ia_regs_t))) { if (copy_to_user(ia_cmds.buf, regs_local,sizeof(ia_regs_t))) {
kfree(regs_local); kfree(regs_local);
......
...@@ -133,6 +133,21 @@ static void class_device_dev_unlink(struct class_device * class_dev) ...@@ -133,6 +133,21 @@ static void class_device_dev_unlink(struct class_device * class_dev)
sysfs_remove_link(&class_dev->kobj, "device"); sysfs_remove_link(&class_dev->kobj, "device");
} }
static int class_device_driver_link(struct class_device * class_dev)
{
if ((class_dev->dev) && (class_dev->dev->driver))
return sysfs_create_link(&class_dev->kobj,
&class_dev->dev->driver->kobj, "driver");
return 0;
}
static void class_device_driver_unlink(struct class_device * class_dev)
{
if ((class_dev->dev) && (class_dev->dev->driver))
sysfs_remove_link(&class_dev->kobj, "driver");
}
#define to_class_dev(obj) container_of(obj,struct class_device,kobj) #define to_class_dev(obj) container_of(obj,struct class_device,kobj)
#define to_class_dev_attr(_attr) container_of(_attr,struct class_device_attribute,attr) #define to_class_dev_attr(_attr) container_of(_attr,struct class_device_attribute,attr)
...@@ -244,7 +259,6 @@ int class_device_add(struct class_device *class_dev) ...@@ -244,7 +259,6 @@ int class_device_add(struct class_device *class_dev)
/* first, register with generic layer. */ /* first, register with generic layer. */
strncpy(class_dev->kobj.name, class_dev->class_id, KOBJ_NAME_LEN); strncpy(class_dev->kobj.name, class_dev->class_id, KOBJ_NAME_LEN);
kobj_set_kset_s(class_dev, class_subsys);
kobj_set_kset_s(class_dev, class_obj_subsys); kobj_set_kset_s(class_dev, class_obj_subsys);
if (parent) if (parent)
class_dev->kobj.parent = &parent->subsys.kset.kobj; class_dev->kobj.parent = &parent->subsys.kset.kobj;
...@@ -265,6 +279,7 @@ int class_device_add(struct class_device *class_dev) ...@@ -265,6 +279,7 @@ int class_device_add(struct class_device *class_dev)
} }
class_device_dev_link(class_dev); class_device_dev_link(class_dev);
class_device_driver_link(class_dev);
register_done: register_done:
if (error && parent) if (error && parent)
...@@ -298,6 +313,7 @@ void class_device_del(struct class_device *class_dev) ...@@ -298,6 +313,7 @@ void class_device_del(struct class_device *class_dev)
if (class_dev->dev) { if (class_dev->dev) {
class_device_dev_unlink(class_dev); class_device_dev_unlink(class_dev);
class_device_driver_unlink(class_dev);
put_device(class_dev->dev); put_device(class_dev->dev);
} }
......
...@@ -28,7 +28,7 @@ static int writes_starved = 2; /* max times reads can starve a write */ ...@@ -28,7 +28,7 @@ static int writes_starved = 2; /* max times reads can starve a write */
static int fifo_batch = 16; /* # of sequential requests treated as one static int fifo_batch = 16; /* # of sequential requests treated as one
by the above parameters. For throughput. */ by the above parameters. For throughput. */
static const int deadline_hash_shift = 10; static const int deadline_hash_shift = 5;
#define DL_HASH_BLOCK(sec) ((sec) >> 3) #define DL_HASH_BLOCK(sec) ((sec) >> 3)
#define DL_HASH_FN(sec) (hash_long(DL_HASH_BLOCK((sec)), deadline_hash_shift)) #define DL_HASH_FN(sec) (hash_long(DL_HASH_BLOCK((sec)), deadline_hash_shift))
#define DL_HASH_ENTRIES (1 << deadline_hash_shift) #define DL_HASH_ENTRIES (1 << deadline_hash_shift)
...@@ -71,6 +71,8 @@ struct deadline_data { ...@@ -71,6 +71,8 @@ struct deadline_data {
int fifo_batch; int fifo_batch;
int writes_starved; int writes_starved;
int front_merges; int front_merges;
mempool_t *drq_pool;
}; };
/* /*
...@@ -130,6 +132,21 @@ deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq) ...@@ -130,6 +132,21 @@ deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq)
list_add(&drq->hash, &dd->hash[DL_HASH_FN(rq_hash_key(rq))]); list_add(&drq->hash, &dd->hash[DL_HASH_FN(rq_hash_key(rq))]);
} }
/*
* move hot entry to front of chain
*/
static inline void
deadline_hot_drq_hash(struct deadline_data *dd, struct deadline_rq *drq)
{
struct request *rq = drq->request;
struct list_head *head = &dd->hash[DL_HASH_FN(rq_hash_key(rq))];
if (ON_HASH(drq) && drq->hash.prev != head) {
list_del(&drq->hash);
list_add(&drq->hash, head);
}
}
static struct request * static struct request *
deadline_find_drq_hash(struct deadline_data *dd, sector_t offset) deadline_find_drq_hash(struct deadline_data *dd, sector_t offset)
{ {
...@@ -353,6 +370,8 @@ deadline_merge(request_queue_t *q, struct list_head **insert, struct bio *bio) ...@@ -353,6 +370,8 @@ deadline_merge(request_queue_t *q, struct list_head **insert, struct bio *bio)
out: out:
q->last_merge = &__rq->queuelist; q->last_merge = &__rq->queuelist;
out_insert: out_insert:
if (ret)
deadline_hot_drq_hash(dd, RQ_DATA(__rq));
*insert = &__rq->queuelist; *insert = &__rq->queuelist;
return ret; return ret;
} }
...@@ -673,28 +692,11 @@ deadline_latter_request(request_queue_t *q, struct request *rq) ...@@ -673,28 +692,11 @@ deadline_latter_request(request_queue_t *q, struct request *rq)
static void deadline_exit(request_queue_t *q, elevator_t *e) static void deadline_exit(request_queue_t *q, elevator_t *e)
{ {
struct deadline_data *dd = e->elevator_data; struct deadline_data *dd = e->elevator_data;
struct deadline_rq *drq;
struct request *rq;
int i;
BUG_ON(!list_empty(&dd->fifo_list[READ])); BUG_ON(!list_empty(&dd->fifo_list[READ]));
BUG_ON(!list_empty(&dd->fifo_list[WRITE])); BUG_ON(!list_empty(&dd->fifo_list[WRITE]));
for (i = READ; i <= WRITE; i++) { mempool_destroy(dd->drq_pool);
struct request_list *rl = &q->rq[i];
struct list_head *entry;
list_for_each(entry, &rl->free) {
rq = list_entry_rq(entry);
if ((drq = RQ_DATA(rq)) == NULL)
continue;
rq->elevator_private = NULL;
kmem_cache_free(drq_pool, drq);
}
}
kfree(dd->hash); kfree(dd->hash);
kfree(dd); kfree(dd);
} }
...@@ -706,9 +708,7 @@ static void deadline_exit(request_queue_t *q, elevator_t *e) ...@@ -706,9 +708,7 @@ static void deadline_exit(request_queue_t *q, elevator_t *e)
static int deadline_init(request_queue_t *q, elevator_t *e) static int deadline_init(request_queue_t *q, elevator_t *e)
{ {
struct deadline_data *dd; struct deadline_data *dd;
struct deadline_rq *drq; int i;
struct request *rq;
int i, ret = 0;
if (!drq_pool) if (!drq_pool)
return -ENOMEM; return -ENOMEM;
...@@ -724,6 +724,13 @@ static int deadline_init(request_queue_t *q, elevator_t *e) ...@@ -724,6 +724,13 @@ static int deadline_init(request_queue_t *q, elevator_t *e)
return -ENOMEM; return -ENOMEM;
} }
dd->drq_pool = mempool_create(BLKDEV_MIN_RQ, mempool_alloc_slab, mempool_free_slab, drq_pool);
if (!dd->drq_pool) {
kfree(dd->hash);
kfree(dd);
return -ENOMEM;
}
for (i = 0; i < DL_HASH_ENTRIES; i++) for (i = 0; i < DL_HASH_ENTRIES; i++)
INIT_LIST_HEAD(&dd->hash[i]); INIT_LIST_HEAD(&dd->hash[i]);
...@@ -739,33 +746,41 @@ static int deadline_init(request_queue_t *q, elevator_t *e) ...@@ -739,33 +746,41 @@ static int deadline_init(request_queue_t *q, elevator_t *e)
dd->front_merges = 1; dd->front_merges = 1;
dd->fifo_batch = fifo_batch; dd->fifo_batch = fifo_batch;
e->elevator_data = dd; e->elevator_data = dd;
return 0;
}
for (i = READ; i <= WRITE; i++) { static void deadline_put_request(request_queue_t *q, struct request *rq)
struct request_list *rl = &q->rq[i]; {
struct list_head *entry; struct deadline_data *dd = q->elevator.elevator_data;
struct deadline_rq *drq = RQ_DATA(rq);
list_for_each(entry, &rl->free) { if (drq) {
rq = list_entry_rq(entry); mempool_free(drq, dd->drq_pool);
rq->elevator_private = NULL;
}
}
drq = kmem_cache_alloc(drq_pool, GFP_KERNEL); static int
if (!drq) { deadline_set_request(request_queue_t *q, struct request *rq, int gfp_mask)
ret = -ENOMEM; {
break; struct deadline_data *dd = q->elevator.elevator_data;
} struct deadline_rq *drq;
memset(drq, 0, sizeof(*drq)); drq = mempool_alloc(dd->drq_pool, gfp_mask);
INIT_LIST_HEAD(&drq->fifo); if (drq) {
INIT_LIST_HEAD(&drq->hash); RB_CLEAR(&drq->rb_node);
RB_CLEAR(&drq->rb_node); drq->request = rq;
drq->request = rq;
rq->elevator_private = drq;
}
}
if (ret) INIT_LIST_HEAD(&drq->hash);
deadline_exit(q, e); drq->hash_valid_count = 0;
return ret; INIT_LIST_HEAD(&drq->fifo);
rq->elevator_private = drq;
return 0;
}
return 1;
} }
/* /*
...@@ -916,6 +931,8 @@ elevator_t iosched_deadline = { ...@@ -916,6 +931,8 @@ elevator_t iosched_deadline = {
.elevator_queue_empty_fn = deadline_queue_empty, .elevator_queue_empty_fn = deadline_queue_empty,
.elevator_former_req_fn = deadline_former_request, .elevator_former_req_fn = deadline_former_request,
.elevator_latter_req_fn = deadline_latter_request, .elevator_latter_req_fn = deadline_latter_request,
.elevator_set_req_fn = deadline_set_request,
.elevator_put_req_fn = deadline_put_request,
.elevator_init_fn = deadline_init, .elevator_init_fn = deadline_init,
.elevator_exit_fn = deadline_exit, .elevator_exit_fn = deadline_exit,
......
...@@ -408,6 +408,25 @@ struct request *elv_former_request(request_queue_t *q, struct request *rq) ...@@ -408,6 +408,25 @@ struct request *elv_former_request(request_queue_t *q, struct request *rq)
return NULL; return NULL;
} }
int elv_set_request(request_queue_t *q, struct request *rq, int gfp_mask)
{
elevator_t *e = &q->elevator;
if (e->elevator_set_req_fn)
return e->elevator_set_req_fn(q, rq, gfp_mask);
rq->elevator_private = NULL;
return 0;
}
void elv_put_request(request_queue_t *q, struct request *rq)
{
elevator_t *e = &q->elevator;
if (e->elevator_put_req_fn)
e->elevator_put_req_fn(q, rq);
}
int elv_register_queue(struct gendisk *disk) int elv_register_queue(struct gendisk *disk)
{ {
request_queue_t *q = disk->queue; request_queue_t *q = disk->queue;
......
This diff is collapsed.
This diff is collapsed.
...@@ -55,13 +55,17 @@ int i2c_device_remove(struct device *dev) ...@@ -55,13 +55,17 @@ int i2c_device_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver i2c_generic_driver = { static struct device_driver i2c_adapter_driver = {
.name = "i2c", .name = "i2c_adapter",
.bus = &i2c_bus_type, .bus = &i2c_bus_type,
.probe = i2c_device_probe, .probe = i2c_device_probe,
.remove = i2c_device_remove, .remove = i2c_device_remove,
}; };
static struct class i2c_adapter_class = {
.name = "i2c-adapter"
};
/* --------------------------------------------------- /* ---------------------------------------------------
* registering functions * registering functions
...@@ -94,9 +98,16 @@ int i2c_add_adapter(struct i2c_adapter *adap) ...@@ -94,9 +98,16 @@ int i2c_add_adapter(struct i2c_adapter *adap)
if (adap->dev.parent == NULL) if (adap->dev.parent == NULL)
adap->dev.parent = &legacy_bus; adap->dev.parent = &legacy_bus;
sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); sprintf(adap->dev.bus_id, "i2c-%d", adap->nr);
adap->dev.driver = &i2c_generic_driver; adap->dev.driver = &i2c_adapter_driver;
device_register(&adap->dev); device_register(&adap->dev);
/* Add this adapter to the i2c_adapter class */
memset(&adap->class_dev, 0x00, sizeof(struct class_device));
adap->class_dev.dev = &adap->dev;
adap->class_dev.class = &i2c_adapter_class;
strncpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE);
class_device_register(&adap->class_dev);
/* inform drivers of new adapters */ /* inform drivers of new adapters */
list_for_each(item,&drivers) { list_for_each(item,&drivers) {
driver = list_entry(item, struct i2c_driver, list); driver = list_entry(item, struct i2c_driver, list);
...@@ -150,6 +161,7 @@ int i2c_del_adapter(struct i2c_adapter *adap) ...@@ -150,6 +161,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
} }
/* clean up the sysfs representation */ /* clean up the sysfs representation */
class_device_unregister(&adap->class_dev);
device_unregister(&adap->dev); device_unregister(&adap->dev);
list_del(&adap->list); list_del(&adap->list);
...@@ -443,14 +455,23 @@ struct bus_type i2c_bus_type = { ...@@ -443,14 +455,23 @@ struct bus_type i2c_bus_type = {
.match = i2c_device_match, .match = i2c_device_match,
}; };
static int __init i2c_init(void) static int __init i2c_init(void)
{ {
return bus_register(&i2c_bus_type); int retval;
retval = bus_register(&i2c_bus_type);
if (retval)
return retval;
retval = driver_register(&i2c_adapter_driver);
if (retval)
return retval;
return class_register(&i2c_adapter_class);
} }
static void __exit i2c_exit(void) static void __exit i2c_exit(void)
{ {
class_unregister(&i2c_adapter_class);
driver_unregister(&i2c_adapter_driver);
bus_unregister(&i2c_bus_type); bus_unregister(&i2c_bus_type);
} }
...@@ -475,7 +496,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg msgs[],int num) ...@@ -475,7 +496,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg msgs[],int num)
return ret; return ret;
} else { } else {
dev_err(&adap->dev, "I2C level transfers not supported\n"); DEB2(dev_dbg(&adap->dev, "I2C level transfers not supported\n"));
return -ENOSYS; return -ENOSYS;
} }
} }
......
...@@ -2871,6 +2871,11 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) ...@@ -2871,6 +2871,11 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
struct atapi_capabilities_page cap; struct atapi_capabilities_page cap;
int nslots = 1; int nslots = 1;
if (drive->media == ide_optical) {
printk("%s: ATAPI magneto-optical drive\n", drive->name);
return nslots;
}
if (CDROM_CONFIG_FLAGS(drive)->nec260) { if (CDROM_CONFIG_FLAGS(drive)->nec260) {
CDROM_CONFIG_FLAGS(drive)->no_eject = 0; CDROM_CONFIG_FLAGS(drive)->no_eject = 0;
CDROM_CONFIG_FLAGS(drive)->audio_play = 1; CDROM_CONFIG_FLAGS(drive)->audio_play = 1;
...@@ -3337,7 +3342,7 @@ static int ide_cdrom_attach (ide_drive_t *drive) ...@@ -3337,7 +3342,7 @@ static int ide_cdrom_attach (ide_drive_t *drive)
goto failed; goto failed;
if (!drive->present) if (!drive->present)
goto failed; goto failed;
if (drive->media != ide_cdrom) if (drive->media != ide_cdrom && drive->media != ide_optical)
goto failed; goto failed;
/* skip drives that we were told to ignore */ /* skip drives that we were told to ignore */
if (ignore != NULL) { if (ignore != NULL) {
......
...@@ -1235,7 +1235,7 @@ struct gendisk *ata_probe(dev_t dev, int *part, void *data) ...@@ -1235,7 +1235,7 @@ struct gendisk *ata_probe(dev_t dev, int *part, void *data)
(void) request_module("ide-disk"); (void) request_module("ide-disk");
if (drive->scsi) if (drive->scsi)
(void) request_module("ide-scsi"); (void) request_module("ide-scsi");
if (drive->media == ide_cdrom) if (drive->media == ide_cdrom || drive->media == ide_optical)
(void) request_module("ide-cd"); (void) request_module("ide-cd");
if (drive->media == ide_tape) if (drive->media == ide_tape)
(void) request_module("ide-tape"); (void) request_module("ide-tape");
......
...@@ -57,7 +57,9 @@ ...@@ -57,7 +57,9 @@
#define NP_IPV6 1 /* Internet Protocol V6 */ #define NP_IPV6 1 /* Internet Protocol V6 */
#define NP_IPX 2 /* IPX protocol */ #define NP_IPX 2 /* IPX protocol */
#define NP_AT 3 /* Appletalk protocol */ #define NP_AT 3 /* Appletalk protocol */
#define NUM_NP 4 /* Number of NPs. */ #define NP_MPLS_UC 4 /* MPLS unicast */
#define NP_MPLS_MC 5 /* MPLS multicast */
#define NUM_NP 6 /* Number of NPs. */
#define MPHDRLEN 6 /* multilink protocol header length */ #define MPHDRLEN 6 /* multilink protocol header length */
#define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */
...@@ -281,6 +283,10 @@ static inline int proto_to_npindex(int proto) ...@@ -281,6 +283,10 @@ static inline int proto_to_npindex(int proto)
return NP_IPX; return NP_IPX;
case PPP_AT: case PPP_AT:
return NP_AT; return NP_AT;
case PPP_MPLS_UC:
return NP_MPLS_UC;
case PPP_MPLS_MC:
return NP_MPLS_MC;
} }
return -EINVAL; return -EINVAL;
} }
...@@ -291,6 +297,8 @@ static const int npindex_to_proto[NUM_NP] = { ...@@ -291,6 +297,8 @@ static const int npindex_to_proto[NUM_NP] = {
PPP_IPV6, PPP_IPV6,
PPP_IPX, PPP_IPX,
PPP_AT, PPP_AT,
PPP_MPLS_UC,
PPP_MPLS_MC,
}; };
/* Translates an ethertype into an NP index */ /* Translates an ethertype into an NP index */
...@@ -306,6 +314,10 @@ static inline int ethertype_to_npindex(int ethertype) ...@@ -306,6 +314,10 @@ static inline int ethertype_to_npindex(int ethertype)
case ETH_P_PPPTALK: case ETH_P_PPPTALK:
case ETH_P_ATALK: case ETH_P_ATALK:
return NP_AT; return NP_AT;
case ETH_P_MPLS_UC:
return NP_MPLS_UC;
case ETH_P_MPLS_MC:
return NP_MPLS_MC;
} }
return -1; return -1;
} }
...@@ -316,6 +328,8 @@ static const int npindex_to_ethertype[NUM_NP] = { ...@@ -316,6 +328,8 @@ static const int npindex_to_ethertype[NUM_NP] = {
ETH_P_IPV6, ETH_P_IPV6,
ETH_P_IPX, ETH_P_IPX,
ETH_P_PPPTALK, ETH_P_PPPTALK,
ETH_P_MPLS_UC,
ETH_P_MPLS_MC,
}; };
/* /*
......
...@@ -9,14 +9,11 @@ ...@@ -9,14 +9,11 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/netlink.h> #include <linux/netlink.h>
extern int x25_asy_init_ctrl_dev(void);
extern int dmascc_init(void); extern int dmascc_init(void);
extern int arcnet_init(void); extern int arcnet_init(void);
extern int scc_enet_init(void); extern int scc_enet_init(void);
extern int fec_enet_init(void); extern int fec_enet_init(void);
extern int dlci_setup(void);
extern int sdla_setup(void); extern int sdla_setup(void);
extern int sdla_c_setup(void); extern int sdla_c_setup(void);
extern int comx_init(void); extern int comx_init(void);
...@@ -51,9 +48,6 @@ static struct net_probe pci_probes[] __initdata = { ...@@ -51,9 +48,6 @@ static struct net_probe pci_probes[] __initdata = {
#if defined(CONFIG_DMASCC) #if defined(CONFIG_DMASCC)
{dmascc_init, 0}, {dmascc_init, 0},
#endif #endif
#if defined(CONFIG_DLCI)
{dlci_setup, 0},
#endif
#if defined(CONFIG_SDLA) #if defined(CONFIG_SDLA)
{sdla_c_setup, 0}, {sdla_c_setup, 0},
#endif #endif
...@@ -101,19 +95,6 @@ static void __init network_probe(void) ...@@ -101,19 +95,6 @@ static void __init network_probe(void)
} }
} }
/*
* Initialise the line discipline drivers
*/
static void __init network_ldisc_init(void)
{
#if defined(CONFIG_X25_ASY)
x25_asy_init_ctrl_dev();
#endif
}
static void __init special_device_init(void) static void __init special_device_init(void)
{ {
#ifdef CONFIG_NET_SB1000 #ifdef CONFIG_NET_SB1000
...@@ -133,11 +114,8 @@ static void __init special_device_init(void) ...@@ -133,11 +114,8 @@ static void __init special_device_init(void)
void __init net_device_init(void) void __init net_device_init(void)
{ {
/* Devices supporting the new probing API */ /* Devices supporting the new^H^H^Hold probing API */
network_probe(); network_probe();
/* Line disciplines */
network_ldisc_init();
/* Special devices */ /* Special devices */
special_device_init(); special_device_init();
/* That kicks off the legacy init functions */
} }
...@@ -539,6 +539,8 @@ static void init_dev(struct net_device *dev, u_long iobase) ...@@ -539,6 +539,8 @@ static void init_dev(struct net_device *dev, u_long iobase)
dev->header_cache_update = NULL; /* not supported */ dev->header_cache_update = NULL; /* not supported */
dev->change_mtu = NULL; /* set in fddi_setup() */ dev->change_mtu = NULL; /* set in fddi_setup() */
SET_MODULE_OWNER(dev);
/* Initialize remaining device structure information */ /* Initialize remaining device structure information */
fddi_setup(dev); fddi_setup(dev);
} // init_device } // init_device
...@@ -791,8 +793,6 @@ static int skfp_open(struct net_device *dev) ...@@ -791,8 +793,6 @@ static int skfp_open(struct net_device *dev)
smt_online(smc, 1); smt_online(smc, 1);
STI_FBI(); STI_FBI();
MOD_INC_USE_COUNT;
/* Clear local multicast address tables */ /* Clear local multicast address tables */
mac_clear_multicast(smc); mac_clear_multicast(smc);
...@@ -854,8 +854,6 @@ static int skfp_close(struct net_device *dev) ...@@ -854,8 +854,6 @@ static int skfp_close(struct net_device *dev)
dev_kfree_skb(skb); dev_kfree_skb(skb);
} }
MOD_DEC_USE_COUNT;
return (0); return (0);
} // skfp_close } // skfp_close
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/in.h> #include <linux/in.h>
#include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -577,9 +578,10 @@ int dlci_init(struct net_device *dev) ...@@ -577,9 +578,10 @@ int dlci_init(struct net_device *dev)
return(0); return(0);
} }
int __init dlci_setup(void) int __init init_dlci(void)
{ {
int i; int i;
dlci_ioctl_set(dlci_ioctl);
printk("%s.\n", version); printk("%s.\n", version);
...@@ -589,25 +591,16 @@ int __init dlci_setup(void) ...@@ -589,25 +591,16 @@ int __init dlci_setup(void)
for(i=0;i<sizeof(basename) / sizeof(char *);i++) for(i=0;i<sizeof(basename) / sizeof(char *);i++)
basename[i] = NULL; basename[i] = NULL;
return(0); return 0;
} }
#ifdef MODULE void __exit dlci_exit(void)
extern int (*dlci_ioctl_hook)(unsigned int, void *);
int init_module(void)
{ {
dlci_ioctl_hook = dlci_ioctl; dlci_ioctl_set(NULL);
return(dlci_setup());
} }
void cleanup_module(void) module_init(init_dlci);
{ module_exit(dlci_exit);
dlci_ioctl_hook = NULL;
}
#endif /* MODULE */
MODULE_AUTHOR("Mike McLagan"); MODULE_AUTHOR("Mike McLagan");
MODULE_DESCRIPTION("Frame Relay DLCI layer"); MODULE_DESCRIPTION("Frame Relay DLCI layer");
......
...@@ -46,8 +46,6 @@ int x25_asy_maxdev = SL_NRUNIT; /* Can be overridden with insmod! */ ...@@ -46,8 +46,6 @@ int x25_asy_maxdev = SL_NRUNIT; /* Can be overridden with insmod! */
MODULE_PARM(x25_asy_maxdev, "i"); MODULE_PARM(x25_asy_maxdev, "i");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static struct tty_ldisc x25_ldisc;
static int x25_asy_esc(unsigned char *p, unsigned char *d, int len); static int x25_asy_esc(unsigned char *p, unsigned char *d, int len);
static void x25_asy_unesc(struct x25_asy *sl, unsigned char c); static void x25_asy_unesc(struct x25_asy *sl, unsigned char c);
...@@ -634,8 +632,6 @@ static int x25_asy_open_tty(struct tty_struct *tty) ...@@ -634,8 +632,6 @@ static int x25_asy_open_tty(struct tty_struct *tty)
if ((err = x25_asy_open(sl->dev))) if ((err = x25_asy_open(sl->dev)))
return err; return err;
MOD_INC_USE_COUNT;
/* Done. We have linked the TTY line to a channel. */ /* Done. We have linked the TTY line to a channel. */
return sl->dev->base_addr; return sl->dev->base_addr;
} }
...@@ -664,7 +660,6 @@ static void x25_asy_close_tty(struct tty_struct *tty) ...@@ -664,7 +660,6 @@ static void x25_asy_close_tty(struct tty_struct *tty)
sl->tty = NULL; sl->tty = NULL;
x25_asy_free(sl); x25_asy_free(sl);
unregister_netdev(sl->dev); unregister_netdev(sl->dev);
MOD_DEC_USE_COUNT;
} }
...@@ -769,32 +764,29 @@ static void x25_asy_unesc(struct x25_asy *sl, unsigned char s) ...@@ -769,32 +764,29 @@ static void x25_asy_unesc(struct x25_asy *sl, unsigned char s)
/* Perform I/O control on an active X.25 channel. */ /* Perform I/O control on an active X.25 channel. */
static int x25_asy_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg) static int x25_asy_ioctl(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg)
{ {
struct x25_asy *sl = (struct x25_asy *) tty->disc_data; struct x25_asy *sl = (struct x25_asy *) tty->disc_data;
/* First make sure we're connected. */ /* First make sure we're connected. */
if (!sl || sl->magic != X25_ASY_MAGIC) { if (!sl || sl->magic != X25_ASY_MAGIC)
return -EINVAL; return -EINVAL;
}
switch(cmd)
{
case SIOCGIFNAME:
if(copy_to_user(arg, sl->dev->name, strlen(sl->dev->name) + 1))
return -EFAULT;
return 0;
case SIOCSIFHWADDR:
return -EINVAL;
/* Allow stty to read, but not set, the serial port */ switch(cmd) {
case TCGETS: case SIOCGIFNAME:
case TCGETA: if (copy_to_user((void *)arg, sl->dev->name,
return n_tty_ioctl(tty, (struct file *) file, cmd, (unsigned long) arg); strlen(sl->dev->name) + 1))
return -EFAULT;
default: return 0;
return -ENOIOCTLCMD; case SIOCSIFHWADDR:
return -EINVAL;
/* Allow stty to read, but not set, the serial port */
case TCGETS:
case TCGETA:
return n_tty_ioctl(tty, file, cmd, arg);
default:
return -ENOIOCTLCMD;
} }
} }
...@@ -806,51 +798,7 @@ static int x25_asy_open_dev(struct net_device *dev) ...@@ -806,51 +798,7 @@ static int x25_asy_open_dev(struct net_device *dev)
return 0; return 0;
} }
/* Initialize X.25 control device -- register X.25 line discipline */
int __init x25_asy_init_ctrl_dev(void)
{
int status;
if (x25_asy_maxdev < 4) x25_asy_maxdev = 4; /* Sanity */
printk(KERN_INFO "X.25 async: version 0.00 ALPHA (dynamic channels, max=%d).\n",
x25_asy_maxdev );
x25_asy_ctrls = (x25_asy_ctrl_t **) kmalloc(sizeof(void*)*x25_asy_maxdev, GFP_KERNEL);
if (x25_asy_ctrls == NULL)
{
printk("X25 async: Can't allocate x25_asy_ctrls[] array! Uaargh! (-> No X.25 available)\n");
return -ENOMEM;
}
/* Clear the pointer array, we allocate devices when we need them */
memset(x25_asy_ctrls, 0, sizeof(void*)*x25_asy_maxdev); /* Pointers */
/* Fill in our line protocol discipline, and register it */
memset(&x25_ldisc, 0, sizeof(x25_ldisc));
x25_ldisc.magic = TTY_LDISC_MAGIC;
x25_ldisc.name = "X.25";
x25_ldisc.flags = 0;
x25_ldisc.open = x25_asy_open_tty;
x25_ldisc.close = x25_asy_close_tty;
x25_ldisc.read = NULL;
x25_ldisc.write = NULL;
x25_ldisc.ioctl = (int (*)(struct tty_struct *, struct file *,
unsigned int, unsigned long)) x25_asy_ioctl;
x25_ldisc.poll = NULL;
x25_ldisc.receive_buf = x25_asy_receive_buf;
x25_ldisc.receive_room = x25_asy_receive_room;
x25_ldisc.write_wakeup = x25_asy_write_wakeup;
if ((status = tty_register_ldisc(N_X25, &x25_ldisc)) != 0) {
printk("X.25 async: can't register line discipline (err = %d)\n", status);
}
return status;
}
/* Initialise the X.25 driver. Called by the device init code */ /* Initialise the X.25 driver. Called by the device init code */
int x25_asy_init(struct net_device *dev) int x25_asy_init(struct net_device *dev)
{ {
struct x25_asy *sl = (struct x25_asy*)(dev->priv); struct x25_asy *sl = (struct x25_asy*)(dev->priv);
...@@ -885,43 +833,58 @@ int x25_asy_init(struct net_device *dev) ...@@ -885,43 +833,58 @@ int x25_asy_init(struct net_device *dev)
return 0; return 0;
} }
#ifdef MODULE
int static struct tty_ldisc x25_ldisc = {
init_module(void) .owner = THIS_MODULE,
.magic = TTY_LDISC_MAGIC,
.name = "X.25",
.open = x25_asy_open_tty,
.close = x25_asy_close_tty,
.ioctl = x25_asy_ioctl,
.receive_buf = x25_asy_receive_buf,
.receive_room = x25_asy_receive_room,
.write_wakeup = x25_asy_write_wakeup,
};
static int __init init_x25_asy(void)
{ {
return x25_asy_init_ctrl_dev(); if (x25_asy_maxdev < 4)
x25_asy_maxdev = 4; /* Sanity */
printk(KERN_INFO "X.25 async: version 0.00 ALPHA "
"(dynamic channels, max=%d).\n", x25_asy_maxdev );
x25_asy_ctrls = kmalloc(sizeof(void*)*x25_asy_maxdev, GFP_KERNEL);
if (!x25_asy_ctrls) {
printk(KERN_WARNING "X25 async: Can't allocate x25_asy_ctrls[] "
"array! Uaargh! (-> No X.25 available)\n");
return -ENOMEM;
}
memset(x25_asy_ctrls, 0, sizeof(void*)*x25_asy_maxdev); /* Pointers */
return tty_register_ldisc(N_X25, &x25_ldisc);
} }
void
cleanup_module(void) static void __exit exit_x25_asy(void)
{ {
int i; int i;
if (x25_asy_ctrls != NULL) for (i = 0; i < x25_asy_maxdev; i++) {
{ if (x25_asy_ctrls[i]) {
for (i = 0; i < x25_asy_maxdev; i++) /*
{ * VSV = if dev->start==0, then device
if (x25_asy_ctrls[i]) * unregistered while close proc.
{ */
/* if (netif_running(&(x25_asy_ctrls[i]->dev)))
* VSV = if dev->start==0, then device unregister_netdev(&(x25_asy_ctrls[i]->dev));
* unregistered while close proc.
*/ kfree(x25_asy_ctrls[i]);
if (netif_running(&(x25_asy_ctrls[i]->dev)))
unregister_netdev(&(x25_asy_ctrls[i]->dev));
kfree(x25_asy_ctrls[i]);
x25_asy_ctrls[i] = NULL;
}
} }
kfree(x25_asy_ctrls);
x25_asy_ctrls = NULL;
}
if ((i = tty_register_ldisc(N_X25, NULL)))
{
printk("X.25 async: can't unregister line discipline (err = %d)\n", i);
} }
kfree(x25_asy_ctrls);
tty_register_ldisc(N_X25, NULL);
} }
#endif /* MODULE */
module_init(init_x25_asy);
module_exit(exit_x25_asy);
...@@ -768,7 +768,7 @@ ahc_done_unlock(struct ahc_softc *ahc, unsigned long *flags) ...@@ -768,7 +768,7 @@ ahc_done_unlock(struct ahc_softc *ahc, unsigned long *flags)
} }
static __inline void static __inline void
ahc_list_lockinit() ahc_list_lockinit(void)
{ {
spin_lock_init(&ahc_list_spinlock); spin_lock_init(&ahc_list_spinlock);
} }
......
...@@ -1958,8 +1958,7 @@ write_brdctl(struct ahc_softc *ahc, uint8_t value) ...@@ -1958,8 +1958,7 @@ write_brdctl(struct ahc_softc *ahc, uint8_t value)
} }
static uint8_t static uint8_t
read_brdctl(ahc) read_brdctl(struct ahc_softc *ahc)
struct ahc_softc *ahc;
{ {
uint8_t brdctl; uint8_t brdctl;
uint8_t value; uint8_t value;
......
...@@ -91,5 +91,7 @@ source "drivers/usb/serial/Kconfig" ...@@ -91,5 +91,7 @@ source "drivers/usb/serial/Kconfig"
source "drivers/usb/misc/Kconfig" source "drivers/usb/misc/Kconfig"
source "drivers/usb/gadget/Kconfig"
endmenu endmenu
...@@ -58,3 +58,7 @@ obj-$(CONFIG_USB_SPEEDTOUCH) += misc/ ...@@ -58,3 +58,7 @@ obj-$(CONFIG_USB_SPEEDTOUCH) += misc/
obj-$(CONFIG_USB_TEST) += misc/ obj-$(CONFIG_USB_TEST) += misc/
obj-$(CONFIG_USB_TIGL) += misc/ obj-$(CONFIG_USB_TIGL) += misc/
obj-$(CONFIG_USB_USS720) += misc/ obj-$(CONFIG_USB_USS720) += misc/
obj-$(CONFIG_USB_NET2280) += gadget/
obj-$(CONFIG_USB_ZERO) += gadget/
obj-$(CONFIG_USB_ETH) += gadget/
#
# USB Gadget support on a system involves
# (a) a peripheral controller, and
# (b) the gadget driver using it.
#
# for 2.5 kbuild, drivers/usb/gadget/Kconfig
# source this at the end of drivers/usb/Kconfig
#
menuconfig USB_GADGET
tristate "Support for USB Gadgets"
depends on EXPERIMENTAL
help
USB is a master/slave protocol, organized with with one master
host (such as a PC) controlling up to 127 peripheral devices.
The USB hardware is asymmetric, which makes it easier to set up:
you can't connect two "to-the-host" connectors to each other.
Linux can run in the host, or in the peripheral. In both cases
you need a low level bus controller driver, and some software
talking to it. Peripheral controllers are often discrete silicon,
or are integrated with the CPU in a microcontroller. The more
familiar host side controllers have names like like "EHCI", "OHCI",
or "UHCI", and are usually integrated into southbridges on PC
motherboards.
Enable this configuration option if you want to run Linux inside
a USB peripheral device. Configure one hardware driver for your
peripheral/device side bus controller, and a "gadget driver" for
your peripheral protocol. (If you use modular gadget drivers,
you may configure more than one.)
If in doubt, say "N" and don't enable these drivers; most people
don't have this kind of hardware (except maybe inside Linux PDAs).
#
# USB Peripheral Controller Support
#
# FIXME convert to tristate choice when "choice" behaves as specified
#
comment "USB Peripheral Controller Support"
depends on USB_GADGET
config USB_NET2280
tristate "NetChip 2280 USB Peripheral Controller"
depends on PCI && USB_GADGET
help
NetChip 2280 is a PCI based USB peripheral controller which
supports both full and high speed USB 2.0 data transfers.
It has six configurable endpoints, as well as endpoint zero
(for control transfers) and several endpoints with dedicated
functions.
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "net2280" and force all
gadget drivers to also be dynamically linked.
#
# USB Gadget Drivers
#
# FIXME only one of these may be statically linked; choice/endchoice.
#
comment "USB Gadget Drivers"
depends on USB_GADGET
# FIXME want better dependency/config approach for drivers. with only
# two knobs to tweak (driver y/m/n, and a hardware symbol) there's no
# good excuse for Kconfig to cause such trouble here. there are clear
# bugs (coredumps, multiple choices enabled, and more) in its (boolean)
# "choice" logic too ...
config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)"
depends on USB_GADGET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA250 || USB_SA1100)
help
Gadget Zero is a two-configuration device. It either sinks and
sources bulk data; or it loops back a configurable number of
transfers. It also implements control requests, for "chapter 9"
conformance. The driver needs only two bulk-capable endpoints, so
it can work on top of most device-side usb controllers. It's
useful for testing, and is also a working example showing how
USB "gadget drivers" can be written.
Make this be the first driver you try using on top of any new
USB peripheral controller driver. Then you can use host-side
test software, like the "usbtest" driver, to put your hardware
and its driver through a basic set of functional tests.
Gadget Zero also works with the host-side "usb-skeleton" driver,
and with many kinds of host-side test software. You may need
to tweak product and vendor IDs before host software knows about
this device, and arrange to select an appropriate configuration.
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "g_zero".
config USB_ZERO_NET2280
bool
# for now, treat the "dummy" hcd as if it were a net2280
depends on USB_ZERO && (USB_NET2280 || USB_DUMMY_HCD)
default y
config USB_ZERO_PXA250
bool
depends on USB_ZERO && USB_PXA250
default y
config USB_ZERO_SA1100
bool
depends on USB_ZERO && USB_SA1100
default y
config USB_ETH
tristate "Ethernet Gadget"
depends on USB_GADGET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA250 || USB_SA1100)
help
This driver implements the "Communication Device Class" (CDC)
Ethernet Control Model. That protocol is often avoided with pure
Ethernet adapters, in favor of simpler vendor-specific hardware,
but is widely supported by firmware for smart network devices.
Within the USB device, this gadget driver exposes a network device
"usbX", where X depends on what other networking devices you have.
Treat it like a two-node Ethernet link: host, and gadget.
The Linux-USB host-side "usbnet" driver interoperates with this
driver, so that deep I/O queues can be supported. (On 2.4 kernels,
use "CDCEther" instead.) Deep queues are especially important with
high speed devices. It should also interoperate with standard CDC
Ethernet class drivers on other host operating systems.
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "g_ether".
config USB_ETH_NET2280
bool
# for now, treat the "dummy" hcd as if it were a net2280
depends on USB_ETH && (USB_NET2280 || USB_DUMMY_HCD)
default y
config USB_ETH_PXA250
bool
depends on USB_ETH && USB_PXA250
default y
config USB_ETH_SA1100
bool
depends on USB_ETH && USB_SA1100
default y
# endmenuconfig
#
# USB peripheral controller drivers
#
obj-$(CONFIG_USB_NET2280) += net2280.o
#
# USB gadget drivers
#
g_zero-objs := zero.o usbstring.o
g_ether-objs := ether.o usbstring.o
obj-$(CONFIG_USB_ZERO) += g_zero.o
obj-$(CONFIG_USB_ETH) += g_ether.o
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2003 David Brownell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*/
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/string.h>
#include <linux/device.h>
#include <linux/usb_ch9.h>
#include <linux/usb_gadget.h>
/**
* usb_gadget_get_string - fill out a string descriptor
* @table: of c strings using iso latin/1 characters
* @id: string id, from low byte of wValue in get string descriptor
* @buf: at least 256 bytes
*
* Finds the iso latin/1 string matching the ID, and converts it into a
* string descriptor in utf16-le.
* Returns length of descriptor (always even) or negative errno
*
* If your driver needs stings in multiple languages, you'll need to
* to use some alternate solution for languages where the ISO 8859/1
* (latin/1) character set can't be used. For example, they can't be
* used with Chinese (Big5, GB2312, etc), Japanese, Korean, or many other
* languages. You'd likely "switch (wIndex) { ... }" in your ep0
* string descriptor logic, using this routine in cases where "western
* european" characters suffice for the strings being returned.
*/
int
usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf)
{
struct usb_string *s;
int len;
/* descriptor 0 has the language id */
if (id == 0) {
buf [0] = 4;
buf [1] = USB_DT_STRING;
buf [2] = (u8) table->language;
buf [3] = (u8) (table->language >> 8);
return 4;
}
for (s = table->strings; s && s->s; s++)
if (s->id == id)
break;
/* unrecognized: stall. */
if (!s || !s->s)
return -EINVAL;
/* string descriptors have length, tag, then UTF16-LE text */
len = min ((size_t) 126, strlen (s->s));
buf [0] = (len + 1) * 2;
buf [1] = USB_DT_STRING;
memset (buf + 2, 0, 2 * len); /* zero all the high bytes */
while (len) {
buf [2 * len] = s->s [len - 1];
len--;
}
return buf [0];
}
This diff is collapsed.
...@@ -728,6 +728,7 @@ void bio_endio(struct bio *bio, unsigned int bytes_done, int error) ...@@ -728,6 +728,7 @@ void bio_endio(struct bio *bio, unsigned int bytes_done, int error)
} }
bio->bi_size -= bytes_done; bio->bi_size -= bytes_done;
bio->bi_sector += (bytes_done >> 9);
if (bio->bi_end_io) if (bio->bi_end_io)
bio->bi_end_io(bio, bytes_done, error); bio->bi_end_io(bio, bytes_done, error);
......
...@@ -87,15 +87,15 @@ extern int restore_i387( struct _fpstate __user *buf ); ...@@ -87,15 +87,15 @@ extern int restore_i387( struct _fpstate __user *buf );
/* /*
* ptrace request handers... * ptrace request handers...
*/ */
extern int get_fpregs( struct user_i387_struct *buf, extern int get_fpregs( struct user_i387_struct __user *buf,
struct task_struct *tsk ); struct task_struct *tsk );
extern int set_fpregs( struct task_struct *tsk, extern int set_fpregs( struct task_struct *tsk,
struct user_i387_struct *buf ); struct user_i387_struct __user *buf );
extern int get_fpxregs( struct user_fxsr_struct *buf, extern int get_fpxregs( struct user_fxsr_struct __user *buf,
struct task_struct *tsk ); struct task_struct *tsk );
extern int set_fpxregs( struct task_struct *tsk, extern int set_fpxregs( struct task_struct *tsk,
struct user_fxsr_struct *buf ); struct user_fxsr_struct __user *buf );
/* /*
* FPU state for core dumps... * FPU state for core dumps...
......
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.
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.
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.
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.
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.
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.
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.
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.
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