From: "Miguel Ángel Álvarez" <gotzoncabanes@gmail.com>
To: netdev@vger.kernel.org, "Krzysztof Halasa" <khc@pm.waw.pl>
Subject: ixp4xx_hss: Little improvement in create_chan function
Date: Wed, 26 Nov 2008 18:38:10 +0100 [thread overview]
Message-ID: <b0438a630811260938n14835453jda2da43c6f1445f9@mail.gmail.com> (raw)
Hi.
We are searching for the desired channel three times in the same list.
So I think we could erase two of them. What do you think?
Signed-off-by: Miguel Ángel Álvarez (gotzoncabanes@gmail.com)
---
--- ixp4xx_hss.c.orig 2008-11-19 11:26:54.000000000 +0100
+++ ixp4xx_hss.c.create_chan 2008-11-26 18:34:23.000000000 +0100
@@ -2273,10 +2273,13 @@
}
for (ch = 0; ch < MAX_CHANNELS; ch++)
- if (channels[ch] && port->channels[ch] != CHANNEL_UNUSED) {
- printk(KERN_DEBUG "Channel #%i already in use\n", ch);
- err = -EBUSY;
- goto free;
+ if (channels[ch]) {
+ if (port->channels[ch] != CHANNEL_UNUSED) {
+ printk(KERN_DEBUG "Channel #%i already in use\n", ch);
+ err = -EBUSY;
+ goto free;
+ } else
+ break;
}
for (id = 0; id < MAX_CHAN_DEVICES; id++)
@@ -2288,10 +2291,6 @@
goto free;
}
- for (ch = 0; ch < MAX_CHANNELS; ch++)
- if (channels[ch])
- break;
-
minor = port->id * MAX_CHAN_DEVICES + ch;
chan_dev->id = id;
chan_dev->port = port;
@@ -2307,9 +2306,7 @@
if ((err = cdev_add(&chan_dev->cdev, MKDEV(chan_major, minor), 1)))
goto destroy_device;
- for (ch = 0; ch < MAX_CHANNELS; ch++)
- if (channels[ch])
- port->channels[ch] = id;
+ port->channels[ch] = id;
port->chan_devices[id] = chan_dev;
dev_set_drvdata(chan_dev->dev, chan_dev);
BUG_ON(device_create_file(chan_dev->dev, &chan_attr));
Thanks
Miguel Ángel Álvarez
next reply other threads:[~2008-11-26 17:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-26 17:38 Miguel Ángel Álvarez [this message]
2008-12-04 20:54 ` ixp4xx_hss: Little improvement in create_chan function Krzysztof Halasa
2008-12-05 8:32 ` Miguel Ángel Álvarez
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=b0438a630811260938n14835453jda2da43c6f1445f9@mail.gmail.com \
--to=gotzoncabanes@gmail.com \
--cc=khc@pm.waw.pl \
--cc=netdev@vger.kernel.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