Commit 48c8cee6 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

drivers/block/floppy.c: #define space and column neatening

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d4937543
...@@ -250,7 +250,7 @@ static int irqdma_allocated; ...@@ -250,7 +250,7 @@ static int irqdma_allocated;
static struct request *current_req; static struct request *current_req;
static struct request_queue *floppy_queue; static struct request_queue *floppy_queue;
static void do_fd_request(struct request_queue * q); static void do_fd_request(struct request_queue *q);
#ifndef fd_get_dma_residue #ifndef fd_get_dma_residue
#define fd_get_dma_residue() get_dma_residue(FLOPPY_DMA) #define fd_get_dma_residue() get_dma_residue(FLOPPY_DMA)
...@@ -263,7 +263,7 @@ static void do_fd_request(struct request_queue * q); ...@@ -263,7 +263,7 @@ static void do_fd_request(struct request_queue * q);
#endif #endif
#ifndef fd_dma_mem_alloc #ifndef fd_dma_mem_alloc
#define fd_dma_mem_alloc(size) __get_dma_pages(GFP_KERNEL,get_order(size)) #define fd_dma_mem_alloc(size) __get_dma_pages(GFP_KERNEL, get_order(size))
#endif #endif
static inline void fallback_on_nodma_alloc(char **addr, size_t l) static inline void fallback_on_nodma_alloc(char **addr, size_t l)
...@@ -285,12 +285,13 @@ static inline void fallback_on_nodma_alloc(char **addr, size_t l) ...@@ -285,12 +285,13 @@ static inline void fallback_on_nodma_alloc(char **addr, size_t l)
static unsigned long fake_change; static unsigned long fake_change;
static int initialising = 1; static int initialising = 1;
#define ITYPE(x) (((x)>>2) & 0x1f) #define ITYPE(x) (((x) >> 2) & 0x1f)
#define TOMINOR(x) ((x & 3) | ((x & 4) << 5)) #define TOMINOR(x) ((x & 3) | ((x & 4) << 5))
#define UNIT(x) ((x) & 0x03) /* drive on fdc */ #define UNIT(x) ((x) & 0x03) /* drive on fdc */
#define FDC(x) (((x) & 0x04) >> 2) /* fdc of drive */ #define FDC(x) (((x) & 0x04) >> 2) /* fdc of drive */
/* reverse mapping from unit and fdc to drive */ /* reverse mapping from unit and fdc to drive */
#define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) #define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2))
#define DP (&drive_params[current_drive]) #define DP (&drive_params[current_drive])
#define DRS (&drive_state[current_drive]) #define DRS (&drive_state[current_drive])
#define DRWE (&write_errors[current_drive]) #define DRWE (&write_errors[current_drive])
...@@ -307,35 +308,36 @@ static int initialising = 1; ...@@ -307,35 +308,36 @@ static int initialising = 1;
#define USETF(x) set_bit(x##_BIT, &UDRS->flags) #define USETF(x) set_bit(x##_BIT, &UDRS->flags)
#define UTESTF(x) test_bit(x##_BIT, &UDRS->flags) #define UTESTF(x) test_bit(x##_BIT, &UDRS->flags)
#define DPRINT(format, args...) printk(DEVICE_NAME "%d: " format, current_drive , ## args) #define DPRINT(format, args...) \
printk(DEVICE_NAME "%d: " format, current_drive, ##args)
#define PH_HEAD(floppy,head) (((((floppy)->stretch & 2) >>1) ^ head) << 2) #define PH_HEAD(floppy, head) (((((floppy)->stretch & 2) >> 1) ^ head) << 2)
#define STRETCH(floppy) ((floppy)->stretch & FD_STRETCH) #define STRETCH(floppy) ((floppy)->stretch & FD_STRETCH)
#define CLEARSTRUCT(x) memset((x), 0, sizeof(*(x))) #define CLEARSTRUCT(x) memset((x), 0, sizeof(*(x)))
/* read/write */ /* read/write */
#define COMMAND raw_cmd->cmd[0] #define COMMAND (raw_cmd->cmd[0])
#define DR_SELECT raw_cmd->cmd[1] #define DR_SELECT (raw_cmd->cmd[1])
#define TRACK raw_cmd->cmd[2] #define TRACK (raw_cmd->cmd[2])
#define HEAD raw_cmd->cmd[3] #define HEAD (raw_cmd->cmd[3])
#define SECTOR raw_cmd->cmd[4] #define SECTOR (raw_cmd->cmd[4])
#define SIZECODE raw_cmd->cmd[5] #define SIZECODE (raw_cmd->cmd[5])
#define SECT_PER_TRACK raw_cmd->cmd[6] #define SECT_PER_TRACK (raw_cmd->cmd[6])
#define GAP raw_cmd->cmd[7] #define GAP (raw_cmd->cmd[7])
#define SIZECODE2 raw_cmd->cmd[8] #define SIZECODE2 (raw_cmd->cmd[8])
#define NR_RW 9 #define NR_RW 9
/* format */ /* format */
#define F_SIZECODE raw_cmd->cmd[2] #define F_SIZECODE (raw_cmd->cmd[2])
#define F_SECT_PER_TRACK raw_cmd->cmd[3] #define F_SECT_PER_TRACK (raw_cmd->cmd[3])
#define F_GAP raw_cmd->cmd[4] #define F_GAP (raw_cmd->cmd[4])
#define F_FILL raw_cmd->cmd[5] #define F_FILL (raw_cmd->cmd[5])
#define NR_F 6 #define NR_F 6
/* /*
* Maximum disk size (in kilobytes). This default is used whenever the * Maximum disk size (in kilobytes).
* current disk size is unknown. * This default is used whenever the current disk size is unknown.
* [Now it is rather a minimum] * [Now it is rather a minimum]
*/ */
#define MAX_DISK_SIZE 4 /* 3984 */ #define MAX_DISK_SIZE 4 /* 3984 */
...@@ -354,7 +356,8 @@ static int inr; /* size of reply buffer, when called from interrupt */ ...@@ -354,7 +356,8 @@ static int inr; /* size of reply buffer, when called from interrupt */
#define R_HEAD (reply_buffer[4]) #define R_HEAD (reply_buffer[4])
#define R_SECTOR (reply_buffer[5]) #define R_SECTOR (reply_buffer[5])
#define R_SIZECODE (reply_buffer[6]) #define R_SIZECODE (reply_buffer[6])
#define SEL_DLY (2*HZ/100)
#define SEL_DLY (2 * HZ / 100)
/* /*
* this struct defines the different floppy drive types. * this struct defines the different floppy drive types.
...@@ -545,7 +548,8 @@ static int max_buffer_sectors; ...@@ -545,7 +548,8 @@ static int max_buffer_sectors;
static int *errors; static int *errors;
typedef void (*done_f)(int); typedef void (*done_f)(int);
static struct cont_t { static struct cont_t {
void (*interrupt)(void); /* this is called after the interrupt of the void (*interrupt)(void);
/* this is called after the interrupt of the
* main command */ * main command */
void (*redo)(void); /* this is called to retry the operation */ void (*redo)(void); /* this is called to retry the operation */
void (*error)(void); /* this is called to tally an error */ void (*error)(void); /* this is called to tally an error */
...@@ -647,13 +651,13 @@ static void is_alive(const char *message) ...@@ -647,13 +651,13 @@ static void is_alive(const char *message)
} }
#endif #endif
static void (*do_floppy) (void) = NULL; static void (*do_floppy)(void) = NULL;
#ifdef FLOPPY_SANITY_CHECK #ifdef FLOPPY_SANITY_CHECK
#define OLOGSIZE 20 #define OLOGSIZE 20
static void (*lasthandler) (void); static void (*lasthandler)(void);
static unsigned long interruptjiffies; static unsigned long interruptjiffies;
static unsigned long resultjiffies; static unsigned long resultjiffies;
static int resultsize; static int resultsize;
...@@ -699,8 +703,8 @@ static void reschedule_timeout(int drive, const char *message, int marg) ...@@ -699,8 +703,8 @@ static void reschedule_timeout(int drive, const char *message, int marg)
spin_unlock_irqrestore(&floppy_lock, flags); spin_unlock_irqrestore(&floppy_lock, flags);
} }
#define INFBOUND(a,b) (a)=max_t(int, a, b) #define INFBOUND(a, b) (a) = max_t(int, a, b)
#define SUPBOUND(a,b) (a)=min_t(int, a, b) #define SUPBOUND(a, b) (a) = min_t(int, a, b)
/* /*
* Bottom half floppy driver. * Bottom half floppy driver.
...@@ -909,10 +913,12 @@ static int _lock_fdc(int drive, int interruptible, int line) ...@@ -909,10 +913,12 @@ static int _lock_fdc(int drive, int interruptible, int line)
return 0; return 0;
} }
#define lock_fdc(drive,interruptible) _lock_fdc(drive,interruptible, __LINE__) #define lock_fdc(drive, interruptible) \
_lock_fdc(drive, interruptible, __LINE__)
#define LOCK_FDC(drive,interruptible) \ #define LOCK_FDC(drive, interruptible) \
if (lock_fdc(drive,interruptible)) return -EINTR; if (lock_fdc(drive, interruptible)) \
return -EINTR;
/* unlocks the driver */ /* unlocks the driver */
static inline void unlock_fdc(void) static inline void unlock_fdc(void)
...@@ -1003,7 +1009,7 @@ static void empty(void) ...@@ -1003,7 +1009,7 @@ static void empty(void)
static DECLARE_WORK(floppy_work, NULL); static DECLARE_WORK(floppy_work, NULL);
static void schedule_bh(void (*handler) (void)) static void schedule_bh(void (*handler)(void))
{ {
PREPARE_WORK(&floppy_work, (work_func_t)handler); PREPARE_WORK(&floppy_work, (work_func_t)handler);
schedule_work(&floppy_work); schedule_work(&floppy_work);
...@@ -2181,8 +2187,9 @@ static void format_interrupt(void) ...@@ -2181,8 +2187,9 @@ static void format_interrupt(void)
} }
#define CODE2SIZE (ssize = ((1 << SIZECODE) + 3) >> 2) #define CODE2SIZE (ssize = ((1 << SIZECODE) + 3) >> 2)
#define FM_MODE(x,y) ((y) & ~(((x)->rate & 0x80) >>1)) #define FM_MODE(x, y) ((y) & ~(((x)->rate & 0x80) >> 1))
#define CT(x) ((x) | 0xc0) #define CT(x) ((x) | 0xc0)
static void setup_format_params(int track) static void setup_format_params(int track)
{ {
int n; int n;
...@@ -2197,8 +2204,8 @@ static void setup_format_params(int track) ...@@ -2197,8 +2204,8 @@ static void setup_format_params(int track)
raw_cmd = &default_raw_cmd; raw_cmd = &default_raw_cmd;
raw_cmd->track = track; raw_cmd->track = track;
raw_cmd->flags = FD_RAW_WRITE | FD_RAW_INTR | FD_RAW_SPIN | raw_cmd->flags = (FD_RAW_WRITE | FD_RAW_INTR | FD_RAW_SPIN |
FD_RAW_NEED_DISK | FD_RAW_NEED_SEEK; FD_RAW_NEED_DISK | FD_RAW_NEED_SEEK);
raw_cmd->rate = _floppy->rate & 0x43; raw_cmd->rate = _floppy->rate & 0x43;
raw_cmd->cmd_count = NR_F; raw_cmd->cmd_count = NR_F;
COMMAND = FM_MODE(_floppy, FD_FORMAT); COMMAND = FM_MODE(_floppy, FD_FORMAT);
...@@ -2600,8 +2607,9 @@ static void virtualdmabug_workaround(void) ...@@ -2600,8 +2607,9 @@ static void virtualdmabug_workaround(void)
return; return;
} }
#endif #endif
SECT_PER_TRACK = end_sector; /* make sure SECT_PER_TRACK points SECT_PER_TRACK = end_sector;
* to end of transfer */ /* make sure SECT_PER_TRACK
* points to end of transfer */
} }
} }
...@@ -3075,13 +3083,16 @@ static inline int fd_copyout(void __user *param, const void *address, ...@@ -3075,13 +3083,16 @@ static inline int fd_copyout(void __user *param, const void *address,
return copy_to_user(param, address, size) ? -EFAULT : 0; return copy_to_user(param, address, size) ? -EFAULT : 0;
} }
static inline int fd_copyin(void __user *param, void *address, unsigned long size) static inline int fd_copyin(void __user *param, void *address,
unsigned long size)
{ {
return copy_from_user(address, param, size) ? -EFAULT : 0; return copy_from_user(address, param, size) ? -EFAULT : 0;
} }
#define _COPYOUT(x) (copy_to_user((void __user *)param, &(x), sizeof(x)) ? -EFAULT : 0) #define _COPYOUT(x) (copy_to_user((void __user *)param, &(x), sizeof(x)) \
#define _COPYIN(x) (copy_from_user(&(x), (void __user *)param, sizeof(x)) ? -EFAULT : 0) ? -EFAULT : 0)
#define _COPYIN(x) (copy_from_user(&(x), (void __user *)param, sizeof(x)) \
? -EFAULT : 0)
#define COPYOUT(x) ECALL(_COPYOUT(x)) #define COPYOUT(x) ECALL(_COPYOUT(x))
#define COPYIN(x) ECALL(_COPYIN(x)) #define COPYIN(x) ECALL(_COPYIN(x))
...@@ -4148,7 +4159,8 @@ static ssize_t floppy_cmos_show(struct device *dev, ...@@ -4148,7 +4159,8 @@ static ssize_t floppy_cmos_show(struct device *dev,
drive = p->id; drive = p->id;
return sprintf(buf, "%X\n", UDP->cmos); return sprintf(buf, "%X\n", UDP->cmos);
} }
DEVICE_ATTR(cmos,S_IRUGO,floppy_cmos_show,NULL);
DEVICE_ATTR(cmos, S_IRUGO, floppy_cmos_show, NULL);
static void floppy_device_release(struct device *dev) static void floppy_device_release(struct device *dev)
{ {
...@@ -4625,6 +4637,7 @@ static void __exit floppy_module_exit(void) ...@@ -4625,6 +4637,7 @@ static void __exit floppy_module_exit(void)
/* eject disk, if any */ /* eject disk, if any */
fd_eject(0); fd_eject(0);
} }
module_exit(floppy_module_exit); module_exit(floppy_module_exit);
module_param(floppy, charp, 0); module_param(floppy, charp, 0);
...@@ -4636,9 +4649,10 @@ MODULE_LICENSE("GPL"); ...@@ -4636,9 +4649,10 @@ MODULE_LICENSE("GPL");
/* This doesn't actually get used other than for module information */ /* This doesn't actually get used other than for module information */
static const struct pnp_device_id floppy_pnpids[] = { static const struct pnp_device_id floppy_pnpids[] = {
{ "PNP0700", 0 }, {"PNP0700", 0},
{ } {}
}; };
MODULE_DEVICE_TABLE(pnp, floppy_pnpids); MODULE_DEVICE_TABLE(pnp, floppy_pnpids);
#else #else
......
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