/* The base I/O address of the Sony Interface. This is a variable (not a
#define) so it can be easily changed via some future ioctl() */
static unsigned int sony535_cd_base_io = CDU535_ADDRESS;
-MODULE_PARM(sony535_cd_base_io, "i");
+module_param(sony535_cd_base_io, int, 0);
/*
* The following are I/O addresses of the various registers for the drive. The
static unsigned short read_status_reg;
static unsigned short data_reg;
-static spinlock_t sonycd535_lock = SPIN_LOCK_UNLOCKED; /* queue lock */
+static DEFINE_SPINLOCK(sonycd535_lock); /* queue lock */
static struct request_queue *sonycd535_queue;
static int initialized; /* Has the drive been initialized? */
}
static irqreturn_t
-cdu535_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+cdu535_interrupt(int irq, void *dev_id)
{
disable_interrupts();
if (waitqueue_active(&cdu535_irq_wait)) {
* (not BCD), so all the conversions are done.
*/
static int
-sony_get_subchnl_info(long arg)
+sony_get_subchnl_info(void __user *arg)
{
struct cdrom_subchnl schi;
if (!sony_toc_read) {
return -EIO;
}
- if (copy_from_user(&schi, (char *)arg, sizeof schi))
+ if (copy_from_user(&schi, arg, sizeof schi))
return -EFAULT;
switch (sony_audio_status) {
case CDROM_AUDIO_NO_STATUS:
schi.cdsc_audiostatus = sony_audio_status;
- if (copy_to_user((char *)arg, &schi, sizeof schi))
+ if (copy_to_user(arg, &schi, sizeof schi))
return -EFAULT;
return 0;
break;
schi.cdsc_absaddr.lba = msf_to_log(last_sony_subcode->abs_msf);
schi.cdsc_reladdr.lba = msf_to_log(last_sony_subcode->rel_msf);
}
- return copy_to_user((char *)arg, &schi, sizeof schi) ? -EFAULT : 0;
+ return copy_to_user(arg, &schi, sizeof schi) ? -EFAULT : 0;
}
Byte cmd_buff[10], params[10];
int i;
int dsc_status;
+ void __user *argp = (void __user *)arg;
if (check_drive_status() != 0)
return -EIO;
break;
case CDROMPLAYMSF: /* Play starting at the given MSF address. */
- if (copy_from_user(params, (void *)arg, 6))
+ if (copy_from_user(params, argp, 6))
return -EFAULT;
spin_up_drive(status);
set_drive_mode(SONY535_AUDIO_DRIVE_MODE, status);
case CDROMREADTOCHDR: /* Read the table of contents header */
{
- struct cdrom_tochdr *hdr;
+ struct cdrom_tochdr __user *hdr = argp;
struct cdrom_tochdr loc_hdr;
sony_get_toc();
if (!sony_toc_read)
return -EIO;
- hdr = (struct cdrom_tochdr *)arg;
loc_hdr.cdth_trk0 = bcd_to_int(sony_toc->first_track_num);
loc_hdr.cdth_trk1 = bcd_to_int(sony_toc->last_track_num);
if (copy_to_user(hdr, &loc_hdr, sizeof *hdr))
case CDROMREADTOCENTRY: /* Read a given table of contents entry */
{
- struct cdrom_tocentry *entry;
+ struct cdrom_tocentry __user *entry = argp;
struct cdrom_tocentry loc_entry;
int track_idx;
Byte *msf_val = NULL;
if (!sony_toc_read) {
return -EIO;
}
- entry = (struct cdrom_tocentry *)arg;
if (copy_from_user(&loc_entry, entry, sizeof loc_entry))
return -EFAULT;
if (!sony_toc_read)
return -EIO;
- if (copy_from_user(&ti, (char *)arg, sizeof ti))
+ if (copy_from_user(&ti, argp, sizeof ti))
return -EFAULT;
if ((ti.cdti_trk0 < sony_toc->first_track_num)
|| (sony_toc->last_track_num < ti.cdti_trk0)
}
case CDROMSUBCHNL: /* Get subchannel info */
- return sony_get_subchnl_info(arg);
+ return sony_get_subchnl_info(argp);
case CDROMVOLCTRL: /* Volume control. What volume does this change, anyway? */
{
struct cdrom_volctrl volctrl;
- if (copy_from_user(&volctrl, (char *)arg,
- sizeof volctrl))
+ if (copy_from_user(&volctrl, argp, sizeof volctrl))
return -EFAULT;
cmd_buff[0] = SONY535_SET_VOLUME;
cmd_buff[1] = volctrl.channel0;
/* look for the CD-ROM, follows the procedure in the DOS driver */
inb(select_unit_reg);
/* wait for 40 18 Hz ticks (reverse-engineered from DOS driver) */
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout((HZ+17)*40/18);
+ schedule_timeout_interruptible((HZ+17)*40/18);
inb(result_reg);
outb(0, read_status_reg); /* does a reset? */
}
if (sony535_irq_used > 0) {
if (request_irq(sony535_irq_used, cdu535_interrupt,
- SA_INTERRUPT, CDU535_HANDLE, NULL)) {
+ IRQF_DISABLED, CDU535_HANDLE, NULL)) {
printk("Unable to grab IRQ%d for the " CDU535_MESSAGE_NAME
" driver; polling instead.\n", sony535_irq_used);
sony535_irq_used = 0;
cdu_disk->first_minor = 0;
cdu_disk->fops = &cdu_fops;
sprintf(cdu_disk->disk_name, "cdu");
- sprintf(cdu_disk->devfs_name, "cdu535");
if (!request_region(sony535_cd_base_io, 4, CDU535_HANDLE)) {
printk(KERN_WARNING"sonycd535: Unable to request region 0x%x\n",
put_disk(cdu_disk);
out6:
for (i = 0; i < sony_buffer_sectors; i++)
- if (sony_buffer[i])
- kfree(sony_buffer[i]);
+ kfree(sony_buffer[i]);
out5:
kfree(sony_buffer);
out4: