All of lore.kernel.org
 help / color / mirror / Atom feed
From: dl9pf@gmx.de (Jan-Simon Möller)
To: kernelnewbies@lists.kernelnewbies.org
Subject: rev2 - Driver for BlinkM i2c LED module
Date: Sun, 3 Jun 2012 22:27:59 +0200	[thread overview]
Message-ID: <201206032227.59186.dl9pf@gmx.de> (raw)
In-Reply-To: <20120603173208.GB2377@debian.debian>

New version attched.

Am Sonntag, Juni 03, 2012, 07:32:08 PM schrieb Jonathan Neusch?fer:
> On Sat, Jun 02, 2012 at 11:29:46AM +0200, Jan-Simon M?ller wrote:
> > static const struct {
> > 
> > 	char cmdchar;
> > 	u8 cmdbyte;
> > 	u8 nr_args;
> > 	u8 nr_ret;
> > 	u8 dir:2;
> > 
> > } blinkm_cmds[17] = {
> > 
> > 	/* cmdnr, cmdchar, cmdbyte, nr_args, nr_ret,  dir */
> 
> cmdnr isn't there anymore.

Yep, tnx.

> > 	/* We start hardware transfers which are not to be
> > 	
> > 	 * mixed with other commands. Aquire a lock now. */
> > 	
> > 	if (mutex_lock_interruptible(&data->update_lock) < 0)
> > 	
> > 		return -EAGAIN;
> > 	
> > 	/* switch cmd - usually write before reads */
> > 	switch (cmd) {
> 
> [...]
> 
> > 	default:
> > 		printk(KERN_INFO "BlinkM: unknown command %d\n", cmd);
> > 		return -1;
> 
> You need to unlock the mutex in the error case, too.
> 
> Also the -1 looks suspicious to me. When interpreted as -errno it would
> be -EPERM on most (or even all) architectures.  (according to
> include/asm-generic/errno-base.h)

Thanks for spotting this. Fixed.

[...]

> > 	/* red fade to off */
> > 	data->red = 0xff;
> > 	ret = blinkm_transfer_hw(client, BLM_GO_RGB);
> > 	if (ret < 0)
> > 	
> > 		printk(KERN_INFO
> > 		
> > 		       "Failure in blinkm_remove ignored. Continuing.\n");
> > 	
> > 	/* off */
> > 	data->red = 0x00;
> > 	data->green = 0x00;
> > 	data->blue = 0x00;
> > 	ret = blinkm_transfer_hw(client, BLM_FADE_RGB);
> > 	if (ret < 0)
> > 	
> > 		printk(KERN_INFO
> > 		
> > 		       "Failure in blinkm_remove ignored. Continuing.\n");
> 
> Did you leave this fading in for testing?
That is in by intention.


Best,
Jan-Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-driver-for-BlinkM-device-to-drivers-leds.patch
Type: text/x-patch
Size: 22767 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120603/1cc20080/attachment-0001.bin 

      reply	other threads:[~2012-06-03 20:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 13:45 Driver for BlinkM i2c LED module Jan-Simon Möller
2012-06-01 15:16 ` Jonathan Neuschäfer
2012-06-01 21:45   ` Jan-Simon Möller
2012-06-01 22:09     ` Jonathan Neuschäfer
2012-06-02  9:29   ` rev2 - " Jan-Simon Möller
2012-06-03 17:32     ` Jonathan Neuschäfer
2012-06-03 20:27       ` Jan-Simon Möller [this message]

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=201206032227.59186.dl9pf@gmx.de \
    --to=dl9pf@gmx.de \
    --cc=kernelnewbies@lists.kernelnewbies.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 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.