summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_net.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c
index 64977ba4b..2a4d70a5e 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c
@@ -123,7 +123,6 @@ static void hexdump( const unsigned char *buf, unsigned short len )
struct dvb_net_priv {
int in_use;
struct net_device_stats stats;
- char name[7];
u16 pid;
struct dvb_net *host;
struct dmx_demux *demux;
@@ -228,7 +227,7 @@ int ule_bridged_sndu( struct dvb_net_priv *p )
/* BRIDGE SNDU handling sucks in draft-ietf-ipdvb-ule-03.txt.
* This has to be the last extension header, otherwise it won't work.
* Blame the authors!
- */
+ */
p->ule_bridged = 1;
return 0;
}
@@ -237,7 +236,7 @@ int ule_bridged_sndu( struct dvb_net_priv *p )
/** Handle ULE extension headers.
* Function is called after a successful CRC32 verification of an ULE SNDU to complete its decoding.
* Returns: >= 0: nr. of bytes consumed by next extension header
- * -1: Mandatory extension header that is not recognized or TEST SNDU; discard.
+ * -1: Mandatory extension header that is not recognized or TEST SNDU; discard.
*/
static int handle_one_ule_extension( struct dvb_net_priv *p )
{
@@ -1157,30 +1156,25 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
struct dvb_net_priv *priv;
int result;
int if_num;
- char name[20];
-
- memset(name, 0, sizeof(name));
-
+
if (feedtype != DVB_NET_FEEDTYPE_MPE && feedtype != DVB_NET_FEEDTYPE_ULE)
return -EINVAL;
if ((if_num = get_if(dvbnet)) < 0)
return -EINVAL;
- sprintf(name, "dvb%1d%1d%1d",
- dvbnet->dvbdev->adapter->num, dvbnet->dvbdev->id, if_num);
- /* compatibility fix to keep dvb0_0 format */
- if(name[4] == '0')
- name[4] = '_';
-
- net = alloc_netdev(sizeof(struct dvb_net_priv), name,
- dvb_net_setup);
+ net = alloc_netdev(sizeof(struct dvb_net_priv), "dvb", dvb_net_setup);
if (!net)
return -ENOMEM;
- sprintf(net->name, "%s", name);
- printk("dvb_net: created network interface %s\n", net->name);
-
- net->addr_len = 6;
+ if (dvbnet->dvbdev->id)
+ snprintf(net->name, IFNAMSIZ, "dvb%d%u%d",
+ dvbnet->dvbdev->adapter->num, dvbnet->dvbdev->id, if_num);
+ else
+ /* compatibility fix to keep dvb0_0 format */
+ snprintf(net->name, IFNAMSIZ, "dvb%d_%d",
+ dvbnet->dvbdev->adapter->num, if_num);
+
+ net->addr_len = 6;
memcpy(net->dev_addr, dvbnet->dvbdev->adapter->proposed_mac, 6);
dvbnet->device[if_num] = net;
@@ -1204,6 +1198,7 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
free_netdev(net);
return result;
}
+ printk("dvb_net: created network interface %s\n", net->name);
return if_num;
}
@@ -1222,7 +1217,7 @@ static int dvb_net_remove_if(struct dvb_net *dvbnet, unsigned int num)
dvb_net_stop(net);
flush_scheduled_work();
printk("dvb_net: removed network interface %s\n", net->name);
- unregister_netdev(net);
+ unregister_netdev(net);
dvbnet->state[num]=0;
dvbnet->device[num] = NULL;
free_netdev(net);
@@ -1247,7 +1242,7 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
-
+
if (!try_module_get(dvbdev->adapter->module))
return -EPERM;