Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77160
b: refs/heads/master
c: a3d2c2e
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Jan 23, 2008
1 parent bcd842a commit e021027
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a43cf0f3511585493e3c948f7ec62f659486d0b3
refs/heads/master: a3d2c2e8f5e01e185013d8f944c0a26fdc558ad8
22 changes: 15 additions & 7 deletions trunk/drivers/scsi/ch.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,29 +913,37 @@ static long ch_ioctl_compat(struct file * file,
static int ch_probe(struct device *dev)
{
struct scsi_device *sd = to_scsi_device(dev);
struct class_device *class_dev;
scsi_changer *ch;

if (sd->type != TYPE_MEDIUM_CHANGER)
return -ENODEV;

ch = kzalloc(sizeof(*ch), GFP_KERNEL);
if (NULL == ch)
return -ENOMEM;

ch->minor = ch_devcount;
sprintf(ch->name,"ch%d",ch->minor);

class_dev = class_device_create(ch_sysfs_class, NULL,
MKDEV(SCSI_CHANGER_MAJOR, ch->minor),
dev, "s%s", ch->name);
if (IS_ERR(class_dev)) {
printk(KERN_WARNING "ch%d: class_device_create failed\n",
ch->minor);
kfree(ch);
return PTR_ERR(class_dev);
}

mutex_init(&ch->lock);
ch->device = sd;
ch_readconfig(ch);
if (init)
ch_init_elem(ch);

class_device_create(ch_sysfs_class, NULL,
MKDEV(SCSI_CHANGER_MAJOR,ch->minor),
dev, "s%s", ch->name);

sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name);

spin_lock(&ch_devlist_lock);
list_add_tail(&ch->list,&ch_devlist);
ch_devcount++;
Expand Down

0 comments on commit e021027

Please sign in to comment.