summaryrefslogtreecommitdiff
path: root/cleopatre
diff options
context:
space:
mode:
authorNicolas Schodet2011-09-02 16:50:45 +0200
committerNicolas Schodet2011-12-20 15:42:43 +0100
commite630c0903e17d697339edd29172b9439788d9348 (patch)
tree56a3505cd22088c0df7674fa2f01b2ddcdc04b6d /cleopatre
parentc09ec495214bb068ce01871a016604604f721b07 (diff)
cleopatre/devkit/plcdrv: create net device uninit function, refs #2701
This function is symmetric to init function. Also private part kfree is removed, this is done in free_netdev.
Diffstat (limited to 'cleopatre')
-rw-r--r--cleopatre/devkit/plcdrv/arm/src/linux_drv.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/cleopatre/devkit/plcdrv/arm/src/linux_drv.c b/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
index 19475cd363..df5444b19e 100644
--- a/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
+++ b/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
@@ -153,6 +153,9 @@ module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Let's the user start PLC Processor by debugger");
module_param(trace, uint, 0644);
+void plcdrv_uninit(struct net_device *dev);
+
+
static const unsigned char __hexdigits[] = "0123456789ABCDEF";
static void sprintf_hex(unsigned char * str, const unsigned char * ptr, int len, unsigned char delim)
{
@@ -1781,6 +1784,7 @@ int plcdrv_init(struct net_device *dev)
//Initialise device functions
ether_setup(dev);
+ dev->uninit = plcdrv_uninit;
dev->open = plcdrv_open;
dev->stop = plcdrv_stop;
dev->do_ioctl = plcdrv_ioctl;
@@ -1812,6 +1816,26 @@ int plcdrv_init(struct net_device *dev)
return 0;
}// plcdrv_init
+/**
+ * Uninitialise the network device.
+ *
+ * \param dev device structure.
+ */
+void plcdrv_uninit(struct net_device *dev)
+{
+ struct net_priv *priv;
+ BUG_ON(!dev);
+ priv = (struct net_priv *)dev->priv;
+ BUG_ON(!priv);
+
+ //Kill tasklet for reception
+ tasklet_kill(&priv->tasklet_it_rx);
+
+ //Unmap IP address
+ BUG_ON(!dev->base_addr);
+ iounmap((void*)dev->base_addr);
+}// plcdrv_uninit
+
/** Character device functions */
static struct file_operations plcdrv_char_fops = {
.owner = THIS_MODULE,
@@ -1925,7 +1949,6 @@ int __init plcdrv_module_init(void)
*/
void __exit plcdrv_module_exit(void)
{
- struct net_priv *priv = NULL;
//Unregister character device
cdev_del(&plcdrv_char_dev);
@@ -1940,20 +1963,6 @@ void __exit plcdrv_module_exit(void)
remove_proc_entry("version", proc_plc_dir);
remove_proc_entry("plc", init_net.proc_net);
- //Unmap IP address
- if(plcdrv_device->base_addr)
- iounmap((void*)plcdrv_device->base_addr);
-
- priv = plcdrv_device->priv;
- if(priv)
- {
- //Kill tasklet for reception
- tasklet_kill(&priv->tasklet_it_rx);
-
- //Freeing private field of the net device structure
- kfree(priv);
- }
-
//Unregister net device
unregister_netdev(plcdrv_device);