mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: jim.cromie@gmail.com
Subject: [PATCH] PC8736X: Correct dev_dbg() message showing major number.
Date: Wed, 4 May 2011 05:26:43 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1105040522250.4503@localhost6.localdomain6> (raw)


Currently, the debugging info is incorrect, as a successful call to
either register_chrdev_region() or alloc_chrdev_region() returns
simply zero, which appears to be what the following code would print.
Skip the checking, just print the value of "major", which should be
correct.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

  here's the current code in context, so you can see what i mean:

        if (major) {
                devid = MKDEV(major, 0);
                rc = register_chrdev_region(devid, PC8736X_GPIO_CT, DEVNAME);
        } else {
                rc = alloc_chrdev_region(&devid, 0, PC8736X_GPIO_CT, DEVNAME);
                major = MAJOR(devid);
        }

        if (rc < 0) {
                dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
                goto undo_request_region;
        }
        dev_dbg(&pdev->dev, "got dynamic major %d\n", major);


diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
index b304ec0..a23d6bf 100644
--- a/drivers/char/pc8736x_gpio.c
+++ b/drivers/char/pc8736x_gpio.c
@@ -314,10 +314,7 @@ static int __init pc8736x_gpio_init(void)
 		dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
 		goto undo_request_region;
 	}
-	if (!major) {
-		major = rc;
-		dev_dbg(&pdev->dev, "got dynamic major %d\n", major);
-	}
+	dev_dbg(&pdev->dev, "got dynamic major %d\n", major);

 	pc8736x_init_shadow();


-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

             reply	other threads:[~2011-05-04  9:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04  9:26 Robert P. J. Day [this message]
2011-05-14 19:41 ` Jim Cromie

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=alpine.DEB.2.00.1105040522250.4503@localhost6.localdomain6 \
    --to=rpjday@crashcourse.ca \
    --cc=jim.cromie@gmail.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 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®