All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Cromie <jim.cromie@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: [ patch -mm1 01/11 ] gpio-patchset-fixups: static-numpins
Date: Thu, 22 Jun 2006 12:50:01 -0600	[thread overview]
Message-ID: <449AE659.40407@gmail.com> (raw)


diff.2-fix-static-numpins

Theres currently no reason to expose number of pins, so make it static
until a reason presents itself.  Also, change name to be less generic.

Signed-off-by:   Jim Cromie <jim.cromie@gmail.com>

$ diffstat diff.2-fix-static-numpins
 scx200_gpio.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff -ruNp -X dontdiff -X exclude-diffs ../linux-2.6.17-mm1-sk/drivers/char/scx200_gpio.c 2/drivers/char/scx200_gpio.c
--- ../linux-2.6.17-mm1-sk/drivers/char/scx200_gpio.c	2006-06-21 07:04:24.000000000 -0600
+++ 2/drivers/char/scx200_gpio.c	2006-06-21 18:04:16.000000000 -0600
@@ -72,7 +72,7 @@ static struct file_operations scx200_gpi
 };
 
 struct cdev *scx200_devices;
-int num_devs = 32;
+static int num_pins = 32;
 
 static int __init scx200_gpio_init(void)
 {
@@ -97,21 +97,21 @@ static int __init scx200_gpio_init(void)
 	scx200_access.dev = &pdev->dev;
 
 	if (major)
-		rc = register_chrdev_region(dev, num_devs, "scx200_gpio");
+		rc = register_chrdev_region(dev, num_pins, "scx200_gpio");
 	else {
-		rc = alloc_chrdev_region(&dev, 0, num_devs, "scx200_gpio");
+		rc = alloc_chrdev_region(&dev, 0, num_pins, "scx200_gpio");
 		major = MAJOR(dev);
 	}
 	if (rc < 0) {
 		dev_err(&pdev->dev, "SCx200 chrdev_region err: %d\n", rc);
 		goto undo_platform_device_add;
 	}
-	scx200_devices = kzalloc(num_devs * sizeof(struct cdev), GFP_KERNEL);
+	scx200_devices = kzalloc(num_pins * sizeof(struct cdev), GFP_KERNEL);
 	if (!scx200_devices) {
 		rc = -ENOMEM;
 		goto undo_chrdev_region;
 	}
-	for (i = 0; i < num_devs; i++) {
+	for (i = 0; i < num_pins; i++) {
 		struct cdev *cdev = &scx200_devices[i];
 		cdev_init(cdev, &scx200_gpio_fops);
 		cdev->owner = THIS_MODULE;
@@ -124,7 +124,7 @@ static int __init scx200_gpio_init(void)
 	return 0; /* succeed */
 
 undo_chrdev_region:
-        unregister_chrdev_region(dev, num_devs);
+	unregister_chrdev_region(dev, num_pins);
 undo_platform_device_add:
 	platform_device_put(pdev);
 	kfree(pdev);		/* undo platform_device_alloc */
@@ -134,7 +134,7 @@ undo_platform_device_add:
 static void __exit scx200_gpio_cleanup(void)
 {
 	kfree(scx200_devices);
-	unregister_chrdev_region(MKDEV(major, 0), num_devs);
+	unregister_chrdev_region(MKDEV(major, 0), num_pins);
 	platform_device_put(pdev);
 	platform_device_unregister(pdev);
 	/* kfree(pdev); */



                 reply	other threads:[~2006-06-22 18:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=449AE659.40407@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=akpm@osdl.org \
    --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.