mISDN: Use struct device name field
authorMatthias Urlichs <smurf@smurf.noris.de>
Fri, 15 Aug 2008 22:04:33 +0000 (00:04 +0200)
committerKarsten Keil <kkeil@suse.de>
Fri, 9 Jan 2009 21:44:24 +0000 (22:44 +0100)
struct device already has a 'name' member, use it.

Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
Signed-off-by: Karsten Keil <kkeil@suse.de>
drivers/isdn/mISDN/core.c
drivers/isdn/mISDN/layer1.c
drivers/isdn/mISDN/socket.c
drivers/isdn/mISDN/stack.c
drivers/isdn/mISDN/tei.c
include/linux/mISDNif.h

index 751665c448d0e9ebe284d6942cf709e4e29e9160..43fd97b0fe42bc9a81b98029b4fff8814ad33b83 100644 (file)
@@ -82,12 +82,12 @@ mISDN_register_device(struct mISDNdevice *dev, char *name)
        if (dev->id < 0)
                return -EBUSY;
        if (name && name[0])
-               strcpy(dev->name, name);
+               dev_set_name(&dev->dev, "%s", name);
        else
-               sprintf(dev->name, "mISDN%d", dev->id);
+               dev_set_name(&dev->dev, "mISDN%d", dev->id);
        if (debug & DEBUG_CORE)
                printk(KERN_DEBUG "mISDN_register %s %d\n",
-                       dev->name, dev->id);
+                       dev_name(&dev->dev), dev->id);
        err = create_stack(dev);
        if (err)
                return err;
@@ -104,7 +104,7 @@ mISDN_unregister_device(struct mISDNdevice *dev) {
 
        if (debug & DEBUG_CORE)
                printk(KERN_DEBUG "mISDN_unregister %s %d\n",
-                       dev->name, dev->id);
+                       dev_name(&dev->dev), dev->id);
        write_lock_irqsave(&device_lock, flags);
        list_del(&dev->D.list);
        write_unlock_irqrestore(&device_lock, flags);
index b73e952d12cf0674f6eb09782f009b530c9b1720..e826eeb1ecec58a45ef7483df0bb55599a2fbe7c 100644 (file)
@@ -101,7 +101,7 @@ l1m_debug(struct FsmInst *fi, char *fmt, ...)
        va_list va;
 
        va_start(va, fmt);
-       printk(KERN_DEBUG "%s: ", l1->dch->dev.name);
+       printk(KERN_DEBUG "%s: ", dev_name(&l1->dch->dev.dev));
        vprintk(fmt, va);
        printk("\n");
        va_end(va);
index 98fa6c4a4bd6f7dfdd07ea1aba4fdfc57eda102b..2f6d6e88ff2c23d14fc6217a724b9e419610b830 100644 (file)
@@ -381,7 +381,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        memcpy(di.channelmap, dev->channelmap,
                                sizeof(di.channelmap));
                        di.nrbchan = dev->nrbchan;
-                       strcpy(di.name, dev->name);
+                       strcpy(di.name, dev_name(&dev->dev));
                        if (copy_to_user((void __user *)arg, &di, sizeof(di)))
                                err = -EFAULT;
                } else
@@ -639,7 +639,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        memcpy(di.channelmap, dev->channelmap,
                                sizeof(di.channelmap));
                        di.nrbchan = dev->nrbchan;
-                       strcpy(di.name, dev->name);
+                       strcpy(di.name, dev_name(&dev->dev));
                        if (copy_to_user((void __user *)arg, &di, sizeof(di)))
                                err = -EFAULT;
                } else
@@ -655,7 +655,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        }
                        dev = get_mdevice(dn.id);
                        if (dev)
-                               strlcpy(dev->name, dn.name, MISDN_MAX_IDLEN);
+                               err = device_rename(&dev->dev, dn.name);
                        else
                                err = -ENODEV;
                }
index d55b14ae4e99d4e1ffbf58e76d9bda93df2cfb63..9b9fab47cb2b688cb716ecf675ee5d69d09d006e 100644 (file)
@@ -172,7 +172,8 @@ send_msg_to_layer(struct mISDNstack *st, struct sk_buff *skb)
                else
                        printk(KERN_WARNING
                            "%s: dev(%s) prim(%x) id(%x) no channel\n",
-                           __func__, st->dev->name, hh->prim, hh->id);
+                           __func__, dev_name(&st->dev->dev), hh->prim,
+                           hh->id);
        } else if (lm == 0x8) {
                WARN_ON(lm == 0x8);
                ch = get_channel4id(st, hh->id);
@@ -181,11 +182,12 @@ send_msg_to_layer(struct mISDNstack *st, struct sk_buff *skb)
                else
                        printk(KERN_WARNING
                            "%s: dev(%s) prim(%x) id(%x) no channel\n",
-                           __func__, st->dev->name, hh->prim, hh->id);
+                           __func__, dev_name(&st->dev->dev), hh->prim,
+                           hh->id);
        } else {
                /* broadcast not handled yet */
                printk(KERN_WARNING "%s: dev(%s) prim %x not delivered\n",
-                   __func__, st->dev->name, hh->prim);
+                   __func__, dev_name(&st->dev->dev), hh->prim);
        }
        return -ESRCH;
 }
@@ -209,7 +211,8 @@ mISDNStackd(void *data)
        unlock_kernel();
 #endif
        if (*debug & DEBUG_MSG_THREAD)
-               printk(KERN_DEBUG "mISDNStackd %s started\n", st->dev->name);
+               printk(KERN_DEBUG "mISDNStackd %s started\n",
+                   dev_name(&st->dev->dev));
 
        if (st->notify != NULL) {
                complete(st->notify);
@@ -245,7 +248,7 @@ mISDNStackd(void *data)
                                        printk(KERN_DEBUG
                                            "%s: %s prim(%x) id(%x) "
                                            "send call(%d)\n",
-                                           __func__, st->dev->name,
+                                           __func__, dev_name(&st->dev->dev),
                                            mISDN_HEAD_PRIM(skb),
                                            mISDN_HEAD_ID(skb), err);
                                dev_kfree_skb(skb);
@@ -288,7 +291,7 @@ mISDNStackd(void *data)
                    mISDN_STACK_ACTION_MASK));
                if (*debug & DEBUG_MSG_THREAD)
                        printk(KERN_DEBUG "%s: %s wake status %08lx\n",
-                           __func__, st->dev->name, st->status);
+                           __func__, dev_name(&st->dev->dev), st->status);
                test_and_set_bit(mISDN_STACK_ACTIVE, &st->status);
 
                test_and_clear_bit(mISDN_STACK_WAKEUP, &st->status);
@@ -303,15 +306,16 @@ mISDNStackd(void *data)
 #ifdef MISDN_MSG_STATS
        printk(KERN_DEBUG "mISDNStackd daemon for %s proceed %d "
            "msg %d sleep %d stopped\n",
-           st->dev->name, st->msg_cnt, st->sleep_cnt, st->stopped_cnt);
+           dev_name(&st->dev->dev), st->msg_cnt, st->sleep_cnt,
+           st->stopped_cnt);
        printk(KERN_DEBUG
            "mISDNStackd daemon for %s utime(%ld) stime(%ld)\n",
-           st->dev->name, st->thread->utime, st->thread->stime);
+           dev_name(&st->dev->dev), st->thread->utime, st->thread->stime);
        printk(KERN_DEBUG
            "mISDNStackd daemon for %s nvcsw(%ld) nivcsw(%ld)\n",
-           st->dev->name, st->thread->nvcsw, st->thread->nivcsw);
+           dev_name(&st->dev->dev), st->thread->nvcsw, st->thread->nivcsw);
        printk(KERN_DEBUG "mISDNStackd daemon for %s killed now\n",
-           st->dev->name);
+           dev_name(&st->dev->dev));
 #endif
        test_and_set_bit(mISDN_STACK_KILLED, &st->status);
        test_and_clear_bit(mISDN_STACK_RUNNING, &st->status);
@@ -401,15 +405,16 @@ create_stack(struct mISDNdevice *dev)
        newst->own.send = mISDN_queue_message;
        newst->own.recv = mISDN_queue_message;
        if (*debug & DEBUG_CORE_FUNC)
-               printk(KERN_DEBUG "%s: st(%s)\n", __func__, newst->dev->name);
+               printk(KERN_DEBUG "%s: st(%s)\n", __func__,
+                   dev_name(&newst->dev->dev));
        newst->notify = &done;
        newst->thread = kthread_run(mISDNStackd, (void *)newst, "mISDN_%s",
-               newst->dev->name);
+               dev_name(&newst->dev->dev));
        if (IS_ERR(newst->thread)) {
                err = PTR_ERR(newst->thread);
                printk(KERN_ERR
                        "mISDN:cannot create kernel thread for %s (%d)\n",
-                       newst->dev->name, err);
+                       dev_name(&newst->dev->dev), err);
                delete_teimanager(dev->teimgr);
                kfree(newst);
        } else
@@ -428,8 +433,8 @@ connect_layer1(struct mISDNdevice *dev, struct mISDNchannel *ch,
 
        if (*debug &  DEBUG_CORE_FUNC)
                printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n",
-                       __func__, dev->name, protocol, adr->dev, adr->channel,
-                        adr->sapi, adr->tei);
+                       __func__, dev_name(&dev->dev), protocol, adr->dev,
+                       adr->channel, adr->sapi, adr->tei);
        switch (protocol) {
        case ISDN_P_NT_S0:
        case ISDN_P_NT_E1:
@@ -473,7 +478,7 @@ connect_Bstack(struct mISDNdevice *dev, struct mISDNchannel *ch,
 
        if (*debug &  DEBUG_CORE_FUNC)
                printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n",
-                       __func__, dev->name, protocol,
+                       __func__, dev_name(&dev->dev), protocol,
                        adr->dev, adr->channel, adr->sapi,
                        adr->tei);
        ch->st = dev->D.st;
@@ -529,7 +534,7 @@ create_l2entity(struct mISDNdevice *dev, struct mISDNchannel *ch,
 
        if (*debug &  DEBUG_CORE_FUNC)
                printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n",
-                       __func__, dev->name, protocol,
+                       __func__, dev_name(&dev->dev), protocol,
                        adr->dev, adr->channel, adr->sapi,
                        adr->tei);
        rq.protocol = ISDN_P_TE_S0;
@@ -590,7 +595,7 @@ delete_channel(struct mISDNchannel *ch)
        }
        if (*debug & DEBUG_CORE_FUNC)
                printk(KERN_DEBUG "%s: st(%s) protocol(%x)\n", __func__,
-                   ch->st->dev->name, ch->protocol);
+                   dev_name(&ch->st->dev->dev), ch->protocol);
        if (ch->protocol >= ISDN_P_B_START) {
                if (ch->peer) {
                        ch->peer->ctrl(ch->peer, CLOSE_CHANNEL, NULL);
@@ -643,7 +648,7 @@ delete_stack(struct mISDNdevice *dev)
 
        if (*debug & DEBUG_CORE_FUNC)
                printk(KERN_DEBUG "%s: st(%s)\n", __func__,
-                   st->dev->name);
+                   dev_name(&st->dev->dev));
        if (dev->teimgr)
                delete_teimanager(dev->teimgr);
        if (st->thread) {
index 5c43d19e7c11676716e32be9357452a5f4db8a8c..b452dead8fd04e3fc782ec81fe68914c75f7b6b5 100644 (file)
@@ -968,9 +968,9 @@ create_teimgr(struct manager *mgr, struct channel_req *crq)
 
        if (*debug & DEBUG_L2_TEI)
                printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n",
-                       __func__, mgr->ch.st->dev->name, crq->protocol,
-                       crq->adr.dev, crq->adr.channel, crq->adr.sapi,
-                       crq->adr.tei);
+                       __func__, dev_name(&mgr->ch.st->dev->dev),
+                       crq->protocol, crq->adr.dev, crq->adr.channel,
+                       crq->adr.sapi, crq->adr.tei);
        if (crq->adr.sapi != 0) /* not supported yet */
                return -EINVAL;
        if (crq->adr.tei > GROUP_TEI)
index be09476ed8549af2968065fdebd3525000311a95..a59febb6143a8fdcc1acf6f72a538c3f6a0bf812 100644 (file)
@@ -431,7 +431,6 @@ struct mISDN_sock {
 struct mISDNdevice {
        struct mISDNchannel     D;
        u_int                   id;
-       char                    name[MISDN_MAX_IDLEN];
        u_int                   Dprotocols;
        u_int                   Bprotocols;
        u_int                   nrbchan;