Loading drivers/atm/solos-pci.c +11 −28 Original line number Diff line number Diff line Loading @@ -165,7 +165,6 @@ static uint32_t fpga_tx(struct solos_card *); static irqreturn_t solos_irq(int irq, void *dev_id); static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); static int list_vccs(int vci); static void release_vccs(struct atm_dev *dev); static int atm_init(struct solos_card *, struct device *); static void atm_remove(struct solos_card *); static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); Loading Loading @@ -384,7 +383,6 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb /* Anything but 'Showtime' is down */ if (strcmp(state_str, "Showtime")) { atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST); release_vccs(card->atmdev[port]); dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str); return 0; } Loading Loading @@ -697,7 +695,7 @@ void solos_bh(unsigned long card_arg) size); } if (atmdebug) { dev_info(&card->dev->dev, "Received: device %d\n", port); dev_info(&card->dev->dev, "Received: port %d\n", port); dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", size, le16_to_cpu(header->vpi), le16_to_cpu(header->vci)); Loading @@ -710,8 +708,8 @@ void solos_bh(unsigned long card_arg) le16_to_cpu(header->vci)); if (!vcc) { if (net_ratelimit()) dev_warn(&card->dev->dev, "Received packet for unknown VCI.VPI %d.%d on port %d\n", le16_to_cpu(header->vci), le16_to_cpu(header->vpi), dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n", le16_to_cpu(header->vpi), le16_to_cpu(header->vci), port); continue; } Loading Loading @@ -830,28 +828,6 @@ static int list_vccs(int vci) return num_found; } static void release_vccs(struct atm_dev *dev) { int i; write_lock_irq(&vcc_sklist_lock); for (i = 0; i < VCC_HTABLE_SIZE; i++) { struct hlist_head *head = &vcc_hash[i]; struct hlist_node *node, *tmp; struct sock *s; struct atm_vcc *vcc; sk_for_each_safe(s, node, tmp, head) { vcc = atm_sk(s); if (vcc->dev == dev) { vcc_release_async(vcc, -EPIPE); sk_del_node_init(s); } } } write_unlock_irq(&vcc_sklist_lock); } static int popen(struct atm_vcc *vcc) { Loading Loading @@ -1018,8 +994,15 @@ static uint32_t fpga_tx(struct solos_card *card) /* Clean up and free oldskb now it's gone */ if (atmdebug) { struct pkt_hdr *header = (void *)oldskb->data; int size = le16_to_cpu(header->size); skb_pull(oldskb, sizeof(*header)); dev_info(&card->dev->dev, "Transmitted: port %d\n", port); dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", size, le16_to_cpu(header->vpi), le16_to_cpu(header->vci)); print_buffer(oldskb); } Loading Loading @@ -1262,7 +1245,7 @@ static int atm_init(struct solos_card *card, struct device *parent) card->atmdev[i]->ci_range.vci_bits = 16; card->atmdev[i]->dev_data = card; card->atmdev[i]->phy_data = (void *)(unsigned long)i; atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_UNKNOWN); atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND); skb = alloc_skb(sizeof(*header), GFP_ATOMIC); if (!skb) { Loading drivers/connector/cn_queue.c +17 −41 Original line number Diff line number Diff line Loading @@ -31,24 +31,9 @@ #include <linux/connector.h> #include <linux/delay.h> void cn_queue_wrapper(struct work_struct *work) { struct cn_callback_entry *cbq = container_of(work, struct cn_callback_entry, work); struct cn_callback_data *d = &cbq->data; struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb)); struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb); d->callback(msg, nsp); kfree_skb(d->skb); d->skb = NULL; kfree(d->free); } static struct cn_callback_entry * cn_queue_alloc_callback_entry(const char *name, struct cb_id *id, cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) { struct cn_callback_entry *cbq; Loading @@ -59,17 +44,23 @@ cn_queue_alloc_callback_entry(const char *name, struct cb_id *id, return NULL; } atomic_set(&cbq->refcnt, 1); atomic_inc(&dev->refcnt); cbq->pdev = dev; snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name); memcpy(&cbq->id.id, id, sizeof(struct cb_id)); cbq->data.callback = callback; INIT_WORK(&cbq->work, &cn_queue_wrapper); cbq->callback = callback; return cbq; } static void cn_queue_free_callback(struct cn_callback_entry *cbq) void cn_queue_release_callback(struct cn_callback_entry *cbq) { flush_workqueue(cbq->pdev->cn_queue); if (!atomic_dec_and_test(&cbq->refcnt)) return; atomic_dec(&cbq->pdev->refcnt); kfree(cbq); } Loading @@ -85,13 +76,10 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, struct cn_callback_entry *cbq, *__cbq; int found = 0; cbq = cn_queue_alloc_callback_entry(name, id, callback); cbq = cn_queue_alloc_callback_entry(dev, name, id, callback); if (!cbq) return -ENOMEM; atomic_inc(&dev->refcnt); cbq->pdev = dev; spin_lock_bh(&dev->queue_lock); list_for_each_entry(__cbq, &dev->queue_list, callback_entry) { if (cn_cb_equal(&__cbq->id.id, id)) { Loading @@ -104,8 +92,7 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, spin_unlock_bh(&dev->queue_lock); if (found) { cn_queue_free_callback(cbq); atomic_dec(&dev->refcnt); cn_queue_release_callback(cbq); return -EINVAL; } Loading @@ -130,10 +117,8 @@ void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id) } spin_unlock_bh(&dev->queue_lock); if (found) { cn_queue_free_callback(cbq); atomic_dec(&dev->refcnt); } if (found) cn_queue_release_callback(cbq); } struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls) Loading @@ -151,12 +136,6 @@ struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls) dev->nls = nls; dev->cn_queue = alloc_ordered_workqueue(dev->name, 0); if (!dev->cn_queue) { kfree(dev); return NULL; } return dev; } Loading @@ -164,9 +143,6 @@ void cn_queue_free_dev(struct cn_queue_dev *dev) { struct cn_callback_entry *cbq, *n; flush_workqueue(dev->cn_queue); destroy_workqueue(dev->cn_queue); spin_lock_bh(&dev->queue_lock); list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry) list_del(&cbq->callback_entry); Loading drivers/connector/connector.c +12 −35 Original line number Diff line number Diff line Loading @@ -122,51 +122,28 @@ EXPORT_SYMBOL_GPL(cn_netlink_send); */ static int cn_call_callback(struct sk_buff *skb) { struct cn_callback_entry *__cbq, *__new_cbq; struct cn_callback_entry *i, *cbq = NULL; struct cn_dev *dev = &cdev; struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb)); struct netlink_skb_parms *nsp = &NETLINK_CB(skb); int err = -ENODEV; spin_lock_bh(&dev->cbdev->queue_lock); list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { if (cn_cb_equal(&__cbq->id.id, &msg->id)) { if (likely(!work_pending(&__cbq->work) && __cbq->data.skb == NULL)) { __cbq->data.skb = skb; if (queue_work(dev->cbdev->cn_queue, &__cbq->work)) err = 0; else err = -EINVAL; } else { struct cn_callback_data *d; err = -ENOMEM; __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); if (__new_cbq) { d = &__new_cbq->data; d->skb = skb; d->callback = __cbq->data.callback; d->free = __new_cbq; INIT_WORK(&__new_cbq->work, &cn_queue_wrapper); if (queue_work(dev->cbdev->cn_queue, &__new_cbq->work)) err = 0; else { kfree(__new_cbq); err = -EINVAL; } } } list_for_each_entry(i, &dev->cbdev->queue_list, callback_entry) { if (cn_cb_equal(&i->id.id, &msg->id)) { atomic_inc(&i->refcnt); cbq = i; break; } } spin_unlock_bh(&dev->cbdev->queue_lock); if (cbq != NULL) { cbq->callback(msg, nsp); kfree_skb(skb); cn_queue_release_callback(cbq); } return err; } Loading drivers/net/atlx/atl2.c +14 −8 Original line number Diff line number Diff line Loading @@ -1996,13 +1996,15 @@ static int atl2_set_eeprom(struct net_device *netdev, if (!eeprom_buff) return -ENOMEM; ptr = (u32 *)eeprom_buff; ptr = eeprom_buff; if (eeprom->offset & 3) { /* need read/modify/write of first changed EEPROM word */ /* only the second byte of the word is being modified */ if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) return -EIO; if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) { ret_val = -EIO; goto out; } ptr++; } if (((eeprom->offset + eeprom->len) & 3)) { Loading @@ -2011,18 +2013,22 @@ static int atl2_set_eeprom(struct net_device *netdev, * only the first byte of the word is being modified */ if (!atl2_read_eeprom(hw, last_dword * 4, &(eeprom_buff[last_dword - first_dword]))) return -EIO; &(eeprom_buff[last_dword - first_dword]))) { ret_val = -EIO; goto out; } } /* Device's eeprom is always little-endian, word addressable */ memcpy(ptr, bytes, eeprom->len); for (i = 0; i < last_dword - first_dword + 1; i++) { if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) return -EIO; if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) { ret_val = -EIO; goto out; } } out: kfree(eeprom_buff); return ret_val; } Loading drivers/net/irda/via-ircc.c +21 −73 Original line number Diff line number Diff line Loading @@ -75,15 +75,9 @@ static int dongle_id = 0; /* default: probe */ /* We can't guess the type of connected dongle, user *must* supply it. */ module_param(dongle_id, int, 0); /* FIXME : we should not need this, because instances should be automatically * managed by the PCI layer. Especially that we seem to only be using the * first entry. Jean II */ /* Max 4 instances for now */ static struct via_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL }; /* Some prototypes */ static int via_ircc_open(int i, chipio_t * info, unsigned int id); static int via_ircc_close(struct via_ircc_cb *self); static int via_ircc_open(struct pci_dev *pdev, chipio_t * info, unsigned int id); static int via_ircc_dma_receive(struct via_ircc_cb *self); static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, int iobase); Loading Loading @@ -215,7 +209,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0)); pci_write_config_byte(pcidev,0x5a,0xc0); WriteLPCReg(0x28, 0x70 ); if (via_ircc_open(0, &info,0x3076) == 0) if (via_ircc_open(pcidev, &info, 0x3076) == 0) rc=0; } else rc = -ENODEV; //IR not turn on Loading Loading @@ -254,7 +248,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi info.irq=FirIRQ; info.dma=FirDRQ1; info.dma2=FirDRQ0; if (via_ircc_open(0, &info,0x3096) == 0) if (via_ircc_open(pcidev, &info, 0x3096) == 0) rc=0; } else rc = -ENODEV; //IR not turn on !!!!! Loading @@ -264,48 +258,10 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi return rc; } /* * Function via_ircc_clean () * * Close all configured chips * */ static void via_ircc_clean(void) { int i; IRDA_DEBUG(3, "%s()\n", __func__); for (i=0; i < ARRAY_SIZE(dev_self); i++) { if (dev_self[i]) via_ircc_close(dev_self[i]); } } static void __devexit via_remove_one (struct pci_dev *pdev) { IRDA_DEBUG(3, "%s()\n", __func__); /* FIXME : This is ugly. We should use pci_get_drvdata(pdev); * to get our driver instance and call directly via_ircc_close(). * See vlsi_ir for details... * Jean II */ via_ircc_clean(); /* FIXME : This should be in via_ircc_close(), because here we may * theoritically disable still configured devices :-( - Jean II */ pci_disable_device(pdev); } static void __exit via_ircc_cleanup(void) { IRDA_DEBUG(3, "%s()\n", __func__); /* FIXME : This should be redundant, as pci_unregister_driver() * should call via_remove_one() on each device. * Jean II */ via_ircc_clean(); /* Cleanup all instances of the driver */ pci_unregister_driver (&via_driver); } Loading @@ -324,12 +280,13 @@ static const struct net_device_ops via_ircc_fir_ops = { }; /* * Function via_ircc_open (iobase, irq) * Function via_ircc_open(pdev, iobase, irq) * * Open driver instance * */ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) static __devinit int via_ircc_open(struct pci_dev *pdev, chipio_t * info, unsigned int id) { struct net_device *dev; struct via_ircc_cb *self; Loading @@ -337,9 +294,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) IRDA_DEBUG(3, "%s()\n", __func__); if (i >= ARRAY_SIZE(dev_self)) return -ENOMEM; /* Allocate new instance of the driver */ dev = alloc_irdadev(sizeof(struct via_ircc_cb)); if (dev == NULL) Loading @@ -349,13 +303,8 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) self->netdev = dev; spin_lock_init(&self->lock); /* FIXME : We should store our driver instance in the PCI layer, * using pci_set_drvdata(), not in this array. * See vlsi_ir for details... - Jean II */ /* FIXME : 'i' is always 0 (see via_init_one()) :-( - Jean II */ /* Need to store self somewhere */ dev_self[i] = self; self->index = i; pci_set_drvdata(pdev, self); /* Initialize Resource */ self->io.cfg_base = info->cfg_base; self->io.fir_base = info->fir_base; Loading Loading @@ -414,7 +363,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) /* Allocate memory if needed */ self->rx_buff.head = dma_alloc_coherent(NULL, self->rx_buff.truesize, dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize, &self->rx_buff_dma, GFP_KERNEL); if (self->rx_buff.head == NULL) { err = -ENOMEM; Loading @@ -423,7 +372,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) memset(self->rx_buff.head, 0, self->rx_buff.truesize); self->tx_buff.head = dma_alloc_coherent(NULL, self->tx_buff.truesize, dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize, &self->tx_buff_dma, GFP_KERNEL); if (self->tx_buff.head == NULL) { err = -ENOMEM; Loading Loading @@ -455,33 +404,32 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) via_hw_init(self); return 0; err_out4: dma_free_coherent(NULL, self->tx_buff.truesize, dma_free_coherent(&pdev->dev, self->tx_buff.truesize, self->tx_buff.head, self->tx_buff_dma); err_out3: dma_free_coherent(NULL, self->rx_buff.truesize, dma_free_coherent(&pdev->dev, self->rx_buff.truesize, self->rx_buff.head, self->rx_buff_dma); err_out2: release_region(self->io.fir_base, self->io.fir_ext); err_out1: pci_set_drvdata(pdev, NULL); free_netdev(dev); dev_self[i] = NULL; return err; } /* * Function via_ircc_close (self) * Function via_remove_one(pdev) * * Close driver instance * */ static int via_ircc_close(struct via_ircc_cb *self) static void __devexit via_remove_one(struct pci_dev *pdev) { struct via_ircc_cb *self = pci_get_drvdata(pdev); int iobase; IRDA_DEBUG(3, "%s()\n", __func__); IRDA_ASSERT(self != NULL, return -1;); iobase = self->io.fir_base; ResetChip(iobase, 5); //hardware reset. Loading @@ -493,16 +441,16 @@ static int via_ircc_close(struct via_ircc_cb *self) __func__, self->io.fir_base); release_region(self->io.fir_base, self->io.fir_ext); if (self->tx_buff.head) dma_free_coherent(NULL, self->tx_buff.truesize, dma_free_coherent(&pdev->dev, self->tx_buff.truesize, self->tx_buff.head, self->tx_buff_dma); if (self->rx_buff.head) dma_free_coherent(NULL, self->rx_buff.truesize, dma_free_coherent(&pdev->dev, self->rx_buff.truesize, self->rx_buff.head, self->rx_buff_dma); dev_self[self->index] = NULL; pci_set_drvdata(pdev, NULL); free_netdev(self->netdev); return 0; pci_disable_device(pdev); } /* Loading Loading
drivers/atm/solos-pci.c +11 −28 Original line number Diff line number Diff line Loading @@ -165,7 +165,6 @@ static uint32_t fpga_tx(struct solos_card *); static irqreturn_t solos_irq(int irq, void *dev_id); static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); static int list_vccs(int vci); static void release_vccs(struct atm_dev *dev); static int atm_init(struct solos_card *, struct device *); static void atm_remove(struct solos_card *); static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); Loading Loading @@ -384,7 +383,6 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb /* Anything but 'Showtime' is down */ if (strcmp(state_str, "Showtime")) { atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST); release_vccs(card->atmdev[port]); dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str); return 0; } Loading Loading @@ -697,7 +695,7 @@ void solos_bh(unsigned long card_arg) size); } if (atmdebug) { dev_info(&card->dev->dev, "Received: device %d\n", port); dev_info(&card->dev->dev, "Received: port %d\n", port); dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", size, le16_to_cpu(header->vpi), le16_to_cpu(header->vci)); Loading @@ -710,8 +708,8 @@ void solos_bh(unsigned long card_arg) le16_to_cpu(header->vci)); if (!vcc) { if (net_ratelimit()) dev_warn(&card->dev->dev, "Received packet for unknown VCI.VPI %d.%d on port %d\n", le16_to_cpu(header->vci), le16_to_cpu(header->vpi), dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n", le16_to_cpu(header->vpi), le16_to_cpu(header->vci), port); continue; } Loading Loading @@ -830,28 +828,6 @@ static int list_vccs(int vci) return num_found; } static void release_vccs(struct atm_dev *dev) { int i; write_lock_irq(&vcc_sklist_lock); for (i = 0; i < VCC_HTABLE_SIZE; i++) { struct hlist_head *head = &vcc_hash[i]; struct hlist_node *node, *tmp; struct sock *s; struct atm_vcc *vcc; sk_for_each_safe(s, node, tmp, head) { vcc = atm_sk(s); if (vcc->dev == dev) { vcc_release_async(vcc, -EPIPE); sk_del_node_init(s); } } } write_unlock_irq(&vcc_sklist_lock); } static int popen(struct atm_vcc *vcc) { Loading Loading @@ -1018,8 +994,15 @@ static uint32_t fpga_tx(struct solos_card *card) /* Clean up and free oldskb now it's gone */ if (atmdebug) { struct pkt_hdr *header = (void *)oldskb->data; int size = le16_to_cpu(header->size); skb_pull(oldskb, sizeof(*header)); dev_info(&card->dev->dev, "Transmitted: port %d\n", port); dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", size, le16_to_cpu(header->vpi), le16_to_cpu(header->vci)); print_buffer(oldskb); } Loading Loading @@ -1262,7 +1245,7 @@ static int atm_init(struct solos_card *card, struct device *parent) card->atmdev[i]->ci_range.vci_bits = 16; card->atmdev[i]->dev_data = card; card->atmdev[i]->phy_data = (void *)(unsigned long)i; atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_UNKNOWN); atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND); skb = alloc_skb(sizeof(*header), GFP_ATOMIC); if (!skb) { Loading
drivers/connector/cn_queue.c +17 −41 Original line number Diff line number Diff line Loading @@ -31,24 +31,9 @@ #include <linux/connector.h> #include <linux/delay.h> void cn_queue_wrapper(struct work_struct *work) { struct cn_callback_entry *cbq = container_of(work, struct cn_callback_entry, work); struct cn_callback_data *d = &cbq->data; struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb)); struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb); d->callback(msg, nsp); kfree_skb(d->skb); d->skb = NULL; kfree(d->free); } static struct cn_callback_entry * cn_queue_alloc_callback_entry(const char *name, struct cb_id *id, cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) { struct cn_callback_entry *cbq; Loading @@ -59,17 +44,23 @@ cn_queue_alloc_callback_entry(const char *name, struct cb_id *id, return NULL; } atomic_set(&cbq->refcnt, 1); atomic_inc(&dev->refcnt); cbq->pdev = dev; snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name); memcpy(&cbq->id.id, id, sizeof(struct cb_id)); cbq->data.callback = callback; INIT_WORK(&cbq->work, &cn_queue_wrapper); cbq->callback = callback; return cbq; } static void cn_queue_free_callback(struct cn_callback_entry *cbq) void cn_queue_release_callback(struct cn_callback_entry *cbq) { flush_workqueue(cbq->pdev->cn_queue); if (!atomic_dec_and_test(&cbq->refcnt)) return; atomic_dec(&cbq->pdev->refcnt); kfree(cbq); } Loading @@ -85,13 +76,10 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, struct cn_callback_entry *cbq, *__cbq; int found = 0; cbq = cn_queue_alloc_callback_entry(name, id, callback); cbq = cn_queue_alloc_callback_entry(dev, name, id, callback); if (!cbq) return -ENOMEM; atomic_inc(&dev->refcnt); cbq->pdev = dev; spin_lock_bh(&dev->queue_lock); list_for_each_entry(__cbq, &dev->queue_list, callback_entry) { if (cn_cb_equal(&__cbq->id.id, id)) { Loading @@ -104,8 +92,7 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, spin_unlock_bh(&dev->queue_lock); if (found) { cn_queue_free_callback(cbq); atomic_dec(&dev->refcnt); cn_queue_release_callback(cbq); return -EINVAL; } Loading @@ -130,10 +117,8 @@ void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id) } spin_unlock_bh(&dev->queue_lock); if (found) { cn_queue_free_callback(cbq); atomic_dec(&dev->refcnt); } if (found) cn_queue_release_callback(cbq); } struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls) Loading @@ -151,12 +136,6 @@ struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls) dev->nls = nls; dev->cn_queue = alloc_ordered_workqueue(dev->name, 0); if (!dev->cn_queue) { kfree(dev); return NULL; } return dev; } Loading @@ -164,9 +143,6 @@ void cn_queue_free_dev(struct cn_queue_dev *dev) { struct cn_callback_entry *cbq, *n; flush_workqueue(dev->cn_queue); destroy_workqueue(dev->cn_queue); spin_lock_bh(&dev->queue_lock); list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry) list_del(&cbq->callback_entry); Loading
drivers/connector/connector.c +12 −35 Original line number Diff line number Diff line Loading @@ -122,51 +122,28 @@ EXPORT_SYMBOL_GPL(cn_netlink_send); */ static int cn_call_callback(struct sk_buff *skb) { struct cn_callback_entry *__cbq, *__new_cbq; struct cn_callback_entry *i, *cbq = NULL; struct cn_dev *dev = &cdev; struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb)); struct netlink_skb_parms *nsp = &NETLINK_CB(skb); int err = -ENODEV; spin_lock_bh(&dev->cbdev->queue_lock); list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { if (cn_cb_equal(&__cbq->id.id, &msg->id)) { if (likely(!work_pending(&__cbq->work) && __cbq->data.skb == NULL)) { __cbq->data.skb = skb; if (queue_work(dev->cbdev->cn_queue, &__cbq->work)) err = 0; else err = -EINVAL; } else { struct cn_callback_data *d; err = -ENOMEM; __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); if (__new_cbq) { d = &__new_cbq->data; d->skb = skb; d->callback = __cbq->data.callback; d->free = __new_cbq; INIT_WORK(&__new_cbq->work, &cn_queue_wrapper); if (queue_work(dev->cbdev->cn_queue, &__new_cbq->work)) err = 0; else { kfree(__new_cbq); err = -EINVAL; } } } list_for_each_entry(i, &dev->cbdev->queue_list, callback_entry) { if (cn_cb_equal(&i->id.id, &msg->id)) { atomic_inc(&i->refcnt); cbq = i; break; } } spin_unlock_bh(&dev->cbdev->queue_lock); if (cbq != NULL) { cbq->callback(msg, nsp); kfree_skb(skb); cn_queue_release_callback(cbq); } return err; } Loading
drivers/net/atlx/atl2.c +14 −8 Original line number Diff line number Diff line Loading @@ -1996,13 +1996,15 @@ static int atl2_set_eeprom(struct net_device *netdev, if (!eeprom_buff) return -ENOMEM; ptr = (u32 *)eeprom_buff; ptr = eeprom_buff; if (eeprom->offset & 3) { /* need read/modify/write of first changed EEPROM word */ /* only the second byte of the word is being modified */ if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) return -EIO; if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) { ret_val = -EIO; goto out; } ptr++; } if (((eeprom->offset + eeprom->len) & 3)) { Loading @@ -2011,18 +2013,22 @@ static int atl2_set_eeprom(struct net_device *netdev, * only the first byte of the word is being modified */ if (!atl2_read_eeprom(hw, last_dword * 4, &(eeprom_buff[last_dword - first_dword]))) return -EIO; &(eeprom_buff[last_dword - first_dword]))) { ret_val = -EIO; goto out; } } /* Device's eeprom is always little-endian, word addressable */ memcpy(ptr, bytes, eeprom->len); for (i = 0; i < last_dword - first_dword + 1; i++) { if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) return -EIO; if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) { ret_val = -EIO; goto out; } } out: kfree(eeprom_buff); return ret_val; } Loading
drivers/net/irda/via-ircc.c +21 −73 Original line number Diff line number Diff line Loading @@ -75,15 +75,9 @@ static int dongle_id = 0; /* default: probe */ /* We can't guess the type of connected dongle, user *must* supply it. */ module_param(dongle_id, int, 0); /* FIXME : we should not need this, because instances should be automatically * managed by the PCI layer. Especially that we seem to only be using the * first entry. Jean II */ /* Max 4 instances for now */ static struct via_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL }; /* Some prototypes */ static int via_ircc_open(int i, chipio_t * info, unsigned int id); static int via_ircc_close(struct via_ircc_cb *self); static int via_ircc_open(struct pci_dev *pdev, chipio_t * info, unsigned int id); static int via_ircc_dma_receive(struct via_ircc_cb *self); static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, int iobase); Loading Loading @@ -215,7 +209,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0)); pci_write_config_byte(pcidev,0x5a,0xc0); WriteLPCReg(0x28, 0x70 ); if (via_ircc_open(0, &info,0x3076) == 0) if (via_ircc_open(pcidev, &info, 0x3076) == 0) rc=0; } else rc = -ENODEV; //IR not turn on Loading Loading @@ -254,7 +248,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi info.irq=FirIRQ; info.dma=FirDRQ1; info.dma2=FirDRQ0; if (via_ircc_open(0, &info,0x3096) == 0) if (via_ircc_open(pcidev, &info, 0x3096) == 0) rc=0; } else rc = -ENODEV; //IR not turn on !!!!! Loading @@ -264,48 +258,10 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi return rc; } /* * Function via_ircc_clean () * * Close all configured chips * */ static void via_ircc_clean(void) { int i; IRDA_DEBUG(3, "%s()\n", __func__); for (i=0; i < ARRAY_SIZE(dev_self); i++) { if (dev_self[i]) via_ircc_close(dev_self[i]); } } static void __devexit via_remove_one (struct pci_dev *pdev) { IRDA_DEBUG(3, "%s()\n", __func__); /* FIXME : This is ugly. We should use pci_get_drvdata(pdev); * to get our driver instance and call directly via_ircc_close(). * See vlsi_ir for details... * Jean II */ via_ircc_clean(); /* FIXME : This should be in via_ircc_close(), because here we may * theoritically disable still configured devices :-( - Jean II */ pci_disable_device(pdev); } static void __exit via_ircc_cleanup(void) { IRDA_DEBUG(3, "%s()\n", __func__); /* FIXME : This should be redundant, as pci_unregister_driver() * should call via_remove_one() on each device. * Jean II */ via_ircc_clean(); /* Cleanup all instances of the driver */ pci_unregister_driver (&via_driver); } Loading @@ -324,12 +280,13 @@ static const struct net_device_ops via_ircc_fir_ops = { }; /* * Function via_ircc_open (iobase, irq) * Function via_ircc_open(pdev, iobase, irq) * * Open driver instance * */ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) static __devinit int via_ircc_open(struct pci_dev *pdev, chipio_t * info, unsigned int id) { struct net_device *dev; struct via_ircc_cb *self; Loading @@ -337,9 +294,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) IRDA_DEBUG(3, "%s()\n", __func__); if (i >= ARRAY_SIZE(dev_self)) return -ENOMEM; /* Allocate new instance of the driver */ dev = alloc_irdadev(sizeof(struct via_ircc_cb)); if (dev == NULL) Loading @@ -349,13 +303,8 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) self->netdev = dev; spin_lock_init(&self->lock); /* FIXME : We should store our driver instance in the PCI layer, * using pci_set_drvdata(), not in this array. * See vlsi_ir for details... - Jean II */ /* FIXME : 'i' is always 0 (see via_init_one()) :-( - Jean II */ /* Need to store self somewhere */ dev_self[i] = self; self->index = i; pci_set_drvdata(pdev, self); /* Initialize Resource */ self->io.cfg_base = info->cfg_base; self->io.fir_base = info->fir_base; Loading Loading @@ -414,7 +363,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) /* Allocate memory if needed */ self->rx_buff.head = dma_alloc_coherent(NULL, self->rx_buff.truesize, dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize, &self->rx_buff_dma, GFP_KERNEL); if (self->rx_buff.head == NULL) { err = -ENOMEM; Loading @@ -423,7 +372,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) memset(self->rx_buff.head, 0, self->rx_buff.truesize); self->tx_buff.head = dma_alloc_coherent(NULL, self->tx_buff.truesize, dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize, &self->tx_buff_dma, GFP_KERNEL); if (self->tx_buff.head == NULL) { err = -ENOMEM; Loading Loading @@ -455,33 +404,32 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) via_hw_init(self); return 0; err_out4: dma_free_coherent(NULL, self->tx_buff.truesize, dma_free_coherent(&pdev->dev, self->tx_buff.truesize, self->tx_buff.head, self->tx_buff_dma); err_out3: dma_free_coherent(NULL, self->rx_buff.truesize, dma_free_coherent(&pdev->dev, self->rx_buff.truesize, self->rx_buff.head, self->rx_buff_dma); err_out2: release_region(self->io.fir_base, self->io.fir_ext); err_out1: pci_set_drvdata(pdev, NULL); free_netdev(dev); dev_self[i] = NULL; return err; } /* * Function via_ircc_close (self) * Function via_remove_one(pdev) * * Close driver instance * */ static int via_ircc_close(struct via_ircc_cb *self) static void __devexit via_remove_one(struct pci_dev *pdev) { struct via_ircc_cb *self = pci_get_drvdata(pdev); int iobase; IRDA_DEBUG(3, "%s()\n", __func__); IRDA_ASSERT(self != NULL, return -1;); iobase = self->io.fir_base; ResetChip(iobase, 5); //hardware reset. Loading @@ -493,16 +441,16 @@ static int via_ircc_close(struct via_ircc_cb *self) __func__, self->io.fir_base); release_region(self->io.fir_base, self->io.fir_ext); if (self->tx_buff.head) dma_free_coherent(NULL, self->tx_buff.truesize, dma_free_coherent(&pdev->dev, self->tx_buff.truesize, self->tx_buff.head, self->tx_buff_dma); if (self->rx_buff.head) dma_free_coherent(NULL, self->rx_buff.truesize, dma_free_coherent(&pdev->dev, self->rx_buff.truesize, self->rx_buff.head, self->rx_buff_dma); dev_self[self->index] = NULL; pci_set_drvdata(pdev, NULL); free_netdev(self->netdev); return 0; pci_disable_device(pdev); } /* Loading