From: Andy Isaacson <adi@hexapodia.org>
To: Masayuki Ohtak <masa-korg@dsn.okisemi.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
Arnd Bergmann <arnd@arndb.de>,
"Wang, Yong Y" <yong.y.wang@intel.com>,
qi.wang@intel.com, joel.clark@intel.com,
andrew.chih.howe.khor@intel.com,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Packet hub driver of Topcliff PCH
Date: Wed, 30 Jun 2010 23:58:11 -0700 [thread overview]
Message-ID: <20100701065811.GM29166@hexapodia.org> (raw)
In-Reply-To: <4C2C2423.4060705@dsn.okisemi.com>
On Thu, Jul 01, 2010 at 02:14:11PM +0900, Masayuki Ohtak wrote:
> Hi Andy and Randy
>
> I have modified for your comments.
> Please confirm below.
Your style is looking better, and the additional documentation is much
appreciated.
I still have concerns about the userland interface design. It still
seems to me that the MAC interface should be used by something in
drivers/net and there's no reason to expose the SROM in /dev unless it
contains more than just the MAC address.
A few more style issues I saw on a quick scan through -- this was not a
comprehensive review:
> +static long pch_phub_ioctl(struct file *file, unsigned int cmd,
> + unsigned long arg)
[snip]
> + ret_value = copy_to_user(varg,
> + mac_addr, sizeof(mac_addr));
Reformat this to fit on one line:
+ ret_value = copy_to_user(varg, mac_addr, sizeof(mac_addr));
[snip]
> + case IOCTL_PHUB_WRITE_MAC_ADDR:
> + ret_value = copy_from_user(mac_addr, varg, sizeof(mac_addr));
> +
> + if (ret_value)
Here we need to break:
+ {
> + ret_value = -EFAULT;
+ break;
+ }
because if copy_from_user failed ...
> + for (i = 0; i < 6; i++)
> + pch_phub_write_gbe_mac_addr(i, mac_addr[i]);
... we would pass garbage to pch_phub_write_gbe_mac_addr.
[snip]
> + dev_dbg(&pdev->dev,
> + "\npch_phub_probe : pci_enable_device FAILED");
Prefix \n is not correct. This should be
+ dev_dbg(&pdev->dev, "pch_phub_probe: pci_enable_device FAILED");
In general dev_dbg format strings should fit on one 80-char line. If
your format strings are longer than that, it's a clue you're doing
something wrong. For example:
> + dev_dbg(&pdev->dev, "pch_phub_probe : "
> + "pci_enable_device returns %d\n", ret);
+ dev_dbg(&pdev->dev, "pch_phub_probe: pci_enable_device returns %d\n",
+ ret);
> + ret = pci_request_regions(pdev, MODULE_NAME);
> + if (ret) {
> + dev_dbg(&pdev->dev,
> + "pch_phub_probe : pci_request_regions FAILED");
If you have a dev_dbg, please print ret. It may give an important clue.
[snip a bunch more I don't have time to review right now]
Thanks,
-andy
next prev parent reply other threads:[~2010-07-01 6:58 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-22 5:33 [PATCH] Topcliff PHUB: Generate PacketHub driver Masayuki Ohtak
2010-06-22 10:33 ` Masayuki Ohtak
2010-06-22 22:12 ` Andrew Morton
2010-06-23 0:31 ` Masayuki Ohtake
2010-06-22 11:30 ` Arnd Bergmann
2010-06-22 13:52 ` Yong Wang
2010-06-29 23:31 ` Andy Isaacson
2010-06-30 5:58 ` Masayuki Ohtake
2010-06-30 18:28 ` Andy Isaacson
2010-07-01 4:08 ` Masayuki Ohtake
2010-06-30 7:51 ` [PATCH] Packet hub driver of Topcliff PCH Masayuki Ohtak
2010-06-30 18:05 ` Randy Dunlap
2010-07-01 2:52 ` Masayuki Ohtake
2010-07-01 5:14 ` Masayuki Ohtak
2010-07-01 6:58 ` Andy Isaacson [this message]
2010-07-01 10:13 ` Masayuki Ohtake
2010-07-01 10:38 ` Masayuki Ohtak
2010-07-01 15:44 ` Randy Dunlap
2010-07-05 7:20 ` Masayuki Ohtak
2010-07-05 15:04 ` Arnd Bergmann
2010-07-06 15:58 ` Randy Dunlap
2010-07-06 6:20 ` Masayuki Ohtak
2010-07-06 6:30 ` Arnd Bergmann
2010-07-07 1:19 ` Yong Wang
2010-07-09 20:00 ` Andrew Morton
2010-07-12 1:25 ` Masayuki Ohtake
2010-07-15 7:25 ` Masayuki Ohtak
2010-07-15 7:42 ` [PATCH] I2C " Masayuki Ohtak
[not found] ` <4C3EBBEC.9020304-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-07-15 19:35 ` Arnd Bergmann
2010-07-15 19:35 ` Arnd Bergmann
2010-07-20 0:05 ` Masayuki Ohtake
2010-07-20 0:05 ` Masayuki Ohtake
2010-07-20 4:55 ` Masayuki Ohtake
2010-07-20 4:55 ` Masayuki Ohtake
[not found] ` <000401cb27c7$ce732960$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-07-20 9:27 ` Arnd Bergmann
2010-07-20 9:27 ` Arnd Bergmann
2010-07-20 12:38 ` Masayuki Ohtake
2010-07-20 12:38 ` Masayuki Ohtake
2010-07-20 8:19 ` Masayuki Ohtake
2010-07-20 8:19 ` Masayuki Ohtake
[not found] ` <000601cb27e4$3768c170$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-07-20 9:29 ` Arnd Bergmann
2010-07-20 9:29 ` Arnd Bergmann
2010-07-20 12:40 ` Masayuki Ohtake
2010-07-20 12:40 ` Masayuki Ohtake
[not found] ` <4C204B0D.2030201-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-07-21 6:46 ` Masayuki Ohtak
2010-07-21 6:46 ` Masayuki Ohtak
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=20100701065811.GM29166@hexapodia.org \
--to=adi@hexapodia.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=andrew.chih.howe.khor@intel.com \
--cc=arnd@arndb.de \
--cc=joel.clark@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masa-korg@dsn.okisemi.com \
--cc=qi.wang@intel.com \
--cc=randy.dunlap@oracle.com \
--cc=yong.y.wang@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.