[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH] cdi: Move send_packet into cdi_net_driver



* cdi: send_packet is currently in cdi_net_device despite being driver
  specific and not device specific. Move it to cdi_net_driver.

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 e1000/device.c    |    1 -
 e1000/main.c      |    2 ++
 include/cdi/net.h |    6 +++---
 ne2k/main.c       |    2 ++
 ne2k/ne2k.c       |    1 -
 pcnet/main.c      |    2 ++
 pcnet/pcnet.c     |    1 -
 rtl8139/main.c    |    2 ++
 rtl8139/rtl8139.c |    1 -
 sis900/device.c   |    1 -
 sis900/main.c     |    2 ++
 11 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/e1000/device.c b/e1000/device.c
index b4aa4eb..b21df2f 100644
--- a/e1000/device.c
+++ b/e1000/device.c
@@ -159,7 +159,6 @@ struct cdi_device* e1000_init_device(struct cdi_bus_data* bus_data)
     cdi_alloc_phys_mem(sizeof(*netcard), (void**) &netcard, &phys_device);
     memset(netcard, 0, sizeof(*netcard));
 
-    netcard->net.send_packet = e1000_send_packet;
     netcard->phys = phys_device;
     netcard->net.dev.bus_data = (struct cdi_bus_data*) pci;
 
diff --git a/e1000/main.c b/e1000/main.c
index faf6f2e..dbbe80d 100644
--- a/e1000/main.c
+++ b/e1000/main.c
@@ -75,6 +75,8 @@ static struct cdi_net_driver driver = {
         .init_device    = e1000_init_device,
         .remove_device  = e1000_remove_device,
     },
+
+    .send_packet        = e1000_send_packet,
 };
 
 CDI_DRIVER(DRIVER_NAME, driver)
diff --git a/include/cdi/net.h b/include/cdi/net.h
index 1fddab6..9d4f0f0 100644
--- a/include/cdi/net.h
+++ b/include/cdi/net.h
@@ -26,13 +26,13 @@ struct cdi_net_device {
     struct cdi_device   dev;
     uint64_t            mac : 48;
     int                 number;
-
-    void (*send_packet)
-        (struct cdi_net_device* device, void* data, size_t size);
 };
 
 struct cdi_net_driver {
     struct cdi_driver   drv;
+
+    void (*send_packet)
+        (struct cdi_net_device* device, void* data, size_t size);
 };
 
 
diff --git a/ne2k/main.c b/ne2k/main.c
index 35f31b4..636a76d 100644
--- a/ne2k/main.c
+++ b/ne2k/main.c
@@ -70,6 +70,8 @@ static struct cdi_net_driver ne2k_driver = {
         .init_device    = ne2k_init_device,
         .remove_device  = ne2k_remove_device,
     },
+
+    .send_packet        = ne2k_send_packet,
 };
 
 CDI_DRIVER(DRIVER_NAME, ne2k_driver)
diff --git a/ne2k/ne2k.c b/ne2k/ne2k.c
index b3faf46..7f1262e 100644
--- a/ne2k/ne2k.c
+++ b/ne2k/ne2k.c
@@ -90,7 +90,6 @@ struct cdi_device* ne2k_init_device(struct cdi_bus_data* bus_data)
     cdi_alloc_phys_mem(sizeof(*netcard), (void**) &netcard, &phys_device);
     memset(netcard, 0, sizeof(*netcard));
 
-    netcard->net.send_packet = ne2k_send_packet;
     netcard->phys = phys_device;
     netcard->net.dev.bus_data = (struct cdi_bus_data*) pci;
 
diff --git a/pcnet/main.c b/pcnet/main.c
index 685d281..ce7152e 100644
--- a/pcnet/main.c
+++ b/pcnet/main.c
@@ -74,6 +74,8 @@ static struct cdi_net_driver pcnet_driver = {
         .init_device    = pcnet_init_device,
         .remove_device  = pcnet_remove_device,
     },
+
+    .send_packet        = pcnet_send_packet,
 };
 
 CDI_DRIVER(DRIVER_NAME, pcnet_driver)
diff --git a/pcnet/pcnet.c b/pcnet/pcnet.c
index 9983fd5..a157094 100644
--- a/pcnet/pcnet.c
+++ b/pcnet/pcnet.c
@@ -65,7 +65,6 @@ struct cdi_device* pcnet_init_device(struct cdi_bus_data* bus_data)
     memset(netcard, 0, sizeof(struct pcnet_device));
 
     netcard->net.dev.bus_data = (struct cdi_bus_data*) pci;
-    netcard->net.send_packet = pcnet_send_packet;
 
     // PCI-bezogenes Zeug initialisieren
     DEBUG_MSG("Interrupthandler und Ports registrieren");
diff --git a/rtl8139/main.c b/rtl8139/main.c
index b3eb095..78b6f94 100644
--- a/rtl8139/main.c
+++ b/rtl8139/main.c
@@ -73,6 +73,8 @@ static struct cdi_net_driver rtl8139_driver = {
         .init_device    = rtl8139_init_device,
         .remove_device  = rtl8139_remove_device,
     },
+
+    .send_packet        = rtl8139_send_packet,
 };
 
 CDI_DRIVER(DRIVER_NAME, rtl8139_driver)
diff --git a/rtl8139/rtl8139.c b/rtl8139/rtl8139.c
index e922889..600f3e9 100644
--- a/rtl8139/rtl8139.c
+++ b/rtl8139/rtl8139.c
@@ -90,7 +90,6 @@ struct cdi_device* rtl8139_init_device(struct cdi_bus_data* bus_data)
 
     netcard->phys = phys_device;
     netcard->net.dev.bus_data = (struct cdi_bus_data*) pci;
-    netcard->net.send_packet = rtl8139_send_packet;
 
     // PCI-bezogenes Zeug initialisieren
     DEBUG_MSG("Interrupthandler und Ports registrieren");
diff --git a/sis900/device.c b/sis900/device.c
index ade91c1..30c6d39 100644
--- a/sis900/device.c
+++ b/sis900/device.c
@@ -196,7 +196,6 @@ struct cdi_device* sis900_init_device(struct cdi_bus_data* bus_data)
 
     netcard->phys = phys_device;
     netcard->net.dev.bus_data = (struct cdi_bus_data*) pci;
-    netcard->net.send_packet = sis900_send_packet;
 
     // PCI-bezogenes Zeug initialisieren
     netcard->revision = pci->rev_id;
diff --git a/sis900/main.c b/sis900/main.c
index 93cb4dd..7f3aae7 100644
--- a/sis900/main.c
+++ b/sis900/main.c
@@ -75,6 +75,8 @@ static struct cdi_net_driver sis900_driver = {
         .init_device    = sis900_init_device,
         .remove_device  = sis900_remove_device,
     },
+
+    .send_packet        = sis900_send_packet,
 };
 
 CDI_DRIVER(DRIVER_NAME, sis900_driver)
-- 
1.6.0.2