Commit b9e8bb61 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] large dev_t - second series (1/15)

	misc trivial cleanups
parent fd7c9d21
......@@ -56,7 +56,7 @@ static struct backing_dev_info hwgfs_backing_dev_info = {
.memory_backed = 1, /* Does not contribute to dirty memory */
};
struct inode *hwgfs_get_inode(struct super_block *sb, int mode, dev_t dev)
static struct inode *hwgfs_get_inode(struct super_block *sb, int mode, dev_t dev)
{
struct inode * inode = new_inode(sb);
......@@ -66,7 +66,6 @@ struct inode *hwgfs_get_inode(struct super_block *sb, int mode, dev_t dev)
inode->i_gid = current->fsgid;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = NODEV;
inode->i_mapping->a_ops = &hwgfs_aops;
inode->i_mapping->backing_dev_info = &hwgfs_backing_dev_info;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
......
......@@ -34,12 +34,6 @@
#include <linux/swapops.h>
#ifdef CONFIG_STRAM_SWAP
#define MAJOR_NR Z2RAM_MAJOR
#define do_z2_request do_stram_request
#define DEVICE_NR(device) (minor(device))
#endif
#undef DEBUG
#ifdef DEBUG
......
......@@ -399,7 +399,7 @@ note_scsi_host(struct device_node *node, void *host)
#endif
#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
dev_t __init
static dev_t __init
find_ide_boot(void)
{
char *p;
......
......@@ -55,9 +55,6 @@ static int ubd_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg);
#define MAX_DEV (8)
#define MAX_MINOR (MAX_DEV << UBD_SHIFT)
#define DEVICE_NR(n) (minor(n) >> UBD_SHIFT)
static struct block_device_operations ubd_blops = {
.owner = THIS_MODULE,
......
......@@ -28,11 +28,6 @@ struct kobj_map {
struct rw_semaphore *sem;
};
static inline int dev_to_index(dev_t dev)
{
return MAJOR(dev) % 255;
}
int kobj_map(struct kobj_map *domain, dev_t dev, unsigned long range,
struct module *module, kobj_probe_t *probe,
int (*lock)(dev_t, void *), void *data)
......
......@@ -2063,38 +2063,6 @@ extern int DAC960_KernelIOCTL(unsigned int Request, void *Argument);
#define DAC960_MaxPartitions 8
#define DAC960_MaxPartitionsBits 3
/*
Define macros to extract the Controller Number, Logical Drive Number, and
Partition Number from a Kernel Device, and to construct a Major Number, Minor
Number, and Kernel Device from the Controller Number, Logical Drive Number,
and Partition Number. There is one Major Number assigned to each Controller.
The associated Minor Number is divided into the Logical Drive Number and
Partition Number.
*/
#define DAC960_ControllerNumber(Device) \
(major(Device) - DAC960_MAJOR)
#define DAC960_LogicalDriveNumber(Device) \
(minor(Device) >> DAC960_MaxPartitionsBits)
#define DAC960_MajorNumber(ControllerNumber) \
(DAC960_MAJOR + (ControllerNumber))
#define DAC960_MinorNumber(LogicalDriveNumber, PartitionNumber) \
(((LogicalDriveNumber) << DAC960_MaxPartitionsBits) | (PartitionNumber))
#define DAC960_MinorCount (DAC960_MaxLogicalDrives \
* DAC960_MaxPartitions)
#define DAC960_KernelDevice(ControllerNumber, \
LogicalDriveNumber, \
PartitionNumber) \
mk_kdev(DAC960_MajorNumber(ControllerNumber), \
DAC960_MinorNumber(LogicalDriveNumber, PartitionNumber))
/*
Define the DAC960 Controller fixed Block Size and Block Size Bits.
*/
......
......@@ -158,10 +158,6 @@
/** \name Backward compatibility section */
/*@{*/
#ifndef minor
#define minor(x) MINOR((x))
#endif
#ifndef MODULE_LICENSE
#define MODULE_LICENSE(x)
#endif
......
......@@ -1460,17 +1460,6 @@ static int rp_ioctl(struct tty_struct *tty, struct file *file,
return 0;
}
#if (defined(ROCKET_DEBUG_FLOW) || defined(ROCKET_DEBUG_THROTTLE))
static char *rp_tty_name(struct tty_struct *tty, char *buf)
{
if (tty)
sprintf(buf, "%s%d", TTY_DRIVER_NAME(tty), MINOR(tty->device) - TTY_DRIVER_MINOR_START(tty) + TTY_DRIVER_NAME_BASE);
else
strcpy(buf, "NULL tty");
return buf;
}
#endif
static void rp_send_xchar(struct tty_struct *tty, char ch)
{
struct r_port *info = (struct r_port *) tty->driver_data;
......@@ -1490,10 +1479,9 @@ static void rp_throttle(struct tty_struct *tty)
{
struct r_port *info = (struct r_port *) tty->driver_data;
CHANNEL_t *cp;
#ifdef ROCKET_DEBUG_THROTTLE
char buf[64];
printk(KERN_INFO "throttle %s: %d....\n", rp_tty_name(tty, buf),
#ifdef ROCKET_DEBUG_THROTTLE
printk(KERN_INFO "throttle %s: %d....\n", tty->name,
tty->ldisc.chars_in_buffer(tty));
#endif
......@@ -1512,9 +1500,7 @@ static void rp_unthrottle(struct tty_struct *tty)
struct r_port *info = (struct r_port *) tty->driver_data;
CHANNEL_t *cp;
#ifdef ROCKET_DEBUG_THROTTLE
char buf[64];
printk(KERN_INFO "unthrottle %s: %d....\n", rp_tty_name(tty, buf),
printk(KERN_INFO "unthrottle %s: %d....\n", tty->name,
tty->ldisc.chars_in_buffer(tty));
#endif
......@@ -1539,10 +1525,9 @@ static void rp_unthrottle(struct tty_struct *tty)
static void rp_stop(struct tty_struct *tty)
{
struct r_port *info = (struct r_port *) tty->driver_data;
#ifdef ROCKET_DEBUG_FLOW
char buf[64];
printk(KERN_INFO "stop %s: %d %d....\n", rp_tty_name(tty, buf),
#ifdef ROCKET_DEBUG_FLOW
printk(KERN_INFO "stop %s: %d %d....\n", tty->name,
info->xmit_cnt, info->xmit_fifo_room);
#endif
......@@ -1556,10 +1541,9 @@ static void rp_stop(struct tty_struct *tty)
static void rp_start(struct tty_struct *tty)
{
struct r_port *info = (struct r_port *) tty->driver_data;
#ifdef ROCKET_DEBUG_FLOW
char buf[64];
printk(KERN_INFO "start %s: %d %d....\n", rp_tty_name(tty, buf),
#ifdef ROCKET_DEBUG_FLOW
printk(KERN_INFO "start %s: %d %d....\n", tty->name,
info->xmit_cnt, info->xmit_fifo_room);
#endif
......
......@@ -74,7 +74,6 @@
#define VERSION(ver,rel,seq) (((ver)<<16) | ((rel)<<8) | (seq))
#if LINUX_VERSION_CODE < VERSION(2,5,0)
# define minor(x) MINOR(x)
# define need_resched() (current->need_resched)
#endif
......
......@@ -2140,7 +2140,7 @@ static void tty_add_class_device(char *name, dev_t dev, struct device *device)
kfree(tty_dev);
}
void tty_remove_class_device(dev_t dev)
static void tty_remove_class_device(dev_t dev)
{
struct tty_dev *tty_dev = NULL;
struct list_head *tmp;
......@@ -2149,19 +2149,15 @@ void tty_remove_class_device(dev_t dev)
spin_lock(&tty_dev_list_lock);
list_for_each (tmp, &tty_dev_list) {
tty_dev = list_entry(tmp, struct tty_dev, node);
if ((MAJOR(tty_dev->dev) == MAJOR(dev)) &&
(MINOR(tty_dev->dev) == MINOR(dev))) {
if (tty_dev->dev == dev) {
list_del(&tty_dev->node);
found = 1;
break;
}
}
if (found) {
list_del(&tty_dev->node);
spin_unlock(&tty_dev_list_lock);
spin_unlock(&tty_dev_list_lock);
if (found)
class_device_unregister(&tty_dev->class_dev);
} else {
spin_unlock(&tty_dev_list_lock);
}
}
/**
......
......@@ -16,10 +16,6 @@
/* The great kdev_t changeover in 2.5.x */
#include <linux/kdev_t.h>
#ifndef minor
#define minor(dev) MINOR(dev)
#endif
/* Transaction Label handling */
struct hpsb_tlabel_pool {
......
......@@ -577,7 +577,7 @@ static int create(struct dm_ioctl *param, struct dm_ioctl *user)
}
if (param->flags & DM_PERSISTENT_DEV_FLAG)
r = dm_create_with_minor(minor(to_kdev_t(param->dev)), &md);
r = dm_create_with_minor(MINOR(param->dev), &md);
else
r = dm_create(&md);
......
......@@ -481,7 +481,7 @@ static int dev_create(struct dm_ioctl *param, size_t param_size)
return r;
if (param->flags & DM_PERSISTENT_DEV_FLAG)
r = dm_create_with_minor(minor(to_kdev_t(param->dev)), &md);
r = dm_create_with_minor(MINOR(param->dev), &md);
else
r = dm_create(&md);
......
......@@ -25,7 +25,6 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define MD_PERSONALITY
#define DEVICE_NR(device) (minor(device))
/*
* find which device holds a particular offset
......
......@@ -50,7 +50,6 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define DEVICE_NR(device) (minor(device))
#define DEBUG 0
#define dprintk(x...) ((void)(DEBUG && printk(x)))
......
......@@ -29,7 +29,6 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define MD_PERSONALITY
#define DEVICE_NR(device) (minor(device))
#define MAX_WORK_PER_DISK 128
......
......@@ -24,7 +24,6 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define MD_PERSONALITY
#define DEVICE_NR(device) (minor(device))
static int create_strip_zones (mddev_t *mddev)
{
......
......@@ -27,7 +27,6 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define MD_PERSONALITY
#define DEVICE_NR(device) (minor(device))
/*
* Number of guaranteed r1bios in case of extreme VM load:
......
......@@ -52,7 +52,7 @@ static ssize_t show_dev(struct class_device *cd, char *buf)
{
struct video_device *vfd = container_of(cd, struct video_device, class_dev);
dev_t dev = MKDEV(VIDEO_MAJOR, vfd->minor);
return sprintf(buf,"%04x\n",(int)dev);
return sprintf(buf,"%04x\n",old_encode_dev(dev));
}
static CLASS_DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
......
......@@ -1265,7 +1265,7 @@ static int
zoran_open (struct inode *inode,
struct file *file)
{
unsigned int minor = minor(inode->i_rdev);
unsigned int minor = iminor(inode);
struct zoran *zr = NULL;
struct zoran_fh *fh;
int i, res, first_open = 0, have_module_locks = 0;
......
......@@ -158,7 +158,6 @@ enum tubwhat { /* echo what= proc actions */
#define TUBMAXMINS 256
#define TUB_DEV MKDEV(IBM_FS3270_MAJ, 0) /* Generic /dev/3270/tub */
#define _GEOM_ROWS 24
#define _GEOM_COLS 80
#define GEOM_ROWS (tubp->geom_rows)
......@@ -294,23 +293,6 @@ typedef struct tub_s {
#define TUB_UE_BUSY 0x0800
#define TUB_INPUT_HACK 0x1000 /* Early init of command line */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))
#define S390_CONSOLE_DEV MKDEV(TTY_MAJOR, 64)
#define tub_major(x) MAJOR(x)
#define tub_minor(x) MINOR(x)
#define tub_mkdev(x, y) MKDEV(x, y)
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#define S390_CONSOLE_DEV MKDEV(TTYAUX_MAJOR, 1)
#define tub_major(x) MAJOR(x)
#define tub_minor(x) MINOR(x)
#define tub_mkdev(x, y) MKDEV(x, y)
#else
#define S390_CONSOLE_DEV mk_kdev(TTYAUX_MAJOR, 1)
#define tub_major(x) major(x)
#define tub_minor(x) minor(x)
#define tub_mkdev(x, y) mk_kdev(x, y)
#endif
/*
* Extra stuff for 3270 console support
*/
......
......@@ -152,7 +152,6 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de
inode->i_gid = current->fsgid;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = NODEV;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) {
default:
......
......@@ -68,7 +68,6 @@ static int afs_inode_map_status(afs_vnode_t *vnode)
inode->i_nlink = vnode->status.nlink;
inode->i_uid = vnode->status.owner;
inode->i_gid = 0;
inode->i_rdev = NODEV;
inode->i_size = vnode->status.size;
inode->i_atime.tv_sec = inode->i_mtime.tv_sec = inode->i_ctime.tv_sec = vnode->status.mtime_server;
inode->i_atime.tv_nsec =
......
......@@ -298,7 +298,6 @@ struct inode *autofs4_get_inode(struct super_block *sb,
}
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = NODEV;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
if (S_ISDIR(inf->mode)) {
......
......@@ -2010,7 +2010,6 @@ static struct inode *_devfs_get_vfs_inode (struct super_block *sb,
inode->i_blksize = FAKE_BLOCK_SIZE;
inode->i_op = &devfs_iops;
inode->i_fop = &devfs_fops;
inode->i_rdev = NODEV;
if ( S_ISCHR (de->mode) )
{
inode->i_rdev = to_kdev_t(de->u.cdev.dev);
......@@ -2494,8 +2493,8 @@ static int devfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
struct devfs_entry *parent, *de;
struct inode *inode;
DPRINTK (DEBUG_I_MKNOD, "(%s): mode: 0%o dev: %d\n",
dentry->d_name.name, mode, rdev);
DPRINTK (DEBUG_I_MKNOD, "(%s): mode: 0%o dev: %u:%u\n",
dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev));
parent = get_devfs_entry_from_vfs_inode (dir);
if (parent == NULL) return -ENOENT;
de = _devfs_alloc_entry (dentry->d_name.name, dentry->d_name.len, mode);
......
......@@ -322,7 +322,6 @@ struct inode *hfs_iget(struct hfs_cat_entry *entry, ino_t type,
/* Initialize the inode */
struct hfs_sb_info *hsb = HFS_SB(sb);
inode->i_rdev = NODEV;
inode->i_ctime.tv_sec = inode->i_atime.tv_sec = inode->i_mtime.tv_sec =
hfs_m_to_utime(entry->modify_date);
inode->i_ctime.tv_nsec = 0;
......
......@@ -406,7 +406,6 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,
inode->i_gid = gid;
inode->i_blksize = HPAGE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = NODEV;
inode->i_mapping->a_ops = &hugetlbfs_aops;
inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
......
......@@ -362,7 +362,6 @@ jffs_new_inode(const struct inode * dir, struct jffs_raw_inode *raw_inode,
inode->i_nlink = raw_inode->nlink;
inode->i_uid = raw_inode->uid;
inode->i_gid = raw_inode->gid;
inode->i_rdev = NODEV;
inode->i_size = raw_inode->dsize;
inode->i_atime.tv_sec = raw_inode->atime;
inode->i_mtime.tv_sec = raw_inode->mtime;
......
......@@ -147,7 +147,7 @@ void jffs2_read_inode (struct inode *inode)
case S_IFSOCK:
case S_IFIFO:
inode->i_op = &jffs2_file_inode_operations;
init_special_inode(inode, inode->i_mode, kdev_t_to_nr(mk_kdev(je16_to_cpu(rdev)>>8, je16_to_cpu(rdev)&0xff)));
init_special_inode(inode, inode->i_mode, MKDEV(je16_to_cpu(rdev)>>8, je16_to_cpu(rdev)&0xff));
break;
default:
......
......@@ -220,7 +220,6 @@ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)
inode->i_nlink = 1;
inode->i_uid = server->m.uid;
inode->i_gid = server->m.gid;
inode->i_rdev = NODEV;
inode->i_blksize = NCP_BLOCK_SIZE;
ncp_update_dates(inode, &nwinfo->i);
......
......@@ -58,7 +58,6 @@ static struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev
inode->i_gid = current->fsgid;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = NODEV;
inode->i_mapping->a_ops = &ramfs_aops;
inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
......
......@@ -542,10 +542,8 @@ romfs_read_inode(struct inode *i)
default:
/* depending on MBZ for sock/fifos */
nextfh = ntohl(ri.spec);
/* convert back and forth for typechecking and
* source tagging */
nextfh = kdev_t_to_nr(mk_kdev(nextfh>>16,nextfh&0xffff));
init_special_inode(i, ino, nextfh);
init_special_inode(i, ino,
MKDEV(nextfh>>16,nextfh&0xffff));
}
}
......
......@@ -33,7 +33,6 @@ struct inode * sysfs_new_inode(mode_t mode)
inode->i_gid = current->fsgid;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = NODEV;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
inode->i_mapping->a_ops = &sysfs_aops;
inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
......
......@@ -1040,7 +1040,6 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
inode->i_gid = current->fsgid;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = NODEV;
inode->i_mapping->a_ops = &shmem_aops;
inode->i_mapping->backing_dev_info = &shmem_backing_dev_info;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
......
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