Commit a3ccc789 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Jeff Garzik

tlan: proper shared IRQ support

Handle shared IRQ correctly. If IRQ is shared, it typically will show up
as an IRQ with an empty status field. So check in driver and handle it
without crapping out with invalid interrupt message.

Compile tested only.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 9ded65a1
...@@ -218,7 +218,7 @@ static int bbuf; ...@@ -218,7 +218,7 @@ static int bbuf;
module_param(bbuf, int, 0); module_param(bbuf, int, 0);
MODULE_PARM_DESC(bbuf, "ThunderLAN use big buffer (0-1)"); MODULE_PARM_DESC(bbuf, "ThunderLAN use big buffer (0-1)");
static char TLanSignature[] = "TLAN"; static const char TLanSignature[] = "TLAN";
static const char tlan_banner[] = "ThunderLAN driver v1.15\n"; static const char tlan_banner[] = "ThunderLAN driver v1.15\n";
static int tlan_have_pci; static int tlan_have_pci;
static int tlan_have_eisa; static int tlan_have_eisa;
...@@ -297,7 +297,6 @@ static void TLan_tx_timeout( struct net_device *dev); ...@@ -297,7 +297,6 @@ static void TLan_tx_timeout( struct net_device *dev);
static void TLan_tx_timeout_work(struct work_struct *work); static void TLan_tx_timeout_work(struct work_struct *work);
static int tlan_init_one( struct pci_dev *pdev, const struct pci_device_id *ent); static int tlan_init_one( struct pci_dev *pdev, const struct pci_device_id *ent);
static u32 TLan_HandleInvalid( struct net_device *, u16 );
static u32 TLan_HandleTxEOF( struct net_device *, u16 ); static u32 TLan_HandleTxEOF( struct net_device *, u16 );
static u32 TLan_HandleStatOverflow( struct net_device *, u16 ); static u32 TLan_HandleStatOverflow( struct net_device *, u16 );
static u32 TLan_HandleRxEOF( struct net_device *, u16 ); static u32 TLan_HandleRxEOF( struct net_device *, u16 );
...@@ -366,7 +365,7 @@ TLan_GetSKB( const struct tlan_list_tag *tag) ...@@ -366,7 +365,7 @@ TLan_GetSKB( const struct tlan_list_tag *tag)
static TLanIntVectorFunc *TLanIntVector[TLAN_INT_NUMBER_OF_INTS] = { static TLanIntVectorFunc *TLanIntVector[TLAN_INT_NUMBER_OF_INTS] = {
TLan_HandleInvalid, NULL,
TLan_HandleTxEOF, TLan_HandleTxEOF,
TLan_HandleStatOverflow, TLan_HandleStatOverflow,
TLan_HandleRxEOF, TLan_HandleRxEOF,
...@@ -935,7 +934,8 @@ static int TLan_Open( struct net_device *dev ) ...@@ -935,7 +934,8 @@ static int TLan_Open( struct net_device *dev )
int err; int err;
priv->tlanRev = TLan_DioRead8( dev->base_addr, TLAN_DEF_REVISION ); priv->tlanRev = TLan_DioRead8( dev->base_addr, TLAN_DEF_REVISION );
err = request_irq( dev->irq, TLan_HandleInterrupt, IRQF_SHARED, TLanSignature, dev ); err = request_irq( dev->irq, TLan_HandleInterrupt, IRQF_SHARED,
dev->name, dev );
if ( err ) { if ( err ) {
printk(KERN_ERR "TLAN: Cannot open %s because IRQ %d is already in use.\n", dev->name, dev->irq ); printk(KERN_ERR "TLAN: Cannot open %s because IRQ %d is already in use.\n", dev->name, dev->irq );
...@@ -1167,33 +1167,31 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev ) ...@@ -1167,33 +1167,31 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev )
static irqreturn_t TLan_HandleInterrupt(int irq, void *dev_id) static irqreturn_t TLan_HandleInterrupt(int irq, void *dev_id)
{ {
u32 ack; struct net_device *dev = dev_id;
struct net_device *dev; TLanPrivateInfo *priv = netdev_priv(dev);
u32 host_cmd;
u16 host_int; u16 host_int;
int type; u16 type;
TLanPrivateInfo *priv;
dev = dev_id;
priv = netdev_priv(dev);
spin_lock(&priv->lock); spin_lock(&priv->lock);
host_int = inw( dev->base_addr + TLAN_HOST_INT ); host_int = inw( dev->base_addr + TLAN_HOST_INT );
outw( host_int, dev->base_addr + TLAN_HOST_INT );
type = ( host_int & TLAN_HI_IT_MASK ) >> 2; type = ( host_int & TLAN_HI_IT_MASK ) >> 2;
if ( type ) {
u32 ack;
u32 host_cmd;
outw( host_int, dev->base_addr + TLAN_HOST_INT );
ack = TLanIntVector[type]( dev, host_int ); ack = TLanIntVector[type]( dev, host_int );
if ( ack ) { if ( ack ) {
host_cmd = TLAN_HC_ACK | ack | ( type << 18 ); host_cmd = TLAN_HC_ACK | ack | ( type << 18 );
outl( host_cmd, dev->base_addr + TLAN_HOST_CMD ); outl( host_cmd, dev->base_addr + TLAN_HOST_CMD );
} }
}
spin_unlock(&priv->lock); spin_unlock(&priv->lock);
return IRQ_HANDLED; return IRQ_RETVAL(type);
} /* TLan_HandleInterrupts */ } /* TLan_HandleInterrupts */
...@@ -1359,31 +1357,6 @@ static void TLan_SetMulticastList( struct net_device *dev ) ...@@ -1359,31 +1357,6 @@ static void TLan_SetMulticastList( struct net_device *dev )
*****************************************************************************/ *****************************************************************************/
/***************************************************************
* TLan_HandleInvalid
*
* Returns:
* 0
* Parms:
* dev Device assigned the IRQ that was
* raised.
* host_int The contents of the HOST_INT
* port.
*
* This function handles invalid interrupts. This should
* never happen unless some other adapter is trying to use
* the IRQ line assigned to the device.
*
**************************************************************/
static u32 TLan_HandleInvalid( struct net_device *dev, u16 host_int )
{
/* printk( "TLAN: Invalid interrupt on %s.\n", dev->name ); */
return 0;
} /* TLan_HandleInvalid */
/*************************************************************** /***************************************************************
......
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