mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Halasa <khc@pm.waw.pl>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.6.0-test2 wanXL driver
Date: 30 Jul 2003 01:09:34 +0200	[thread overview]
Message-ID: <m3u195lykx.fsf@defiant.pm.waw.pl> (raw)
In-Reply-To: <20030730002959.A23749@electric-eye.fr.zoreil.com>

Francois Romieu <romieu@fr.zoreil.com> writes:

> unsigned long timeout = jiffies + HZ;
> 
> do {
> ...
> } while (time_after(timeout, jiffies));

That's the same (my version deals with wraps too) but yes, time_after
looks nicer. I'll change it in next version.


> +	switch (pdev->device) {
> +	case PCI_DEVICE_ID_SBE_WANXL100: ports = 1; break;
> +	case PCI_DEVICE_ID_SBE_WANXL200: ports = 2; break;
> +	default: ports = 4;
> +	}
> 
> You can do it this way:
> static struct pci_device_id wanxl_pci_tbl[] __devinitdata = {
> 	{ PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_SBE_WANXL100, PCI_ANY_ID,
> 	  PCI_ANY_ID, 0, 0, 1 },
>         { PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_SBE_WANXL200, PCI_ANY_ID,
>           PCI_ANY_ID, 0, 0, 2 },
>         { PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_SBE_WANXL400, PCI_ANY_ID,
>           PCI_ANY_ID, 0, 0, 4 },
>         { 0, }
> };
> 
> ports = ent->driver_data;
> 
> (imho turning 1, 2, 4 into #define wouldn't be bad then)

Yes, but I like having the variable local to this function a little more.

> +	while ((stat = readl(card->plx + PLX_MAILBOX_0)) != 0) {
> +		if (jiffies - start >= 20 * HZ) {
> +			printk(KERN_WARNING "wanXL %s: timeout waiting for"
> +			       " PUTS to complete\n", card_name(pdev));
> +			return -ENODEV;
> 
> This return leaks kmalloced card_t *card, pci_requested_regions and
> ioremaped area (same thing for the return a few lines below in the
> same function).

Right. Will fix in next version.

> +	for (i = 0; i < RX_QUEUE_LENGTH; i++) {
> +		struct sk_buff *skb = dev_alloc_skb(BUFFER_LENGTH);
> +		card->rx_skbs[i] = skb;
> +		if (skb)
> +			card->rx_descs[i].address = virt_to_bus(skb->data);
> 
> dma_map_single() is probably preferred over virt_to_bus().

Never heard of it in fact :-)
Will check.

Thanks.
-- 
Krzysztof Halasa
Network Administrator

  reply	other threads:[~2003-07-30 13:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29 20:59 Krzysztof Halasa
2003-07-29 22:29 ` Francois Romieu
2003-07-29 23:09   ` Krzysztof Halasa [this message]
2003-07-30 16:37     ` Francois Romieu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3u195lykx.fsf@defiant.pm.waw.pl \
    --to=khc@pm.waw.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®