Commit 16d6f850 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] kdev_t search/replaces.

First batch of various kdev_t related changes that have accumulated on
linux-kernel, and some that got sent directly to me after you dropped them.

Some of these need additional fixes to make them work, Some of them
even to make them compile, but this is one step forward..

I have bio-related fixes for some of these also, I'll push those seperately.
parent 9c0c830c
......@@ -746,7 +746,7 @@ static void request_done(int uptodate)
/* Yep - a partial access */
/* and issue the remainder */
issue_request(MINOR(CURRENT->rq_dev), PartFragRead_RestartBlock, PartFragRead_SectorsLeft, CURRENT);
issue_request(minor(CURRENT->rq_dev), PartFragRead_RestartBlock, PartFragRead_SectorsLeft, CURRENT);
return;
}
......@@ -929,7 +929,7 @@ static void mfm_request(void)
DBG("mfm_request: before arg extraction\n");
dev = MINOR(CURRENT->rq_dev);
dev = minor(CURRENT->rq_dev);
block = CURRENT->sector;
nsect = CURRENT->nr_sectors;
#ifdef DEBUG
......@@ -1187,10 +1187,10 @@ static int mfm_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long a
if (!inode || !(dev = inode->i_rdev))
return -EINVAL;
major = MAJOR(dev);
minor = MINOR(dev);
major = major(dev);
minor = minor(dev);
device = DEVICE_NR(MINOR(inode->i_rdev)), err;
device = DEVICE_NR(minor(inode->i_rdev)), err;
if (device >= mfm_drives)
return -EINVAL;
......@@ -1231,7 +1231,7 @@ static int mfm_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long a
static int mfm_open(struct inode *inode, struct file *file)
{
int dev = DEVICE_NR(MINOR(inode->i_rdev));
int dev = DEVICE_NR(minor(inode->i_rdev));
if (dev >= mfm_drives)
return -ENODEV;
......@@ -1249,7 +1249,7 @@ static int mfm_open(struct inode *inode, struct file *file)
*/
static int mfm_release(struct inode *inode, struct file *file)
{
mfm_info[DEVICE_NR(MINOR(inode->i_rdev))].access_count--;
mfm_info[DEVICE_NR(minor(inode->i_rdev))].access_count--;
return 0;
}
......@@ -1270,7 +1270,7 @@ void mfm_setup(char *str, int *ints)
void xd_set_geometry(kdev_t dev, unsigned char secsptrack, unsigned char heads,
unsigned long discsize, unsigned int secsize)
{
int drive = MINOR(dev) >> 6;
int drive = minor(dev) >> 6;
if (mfm_info[drive].cylinders == 1) {
mfm_info[drive].sectors = secsptrack;
......@@ -1338,7 +1338,7 @@ static void mfm_geninit (void)
for (i = 0; i < mfm_drives; i++) {
mfm_geometry (i);
register_disk(&mfm_gendisk, MKDEV(MAJOR_NR,i<<6), 1<<6,
register_disk(&mfm_gendisk, mk_kdev(MAJOR_NR,i<<6), 1<<6,
&mfm_fops,
mfm_info[i].cylinders * mfm_info[i].heads *
mfm_info[i].sectors / 2);
......@@ -1448,7 +1448,7 @@ int mfm_init (void)
*/
static int mfm_reread_partitions(kdev_t dev)
{
unsigned int start, i, maxp, target = DEVICE_NR(MINOR(dev));
unsigned int start, i, maxp, target = DEVICE_NR(minor(dev));
unsigned long flags;
local_irq_save(flags);
......@@ -1464,7 +1464,7 @@ static int mfm_reread_partitions(kdev_t dev)
for (i = maxp - 1; i >= 0; i--) {
int minor = start + i;
invalidate_device (MKDEV(MAJOR_NR, minor), 1);
invalidate_device (mk_kdev(MAJOR_NR, minor), 1);
mfm_gendisk.part[minor].start_sect = 0;
mfm_gendisk.part[minor].nr_sects = 0;
}
......
......@@ -2074,7 +2074,7 @@ extern int DAC960_KernelIOCTL(unsigned int Request, void *Argument);
#define DAC960_KernelDevice(ControllerNumber, \
LogicalDriveNumber, \
PartitionNumber) \
MKDEV(DAC960_MajorNumber(ControllerNumber), \
mk_kdev(DAC960_MajorNumber(ControllerNumber), \
DAC960_MinorNumber(LogicalDriveNumber, PartitionNumber))
......
......@@ -784,7 +784,7 @@ static void read_intr( void )
status = acsi_getstatus();
if (status != 0) {
int dev = DEVICE_NR(MINOR(CURRENT->rq_dev));
int dev = DEVICE_NR(minor(CURRENT->rq_dev));
printk( KERN_ERR "ad%c: ", dev+'a' );
if (!acsi_reqsense( acsi_buffer, acsi_info[dev].target,
acsi_info[dev].lun))
......@@ -815,7 +815,7 @@ static void write_intr(void)
status = acsi_getstatus();
if (status != 0) {
int dev = DEVICE_NR(MINOR(CURRENT->rq_dev));
int dev = DEVICE_NR(minor(CURRENT->rq_dev));
printk( KERN_ERR "ad%c: ", dev+'a' );
if (!acsi_reqsense( acsi_buffer, acsi_info[dev].target,
acsi_info[dev].lun))
......@@ -993,7 +993,7 @@ static void redo_acsi_request( void )
panic(DEVICE_NAME ": block not locked");
}
dev = MINOR(CURRENT->rq_dev);
dev = minor(CURRENT->rq_dev);
block = CURRENT->sector;
if (DEVICE_NR(dev) >= NDevices ||
block+CURRENT->nr_sectors >= acsi_part[dev].nr_sects) {
......@@ -1111,7 +1111,7 @@ static int acsi_ioctl( struct inode *inode, struct file *file,
if (!inode)
return -EINVAL;
dev = DEVICE_NR(MINOR(inode->i_rdev));
dev = DEVICE_NR(minor(inode->i_rdev));
if (dev >= NDevices)
return -EINVAL;
switch (cmd) {
......@@ -1174,7 +1174,7 @@ static int acsi_open( struct inode * inode, struct file * filp )
int device;
struct acsi_info_struct *aip;
device = DEVICE_NR(MINOR(inode->i_rdev));
device = DEVICE_NR(minor(inode->i_rdev));
if (device >= NDevices)
return -ENXIO;
aip = &acsi_info[device];
......@@ -1212,7 +1212,7 @@ static int acsi_open( struct inode * inode, struct file * filp )
static int acsi_release( struct inode * inode, struct file * file )
{
int device = DEVICE_NR(MINOR(inode->i_rdev));
int device = DEVICE_NR(minor(inode->i_rdev));
if (--access_count[device] == 0 && acsi_info[device].removable)
acsi_prevent_removal(device, 0);
return( 0 );
......@@ -1240,7 +1240,7 @@ static void acsi_prevent_removal(int device, int flag)
static int acsi_media_change (dev_t dev)
{
int device = DEVICE_NR(MINOR(dev));
int device = DEVICE_NR(minor(dev));
struct acsi_info_struct *aip;
aip = &acsi_info[device];
......@@ -1742,7 +1742,7 @@ static void acsi_geninit(void)
acsi_blocksizes[i] = 1024;
blksize_size[MAJOR_NR] = acsi_blocksizes;
for( i = 0; i < NDevices; ++i )
register_disk(&acsi_gendisk, MKDEV(MAJOR_NR,i<<4),
register_disk(&acsi_gendisk, mk_kdev(MAJOR_NR,i<<4),
(acsi_info[i].type==HARDDISK)?1<<4:1,
&acsi_fops,
acsi_info[i].size);
......@@ -1853,7 +1853,7 @@ static int revalidate_acsidisk( int dev, int maxusage )
int res;
struct acsi_info_struct *aip;
device = DEVICE_NR(MINOR(dev));
device = DEVICE_NR(minor(dev));
aip = &acsi_info[device];
gdev = &GENDISK_STRUCT;
......
......@@ -659,7 +659,7 @@ static int do_format(kdev_t device, struct atari_format_descr *desc)
unsigned char *p;
int sect, nsect;
unsigned long flags;
int type, drive = MINOR(device) & 3;
int type, drive = minor(device) & 3;
DPRINT(("do_format( dr=%d tr=%d he=%d offs=%d )\n",
drive, desc->track, desc->head, desc->sect_offset ));
......@@ -672,7 +672,7 @@ static int do_format(kdev_t device, struct atari_format_descr *desc)
atari_turnon_irq( IRQ_MFP_FDC ); /* should be already, just to be sure */
restore_flags(flags);
type = MINOR(device) >> 2;
type = minor(device) >> 2;
if (type) {
if (--type >= NUM_DISK_MINORS ||
minor2disktype[type].drive_types > DriveType) {
......@@ -1367,9 +1367,9 @@ static void floppy_off( unsigned int nr) {}
static int check_floppy_change (kdev_t dev)
{
unsigned int drive = MINOR(dev) & 0x03;
unsigned int drive = minor(dev) & 0x03;
if (MAJOR(dev) != MAJOR_NR) {
if (major(dev) != MAJOR_NR) {
printk(KERN_ERR "floppy_changed: not a floppy\n");
return 0;
}
......@@ -1394,7 +1394,7 @@ static int check_floppy_change (kdev_t dev)
static int floppy_revalidate (kdev_t dev)
{
int drive = MINOR(dev) & 3;
int drive = minor(dev) & 3;
if (test_bit(drive, &changed_floppies) ||
test_bit(drive, &fake_change) ||
......@@ -1466,13 +1466,13 @@ static void redo_fd_request(void)
if (QUEUE_EMPTY)
goto the_end;
if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)
if (major(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed");
if (CURRENT->bh && !buffer_locked(CURRENT->bh))
panic(DEVICE_NAME ": block not locked");
device = MINOR(CURRENT_DEVICE);
device = minor(CURRENT_DEVICE);
drive = device & 3;
type = device >> 2;
......@@ -1553,7 +1553,7 @@ static int invalidate_drive(kdev_t rdev)
{
/* invalidate the buffer track to force a reread */
BufferDrive = -1;
set_bit(MINOR(rdev) & 3, &fake_change);
set_bit(minor(rdev) & 3, &fake_change);
check_disk_change(rdev);
return 0;
}
......@@ -1576,7 +1576,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
case BLKFLSBUF:
return blk_ioctl(device, cmd, param);
}
drive = MINOR (device);
drive = minor (device);
type = drive >> 2;
drive &= 3;
switch (cmd) {
......@@ -1896,15 +1896,15 @@ static int floppy_open( struct inode *inode, struct file *filp )
return -EIO;
}
drive = MINOR(inode->i_rdev) & 3;
type = MINOR(inode->i_rdev) >> 2;
drive = minor(inode->i_rdev) & 3;
type = minor(inode->i_rdev) >> 2;
DPRINT(("fd_open: type=%d\n",type));
if (drive >= FD_MAX_UNITS || type > NUM_DISK_MINORS)
return -ENXIO;
old_dev = fd_device[drive];
if (fd_ref[drive] && old_dev != MINOR(inode->i_rdev))
if (fd_ref[drive] && old_dev != minor(inode->i_rdev))
return -EBUSY;
if (fd_ref[drive] == -1 || (fd_ref[drive] && filp->f_flags & O_EXCL))
......@@ -1915,10 +1915,10 @@ static int floppy_open( struct inode *inode, struct file *filp )
else
fd_ref[drive]++;
fd_device[drive] = MINOR(inode->i_rdev);
fd_device[drive] = minor(inode->i_rdev);
if (old_dev && old_dev != MINOR(inode->i_rdev))
invalidate_buffers(MKDEV(FLOPPY_MAJOR, old_dev));
if (old_dev && old_dev != minor(inode->i_rdev))
invalidate_buffers(mk_kdev(FLOPPY_MAJOR, old_dev));
if (filp->f_flags & O_NDELAY)
return 0;
......@@ -1939,7 +1939,7 @@ static int floppy_open( struct inode *inode, struct file *filp )
static int floppy_release( struct inode * inode, struct file * filp )
{
int drive = MINOR(inode->i_rdev) & 3;
int drive = minor(inode->i_rdev) & 3;
if (fd_ref[drive] < 0)
fd_ref[drive] = 0;
......
......@@ -70,7 +70,7 @@ static unsigned int ataraiduse;
static int ataraid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
int minor;
minor = MINOR(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev)>>SHIFT;
if ((ataraid_ops[minor])&&(ataraid_ops[minor]->ioctl))
return (ataraid_ops[minor]->ioctl)(inode,file,cmd,arg);
......@@ -80,7 +80,7 @@ static int ataraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
static int ataraid_open(struct inode * inode, struct file * filp)
{
int minor;
minor = MINOR(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev)>>SHIFT;
if ((ataraid_ops[minor])&&(ataraid_ops[minor]->open))
return (ataraid_ops[minor]->open)(inode,filp);
......@@ -91,7 +91,7 @@ static int ataraid_open(struct inode * inode, struct file * filp)
static int ataraid_release(struct inode * inode, struct file * filp)
{
int minor;
minor = MINOR(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev)>>SHIFT;
if ((ataraid_ops[minor])&&(ataraid_ops[minor]->release))
return (ataraid_ops[minor]->release)(inode,filp);
......@@ -102,7 +102,7 @@ static int ataraid_make_request (request_queue_t *q, int rw, struct buffer_head
{
int minor;
int retval;
minor = MINOR(bh->b_rdev)>>SHIFT;
minor = minor(bh->b_rdev)>>SHIFT;
if ((ataraid_ops[minor])&&(ataraid_ops[minor]->make_request)) {
......@@ -229,7 +229,7 @@ void ataraid_release_device(int device)
void ataraid_register_disk(int device,long size)
{
register_disk(&ataraid_gendisk, MKDEV(ATAMAJOR,16*device),16,
register_disk(&ataraid_gendisk, mk_kdev(ATAMAJOR,16*device),16,
&ataraid_fops,size);
}
......
......@@ -558,7 +558,7 @@ static void hd_request(void)
reset_hd();
return;
}
dev = MINOR(CURRENT->rq_dev);
dev = minor(CURRENT->rq_dev);
block = CURRENT->sector;
nsect = CURRENT->nr_sectors;
if (dev >= (NR_HD<<6) || (dev & 0x3f) ||
......@@ -568,7 +568,7 @@ static void hd_request(void)
kdevname(CURRENT->rq_dev));
else
printk("hd%c: bad access: block=%d, count=%d\n",
(MINOR(CURRENT->rq_dev)>>6)+'a', block, nsect);
(minor(CURRENT->rq_dev)>>6)+'a', block, nsect);
end_request(0);
goto repeat;
}
......@@ -626,7 +626,7 @@ static int hd_ioctl(struct inode * inode, struct file * file,
struct hd_geometry *loc = (struct hd_geometry *) arg;
int dev;
if ((!inode) || !(inode->i_rdev))
if ((!inode) || kdev_none(inode->i_rdev))
return -EINVAL;
dev = DEVICE_NR(inode->i_rdev);
if (dev >= NR_HD)
......@@ -822,7 +822,7 @@ static void __init hd_geninit(void)
hd_gendisk.nr_real = NR_HD;
for(drive=0; drive < NR_HD; drive++)
register_disk(&hd_gendisk, MKDEV(MAJOR_NR,drive<<6), 1<<6,
register_disk(&hd_gendisk, mk_kdev(MAJOR_NR,drive<<6), 1<<6,
&hd_fops, hd_info[drive].head * hd_info[drive].sect *
hd_info[drive].cyl);
}
......
......@@ -75,16 +75,16 @@ static int hptraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
unsigned char val;
unsigned long sectors;
if (!inode || !inode->i_rdev)
if (!inode || kdev_none(inode->i_rdev))
return -EINVAL;
minor = MINOR(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev)>>SHIFT;
switch (cmd) {
case BLKGETSIZE: /* Return device size */
if (!arg) return -EINVAL;
sectors = ataraid_gendisk.part[MINOR(inode->i_rdev)].nr_sects;
if (MINOR(inode->i_rdev)&15)
sectors = ataraid_gendisk.part[minor(inode->i_rdev)].nr_sects;
if (minor(inode->i_rdev)&15)
return put_user(sectors, (unsigned long *) arg);
return put_user(raid[minor].sectors , (unsigned long *) arg);
break;
......@@ -102,7 +102,7 @@ static int hptraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
if (put_user(val, (byte *) &loc->sectors)) return -EFAULT;
bios_cyl = raid[minor].sectors/63/255;
if (put_user(bios_cyl, (unsigned short *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)ataraid_gendisk.part[MINOR(inode->i_rdev)].start_sect,
if (put_user((unsigned)ataraid_gendisk.part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
return 0;
}
......@@ -118,7 +118,7 @@ static int hptraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
if (put_user(val, (byte *) &loc->sectors)) return -EFAULT;
bios_cyl = raid[minor].sectors/63/255;
if (put_user(bios_cyl, (unsigned int *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)ataraid_gendisk.part[MINOR(inode->i_rdev)].start_sect,
if (put_user((unsigned)ataraid_gendisk.part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
return 0;
}
......@@ -167,7 +167,7 @@ static int hptraid_make_request (request_queue_t *q, int rw, struct buffer_head
/* Partitions need adding of the start sector of the partition to the requested sector */
rsect += ataraid_gendisk.part[MINOR(bh->b_rdev)].start_sect;
rsect += ataraid_gendisk.part[minor(bh->b_rdev)].start_sect;
/* Woops we need to split the request to avoid crossing a stride barrier */
if ((rsect/thisraid->stride) != ((rsect+(bh->b_size/512)-1)/thisraid->stride)) {
......@@ -248,7 +248,7 @@ static unsigned long maxsectors (int major,int minor)
kdev_t dev;
ide_drive_t *ideinfo;
dev = MKDEV(major,minor);
dev = mk_kdev(major,minor);
ideinfo = get_info_ptr (dev);
if (ideinfo==NULL)
return 0;
......@@ -268,7 +268,7 @@ static struct highpoint_raid_conf __initdata prom;
static void __init probedisk(int major, int minor,int device)
{
int i;
struct block_device *bdev = bdget(MKDEV(major,minor));
struct block_device *bdev = bdget(mk_kdev(major,minor));
struct gendisk *gd;
if (!bdev)
......@@ -301,14 +301,14 @@ static void __init probedisk(int major, int minor,int device)
/* now blank the /proc/partitions table for the wrong partition table,
so that scripts don't accidentally mount it and crash the kernel */
/* XXX: the 0 is an utter hack --hch */
gd=get_gendisk(MKDEV(major, 0));
gd=get_gendisk(mk_kdev(major, 0));
if (gd!=NULL) {
int j;
for (j=1+(minor<<gd->minor_shift);j<((minor+1)<<gd->minor_shift);j++)
gd->part[j].nr_sects=0;
}
raid[device].disk[i].device = MKDEV(major,minor);
raid[device].disk[i].device = mk_kdev(major,minor);
raid[device].disk[i].sectors = maxsectors(major,minor);
raid[device].stride = (1<<prom.raid0_shift);
raid[device].disks = prom.raid_disks;
......
......@@ -102,17 +102,17 @@ static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
unsigned int minor;
unsigned long sectors;
if (!inode || !inode->i_rdev)
if (!inode || kdev_none(inode->i_rdev))
return -EINVAL;
minor = MINOR(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev)>>SHIFT;
switch (cmd) {
case BLKGETSIZE: /* Return device size */
if (!arg) return -EINVAL;
sectors = ataraid_gendisk.part[MINOR(inode->i_rdev)].nr_sects;
if (MINOR(inode->i_rdev)&15)
sectors = ataraid_gendisk.part[minor(inode->i_rdev)].nr_sects;
if (minor(inode->i_rdev)&15)
return put_user(sectors, (unsigned long *) arg);
return put_user(raid[minor].sectors , (unsigned long *) arg);
break;
......@@ -127,7 +127,7 @@ static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
if (put_user(raid[minor].geom.heads, (byte *) &loc->heads)) return -EFAULT;
if (put_user(raid[minor].geom.sectors, (byte *) &loc->sectors)) return -EFAULT;
if (put_user(bios_cyl, (unsigned short *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)ataraid_gendisk.part[MINOR(inode->i_rdev)].start_sect,
if (put_user((unsigned)ataraid_gendisk.part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
return 0;
}
......@@ -139,7 +139,7 @@ static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
if (put_user(raid[minor].geom.heads, (byte *) &loc->heads)) return -EFAULT;
if (put_user(raid[minor].geom.sectors, (byte *) &loc->sectors)) return -EFAULT;
if (put_user(raid[minor].geom.cylinders, (unsigned int *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)ataraid_gendisk.part[MINOR(inode->i_rdev)].start_sect,
if (put_user((unsigned)ataraid_gendisk.part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
return 0;
}
......@@ -463,7 +463,7 @@ static void __init probedisk(int devindex,int device, int raidlevel)
major = devlist[devindex].major;
minor = devlist[devindex].minor;
bdev = bdget(MKDEV(major,minor));
bdev = bdget(mk_kdev(major,minor));
if (!bdev)
return;
......@@ -491,7 +491,7 @@ static void __init probedisk(int devindex,int device, int raidlevel)
(prom.raid.disk[i].device == prom.raid.device) ) {
raid[device].disk[i].bdev = bdev;
raid[device].disk[i].device = MKDEV(major,minor);
raid[device].disk[i].device = mk_kdev(major,minor);
raid[device].disk[i].sectors = prom.raid.disk_secs;
raid[device].stride = (1<<prom.raid.raid0_shift);
raid[device].disks = prom.raid.total_disks;
......@@ -551,7 +551,7 @@ static __init int pdcraid_init_one(int device,int raidlevel)
for (i=0;i<8;i++) {
if (raid[device].disk[i].device!=0) {
printk(KERN_INFO "Drive %i is %li Mb (%i / %i) \n",
i,raid[device].disk[i].sectors/2048,MAJOR(raid[device].disk[i].device),MINOR(raid[device].disk[i].device));
i,raid[device].disk[i].sectors/2048,major(raid[device].disk[i].device),minor(raid[device].disk[i].device));
count++;
}
}
......
......@@ -116,7 +116,7 @@
#define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
#define I2O_BSA_DSC_TIMEOUT 0x000E
#define I2O_UNIT(dev) (i2ob_dev[MINOR((dev)) & 0xf0])
#define I2O_UNIT(dev) (i2ob_dev[minor((dev)) & 0xf0])
#define I2O_LOCK(unit) (i2ob_dev[(unit)].req_queue->queue_lock)
/*
......@@ -760,7 +760,7 @@ static int i2ob_evt(void *dummy)
{
u64 size;
if(do_i2ob_revalidate(MKDEV(MAJOR_NR, unit),0) != -EBUSY)
if(do_i2ob_revalidate(mk_kdev(MAJOR_NR, unit),0) != -EBUSY)
continue;
if(i2ob_query_device(&i2ob_dev[unit], 0x0004, 0, &size, 8) !=0 )
......@@ -869,7 +869,7 @@ static int i2ob_backlog_request(struct i2o_controller *c, struct i2ob_device *de
if(i2ob_backlog[c->unit] == NULL)
i2ob_backlog_tail[c->unit] = NULL;
unit = MINOR(ireq->req->rq_dev);
unit = minor(ireq->req->rq_dev);
i2ob_send(m, dev, ireq, i2ob[unit].start_sect, unit);
}
if(i2ob_backlog[c->unit])
......@@ -905,7 +905,7 @@ static void i2ob_request(request_queue_t *q)
if(req->rq_status == RQ_INACTIVE)
return;
unit = MINOR(req->rq_dev);
unit = minor(req->rq_dev);
dev = &i2ob_dev[(unit&0xF0)];
/*
......@@ -1038,7 +1038,7 @@ static void i2o_block_biosparam(
static int do_i2ob_revalidate(kdev_t dev, int maxu)
{
int minor=MINOR(dev);
int minor=minor(dev);
int i;
minor&=0xF0;
......@@ -1053,7 +1053,7 @@ static int do_i2ob_revalidate(kdev_t dev, int maxu)
for( i = 15; i>=0 ; i--)
{
int m = minor+i;
invalidate_device(MKDEV(MAJOR_NR, m), 1);
invalidate_device(mk_kdev(MAJOR_NR, m), 1);
i2ob_gendisk.part[m].start_sect = 0;
i2ob_gendisk.part[m].nr_sects = 0;
}
......@@ -1079,14 +1079,14 @@ static int i2ob_ioctl(struct inode *inode, struct file *file,
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
if (!inode || !inode->i_rdev)
if (!inode || kdev_none(inode->i_rdev))
return -EINVAL;
switch (cmd) {
case HDIO_GETGEO:
{
struct hd_geometry g;
int u = MINOR(inode->i_rdev) & 0xF0;
int u = minor(inode->i_rdev) & 0xF0;
i2o_block_biosparam(i2ob_sizes[u]<<1,
&g.cylinders, &g.heads, &g.sectors);
g.start = get_start_sect(inode->i_rdev);
......@@ -1121,7 +1121,7 @@ static int i2ob_release(struct inode *inode, struct file *file)
struct i2ob_device *dev;
int minor;
minor = MINOR(inode->i_rdev);
minor = minor(inode->i_rdev);
if (minor >= (MAX_I2OB<<4))
return -ENODEV;
dev = &i2ob_dev[(minor&0xF0)];
......@@ -1193,7 +1193,7 @@ static int i2ob_open(struct inode *inode, struct file *file)
if (!inode)
return -EINVAL;
minor = MINOR(inode->i_rdev);
minor = minor(inode->i_rdev);
if (minor >= MAX_I2OB<<4)
return -ENODEV;
dev=&i2ob_dev[(minor&0xF0)];
......@@ -1384,7 +1384,7 @@ static int i2ob_install_device(struct i2o_controller *c, struct i2o_device *d, i
*/
dev->req_queue = &i2ob_queues[c->unit]->req_queue;
grok_partitions(MKDEV(MAJOR_NR, unit), (long)(size>>9));
grok_partitions(mk_kdev(MAJOR_NR, unit), (long)(size>>9));
/*
* Register for the events we're interested in and that the
......@@ -1704,7 +1704,7 @@ void i2ob_del_device(struct i2o_controller *c, struct i2o_device *d)
*/
static int i2ob_media_change(kdev_t dev)
{
int i=MINOR(dev);
int i=minor(dev);
i>>=4;
if(i2ob_media_change_flag[i])
{
......@@ -1883,7 +1883,7 @@ int i2o_block_init(void)
* Finally see what is actually plugged in to our controllers
*/
for (i = 0; i < MAX_I2OB; i++)
register_disk(&i2ob_gendisk, MKDEV(MAJOR_NR,i<<4), 1<<4,
register_disk(&i2ob_gendisk, mk_kdev(MAJOR_NR,i<<4), 1<<4,
&i2ob_fops, 0);
i2ob_probe();
......
......@@ -156,7 +156,7 @@ static void NFTL_setup(struct mtd_info *mtd)
#if LINUX_VERSION_CODE < 0x20328
resetup_one_dev(&nftl_gendisk, firstfree);
#else
grok_partitions(MKDEV(MAJOR_NR,firstfree<<NFTL_PARTN_BITS),
grok_partitions(mk_kdev(MAJOR_NR,firstfree<<NFTL_PARTN_BITS),
nftl->nr_sects);
#endif
}
......@@ -779,7 +779,7 @@ static int nftl_ioctl(struct inode * inode, struct file * file, unsigned int cmd
struct NFTLrecord *nftl;
int res;
nftl = NFTLs[MINOR(inode->i_rdev) >> NFTL_PARTN_BITS];
nftl = NFTLs[minor(inode->i_rdev) >> NFTL_PARTN_BITS];
if (!nftl) return -EINVAL;
......@@ -853,7 +853,7 @@ void nftl_request(RQFUNC_ARG)
(req->cmd == READ) ? "Read " : "Write",
req->sector, req->current_nr_sectors);
dev = MINOR(req->rq_dev);
dev = minor(req->rq_dev);
block = req->sector;
nsect = req->current_nr_sectors;
buffer = req->buffer;
......@@ -875,7 +875,7 @@ void nftl_request(RQFUNC_ARG)
if (block + nsect > part_table[dev].nr_sects) {
/* access past the end of device */
printk("nftl%c%d: bad access: block = %d, count = %d\n",
(MINOR(req->rq_dev)>>6)+'a', dev & 0xf, block, nsect);
(minor(req->rq_dev)>>6)+'a', dev & 0xf, block, nsect);
up(&nftl->mutex);
res = 0; /* fail */
goto repeat;
......@@ -933,7 +933,7 @@ void nftl_request(RQFUNC_ARG)
static int nftl_open(struct inode *ip, struct file *fp)
{
int nftlnum = MINOR(ip->i_rdev) >> NFTL_PARTN_BITS;
int nftlnum = minor(ip->i_rdev) >> NFTL_PARTN_BITS;
struct NFTLrecord *thisNFTL;
thisNFTL = NFTLs[nftlnum];
......@@ -947,7 +947,7 @@ static int nftl_open(struct inode *ip, struct file *fp)
#endif
if (!thisNFTL) {
DEBUG(MTD_DEBUG_LEVEL2,"ENODEV: thisNFTL = %d, minor = %d, ip = %p, fp = %p\n",
nftlnum, ip->i_rdev, ip, fp);
nftlnum, minor(ip->i_rdev), ip, fp);
return -ENODEV;
}
......@@ -967,7 +967,7 @@ static int nftl_release(struct inode *inode, struct file *fp)
{
struct NFTLrecord *thisNFTL;
thisNFTL = NFTLs[MINOR(inode->i_rdev) / 16];
thisNFTL = NFTLs[minor(inode->i_rdev) / 16];
DEBUG(MTD_DEBUG_LEVEL2, "NFTL_release\n");
......
......@@ -524,7 +524,7 @@ void get_sectorsize(int i)
scsi_CDs[i].needs_sector_size = 1;
} else {
#if 0
if (cdrom_get_last_written(MKDEV(MAJOR_NR, i),
if (cdrom_get_last_written(mkdev(MAJOR_NR, i),
&scsi_CDs[i].capacity))
#endif
scsi_CDs[i].capacity = 1 + ((buffer[0] << 24) |
......
......@@ -280,7 +280,7 @@ static int reint_mknod (int slot_offset, struct kml_rec *rec)
old_fs = get_fs();
set_fs (get_ds());
error = lento_mknod (mknod->path, mknod->mode,
MKDEV(mknod->major, mknod->minor), &info);
mk_kdev(mknod->major, mknod->minor), &info);
set_fs (old_fs);
kmlreint_post_secure (rec);
EXIT;
......
......@@ -789,7 +789,7 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
}
error = lento_mknod(input.name, input.mode,
MKDEV(input.major,input.minor),&input.info);
mk_kdev(input.major,input.minor),&input.info);
EXIT;
return error;
}
......
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