diff options
| author | Max Filippov <jcmvbkbc@gmail.com> | 2013-11-10 07:05:44 -0500 |
|---|---|---|
| committer | Chris Zankel <chris@zankel.net> | 2014-01-14 13:19:48 -0500 |
| commit | 3f3cd60bbd376e52ef91c92d0dba95b8942ebfcc (patch) | |
| tree | a64df8deb0a459f0fb70088afcca807dac93c6de /arch/xtensa/platforms | |
| parent | ea1d3ed3cfde34914a517f97320b80d9ccee7507 (diff) | |
xtensa: ISS: clean up iss-network driver
No functional changes, remove dead/unused code, clean checkpatch warnings,
replace strlen of constant strings with sizeof.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa/platforms')
| -rw-r--r-- | arch/xtensa/platforms/iss/network.c | 176 |
1 files changed, 52 insertions, 124 deletions
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c index e9e1aad8c271..6d9cc455eae1 100644 --- a/arch/xtensa/platforms/iss/network.c +++ b/arch/xtensa/platforms/iss/network.c | |||
| @@ -57,7 +57,6 @@ static LIST_HEAD(devices); | |||
| 57 | struct tuntap_info { | 57 | struct tuntap_info { |
| 58 | char dev_name[IFNAMSIZ]; | 58 | char dev_name[IFNAMSIZ]; |
| 59 | int fixed_config; | 59 | int fixed_config; |
| 60 | unsigned char gw[ETH_ALEN]; | ||
| 61 | int fd; | 60 | int fd; |
| 62 | }; | 61 | }; |
| 63 | 62 | ||
| @@ -67,7 +66,6 @@ struct tuntap_info { | |||
| 67 | /* This structure contains out private information for the driver. */ | 66 | /* This structure contains out private information for the driver. */ |
| 68 | 67 | ||
| 69 | struct iss_net_private { | 68 | struct iss_net_private { |
| 70 | |||
| 71 | struct list_head device_list; | 69 | struct list_head device_list; |
| 72 | struct list_head opened_list; | 70 | struct list_head opened_list; |
| 73 | 71 | ||
| @@ -118,7 +116,7 @@ static char *split_if_spec(char *str, ...) | |||
| 118 | *arg = str; | 116 | *arg = str; |
| 119 | if (end == NULL) | 117 | if (end == NULL) |
| 120 | return NULL; | 118 | return NULL; |
| 121 | *end ++ = '\0'; | 119 | *end++ = '\0'; |
| 122 | str = end; | 120 | str = end; |
| 123 | } | 121 | } |
| 124 | va_end(ap); | 122 | va_end(ap); |
| @@ -126,25 +124,6 @@ static char *split_if_spec(char *str, ...) | |||
| 126 | } | 124 | } |
| 127 | 125 | ||
| 128 | 126 | ||
| 129 | #if 0 | ||
| 130 | /* Adjust SKB. */ | ||
| 131 | |||
| 132 | struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra) | ||
| 133 | { | ||
| 134 | if ((skb != NULL) && (skb_tailroom(skb) < extra)) { | ||
| 135 | struct sk_buff *skb2; | ||
| 136 | |||
| 137 | skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC); | ||
| 138 | dev_kfree_skb(skb); | ||
| 139 | skb = skb2; | ||
| 140 | } | ||
| 141 | if (skb != NULL) | ||
| 142 | skb_put(skb, extra); | ||
| 143 | |||
| 144 | return skb; | ||
| 145 | } | ||
| 146 | #endif | ||
| 147 | |||
| 148 | /* Return the IP address as a string for a given device. */ | 127 | /* Return the IP address as a string for a given device. */ |
| 149 | 128 | ||
| 150 | static void dev_ip_addr(void *d, char *buf, char *bin_buf) | 129 | static void dev_ip_addr(void *d, char *buf, char *bin_buf) |
| @@ -154,11 +133,13 @@ static void dev_ip_addr(void *d, char *buf, char *bin_buf) | |||
| 154 | struct in_ifaddr *in; | 133 | struct in_ifaddr *in; |
| 155 | __be32 addr; | 134 | __be32 addr; |
| 156 | 135 | ||
| 157 | if ((ip == NULL) || ((in = ip->ifa_list) == NULL)) { | 136 | if (ip == NULL || ip->ifa_list == NULL) { |
| 158 | printk(KERN_WARNING "Device not assigned an IP address!\n"); | 137 | pr_warn("Device not assigned an IP address!\n"); |
| 159 | return; | 138 | return; |
| 160 | } | 139 | } |
| 161 | 140 | ||
| 141 | in = ip->ifa_list; | ||
| 142 | |||
| 162 | addr = in->ifa_address; | 143 | addr = in->ifa_address; |
| 163 | sprintf(buf, "%d.%d.%d.%d", addr & 0xff, (addr >> 8) & 0xff, | 144 | sprintf(buf, "%d.%d.%d.%d", addr & 0xff, (addr >> 8) & 0xff, |
| 164 | (addr >> 16) & 0xff, addr >> 24); | 145 | (addr >> 16) & 0xff, addr >> 24); |
| @@ -173,7 +154,7 @@ static void dev_ip_addr(void *d, char *buf, char *bin_buf) | |||
| 173 | 154 | ||
| 174 | /* Set Ethernet address of the specified device. */ | 155 | /* Set Ethernet address of the specified device. */ |
| 175 | 156 | ||
| 176 | static void inline set_ether_mac(void *d, unsigned char *addr) | 157 | static inline void set_ether_mac(void *d, unsigned char *addr) |
| 177 | { | 158 | { |
| 178 | struct net_device *dev = d; | 159 | struct net_device *dev = d; |
| 179 | memcpy(dev->dev_addr, addr, ETH_ALEN); | 160 | memcpy(dev->dev_addr, addr, ETH_ALEN); |
| @@ -194,19 +175,21 @@ static int tuntap_open(struct iss_net_private *lp) | |||
| 194 | if (!lp->tp.info.tuntap.fixed_config) | 175 | if (!lp->tp.info.tuntap.fixed_config) |
| 195 | return -EINVAL; | 176 | return -EINVAL; |
| 196 | 177 | ||
| 197 | if ((fd = simc_open("/dev/net/tun", 02, 0)) < 0) { /* O_RDWR */ | 178 | fd = simc_open("/dev/net/tun", 02, 0); /* O_RDWR */ |
| 198 | printk("Failed to open /dev/net/tun, returned %d " | 179 | if (fd < 0) { |
| 199 | "(errno = %d)\n", fd, errno); | 180 | pr_err("Failed to open /dev/net/tun, returned %d (errno = %d)\n", |
| 181 | fd, errno); | ||
| 200 | return fd; | 182 | return fd; |
| 201 | } | 183 | } |
| 202 | 184 | ||
| 203 | memset(&ifr, 0, sizeof ifr); | 185 | memset(&ifr, 0, sizeof(ifr)); |
| 204 | ifr.ifr_flags = IFF_TAP | IFF_NO_PI; | 186 | ifr.ifr_flags = IFF_TAP | IFF_NO_PI; |
| 205 | strlcpy(ifr.ifr_name, dev_name, sizeof ifr.ifr_name); | 187 | strlcpy(ifr.ifr_name, dev_name, sizeof(ifr.ifr_name)); |
| 206 | 188 | ||
| 207 | if ((err = simc_ioctl(fd, TUNSETIFF, (void*) &ifr)) < 0) { | 189 | err = simc_ioctl(fd, TUNSETIFF, &ifr); |
| 208 | printk("Failed to set interface, returned %d " | 190 | if (err < 0) { |
| 209 | "(errno = %d)\n", err, errno); | 191 | pr_err("Failed to set interface, returned %d (errno = %d)\n", |
| 192 | err, errno); | ||
| 210 | simc_close(fd); | 193 | simc_close(fd); |
| 211 | return err; | 194 | return err; |
| 212 | } | 195 | } |
| @@ -217,27 +200,17 @@ static int tuntap_open(struct iss_net_private *lp) | |||
| 217 | 200 | ||
| 218 | static void tuntap_close(struct iss_net_private *lp) | 201 | static void tuntap_close(struct iss_net_private *lp) |
| 219 | { | 202 | { |
| 220 | #if 0 | ||
| 221 | if (lp->tp.info.tuntap.fixed_config) | ||
| 222 | iter_addresses(lp->tp.info.tuntap.dev, close_addr, lp->host.dev_name); | ||
| 223 | #endif | ||
| 224 | simc_close(lp->tp.info.tuntap.fd); | 203 | simc_close(lp->tp.info.tuntap.fd); |
| 225 | lp->tp.info.tuntap.fd = -1; | 204 | lp->tp.info.tuntap.fd = -1; |
| 226 | } | 205 | } |
| 227 | 206 | ||
| 228 | static int tuntap_read (struct iss_net_private *lp, struct sk_buff **skb) | 207 | static int tuntap_read(struct iss_net_private *lp, struct sk_buff **skb) |
| 229 | { | 208 | { |
| 230 | #if 0 | ||
| 231 | *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); | ||
| 232 | if (*skb == NULL) | ||
| 233 | return -ENOMEM; | ||
| 234 | #endif | ||
| 235 | |||
| 236 | return simc_read(lp->tp.info.tuntap.fd, | 209 | return simc_read(lp->tp.info.tuntap.fd, |
| 237 | (*skb)->data, (*skb)->dev->mtu + ETH_HEADER_OTHER); | 210 | (*skb)->data, (*skb)->dev->mtu + ETH_HEADER_OTHER); |
| 238 | } | 211 | } |
| 239 | 212 | ||
| 240 | static int tuntap_write (struct iss_net_private *lp, struct sk_buff **skb) | 213 | static int tuntap_write(struct iss_net_private *lp, struct sk_buff **skb) |
| 241 | { | 214 | { |
| 242 | return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len); | 215 | return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len); |
| 243 | } | 216 | } |
| @@ -259,40 +232,36 @@ static int tuntap_poll(struct iss_net_private *lp) | |||
| 259 | 232 | ||
| 260 | static int tuntap_probe(struct iss_net_private *lp, int index, char *init) | 233 | static int tuntap_probe(struct iss_net_private *lp, int index, char *init) |
| 261 | { | 234 | { |
| 262 | const int len = strlen(TRANSPORT_TUNTAP_NAME); | ||
| 263 | char *dev_name = NULL, *mac_str = NULL, *rem = NULL; | 235 | char *dev_name = NULL, *mac_str = NULL, *rem = NULL; |
| 264 | 236 | ||
| 265 | /* Transport should be 'tuntap': ethX=tuntap,mac,dev_name */ | 237 | /* Transport should be 'tuntap': ethX=tuntap,mac,dev_name */ |
| 266 | 238 | ||
| 267 | if (strncmp(init, TRANSPORT_TUNTAP_NAME, len)) | 239 | if (strncmp(init, TRANSPORT_TUNTAP_NAME, |
| 240 | sizeof(TRANSPORT_TUNTAP_NAME) - 1)) | ||
| 268 | return 0; | 241 | return 0; |
| 269 | 242 | ||
| 270 | if (*(init += strlen(TRANSPORT_TUNTAP_NAME)) == ',') { | 243 | init += sizeof(TRANSPORT_TUNTAP_NAME) - 1; |
| 271 | if ((rem=split_if_spec(init+1, &mac_str, &dev_name)) != NULL) { | 244 | if (*init == ',') { |
| 272 | printk("Extra garbage on specification : '%s'\n", rem); | 245 | rem = split_if_spec(init + 1, &mac_str, &dev_name); |
| 246 | if (rem != NULL) { | ||
| 247 | pr_err("Extra garbage on specification : '%s'\n", rem); | ||
| 273 | return 0; | 248 | return 0; |
| 274 | } | 249 | } |
| 275 | } else if (*init != '\0') { | 250 | } else if (*init != '\0') { |
| 276 | printk("Invalid argument: %s. Skipping device!\n", init); | 251 | pr_err("Invalid argument: %s. Skipping device!\n", init); |
| 277 | return 0; | 252 | return 0; |
| 278 | } | 253 | } |
| 279 | 254 | ||
| 280 | if (dev_name) { | 255 | if (dev_name) { |
| 281 | strncpy(lp->tp.info.tuntap.dev_name, dev_name, | 256 | strlcpy(lp->tp.info.tuntap.dev_name, dev_name, |
| 282 | sizeof lp->tp.info.tuntap.dev_name); | 257 | sizeof(lp->tp.info.tuntap.dev_name)); |
| 283 | lp->tp.info.tuntap.fixed_config = 1; | 258 | lp->tp.info.tuntap.fixed_config = 1; |
| 284 | } else | 259 | } else |
| 285 | strcpy(lp->tp.info.tuntap.dev_name, TRANSPORT_TUNTAP_NAME); | 260 | strcpy(lp->tp.info.tuntap.dev_name, TRANSPORT_TUNTAP_NAME); |
| 286 | 261 | ||
| 287 | 262 | ||
| 288 | #if 0 | ||
| 289 | if (setup_etheraddr(mac_str, lp->mac)) | ||
| 290 | lp->have_mac = 1; | ||
| 291 | #endif | ||
| 292 | lp->mtu = TRANSPORT_TUNTAP_MTU; | 263 | lp->mtu = TRANSPORT_TUNTAP_MTU; |
| 293 | 264 | ||
| 294 | //lp->info.tuntap.gate_addr = gate_addr; | ||
| 295 | |||
| 296 | lp->tp.info.tuntap.fd = -1; | 265 | lp->tp.info.tuntap.fd = -1; |
| 297 | 266 | ||
| 298 | lp->tp.open = tuntap_open; | 267 | lp->tp.open = tuntap_open; |
| @@ -302,12 +271,7 @@ static int tuntap_probe(struct iss_net_private *lp, int index, char *init) | |||
| 302 | lp->tp.protocol = tuntap_protocol; | 271 | lp->tp.protocol = tuntap_protocol; |
| 303 | lp->tp.poll = tuntap_poll; | 272 | lp->tp.poll = tuntap_poll; |
| 304 | 273 | ||
| 305 | printk("TUN/TAP backend - "); | 274 | pr_info("TUN/TAP backend -\n"); |
| 306 | #if 0 | ||
| 307 | if (lp->host.gate_addr != NULL) | ||
| 308 | printk("IP = %s", lp->host.gate_addr); | ||
| 309 | #endif | ||
| 310 | printk("\n"); | ||
| 311 | 275 | ||
| 312 | return 1; | 276 | return 1; |
| 313 | } | 277 | } |
| @@ -327,7 +291,8 @@ static int iss_net_rx(struct net_device *dev) | |||
| 327 | 291 | ||
| 328 | /* Try to allocate memory, if it fails, try again next round. */ | 292 | /* Try to allocate memory, if it fails, try again next round. */ |
| 329 | 293 | ||
| 330 | if ((skb = dev_alloc_skb(dev->mtu + 2 + ETH_HEADER_OTHER)) == NULL) { | 294 | skb = dev_alloc_skb(dev->mtu + 2 + ETH_HEADER_OTHER); |
| 295 | if (skb == NULL) { | ||
| 331 | lp->stats.rx_dropped++; | 296 | lp->stats.rx_dropped++; |
| 332 | return 0; | 297 | return 0; |
| 333 | } | 298 | } |
| @@ -347,7 +312,6 @@ static int iss_net_rx(struct net_device *dev) | |||
| 347 | 312 | ||
| 348 | lp->stats.rx_bytes += skb->len; | 313 | lp->stats.rx_bytes += skb->len; |
| 349 | lp->stats.rx_packets++; | 314 | lp->stats.rx_packets++; |
| 350 | // netif_rx(skb); | ||
| 351 | netif_rx_ni(skb); | 315 | netif_rx_ni(skb); |
| 352 | return pkt_len; | 316 | return pkt_len; |
| 353 | } | 317 | } |
| @@ -378,11 +342,11 @@ static int iss_net_poll(void) | |||
| 378 | spin_unlock(&lp->lock); | 342 | spin_unlock(&lp->lock); |
| 379 | 343 | ||
| 380 | if (err < 0) { | 344 | if (err < 0) { |
| 381 | printk(KERN_ERR "Device '%s' read returned %d, " | 345 | pr_err("Device '%s' read returned %d, shutting it down\n", |
| 382 | "shutting it down\n", lp->dev->name, err); | 346 | lp->dev->name, err); |
| 383 | dev_close(lp->dev); | 347 | dev_close(lp->dev); |
| 384 | } else { | 348 | } else { |
| 385 | // FIXME reactivate_fd(lp->fd, ISS_ETH_IRQ); | 349 | /* FIXME reactivate_fd(lp->fd, ISS_ETH_IRQ); */ |
| 386 | } | 350 | } |
| 387 | } | 351 | } |
| 388 | 352 | ||
| @@ -393,14 +357,11 @@ static int iss_net_poll(void) | |||
| 393 | 357 | ||
| 394 | static void iss_net_timer(unsigned long priv) | 358 | static void iss_net_timer(unsigned long priv) |
| 395 | { | 359 | { |
| 396 | struct iss_net_private* lp = (struct iss_net_private*) priv; | 360 | struct iss_net_private *lp = (struct iss_net_private *)priv; |
| 397 | 361 | ||
| 398 | spin_lock(&lp->lock); | 362 | spin_lock(&lp->lock); |
| 399 | |||
| 400 | iss_net_poll(); | 363 | iss_net_poll(); |
| 401 | |||
| 402 | mod_timer(&lp->timer, jiffies + lp->timer_val); | 364 | mod_timer(&lp->timer, jiffies + lp->timer_val); |
| 403 | |||
| 404 | spin_unlock(&lp->lock); | 365 | spin_unlock(&lp->lock); |
| 405 | } | 366 | } |
| 406 | 367 | ||
| @@ -408,12 +369,13 @@ static void iss_net_timer(unsigned long priv) | |||
| 408 | static int iss_net_open(struct net_device *dev) | 369 | static int iss_net_open(struct net_device *dev) |
| 409 | { | 370 | { |
| 410 | struct iss_net_private *lp = netdev_priv(dev); | 371 | struct iss_net_private *lp = netdev_priv(dev); |
| 411 | char addr[sizeof "255.255.255.255\0"]; | 372 | char addr[sizeof("255.255.255.255\0")]; |
| 412 | int err; | 373 | int err; |
| 413 | 374 | ||
| 414 | spin_lock(&lp->lock); | 375 | spin_lock(&lp->lock); |
| 415 | 376 | ||
| 416 | if ((err = lp->tp.open(lp)) < 0) | 377 | err = lp->tp.open(lp); |
| 378 | if (err < 0) | ||
| 417 | goto out; | 379 | goto out; |
| 418 | 380 | ||
| 419 | if (!lp->have_mac) { | 381 | if (!lp->have_mac) { |
| @@ -448,7 +410,6 @@ out: | |||
| 448 | static int iss_net_close(struct net_device *dev) | 410 | static int iss_net_close(struct net_device *dev) |
| 449 | { | 411 | { |
| 450 | struct iss_net_private *lp = netdev_priv(dev); | 412 | struct iss_net_private *lp = netdev_priv(dev); |
| 451 | printk("iss_net_close!\n"); | ||
| 452 | netif_stop_queue(dev); | 413 | netif_stop_queue(dev); |
| 453 | spin_lock(&lp->lock); | 414 | spin_lock(&lp->lock); |
| 454 | 415 | ||
| @@ -490,7 +451,7 @@ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 490 | 451 | ||
| 491 | } else { | 452 | } else { |
| 492 | netif_start_queue(dev); | 453 | netif_start_queue(dev); |
| 493 | printk(KERN_ERR "iss_net_start_xmit: failed(%d)\n", len); | 454 | pr_err("iss_net_start_xmit: failed(%d)\n", len); |
| 494 | } | 455 | } |
| 495 | 456 | ||
| 496 | spin_unlock_irqrestore(&lp->lock, flags); | 457 | spin_unlock_irqrestore(&lp->lock, flags); |
| @@ -508,22 +469,10 @@ static struct net_device_stats *iss_net_get_stats(struct net_device *dev) | |||
| 508 | 469 | ||
| 509 | static void iss_net_set_multicast_list(struct net_device *dev) | 470 | static void iss_net_set_multicast_list(struct net_device *dev) |
| 510 | { | 471 | { |
| 511 | #if 0 | ||
| 512 | if (dev->flags & IFF_PROMISC) | ||
| 513 | return; | ||
| 514 | else if (!netdev_mc_empty(dev)) | ||
| 515 | dev->flags |= IFF_ALLMULTI; | ||
| 516 | else | ||
| 517 | dev->flags &= ~IFF_ALLMULTI; | ||
| 518 | #endif | ||
| 519 | } | 472 | } |
| 520 | 473 | ||
| 521 | static void iss_net_tx_timeout(struct net_device *dev) | 474 | static void iss_net_tx_timeout(struct net_device *dev) |
| 522 | { | 475 | { |
| 523 | #if 0 | ||
| 524 | dev->trans_start = jiffies; | ||
| 525 | netif_wake_queue(dev); | ||
| 526 | #endif | ||
| 527 | } | 476 | } |
| 528 | 477 | ||
| 529 | static int iss_net_set_mac(struct net_device *dev, void *addr) | 478 | static int iss_net_set_mac(struct net_device *dev, void *addr) |
| @@ -542,22 +491,6 @@ static int iss_net_set_mac(struct net_device *dev, void *addr) | |||
| 542 | 491 | ||
| 543 | static int iss_net_change_mtu(struct net_device *dev, int new_mtu) | 492 | static int iss_net_change_mtu(struct net_device *dev, int new_mtu) |
| 544 | { | 493 | { |
| 545 | #if 0 | ||
| 546 | struct iss_net_private *lp = netdev_priv(dev); | ||
| 547 | int err = 0; | ||
| 548 | |||
| 549 | spin_lock(&lp->lock); | ||
| 550 | |||
| 551 | // FIXME not needed new_mtu = transport_set_mtu(new_mtu, &lp->user); | ||
| 552 | |||
| 553 | if (new_mtu < 0) | ||
| 554 | err = new_mtu; | ||
| 555 | else | ||
| 556 | dev->mtu = new_mtu; | ||
| 557 | |||
| 558 | spin_unlock(&lp->lock); | ||
| 559 | return err; | ||
| 560 | #endif | ||
| 561 | return -EINVAL; | 494 | return -EINVAL; |
| 562 | } | 495 | } |
| 563 | 496 | ||
| @@ -582,7 +515,6 @@ static const struct net_device_ops iss_netdev_ops = { | |||
| 582 | .ndo_validate_addr = eth_validate_addr, | 515 | .ndo_validate_addr = eth_validate_addr, |
| 583 | .ndo_change_mtu = iss_net_change_mtu, | 516 | .ndo_change_mtu = iss_net_change_mtu, |
| 584 | .ndo_set_mac_address = iss_net_set_mac, | 517 | .ndo_set_mac_address = iss_net_set_mac, |
| 585 | //.ndo_do_ioctl = iss_net_ioctl, | ||
| 586 | .ndo_tx_timeout = iss_net_tx_timeout, | 518 | .ndo_tx_timeout = iss_net_tx_timeout, |
| 587 | .ndo_set_rx_mode = iss_net_set_multicast_list, | 519 | .ndo_set_rx_mode = iss_net_set_multicast_list, |
| 588 | }; | 520 | }; |
| @@ -593,24 +525,24 @@ static int iss_net_configure(int index, char *init) | |||
| 593 | struct iss_net_private *lp; | 525 | struct iss_net_private *lp; |
| 594 | int err; | 526 | int err; |
| 595 | 527 | ||
| 596 | if ((dev = alloc_etherdev(sizeof *lp)) == NULL) { | 528 | dev = alloc_etherdev(sizeof(*lp)); |
| 597 | printk(KERN_ERR "eth_configure: failed to allocate device\n"); | 529 | if (dev == NULL) { |
| 530 | pr_err("eth_configure: failed to allocate device\n"); | ||
| 598 | return 1; | 531 | return 1; |
| 599 | } | 532 | } |
| 600 | 533 | ||
| 601 | /* Initialize private element. */ | 534 | /* Initialize private element. */ |
| 602 | 535 | ||
| 603 | lp = netdev_priv(dev); | 536 | lp = netdev_priv(dev); |
| 604 | *lp = ((struct iss_net_private) { | 537 | *lp = (struct iss_net_private) { |
| 605 | .device_list = LIST_HEAD_INIT(lp->device_list), | 538 | .device_list = LIST_HEAD_INIT(lp->device_list), |
| 606 | .opened_list = LIST_HEAD_INIT(lp->opened_list), | 539 | .opened_list = LIST_HEAD_INIT(lp->opened_list), |
| 607 | .lock = __SPIN_LOCK_UNLOCKED(lp.lock), | 540 | .lock = __SPIN_LOCK_UNLOCKED(lp.lock), |
| 608 | .dev = dev, | 541 | .dev = dev, |
| 609 | .index = index, | 542 | .index = index, |
| 610 | //.fd = -1, | ||
| 611 | .mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0 }, | 543 | .mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0 }, |
| 612 | .have_mac = 0, | 544 | .have_mac = 0, |
| 613 | }); | 545 | }; |
| 614 | 546 | ||
| 615 | /* | 547 | /* |
| 616 | * Try all transport protocols. | 548 | * Try all transport protocols. |
| @@ -618,7 +550,7 @@ static int iss_net_configure(int index, char *init) | |||
| 618 | */ | 550 | */ |
| 619 | 551 | ||
| 620 | if (!tuntap_probe(lp, index, init)) { | 552 | if (!tuntap_probe(lp, index, init)) { |
| 621 | printk("Invalid arguments. Skipping device!\n"); | 553 | pr_err("Invalid arguments. Skipping device!\n"); |
| 622 | goto errout; | 554 | goto errout; |
| 623 | } | 555 | } |
| 624 | 556 | ||
| @@ -641,14 +573,14 @@ static int iss_net_configure(int index, char *init) | |||
| 641 | lp->pdev.id = index; | 573 | lp->pdev.id = index; |
| 642 | lp->pdev.name = DRIVER_NAME; | 574 | lp->pdev.name = DRIVER_NAME; |
| 643 | platform_device_register(&lp->pdev); | 575 | platform_device_register(&lp->pdev); |
| 644 | SET_NETDEV_DEV(dev,&lp->pdev.dev); | 576 | SET_NETDEV_DEV(dev, &lp->pdev.dev); |
| 645 | 577 | ||
| 646 | /* | 578 | /* |
| 647 | * If this name ends up conflicting with an existing registered | 579 | * If this name ends up conflicting with an existing registered |
| 648 | * netdevice, that is OK, register_netdev{,ice}() will notice this | 580 | * netdevice, that is OK, register_netdev{,ice}() will notice this |
| 649 | * and fail. | 581 | * and fail. |
| 650 | */ | 582 | */ |
| 651 | snprintf(dev->name, sizeof dev->name, "eth%d", index); | 583 | snprintf(dev->name, sizeof(dev->name), "eth%d", index); |
| 652 | 584 | ||
| 653 | dev->netdev_ops = &iss_netdev_ops; | 585 | dev->netdev_ops = &iss_netdev_ops; |
| 654 | dev->mtu = lp->mtu; | 586 | dev->mtu = lp->mtu; |
| @@ -660,7 +592,7 @@ static int iss_net_configure(int index, char *init) | |||
| 660 | rtnl_unlock(); | 592 | rtnl_unlock(); |
| 661 | 593 | ||
| 662 | if (err) { | 594 | if (err) { |
| 663 | printk("Error registering net device!\n"); | 595 | pr_err("Error registering net device!\n"); |
| 664 | /* XXX: should we call ->remove() here? */ | 596 | /* XXX: should we call ->remove() here? */ |
| 665 | free_netdev(dev); | 597 | free_netdev(dev); |
| 666 | return 1; | 598 | return 1; |
| @@ -669,16 +601,11 @@ static int iss_net_configure(int index, char *init) | |||
| 669 | init_timer(&lp->tl); | 601 | init_timer(&lp->tl); |
| 670 | lp->tl.function = iss_net_user_timer_expire; | 602 | lp->tl.function = iss_net_user_timer_expire; |
| 671 | 603 | ||
| 672 | #if 0 | ||
| 673 | if (lp->have_mac) | ||
| 674 | set_ether_mac(dev, lp->mac); | ||
| 675 | #endif | ||
| 676 | return 0; | 604 | return 0; |
| 677 | 605 | ||
| 678 | errout: | 606 | errout: |
| 679 | // FIXME: unregister; free, etc.. | 607 | /* FIXME: unregister; free, etc.. */ |
| 680 | return -EIO; | 608 | return -EIO; |
| 681 | |||
| 682 | } | 609 | } |
| 683 | 610 | ||
| 684 | /* ------------------------------------------------------------------------- */ | 611 | /* ------------------------------------------------------------------------- */ |
| @@ -717,7 +644,8 @@ static int __init iss_net_setup(char *str) | |||
| 717 | printk(ERR "Device %d is negative\n", n); | 644 | printk(ERR "Device %d is negative\n", n); |
| 718 | return 1; | 645 | return 1; |
| 719 | } | 646 | } |
| 720 | if (*(str = end) != '=') { | 647 | str = end; |
| 648 | if (*str != '=') { | ||
| 721 | printk(ERR "Expected '=' after device number\n"); | 649 | printk(ERR "Expected '=' after device number\n"); |
| 722 | return 1; | 650 | return 1; |
| 723 | } | 651 | } |
| @@ -739,7 +667,7 @@ static int __init iss_net_setup(char *str) | |||
| 739 | 667 | ||
| 740 | new = alloc_bootmem(sizeof(*new)); | 668 | new = alloc_bootmem(sizeof(*new)); |
| 741 | if (new == NULL) { | 669 | if (new == NULL) { |
| 742 | printk("Alloc_bootmem failed\n"); | 670 | printk(ERR "Alloc_bootmem failed\n"); |
| 743 | return 1; | 671 | return 1; |
| 744 | } | 672 | } |
| 745 | 673 | ||
