All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: Greg KH <greg@kroah.com>
Cc: Chester <fitchett@phidgets.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB: add new USB PhidgetServo driver
Date: Thu, 29 Apr 2004 03:59:51 +0200	[thread overview]
Message-ID: <20040429015951.GA4135@behemoth.pad.mess.org> (raw)
In-Reply-To: <20040428184138.GA17275@kroah.com>

On Wed, Apr 28, 2004 at 11:41:38AM -0700, Greg KH wrote:
> On Wed, Apr 28, 2004 at 08:18:06PM +0200, Sean Young wrote:
> > Here is a driver for the usb servo controllers from Phidgets 
> > <http://www.phidgets.com/>, using sysfs. 
> > 
> > Note that the devices claim to be hid devices, so I've added them to the 
> > hid_blacklist (HID_QUIRK_IGNORE). A servo controller isn't really an hid
> > device (or is it?).
> > 
> > diff against 2.6.6-rc2.
> 
> Nice, I like tiny clean drivers like this :)
> 
> I've applied it to my trees, and it will make it into the next -mm tree,
> and show up in the 2.6.7 release whenever it happens.

Great! Thanks.

Somehow I managed to send the wrong version. Here is a patch which fixes
that. (Remove a dev_info() which wasn't supposed to be there, and make sure 
that everything is still consistent in the unlikely event that kmalloc()
fails). Just minor cleanups.


Sean

diff -Nur linux-2.6.0/drivers/usb/misc/phidgetservo.c /usr/src/linux-2.6.0/drivers/usb/misc/phidgetservo.c
--- linux-2.6.0/drivers/usb/misc/phidgetservo.c	2004-04-29 02:35:19.000000000 +0200
+++ /usr/src/linux-2.6.0/drivers/usb/misc/phidgetservo.c	2004-04-29 02:35:09.000000000 +0200
@@ -67,6 +67,13 @@
 	int retval;
 	unsigned char *buffer;
 
+	buffer = kmalloc(6, GFP_KERNEL);
+	if (!buffer) {
+		dev_err(&servo->udev->dev, "%s - out of memory\n",
+			__FUNCTION__);
+		return;
+	}
+
 	/*
 	 * pulse = 0 - 4095
 	 * angle = 0 - 180 degrees
@@ -77,13 +84,6 @@
 	servo->degrees[servo_no]= degrees;
 	servo->minutes[servo_no]= minutes;	
 
-	buffer = kmalloc(6, GFP_KERNEL);
-	if (!buffer) {
-		dev_err(&servo->udev->dev, "%s - out of memory\n",
-			__FUNCTION__);
-		return;
-	}
-
 	/* 
 	 * The PhidgetServo v3.0 is controlled by sending 6 bytes,
 	 * 4 * 12 bits for each servo.
@@ -136,6 +136,13 @@
 	int retval;
 	unsigned char *buffer;
 
+	buffer = kmalloc(2, GFP_KERNEL);
+	if (!buffer) {
+		dev_err(&servo->udev->dev, "%s - out of memory\n",
+			__FUNCTION__);
+		return;
+	}
+
 	/*
 	 * angle = 0 - 180 degrees
 	 * pulse = angle + 23
@@ -144,13 +151,6 @@
 	servo->degrees[servo_no]= degrees;
 	servo->minutes[servo_no]= 0;
 
-	buffer = kmalloc(2, GFP_KERNEL);
-	if (!buffer) {
-		dev_err(&servo->udev->dev, "%s - out of memory\n",
-			__FUNCTION__);
-		return;
-	}
-
 	/*
 	 * The PhidgetServo v2.0 is controlled by sending two bytes. The
 	 * first byte is the servo number xor'ed with 2:
@@ -291,9 +291,6 @@
 
 	dev_info(&interface->dev, "USB %d-Motor PhidgetServo v%d.0 detached\n",
 		 dev->quad_servo ? 4 : 1, dev->version);
-
-	dev_info(&interface->dev,
-		 "WARNING: version 2.0 not tested. Please report if this works.\n");
 }
 
 static struct usb_driver servo_driver = {

  reply	other threads:[~2004-04-29  2:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-28 18:18 [PATCH] USB: add new USB PhidgetServo driver Sean Young
2004-04-28 18:41 ` Greg KH
2004-04-29  1:59   ` Sean Young [this message]
2004-04-29  3:08     ` Greg KH
2004-04-29  2:18 ` Bryan Small
2004-04-29  3:10   ` Greg KH
2004-04-29 18:49     ` Bryan Small
2004-04-29 19:10       ` Oliver Neukum
2004-04-29 19:16         ` Greg KH
2004-04-29 19:35           ` Oliver Neukum
2004-04-29 19:44             ` Greg KH
2004-04-29 20:33               ` Oliver Neukum

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=20040429015951.GA4135@behemoth.pad.mess.org \
    --to=sean@mess.org \
    --cc=fitchett@phidgets.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@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 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.