From: Greg KH <greg@kroah.com>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Mark Gross <mgross@linux.intel.com>,
akpm@osdl.org, linux-kernel@vger.kernel.org,
Sebastien.Bouchard@ca.kontron.com, mark.gross@intel.com
Subject: Re: Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade
Date: Thu, 13 Oct 2005 15:40:42 -0700 [thread overview]
Message-ID: <20051013224042.GB3266@kroah.com> (raw)
In-Reply-To: <9a8748490510131508r49a048cau7e08d77ef1d614ad@mail.gmail.com>
On Fri, Oct 14, 2005 at 12:08:28AM +0200, Jesper Juhl wrote:
>
> I just took a new look at your patch and I have (again) a few small comments...
>
>
> +static int tlclk_open(struct inode *inode, struct file *filp)
> +{
> + int result;
> +
> + /* Make sure there is no interrupt pending while
> + * initialising interrupt handler */
> + inb(TLCLK_REG6);
> +
> + /* This device is wired through the FPGA IO space of the ATCA blade
> + * we can't share this IRQ */
> + result = request_irq(telclk_interrupt, &tlclk_interrupt,
> + SA_INTERRUPT, "telco_clock", tlclk_interrupt);
> + if (result == -EBUSY) {
> + printk(KERN_ERR "telco_clock: Interrupt can't be reserved!\n");
> + return -EBUSY;
> + }
> + inb(TLCLK_REG6); /* Clear interrupt events */
> +
> + return 0;
> +}
>
> It seems to me that you can get rid of the "result" variable here by
> rewriting the funcion like this :
>
> static int tlclk_open(struct inode *inode, struct file *filp)
> {
> /* Make sure there is no interrupt pending while
> * initialising interrupt handler */
> inb(TLCLK_REG6);
>
> /* This device is wired through the FPGA IO space of the ATCA blade
> * we can't share this IRQ */
> if (-EBUSY == request_irq(telclk_interrupt, &tlclk_interrupt,
> SA_INTERRUPT, "telco_clock", tlclk_interrupt)) {
Ick, no, that's a mess. Stick with the original version.
Don't call functions within a if() statement, it's harder to read.
> + unsigned long tmp;
> + unsigned char val;
> + unsigned long flags;
> +
> + sscanf(buf, "%lX", &tmp);
> + dev_dbg(d, "tmp = 0x%lX\n", tmp);
> +
> + val = (unsigned char)tmp;
>
> You do this a lot, I'm wondering why you don't read directly into
> "val" and then get rid of the "tmp" variable?
Because you want to cast it.
thanks,
greg k-h
next prev parent reply other threads:[~2005-10-13 22:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-06 15:03 Mark Gross
2005-10-06 16:52 ` Jesper Juhl
2005-10-06 17:28 ` Mark Gross
2005-10-07 12:21 ` Jesper Juhl
2005-10-06 17:24 ` Fwd: " Alexey Dobriyan
2005-10-06 17:31 ` Mark Gross
2005-10-06 18:20 ` Greg KH
2005-10-06 22:54 ` Mark Gross
2005-10-06 23:15 ` Greg KH
2005-10-12 22:30 ` Mark Gross
2005-10-12 22:49 ` Greg KH
2005-10-12 23:36 ` Mark Gross
2005-10-13 1:14 ` Greg KH
2005-10-13 21:36 ` Mark Gross
2005-10-13 22:08 ` Jesper Juhl
2005-10-13 22:40 ` Greg KH [this message]
[not found] ` <9a8748490510131547s127f3167j6c9427ff3d97f878@mail.gmail.com>
[not found] ` <20051014001547.GA4647@kroah.com>
2005-10-14 1:28 ` Jesper Juhl
2005-10-06 23:45 ` Alexey Dobriyan
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=20051013224042.GB3266@kroah.com \
--to=greg@kroah.com \
--cc=Sebastien.Bouchard@ca.kontron.com \
--cc=akpm@osdl.org \
--cc=jesper.juhl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.gross@intel.com \
--cc=mgross@linux.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 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®