staging: most: remove dependency on networking-aim
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>
This commit is contained in:
parent
78a900205c
commit
d35bbfaa4a
|
@ -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);
|
||||
|
|
|
@ -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
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
config HDM_DIM2
|
||||
tristate "DIM2 HDM"
|
||||
depends on AIM_NETWORK
|
||||
depends on HAS_IOMEM
|
||||
|
||||
---help---
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue