Netdev List
 help / color / mirror / Atom feed
From: urs.thuermann@gmx.de
To: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Cc: Urs Thuermann <urs.thuermann@volkswagen.de>,
	Oliver Hartkopp <oliver.hartkopp@volkswagen.de>,
	Oliver Hartkopp <oliver@hartkopp.net>
Subject: [patch 1/3] CAN: Clean up module auto loading
Date: Wed,  6 Feb 2008 23:07:50 +0100	[thread overview]
Message-ID: <20080206220825.20500.1@janus.isnogud.escape.de> (raw)
In-Reply-To: 20080206220749.20500.0@janus.isnogud.escape.de

[-- Attachment #1: module-load --]
[-- Type: text/plain, Size: 1705 bytes --]

Remove local char array to construct module name.
Don't call request_module() when CONFIG_KMOD is not set.

Signed-off-by: Urs Thuermann <urs.thuermann@volkswagen.de>
Signed-off-by: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>

---
 net/can/af_can.c |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

Index: net-2.6/net/can/af_can.c
===================================================================
--- net-2.6.orig/net/can/af_can.c	2008-02-06 22:17:58.000000000 +0100
+++ net-2.6/net/can/af_can.c	2008-02-06 22:20:46.000000000 +0100
@@ -118,7 +118,6 @@
 {
 	struct sock *sk;
 	struct can_proto *cp;
-	char module_name[sizeof("can-proto-000")];
 	int err = 0;
 
 	sock->state = SS_UNCONNECTED;
@@ -129,26 +128,21 @@
 	if (net != &init_net)
 		return -EAFNOSUPPORT;
 
+#ifdef CONFIG_KMOD
 	/* try to load protocol module, when CONFIG_KMOD is defined */
 	if (!proto_tab[protocol]) {
-		sprintf(module_name, "can-proto-%d", protocol);
-		err = request_module(module_name);
+		err = request_module("can-proto-%d", protocol);
 
 		/*
 		 * In case of error we only print a message but don't
 		 * return the error code immediately.  Below we will
 		 * return -EPROTONOSUPPORT
 		 */
-		if (err == -ENOSYS) {
-			if (printk_ratelimit())
-				printk(KERN_INFO "can: request_module(%s)"
-				       " not implemented.\n", module_name);
-		} else if (err) {
-			if (printk_ratelimit())
-				printk(KERN_ERR "can: request_module(%s)"
-				       " failed.\n", module_name);
-		}
+		if (err && printk_ratelimit())
+			printk(KERN_ERR "can: request_module "
+			       "(can-proto-%d) failed.\n", protocol);
 	}
+#endif
 
 	spin_lock(&proto_tab_lock);
 	cp = proto_tab[protocol];

--

  reply	other threads:[~2008-02-06 23:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-06 22:07 [patch 0/3] CAN: Some updates for 2.6.25 urs.thuermann
2008-02-06 22:07 ` urs.thuermann [this message]
2008-02-06 22:07 ` [patch 2/3] CAN: Move proto_{,un}register() out of spin-locked region urs.thuermann
2008-02-06 22:07 ` [patch 3/3] CAN: Minor clean-ups urs.thuermann
2008-02-08  2:05 ` [patch 0/3] CAN: Some updates for 2.6.25 David Miller

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=20080206220825.20500.1@janus.isnogud.escape.de \
    --to=urs.thuermann@gmx.de \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=oliver.hartkopp@volkswagen.de \
    --cc=oliver@hartkopp.net \
    --cc=urs.thuermann@volkswagen.de \
    /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