]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: most: remove dependency on networking-aim
authorAndrey Shvetsov <andrey.shvetsov@k2l.de>
Fri, 12 May 2017 10:59:54 +0000 (12:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 May 2017 09:59:09 +0000 (11:59 +0200)
The modules hdm-usb and hdm-dim2 depend on the module aim-network, because
they use the function most_deliver_netinfo that it exports.

To remove this dependency, this patch replaces the call of the function
most_deliver_netinfo with the call of the function that is the parameter
'on_netinfo' of the function request_netinfo.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/aim-network/networking.c
drivers/staging/most/aim-network/networking.h [deleted file]
drivers/staging/most/hdm-dim2/Kconfig
drivers/staging/most/hdm-dim2/dim2_hdm.c
drivers/staging/most/hdm-usb/Kconfig
drivers/staging/most/hdm-usb/hdm_usb.c
drivers/staging/most/mostcore/mostcore.h

index 03ddbd2459d6e6763cb8b3a8bb87d258cb417128..a3009fdfa27829dbcd2b4680ab90ad28ac3914d7 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/wait.h>
 #include <linux/kobject.h>
 #include "mostcore.h"
-#include "networking.h"
 
 #define MEP_HDR_LEN 8
 #define MDP_HDR_LEN 16
@@ -176,6 +175,9 @@ static int most_nd_set_mac_address(struct net_device *dev, void *p)
        return 0;
 }
 
+static void on_netinfo(struct most_interface *iface,
+                      unsigned char link_stat, unsigned char *mac_addr);
+
 static int most_nd_open(struct net_device *dev)
 {
        struct net_dev_context *nd = dev->ml_priv;
@@ -204,7 +206,7 @@ static int most_nd_open(struct net_device *dev)
                netif_dormant_on(dev);
        netif_wake_queue(dev);
        if (nd->iface->request_netinfo)
-               nd->iface->request_netinfo(nd->iface, nd->tx.ch_id);
+               nd->iface->request_netinfo(nd->iface, nd->tx.ch_id, on_netinfo);
        return 0;
 }
 
@@ -216,6 +218,8 @@ static int most_nd_stop(struct net_device *dev)
 
        BUG_ON(nd->dev != dev);
        netif_stop_queue(dev);
+       if (nd->iface->request_netinfo)
+               nd->iface->request_netinfo(nd->iface, nd->tx.ch_id, NULL);
        most_stop_channel(nd->iface, nd->rx.ch_id, &aim);
        most_stop_channel(nd->iface, nd->tx.ch_id, &aim);
 
@@ -527,13 +531,13 @@ static void __exit most_net_exit(void)
 }
 
 /**
- * most_deliver_netinfo - callback for HDM to be informed about HW's MAC
+ * on_netinfo - callback for HDM to be informed about HW's MAC
  * @param iface - most interface instance
  * @param link_stat - link status
  * @param mac_addr - MAC address
  */
-void most_deliver_netinfo(struct most_interface *iface,
-                         unsigned char link_stat, unsigned char *mac_addr)
+static void on_netinfo(struct most_interface *iface,
+                      unsigned char link_stat, unsigned char *mac_addr)
 {
        struct net_dev_context *nd;
        struct net_device *dev;
@@ -564,7 +568,6 @@ void most_deliver_netinfo(struct most_interface *iface,
                }
        }
 }
-EXPORT_SYMBOL(most_deliver_netinfo);
 
 module_init(most_net_init);
 module_exit(most_net_exit);
diff --git a/drivers/staging/most/aim-network/networking.h b/drivers/staging/most/aim-network/networking.h
deleted file mode 100644 (file)
index 6f346d4..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Networking AIM - Networking Application Interface Module for MostCore
- *
- * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This file is licensed under GPLv2.
- */
-#ifndef _NETWORKING_H_
-#define _NETWORKING_H_
-
-#include "mostcore.h"
-
-void most_deliver_netinfo(struct most_interface *iface,
-                         unsigned char link_stat, unsigned char *mac_addr);
-
-#endif
index 28a0e1791600869f247e979aff15759c02eef447..663bfebff6744fda0fba7316134b3657a15e1cd9 100644 (file)
@@ -4,7 +4,6 @@
 
 config HDM_DIM2
        tristate "DIM2 HDM"
-       depends on AIM_NETWORK
        depends on HAS_IOMEM
 
        ---help---
index 902824e728ea44d8cc73b5d167501ee9abd820de..4607d03c577bb211453c7df82f24103fb74e443e 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/kthread.h>
 
 #include <mostcore.h>
-#include <networking.h>
 #include "dim2_hal.h"
 #include "dim2_hdm.h"
 #include "dim2_errors.h"
@@ -107,6 +106,8 @@ struct dim2_hdm {
        unsigned char link_state;
        int atx_idx;
        struct medialb_bus bus;
+       void (*on_netinfo)(struct most_interface *,
+                          unsigned char, unsigned char *);
 };
 
 #define iface_to_hdm(iface) container_of(iface, struct dim2_hdm, most_iface)
@@ -287,8 +288,11 @@ static int deliver_netinfo_thread(void *data)
 
                if (dev->deliver_netinfo) {
                        dev->deliver_netinfo--;
-                       most_deliver_netinfo(&dev->most_iface, dev->link_state,
-                                            dev->mac_addrs);
+                       if (dev->on_netinfo) {
+                               dev->on_netinfo(&dev->most_iface,
+                                               dev->link_state,
+                                               dev->mac_addrs);
+                       }
                }
        }
 
@@ -654,12 +658,18 @@ static int enqueue(struct most_interface *most_iface, int ch_idx,
  * Send a command to INIC which triggers retrieving of network info by means of
  * "Message exchange over MDP/MEP". Return 0 on success, negative on failure.
  */
-static void request_netinfo(struct most_interface *most_iface, int ch_idx)
+static void request_netinfo(struct most_interface *most_iface, int ch_idx,
+                           void (*on_netinfo)(struct most_interface *,
+                                              unsigned char, unsigned char *))
 {
        struct dim2_hdm *dev = iface_to_hdm(most_iface);
        struct mbo *mbo;
        u8 *data;
 
+       dev->on_netinfo = on_netinfo;
+       if (!on_netinfo)
+               return;
+
        if (dev->atx_idx < 0) {
                pr_err("Async Tx Not initialized\n");
                return;
index ec1546312ee67034d3cee21457937bea25324a3a..487f1f34776c39e5101fd92f32a4b9410c7dde76 100644 (file)
@@ -5,7 +5,7 @@
 config HDM_USB
        tristate "USB HDM"
        depends on USB && NET
-       select AIM_NETWORK
+
        ---help---
          Say Y here if you want to connect via USB to network tranceiver.
          This device driver depends on the networking AIM.
index a95b5910d9fc8aca4b0cadf4f5f14ca9577707c2..d0f68cb3c1734729cc041a94e6ce8a0da53bd1cf 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/etherdevice.h>
 #include <linux/uaccess.h>
 #include "mostcore.h"
-#include "networking.h"
 
 #define USB_MTU                        512
 #define NO_ISOCHRONOUS_URB     0
@@ -126,6 +125,8 @@ struct most_dev {
        struct mutex io_mutex;
        struct timer_list link_stat_timer;
        struct work_struct poll_work_obj;
+       void (*on_netinfo)(struct most_interface *, unsigned char,
+                          unsigned char *);
 };
 
 #define to_mdev(d) container_of(d, struct most_dev, iface)
@@ -719,12 +720,19 @@ exit:
  * polls for the NI state of the INIC every 2 seconds.
  *
  */
-static void hdm_request_netinfo(struct most_interface *iface, int channel)
+static void hdm_request_netinfo(struct most_interface *iface, int channel,
+                               void (*on_netinfo)(struct most_interface *,
+                                                  unsigned char,
+                                                  unsigned char *))
 {
        struct most_dev *mdev;
 
        BUG_ON(!iface);
        mdev = to_mdev(iface);
+       mdev->on_netinfo = on_netinfo;
+       if (!on_netinfo)
+               return;
+
        mdev->link_stat_timer.expires = jiffies + HZ;
        mod_timer(&mdev->link_stat_timer, mdev->link_stat_timer.expires);
 }
@@ -786,7 +794,8 @@ static void wq_netinfo(struct work_struct *wq_obj)
        hw_addr[4] = lo >> 8;
        hw_addr[5] = lo;
 
-       most_deliver_netinfo(&mdev->iface, link, hw_addr);
+       if (mdev->on_netinfo)
+               mdev->on_netinfo(&mdev->iface, link, hw_addr);
 }
 
 /**
index 5f8339bd046ff66d29298aa1a5b491ef3b08f1f9..915e5159d1eb990854e148160fdba27f031bd12c 100644 (file)
@@ -233,6 +233,8 @@ struct mbo {
  *   The callback returns a negative value on error, otherwise 0.
  * @request_netinfo: triggers retrieving of network info from the HDM by
  *   means of "Message exchange over MDP/MEP"
+ *   The call of the function request_netinfo with the parameter on_netinfo as
+ *   NULL prohibits use of the previously obtained function pointer.
  * @priv Private field used by mostcore to store context information.
  */
 struct most_interface {
@@ -246,7 +248,10 @@ struct most_interface {
        int (*enqueue)(struct most_interface *iface, int channel_idx,
                       struct mbo *mbo);
        int (*poison_channel)(struct most_interface *iface, int channel_idx);
-       void (*request_netinfo)(struct most_interface *iface, int channel_idx);
+       void (*request_netinfo)(struct most_interface *iface, int channel_idx,
+                               void (*on_netinfo)(struct most_interface *iface,
+                                                  unsigned char link_stat,
+                                                  unsigned char *mac_addr));
        void *priv;
 };