Google Groups Home
Help | Sign in
Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  19 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Mark Gross  
View profile
 More options Oct 6 2005, 11:08 am
Newsgroups: fa.linux.kernel
From: Mark Gross <mgr...@linux.intel.com>
Date: Thu, 06 Oct 2005 15:08:24 UTC
Local: Thurs, Oct 6 2005 11:08 am
Subject: Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade

Andrew,

Attached is a simple charactor driver for possible inclusion in your MM tree.

This driver is specific to the MPCBL0010 that will start shipping this fall.

The telcom clock is a special circuit, line card PLL, that provids a mechanism
for synchronization of specialized hardware across the backplane of a chassis
of multiple computers with similar specail curcits.  In this case the
synchronization signals get routed to multiple places, typically to pins on
expansion slots for hardware that knows what to do with this signal.  (SONET,
G.813, stratum 3...) and similar signaling applications found in telcom sites
can use this type of thing.

The actual device is hidden behind the FPGA on the motherboar, and is
connected to the FPGA via I2C.  This driver only talks to the FPGA registers.

Thanks,

--
--mgross
BTW: This may or may not be the opinion of my employer, more likely not.  

-------------------------------------------------------

--
--mgross
BTW: This may or may not be the opinion of my employer, more likely not.  

  tlclk-2.6.14-rc2-mm2.patch
30K Download

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Telecom Clock Driver for MPCBL0010 ATCA computer blade" by Jesper Juhl
Jesper Juhl  
View profile
 More options Oct 6 2005, 12:52 pm
Newsgroups: fa.linux.kernel
From: Jesper Juhl <jesper.j...@gmail.com>
Date: Thu, 06 Oct 2005 16:52:46 UTC
Local: Thurs, Oct 6 2005 12:52 pm
Subject: Re: Telecom Clock Driver for MPCBL0010 ATCA computer blade
On 10/6/05, Mark Gross <mgr...@linux.intel.com> wrote:

A few minor style and spelling comments :

[snip]

> + *
> + * Send feedback to <sebastien.bouch...@ca.kontron.com>
> + *
> + * 2.6 driver version being maintained by <mark.gr...@intel.com>

shouldn't this info go into CREDITS/MAINTAINERS and the above then simply be

 * Send feedback to Sebastien Bouchard and the current maintainer.

???

Same comment for the other files.

[snip]

> +/* sysFS interface definition:

Isn't it just called "sysfs" without the caps?

> +Uppon loading the driver will create a sysfs directory under class/misc/tlclk.

s/Uppon/Upon/

> +
> +This directory exports the following interfaces.  There opperation is documented

Line exceeds 80 characters (in this case due to trailing whitespace).

Let me quote Documentation/CodingStyle Chapter 2 :

"
The limit on the length of lines is 80 columns and this is a hard limit.

Statements longer than 80 columns will be broken into sensible chunks.
Descendants are always substantially shorter than the parent and are placed
substantially to the right. The same applies to function headers with a long
argument list. Long strings are as well broken into shorter strings.
"

You have both comment and code lines elsewhere in the file that exceed this.
Please fix.

And while you are at it, please get rid of all the trailing whitespace. A
simple sed script will do it like this :

sed -r s/"[ \t]+$"/""/ file_with_trailing_whitespace.c > fixed_file.c

[snip]

> +All sysfs interaces are integers in hex format, i.e echo 99 > refalign

I trust you mean "interfaces" ...

[snip]

> +#define debug_printk( args... ) printk( args)
> +#else
> +#define debug_printk( args... )

Why these spaces after start paren and before closing paren?

[snip]

> +tlclk_read(struct file * filp, char __user * buf, size_t count, loff_t * f_pos)

Most of your functions nicely place the '*' next to the variable name, but this
one, the next one and a few other cases do not. Please be consistent.

[snip]

> +static CLASS_DEVICE_ATTR(enable_clk3b_output, S_IWUGO, NULL,
> +          store_enable_clk3b_output);
> +
> +
> +
> +static ssize_t store_enable_clk3a_output(struct class_device *d,

Why all those blank lines? One should do just fine.

[snip]

> +static CLASS_DEVICE_ATTR(enable_clk3a_output, S_IWUGO, NULL,
> +          store_enable_clk3a_output);
> +
> +
> +
> +static ssize_t store_enable_clkb1_output(struct class_device *d,

Again a lot of blank lines, and this is not the last case (just the last one
I'm going to point out).

[snip]

> +#ifdef  CONFIG_SYSFS
> +  if( 0 > (ret = misc_register(&tlclk_miscdev )) ) {

First a style thing :
        if (0 > (ret = misc_register(&tlclk_miscdev))) {

Secondly, wouldn't this look nicer as
        if ((ret = misc_register(&tlclk_miscdev)) < 0) {
or is that just me?

Personally I think I would prefer this :
        ret = misc_register(&tlclk_miscdev);
        if (ret < 0) {
Looks more readable to me.

> +          printk(KERN_ERR" misc_register retruns %d \n", ret);

Ehh, why a space just before the newline in this printk?

> +          ret =  -EBUSY;

                ret = -EBUSY;

--
Jesper Juhl <jesper.j...@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade" by Alexey Dobriyan
Alexey Dobriyan  
View profile
 More options Oct 6 2005, 1:13 pm
Newsgroups: fa.linux.kernel
From: Alexey Dobriyan <adobri...@gmail.com>
Date: Thu, 06 Oct 2005 17:13:31 UTC
Local: Thurs, Oct 6 2005 1:13 pm
Subject: Re: Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade

> --- linux-2.6.14-rc2-mm2/drivers/char/tlclk.c
> +++ linux-2.6.14-rc2-mm2-tlclk/drivers/char/tlclk.c

Can you drop ioctl part of interface and leave only sysfs one?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Telecom Clock Driver for MPCBL0010 ATCA computer blade" by Mark Gross
Mark Gross  
View profile
 More options Oct 6 2005, 1:32 pm
Newsgroups: fa.linux.kernel
From: Mark Gross <mgr...@linux.intel.com>
Date: Thu, 06 Oct 2005 17:32:13 UTC
Local: Thurs, Oct 6 2005 1:32 pm
Subject: Re: Telecom Clock Driver for MPCBL0010 ATCA computer blade

On Thursday 06 October 2005 09:52, Jesper Juhl wrote:

Thanks for the review, I thought I had the 80 line thing taken care of last month.  :(

See attached, I hope it catches all the issues you found.

--
--mgross
BTW: This may or may not be the opinion of my employer, more likely not.  

  tlclk-2.6.14-rc2-mm2.patch
31K Download

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade" by Mark Gross
Mark Gross  
View profile
 More options Oct 6 2005, 1:35 pm
Newsgroups: fa.linux.kernel
From: Mark Gross <mgr...@linux.intel.com>
Date: Thu, 06 Oct 2005 17:35:04 UTC
Local: Thurs, Oct 6 2005 1:35 pm
Subject: Re: Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade
On Thursday 06 October 2005 10:24, Alexey Dobriyan wrote:

> > --- linux-2.6.14-rc2-mm2/drivers/char/tlclk.c
> > +++ linux-2.6.14-rc2-mm2-tlclk/drivers/char/tlclk.c

> Can you drop ioctl part of interface and leave only sysfs one?

I would like to keep if for a little while because the hardware validation
guys are still using test harnesses written for the 2.4 kernel driver
version.  However; I am willing to pull this block if that would help in
getting this driver into the kernel.

--mgross

--
--mgross
BTW: This may or may not be the opinion of my employer, more likely not.  
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg KH  
View profile
 More options Oct 6 2005, 2:21 pm
Newsgroups: fa.linux.kernel
From: Greg KH <g...@kroah.com>
Date: Thu, 06 Oct 2005 18:21:37 UTC
Local: Thurs, Oct 6 2005 2:21 pm
Subject: Re: Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade

On Thu, Oct 06, 2005 at 08:03:21AM -0700, Mark Gross wrote:
> +#if CONFIG_DEBUG_KERNEL
> +#define debug_printk( args... ) printk( args)
> +#else
> +#define debug_printk( args... )
> +#endif

Please just use the existing dev_dbg() and friend functions instead of
creating your own.

> +DEFINE_SPINLOCK(event_lock);

This should be static, right?

> +irqreturn_t tlclk_interrupt(int irq, void *dev_id, struct pt_regs *regs);

static?

> +DECLARE_WAIT_QUEUE_HEAD(wq);

static?

> +#ifdef TLCLK_IOCTL

Please just delete this whole section, no new ioctls for 2.6 please.

> +ssize_t
> +tlclk_read(struct file * filp, char __user * buf, size_t count, loff_t * f_pos)

Return type on the same line as the function name please.

> +{
> +  int count0 = sizeof(struct tlclk_alarms);
> +
> +  wait_event_interruptible(wq, got_event);
> +  if (copy_to_user(buf, alarm_events, sizeof(struct tlclk_alarms)))
> +          return -EFAULT;
> +
> +  memset(alarm_events, 0, sizeof(struct tlclk_alarms));
> +  got_event = 0;
> +
> +  return count0;

count0 doesn't really need to be here, does it?

What if you get passed less than that size of data?  You will be reading
in off of the end of the buffer (which is not a nice thing to do...)

> +#ifdef CONFIG_SYSFS

Not needed, just drop this #ifdef please.

> +static ssize_t show_current_ref(struct class_device *d, char * buf)
> +{
> +  unsigned long ret_val;
> +  unsigned long flags;
> +
> +  spin_lock_irqsave(&event_lock, flags);
> +          ret_val = ((inb(TLCLK_REG1) & 0x08) >> 3);
> +  spin_unlock_irqrestore(&event_lock, flags);

Odd indentation here.  You do this a lot, please fix them all.

> +static int __init tlclk_init(void)
> +{
> +  int ret;
> +#ifdef  CONFIG_SYSFS
> +  struct class_device *class;
> +#endif

Again, please drop all of the #ifdefs from this file, they are not
needed.

> +  alarm_events = kcalloc(1, sizeof(struct tlclk_alarms), GFP_KERNEL);

We have kzalloc() now.

> +
> +  if (!alarm_events)
> +          goto out1;
> +
> +/* Read telecom clock IRQ number (Set by BIOS) */

Indentation is wrong.

> +  if( 0 > (ret = misc_register(&tlclk_miscdev )) ) {

Try this instead:
        ret = misc_register(&tlclk_miscdev);
        if (ret) {

> +          printk(KERN_ERR" misc_register retruns %d \n", ret);
> +          ret =  -EBUSY;
> +          goto out3;
> +  }
> +  class = tlclk_miscdev.class;
> +  class_device_create_file(class, &class_device_attr_current_ref);

Try registering a whole attribute group instead.  It's much nicer than
the 20 lines you have to register and unregister your devices (and you
don't handle the error condition properly if something goes wrong half
way through.)

> diff -urN -X dontdiff linux-2.6.14-rc2-mm2/drivers/char/tlclk.h linux-2.6.14-rc2-mm2-tlclk/drivers/char/tlclk.h

Why not just put this stuff into the tlclk.c file itself, as it isn't
needed anywhere else?

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Gross  
View profile
 More options Oct 6 2005, 6:58 pm
Newsgroups: fa.linux.kernel
From: Mark Gross <mgr...@linux.intel.com>
Date: Thu, 06 Oct 2005 22:58:03 UTC
Local: Thurs, Oct 6 2005 6:58 pm
Subject: Re: Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade

On Thursday 06 October 2005 11:20, Greg KH wrote:

> > +             printk(KERN_ERR" misc_register retruns %d \n", ret);
> > +             ret =  -EBUSY;
> > +             goto out3;
> > +     }
> > +     class = tlclk_miscdev.class;
> > +     class_device_create_file(class, &class_device_attr_current_ref);

> Try registering a whole attribute group instead.  It's much nicer than
> the 20 lines you have to register and unregister your devices (and you
> don't handle the error condition properly if something goes wrong half
> way through.)

I couldn't find such an API that wasn't static to class.c, or described in class.txt.  Any pointers on this would be helpful.

> > diff -urN -X dontdiff linux-2.6.14-rc2-mm2/drivers/char/tlclk.h linux-2.6.14-rc2-mm2-tlclk/drivers/char/tlclk.h

> Why not just put this stuff into the tlclk.c file itself, as it isn't
> needed anywhere else?

done.

Attached is an update that I think addresses your other comments.

Thanks for looking at this.

--
--mgross
BTW: This may or may not be the opinion of my employer, more likely not.  

  tlclk-2.6.14-rc2-mm2.patch
24K Download

    Reply to author    Forward