diff options
Diffstat (limited to 'drivers/net/ethernet/ti/keystone_pa.c')
-rw-r--r-- | drivers/net/ethernet/ti/keystone_pa.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/keystone_pa.c b/drivers/net/ethernet/ti/keystone_pa.c index 5b4875f3e78..620ed16a053 100644 --- a/drivers/net/ethernet/ti/keystone_pa.c +++ b/drivers/net/ethernet/ti/keystone_pa.c | |||
@@ -301,6 +301,7 @@ struct pa_device { | |||
301 | u32 ip_lut_size; | 301 | u32 ip_lut_size; |
302 | netdev_features_t netif_features; | 302 | netdev_features_t netif_features; |
303 | const char *pdsp_fw[DEVICE_PA_NUM_PDSPS]; | 303 | const char *pdsp_fw[DEVICE_PA_NUM_PDSPS]; |
304 | u32 opened; | ||
304 | }; | 305 | }; |
305 | 306 | ||
306 | #define pa_from_module(data) container_of(data, struct pa_device, module) | 307 | #define pa_from_module(data) container_of(data, struct pa_device, module) |
@@ -2095,6 +2096,7 @@ static int pa_close(void *intf_priv, struct net_device *ndev) | |||
2095 | pa_dev->clk = NULL; | 2096 | pa_dev->clk = NULL; |
2096 | } | 2097 | } |
2097 | 2098 | ||
2099 | pa_dev->opened = 0; | ||
2098 | mutex_unlock(&pa_modules_lock); | 2100 | mutex_unlock(&pa_modules_lock); |
2099 | return 0; | 2101 | return 0; |
2100 | } | 2102 | } |
@@ -2336,6 +2338,7 @@ static int pa_open(void *intf_priv, struct net_device *ndev) | |||
2336 | netcp_register_rxhook(netcp_priv, pa_dev->rxhook_order, | 2338 | netcp_register_rxhook(netcp_priv, pa_dev->rxhook_order, |
2337 | pa_rx_hook, intf_priv); | 2339 | pa_rx_hook, intf_priv); |
2338 | 2340 | ||
2341 | pa_dev->opened = 1; | ||
2339 | return 0; | 2342 | return 0; |
2340 | 2343 | ||
2341 | fail: | 2344 | fail: |
@@ -2355,6 +2358,9 @@ int pa_add_addr(void *intf_priv, struct netcp_addr *naddr) | |||
2355 | int idx, error; | 2358 | int idx, error; |
2356 | const u8 *addr; | 2359 | const u8 *addr; |
2357 | 2360 | ||
2361 | if (!pa_dev->opened) | ||
2362 | return -ENXIO; | ||
2363 | |||
2358 | for (idx = 0; idx < count; idx++) { | 2364 | for (idx = 0; idx < count; idx++) { |
2359 | entries[idx] = pa_lut_alloc(pa_dev, PA_LUT_MAC, | 2365 | entries[idx] = pa_lut_alloc(pa_dev, PA_LUT_MAC, |
2360 | naddr->type == ADDR_ANY); | 2366 | naddr->type == ADDR_ANY); |
@@ -2409,6 +2415,9 @@ static int pa_del_addr(void *intf_priv, struct netcp_addr *naddr) | |||
2409 | struct pa_lut_entry *entry; | 2415 | struct pa_lut_entry *entry; |
2410 | int idx; | 2416 | int idx; |
2411 | 2417 | ||
2418 | if (!pa_dev->opened) | ||
2419 | return -ENXIO; | ||
2420 | |||
2412 | for (idx = 0; idx < pa_dev->lut_size; idx++) { | 2421 | for (idx = 0; idx < pa_dev->lut_size; idx++) { |
2413 | entry = pa_dev->lut + idx; | 2422 | entry = pa_dev->lut + idx; |
2414 | if (!entry->valid || !entry->in_use || entry->u.naddr != naddr) | 2423 | if (!entry->valid || !entry->in_use || entry->u.naddr != naddr) |