Commit 1b4199a5 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (11/14) resync

monstrous cascade of #ifdefs is gone from blk.h.  This is the first
step of cleanup - we move #define in question into the code that
includes blk.h (i.e. DEVICE_NR, DEVICE_NAME and DEVICE_INTR are
explicitly set by drivers).
parent b7031fe5
......@@ -35,6 +35,8 @@
#ifdef CONFIG_STRAM_SWAP
#define MAJOR_NR Z2RAM_MAJOR
#define do_z2_request do_stram_request
#define DEVICE_NAME "Z2RAM"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#undef DEVICE_NAME
#define DEVICE_NAME "stram"
......
......@@ -154,6 +154,9 @@
#define MAJOR_NR FLOPPY_MAJOR
#define FLOPPY_DMA 0
#define DEVICE_NAME "floppy"
#define DEVICE_INTR do_floppy
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#include <linux/blk.h>
/* Note: FD_MAX_UNITS could be redefined to 2 for the Atari (with
......
......@@ -114,6 +114,9 @@
#include <linux/delay.h>
#define MAJOR_NR MFM_ACORN_MAJOR
#define DEVICE_NAME "mfm disk"
#define DEVICE_INTR do_mfm
#define DEVICE_NR(device) (minor(device) >> 6)
#include <linux/blk.h>
#include <linux/blkpg.h>
......
......@@ -44,6 +44,9 @@
*/
#define MAJOR_NR ACSI_MAJOR
#define DEVICE_NAME "ACSI"
#define DEVICE_INTR do_acsi
#define DEVICE_NR(device) (minor(device) >> 4)
#include <linux/config.h>
#include <linux/module.h>
......
......@@ -79,6 +79,9 @@
#include <asm/irq.h>
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define DEVICE_INTR do_floppy
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#include <linux/blk.h>
#undef DEBUG /* print _LOTS_ of infos */
......
......@@ -92,6 +92,9 @@
#include <asm/atari_stram.h>
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define DEVICE_INTR do_floppy
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#include <linux/blk.h>
#include <linux/blkpg.h>
......
......@@ -53,6 +53,8 @@ MODULE_LICENSE("GPL");
#define MAJOR_NR COMPAQ_SMART2_MAJOR
#define LOCAL_END_REQUEST
#define DEVICE_NAME "ida"
#define DEVICE_NR(device) (minor(device) >> 4)
#include <linux/blk.h>
#include <linux/blkdev.h>
#include <linux/genhd.h>
......
......@@ -240,6 +240,8 @@ static int irqdma_allocated;
#define LOCAL_END_REQUEST
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#include <linux/blk.h>
#include <linux/blkpg.h>
......
......@@ -51,6 +51,8 @@
#include <asm/types.h>
#define MAJOR_NR NBD_MAJOR
#define DEVICE_NAME "nbd"
#define DEVICE_NR(device) (minor(device))
#include <linux/nbd.h>
#define LO_MAGIC 0x68797548
......
......@@ -33,6 +33,8 @@
#ifdef CONFIG_BLK_DEV_PS2
#define MAJOR_NR PS2ESDI_MAJOR
#define DEVICE_NAME "PS/2 ESDI"
#define DEVICE_NR(device) (minor(device) >> 6)
#include <linux/errno.h>
#include <linux/sched.h>
......
......@@ -57,6 +57,8 @@
* include/linux/major.h for now
*/
#define MAJOR_NR RAMDISK_MAJOR
#define DEVICE_NAME "ramdisk"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#include <linux/blkpg.h>
......@@ -357,7 +359,7 @@ static struct file_operations initrd_fops = {
static int rd_open(struct inode * inode, struct file * filp)
{
int unit = DEVICE_NR(inode->i_rdev);
int unit = minor(inode->i_rdev);
#ifdef CONFIG_BLK_DEV_INITRD
if (unit == INITRD_MINOR) {
......
......@@ -33,6 +33,9 @@
#include <asm/pmac_feature.h>
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define DEVICE_INTR do_floppy
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#include <linux/blk.h>
#include <linux/devfs_fs_kernel.h>
......
......@@ -27,6 +27,9 @@
/* This has to be defined before some of the #includes below */
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define DEVICE_INTR do_floppy
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#include <linux/stddef.h>
#include <linux/kernel.h>
......
......@@ -52,6 +52,8 @@
#include <asm/dma.h>
#define MAJOR_NR XT_DISK_MAJOR
#define DEVICE_NAME "xt disk"
#define DEVICE_NR(device) (minor(device) >> 6)
#include <linux/blk.h>
#include <linux/blkpg.h>
......
......@@ -26,6 +26,8 @@
*/
#define MAJOR_NR Z2RAM_MAJOR
#define DEVICE_NAME "Z2RAM"
#define DEVICE_NR(device) (minor(device))
#include <linux/major.h>
#include <linux/slab.h>
......
......@@ -168,6 +168,8 @@
#include <linux/version.h>
#define MAJOR_NR AZTECH_CDROM_MAJOR
#define DEVICE_NAME "Aztech CD-ROM"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#include "aztcd.h"
......
......@@ -177,6 +177,8 @@
#include "cdu31a.h"
#define MAJOR_NR CDU31A_CDROM_MAJOR
#define DEVICE_NAME "CDU31A"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#define CDU31A_READAHEAD 4 /* 128 sector, 64kB, 32 reads read-ahead */
......
......@@ -198,6 +198,9 @@
#include <asm/io.h>
#define MAJOR_NR CM206_CDROM_MAJOR
#define DEVICE_NAME "Philips/LMS CD-ROM cm206"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#undef DEBUG
......
......@@ -70,6 +70,8 @@
#include <asm/uaccess.h>
#define MAJOR_NR GOLDSTAR_CDROM_MAJOR
#define DEVICE_NAME "Goldstar R420"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#define gscd_port gscd /* for compatible parameter passing with "insmod" */
#include "gscd.h"
......
......@@ -102,6 +102,8 @@
#include <asm/uaccess.h>
#define MAJOR_NR MITSUMI_CDROM_MAJOR
#define DEVICE_NAME "Mitsumi CD-ROM"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#define mcd_port mcd /* for compatible parameter passing with "insmod" */
......
......@@ -73,6 +73,8 @@ static const char *mcdx_c_version
#include <linux/major.h>
#define MAJOR_NR MITSUMI_X_CDROM_MAJOR
#define DEVICE_NAME "Mitsumi CD-ROM"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#include <linux/devfs_fs_kernel.h>
......
......@@ -76,6 +76,8 @@
#include <asm/io.h>
#define MAJOR_NR OPTICS_CDROM_MAJOR
#define DEVICE_NAME "DOLPHIN 8000AT CD-ROM"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#include <linux/cdrom.h>
......
......@@ -380,6 +380,7 @@
#include "sbpcd.h"
#define MAJOR_NR MATSUSHITA_CDROM_MAJOR
#define DEVICE_NAME "Matsushita CD-ROM controller #1"
#include <linux/blk.h>
......
......@@ -77,6 +77,8 @@
#include <asm/uaccess.h>
#define MAJOR_NR SANYO_CDROM_MAJOR
#define DEVICE_NAME "Sanyo H94A CD-ROM"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#include "sjcd.h"
......
......@@ -135,6 +135,9 @@
#include <linux/cdrom.h>
#define MAJOR_NR CDU535_CDROM_MAJOR
#define DEVICE_NAME "SONY-CDU535"
#define DEVICE_INTR do_cdu535
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#define sony535_cd_base_io sonycd535 /* for compatible parameter passing with "insmod" */
......
......@@ -52,6 +52,9 @@
#include <asm/uaccess.h>
#define MAJOR_NR HD_MAJOR
#define DEVICE_NAME "hard disk"
#define DEVICE_INTR do_hd
#define DEVICE_NR(device) (minor(device)>>6)
#include <linux/blk.h>
#ifdef __arm__
......
......@@ -26,6 +26,8 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define MD_PERSONALITY
#define DEVICE_NAME "Multiple devices driver"
#define DEVICE_NR(device) (minor(device))
static int linear_run (mddev_t *mddev)
{
......
......@@ -49,6 +49,8 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define DEVICE_NAME "Multiple devices driver"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
......
......@@ -29,6 +29,8 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define MD_PERSONALITY
#define DEVICE_NAME "Multiple devices driver"
#define DEVICE_NR(device) (minor(device))
#define MAX_WORK_PER_DISK 128
......
......@@ -24,6 +24,8 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define MD_PERSONALITY
#define DEVICE_NAME "Multiple devices driver"
#define DEVICE_NR(device) (minor(device))
static int create_strip_zones (mddev_t *mddev)
{
......
......@@ -27,6 +27,8 @@
#define MAJOR_NR MD_MAJOR
#define MD_DRIVER
#define MD_PERSONALITY
#define DEVICE_NAME "Multiple devices driver"
#define DEVICE_NR(device) (minor(device))
/*
* Number of guaranteed r1bios in case of extreme VM load:
......
......@@ -72,6 +72,8 @@
#include <linux/wait.h>
#define MAJOR_NR I2O_MAJOR
#define DEVICE_NAME "I2O block"
#define DEVICE_NR(device) (minor(device)>>4)
#include <linux/blk.h>
......
......@@ -60,6 +60,9 @@ const char * osst_version = "0.9.10";
#define OSST_DEB_MSG KERN_NOTICE
#define MAJOR_NR OSST_MAJOR
#define DEVICE_NAME "onstream"
#define DEVICE_INTR do_osst
#define DEVICE_NR(device) (minor(device) & 0x7f)
#include <linux/blk.h>
#include "scsi.h"
......
......@@ -50,6 +50,8 @@
#define MAJOR_NR SCSI_DISK0_MAJOR
#define LOCAL_END_REQUEST
#define DEVICE_NAME "scsidisk"
#define DEVICE_NR(device) (((major(device) & SD_MAJOR_MASK) << (8 - 4)) + (minor(device) >> 4))
#include <linux/blk.h>
#include <linux/blkpg.h>
#include "scsi.h"
......
......@@ -50,6 +50,8 @@
#define MAJOR_NR SCSI_CDROM_MAJOR
#define LOCAL_END_REQUEST
#define DEVICE_NAME "CD-ROM"
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#include "scsi.h"
#include "hosts.h"
......
......@@ -55,6 +55,9 @@ static char *verstr = "20020205";
#endif
#define MAJOR_NR SCSI_TAPE_MAJOR
#define DEVICE_NAME "scsitape"
#define DEVICE_INTR do_st
#define DEVICE_NR(device) (minor(device) & 0x7f)
#include <linux/blk.h>
#include "scsi.h"
......
......@@ -96,181 +96,8 @@ extern inline struct request *elv_next_request(request_queue_t *q)
} while (0)
#define elv_add_request(q, rq, back) _elv_add_request((q), (rq), (back), 1)
#if defined(MAJOR_NR) || defined(IDE_DRIVER)
/*
* Add entries as needed.
*/
#ifdef IDE_DRIVER
#define DEVICE_NR(device) (minor(device) >> PARTN_BITS)
#define DEVICE_NAME "ide"
#elif (MAJOR_NR == RAMDISK_MAJOR)
/* ram disk */
#define DEVICE_NAME "ramdisk"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == Z2RAM_MAJOR)
/* Zorro II Ram */
#define DEVICE_NAME "Z2RAM"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == FLOPPY_MAJOR)
static void floppy_off(unsigned int nr);
#define DEVICE_NAME "floppy"
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#elif (MAJOR_NR == HD_MAJOR)
/* Hard disk: timeout is 6 seconds. */
#define DEVICE_NAME "hard disk"
#define DEVICE_INTR do_hd
#define DEVICE_NR(device) (minor(device)>>6)
#elif (SCSI_DISK_MAJOR(MAJOR_NR))
#define DEVICE_NAME "scsidisk"
#define DEVICE_NR(device) (((major(device) & SD_MAJOR_MASK) << (8 - 4)) + (minor(device) >> 4))
/* Kludge to use the same number for both char and block major numbers */
#elif (MAJOR_NR == MD_MAJOR) && defined(MD_DRIVER)
#define DEVICE_NAME "Multiple devices driver"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == SCSI_TAPE_MAJOR)
#define DEVICE_NAME "scsitape"
#define DEVICE_INTR do_st
#define DEVICE_NR(device) (minor(device) & 0x7f)
#elif (MAJOR_NR == OSST_MAJOR)
#define DEVICE_NAME "onstream"
#define DEVICE_INTR do_osst
#define DEVICE_NR(device) (minor(device) & 0x7f)
#elif (MAJOR_NR == SCSI_CDROM_MAJOR)
#define DEVICE_NAME "CD-ROM"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == XT_DISK_MAJOR)
#define DEVICE_NAME "xt disk"
#define DEVICE_NR(device) (minor(device) >> 6)
#elif (MAJOR_NR == PS2ESDI_MAJOR)
#define DEVICE_NAME "PS/2 ESDI"
#define DEVICE_NR(device) (minor(device) >> 6)
#elif (MAJOR_NR == CDU31A_CDROM_MAJOR)
#define DEVICE_NAME "CDU31A"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == ACSI_MAJOR) && (defined(CONFIG_ATARI_ACSI) || defined(CONFIG_ATARI_ACSI_MODULE))
#define DEVICE_NAME "ACSI"
#define DEVICE_INTR do_acsi
#define DEVICE_NR(device) (minor(device) >> 4)
#elif (MAJOR_NR == MITSUMI_CDROM_MAJOR)
#define DEVICE_NAME "Mitsumi CD-ROM"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MITSUMI_X_CDROM_MAJOR)
#define DEVICE_NAME "Mitsumi CD-ROM"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == AZTECH_CDROM_MAJOR)
#define DEVICE_NAME "Aztech CD-ROM"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == CDU535_CDROM_MAJOR)
#define DEVICE_NAME "SONY-CDU535"
#define DEVICE_INTR do_cdu535
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == GOLDSTAR_CDROM_MAJOR)
#define DEVICE_NAME "Goldstar R420"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == CM206_CDROM_MAJOR)
#define DEVICE_NAME "Philips/LMS CD-ROM cm206"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == OPTICS_CDROM_MAJOR)
#define DEVICE_NAME "DOLPHIN 8000AT CD-ROM"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == SANYO_CDROM_MAJOR)
#define DEVICE_NAME "Sanyo H94A CD-ROM"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == APBLOCK_MAJOR)
#define DEVICE_NAME "apblock"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == DDV_MAJOR)
#define DEVICE_NAME "ddv"
#define DEVICE_NR(device) (minor(device)>>PARTN_BITS)
#elif (MAJOR_NR == MFM_ACORN_MAJOR)
#define DEVICE_NAME "mfm disk"
#define DEVICE_INTR do_mfm
#define DEVICE_NR(device) (minor(device) >> 6)
#elif (MAJOR_NR == NBD_MAJOR)
#define DEVICE_NAME "nbd"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MDISK_MAJOR)
#define DEVICE_NAME "mdisk"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == DASD_MAJOR)
#define DEVICE_NAME "dasd"
#define DEVICE_NR(device) (minor(device) >> PARTN_BITS)
#elif (MAJOR_NR == I2O_MAJOR)
#define DEVICE_NAME "I2O block"
#define DEVICE_NR(device) (minor(device)>>4)
#elif (MAJOR_NR == COMPAQ_SMART2_MAJOR)
#define DEVICE_NAME "ida"
#define DEVICE_NR(device) (minor(device) >> 4)
#endif /* MAJOR_NR == whatever */
#if defined(MAJOR_NR) || defined(IDE_DRIVER)
#if (MAJOR_NR != SCSI_TAPE_MAJOR) && (MAJOR_NR != OSST_MAJOR)
#if !defined(IDE_DRIVER)
......
......@@ -598,6 +598,8 @@ extern int noautodma;
*/
#define IDE_DRIVER /* Toggle some magic bits in blk.h */
#define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */
#define DEVICE_NR(device) (minor(device) >> PARTN_BITS)
#define DEVICE_NAME "ide"
#include <linux/blk.h>
extern int __ide_end_request(struct ata_device *, struct request *, int, unsigned int);
......
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