Re: [PATCH v4 1/5] staging: et131x: clean up code
On Fri, Nov 22, 2013 at 10:54:27AM +0800, ZHAO Gang wrote: > 1. change function name: et1310_phy_power_down -> et1310_phy_power_switch > change function name to better describe its functionality. > > 2. as TODO file suggested, do this sort of things to reduce split lines > struct fbr_lookup *fbr; > fbr = rx_local->fbr[id]; > Then replace all the instances of "rx_local->fbr[id]" with fbr. > > 3. delete unnecessary variable in function et131x_init > variable u32 numrfd is not necessary in this function. > > 4. some code style change This should be 4 patches. One for each. The first 3 versions of this patch weren't sent to the list or we would have said that already. > @@ -1822,6 +1822,9 @@ static void et131x_config_rx_dma_regs(struct > et131x_adapter *adapter) > u32 __iomem *base_hi; > u32 __iomem *base_lo; > > + struct fbr_lookup *fbr; > + fbr = rx_local->fbr[id]; The blank lines are in the wrong place. The variable declarations go in one block with a blank after. > + > if (id == 0) { > num_des = &rx_dma->fbr0_num_des; > full_offset = &rx_dma->fbr0_full_offset; Otherwise this patch seems nice but it needs to be split up and resent. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 1/5] staging: et131x: clean up code
On Fri, Nov 22, 2013 at 4:08 PM, Dan Carpenter wrote: > On Fri, Nov 22, 2013 at 10:54:27AM +0800, ZHAO Gang wrote: >> 1. change function name: et1310_phy_power_down -> et1310_phy_power_switch >> change function name to better describe its functionality. >> >> 2. as TODO file suggested, do this sort of things to reduce split lines >> struct fbr_lookup *fbr; >> fbr = rx_local->fbr[id]; >> Then replace all the instances of "rx_local->fbr[id]" with fbr. >> >> 3. delete unnecessary variable in function et131x_init >> variable u32 numrfd is not necessary in this function. >> >> 4. some code style change > > This should be 4 patches. One for each. The first 3 versions of this > patch weren't sent to the list or we would have said that already. I can split this patch to four, since this is the first patch of a patch set, I will resend the entire patch set. > >> @@ -1822,6 +1822,9 @@ static void et131x_config_rx_dma_regs(struct >> et131x_adapter *adapter) >> u32 __iomem *base_hi; >> u32 __iomem *base_lo; >> >> + struct fbr_lookup *fbr; >> + fbr = rx_local->fbr[id]; > > The blank lines are in the wrong place. The variable declarations go in > one block with a blank after. I will fix this. > >> + >> if (id == 0) { >> num_des = &rx_dma->fbr0_num_des; >> full_offset = &rx_dma->fbr0_full_offset; > > Otherwise this patch seems nice but it needs to be split up and resent. By the way, this mailing list is surely an open list, but I can't find how to subscribe it - the website at driverdev.osuosl.org said it has no publicly-advertised Mailman mailing lists. Another question: if I send patches to this list, should I also cc linux-kernel mailing list? Thanks for your review. > > regards, > dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 2/5] staging: et131x: drop packet when error occurs in et131x_tx
On Thu, Nov 21, 2013 at 09:19:21PM +, Mark Einon wrote: > On Wed, Nov 20, 2013 at 03:55:27PM +0800, ZHAO Gang wrote: > > As TODO file suggested, drop packet instead of return NETDEV_TX_BUSY > > when tx failed. > > > > et131x_tx calls function et131x_send_packets, I put the work of > > et131x_send_packets directly into et131x_tx, and made some changes to > > let the code more readable. > > > > Signed-off-by: ZHAO Gang > > Acked-by: Mark Einon > > > --- > > drivers/staging/et131x/et131x.c | 84 > > +++-- > > 1 file changed, 22 insertions(+), 62 deletions(-) > > > > diff --git a/drivers/staging/et131x/et131x.c > > b/drivers/staging/et131x/et131x.c > > index 836a4db..cda037a 100644 > > --- a/drivers/staging/et131x/et131x.c > > +++ b/drivers/staging/et131x/et131x.c > > @@ -3123,55 +3123,6 @@ static int send_packet(struct sk_buff *skb, struct > > et131x_adapter *adapter) > > return 0; > > } > > > > -/* et131x_send_packets - This function is called by the OS to send packets > > - * @skb: the packet(s) to send > > - * @netdev:device on which to TX the above packet(s) > > - * > > - * Return 0 in almost all cases; non-zero value in extreme hard failure > > only > > - */ > > -static int et131x_send_packets(struct sk_buff *skb, struct net_device > > *netdev) > > -{ > > - int status = 0; > > - struct et131x_adapter *adapter = netdev_priv(netdev); > > - > > - /* Send these packets > > -* > > -* NOTE: The Linux Tx entry point is only given one packet at a time > > -* to Tx, so the PacketCount and it's array used makes no sense here > > -*/ > > - > > - /* TCB is not available */ > > - if (adapter->tx_ring.used >= NUM_TCB) { > > - /* NOTE: If there's an error on send, no need to queue the > > -* packet under Linux; if we just send an error up to the > > -* netif layer, it will resend the skb to us. > > -*/ > > - status = -ENOMEM; > > - } else { > > - /* We need to see if the link is up; if it's not, make the > > -* netif layer think we're good and drop the packet > > -*/ > > - if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || > > - !netif_carrier_ok(netdev)) { > > - dev_kfree_skb_any(skb); > > - skb = NULL; > > - > > - adapter->net_stats.tx_dropped++; > > - } else { > > - status = send_packet(skb, adapter); > > - if (status != 0 && status != -ENOMEM) { > > - /* On any other error, make netif think we're > > -* OK and drop the packet > > -*/ > > - dev_kfree_skb_any(skb); > > - skb = NULL; > > - adapter->net_stats.tx_dropped++; > > - } > > - } > > - } > > - return status; > > -} > > - > > /* free_send_packet - Recycle a struct tcb > > * @adapter: pointer to our adapter > > * @tcb: pointer to struct tcb > > @@ -4537,12 +4488,9 @@ static void et131x_multicast(struct net_device > > *netdev) > > /* et131x_tx - The handler to tx a packet on the device > > * @skb: data to be Tx'd > > * @netdev: device on which data is to be Tx'd > > - * > > - * Returns 0 on success, errno on failure (as defined in errno.h) > > */ > > -static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) > > +static netdev_tx_t et131x_tx(struct sk_buff *skb, struct net_device > > *netdev) > > { > > - int status = 0; > > struct et131x_adapter *adapter = netdev_priv(netdev); > > > > /* stop the queue if it's getting full */ > > @@ -4553,17 +4501,29 @@ static int et131x_tx(struct sk_buff *skb, struct > > net_device *netdev) > > /* Save the timestamp for the TX timeout watchdog */ > > netdev->trans_start = jiffies; > > > > - /* Call the device-specific data Tx routine */ > > - status = et131x_send_packets(skb, netdev); > > + /* TCB is not available */ > > + if (adapter->tx_ring.used >= NUM_TCB) > > + goto drop; > > > > - /* Check status and manage the netif queue if necessary */ > > - if (status != 0) { > > - if (status == -ENOMEM) > > - status = NETDEV_TX_BUSY; > > - else > > - status = NETDEV_TX_OK; > > + /* We need to see if the link is up; if it's not, make the > > +* netif layer think we're good and drop the packet > > +*/ > > + if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || > > + !netif_carrier_ok(netdev)) { > > + goto drop; > > + } else { > > + if (!send_packet(skb, adapter)) > > + goto out; > > + /* On error (send_packet returns != 0), make netif > > +* think we're OK and drop the packet > > +*/ > > } > > - return status
Re: [PATCH v4 1/5] staging: et131x: clean up code
On Fri, Nov 22, 2013 at 04:44:48PM +0800, ZHAO Gang wrote: > > > > Otherwise this patch seems nice but it needs to be split up and resent. > > By the way, this mailing list is surely an open list, but I can't find > how to subscribe it - the website at driverdev.osuosl.org said it has > no publicly-advertised Mailman mailing lists. > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel > Another question: if I send patches to this list, should I also cc > linux-kernel mailing list? Don't bother with linux-kernel. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 2/5] staging: et131x: drop packet when error occurs in et131x_tx
On 11/22/13, Mark Einon wrote: > On Wed, Nov 20, 2013 at 03:55:27PM +0800, ZHAO Gang wrote: >> As TODO file suggested, drop packet instead of return NETDEV_TX_BUSY >> when tx failed. >> >> et131x_tx calls function et131x_send_packets, I put the work of >> et131x_send_packets directly into et131x_tx, and made some changes to >> let the code more readable. >> >> Signed-off-by: ZHAO Gang > > Acked-by: Mark Einon > >> --- >> drivers/staging/et131x/et131x.c | 84 >> +++-- >> 1 file changed, 22 insertions(+), 62 deletions(-) >> >> diff --git a/drivers/staging/et131x/et131x.c >> b/drivers/staging/et131x/et131x.c >> index 836a4db..cda037a 100644 >> --- a/drivers/staging/et131x/et131x.c >> +++ b/drivers/staging/et131x/et131x.c >> @@ -3123,55 +3123,6 @@ static int send_packet(struct sk_buff *skb, struct >> et131x_adapter *adapter) >> return 0; >> } >> >> -/* et131x_send_packets - This function is called by the OS to send >> packets >> - * @skb: the packet(s) to send >> - * @netdev:device on which to TX the above packet(s) >> - * >> - * Return 0 in almost all cases; non-zero value in extreme hard failure >> only >> - */ >> -static int et131x_send_packets(struct sk_buff *skb, struct net_device >> *netdev) >> -{ >> -int status = 0; >> -struct et131x_adapter *adapter = netdev_priv(netdev); >> - >> -/* Send these packets >> - * >> - * NOTE: The Linux Tx entry point is only given one packet at a time >> - * to Tx, so the PacketCount and it's array used makes no sense here >> - */ >> - >> -/* TCB is not available */ >> -if (adapter->tx_ring.used >= NUM_TCB) { >> -/* NOTE: If there's an error on send, no need to queue the >> - * packet under Linux; if we just send an error up to the >> - * netif layer, it will resend the skb to us. >> - */ >> -status = -ENOMEM; >> -} else { >> -/* We need to see if the link is up; if it's not, make the >> - * netif layer think we're good and drop the packet >> - */ >> -if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || >> -!netif_carrier_ok(netdev)) { >> -dev_kfree_skb_any(skb); >> -skb = NULL; >> - >> -adapter->net_stats.tx_dropped++; >> -} else { >> -status = send_packet(skb, adapter); >> -if (status != 0 && status != -ENOMEM) { >> -/* On any other error, make netif think we're >> - * OK and drop the packet >> - */ >> -dev_kfree_skb_any(skb); >> -skb = NULL; >> -adapter->net_stats.tx_dropped++; >> -} >> -} >> -} >> -return status; >> -} >> - >> /* free_send_packet - Recycle a struct tcb >> * @adapter: pointer to our adapter >> * @tcb: pointer to struct tcb >> @@ -4537,12 +4488,9 @@ static void et131x_multicast(struct net_device >> *netdev) >> /* et131x_tx - The handler to tx a packet on the device >> * @skb: data to be Tx'd >> * @netdev: device on which data is to be Tx'd >> - * >> - * Returns 0 on success, errno on failure (as defined in errno.h) >> */ >> -static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) >> +static netdev_tx_t et131x_tx(struct sk_buff *skb, struct net_device >> *netdev) >> { >> -int status = 0; >> struct et131x_adapter *adapter = netdev_priv(netdev); >> >> /* stop the queue if it's getting full */ >> @@ -4553,17 +4501,29 @@ static int et131x_tx(struct sk_buff *skb, struct >> net_device *netdev) >> /* Save the timestamp for the TX timeout watchdog */ >> netdev->trans_start = jiffies; >> >> -/* Call the device-specific data Tx routine */ >> -status = et131x_send_packets(skb, netdev); >> +/* TCB is not available */ >> +if (adapter->tx_ring.used >= NUM_TCB) >> +goto drop; That's wrong. You have to properly manage tx queue and not just drop packets >> -/* Check status and manage the netif queue if necessary */ >> -if (status != 0) { >> -if (status == -ENOMEM) >> -status = NETDEV_TX_BUSY; >> -else >> -status = NETDEV_TX_OK; >> +/* We need to see if the link is up; if it's not, make the >> + * netif layer think we're good and drop the packet >> + */ >> +if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || >> +!netif_carrier_ok(netdev)) { >> +goto drop; >> +} else { >> +if (!send_packet(skb, adapter)) >> +goto out; >> +/* On error (send_packet returns != 0), make netif >> + * think we're OK and drop the packet >> + */ >> } >> -return status; >> + >> +drop: >> +de
Re: [PATCH v3 2/5] staging: et131x: drop packet when error occurs in et131x_tx
On Fri, Nov 22, 2013 at 4:57 PM, Dan Carpenter wrote: > This is a lot of spaghetti. Just write it like this: > > > if (adapter->tx_ring.used >= NUM_TCB) > goto drop; > if (adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) > goto drop; > if (!netif_carrier_ok(netdev)) > goto drop; > status = send_packet(skb, adapter); > if (status) > goto drop; > > return NETDEV_TX_OK; > > drop: > dev_kfree_skb_any(skb); > adapter->net_stats.tx_dropped++; > > /* We return success deliberately to make the netif layer happy */ > return NETDEV_TX_OK; > > In the original code the success path was if condition false, then if > condition true, then follow a goto then return. In the new code it is > straight line path to success with no nested if else statements. > This made the code more clear, I will apply it in resent patch. Thanks for your review. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 1/5] staging: et131x: clean up code
On Fri, Nov 22, 2013 at 5:00 PM, Dan Carpenter wrote: > On Fri, Nov 22, 2013 at 04:44:48PM +0800, ZHAO Gang wrote: >> > >> > Otherwise this patch seems nice but it needs to be split up and resent. >> >> By the way, this mailing list is surely an open list, but I can't find >> how to subscribe it - the website at driverdev.osuosl.org said it has >> no publicly-advertised Mailman mailing lists. >> > > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel So de...@driverdev.osuosl.org and driverdev-devel@linuxdriverproject.org are the same mailing list. I think it's better to use the later in MAINTAINERS file since users can find how to join on website linuxdriverproject.org, instead of being told there are no public mailing list on website driverdev.osuosl.org > >> Another question: if I send patches to this list, should I also cc >> linux-kernel mailing list? > > Don't bother with linux-kernel. > > regards, > dan carpenter > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 2/5] staging: et131x: drop packet when error occurs in et131x_tx
On Fri, Nov 22, 2013 at 5:17 PM, Denis Kirjanov wrote: > On 11/22/13, Mark Einon wrote: >> On Wed, Nov 20, 2013 at 03:55:27PM +0800, ZHAO Gang wrote: >>> As TODO file suggested, drop packet instead of return NETDEV_TX_BUSY >>> when tx failed. >>> >>> et131x_tx calls function et131x_send_packets, I put the work of >>> et131x_send_packets directly into et131x_tx, and made some changes to >>> let the code more readable. >>> >>> Signed-off-by: ZHAO Gang >> >> Acked-by: Mark Einon >> >>> --- >>> drivers/staging/et131x/et131x.c | 84 >>> +++-- >>> 1 file changed, 22 insertions(+), 62 deletions(-) >>> >>> diff --git a/drivers/staging/et131x/et131x.c >>> b/drivers/staging/et131x/et131x.c >>> index 836a4db..cda037a 100644 >>> --- a/drivers/staging/et131x/et131x.c >>> +++ b/drivers/staging/et131x/et131x.c >>> @@ -3123,55 +3123,6 @@ static int send_packet(struct sk_buff *skb, struct >>> et131x_adapter *adapter) >>> return 0; >>> } >>> >>> -/* et131x_send_packets - This function is called by the OS to send >>> packets >>> - * @skb: the packet(s) to send >>> - * @netdev:device on which to TX the above packet(s) >>> - * >>> - * Return 0 in almost all cases; non-zero value in extreme hard failure >>> only >>> - */ >>> -static int et131x_send_packets(struct sk_buff *skb, struct net_device >>> *netdev) >>> -{ >>> -int status = 0; >>> -struct et131x_adapter *adapter = netdev_priv(netdev); >>> - >>> -/* Send these packets >>> - * >>> - * NOTE: The Linux Tx entry point is only given one packet at a time >>> - * to Tx, so the PacketCount and it's array used makes no sense here >>> - */ >>> - >>> -/* TCB is not available */ >>> -if (adapter->tx_ring.used >= NUM_TCB) { >>> -/* NOTE: If there's an error on send, no need to queue the >>> - * packet under Linux; if we just send an error up to the >>> - * netif layer, it will resend the skb to us. >>> - */ >>> -status = -ENOMEM; >>> -} else { >>> -/* We need to see if the link is up; if it's not, make the >>> - * netif layer think we're good and drop the packet >>> - */ >>> -if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || >>> -!netif_carrier_ok(netdev)) { >>> -dev_kfree_skb_any(skb); >>> -skb = NULL; >>> - >>> -adapter->net_stats.tx_dropped++; >>> -} else { >>> -status = send_packet(skb, adapter); >>> -if (status != 0 && status != -ENOMEM) { >>> -/* On any other error, make netif think we're >>> - * OK and drop the packet >>> - */ >>> -dev_kfree_skb_any(skb); >>> -skb = NULL; >>> -adapter->net_stats.tx_dropped++; >>> -} >>> -} >>> -} >>> -return status; >>> -} >>> - >>> /* free_send_packet - Recycle a struct tcb >>> * @adapter: pointer to our adapter >>> * @tcb: pointer to struct tcb >>> @@ -4537,12 +4488,9 @@ static void et131x_multicast(struct net_device >>> *netdev) >>> /* et131x_tx - The handler to tx a packet on the device >>> * @skb: data to be Tx'd >>> * @netdev: device on which data is to be Tx'd >>> - * >>> - * Returns 0 on success, errno on failure (as defined in errno.h) >>> */ >>> -static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) >>> +static netdev_tx_t et131x_tx(struct sk_buff *skb, struct net_device >>> *netdev) >>> { >>> -int status = 0; >>> struct et131x_adapter *adapter = netdev_priv(netdev); >>> >>> /* stop the queue if it's getting full */ >>> @@ -4553,17 +4501,29 @@ static int et131x_tx(struct sk_buff *skb, struct >>> net_device *netdev) >>> /* Save the timestamp for the TX timeout watchdog */ >>> netdev->trans_start = jiffies; >>> >>> -/* Call the device-specific data Tx routine */ >>> -status = et131x_send_packets(skb, netdev); >>> +/* TCB is not available */ >>> +if (adapter->tx_ring.used >= NUM_TCB) >>> +goto drop; > > That's wrong. You have to properly manage tx queue and not just drop packets Could you kindly tell me what should be done to tx queue? > >>> -/* Check status and manage the netif queue if necessary */ >>> -if (status != 0) { >>> -if (status == -ENOMEM) >>> -status = NETDEV_TX_BUSY; >>> -else >>> -status = NETDEV_TX_OK; >>> +/* We need to see if the link is up; if it's not, make the >>> + * netif layer think we're good and drop the packet >>> + */ >>> +if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || >>> +!netif_carrier_ok(netdev)) { >>> +goto drop; >>> +} else { >>> +if (!send_packet(skb,
Re: [PATCH v3 2/5] staging: et131x: drop packet when error occurs in et131x_tx
If you have no free TX descriptors that means that something went wrong and it's a BUG. You have to tell the stack to stop sending packets using netif_stop_queue() and reenable transmissions once tx descriptors will be available. There are a lot of live examples in the source tree. On 11/22/13, ZHAO Gang wrote: > On Fri, Nov 22, 2013 at 5:17 PM, Denis Kirjanov wrote: >> On 11/22/13, Mark Einon wrote: >>> On Wed, Nov 20, 2013 at 03:55:27PM +0800, ZHAO Gang wrote: As TODO file suggested, drop packet instead of return NETDEV_TX_BUSY when tx failed. et131x_tx calls function et131x_send_packets, I put the work of et131x_send_packets directly into et131x_tx, and made some changes to let the code more readable. Signed-off-by: ZHAO Gang >>> >>> Acked-by: Mark Einon >>> --- drivers/staging/et131x/et131x.c | 84 +++-- 1 file changed, 22 insertions(+), 62 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 836a4db..cda037a 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -3123,55 +3123,6 @@ static int send_packet(struct sk_buff *skb, struct et131x_adapter *adapter) return 0; } -/* et131x_send_packets - This function is called by the OS to send packets - * @skb: the packet(s) to send - * @netdev:device on which to TX the above packet(s) - * - * Return 0 in almost all cases; non-zero value in extreme hard failure only - */ -static int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) -{ -int status = 0; -struct et131x_adapter *adapter = netdev_priv(netdev); - -/* Send these packets - * - * NOTE: The Linux Tx entry point is only given one packet at a time - * to Tx, so the PacketCount and it's array used makes no sense here - */ - -/* TCB is not available */ -if (adapter->tx_ring.used >= NUM_TCB) { -/* NOTE: If there's an error on send, no need to queue the - * packet under Linux; if we just send an error up to the - * netif layer, it will resend the skb to us. - */ -status = -ENOMEM; -} else { -/* We need to see if the link is up; if it's not, make the - * netif layer think we're good and drop the packet - */ -if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || -!netif_carrier_ok(netdev)) { -dev_kfree_skb_any(skb); -skb = NULL; - -adapter->net_stats.tx_dropped++; -} else { -status = send_packet(skb, adapter); -if (status != 0 && status != -ENOMEM) { -/* On any other error, make netif think we're - * OK and drop the packet - */ -dev_kfree_skb_any(skb); -skb = NULL; -adapter->net_stats.tx_dropped++; -} -} -} -return status; -} - /* free_send_packet - Recycle a struct tcb * @adapter: pointer to our adapter * @tcb: pointer to struct tcb @@ -4537,12 +4488,9 @@ static void et131x_multicast(struct net_device *netdev) /* et131x_tx - The handler to tx a packet on the device * @skb: data to be Tx'd * @netdev: device on which data is to be Tx'd - * - * Returns 0 on success, errno on failure (as defined in errno.h) */ -static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) +static netdev_tx_t et131x_tx(struct sk_buff *skb, struct net_device *netdev) { -int status = 0; struct et131x_adapter *adapter = netdev_priv(netdev); /* stop the queue if it's getting full */ @@ -4553,17 +4501,29 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) /* Save the timestamp for the TX timeout watchdog */ netdev->trans_start = jiffies; -/* Call the device-specific data Tx routine */ -status = et131x_send_packets(skb, netdev); +/* TCB is not available */ +if (adapter->tx_ring.used >= NUM_TCB) +goto drop; >> >> That's wrong. You have to properly manage tx queue and not just drop >> packets > > Could you kindly tell me what should be done to tx queue? > >> -/* Check status and manage the netif queue if necessary */ -if (status != 0) { -if (
Re: [PATCH v4 1/5] staging: et131x: clean up code
On Fri, Nov 22, 2013 at 07:37:58PM +0800, ZHAO Gang wrote: > On Fri, Nov 22, 2013 at 5:00 PM, Dan Carpenter > wrote: > > On Fri, Nov 22, 2013 at 04:44:48PM +0800, ZHAO Gang wrote: > >> > > >> > Otherwise this patch seems nice but it needs to be split up and resent. > >> > >> By the way, this mailing list is surely an open list, but I can't find > >> how to subscribe it - the website at driverdev.osuosl.org said it has > >> no publicly-advertised Mailman mailing lists. > >> > > > > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel > > So de...@driverdev.osuosl.org and > driverdev-devel@linuxdriverproject.org are the same mailing list. Yep. > I think it's better to use the later in MAINTAINERS file since users can > find how to join on website linuxdriverproject.org, instead of being > told there are no public mailing list on website driverdev.osuosl.org driverdev-devel@linuxdriverproject.org is 38 characters long... It's a crap email address. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 2/5] staging: et131x: drop packet when error occurs in et131x_tx
On Fri, Nov 22, 2013 at 7:56 PM, Denis Kirjanov wrote: > If you have no free TX descriptors that means that something went > wrong and it's a BUG. You have to tell the stack to stop sending > packets using netif_stop_queue() and reenable transmissions once tx > descriptors will be available. There are a lot of live examples in the > source tree. > The stop queue code dose not show in the diff, actually it is at the beginning of et131x_tx: /* stop the queue if it's getting full */ if (adapter->tx_ring.used >= NUM_TCB - 1 && !netif_queue_stopped(netdev)) netif_stop_queue(netdev); I think the logic is when there is only one descriptor left, stop the queue and transmit this packet, if tx queue is full, it must have been stopped, so just drop the packet. Cheers ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 1/5] staging: et131x: clean up code
On Fri, Nov 22, 2013 at 8:13 PM, Dan Carpenter wrote: > On Fri, Nov 22, 2013 at 07:37:58PM +0800, ZHAO Gang wrote: >> On Fri, Nov 22, 2013 at 5:00 PM, Dan Carpenter >> wrote: >> > On Fri, Nov 22, 2013 at 04:44:48PM +0800, ZHAO Gang wrote: >> >> > >> >> > Otherwise this patch seems nice but it needs to be split up and resent. >> >> >> >> By the way, this mailing list is surely an open list, but I can't find >> >> how to subscribe it - the website at driverdev.osuosl.org said it has >> >> no publicly-advertised Mailman mailing lists. >> >> >> > >> > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel >> >> So de...@driverdev.osuosl.org and >> driverdev-devel@linuxdriverproject.org are the same mailing list. > > Yep. > >> I think it's better to use the later in MAINTAINERS file since users can >> find how to join on website linuxdriverproject.org, instead of being >> told there are no public mailing list on website driverdev.osuosl.org > > driverdev-devel@linuxdriverproject.org is 38 characters long... It's a > crap email address. The reason is not so strong, don't we all use aliases for email address? > > regards, > dan carpenter > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 1/5] staging: et131x: clean up code
On Fri, Nov 22, 2013 at 08:35:39PM +0800, ZHAO Gang wrote: > On Fri, Nov 22, 2013 at 8:13 PM, Dan Carpenter > wrote: > > On Fri, Nov 22, 2013 at 07:37:58PM +0800, ZHAO Gang wrote: > >> On Fri, Nov 22, 2013 at 5:00 PM, Dan Carpenter > >> wrote: > >> > On Fri, Nov 22, 2013 at 04:44:48PM +0800, ZHAO Gang wrote: > >> >> > > >> >> > Otherwise this patch seems nice but it needs to be split up and > >> >> > resent. > >> >> > >> >> By the way, this mailing list is surely an open list, but I can't find > >> >> how to subscribe it - the website at driverdev.osuosl.org said it has > >> >> no publicly-advertised Mailman mailing lists. > >> >> > >> > > >> > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel > >> > >> So de...@driverdev.osuosl.org and > >> driverdev-devel@linuxdriverproject.org are the same mailing list. > > > > Yep. > > > >> I think it's better to use the later in MAINTAINERS file since users can > >> find how to join on website linuxdriverproject.org, instead of being > >> told there are no public mailing list on website driverdev.osuosl.org > > > > driverdev-devel@linuxdriverproject.org is 38 characters long... It's a > > crap email address. > > The reason is not so strong, don't we all use aliases for email address? > I don't feel strongly about this either way. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 1/7] staging: et131x: make some tweaks to reduce split lines
1. As TODO list suggested, do this sort of things to reduce split lines: struct fbr_lookup *fbr; fbr = rx_local->fbr[id]; Then replace all the instances of "rx_local->fbr[id]" with fbr. 2. Some code style changes Signed-off-by: ZHAO Gang --- v4 -> v5: split "[PATCH v4 1/5] staging: et131x: clean up code" into 3 parts Dan, I split [PATCH v4 1/5] into 3 parts instead of 4. My argument is that code style changes in this patch are straight and not too many. It maybe not worth the work to let code style changes be a stand alone patch. drivers/staging/et131x/et131x.c | 202 1 file changed, 103 insertions(+), 99 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index d9446c4..aeb24ee 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -1821,6 +1821,9 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) u32 __iomem *min_des; u32 __iomem *base_hi; u32 __iomem *base_lo; + struct fbr_lookup *fbr; + + fbr = rx_local->fbr[id]; if (id == 0) { num_des = &rx_dma->fbr0_num_des; @@ -1837,12 +1840,10 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) } /* Now's the best time to initialize FBR contents */ - fbr_entry = - (struct fbr_desc *) rx_local->fbr[id]->ring_virtaddr; - for (entry = 0; -entry < rx_local->fbr[id]->num_entries; entry++) { - fbr_entry->addr_hi = rx_local->fbr[id]->bus_high[entry]; - fbr_entry->addr_lo = rx_local->fbr[id]->bus_low[entry]; + fbr_entry = (struct fbr_desc *)fbr->ring_virtaddr; + for (entry = 0; entry < fbr->num_entries; entry++) { + fbr_entry->addr_hi = fbr->bus_high[entry]; + fbr_entry->addr_lo = fbr->bus_low[entry]; fbr_entry->word2 = entry; fbr_entry++; } @@ -1850,19 +1851,16 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) /* Set the address and parameters of Free buffer ring 1 and 0 * into the 1310's registers */ - writel(upper_32_bits(rx_local->fbr[id]->ring_physaddr), - base_hi); - writel(lower_32_bits(rx_local->fbr[id]->ring_physaddr), - base_lo); - writel(rx_local->fbr[id]->num_entries - 1, num_des); + writel(upper_32_bits(fbr->ring_physaddr), base_hi); + writel(lower_32_bits(fbr->ring_physaddr), base_lo); + writel(fbr->num_entries - 1, num_des); writel(ET_DMA10_WRAP, full_offset); /* This variable tracks the free buffer ring 1 full position, * so it has to match the above. */ - rx_local->fbr[id]->local_full = ET_DMA10_WRAP; - writel(((rx_local->fbr[id]->num_entries * - LO_MARK_PERCENT_FOR_RX) / 100) - 1, + fbr->local_full = ET_DMA10_WRAP; + writel((fbr->num_entries * LO_MARK_PERCENT_FOR_RX / 100) - 1, min_des); } @@ -2204,6 +2202,7 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) u32 pktstat_ringsize; u32 fbr_chunksize; struct rx_ring *rx_ring; + struct fbr_lookup *fbr; /* Setup some convenience pointers */ rx_ring = &adapter->rx_ring; @@ -2252,15 +2251,16 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) adapter->rx_ring.fbr[1]->num_entries; for (id = 0; id < NUM_FBRS; id++) { + fbr = rx_ring->fbr[id]; + /* Allocate an area of memory for Free Buffer Ring */ - bufsize = - (sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries); - rx_ring->fbr[id]->ring_virtaddr = - dma_alloc_coherent(&adapter->pdev->dev, - bufsize, - &rx_ring->fbr[id]->ring_physaddr, - GFP_KERNEL); - if (!rx_ring->fbr[id]->ring_virtaddr) { + bufsize = sizeof(struct fbr_desc) * fbr->num_entries; + fbr->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, + bufsize, + &fbr->ring_physaddr, + GFP_KERNEL); + + if (!fbr->ring_virtaddr) { dev_err(&adapter->pdev->
[PATCH v5 2/7] staging: et131x: change function name
Change function name from et1310_phy_power_down to et1310_phy_power_switch to better describe its functionality. Signed-off-by: ZHAO Gang --- drivers/staging/et131x/et131x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index aeb24ee..0a6cc62 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -1679,7 +1679,7 @@ static int et131x_mdio_reset(struct mii_bus *bus) return 0; } -/* et1310_phy_power_down - PHY power control +/* et1310_phy_power_switch - PHY power control * @adapter: device to control * @down: true for off/false for back on * @@ -1688,7 +1688,7 @@ static int et131x_mdio_reset(struct mii_bus *bus) * Can't you see that this code processed * Phy power, phy power.. */ -static void et1310_phy_power_down(struct et131x_adapter *adapter, bool down) +static void et1310_phy_power_switch(struct et131x_adapter *adapter, bool down) { u16 data; @@ -1936,7 +1936,7 @@ static void et131x_adapter_setup(struct et131x_adapter *adapter) et1310_config_macstat_regs(adapter); - et1310_phy_power_down(adapter, 0); + et1310_phy_power_switch(adapter, 0); et131x_xcvr_init(adapter); } -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 3/7] staging: et131x: delete unnecessary variable in function et131x_init
Variable u32 numrfd is not necessary in this function. Signed-off-by: ZHAO Gang --- drivers/staging/et131x/et131x.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 0a6cc62..6df7145 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -2454,7 +2454,6 @@ static int et131x_init_recv(struct et131x_adapter *adapter) { struct rfd *rfd; u32 rfdct; - u32 numrfd = 0; struct rx_ring *rx_ring; /* Setup some convenience pointers */ @@ -2471,9 +2470,8 @@ static int et131x_init_recv(struct et131x_adapter *adapter) /* Add this RFD to the recv_list */ list_add_tail(&rfd->list_node, &rx_ring->recv_list); - /* Increment both the available RFD's, and the total RFD's. */ + /* Increment the available RFD's */ rx_ring->num_ready_recv++; - numrfd++; } return 0; -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 4/7] staging: et131x: drop packet when error occurs in et131x_tx
As TODO file suggested, drop packet instead of return NETDEV_TX_BUSY when tx failed. et131x_tx calls function et131x_send_packets, I put the work of et131x_send_packets directly into et131x_tx, and made some changes to let the code more readable. Signed-off-by: ZHAO Gang --- v3 -> v4: no change v4 -> v5: simplify code suggested by Dan drivers/staging/et131x/et131x.c | 84 +++-- 1 file changed, 22 insertions(+), 62 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 6df7145..83d29811 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -3128,55 +3128,6 @@ static int send_packet(struct sk_buff *skb, struct et131x_adapter *adapter) return 0; } -/* et131x_send_packets - This function is called by the OS to send packets - * @skb: the packet(s) to send - * @netdev:device on which to TX the above packet(s) - * - * Return 0 in almost all cases; non-zero value in extreme hard failure only - */ -static int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) -{ - int status = 0; - struct et131x_adapter *adapter = netdev_priv(netdev); - - /* Send these packets -* -* NOTE: The Linux Tx entry point is only given one packet at a time -* to Tx, so the PacketCount and it's array used makes no sense here -*/ - - /* TCB is not available */ - if (adapter->tx_ring.used >= NUM_TCB) { - /* NOTE: If there's an error on send, no need to queue the -* packet under Linux; if we just send an error up to the -* netif layer, it will resend the skb to us. -*/ - status = -ENOMEM; - } else { - /* We need to see if the link is up; if it's not, make the -* netif layer think we're good and drop the packet -*/ - if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || - !netif_carrier_ok(netdev)) { - dev_kfree_skb_any(skb); - skb = NULL; - - adapter->net_stats.tx_dropped++; - } else { - status = send_packet(skb, adapter); - if (status != 0 && status != -ENOMEM) { - /* On any other error, make netif think we're -* OK and drop the packet -*/ - dev_kfree_skb_any(skb); - skb = NULL; - adapter->net_stats.tx_dropped++; - } - } - } - return status; -} - /* free_send_packet - Recycle a struct tcb * @adapter: pointer to our adapter * @tcb: pointer to struct tcb @@ -4542,10 +4493,8 @@ static void et131x_multicast(struct net_device *netdev) /* et131x_tx - The handler to tx a packet on the device * @skb: data to be Tx'd * @netdev: device on which data is to be Tx'd - * - * Returns 0 on success, errno on failure (as defined in errno.h) */ -static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) +static netdev_tx_t et131x_tx(struct sk_buff *skb, struct net_device *netdev) { int status = 0; struct et131x_adapter *adapter = netdev_priv(netdev); @@ -4558,17 +4507,28 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) /* Save the timestamp for the TX timeout watchdog */ netdev->trans_start = jiffies; - /* Call the device-specific data Tx routine */ - status = et131x_send_packets(skb, netdev); + /* TCB is not available */ + if (adapter->tx_ring.used >= NUM_TCB) + goto drop; - /* Check status and manage the netif queue if necessary */ - if (status != 0) { - if (status == -ENOMEM) - status = NETDEV_TX_BUSY; - else - status = NETDEV_TX_OK; - } - return status; + /* We need to see if the link is up; if it's not, make the +* netif layer think we're good and drop the packet +*/ + if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || + !netif_carrier_ok(netdev)) + goto drop; + + status = send_packet(skb, adapter); + if (status) + goto drop; + + return NETDEV_TX_OK; + +drop: + dev_kfree_skb_any(skb); + adapter->net_stats.tx_dropped++; + /* return success to make netif layer happy */ + return NETDEV_TX_OK; } /* et131x_tx_timeout - Timeout handler -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 5/7] staging: et131x: stop read when hit max delay in et131x_phy_mii_read
stop read and return error when hit max delay time. Signed-off-by: ZHAO Gang Acked-by: Mark Einon --- v3 -> v4 -> v5: version bump, sequence number bump drivers/staging/et131x/et131x.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 83d29811..15eadab 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -1392,6 +1392,7 @@ static int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr, mii_indicator); status = -EIO; + goto out; } /* If we hit here we were able to read the register and we need to @@ -1399,6 +1400,7 @@ static int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr, */ *value = readl(&mac->mii_mgmt_stat) & ET_MAC_MIIMGMT_STAT_PHYCRTL_MASK; +out: /* Stop the read operation */ writel(0, &mac->mii_mgmt_cmd); -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 6/7] staging: et131x: remove spinlock adapter->lock
adapter->lock is only used in et131x_multicast(), which is eventually called by network stack function __dev_set_rx_mode(). __dev_set_rx_mode() is always called by (net_device *)dev->addr_list_lock hold, to protect from concurrent access. So adapter->lock is redundant. Signed-off-by: ZHAO Gang Acked-by: Mark Einon --- v3 -> v4 -> v5: version bump, sequence number bump drivers/staging/et131x/et131x.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 15eadab..7db794d 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -486,8 +486,6 @@ struct et131x_adapter { u8 eeprom_data[2]; /* Spinlocks */ - spinlock_t lock; - spinlock_t tcb_send_qlock; spinlock_t tcb_ready_qlock; spinlock_t send_hw_lock; @@ -3872,7 +3870,6 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev, adapter->netdev = netdev; /* Initialize spinlocks here */ - spin_lock_init(&adapter->lock); spin_lock_init(&adapter->tcb_send_qlock); spin_lock_init(&adapter->tcb_ready_qlock); spin_lock_init(&adapter->send_hw_lock); @@ -4434,8 +4431,6 @@ static void et131x_multicast(struct net_device *netdev) struct netdev_hw_addr *ha; int i; - spin_lock_irqsave(&adapter->lock, flags); - /* Before we modify the platform-independent filter flags, store them * locally. This allows us to determine if anything's changed and if * we even need to bother the hardware @@ -4489,7 +4484,6 @@ static void et131x_multicast(struct net_device *netdev) /* Call the device's filter function */ et131x_set_packet_filter(adapter); } - spin_unlock_irqrestore(&adapter->lock, flags); } /* et131x_tx - The handler to tx a packet on the device -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 7/7] staging: et131x: update TODO list
remove items that have been done Signed-off-by: ZHAO Gang Acked-by: Mark Einon --- v3 -> v4 -> v5: version bump, sequence number bump drivers/staging/et131x/README | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/staging/et131x/README b/drivers/staging/et131x/README index 8da96a6..00a34ea 100644 --- a/drivers/staging/et131x/README +++ b/drivers/staging/et131x/README @@ -11,12 +11,7 @@ TODO: - Look at reducing the number of spinlocks - Simplify code in nic_rx_pkts(), when determining multicast_pkts_rcvd - Implement NAPI support - - In et131x_tx(), don't return NETDEV_TX_BUSY, just drop the packet with kfree_skb(). - Reduce the number of split lines by careful consideration of variable names etc. - - Do this in et131x.c: -struct fbr_lookup *fbr; -fbr = rx_local->fbr[id]; - Then replace all the instances of "rx_local->fbr[id]" with fbr. Please send patches to: Greg Kroah-Hartman -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/39] staging: comedi: das6402: remove DEBUG noise
The private data does not contain 'das6402_irqcount' or 'das6402_wordsread' members so the printk noise produces build errors when DEBUG is defined. The other printk is just added noise. Remove the printk's to fix the build errors and remove the noise. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das6402.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c index fb25cb8..e80c19a8 100644 --- a/drivers/staging/comedi/drivers/das6402.c +++ b/drivers/staging/comedi/drivers/das6402.c @@ -152,21 +152,12 @@ static irqreturn_t intr_handler(int irq, void *d) dev_warn(dev->class_dev, "BUG: spurious interrupt\n"); return IRQ_HANDLED; } -#ifdef DEBUG - printk("das6402: interrupt! das6402_irqcount=%i\n", - devpriv->das6402_irqcount); - printk("das6402: iobase+2=%i\n", inw_p(dev->iobase + 2)); -#endif das6402_ai_fifo_dregs(dev, s); if (s->async->buf_write_count >= devpriv->ai_bytes_to_read) { outw_p(SCANL, dev->iobase + 2); /* clears the fifo */ outb(0x07, dev->iobase + 8);/* clears all flip-flops */ -#ifdef DEBUG - printk("das6402: Got %i samples\n\n", - devpriv->das6402_wordsread - diff); -#endif s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s); } -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/39] staging: comedi: pcl816: remove DEBUG macro
This macro is only used to output some function tracing debug messages. These messages are just added noise so remove the DEBUG macro as well as the noise. Also, remove pcl816_cmdtest_out() which was only called as part of the DEBUG() in pcl816_ai_cmdtest(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl816.c | 38 + 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index ab9d2bd..36a9657 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -44,8 +44,6 @@ Configuration Options: #include "comedi_fc.h" #include "8253.h" -#define DEBUG(x) x - /* boards constants */ /* IO space len */ #define PCLx1x_RANGE 16 @@ -405,22 +403,6 @@ static irqreturn_t interrupt_pcl816(int irq, void *d) /* == - COMMAND MODE -*/ -static void pcl816_cmdtest_out(int e, struct comedi_cmd *cmd) -{ - printk(KERN_INFO "pcl816 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e, - cmd->start_src, cmd->scan_begin_src, cmd->convert_src); - printk(KERN_INFO "pcl816 e=%d startarg=%d scanarg=%d convarg=%d\n", e, - cmd->start_arg, cmd->scan_begin_arg, cmd->convert_arg); - printk(KERN_INFO "pcl816 e=%d stopsrc=%x scanend=%x\n", e, - cmd->stop_src, cmd->scan_end_src); - printk(KERN_INFO "pcl816 e=%d stoparg=%d scanendarg=%d chanlistlen=%d\n", - e, cmd->stop_arg, cmd->scan_end_arg, cmd->chanlist_len); -} - -/* - == */ static int pcl816_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) @@ -429,10 +411,6 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, int err = 0; int tmp, divisor1 = 0, divisor2 = 0; - DEBUG(printk(KERN_INFO "pcl816 pcl812_ai_cmdtest\n"); - pcl816_cmdtest_out(-1, cmd); -); - /* Step 1 : check if triggers are trivially valid */ err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); @@ -685,8 +663,6 @@ static int pcl816_ai_cancel(struct comedi_device *dev, { struct pcl816_private *devpriv = dev->private; -/* DEBUG(printk("pcl816_ai_cancel()\n");) */ - if (devpriv->irq_blocked > 0) { switch (devpriv->int816_mode) { case INT_TYPE_AI1_DMA: @@ -719,9 +695,7 @@ static int pcl816_ai_cancel(struct comedi_device *dev, break; } } - - DEBUG(printk("comedi: pcl816_ai_cancel() successful\n");) - return 0; + return 0; } /* @@ -823,11 +797,6 @@ check_channel_list(struct comedi_device *dev, /* first channel is every time ok */ chansegment[0] = chanlist[0]; for (i = 1, seglen = 1; i < chanlen; i++, seglen++) { - /* build part of chanlist */ - DEBUG(printk(KERN_INFO "%d. %d %d\n", i, -CR_CHAN(chanlist[i]), -CR_RANGE(chanlist[i]));) - /* we detect loop, this must by finish */ if (chanlist[0] == chanlist[i]) break; @@ -849,11 +818,6 @@ check_channel_list(struct comedi_device *dev, /* check whole chanlist */ for (i = 0, segpos = 0; i < chanlen; i++) { - DEBUG(printk("%d %d=%d %d\n", -CR_CHAN(chansegment[i % seglen]), -CR_RANGE(chansegment[i % seglen]), -CR_CHAN(chanlist[i]), -CR_RANGE(chanlist[i]));) if (chanlist[i] != chansegment[i % seglen]) { printk(KERN_WARNING "comedi%d: pcl816: bad channel or range" -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/39] staging: comedi: dt282x: remove DEBUG define
This define is only used to enable a debug message during the board attach. The message is just added noise, remove it as well as the DEBUG define. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt282x.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index a01e6b5..c4ffedb 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -63,8 +63,6 @@ Notes: #include "comedi_fc.h" -#define DEBUG - #define DT2821_TIMEOUT 100 /* 500 us */ #define DT2821_SIZE 0x10 @@ -1130,14 +1128,6 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) outw(DT2821_BDINIT, dev->iobase + DT2821_SUPCSR); i = inw(dev->iobase + DT2821_ADCSR); -#ifdef DEBUG - printk(KERN_DEBUG " fingerprint=%x,%x,%x,%x,%x", - inw(dev->iobase + DT2821_ADCSR), - inw(dev->iobase + DT2821_CHANCSR), - inw(dev->iobase + DT2821_DACSR), - inw(dev->iobase + DT2821_SUPCSR), - inw(dev->iobase + DT2821_TMRCTR)); -#endif if (((inw(dev->iobase + DT2821_ADCSR) & DT2821_ADCSR_MASK) != DT2821_ADCSR_VAL) || -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/39] staging: comedi: ni_pcidio: remove custom DPRINTK macro
The comedi core defines a DPRINTK macro in comedidev.h. Use that macro instead of defining a private version in this driver. Also, remove the DEBUG define since it was only used to enable the DPRINTK macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcidio.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index e3a8fa9..75da358 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -47,7 +47,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org */ #define USE_DMA -/* #define DEBUG 1 */ /* #define DEBUG_FLAGS */ #include @@ -60,13 +59,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org #include "comedi_fc.h" #include "mite.h" -#undef DPRINTK -#ifdef DEBUG -#define DPRINTK(format, args...) pr_debug(format, ## args) -#else -#define DPRINTK(format, args...) do { } while (0) -#endif - #define PCI_DIO_SIZE 4096 #define PCI_MITE_SIZE 4096 -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/39] staging: comedi: ni_pcidio: remove DEBUG define
This define is only used to enable some debug messages during the board attach. These are just added noise, remove them as well as the DEBUG define. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_atmio.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c index 856c73d..d039352 100644 --- a/drivers/staging/comedi/drivers/ni_atmio.c +++ b/drivers/staging/comedi/drivers/ni_atmio.c @@ -98,8 +98,6 @@ are not supported. #include "ni_stc.h" #include "8255.h" -#undef DEBUG - #define ATMIO 1 #undef PCIMIO @@ -437,19 +435,6 @@ static int ni_atmio_attach(struct comedi_device *dev, if (ret) return ret; -#ifdef DEBUG - /* board existence sanity check */ - { - int i; - - printk(" board fingerprint:"); - for (i = 0; i < 16; i += 2) { - printk(" %04x %02x", inw(dev->iobase + i), - inb(dev->iobase + i + 1)); - } - } -#endif - /* get board type */ board = ni_getboardtype(dev); -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/39] staging: comedi: remove comedi_debug module parameter
Remove this module parameter and use the CONFIG_COMEDI_DEBUG option to enable normal kernel debugging with -DDEBUG flag. Remove the #undef DEBUG from all the comedi source files so they will honour the -DDEBUG flag. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/Makefile| 2 ++ drivers/staging/comedi/comedi_fops.c | 11 --- drivers/staging/comedi/comedidev.h | 11 +-- drivers/staging/comedi/drivers/Makefile| 1 + drivers/staging/comedi/drivers/ni_mio_cs.c | 2 -- drivers/staging/comedi/kcomedilib/Makefile | 2 ++ 6 files changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/staging/comedi/Makefile b/drivers/staging/comedi/Makefile index e6dfc98..fae2d90 100644 --- a/drivers/staging/comedi/Makefile +++ b/drivers/staging/comedi/Makefile @@ -1,3 +1,5 @@ +ccflags-$(CONFIG_COMEDI_DEBUG) := -DDEBUG + comedi-y := comedi_fops.o range.o drivers.o \ comedi_buf.o comedi-$(CONFIG_COMEDI_PCI_DRIVERS)+= comedi_pci.o diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index f3d59e2..bbfad96 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -16,8 +16,6 @@ GNU General Public License for more details. */ -#undef DEBUG - #include "comedi_compat32.h" #include @@ -47,15 +45,6 @@ #define COMEDI_NUM_SUBDEVICE_MINORS\ (COMEDI_NUM_MINORS - COMEDI_NUM_BOARD_MINORS) -#ifdef CONFIG_COMEDI_DEBUG -int comedi_debug; -EXPORT_SYMBOL_GPL(comedi_debug); -module_param(comedi_debug, int, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(comedi_debug, -"enable comedi core and driver debugging if non-zero (default 0)" - ); -#endif - static int comedi_num_legacy_minors; module_param(comedi_num_legacy_minors, int, S_IRUGO); MODULE_PARM_DESC(comedi_num_legacy_minors, diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 143be80..6dda30e 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -23,10 +23,7 @@ #include "comedi.h" -#define DPRINTK(format, args...) do {\ - if (comedi_debug) \ - pr_debug("comedi: " format, ## args); \ -} while (0) +#define DPRINTK(format, args...) pr_debug("comedi: " format, ## args); #define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) #define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, \ @@ -208,12 +205,6 @@ static inline const void *comedi_board(const struct comedi_device *dev) return dev->board_ptr; } -#ifdef CONFIG_COMEDI_DEBUG -extern int comedi_debug; -#else -static const int comedi_debug; -#endif - /* * function prototypes */ diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index 94cbd26..a16e674 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -1,5 +1,6 @@ # Makefile for individual comedi drivers # +ccflags-$(CONFIG_COMEDI_DEBUG) := -DDEBUG # Comedi "helper" modules diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index 229a273..de42148 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -47,8 +47,6 @@ See the notes in the ni_atmio.o driver. #include #include -#undef DEBUG - #define ATMIO 1 #undef PCIMIO diff --git a/drivers/staging/comedi/kcomedilib/Makefile b/drivers/staging/comedi/kcomedilib/Makefile index 18ee99b..3aff8ed 100644 --- a/drivers/staging/comedi/kcomedilib/Makefile +++ b/drivers/staging/comedi/kcomedilib/Makefile @@ -1,3 +1,5 @@ +ccflags-$(CONFIG_COMEDI_DEBUG) := -DDEBUG + obj-$(CONFIG_COMEDI_KCOMEDILIB)+= kcomedilib.o kcomedilib-objs := kcomedilib_main.o -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/39] staging: comedi: dt3000: remove DEBUG define
This define unables some debug code that prints the status flags during the interrupt handler. These messages are just added noise and it's probably not a good idea to spew them during the interrupt anyway. Remove the DEBUG define as well as the debug code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt3000.c | 23 --- 1 file changed, 23 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 292226e..3073efd 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -48,8 +48,6 @@ AO commands are not supported. you the docs without one, also. */ -#define DEBUG 1 - #include #include #include @@ -253,24 +251,6 @@ struct dt3k_private { unsigned int ai_rear; }; -#ifdef DEBUG -static char *intr_flags[] = { - "AdFull", "AdSwError", "AdHwError", "DaEmpty", - "DaSwError", "DaHwError", "CtDone", "CmDone", -}; - -static void debug_intr_flags(unsigned int flags) -{ - int i; - printk(KERN_DEBUG "dt3k: intr_flags:"); - for (i = 0; i < 8; i++) { - if (flags & (1 << i)) - printk(KERN_CONT " %s", intr_flags[i]); - } - printk(KERN_CONT "\n"); -} -#endif - #define TIMEOUT 100 static void dt3k_send_cmd(struct comedi_device *dev, unsigned int cmd) @@ -380,9 +360,6 @@ static irqreturn_t dt3k_interrupt(int irq, void *d) s = &dev->subdevices[0]; status = readw(devpriv->io_addr + DPR_Intr_Flag); -#ifdef DEBUG - debug_intr_flags(status); -#endif if (status & DT3000_ADFULL) { dt3k_ai_empty_fifo(dev, s); -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/39] staging: comedi: range: remove use of DPRINTK
Use dev_dbg() instead of the DPRINTK macro to output the comedi debugging information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/range.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/range.c b/drivers/staging/comedi/range.c index 8fde554..46b3da6 100644 --- a/drivers/staging/comedi/range.c +++ b/drivers/staging/comedi/range.c @@ -83,8 +83,10 @@ int do_rangeinfo_ioctl(struct comedi_device *dev, } if (RANGE_LENGTH(it.range_type) != lr->length) { - DPRINTK("wrong length %d should be %d (0x%08x)\n", - RANGE_LENGTH(it.range_type), lr->length, it.range_type); + dev_dbg(dev->class_dev, + "wrong length %d should be %d (0x%08x)\n", + RANGE_LENGTH(it.range_type), + lr->length, it.range_type); return -EINVAL; } @@ -123,7 +125,8 @@ static int aref_invalid(struct comedi_subdevice *s, unsigned int chanspec) default: break; } - DPRINTK("subdevice does not support aref %i", aref); + dev_dbg(s->device->class_dev, "subdevice does not support aref %i", + aref); return 1; } -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/39] staging: comedi: amplc_pci224: remove use of DPRINTK
Use dev_dbg() instead of the DPRINTK macro to output the comedi debugging information. The dev_dbg() will prefix the messages appropriately so remove the "comedi%d: " DRIVER_NAME portion and use __func__ to show the actual function name for debugging. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci224.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 810e397..dcccdce 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -909,16 +909,14 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, } if (errors) { if (errors & dupchan_err) { - DPRINTK("comedi%d: " DRIVER_NAME - ": ao_cmdtest: " - "entries in chanlist must contain no " - "duplicate channels\n", dev->minor); + dev_dbg(dev->class_dev, + "%s: entries in chanlist must contain no duplicate channels\n", + __func__); } if (errors & range_err) { - DPRINTK("comedi%d: " DRIVER_NAME - ": ao_cmdtest: " - "entries in chanlist must all have " - "the same range index\n", dev->minor); + dev_dbg(dev->class_dev, + "%s: entries in chanlist must all have the same range index\n", + __func__); } err++; } -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/39] staging: comedi: pcl816: remove use of DPRINTK
Remove the DPRINTK messages that are just function trace noise. Use dev_dbg() instead of the DPRINTK macro to output the comedi debugging information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl816.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 36a9657..7b92aa5 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -174,7 +174,6 @@ static int pcl816_ai_insn_read(struct comedi_device *dev, int n; int timeout; - DPRINTK("mode 0 analog input\n"); /* software trigger, DMA and INT off */ outb(0, dev->iobase + PCL816_CONTROL); /* clear INT (conversion end) flag */ @@ -370,8 +369,6 @@ static irqreturn_t interrupt_pcl816(int irq, void *d) struct comedi_device *dev = d; struct pcl816_private *devpriv = dev->private; - DPRINTK(""); - if (!dev->attached) { comedi_error(dev, "premature interrupt"); return IRQ_HANDLED; @@ -608,7 +605,6 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) break; } - DPRINTK("pcl816 END: pcl812_ai_cmd()\n"); return 0; } @@ -762,8 +758,8 @@ start_pacer(struct comedi_device *dev, int mode, unsigned int divisor1, udelay(1); if (mode == 1) { - DPRINTK("mode %d, divisor1 %d, divisor2 %d\n", mode, divisor1, - divisor2); + dev_dbg(dev->class_dev, "mode %d, divisor1 %d, divisor2 %d\n", + mode, divisor1, divisor2); outb(divisor2 & 0xff, dev->iobase + PCL816_CTR2); outb((divisor2 >> 8) & 0xff, dev->iobase + PCL816_CTR2); outb(divisor1 & 0xff, dev->iobase + PCL816_CTR1); -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/39] staging: comedi: amplc_pci230: remove use of DPRINTK
Use dev_dbg() instead of the DPRINTK macro to output the comedi debugging information. The dev_dbg() will prefix the messages appropriately so remove the "comedi%d: amplc_pci230: " portion and use __func__ to show the actual function name for debugging. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci230.c | 52 +-- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index a97bbd6..e11d7ce 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -818,9 +818,9 @@ static int pci230_ai_rinsn(struct comedi_device *dev, if (aref == AREF_DIFF) { /* Differential. */ if (chan >= s->n_chan / 2) { - DPRINTK("comedi%d: amplc_pci230: ai_rinsn: " - "differential channel number out of range " - "0 to %u\n", dev->minor, (s->n_chan / 2) - 1); + dev_dbg(dev->class_dev, + "%s: differential channel number out of range 0 to %u\n", + __func__, (s->n_chan / 2) - 1); return -EINVAL; } } @@ -1092,14 +1092,14 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, if (errors != 0) { err++; if ((errors & seq_err) != 0) { - DPRINTK("comedi%d: amplc_pci230: ao_cmdtest: " - "channel numbers must increase\n", - dev->minor); + dev_dbg(dev->class_dev, + "%s: channel numbers must increase\n", + __func__); } if ((errors & range_err) != 0) { - DPRINTK("comedi%d: amplc_pci230: ao_cmdtest: " - "channels must have the same range\n", - dev->minor); + dev_dbg(dev->class_dev, + "%s: channels must have the same range\n", + __func__); } } } @@ -1835,33 +1835,29 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, if (errors != 0) { err++; if ((errors & seq_err) != 0) { - DPRINTK("comedi%d: amplc_pci230: ai_cmdtest: " - "channel numbers must increase or " - "sequence must repeat exactly\n", - dev->minor); + dev_dbg(dev->class_dev, + "%s: channel numbers must increase or sequence must repeat exactly\n", + __func__); } if ((errors & rangepair_err) != 0) { - DPRINTK("comedi%d: amplc_pci230: ai_cmdtest: " - "single-ended channel pairs must " - "have the same range\n", dev->minor); + dev_dbg(dev->class_dev, + "%s: single-ended channel pairs must have the same range\n", + __func__); } if ((errors & polarity_err) != 0) { - DPRINTK("comedi%d: amplc_pci230: ai_cmdtest: " - "channel sequence ranges must be all " - "bipolar or all unipolar\n", - dev->minor); + dev_dbg(dev->class_dev, + "%s: channel sequence ranges must be all bipolar or all unipolar\n", + __func__); } if ((errors & aref_err) != 0) { - DPRINTK("comedi%d: amplc_pci230: ai_cmdtest: " - "channel sequence analogue references " - "must be all the same (single-ended " - "or differential)\n", dev->minor); + dev_dbg(dev->class_dev, + "%s: channel sequence analogue references must be all the same (single-ended or differential)\n", + __func__);
[PATCH 17/39] staging: comedi: ni_pcidio: remove debug_int()
This function is not used by the driver. Just remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcidio.c | 31 -- 1 file changed, 31 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index c04ec29..933aabe 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -539,37 +539,6 @@ out: return IRQ_HANDLED; } -#ifdef unused -static void debug_int(struct comedi_device *dev) -{ - struct nidio96_private *devpriv = dev->private; - int a, b; - static int n_int; - struct timeval tv; - - do_gettimeofday(&tv); - a = readb(devpriv->mite->daq_io_addr + Group_Status); - b = readb(devpriv->mite->daq_io_addr + Group_1_Flags); - - if (n_int < 10) { - DPRINTK("status 0x%02x flags 0x%02x time %06d\n", a, b, - (int)tv.tv_usec); - } - - while (b & 1) { - writew(0xff, devpriv->mite->daq_io_addr + Group_1_FIFO); - b = readb(devpriv->mite->daq_io_addr + Group_1_Flags); - } - - b = readb(devpriv->mite->daq_io_addr + Group_1_Flags); - - if (n_int < 10) { - DPRINTK("new status 0x%02x\n", b); - n_int++; - } -} -#endif - static int ni_pcidio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 20/39] staging: comedi: mite: remove MDPRINTK macro
This macro is used by the comedi drivers that usee the mite module to output development function trace messages. These are just added noise. Remove the messages as well as the macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mite.c | 9 - drivers/staging/comedi/drivers/mite.h | 7 --- drivers/staging/comedi/drivers/ni_mio_common.c | 18 ++ 3 files changed, 2 insertions(+), 32 deletions(-) diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 35cb4ac..8a172e3 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -288,7 +288,6 @@ void mite_dma_arm(struct mite_channel *mite_chan) int chor; unsigned long flags; - MDPRINTK("mite_dma_arm ch%i\n", mite_chan->channel); /* * memory barrier is intended to insure any twiddling with the buffer * is done before writing to the mite to arm dma transfer @@ -329,8 +328,6 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, n_links = async->prealloc_bufsz >> PAGE_SHIFT; - MDPRINTK("ring->hw_dev=%p, n_links=0x%04x\n", ring->hw_dev, n_links); - ring->descriptors = dma_alloc_coherent(ring->hw_dev, n_links * sizeof(struct mite_dma_descriptor), @@ -368,8 +365,6 @@ void mite_prep_dma(struct mite_channel *mite_chan, unsigned int chor, chcr, mcr, dcr, lkcr; struct mite_struct *mite = mite_chan->mite; - MDPRINTK("mite_prep_dma ch%i\n", mite_chan->channel); - /* reset DMA and FIFO */ chor = CHOR_DMARESET | CHOR_FRESET; writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel)); @@ -448,8 +443,6 @@ void mite_prep_dma(struct mite_channel *mite_chan, /* starting address for link chaining */ writel(mite_chan->ring->descriptors_dma_addr, mite->mite_io_addr + MITE_LKAR(mite_chan->channel)); - - MDPRINTK("exit mite_prep_dma\n"); } EXPORT_SYMBOL_GPL(mite_prep_dma); @@ -515,8 +508,6 @@ unsigned mite_dma_tcr(struct mite_channel *mite_chan) lkar = readl(mite->mite_io_addr + MITE_LKAR(mite_chan->channel)); tcr = readl(mite->mite_io_addr + MITE_TCR(mite_chan->channel)); - MDPRINTK("mite_dma_tcr ch%i, lkar=0x%08x tcr=%d\n", mite_chan->channel, -lkar, tcr); return tcr; } diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index 8423b8b..1d72149 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -24,15 +24,8 @@ #include #include "../comedidev.h" -/* #define DEBUG_MITE */ #define PCIMIO_COMPAT -#ifdef DEBUG_MITE -#define MDPRINTK(format, args...) pr_debug(format , ## args) -#else -#define MDPRINTK(format, args...) do { } while (0) -#endif - #define MAX_MITE_DMA_CHANNELS 8 struct mite_dma_descriptor { diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 5113397..0581852 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -63,10 +63,6 @@ #include "mite.h" #include "comedi_fc.h" -#ifndef MDPRINTK -#define MDPRINTK(format, args...) -#endif - /* A timeout count */ #define NI_TIMEOUT 1000 static const unsigned old_RTSI_clock_channel = 7; @@ -1214,12 +1210,9 @@ static void handle_b_interrupt(struct comedi_device *dev, s->async->events |= COMEDI_CB_OVERFLOW; } - if (b_status & AO_BC_TC_St) { - MDPRINTK - ("ni_mio_common: AO BC_TC status=0x%04x status2=0x%04x\n", -b_status, devpriv->stc_readw(dev, AO_Status_2_Register)); + if (b_status & AO_BC_TC_St) s->async->events |= COMEDI_CB_EOA; - } + #ifndef PCIDMA if (b_status & AO_FIFO_Request_St) { int ret; @@ -2392,7 +2385,6 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned int stop_count; int interrupt_a_enable = 0; - MDPRINTK("ni_ai_cmd\n"); if (dev->irq == 0) { comedi_error(dev, "cannot run command without an irq"); return -EIO; @@ -2630,15 +2622,11 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ni_set_bits(dev, Interrupt_A_Enable_Register, interrupt_a_enable, 1); - - MDPRINTK("Interrupt_A_Enable_Register = 0x%04x\n", -devpriv->int_a_enable_reg); } else { /* interrupt on nothing */ ni_set_bits(dev, Interrupt_A_Enable_Register, ~0, 0); /* XXX start polling if necessary */ - MDPRINTK("interrupting on nothing\n"); }
[PATCH 21/39] staging: comedi: mite: remove DEBUG_MITE code
The code protected by the DEBUG_MITE define outputs some development debug information. This information is just added noise in the final driver. Remove the code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mite.c | 134 - drivers/staging/comedi/drivers/mite.h | 5 - drivers/staging/comedi/drivers/ni_mio_common.c | 3 - drivers/staging/comedi/drivers/ni_pcidio.c | 4 - 4 files changed, 146 deletions(-) diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 8a172e3..68db40e 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -633,140 +633,6 @@ int mite_done(struct mite_channel *mite_chan) } EXPORT_SYMBOL_GPL(mite_done); -#ifdef DEBUG_MITE - -/* names of bits in mite registers */ - -static const char *const mite_CHOR_strings[] = { - "start", "cont", "stop", "abort", - "freset", "clrlc", "clrrb", "clrdone", - "clr_lpause", "set_lpause", "clr_send_tc", - "set_send_tc", "12", "13", "14", - "15", "16", "17", "18", - "19", "20", "21", "22", - "23", "24", "25", "26", - "27", "28", "29", "30", - "dmareset", -}; - -static const char *const mite_CHCR_strings[] = { - "continue", "ringbuff", "2", "3", - "4", "5", "6", "7", - "8", "9", "10", "11", - "12", "13", "bursten", "fifodis", - "clr_cont_rb_ie", "set_cont_rb_ie", "clr_lc_ie", "set_lc_ie", - "clr_drdy_ie", "set_drdy_ie", "clr_mrdy_ie", "set_mrdy_ie", - "clr_done_ie", "set_done_ie", "clr_sar_ie", "set_sar_ie", - "clr_linkp_ie", "set_linkp_ie", "clr_dma_ie", "set_dma_ie", -}; - -static const char *const mite_MCR_strings[] = { - "amdevice", "1", "2", "3", - "4", "5", "portio", "portvxi", - "psizebyte", "psizehalf (byte & half = word)", "aseqxp1", "11", - "12", "13", "blocken", "berhand", - "reqsintlim/reqs0", "reqs1", "reqs2", "rd32", - "rd512", "rl1", "rl2", "rl8", - "24", "25", "26", "27", - "28", "29", "30", "stopen", -}; - -static const char *const mite_DCR_strings[] = { - "amdevice", "1", "2", "3", - "4", "5", "portio", "portvxi", - "psizebyte", "psizehalf (byte & half = word)", "aseqxp1", "aseqxp2", - "aseqxp8", "13", "blocken", "berhand", - "reqsintlim", "reqs1", "reqs2", "rd32", - "rd512", "rl1", "rl2", "rl8", - "23", "24", "25", "27", - "28", "wsdevc", "wsdevs", "rwdevpack", -}; - -static const char *const mite_LKCR_strings[] = { - "amdevice", "1", "2", "3", - "4", "5", "portio", "portvxi", - "psizebyte", "psizehalf (byte & half = word)", "asequp", "aseqdown", - "12", "13", "14", "berhand", - "16", "17", "18", "rd32", - "rd512", "rl1", "rl2", "rl8", - "24", "25", "26", "27", - "28", "29", "30", "chngend", -}; - -static const char *const mite_CHSR_strings[] = { - "d.err0", "d.err1", "m.err0", "m.err1", - "l.err0", "l.err1", "drq0", "drq1", - "end", "xferr", "operr0", "operr1", - "stops", "habort", "sabort", "error", - "16", "conts_rb", "18", "linkc", - "20", "drdy", "22", "mrdy", - "24", "done", "26", "sars", - "28", "lpauses", "30", "int", -}; - -static void mite_decode(const char *const *bit_str, unsigned int bits) -{ - int i; - - for (i = 31; i >= 0; i--) { - if (bits & (1 << i)) - pr_debug(" %s\n", bit_str[i]); - } -} - -void mite_dump_regs(struct mite_channel *mite_chan) -{ - void __iomem *mite_io_addr = mite_chan->mite->mite_io_addr; - unsigned int offset; - unsigned int value; - int channel = mite_chan->channel; - - pr_debug("mite_dump_regs ch%i\n", channel); - pr_debug("mite address is =%p\n", mite_io_addr); - - offset = MITE_CHOR(channel); - value = readl(mite_io_addr + offset); - pr_debug("mite status[CHOR] at 0x%08x =0x%08x\n", offset, value); - mite_decode(mite_CHOR_strings, value); - offset = MITE_CHCR(channel); - value = readl(mite_io_addr + offset); - pr_debug("mite status[CHCR] at 0x%08x =0x%08x\n", offset, value); - mite_decode(mite_CHCR_strings, value); - offset = MITE_TCR(channel); - value = readl(mite_io_addr + offset); - pr_debug("mite status[TCR] at 0x%08x =0x%08x\n", offset, value); - offset = MITE_MCR(channel); - value = readl(mite_io_addr + offset); - pr_debug("mite status[MCR] at 0x%08x =0x%08x\n", offset, value); - mite_decode(mite_MCR_strings, value); - offset = MITE_MAR(channel); - value = readl(mite_io_addr + offset); - pr_debug("mite status[MAR] at 0x%08x =0x%08x\n", offset, value); - offset = MITE_DCR(channel); - value = readl(mite_io_addr + offset); - pr_debug("mite status[DCR] at 0x%08x =0x%08x\n", offset, value); -
[PATCH 23/39] staging: comedi: gsc_hpdi: remove DEBUG_PRINT
The DEBUG_PRINT macro in this driver is used to output development debug tracing messages. These messages are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/gsc_hpdi.c | 78 --- 1 file changed, 78 deletions(-) diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 559bf55..4fcf3c8 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -60,15 +60,6 @@ static int hpdi_cancel(struct comedi_device *dev, struct comedi_subdevice *s); static irqreturn_t handle_interrupt(int irq, void *d); static int dio_config_block_size(struct comedi_device *dev, unsigned int *data); -#undef HPDI_DEBUG /* disable debugging messages */ -/* #define HPDI_DEBUG enable debugging code */ - -#ifdef HPDI_DEBUG -#define DEBUG_PRINT(format, args...) pr_debug(format , ## args) -#else -#define DEBUG_PRINT(format, args...) no_printk(pr_fmt(format), ## args) -#endif - #define TIMER_BASE 50 /* 20MHz master clock */ #define DMA_BUFFER_SIZE 0x1 #define NUM_DMA_BUFFERS 4 @@ -260,32 +251,6 @@ static void init_plx9080(struct comedi_device *dev) uint32_t bits; void __iomem *plx_iobase = devpriv->plx9080_iobase; - /* plx9080 dump */ - DEBUG_PRINT(" plx interrupt status 0x%x\n", - readl(plx_iobase + PLX_INTRCS_REG)); - DEBUG_PRINT(" plx id bits 0x%x\n", readl(plx_iobase + PLX_ID_REG)); - DEBUG_PRINT(" plx control reg 0x%x\n", - readl(devpriv->plx9080_iobase + PLX_CONTROL_REG)); - - DEBUG_PRINT(" plx revision 0x%x\n", - readl(plx_iobase + PLX_REVISION_REG)); - DEBUG_PRINT(" plx dma channel 0 mode 0x%x\n", - readl(plx_iobase + PLX_DMA0_MODE_REG)); - DEBUG_PRINT(" plx dma channel 1 mode 0x%x\n", - readl(plx_iobase + PLX_DMA1_MODE_REG)); - DEBUG_PRINT(" plx dma channel 0 pci address 0x%x\n", - readl(plx_iobase + PLX_DMA0_PCI_ADDRESS_REG)); - DEBUG_PRINT(" plx dma channel 0 local address 0x%x\n", - readl(plx_iobase + PLX_DMA0_LOCAL_ADDRESS_REG)); - DEBUG_PRINT(" plx dma channel 0 transfer size 0x%x\n", - readl(plx_iobase + PLX_DMA0_TRANSFER_SIZE_REG)); - DEBUG_PRINT(" plx dma channel 0 descriptor 0x%x\n", - readl(plx_iobase + PLX_DMA0_DESCRIPTOR_REG)); - DEBUG_PRINT(" plx dma channel 0 command status 0x%x\n", - readb(plx_iobase + PLX_DMA0_CS_REG)); - DEBUG_PRINT(" plx dma channel 0 threshold 0x%x\n", - readl(plx_iobase + PLX_DMA0_THRESHOLD_REG)); - DEBUG_PRINT(" plx bigend 0x%x\n", readl(plx_iobase + PLX_BIGEND_REG)); #ifdef __BIG_ENDIAN bits = BIGEND_DMA0 | BIGEND_DMA1; #else @@ -395,10 +360,6 @@ static int setup_dma_descriptors(struct comedi_device *dev, if (transfer_size == 0) return -1; - DEBUG_PRINT(" transfer_size %i\n", transfer_size); - DEBUG_PRINT(" descriptors at 0x%lx\n", - (unsigned long)devpriv->dma_desc_phys_addr); - buffer_offset = 0; buffer_index = 0; for (i = 0; i < NUM_DMA_DESCRIPTORS && @@ -423,21 +384,11 @@ static int setup_dma_descriptors(struct comedi_device *dev, buffer_offset = 0; buffer_index++; } - - DEBUG_PRINT(" desc %i\n", i); - DEBUG_PRINT(" start addr virt 0x%p, phys 0x%lx\n", - devpriv->desc_dio_buffer[i], - (unsigned long)devpriv->dma_desc[i]. - pci_start_addr); - DEBUG_PRINT(" next 0x%lx\n", - (unsigned long)devpriv->dma_desc[i].next); } devpriv->num_dma_descriptors = i; /* fix last descriptor to point back to first */ devpriv->dma_desc[i - 1].next = cpu_to_le32(devpriv->dma_desc_phys_addr | next_bits); - DEBUG_PRINT(" desc %i next fixup 0x%lx\n", i - 1, - (unsigned long)devpriv->dma_desc[i - 1].next); devpriv->block_size = transfer_size; @@ -489,9 +440,6 @@ static int hpdi_auto_attach(struct comedi_device *dev, return -ENOMEM; } - DEBUG_PRINT(" plx9080 remapped to 0x%p\n", devpriv->plx9080_iobase); - DEBUG_PRINT(" hpdi remapped to 0x%p\n", devpriv->hpdi_iobase); - init_plx9080(dev); /* get irq */ @@ -510,9 +458,6 @@ static int hpdi_auto_attach(struct comedi_device *dev, devpriv->dio_buffer[i] = pci_alloc_consistent(pcidev, DMA_BUFFER_SIZE, &devpriv->dio_buffer_phys_addr[i]); - DEBUG_PRINT("dio_buffer at virt 0x%p, phys 0x%lx\n", -
[PATCH 22/39] staging: comedi: cb_pcidas64: remove DEBUG_PRINT
The DEBUG_PRINT macro in this driver is used to output development debug tracing messages. These messages are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 126 +-- 1 file changed, 3 insertions(+), 123 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index ff52065..a0053bb 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -94,15 +94,6 @@ TODO: #include "plx9080.h" #include "comedi_fc.h" -#undef PCIDAS64_DEBUG /* disable debugging code */ -/* #define PCIDAS64_DEBUG enable debugging code */ - -#ifdef PCIDAS64_DEBUG -#define DEBUG_PRINT(format, args...) pr_debug(format, ## args) -#else -#define DEBUG_PRINT(format, args...) no_printk(format, ## args) -#endif - #define TIMER_BASE 25 /* 40MHz master clock */ /* 100kHz 'prescaled' clock for slow acquisition, * maybe I'll support this someday */ @@ -1252,8 +1243,6 @@ static void disable_ai_interrupts(struct comedi_device *dev) writew(devpriv->intr_enable_bits, devpriv->main_iobase + INTR_ENABLE_REG); spin_unlock_irqrestore(&dev->spinlock, flags); - - DEBUG_PRINT("intr enable bits 0x%x\n", devpriv->intr_enable_bits); } static void enable_ai_interrupts(struct comedi_device *dev, @@ -1277,7 +1266,6 @@ static void enable_ai_interrupts(struct comedi_device *dev, devpriv->intr_enable_bits |= bits; writew(devpriv->intr_enable_bits, devpriv->main_iobase + INTR_ENABLE_REG); - DEBUG_PRINT("intr enable bits 0x%x\n", devpriv->intr_enable_bits); spin_unlock_irqrestore(&dev->spinlock, flags); } @@ -1292,38 +1280,6 @@ static void init_plx9080(struct comedi_device *dev) devpriv->plx_control_bits = readl(devpriv->plx9080_iobase + PLX_CONTROL_REG); - /* plx9080 dump */ - DEBUG_PRINT(" plx interrupt status 0x%x\n", - readl(plx_iobase + PLX_INTRCS_REG)); - DEBUG_PRINT(" plx id bits 0x%x\n", readl(plx_iobase + PLX_ID_REG)); - DEBUG_PRINT(" plx control reg 0x%x\n", devpriv->plx_control_bits); - DEBUG_PRINT(" plx mode/arbitration reg 0x%x\n", - readl(plx_iobase + PLX_MARB_REG)); - DEBUG_PRINT(" plx region0 reg 0x%x\n", - readl(plx_iobase + PLX_REGION0_REG)); - DEBUG_PRINT(" plx region1 reg 0x%x\n", - readl(plx_iobase + PLX_REGION1_REG)); - - DEBUG_PRINT(" plx revision 0x%x\n", - readl(plx_iobase + PLX_REVISION_REG)); - DEBUG_PRINT(" plx dma channel 0 mode 0x%x\n", - readl(plx_iobase + PLX_DMA0_MODE_REG)); - DEBUG_PRINT(" plx dma channel 1 mode 0x%x\n", - readl(plx_iobase + PLX_DMA1_MODE_REG)); - DEBUG_PRINT(" plx dma channel 0 pci address 0x%x\n", - readl(plx_iobase + PLX_DMA0_PCI_ADDRESS_REG)); - DEBUG_PRINT(" plx dma channel 0 local address 0x%x\n", - readl(plx_iobase + PLX_DMA0_LOCAL_ADDRESS_REG)); - DEBUG_PRINT(" plx dma channel 0 transfer size 0x%x\n", - readl(plx_iobase + PLX_DMA0_TRANSFER_SIZE_REG)); - DEBUG_PRINT(" plx dma channel 0 descriptor 0x%x\n", - readl(plx_iobase + PLX_DMA0_DESCRIPTOR_REG)); - DEBUG_PRINT(" plx dma channel 0 command status 0x%x\n", - readb(plx_iobase + PLX_DMA0_CS_REG)); - DEBUG_PRINT(" plx dma channel 0 threshold 0x%x\n", - readl(plx_iobase + PLX_DMA0_THRESHOLD_REG)); - DEBUG_PRINT(" plx bigend 0x%x\n", readl(plx_iobase + PLX_BIGEND_REG)); - #ifdef __BIG_ENDIAN bits = BIGEND_DMA0 | BIGEND_DMA1; #else @@ -1417,9 +1373,6 @@ static int set_ai_fifo_segment_length(struct comedi_device *dev, devpriv->ai_fifo_segment_length = num_increments * increment_size; - DEBUG_PRINT("set hardware fifo segment length to %i\n", - devpriv->ai_fifo_segment_length); - return devpriv->ai_fifo_segment_length; } @@ -1441,8 +1394,6 @@ static int set_ai_fifo_size(struct comedi_device *dev, unsigned int num_samples) num_samples = retval * fifo->num_segments * fifo->sample_packing_ratio; - DEBUG_PRINT("set hardware fifo size to %i\n", num_samples); - return num_samples; } @@ -1538,8 +1489,6 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) if (devpriv->ai_dma_desc == NULL) return -ENOMEM; - DEBUG_PRINT("ai dma descriptors start at bus addr 0x%llx\n", - (unsigned long long)devpriv->ai_dma_desc_bus_addr); if (ao_cmd_is_supported(thisboard)) { devpriv->ao_dma_desc = pci_alloc_consistent(pcidev, @@ -1548,9 +1497,6 @@ static int alloc_and_i
[PATCH 25/39] staging: comedi: cb_pcimdas: remove CBPCIMDAS_DEBUG
This define is not used in the driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 30520d4..b25fa5d 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -44,9 +44,6 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details. #include "plx9052.h" #include "8255.h" -/* #define CBPCIMDAS_DEBUG */ -#undef CBPCIMDAS_DEBUG - /* Registers for the PCIM-DAS1602/16 */ /* sizes of io regions (bytes) */ -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 26/39] staging: comedi: ni_pcimio: remove PCI_DEBUG
This define is not used in the driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcimio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 536be83..aa002b2 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -116,8 +116,6 @@ Bugs: #include "ni_stc.h" #include "mite.h" -/* #define PCI_DEBUG */ - #define PCIDMA #define PCIMIO 1 -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 27/39] staging: comedi: pcmmio: remove DAMMIT_ITS_BROKEN debug
These debug messages are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcmmio.c | 22 -- 1 file changed, 22 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 14cee3a..1ebc9d2 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -250,11 +250,6 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev, /* The insn data is a mask in data[0] and the new data * in data[1], each channel cooresponding to a bit. */ -#ifdef DAMMIT_ITS_BROKEN - /* DEBUG */ - printk(KERN_DEBUG "write mask: %08x data: %08x\n", data[0], data[1]); -#endif - s->state = 0; for (byte_no = 0; byte_no < s->n_chan / CHANS_PER_PORT; ++byte_no) { @@ -271,14 +266,6 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev, byte = inb(ioaddr); /* read all 8-bits for this port */ -#ifdef DAMMIT_ITS_BROKEN - /* DEBUG */ - printk - (KERN_DEBUG "byte %d wmb %02x db %02x offset %02d io %04x," -" data_in %02x ", byte_no, (unsigned)write_mask_byte, -(unsigned)data_byte, offset, ioaddr, (unsigned)byte); -#endif - if (write_mask_byte) { /* * this byte has some write_bits @@ -291,10 +278,6 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev, /* Write out the new digital output state */ outb(byte, ioaddr); } -#ifdef DAMMIT_ITS_BROKEN - /* DEBUG */ - printk(KERN_DEBUG "data_out_byte %02x\n", (unsigned)byte); -#endif /* save the digital input lines for this byte.. */ s->state |= ((unsigned int)byte) << offset; } @@ -302,11 +285,6 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev, /* now return the DIO lines to data[1] - note they came inverted! */ data[1] = ~s->state; -#ifdef DAMMIT_ITS_BROKEN - /* DEBUG */ - printk(KERN_DEBUG "s->state %08x data_out %08x\n", s->state, data[1]); -#endif - return insn->n; } -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 29/39] staging: comedi: dyna_pci10xx: convert a KERN_DEBUG message to dev_dbg()
Convert a printk(KERN_DEBUG ... message to dev_dbg(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dyna_pci10xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index f2a9f1c..9b1f196 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -90,8 +90,7 @@ static int dyna_pci10xx_insn_read_ai(struct comedi_device *dev, goto conv_finish; } data[n] = 0; - printk(KERN_DEBUG "comedi: dyna_pci10xx: " - "timeout reading analog input\n"); + dev_dbg(dev->class_dev, "timeout reading analog input\n"); continue; conv_finish: /* mask the first 4 bits - EOC bits */ -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 30/39] staging: comedi: pcmmio: convert a KERN_DEBUG message to dev_dbg()
Convert a printk(KERN_DEBUG ... message to dev_dbg(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcmmio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 6da836e..063496d 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -476,9 +476,9 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d) * TODO here: dispatch io lines to subdevs * with commands.. */ - printk - (KERN_DEBUG "got edge detect interrupt %d asic %d which_chans: %06x\n", -irq, asic, triggered); + dev_dbg(dev->class_dev, + "got edge detect interrupt %d asic %d which_chans: %06x\n", + irq, asic, triggered); for (i = 2; i < dev->n_subdevices; i++) { s = &dev->subdevices[i]; /* -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 28/39] staging: comedi: pcmmio: remove commented out debug code
Remove the commented out code in init_asics() that enables the rising edge interrupts on port0 of both asics. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcmmio.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 1ebc9d2..6da836e 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -357,13 +357,6 @@ static void init_asics(struct comedi_device *dev) outb(0, baseaddr + reg); } - /* DEBUG set rising edge interrupts on port0 of both asics */ - /*switch_page(dev, asic, PAGE_POL); - outb(0xff, baseaddr + REG_POL0); - switch_page(dev, asic, PAGE_ENAB); - outb(0xff, baseaddr + REG_ENAB0); */ - /* END DEBUG */ - /* switch back to default page 0 */ switch_page(dev, asic, 0); } -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 32/39] staging: comedi: dt2814: remove disabled irq probe code
The irq probe code in dt2814_attach() is disabled by an #if 0 block. Just remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2814.c | 26 -- 1 file changed, 26 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index 6514b9e..4b41478 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -256,26 +256,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) i = inb(dev->iobase + DT2814_DATA); irq = it->options[1]; -#if 0 - if (irq < 0) { - save_flags(flags); - sti(); - irqs = probe_irq_on(); - - outb(0, dev->iobase + DT2814_CSR); - - udelay(100); - - irq = probe_irq_off(irqs); - restore_flags(flags); - if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) - printk(KERN_DEBUG "error probing irq (bad)\n"); - - - i = inb(dev->iobase + DT2814_DATA); - i = inb(dev->iobase + DT2814_DATA); - } -#endif dev->irq = 0; if (irq > 0) { if (request_irq(irq, dt2814_interrupt, 0, "dt2814", dev)) { @@ -286,12 +266,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } else if (irq == 0) { printk(KERN_WARNING "(no irq)\n"); - } else { -#if 0 - printk(KERN_DEBUG "(probe returned multiple irqs--bad)\n"); -#else - printk(KERN_WARNING "(irq probe not implemented)\n"); -#endif } ret = comedi_alloc_subdevices(dev, 1); -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 34/39] staging: comedi: dmm32at: remove some unnecessary printk(KERN_DEBUG ...
These debug messages are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dmm32at.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index b04a563..cac8358 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -723,12 +723,6 @@ static int dmm32at_attach(struct comedi_device *dev, intstat = inb(dev->iobase + DMM32AT_INTCLOCK); airback = inb(dev->iobase + DMM32AT_AIRBACK); - printk(KERN_DEBUG "dmm32at: lo=0x%02x hi=0x%02x fifostat=0x%02x\n", - ailo, aihi, fifostat); - printk(KERN_DEBUG - "dmm32at: aistat=0x%02x intstat=0x%02x airback=0x%02x\n", - aistat, intstat, airback); - if ((ailo != 0x00) || (aihi != 0x1f) || (fifostat != 0x80) || (aistat != 0x60 || (intstat != 0x00) || airback != 0x0c)) { printk(KERN_ERR "dmmat32: board detection failed\n"); -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 35/39] staging: comedi: ni_mio_common: remove unused NI_CS5529_DEBUG code
The code blocked by #ifdef NI_CS5529_DEBUG is not used by the driver. Just remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 30 -- 1 file changed, 30 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 866e993..f44013c 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -318,10 +318,6 @@ static int cs5529_do_conversion(struct comedi_device *dev, static int cs5529_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -#ifdef NI_CS5529_DEBUG -static unsigned int cs5529_config_read(struct comedi_device *dev, - unsigned int reg_select_bits); -#endif static void cs5529_config_write(struct comedi_device *dev, unsigned int value, unsigned int reg_select_bits); @@ -5856,25 +5852,6 @@ static void cs5529_config_write(struct comedi_device *dev, unsigned int value, comedi_error(dev, "time or signal in cs5529_config_write()"); } -#ifdef NI_CS5529_DEBUG -/* read from cs5529 register */ -static unsigned int cs5529_config_read(struct comedi_device *dev, - unsigned int reg_select_bits) -{ - unsigned int value; - - reg_select_bits &= CSCMD_REGISTER_SELECT_MASK; - cs5529_command(dev, CSCMD_COMMAND | CSCMD_READ | reg_select_bits); - if (cs5529_wait_for_idle(dev)) - comedi_error(dev, "timeout or signal in cs5529_config_read()"); - value = (ni_ao_win_inw(dev, - CAL_ADC_Config_Data_High_Word_67xx) << 16) & - 0xff; - value |= ni_ao_win_inw(dev, CAL_ADC_Config_Data_Low_Word_67xx) & 0x; - return value; -} -#endif - static int cs5529_do_conversion(struct comedi_device *dev, unsigned short *data) { int retval; @@ -5951,12 +5928,5 @@ static int init_cs5529(struct comedi_device *dev) if (cs5529_wait_for_idle(dev)) comedi_error(dev, "timeout or signal in init_cs5529()\n"); #endif -#ifdef NI_CS5529_DEBUG - printk("config: 0x%x\n", cs5529_config_read(dev, - CSCMD_CONFIG_REGISTER)); - printk("gain: 0x%x\n", cs5529_config_read(dev, CSCMD_GAIN_REGISTER)); - printk("offset: 0x%x\n", cs5529_config_read(dev, - CSCMD_OFFSET_REGISTER)); -#endif return 0; } -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 36/39] staging: comedi: ni_mio_common: remove DEBUG_DIO messages
Defining DEBUG_DIO simply enables some function trace messages. These are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 22 ++ 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index f44013c..4bf0ef2 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3798,10 +3798,6 @@ static int ni_serial_insn_config(struct comedi_device *dev, switch (data[0]) { case INSN_CONFIG_SERIAL_CLOCK: - -#ifdef DEBUG_DIO - printk("SPI serial clock Config cd\n", data[1]); -#endif devpriv->serial_hw_mode = 1; devpriv->dio_control |= DIO_HW_Serial_Enable; @@ -3890,10 +3886,6 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, unsigned int status1; int err = 0, count = 20; -#ifdef DEBUG_DIO - printk("ni_serial_hw_readwrite8: outputting 0x%x\n", data_out); -#endif - devpriv->dio_output &= ~DIO_Serial_Data_Mask; devpriv->dio_output |= DIO_Serial_Data_Out(data_out); devpriv->stc_writew(dev, devpriv->dio_output, DIO_Output_Register); @@ -3927,12 +3919,8 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, DIO_Serial_IO_In_Progress_St goes high one bit too early. */ udelay((devpriv->serial_interval_ns + 999) / 1000); - if (data_in != NULL) { + if (data_in != NULL) *data_in = devpriv->stc_readw(dev, DIO_Serial_Input_Register); -#ifdef DEBUG_DIO - printk("ni_serial_hw_readwrite8: inputted 0x%x\n", *data_in); -#endif - } Error: devpriv->stc_writew(dev, devpriv->dio_control, DIO_Control_Register); @@ -3948,10 +3936,6 @@ static int ni_serial_sw_readwrite8(struct comedi_device *dev, struct ni_private *devpriv = dev->private; unsigned char mask, input = 0; -#ifdef DEBUG_DIO - printk("ni_serial_sw_readwrite8: outputting 0x%x\n", data_out); -#endif - /* Wait for one bit before transfer */ udelay((devpriv->serial_interval_ns + 999) / 1000); @@ -3988,9 +3972,7 @@ static int ni_serial_sw_readwrite8(struct comedi_device *dev, input |= mask; } } -#ifdef DEBUG_DIO - printk("ni_serial_sw_readwrite8: inputted 0x%x\n", input); -#endif + if (data_in) *data_in = input; -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 37/39] staging: comedi: ni_mio_common: remove DEBUG_STATUS_B messages
Defining DEBUG_STATUS_B enables dumping of a status register during the interrupt. These messages are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 29 -- 1 file changed, 29 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 4bf0ef2..1ae8f97 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -54,7 +54,6 @@ /* #define DEBUG_INTERRUPT */ /* #define DEBUG_STATUS_A */ -/* #define DEBUG_STATUS_B */ #include #include @@ -267,11 +266,6 @@ static void ni_mio_print_status_a(int status); #else #define ni_mio_print_status_a(a) #endif -#ifdef DEBUG_STATUS_B -static void ni_mio_print_status_b(int status); -#else -#define ni_mio_print_status_b(a) -#endif static int ni_ai_reset(struct comedi_device *dev, struct comedi_subdevice *s); #ifndef PCIDMA @@ -1176,7 +1170,6 @@ static void handle_b_interrupt(struct comedi_device *dev, #ifdef DEBUG_INTERRUPT printk("ni_mio_common: interrupt: b_status=%04x m1_status=%08x\n", b_status, ao_mite_status); - ni_mio_print_status_b(b_status); #endif #ifdef PCIDMA @@ -1247,28 +1240,6 @@ static void ni_mio_print_status_a(int status) } #endif -#ifdef DEBUG_STATUS_B -static const char *const status_b_strings[] = { - "passthru1", "fifo", "G1_gate", "G1_TC", - "UI2_TC", "UPDATE", "UC_TC", "BC_TC", - "start1", "overrun", "start", "bc_tc_error", - "fifo_empty", "fifo_half_full", "fifo_full", "interrupt_b" -}; - -static void ni_mio_print_status_b(int status) -{ - int i; - - printk("B status:"); - for (i = 15; i >= 0; i--) { - if (status & (1 << i)) { - printk(" %s", status_b_strings[i]); - } - } - printk("\n"); -} -#endif - #ifndef PCIDMA static void ni_ao_fifo_load(struct comedi_device *dev, -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 39/39] staging: comedi: ni_mio_common: remove DEBUG_INTERRUPT messages
Defining DEBUG_INTERRUPT enables some function trace messages during the interrupt. These messages are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 24 1 file changed, 24 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 2ca37b6..65db6ad 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -52,8 +52,6 @@ fully tested as yet. Terry Barnaby, BEAM Ltd. */ -/* #define DEBUG_INTERRUPT */ - #include #include #include @@ -1029,11 +1027,6 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status, if (s->type == COMEDI_SUBD_UNUSED) return; -#ifdef DEBUG_INTERRUPT - printk - ("ni_mio_common: interrupt: a_status=%04x ai_mite_status=%08x\n", -status, ai_mite_status); -#endif #ifdef PCIDMA if (ai_mite_status & CHSR_LINKC) { ni_sync_ai_dma(dev); @@ -1081,9 +1074,6 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status, return; } if (status & AI_SC_TC_St) { -#ifdef DEBUG_INTERRUPT - printk("ni_mio_common: SC_TC interrupt\n"); -#endif if (!devpriv->ai_continuous) { shutdown_ai_command(dev); } @@ -1110,15 +1100,6 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status, } ni_event(dev, s); - -#ifdef DEBUG_INTERRUPT - status = devpriv->stc_readw(dev, AI_Status_1_Register); - if (status & Interrupt_A_St) { - printk - ("handle_a_interrupt: didn't clear interrupt? status=0x%x\n", -status); - } -#endif } static void ack_b_interrupt(struct comedi_device *dev, unsigned short b_status) @@ -1158,11 +1139,6 @@ static void handle_b_interrupt(struct comedi_device *dev, struct comedi_subdevice *s = &dev->subdevices[NI_AO_SUBDEV]; /* unsigned short ack=0; */ -#ifdef DEBUG_INTERRUPT - printk("ni_mio_common: interrupt: b_status=%04x m1_status=%08x\n", - b_status, ao_mite_status); -#endif - #ifdef PCIDMA /* Currently, mite.c requires us to handle LINKC */ if (ao_mite_status & CHSR_LINKC) { -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 31/39] staging: comedi: c6xdigio: remove unnecessary c6xdigio_pwmo_insn_read()
The pwm subdevice in this driver sets the subdev_flags to SDF_WRITEABLE so the s->insn_read callback is not needed. Since this callback simply outputs a printk(KERN_DEBUG ... message jsut remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/c6xdigio.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/c6xdigio.c b/drivers/staging/comedi/drivers/c6xdigio.c index 217aa19c..a85b949 100644 --- a/drivers/staging/comedi/drivers/c6xdigio.c +++ b/drivers/staging/comedi/drivers/c6xdigio.c @@ -322,14 +322,6 @@ static void C6X_encResetAll(unsigned long baseAddr) } } -static int c6xdigio_pwmo_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - printk(KERN_DEBUG "c6xdigio_pwmo_insn_read %x\n", insn->n); - return insn->n; -} - static int c6xdigio_pwmo_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -426,7 +418,6 @@ static int c6xdigio_attach(struct comedi_device *dev, s->subdev_flags = SDF_WRITEABLE; s->n_chan = 2; /* s->trig[0] = c6xdigio_pwmo; */ - s->insn_read = c6xdigio_pwmo_insn_read; s->insn_write = c6xdigio_pwmo_insn_write; s->maxdata = 500; s->range_table = &range_bipolar10; /* A suitable lie */ -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/39] staging: comedi: comedi_fops: remove use of DPRINTK
Use dev_dbg(), or pr_debug() when dev is not valid, instead of the DPRINTK macro to output the comedi debugging information. Remove the debug messages for allocation failures. The failure will have already generated a message. Reword the messages that include the dev->minor number. This number will already be displayed as part of the dev_dbg() output. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 122 --- 1 file changed, 69 insertions(+), 53 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index bbfad96..0d78062 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -221,11 +221,13 @@ static int resize_async_buffer(struct comedi_device *dev, return -EPERM; if (s->busy) { - DPRINTK("subdevice is busy, cannot resize buffer\n"); + dev_dbg(dev->class_dev, + "subdevice is busy, cannot resize buffer\n"); return -EBUSY; } if (async->mmap_count) { - DPRINTK("subdevice is mmapped, cannot resize buffer\n"); + dev_dbg(dev->class_dev, + "subdevice is mmapped, cannot resize buffer\n"); return -EBUSY; } @@ -243,8 +245,8 @@ static int resize_async_buffer(struct comedi_device *dev, return retval; } - DPRINTK("comedi%i subd %d buffer resized to %i bytes\n", - dev->minor, s->index, async->prealloc_bufsz); + dev_dbg(dev->class_dev,"subd %d buffer resized to %i bytes\n", + s->index, async->prealloc_bufsz); return 0; } @@ -673,7 +675,8 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, async = s->async; if (!async) { - DPRINTK("subdevice does not have async capability\n"); + dev_dbg(dev->class_dev, + "subdevice does not have async capability\n"); bc.size = 0; bc.maximum_size = 0; goto copyback; @@ -920,7 +923,8 @@ static int do_bufinfo_ioctl(struct comedi_device *dev, async = s->async; if (!async) { - DPRINTK("subdevice does not have async capability\n"); + dev_dbg(dev->class_dev, + "subdevice does not have async capability\n"); bi.buf_write_ptr = 0; bi.buf_read_ptr = 0; bi.buf_write_count = 0; @@ -1072,19 +1076,20 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn, break; } if (insn->subdev >= dev->n_subdevices) { - DPRINTK("%d not usable subdevice\n", + dev_dbg(dev->class_dev, + "%d not usable subdevice\n", insn->subdev); ret = -EINVAL; break; } s = &dev->subdevices[insn->subdev]; if (!s->async) { - DPRINTK("no async\n"); + dev_dbg(dev->class_dev, "no async\n"); ret = -EINVAL; break; } if (!s->async->inttrig) { - DPRINTK("no inttrig\n"); + dev_dbg(dev->class_dev, "no inttrig\n"); ret = -EAGAIN; break; } @@ -1093,7 +1098,7 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn, ret = 1; break; default: - DPRINTK("invalid insn\n"); + dev_dbg(dev->class_dev, "invalid insn\n"); ret = -EINVAL; break; } @@ -1102,21 +1107,23 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int maxdata; if (insn->subdev >= dev->n_subdevices) { - DPRINTK("subdevice %d out of range\n", insn->subdev); + dev_dbg(dev->class_dev, "subdevice %d out of range\n", + insn->subdev); ret = -EINVAL; goto out; } s = &dev->subdevices[insn->subdev]; if (s->type == COMEDI_SUBD_UNUSED) { - DPRINTK("%d not usable subdevice\n", insn->subdev); + dev_dbg(dev->class_dev, "%d not usable subdevice\n", +
[PATCH 24/39] staging: comedi: ni_at_a2150: remove A2150_DEBUG
The A2150_DEBUG define enables some development messages, specifically the ni_dum_regs() function. These messages are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_at_a2150.c | 25 - 1 file changed, 25 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c index 63c8479..cc69dde 100644 --- a/drivers/staging/comedi/drivers/ni_at_a2150.c +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c @@ -74,9 +74,6 @@ TRIG_WAKE_EOS #define A2150_SIZE 28 #define A2150_DMA_BUFFER_SIZE 0xff00 /* size in bytes of dma buffer */ -/* #define A2150_DEBUG enable debugging code */ -#undef A2150_DEBUG /* disable debugging code */ - /* Registers and bits */ #define CONFIG_REG 0x0 #define CHANNEL_BITS(x) ((x) & 0x7) @@ -167,19 +164,6 @@ static int a2150_get_timing(struct comedi_device *dev, unsigned int *period, static int a2150_set_chanlist(struct comedi_device *dev, unsigned int start_channel, unsigned int num_channels); -#ifdef A2150_DEBUG - -static void ni_dump_regs(struct comedi_device *dev) -{ - struct a2150_private *devpriv = dev->private; - - printk("config bits 0x%x\n", devpriv->config_bits); - printk("irq dma bits 0x%x\n", devpriv->irq_dma_bits); - printk("status bits 0x%x\n", inw(dev->iobase + STATUS_REG)); -} - -#endif - /* interrupt service routine */ static irqreturn_t a2150_interrupt(int irq, void *d) { @@ -506,9 +490,6 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* start acquisition for soft trigger */ if (cmd->start_src == TRIG_NOW) outw(0, dev->iobase + FIFO_START_REG); -#ifdef A2150_DEBUG - ni_dump_regs(dev); -#endif return 0; } @@ -573,13 +554,7 @@ static int a2150_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, comedi_error(dev, "timeout"); return -ETIME; } -#ifdef A2150_DEBUG - ni_dump_regs(dev); -#endif data[n] = inw(dev->iobase + FIFO_DATA_REG); -#ifdef A2150_DEBUG - printk(" data is %i\n", data[n]); -#endif data[n] ^= 0x8000; } -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/39] staging: comedi: dt282x: remove DEBUG define
This define is not used by the driver. Just remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/fl512.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/fl512.c b/drivers/staging/comedi/drivers/fl512.c index e3ff4c4..aff1e7d 100644 --- a/drivers/staging/comedi/drivers/fl512.c +++ b/drivers/staging/comedi/drivers/fl512.c @@ -16,8 +16,6 @@ Configuration options: [0] - I/O port base address */ -#define DEBUG 0 - #include #include "../comedidev.h" -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/39] staging: comedi: ni_pcidio: remove DEBUG_FLAGS define and code
The DEBUG_FLAGS define enables some development code that outputs interrupt flags and status information in the interrupt handler. This information is just added noise. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcidio.c | 60 -- 1 file changed, 60 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 75da358..c04ec29 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -47,7 +47,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org */ #define USE_DMA -/* #define DEBUG_FLAGS */ #include #include @@ -311,14 +310,6 @@ static int ni_pcidio_ns_to_timer(int *nanosec, int round_mode); static int setup_mite_dma(struct comedi_device *dev, struct comedi_subdevice *s); -#ifdef DEBUG_FLAGS -static void ni_pcidio_print_flags(unsigned int flags); -static void ni_pcidio_print_status(unsigned int status); -#else -#define ni_pcidio_print_flags(x) -#define ni_pcidio_print_status(x) -#endif - static int ni_pcidio_request_di_mite_channel(struct comedi_device *dev) { struct nidio96_private *devpriv = dev->private; @@ -421,8 +412,6 @@ static irqreturn_t nidio_interrupt(int irq, void *d) DPRINTK("ni_pcidio_interrupt: status=0x%02x,flags=0x%02x\n", status, flags); - ni_pcidio_print_flags(flags); - ni_pcidio_print_status(status); spin_lock(&devpriv->mite_channel_lock); if (devpriv->di_mite_chan) @@ -488,8 +477,6 @@ static irqreturn_t nidio_interrupt(int irq, void *d) async->buf_int_count); */ /* DPRINTK("1) IntEn=%d,flags=%d,status=%d\n", IntEn,flags,status); */ - /* ni_pcidio_print_flags(flags); */ - /* ni_pcidio_print_status(status); */ async->events |= COMEDI_CB_BLOCK; } @@ -536,8 +523,6 @@ static irqreturn_t nidio_interrupt(int irq, void *d) Interrupt_And_Window_Status); /* DPRINTK("loop end: IntEn=0x%02x,flags=0x%02x," "status=0x%02x\n", IntEn, flags, status); */ - /* ni_pcidio_print_flags(flags); */ - /* ni_pcidio_print_status(status); */ } out: @@ -554,51 +539,6 @@ out: return IRQ_HANDLED; } -#ifdef DEBUG_FLAGS -static const char *bit_set_string(unsigned int bits, unsigned int bit, - const char *const strings[]) -{ - return (bits & (1U << bit)) ? strings[bit] : ""; -} - -static const char *const flags_strings[] = { - " TransferReady", " CountExpired", " 2", " 3", - " 4", " Waited", " PrimaryTC", " SecondaryTC", -}; - - -static void ni_pcidio_print_flags(unsigned int flags) -{ - pr_debug("group_1_flags:%s%s%s%s%s%s%s%s\n", -bit_set_string(flags, 7, flags_strings), -bit_set_string(flags, 6, flags_strings), -bit_set_string(flags, 5, flags_strings), -bit_set_string(flags, 4, flags_strings), -bit_set_string(flags, 3, flags_strings), -bit_set_string(flags, 2, flags_strings), -bit_set_string(flags, 1, flags_strings), -bit_set_string(flags, 0, flags_strings)); -} - -static const char *const status_strings[] = { - " DataLeft1", " Reserved1", " Req1", " StopTrig1", - " DataLeft2", " Reserved2", " Req2", " StopTrig2", -}; - -static void ni_pcidio_print_status(unsigned int flags) -{ - pr_debug("group_status:%s%s%s%s%s%s%s%s\n", -bit_set_string(flags, 7, status_strings), -bit_set_string(flags, 6, status_strings), -bit_set_string(flags, 5, status_strings), -bit_set_string(flags, 4, status_strings), -bit_set_string(flags, 3, status_strings), -bit_set_string(flags, 2, status_strings), -bit_set_string(flags, 1, status_strings), -bit_set_string(flags, 0, status_strings)); -} -#endif - #ifdef unused static void debug_int(struct comedi_device *dev) { -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/39] staging: comedi: ni_pcidio: remove use of DPRINTK
Remove the DPRINTK messages that are just function trace noise. Use dev_dbg() instead of the DPRINTK macro to output the comedi debugging information. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcidio.c | 34 ++ 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 933aabe..b2af280 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -410,9 +410,6 @@ static irqreturn_t nidio_interrupt(int irq, void *d) Interrupt_And_Window_Status); flags = readb(devpriv->mite->daq_io_addr + Group_1_Flags); - DPRINTK("ni_pcidio_interrupt: status=0x%02x,flags=0x%02x\n", - status, flags); - spin_lock(&devpriv->mite_channel_lock); if (devpriv->di_mite_chan) m_status = mite_get_status(devpriv->di_mite_chan); @@ -431,7 +428,8 @@ static irqreturn_t nidio_interrupt(int irq, void *d) } if (m_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_DRDY | CHSR_DRQ1 | CHSR_MRDY)) { - DPRINTK("unknown mite interrupt, disabling IRQ\n"); + dev_dbg(dev->class_dev, + "unknown mite interrupt, disabling IRQ\n"); async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; disable_irq(dev->irq); } @@ -441,7 +439,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d) while (status & DataLeft) { work++; if (work > 20) { - DPRINTK("too much work in interrupt\n"); + dev_dbg(dev->class_dev, "too much work in interrupt\n"); writeb(0x00, devpriv->mite->daq_io_addr + Master_DMA_And_Interrupt_Control); @@ -451,11 +449,11 @@ static irqreturn_t nidio_interrupt(int irq, void *d) flags &= IntEn; if (flags & TransferReady) { - /* DPRINTK("TransferReady\n"); */ while (flags & TransferReady) { work++; if (work > 100) { - DPRINTK("too much work in interrupt\n"); + dev_dbg(dev->class_dev, + "too much work in interrupt\n"); writeb(0x00, devpriv->mite->daq_io_addr + Master_DMA_And_Interrupt_Control @@ -469,19 +467,13 @@ static irqreturn_t nidio_interrupt(int irq, void *d) data2 = (auxdata & 0x) >> 16; comedi_buf_put(async, data1); comedi_buf_put(async, data2); - /* DPRINTK("read:%d, %d\n",data1,data2); */ flags = readb(devpriv->mite->daq_io_addr + Group_1_Flags); } - /* DPRINTK("buf_int_count: %d\n", - async->buf_int_count); */ - /* DPRINTK("1) IntEn=%d,flags=%d,status=%d\n", - IntEn,flags,status); */ async->events |= COMEDI_CB_BLOCK; } if (flags & CountExpired) { - DPRINTK("CountExpired\n"); writeb(ClearExpired, devpriv->mite->daq_io_addr + Group_1_Second_Clear); @@ -490,39 +482,26 @@ static irqreturn_t nidio_interrupt(int irq, void *d) writeb(0x00, devpriv->mite->daq_io_addr + OpMode); break; } else if (flags & Waited) { - DPRINTK("Waited\n"); writeb(ClearWaited, devpriv->mite->daq_io_addr + Group_1_First_Clear); async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; break; } else if (flags & PrimaryTC) { - DPRINTK("PrimaryTC\n"); writeb(ClearPrimaryTC, devpriv->mite->daq_io_addr + Group_1_First_Clear); async->events |= COMEDI_CB_EOA; } else if (flags & SecondaryTC) { - DPRINTK("SecondaryTC\n"); writeb(ClearSecondaryTC, devpriv->mite
staging: comedi: cleanup debugging support
Currently the COMEDI_DEBUG option enables the comedi_debug module parameter as well as a DPRINTK() macro. To actually get debug messages to display the kernel still needs to be built with the -DDEBUG flag. Cleanup all the custom uses of DEBUG in comedi and use the COMEDI_DEBUG option to enable the ccflag -DDEBUG in the comedi subsystem. Remove all uses of the DPRINTK macro and just use dev_dbg() or pr_debug() instead. Remove any debug messages that are just added noise. Tidy up all the private debugging implementations in the comedi drivers. H Hartley Sweeten (39): staging: comedi: das6402: remove DEBUG noise staging: comedi: pcl816: remove DEBUG macro staging: comedi: dt282x: remove DEBUG define staging: comedi: dt282x: remove DEBUG define staging: comedi: ni_pcidio: remove custom DPRINTK macro staging: comedi: ni_pcidio: remove DEBUG and DEBUG_FLAGS defines staging: comedi: ni_pcidio: remove DEBUG define staging: comedi: dt3000: remove DEBUG define staging: comedi: remove comedi_debug module parameter staging: comedi: range: remove use of DPRINTK staging: comedi: pcl816: remove use of DPRINTK staging: comedi: amplc_pci224: remove use of DPRINTK staging: comedi: amplc_pci230: remove use of DPRINTK staging: comedi: dt2801: remove use of DPRINTK staging: comedi: comedi_fops: remove use of DPRINTK staging: comedi: ni_pcidio: remove DEBUG_FLAGS define and code staging: comedi: ni_pcidio: remove debug_int() staging: comedi: ni_pcidio: remove use of DPRINTK staging: comedi: remove DPRINTK macro staging: comedi: mite: remove MDPRINTK macro staging: comedi: mite: remove DEBUG_MITE code staging: comedi: cb_pcidas64: remove DEBUG_PRINT staging: comedi: gsc_hpdi: remove DEBUG_PRINT staging: comedi: ni_at_a2150: remove A2150_DEBUG staging: comedi: cb_pcimdas: remove CBPCIMDAS_DEBUG staging: comedi: ni_pcimio: remove PCI_DEBUG staging: comedi: pcmmio: remove DAMMIT_ITS_BROKEN debug staging: comedi: pcmmio: remove commented out debug code staging: comedi: dyna_pci10xx: convert a KERN_DEBUG message to dev_dbg() staging: comedi: pcmmio: convert a KERN_DEBUG message to dev_dbg() staging: comedi: c6xdigio: remove unnecessary c6xdigio_pwmo_insn_read() staging: comedi: dt2814: remove disabled irq probe code staging: comedi: pcl818: remove an unnecessary printk(KERN_DEBUG ... staging: comedi: dmm32at: remove some unnecessary printk(KERN_DEBUG ... staging: comedi: ni_mio_common: remove unused NI_CS5529_DEBUG code staging: comedi: ni_mio_common: remove DEBUG_DIO messages staging: comedi: ni_mio_common: remove DEBUG_STATUS_B messages staging: comedi: ni_mio_common: remove DEBUG_STATUS_A messages staging: comedi: ni_mio_common: remove DEBUG_INTERRUPT messages drivers/staging/comedi/Makefile| 2 + drivers/staging/comedi/comedi_fops.c | 133 +++-- drivers/staging/comedi/comedidev.h | 11 -- drivers/staging/comedi/drivers/Makefile| 1 + drivers/staging/comedi/drivers/amplc_pci224.c | 14 +-- drivers/staging/comedi/drivers/amplc_pci230.c | 52 drivers/staging/comedi/drivers/c6xdigio.c | 9 -- drivers/staging/comedi/drivers/cb_pcidas64.c | 126 +--- drivers/staging/comedi/drivers/cb_pcimdas.c| 3 - drivers/staging/comedi/drivers/das6402.c | 9 -- drivers/staging/comedi/drivers/dmm32at.c | 6 - drivers/staging/comedi/drivers/dt2801.c| 9 -- drivers/staging/comedi/drivers/dt2814.c| 26 drivers/staging/comedi/drivers/dt282x.c| 10 -- drivers/staging/comedi/drivers/dt3000.c| 23 drivers/staging/comedi/drivers/dyna_pci10xx.c | 3 +- drivers/staging/comedi/drivers/fl512.c | 2 - drivers/staging/comedi/drivers/gsc_hpdi.c | 78 drivers/staging/comedi/drivers/mite.c | 143 -- drivers/staging/comedi/drivers/mite.h | 12 -- drivers/staging/comedi/drivers/ni_65xx.c | 3 - drivers/staging/comedi/drivers/ni_at_a2150.c | 25 drivers/staging/comedi/drivers/ni_atmio.c | 15 --- drivers/staging/comedi/drivers/ni_mio_common.c | 157+ drivers/staging/comedi/drivers/ni_mio_cs.c | 2 - drivers/staging/comedi/drivers/ni_pcidio.c | 137 + drivers/staging/comedi/drivers/ni_pcimio.c | 2 - drivers/staging/comedi/drivers/pcl816.c| 46 +--- drivers/staging/comedi/drivers/pcl818.c| 2 - drivers/staging/comedi/drivers/pcmmio.c| 35 +- drivers/staging/comedi/kcomedilib/Makefile | 2 + drivers/staging/comedi/range.c | 9 +- 32 files changed, 130 insertions(+), 977 deletions(-) -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/39] staging: comedi: dt2801: remove use of DPRINTK
The DPRINTK messages in this driver are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2801.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index 811c8c5..1dd8190 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -359,17 +359,12 @@ static int dt2801_reset(struct comedi_device *dev) unsigned int stat; int timeout; - DPRINTK("dt2801: resetting board...\n"); - DPRINTK("fingerprint: 0x%02x 0x%02x\n", inb_p(dev->iobase), - inb_p(dev->iobase + 1)); - /* pull random data from data port */ inb_p(dev->iobase + DT2801_DATA); inb_p(dev->iobase + DT2801_DATA); inb_p(dev->iobase + DT2801_DATA); inb_p(dev->iobase + DT2801_DATA); - DPRINTK("dt2801: stop\n"); /* dt2801_writecmd(dev,DT_C_STOP); */ outb_p(DT_C_STOP, dev->iobase + DT2801_CMD); @@ -387,7 +382,6 @@ static int dt2801_reset(struct comedi_device *dev) /* printk("dt2801: reading dummy\n"); */ /* dt2801_readdata(dev,&board_code); */ - DPRINTK("dt2801: reset\n"); outb_p(DT_C_RESET, dev->iobase + DT2801_CMD); /* dt2801_writecmd(dev,DT_C_RESET); */ @@ -401,11 +395,8 @@ static int dt2801_reset(struct comedi_device *dev) if (!timeout) printk("dt2801: timeout 2 status=0x%02x\n", stat); - DPRINTK("dt2801: reading code\n"); dt2801_readdata(dev, &board_code); - DPRINTK("dt2801: ok. code=0x%02x\n", board_code); - return board_code; } -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 33/39] staging: comedi: pcl818: remove an unnecessary printk(KERN_DEBUG ...
This debug message is just added noise. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl818.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 9e4d7e8..467a9dd 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -1257,8 +1257,6 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) (", unable to allocate IRQ %u, DISABLING IT", irq); irq = 0;/* Can't use IRQ */ - } else { - printk(KERN_DEBUG "irq=%u", irq); } } } -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 19/39] staging: comedi: remove DPRINTK macro
All users of this macro have been converted to use dev_dbg(). Remove the unused macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/comedidev.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 6dda30e..9ad4cfd 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -23,8 +23,6 @@ #include "comedi.h" -#define DPRINTK(format, args...) pr_debug("comedi: " format, ## args); - #define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) #define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, \ COMEDI_MINORVERSION, COMEDI_MICROVERSION) -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 38/39] staging: comedi: ni_mio_common: remove DEBUG_STATUS_A messages
Defining DEBUG_STATUS_A enables dumping of a status register during the interrupt. These messages are just added noise. Remove them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 31 -- 1 file changed, 31 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 1ae8f97..2ca37b6 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -53,7 +53,6 @@ */ /* #define DEBUG_INTERRUPT */ -/* #define DEBUG_STATUS_A */ #include #include @@ -261,12 +260,6 @@ static int ni_rtsi_insn_config(struct comedi_device *dev, static void caldac_setup(struct comedi_device *dev, struct comedi_subdevice *s); static int ni_read_eeprom(struct comedi_device *dev, int addr); -#ifdef DEBUG_STATUS_A -static void ni_mio_print_status_a(int status); -#else -#define ni_mio_print_status_a(a) -#endif - static int ni_ai_reset(struct comedi_device *dev, struct comedi_subdevice *s); #ifndef PCIDMA static void ni_handle_fifo_half_full(struct comedi_device *dev); @@ -1040,7 +1033,6 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status, printk ("ni_mio_common: interrupt: a_status=%04x ai_mite_status=%08x\n", status, ai_mite_status); - ni_mio_print_status_a(status); #endif #ifdef PCIDMA if (ai_mite_status & CHSR_LINKC) { @@ -1077,7 +1069,6 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status, AI_SC_TC_Error_St)) { printk("ni_mio_common: ai error a_status=%04x\n", status); - ni_mio_print_status_a(status); shutdown_ai_command(dev); @@ -1218,28 +1209,6 @@ static void handle_b_interrupt(struct comedi_device *dev, ni_event(dev, s); } -#ifdef DEBUG_STATUS_A -static const char *const status_a_strings[] = { - "passthru0", "fifo", "G0_gate", "G0_TC", - "stop", "start", "sc_tc", "start1", - "start2", "sc_tc_error", "overflow", "overrun", - "fifo_empty", "fifo_half_full", "fifo_full", "interrupt_a" -}; - -static void ni_mio_print_status_a(int status) -{ - int i; - - printk("A status:"); - for (i = 15; i >= 0; i--) { - if (status & (1 << i)) { - printk(" %s", status_a_strings[i]); - } - } - printk("\n"); -} -#endif - #ifndef PCIDMA static void ni_ao_fifo_load(struct comedi_device *dev, -- 1.8.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/8] staging: dwc2: fix potential use after free
dwc2_process_non_isoc_desc() can potentially free the qtd, so null out the qtd pointer if the call fails so we don't try to access it later Signed-off-by: Paul Zimmerman --- drivers/staging/dwc2/hcd_ddma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/dwc2/hcd_ddma.c b/drivers/staging/dwc2/hcd_ddma.c index c7d4345..72e9788 100644 --- a/drivers/staging/dwc2/hcd_ddma.c +++ b/drivers/staging/dwc2/hcd_ddma.c @@ -1103,8 +1103,10 @@ static void dwc2_complete_non_isoc_xfer_ddma(struct dwc2_hsotg *hsotg, for (i = 0; i < qtd->n_desc; i++) { if (dwc2_process_non_isoc_desc(hsotg, chan, chnum, qtd, desc_num, halt_status, - &xfer_done)) + &xfer_done)) { + qtd = NULL; break; + } desc_num++; } } -- 1.8.5.rc3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/8] staging: dwc2: cleanups for DWC2 driver
This is a series of cleanups to the DWC2 driver, in response to Dan Carpenter's review on 11/15/2013. I believe I have addressed all of Dan's suggestions, except for removing the validation checks from the dwc2_set_param_* functions. We depend on the validation checks for setting a default value for each of the parameters, so the checks cannot simply be removed. Paul Zimmerman (8): staging: dwc2: fix some functions to return a proper error code staging: dwc2: fix potential use after free staging: dwc2: rename DWC2_PARAM_TEST to DWC2_OUT_OF_BOUNDS staging: dwc2: make all the dwc2_set_param* functions void staging: dwc2: remove use of NO_FS_PHY_HW_CHECKS macro staging: dwc2: remove useless cast staging: dwc2: rename dwc2_check_core_status() staging: dwc2: remove #ifdef DEBUG from a couple of places drivers/staging/dwc2/core.c | 251 --- drivers/staging/dwc2/core.h | 62 +- drivers/staging/dwc2/core_intr.c | 10 +- drivers/staging/dwc2/hcd.c | 6 +- drivers/staging/dwc2/hcd.h | 4 +- drivers/staging/dwc2/hcd_ddma.c | 4 +- drivers/staging/dwc2/hcd_intr.c | 4 +- drivers/staging/dwc2/hcd_queue.c | 8 +- 8 files changed, 120 insertions(+), 229 deletions(-) -- 1.8.5.rc3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/8] staging: dwc2: rename DWC2_PARAM_TEST to DWC2_OUT_OF_BOUNDS
DWC2_PARAM_TEST is not a very good name for this macro, so rename it to DWC2_OUT_OF_BOUNDS Signed-off-by: Paul Zimmerman --- drivers/staging/dwc2/core.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c index 6d001b5..fc034ba 100644 --- a/drivers/staging/dwc2/core.c +++ b/drivers/staging/dwc2/core.c @@ -1912,7 +1912,7 @@ void dwc2_flush_rx_fifo(struct dwc2_hsotg *hsotg) udelay(1); } -#define DWC2_PARAM_TEST(a, b, c) ((a) < (b) || (a) > (c)) +#define DWC2_OUT_OF_BOUNDS(a, b, c)((a) < (b) || (a) > (c)) /* Parameter access functions */ int dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg, int val) @@ -2026,7 +2026,7 @@ int dwc2_set_param_host_support_fs_ls_low_power(struct dwc2_hsotg *hsotg, { int retval = 0; - if (DWC2_PARAM_TEST(val, 0, 1)) { + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for host_support_fs_low_power\n"); @@ -2209,8 +2209,8 @@ int dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val) #endif int retval = 0; - if (DWC2_PARAM_TEST(val, DWC2_PHY_TYPE_PARAM_FS, - DWC2_PHY_TYPE_PARAM_ULPI)) { + if (DWC2_OUT_OF_BOUNDS(val, DWC2_PHY_TYPE_PARAM_FS, + DWC2_PHY_TYPE_PARAM_ULPI)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for phy_type\n"); dev_err(hsotg->dev, "phy_type must be 0, 1 or 2\n"); @@ -2272,7 +2272,7 @@ int dwc2_set_param_speed(struct dwc2_hsotg *hsotg, int val) int valid = 1; int retval = 0; - if (DWC2_PARAM_TEST(val, 0, 1)) { + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for speed parameter\n"); dev_err(hsotg->dev, "max_speed parameter must be 0 or 1\n"); @@ -2304,8 +2304,8 @@ int dwc2_set_param_host_ls_low_power_phy_clk(struct dwc2_hsotg *hsotg, int val) int valid = 1; int retval = 0; - if (DWC2_PARAM_TEST(val, DWC2_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ, - DWC2_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ)) { + if (DWC2_OUT_OF_BOUNDS(val, DWC2_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ, + DWC2_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for host_ls_low_power_phy_clk parameter\n"); @@ -2340,7 +2340,7 @@ int dwc2_set_param_phy_ulpi_ddr(struct dwc2_hsotg *hsotg, int val) { int retval = 0; - if (DWC2_PARAM_TEST(val, 0, 1)) { + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for phy_ulpi_ddr\n"); dev_err(hsotg->dev, "phy_upli_ddr must be 0 or 1\n"); @@ -2358,7 +2358,7 @@ int dwc2_set_param_phy_ulpi_ext_vbus(struct dwc2_hsotg *hsotg, int val) { int retval = 0; - if (DWC2_PARAM_TEST(val, 0, 1)) { + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for phy_ulpi_ext_vbus\n"); @@ -2411,7 +2411,7 @@ int dwc2_set_param_ulpi_fs_ls(struct dwc2_hsotg *hsotg, int val) { int retval = 0; - if (DWC2_PARAM_TEST(val, 0, 1)) { + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for ulpi_fs_ls\n"); dev_err(hsotg->dev, "ulpi_fs_ls must be 0 or 1\n"); @@ -2429,7 +2429,7 @@ int dwc2_set_param_ts_dline(struct dwc2_hsotg *hsotg, int val) { int retval = 0; - if (DWC2_PARAM_TEST(val, 0, 1)) { + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for ts_dline\n"); dev_err(hsotg->dev, "ts_dline must be 0 or 1\n"); @@ -2450,7 +2450,7 @@ int dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val) #endif int retval = 0; - if (DWC2_PARAM_TEST(val, 0, 1)) { + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for i2c_enable\n"); dev_err(hsotg->dev, "i2c_enable must be 0 or 1\n"); @@ -2489,7 +2489,7 @@ int dwc2_set_param_en_multiple_tx_fifo(struct dwc2_hsotg *hsotg, int val) int valid = 1; int retval = 0; - if (DWC2_PARAM_TEST(val, 0, 1)) { + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { dev_err(hsotg->dev, "Wrong value for en_multiple_tx_fifo,\n"); @
[PATCH 4/8] staging: dwc2: make all the dwc2_set_param* functions void
We were not checking the return value from any of these functions, so make them void functions Signed-off-by: Paul Zimmerman --- drivers/staging/dwc2/core.c | 193 drivers/staging/dwc2/core.h | 60 +++--- drivers/staging/dwc2/hcd.h | 4 +- 3 files changed, 85 insertions(+), 172 deletions(-) diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c index fc034ba..8597836 100644 --- a/drivers/staging/dwc2/core.c +++ b/drivers/staging/dwc2/core.c @@ -1915,10 +1915,9 @@ void dwc2_flush_rx_fifo(struct dwc2_hsotg *hsotg) #define DWC2_OUT_OF_BOUNDS(a, b, c)((a) < (b) || (a) > (c)) /* Parameter access functions */ -int dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg, int val) +void dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg, int val) { int valid = 1; - int retval = 0; switch (val) { case DWC2_CAP_PARAM_HNP_SRP_CAPABLE: @@ -1964,17 +1963,14 @@ int dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg, int val) break; } dev_dbg(hsotg->dev, "Setting otg_cap to %d\n", val); - retval = -EINVAL; } hsotg->core_params->otg_cap = val; - return retval; } -int dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val) +void dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val) { int valid = 1; - int retval = 0; if (val > 0 && hsotg->hw_params.arch == GHWCFG2_SLAVE_ONLY_ARCH) valid = 0; @@ -1988,17 +1984,14 @@ int dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val) val); val = hsotg->hw_params.arch != GHWCFG2_SLAVE_ONLY_ARCH; dev_dbg(hsotg->dev, "Setting dma_enable to %d\n", val); - retval = -EINVAL; } hsotg->core_params->dma_enable = val; - return retval; } -int dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val) +void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val) { int valid = 1; - int retval = 0; if (val > 0 && (hsotg->core_params->dma_enable <= 0 || !hsotg->hw_params.dma_desc_enable)) @@ -2014,18 +2007,14 @@ int dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val) val = (hsotg->core_params->dma_enable > 0 && hsotg->hw_params.dma_desc_enable); dev_dbg(hsotg->dev, "Setting dma_desc_enable to %d\n", val); - retval = -EINVAL; } hsotg->core_params->dma_desc_enable = val; - return retval; } -int dwc2_set_param_host_support_fs_ls_low_power(struct dwc2_hsotg *hsotg, - int val) +void dwc2_set_param_host_support_fs_ls_low_power(struct dwc2_hsotg *hsotg, +int val) { - int retval = 0; - if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { dev_err(hsotg->dev, @@ -2036,17 +2025,14 @@ int dwc2_set_param_host_support_fs_ls_low_power(struct dwc2_hsotg *hsotg, val = 0; dev_dbg(hsotg->dev, "Setting host_support_fs_low_power to %d\n", val); - retval = -EINVAL; } hsotg->core_params->host_support_fs_ls_low_power = val; - return retval; } -int dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val) +void dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val) { int valid = 1; - int retval = 0; if (val > 0 && !hsotg->hw_params.enable_dynamic_fifo) valid = 0; @@ -2060,17 +2046,14 @@ int dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val) val); val = hsotg->hw_params.enable_dynamic_fifo; dev_dbg(hsotg->dev, "Setting enable_dynamic_fifo to %d\n", val); - retval = -EINVAL; } hsotg->core_params->enable_dynamic_fifo = val; - return retval; } -int dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val) +void dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val) { int valid = 1; - int retval = 0; if (val < 16 || val > hsotg->hw_params.host_rx_fifo_size) valid = 0; @@ -2082,17 +2065,14 @@ int dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val) val); val = hsotg->hw_params.host_rx_fifo_size; dev_dbg(hsotg->dev, "Setting host_rx_fifo_size to %d\n", val); - retval = -EINVAL; } hsotg->core_params->host_rx_fifo_size = val; - return retval; } -int dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val) +void dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg
[PATCH 8/8] staging: dwc2: remove #ifdef DEBUG from a couple of places
Remove #ifdef DEBUG from a couple of places where it is not needed Signed-off-by: Paul Zimmerman --- drivers/staging/dwc2/core_intr.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/dwc2/core_intr.c b/drivers/staging/dwc2/core_intr.c index c78bb5d..8205799 100644 --- a/drivers/staging/dwc2/core_intr.c +++ b/drivers/staging/dwc2/core_intr.c @@ -55,7 +55,6 @@ static const char *dwc2_op_state_str(struct dwc2_hsotg *hsotg) { -#ifdef DEBUG switch (hsotg->op_state) { case OTG_STATE_A_HOST: return "a_host"; @@ -70,9 +69,6 @@ static const char *dwc2_op_state_str(struct dwc2_hsotg *hsotg) default: return "unknown"; } -#else - return ""; -#endif } /** @@ -419,12 +415,10 @@ static u32 dwc2_read_common_intr(struct dwc2_hsotg *hsotg) gintmsk = readl(hsotg->regs + GINTMSK); gahbcfg = readl(hsotg->regs + GAHBCFG); -#ifdef DEBUG /* If any common interrupts set */ if (gintsts & gintmsk_common) dev_dbg(hsotg->dev, "gintsts=%08x gintmsk=%08x\n", gintsts, gintmsk); -#endif if (gahbcfg & GAHBCFG_GLBL_INTR_EN) return gintsts & gintmsk & gintmsk_common; -- 1.8.5.rc3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/8] staging: dwc2: remove useless cast
Remove useless cast in dwc2_get_otg_version() Signed-off-by: Paul Zimmerman --- drivers/staging/dwc2/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c index 6149fbc..5b490a4 100644 --- a/drivers/staging/dwc2/core.c +++ b/drivers/staging/dwc2/core.c @@ -2704,7 +2704,7 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg, u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg) { - return (u16)(hsotg->core_params->otg_ver == 1 ? 0x0200 : 0x0103); + return hsotg->core_params->otg_ver == 1 ? 0x0200 : 0x0103; } int dwc2_check_core_status(struct dwc2_hsotg *hsotg) -- 1.8.5.rc3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 7/8] staging: dwc2: rename dwc2_check_core_status()
Rename dwc2_check_core_status() to dwc2_is_controller_alive(), and make it a boolean function. Also change the message when the controller is dead to say "dead" instead of "disconnected". Signed-off-by: Paul Zimmerman --- drivers/staging/dwc2/core.c | 6 +++--- drivers/staging/dwc2/core.h | 2 +- drivers/staging/dwc2/core_intr.c | 4 ++-- drivers/staging/dwc2/hcd_intr.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c index 5b490a4..3d126ed 100644 --- a/drivers/staging/dwc2/core.c +++ b/drivers/staging/dwc2/core.c @@ -2707,12 +2707,12 @@ u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg) return hsotg->core_params->otg_ver == 1 ? 0x0200 : 0x0103; } -int dwc2_check_core_status(struct dwc2_hsotg *hsotg) +bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg) { if (readl(hsotg->regs + GSNPSID) == 0x) - return -1; + return false; else - return 0; + return true; } /** diff --git a/drivers/staging/dwc2/core.h b/drivers/staging/dwc2/core.h index 6a1c09f..648519c 100644 --- a/drivers/staging/dwc2/core.h +++ b/drivers/staging/dwc2/core.h @@ -544,7 +544,7 @@ extern void dwc2_enable_host_interrupts(struct dwc2_hsotg *hsotg); extern void dwc2_disable_host_interrupts(struct dwc2_hsotg *hsotg); extern u32 dwc2_calc_frame_interval(struct dwc2_hsotg *hsotg); -extern int dwc2_check_core_status(struct dwc2_hsotg *hsotg); +extern bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg); /* * Common core Functions. diff --git a/drivers/staging/dwc2/core_intr.c b/drivers/staging/dwc2/core_intr.c index 07cfa2f..c78bb5d 100644 --- a/drivers/staging/dwc2/core_intr.c +++ b/drivers/staging/dwc2/core_intr.c @@ -451,8 +451,8 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) u32 gintsts; irqreturn_t retval = IRQ_NONE; - if (dwc2_check_core_status(hsotg) < 0) { - dev_warn(hsotg->dev, "Controller is disconnected\n"); + if (!dwc2_is_controller_alive(hsotg)) { + dev_warn(hsotg->dev, "Controller is dead\n"); goto out; } diff --git a/drivers/staging/dwc2/hcd_intr.c b/drivers/staging/dwc2/hcd_intr.c index dda1854..e672e6d 100644 --- a/drivers/staging/dwc2/hcd_intr.c +++ b/drivers/staging/dwc2/hcd_intr.c @@ -2059,8 +2059,8 @@ irqreturn_t dwc2_handle_hcd_intr(struct dwc2_hsotg *hsotg) u32 gintsts, dbg_gintsts; irqreturn_t retval = IRQ_NONE; - if (dwc2_check_core_status(hsotg) < 0) { - dev_warn(hsotg->dev, "Controller is disconnected\n"); + if (!dwc2_is_controller_alive(hsotg) < 0) { + dev_warn(hsotg->dev, "Controller is dead\n"); return retval; } -- 1.8.5.rc3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/8] staging: dwc2: fix some functions to return a proper error code
Fix some functions called by dwc2_hcd_qtd_add() to return either a proper error code or 0, instead of somewhat random values. Then change the caller of dwc2_hcd_qtd_add() to just check the return value for 0. Signed-off-by: Paul Zimmerman --- drivers/staging/dwc2/hcd.c | 6 +++--- drivers/staging/dwc2/hcd_queue.c | 8 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c index 3cfd2d5..24a4efe 100644 --- a/drivers/staging/dwc2/hcd.c +++ b/drivers/staging/dwc2/hcd.c @@ -369,7 +369,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, dwc2_hcd_qtd_init(qtd, urb); retval = dwc2_hcd_qtd_add(hsotg, qtd, (struct dwc2_qh **)ep_handle, mem_flags); - if (retval < 0) { + if (retval) { dev_err(hsotg->dev, "DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n", retval); @@ -378,7 +378,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, } intr_mask = readl(hsotg->regs + GINTMSK); - if (!(intr_mask & GINTSTS_SOF) && retval == 0) { + if (!(intr_mask & GINTSTS_SOF)) { enum dwc2_transaction_type tr_type; if (qtd->qh->ep_type == USB_ENDPOINT_XFER_BULK && @@ -396,7 +396,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, spin_unlock_irqrestore(&hsotg->lock, flags); } - return retval; + return 0; } /* Must be called with interrupt disabled and spinlock held */ diff --git a/drivers/staging/dwc2/hcd_queue.c b/drivers/staging/dwc2/hcd_queue.c index 2f68fbc..729cc0b 100644 --- a/drivers/staging/dwc2/hcd_queue.c +++ b/drivers/staging/dwc2/hcd_queue.c @@ -354,7 +354,7 @@ static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) return i; } } - return -1; + return -ENOSPC; } /* @@ -413,7 +413,7 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) continue; } } - return -1; + return -ENOSPC; } static int dwc2_find_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) @@ -487,12 +487,12 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) frame = status - 1; /* Set the new frame up */ - if (frame > -1) { + if (frame >= 0) { qh->sched_frame &= ~0x7; qh->sched_frame |= (frame & 7); } - if (status != -1) + if (status > 0) status = 0; } else { status = dwc2_periodic_channel_available(hsotg); -- 1.8.5.rc3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/8] staging: dwc2: remove use of NO_FS_PHY_HW_CHECKS macro
NO_FS_PHY_HW_CHECKS is never defined, so remove the conditional code that checks for it being set Signed-off-by: Paul Zimmerman --- drivers/staging/dwc2/core.c | 18 -- 1 file changed, 18 deletions(-) diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c index 8597836..6149fbc 100644 --- a/drivers/staging/dwc2/core.c +++ b/drivers/staging/dwc2/core.c @@ -2169,10 +2169,8 @@ void dwc2_set_param_host_channels(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val) { -#ifndef NO_FS_PHY_HW_CHECKS int valid = 0; u32 hs_phy_type, fs_phy_type; -#endif if (DWC2_OUT_OF_BOUNDS(val, DWC2_PHY_TYPE_PARAM_FS, DWC2_PHY_TYPE_PARAM_ULPI)) { @@ -2181,15 +2179,9 @@ void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val) dev_err(hsotg->dev, "phy_type must be 0, 1 or 2\n"); } -#ifndef NO_FS_PHY_HW_CHECKS valid = 0; -#else - val = DWC2_PHY_TYPE_PARAM_FS; - dev_dbg(hsotg->dev, "Setting phy_type to %d\n", val); -#endif } -#ifndef NO_FS_PHY_HW_CHECKS hs_phy_type = hsotg->hw_params.hs_phy_type; fs_phy_type = hsotg->hw_params.fs_phy_type; if (val == DWC2_PHY_TYPE_PARAM_UTMI && @@ -2219,7 +2211,6 @@ void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val) } dev_dbg(hsotg->dev, "Setting phy_type to %d\n", val); } -#endif hsotg->core_params->phy_type = val; } @@ -2382,9 +2373,7 @@ void dwc2_set_param_ts_dline(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val) { -#ifndef NO_FS_PHY_HW_CHECKS int valid = 1; -#endif if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { if (val >= 0) { @@ -2392,15 +2381,9 @@ void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val) dev_err(hsotg->dev, "i2c_enable must be 0 or 1\n"); } -#ifndef NO_FS_PHY_HW_CHECKS valid = 0; -#else - val = 0; - dev_dbg(hsotg->dev, "Setting i2c_enable to %d\n", val); -#endif } -#ifndef NO_FS_PHY_HW_CHECKS if (val == 1 && !(hsotg->hw_params.i2c_enable)) valid = 0; @@ -2412,7 +2395,6 @@ void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val) val = hsotg->hw_params.i2c_enable; dev_dbg(hsotg->dev, "Setting i2c_enable to %d\n", val); } -#endif hsotg->core_params->i2c_enable = val; } -- 1.8.5.rc3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel