Various drivers' irq handlers: kill dead code, needless casts

- Eliminate casts to/from void*

- Eliminate checks for conditions that never occur.  These typically
  fall into two classes:

	1) Checking for 'dev_id == NULL', then it is never called with
	NULL as an argument.

	2) Checking for invalid irq number, when the only caller (the
	system) guarantees the irq handler is called with the proper
	'irq' number argument.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Jeff Garzik 2006-10-06 15:00:58 -04:00
parent c31f28e778
commit c7bec5aba5
35 changed files with 59 additions and 98 deletions

View File

@ -862,15 +862,10 @@ static inline void interrupts_off (amb_dev * dev) {
/********** interrupt handling **********/
static irqreturn_t interrupt_handler(int irq, void *dev_id) {
amb_dev * dev = (amb_dev *) dev_id;
amb_dev * dev = dev_id;
PRINTD (DBG_IRQ|DBG_FLOW, "interrupt_handler: %p", dev_id);
if (!dev_id) {
PRINTD (DBG_IRQ|DBG_ERR, "irq with NULL dev_id: %d", irq);
return IRQ_NONE;
}
{
u32 interrupt = rd_plain (dev, offsetof(amb_mem, interrupt));

View File

@ -1389,15 +1389,6 @@ static irqreturn_t interrupt_handler(int irq, void *dev_id) {
PRINTD (DBG_FLOW, "interrupt_handler: %p", dev_id);
if (!dev_id) {
PRINTD (DBG_IRQ|DBG_ERR, "irq with NULL dev_id: %d", irq);
return IRQ_NONE;
}
if (irq != dev->irq) {
PRINTD (DBG_IRQ|DBG_ERR, "irq mismatch: %d", irq);
return IRQ_NONE;
}
// definitely for us
irq_ok = 0;
while ((int_source = rd_regl (dev, INT_SOURCE_REG_OFF)

View File

@ -1892,11 +1892,9 @@ static inline void lanai_int_1(struct lanai_dev *lanai, u32 reason)
static irqreturn_t lanai_int(int irq, void *devid)
{
struct lanai_dev *lanai = (struct lanai_dev *) devid;
struct lanai_dev *lanai = devid;
u32 reason;
(void) irq; /* unused variables */
#ifdef USE_POWERDOWN
/*
* If we're powered down we shouldn't be generating any interrupts -

View File

@ -5254,7 +5254,7 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
static irqreturn_t DAC960_GEM_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
DAC960_Controller_T *Controller = DeviceIdentifier;
void __iomem *ControllerBaseAddress = Controller->BaseAddress;
DAC960_V2_StatusMailbox_T *NextStatusMailbox;
unsigned long flags;
@ -5295,7 +5295,7 @@ static irqreturn_t DAC960_GEM_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
DAC960_Controller_T *Controller = DeviceIdentifier;
void __iomem *ControllerBaseAddress = Controller->BaseAddress;
DAC960_V2_StatusMailbox_T *NextStatusMailbox;
unsigned long flags;
@ -5337,7 +5337,7 @@ static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
DAC960_Controller_T *Controller = DeviceIdentifier;
void __iomem *ControllerBaseAddress = Controller->BaseAddress;
DAC960_V2_StatusMailbox_T *NextStatusMailbox;
unsigned long flags;
@ -5379,7 +5379,7 @@ static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
DAC960_Controller_T *Controller = DeviceIdentifier;
void __iomem *ControllerBaseAddress = Controller->BaseAddress;
DAC960_V1_StatusMailbox_T *NextStatusMailbox;
unsigned long flags;
@ -5417,7 +5417,7 @@ static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
DAC960_Controller_T *Controller = DeviceIdentifier;
void __iomem *ControllerBaseAddress = Controller->BaseAddress;
DAC960_V1_StatusMailbox_T *NextStatusMailbox;
unsigned long flags;
@ -5455,7 +5455,7 @@ static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
DAC960_Controller_T *Controller = DeviceIdentifier;
void __iomem *ControllerBaseAddress = Controller->BaseAddress;
unsigned long flags;
@ -5493,7 +5493,7 @@ static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_P_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
DAC960_Controller_T *Controller = DeviceIdentifier;
void __iomem *ControllerBaseAddress = Controller->BaseAddress;
unsigned long flags;

View File

@ -850,10 +850,6 @@ static irqreturn_t mcdx_intr(int irq, void *dev_id)
struct s_drive_stuff *stuffp = dev_id;
unsigned char b;
if (stuffp == NULL) {
xwarn("mcdx: no device for intr %d\n", irq);
return IRQ_NONE;
}
#ifdef AK2
if (!stuffp->busy && stuffp->pending)
stuffp->int_err = 1;

View File

@ -88,7 +88,7 @@ void RIOHostReset(unsigned int, struct DpRam __iomem *, unsigned int);
/* riointr.c */
void RIOTxEnable(char *);
void RIOServiceHost(struct rio_info *, struct Host *, int);
void RIOServiceHost(struct rio_info *, struct Host *);
int riotproc(struct rio_info *, struct ttystatics *, int, int);
/* rioparam.c */

View File

@ -368,7 +368,7 @@ static irqreturn_t rio_interrupt(int irq, void *ptr)
struct Host *HostP;
func_enter();
HostP = (struct Host *) ptr; /* &p->RIOHosts[(long)ptr]; */
HostP = ptr; /* &p->RIOHosts[(long)ptr]; */
rio_dprintk(RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", irq, HostP->Ivec);
/* AAargh! The order in which to do these things is essential and
@ -402,7 +402,7 @@ static irqreturn_t rio_interrupt(int irq, void *ptr)
return IRQ_HANDLED;
}
RIOServiceHost(p, HostP, irq);
RIOServiceHost(p, HostP);
rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %p type %d\n", ptr, HostP->Type);

View File

@ -181,7 +181,7 @@ static int RupIntr;
static int RxIntr;
static int TxIntr;
void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
void RIOServiceHost(struct rio_info *p, struct Host *HostP)
{
rio_spin_lock(&HostP->HostLock);
if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {

View File

@ -559,11 +559,10 @@ static irqreturn_t rc_interrupt(int irq, void * dev_id)
int handled = 0;
bp = IRQ_to_board[irq];
if (!bp || !(bp->flags & RC_BOARD_ACTIVE)) {
if (!(bp->flags & RC_BOARD_ACTIVE))
return IRQ_NONE;
}
while ((++loop < 16) && ((status = ~(rc_in(bp, RC_BSR))) &
(RC_BSR_TOUT | RC_BSR_TINT |
RC_BSR_MINT | RC_BSR_RINT))) {

View File

@ -912,7 +912,7 @@ static irqreturn_t sx_interrupt(int irq, void *dev_id)
spin_lock_irqsave(&bp->lock, flags);
dprintk (SX_DEBUG_FLOW, "enter %s port %d room: %ld\n", __FUNCTION__, port_No(sx_get_port(bp, "INT")), SERIAL_XMIT_SIZE - sx_get_port(bp, "ITN")->xmit_cnt - 1);
if (!bp || !(bp->flags & SX_BOARD_ACTIVE)) {
if (!(bp->flags & SX_BOARD_ACTIVE)) {
dprintk (SX_DEBUG_IRQ, "sx: False interrupt. irq %d.\n", irq);
spin_unlock_irqrestore(&bp->lock, flags);
func_exit();

View File

@ -1415,7 +1415,7 @@ zoran_irq (int irq,
struct zoran *zr;
unsigned long flags;
zr = (struct zoran *) dev_id;
zr = dev_id;
count = 0;
if (zr->testing) {

View File

@ -66,7 +66,7 @@ static int at91_cf_ss_init(struct pcmcia_socket *s)
static irqreturn_t at91_cf_irq(int irq, void *_cf)
{
struct at91_cf_socket *cf = (struct at91_cf_socket *) _cf;
struct at91_cf_socket *cf = _cf;
if (irq == cf->board->det_pin) {
unsigned present = at91_cf_present(cf);

View File

@ -650,7 +650,7 @@ static int hs_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem)
*/
static int hs_irq_demux(int irq, void *dev)
{
hs_socket_t *sp = (hs_socket_t *)dev;
hs_socket_t *sp = dev;
u_int cscr;
DPRINTK("hs_irq_demux(irq=%d)\n", irq);
@ -673,11 +673,10 @@ static int hs_irq_demux(int irq, void *dev)
static irqreturn_t hs_interrupt(int irq, void *dev)
{
hs_socket_t *sp = (hs_socket_t *)dev;
hs_socket_t *sp = dev;
u_int events = 0;
u_int cscr;
cscr = hs_in(sp, CSCR);
DPRINTK("hs_interrupt, cscr=%04x\n", cscr);

View File

@ -168,7 +168,7 @@ enum Phase {
};
/* Static function prototypes */
static void NCR53c406a_intr(int, void *);
static void NCR53c406a_intr(void *);
static irqreturn_t do_NCR53c406a_intr(int, void *);
static void chip_init(void);
static void calc_port_addr(void);
@ -685,7 +685,7 @@ static void wait_intr(void)
return;
}
NCR53c406a_intr(0, NULL, NULL);
NCR53c406a_intr(NULL);
}
#endif
@ -767,12 +767,12 @@ static irqreturn_t do_NCR53c406a_intr(int unused, void *dev_id)
struct Scsi_Host *dev = dev_id;
spin_lock_irqsave(dev->host_lock, flags);
NCR53c406a_intr(0, dev_id);
NCR53c406a_intr(dev_id);
spin_unlock_irqrestore(dev->host_lock, flags);
return IRQ_HANDLED;
}
static void NCR53c406a_intr(int unused, void *dev_id)
static void NCR53c406a_intr(void *dev_id)
{
DEB(unsigned char fifo_size;
)

View File

@ -759,12 +759,7 @@ static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, Scsi_Cmnd *SCp)
static irqreturn_t swintr(int irqno, void *dev_id)
{
struct Scsi_Host *shpnt = (struct Scsi_Host *)dev_id;
if (!shpnt) {
printk(KERN_ERR "aha152x: catched software interrupt %d for unknown controller.\n", irqno);
return IRQ_NONE;
}
struct Scsi_Host *shpnt = dev_id;
HOSTDATA(shpnt)->swint++;

View File

@ -6345,12 +6345,12 @@ aic7xxx_handle_command_completion_intr(struct aic7xxx_host *p)
* SCSI controller interrupt handler.
*-F*************************************************************************/
static void
aic7xxx_isr(int irq, void *dev_id)
aic7xxx_isr(void *dev_id)
{
struct aic7xxx_host *p;
unsigned char intstat;
p = (struct aic7xxx_host *)dev_id;
p = dev_id;
/*
* Just a few sanity checks. Make sure that we have an int pending.
@ -6489,7 +6489,7 @@ do_aic7xxx_isr(int irq, void *dev_id)
p->flags |= AHC_IN_ISR;
do
{
aic7xxx_isr(irq, dev_id);
aic7xxx_isr(dev_id);
} while ( (aic_inb(p, INTSTAT) & INT_PEND) );
aic7xxx_done_cmds_complete(p);
aic7xxx_run_waiting_queues(p);
@ -10377,7 +10377,7 @@ static int __aic7xxx_bus_device_reset(struct scsi_cmnd *cmd)
hscb = scb->hscb;
aic7xxx_isr(p->irq, (void *)p);
aic7xxx_isr(p);
aic7xxx_done_cmds_complete(p);
/* If the command was already complete or just completed, then we didn't
* do a reset, return FAILED */
@ -10608,7 +10608,7 @@ static int __aic7xxx_abort(struct scsi_cmnd *cmd)
else
return FAILED;
aic7xxx_isr(p->irq, (void *)p);
aic7xxx_isr(p);
aic7xxx_done_cmds_complete(p);
/* If the command was already complete or just completed, then we didn't
* do a reset, return FAILED */
@ -10863,7 +10863,7 @@ static int aic7xxx_reset(struct scsi_cmnd *cmd)
while((aic_inb(p, INTSTAT) & INT_PEND) && !(p->flags & AHC_IN_ISR))
{
aic7xxx_isr(p->irq, p);
aic7xxx_isr(p);
pause_sequencer(p);
}
aic7xxx_done_cmds_complete(p);

View File

@ -1815,7 +1815,7 @@ static void dc395x_handle_interrupt(struct AdapterCtlBlk *acb,
static irqreturn_t dc395x_interrupt(int irq, void *dev_id)
{
struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)dev_id;
struct AdapterCtlBlk *acb = dev_id;
u16 scsi_status;
u8 dma_status;
irqreturn_t handled = IRQ_NONE;

View File

@ -405,10 +405,10 @@ static unsigned int ql_pcmd(Scsi_Cmnd * cmd)
* Interrupt handler
*/
static void ql_ihandl(int irq, void *dev_id)
static void ql_ihandl(void *dev_id)
{
Scsi_Cmnd *icmd;
struct Scsi_Host *host = (struct Scsi_Host *)dev_id;
struct Scsi_Host *host = dev_id;
struct qlogicfas408_priv *priv = get_priv_by_host(host);
int qbase = priv->qbase;
REG0;
@ -438,7 +438,7 @@ irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id)
struct Scsi_Host *host = dev_id;
spin_lock_irqsave(host->host_lock, flags);
ql_ihandl(irq, dev_id);
ql_ihandl(dev_id);
spin_unlock_irqrestore(host->host_lock, flags);
return IRQ_HANDLED;
}

View File

@ -700,9 +700,9 @@ dc390_InvalidCmd(struct dc390_acb* pACB)
static irqreturn_t __inline__
DC390_Interrupt(int irq, void *dev_id)
DC390_Interrupt(void *dev_id)
{
struct dc390_acb *pACB = (struct dc390_acb*)dev_id;
struct dc390_acb *pACB = dev_id;
struct dc390_dcb *pDCB;
struct dc390_srb *pSRB;
u8 sstatus=0;
@ -811,12 +811,12 @@ DC390_Interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
static irqreturn_t do_DC390_Interrupt( int irq, void *dev_id)
static irqreturn_t do_DC390_Interrupt(int irq, void *dev_id)
{
irqreturn_t ret;
DEBUG1(printk (KERN_INFO "DC390: Irq (%i) caught: ", irq));
/* Locking is done in DC390_Interrupt */
ret = DC390_Interrupt(irq, dev_id);
ret = DC390_Interrupt(dev_id);
DEBUG1(printk (".. IRQ returned\n"));
return ret;
}

View File

@ -287,7 +287,7 @@ static const unsigned short ultrastor_ports_14f[] = {
};
#endif
static void ultrastor_interrupt(int, void *);
static void ultrastor_interrupt(void *);
static irqreturn_t do_ultrastor_interrupt(int, void *);
static inline void build_sg_list(struct mscp *, struct scsi_cmnd *SCpnt);
@ -893,7 +893,7 @@ static int ultrastor_abort(struct scsi_cmnd *SCpnt)
spin_lock_irqsave(host->host_lock, flags);
/* FIXME: Ewww... need to think about passing host around properly */
ultrastor_interrupt(0, NULL);
ultrastor_interrupt(NULL);
spin_unlock_irqrestore(host->host_lock, flags);
return SUCCESS;
}
@ -1039,7 +1039,7 @@ int ultrastor_biosparam(struct scsi_device *sdev, struct block_device *bdev,
return 0;
}
static void ultrastor_interrupt(int irq, void *dev_id)
static void ultrastor_interrupt(void *dev_id)
{
unsigned int status;
#if ULTRASTOR_MAX_CMDS > 1
@ -1177,7 +1177,7 @@ static irqreturn_t do_ultrastor_interrupt(int irq, void *dev_id)
struct Scsi_Host *dev = dev_id;
spin_lock_irqsave(dev->host_lock, flags);
ultrastor_interrupt(irq, dev_id);
ultrastor_interrupt(dev_id);
spin_unlock_irqrestore(dev->host_lock, flags);
return IRQ_HANDLED;
}

View File

@ -620,7 +620,7 @@ static void rs_360_interrupt(int vec, void *dev_id)
volatile struct smc_regs *smcp;
volatile struct scc_regs *sccp;
info = (ser_info_t *)dev_id;
info = dev_id;
idx = PORT_NUM(info->state->smc_scc_num);
if (info->state->smc_scc_num & NUM_IS_SCC) {

View File

@ -1116,7 +1116,7 @@ static void neo_param(struct jsm_channel *ch)
*/
static irqreturn_t neo_intr(int irq, void *voidbrd)
{
struct jsm_board *brd = (struct jsm_board *) voidbrd;
struct jsm_board *brd = voidbrd;
struct jsm_channel *ch;
int port = 0;
int type = 0;

View File

@ -512,19 +512,11 @@ mpc52xx_uart_int_tx_chars(struct uart_port *port)
static irqreturn_t
mpc52xx_uart_int(int irq, void *dev_id)
{
struct uart_port *port = (struct uart_port *) dev_id;
struct uart_port *port = dev_id;
unsigned long pass = ISR_PASS_LIMIT;
unsigned int keepgoing;
unsigned short status;
if ( irq != port->irq ) {
printk( KERN_WARNING
"mpc52xx_uart_int : " \
"Received wrong int %d. Waiting for %d\n",
irq, port->irq);
return IRQ_NONE;
}
spin_lock(&port->lock);
/* While we have stuff to do, we continue */

View File

@ -247,7 +247,7 @@ static void netx_rxint(struct uart_port *port)
static irqreturn_t netx_int(int irq, void *dev_id)
{
struct uart_port *port = (struct uart_port *)dev_id;
struct uart_port *port = dev_id;
unsigned long flags;
unsigned char status;

View File

@ -232,7 +232,7 @@ static inline void check_modem_status(struct uart_pxa_port *up)
*/
static inline irqreturn_t serial_pxa_irq(int irq, void *dev_id)
{
struct uart_pxa_port *up = (struct uart_pxa_port *)dev_id;
struct uart_pxa_port *up = dev_id;
unsigned int iir, lsr;
iir = serial_in(up, UART_IIR);

View File

@ -401,7 +401,7 @@ static inline uint32_t get_pending_intrs(struct ioc3_driver_data *idd)
static irqreturn_t ioc3_intr_io(int irq, void *arg)
{
unsigned long flags;
struct ioc3_driver_data *idd = (struct ioc3_driver_data *)arg;
struct ioc3_driver_data *idd = arg;
int handled = 1, id;
unsigned int pending;

View File

@ -669,7 +669,7 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
static irqreturn_t ssp_int(int irq, void *dev_id)
{
struct driver_data *drv_data = (struct driver_data *)dev_id;
struct driver_data *drv_data = dev_id;
void *reg = drv_data->ioaddr;
if (!drv_data->cur_msg) {

View File

@ -107,7 +107,7 @@ static int __init snd_gusmax_detect(struct snd_gus_card * gus)
static irqreturn_t snd_gusmax_interrupt(int irq, void *dev_id)
{
struct snd_gusmax *maxcard = (struct snd_gusmax *) dev_id;
struct snd_gusmax *maxcard = dev_id;
int loop, max = 5;
int handled = 0;

View File

@ -301,7 +301,7 @@ static int __devinit snd_interwave_detect(struct snd_interwave *iwcard,
static irqreturn_t snd_interwave_interrupt(int irq, void *dev_id)
{
struct snd_interwave *iwcard = (struct snd_interwave *) dev_id;
struct snd_interwave *iwcard = dev_id;
int loop, max = 5;
int handled = 0;

View File

@ -1102,7 +1102,7 @@ static void es1371_handle_midi(struct es1371_state *s)
static irqreturn_t es1371_interrupt(int irq, void *dev_id)
{
struct es1371_state *s = (struct es1371_state *)dev_id;
struct es1371_state *s = dev_id;
unsigned int intsrc, sctl;
/* fastpath out, to ease interrupt sharing */

View File

@ -372,7 +372,7 @@ static void hal2_adc_interrupt(struct hal2_codec *adc)
static irqreturn_t hal2_interrupt(int irq, void *dev_id)
{
struct hal2_card *hal2 = (struct hal2_card*)dev_id;
struct hal2_card *hal2 = dev_id;
irqreturn_t ret = IRQ_NONE;
/* decide what caused this interrupt */

View File

@ -1525,7 +1525,7 @@ static void i810_channel_interrupt(struct i810_card *card)
static irqreturn_t i810_interrupt(int irq, void *dev_id)
{
struct i810_card *card = (struct i810_card *)dev_id;
struct i810_card *card = dev_id;
u32 status;
spin_lock(&card->lock);

View File

@ -435,7 +435,7 @@ static void mpu401_input_loop(struct mpu_config *devc)
static irqreturn_t mpuintr(int irq, void *dev_id)
{
struct mpu_config *devc;
int dev = (int) dev_id;
int dev = (int)(unsigned long) dev_id;
int handled = 0;
devc = &dev_conf[dev];

View File

@ -2235,7 +2235,7 @@ static void vwsnd_audio_write_intr(vwsnd_dev_t *devc, unsigned int status)
static irqreturn_t vwsnd_audio_intr(int irq, void *dev_id)
{
vwsnd_dev_t *devc = (vwsnd_dev_t *) dev_id;
vwsnd_dev_t *devc = dev_id;
unsigned int status;
DBGEV("(irq=%d, dev_id=0x%p)\n", irq, dev_id);

View File

@ -1124,9 +1124,6 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id)
u32 doorbellValue;
struct snd_korg1212 *korg1212 = dev_id;
if(irq != korg1212->irq)
return IRQ_NONE;
doorbellValue = readl(korg1212->inDoorbellPtr);
if (!doorbellValue)
@ -1140,7 +1137,6 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id)
korg1212->inIRQ++;
switch (doorbellValue) {
case K1212_DB_DSPDownloadDone:
K1212_DEBUG_PRINTK("K1212_DEBUG: IRQ DNLD count - %ld, %x, [%s].\n",