Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5423dd67bd0108a180784c6f307646622e804c9b
Commit:     5423dd67bd0108a180784c6f307646622e804c9b
Parent:     5f58a5c8725b48f3e32851f9748527c8d1ff71b2
Author:     Urs Thuermann <[EMAIL PROTECTED]>
AuthorDate: Thu Feb 7 18:04:21 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Thu Feb 7 18:04:21 2008 -0800

    [CAN]: Clean up module auto loading
    
    Remove local char array to construct module name.
    Don't call request_module() when CONFIG_KMOD is not set.
    
    Signed-off-by: Urs Thuermann <[EMAIL PROTECTED]>
    Signed-off-by: Oliver Hartkopp <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/can/af_can.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/net/can/af_can.c b/net/can/af_can.c
index 5158e88..1f51b8a 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -118,7 +118,6 @@ static int can_create(struct net *net, struct socket *sock, 
int protocol)
 {
        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 @@ static int can_create(struct net *net, struct socket 
*sock, int protocol)
        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];
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to