Commit 6f24784f authored by Al Viro's avatar Al Viro
Browse files

whack-a-mole: don't open-code iminor/imajor



several instances creeped back into the tree...

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 9652c732
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -27,11 +27,10 @@ static int openCnt;

static int gio_open(struct inode *inode, struct file *filp)
{
	int minor;
	int minor = iminor(inode);
	int ret = -ENOENT;

	preempt_disable();
	minor = MINOR(inode->i_rdev);
	if (minor < DEVCOUNT) {
		if (openCnt > 0) {
			ret = -EALREADY;
@@ -46,9 +45,8 @@ static int gio_open(struct inode *inode, struct file *filp)

static int gio_close(struct inode *inode, struct file *filp)
{
	int minor;
	int minor = iminor(inode);

	minor = MINOR(inode->i_rdev);
	if (minor < DEVCOUNT) {
		openCnt--;
	}
+1 −1
Original line number Diff line number Diff line
@@ -663,7 +663,7 @@ static inline int is_loop_device(struct file *file)
{
	struct inode *i = file->f_mapping->host;

	return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
	return i && S_ISBLK(i->i_mode) && imajor(i) == LOOP_MAJOR;
}

static int loop_validate_file(struct file *file, struct block_device *bdev)
+1 −1
Original line number Diff line number Diff line
@@ -480,7 +480,7 @@ static void dax_free_inode(struct inode *inode)
	kfree(dax_dev->host);
	dax_dev->host = NULL;
	if (inode->i_rdev)
		ida_simple_remove(&dax_minor_ida, MINOR(inode->i_rdev));
		ida_simple_remove(&dax_minor_ida, iminor(inode));
	kmem_cache_free(dax_cache, dax_dev);
}

+2 −2
Original line number Diff line number Diff line
@@ -783,7 +783,7 @@ static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd,
 */
static int wdt_open(struct inode *inode, struct file *file)
{
	if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) {
	if (iminor(inode) == WATCHDOG_MINOR) {
		mutex_lock(&m41t80_rtc_mutex);
		if (test_and_set_bit(0, &wdt_is_open)) {
			mutex_unlock(&m41t80_rtc_mutex);
@@ -807,7 +807,7 @@ static int wdt_open(struct inode *inode, struct file *file)
 */
static int wdt_release(struct inode *inode, struct file *file)
{
	if (MINOR(inode->i_rdev) == WATCHDOG_MINOR)
	if (iminor(inode) == WATCHDOG_MINOR)
		clear_bit(0, &wdt_is_open);
	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -681,7 +681,7 @@ static int ur_open(struct inode *inode, struct file *file)
	 * We treat the minor number as the devno of the ur device
	 * to find in the driver tree.
	 */
	devno = MINOR(file_inode(file)->i_rdev);
	devno = iminor(file_inode(file));

	urd = urdev_get_from_devno(devno);
	if (!urd) {
Loading