Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'code-clean-up'

Justin Chen says:

====================
code clean up

Clean up and streamlined some code that is no longer needed due to
older HW support being dropped.
====================

Link: https://patch.msgid.link/20260122194949.1145107-1-justin.chen@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+24 -102
+14 -18
drivers/net/ethernet/broadcom/asp2/bcmasp.c
··· 1081 1081 struct bcmasp_priv *priv = data; 1082 1082 u32 status; 1083 1083 1084 - /* No L3 IRQ, so we good */ 1085 - if (priv->wol_irq <= 0) 1086 - goto irq_handled; 1087 - 1088 1084 status = wakeup_intr2_core_rl(priv, ASP_WAKEUP_INTR2_STATUS) & 1089 1085 ~wakeup_intr2_core_rl(priv, ASP_WAKEUP_INTR2_MASK_STATUS); 1090 1086 wakeup_intr2_core_wl(priv, status, ASP_WAKEUP_INTR2_CLEAR); 1091 1087 1092 - irq_handled: 1093 1088 pm_wakeup_event(&priv->pdev->dev, 0); 1094 1089 return IRQ_HANDLED; 1095 1090 } ··· 1317 1322 1318 1323 bcmasp_core_init_filters(priv); 1319 1324 1325 + bcmasp_init_wol(priv); 1326 + 1320 1327 ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports"); 1321 1328 if (!ports_node) { 1322 1329 dev_warn(dev, "No ports found\n"); ··· 1330 1333 intf = bcmasp_interface_create(priv, intf_node, i); 1331 1334 if (!intf) { 1332 1335 dev_err(dev, "Cannot create eth interface %d\n", i); 1333 - bcmasp_remove_intfs(priv); 1334 - ret = -ENOMEM; 1335 - goto of_put_exit; 1336 + of_node_put(ports_node); 1337 + ret = -EINVAL; 1338 + goto err_cleanup; 1336 1339 } 1337 1340 list_add_tail(&intf->list, &priv->intfs); 1338 1341 i++; 1339 1342 } 1340 - 1341 - /* Check and enable WoL */ 1342 - bcmasp_init_wol(priv); 1343 + of_node_put(ports_node); 1343 1344 1344 1345 /* Drop the clock reference count now and let ndo_open()/ndo_close() 1345 1346 * manage it for us from now on. ··· 1352 1357 list_for_each_entry(intf, &priv->intfs, list) { 1353 1358 ret = register_netdev(intf->ndev); 1354 1359 if (ret) { 1355 - netdev_err(intf->ndev, 1356 - "failed to register net_device: %d\n", ret); 1357 - bcmasp_wol_irq_destroy(priv); 1358 - bcmasp_remove_intfs(priv); 1359 - goto of_put_exit; 1360 + dev_err(dev, "failed to register net_device: %d\n", ret); 1361 + goto err_cleanup; 1360 1362 } 1361 1363 count++; 1362 1364 } 1363 1365 1364 1366 dev_info(dev, "Initialized %d port(s)\n", count); 1365 1367 1366 - of_put_exit: 1367 - of_node_put(ports_node); 1368 + return ret; 1369 + 1370 + err_cleanup: 1371 + bcmasp_wol_irq_destroy(priv); 1372 + bcmasp_remove_intfs(priv); 1373 + 1368 1374 return ret; 1369 1375 } 1370 1376
-36
drivers/net/ethernet/broadcom/asp2/bcmasp.h
··· 268 268 u32 tx_timeout_cnt; 269 269 }; 270 270 271 - struct bcmasp_intf_ops { 272 - unsigned long (*rx_desc_read)(struct bcmasp_intf *intf); 273 - void (*rx_buffer_write)(struct bcmasp_intf *intf, dma_addr_t addr); 274 - void (*rx_desc_write)(struct bcmasp_intf *intf, dma_addr_t addr); 275 - unsigned long (*tx_read)(struct bcmasp_intf *intf); 276 - void (*tx_write)(struct bcmasp_intf *intf, dma_addr_t addr); 277 - }; 278 271 279 272 struct bcmasp_priv; 280 273 ··· 279 286 /* ASP Ch */ 280 287 int channel; 281 288 int port; 282 - const struct bcmasp_intf_ops *ops; 283 289 284 290 /* Used for splitting shared resources */ 285 291 int index; ··· 398 406 /* Network filter lock */ 399 407 struct mutex net_lock; 400 408 }; 401 - 402 - static inline unsigned long bcmasp_intf_rx_desc_read(struct bcmasp_intf *intf) 403 - { 404 - return intf->ops->rx_desc_read(intf); 405 - } 406 - 407 - static inline void bcmasp_intf_rx_buffer_write(struct bcmasp_intf *intf, 408 - dma_addr_t addr) 409 - { 410 - intf->ops->rx_buffer_write(intf, addr); 411 - } 412 - 413 - static inline void bcmasp_intf_rx_desc_write(struct bcmasp_intf *intf, 414 - dma_addr_t addr) 415 - { 416 - intf->ops->rx_desc_write(intf, addr); 417 - } 418 - 419 - static inline unsigned long bcmasp_intf_tx_read(struct bcmasp_intf *intf) 420 - { 421 - return intf->ops->tx_read(intf); 422 - } 423 - 424 - static inline void bcmasp_intf_tx_write(struct bcmasp_intf *intf, 425 - dma_addr_t addr) 426 - { 427 - intf->ops->tx_write(intf, addr); 428 - } 429 409 430 410 #define __BCMASP_IO_MACRO(name, m) \ 431 411 static inline u32 name##_rl(struct bcmasp_intf *intf, u32 off) \
+10 -48
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
··· 231 231 return skb; 232 232 } 233 233 234 - static unsigned long bcmasp_rx_edpkt_dma_rq(struct bcmasp_intf *intf) 235 - { 236 - return rx_edpkt_dma_rq(intf, RX_EDPKT_DMA_VALID); 237 - } 238 - 239 - static void bcmasp_rx_edpkt_cfg_wq(struct bcmasp_intf *intf, dma_addr_t addr) 240 - { 241 - rx_edpkt_cfg_wq(intf, addr, RX_EDPKT_RING_BUFFER_READ); 242 - } 243 - 244 - static void bcmasp_rx_edpkt_dma_wq(struct bcmasp_intf *intf, dma_addr_t addr) 245 - { 246 - rx_edpkt_dma_wq(intf, addr, RX_EDPKT_DMA_READ); 247 - } 248 - 249 - static unsigned long bcmasp_tx_spb_dma_rq(struct bcmasp_intf *intf) 250 - { 251 - return tx_spb_dma_rq(intf, TX_SPB_DMA_READ); 252 - } 253 - 254 - static void bcmasp_tx_spb_dma_wq(struct bcmasp_intf *intf, dma_addr_t addr) 255 - { 256 - tx_spb_dma_wq(intf, addr, TX_SPB_DMA_VALID); 257 - } 258 - 259 - static const struct bcmasp_intf_ops bcmasp_intf_ops = { 260 - .rx_desc_read = bcmasp_rx_edpkt_dma_rq, 261 - .rx_buffer_write = bcmasp_rx_edpkt_cfg_wq, 262 - .rx_desc_write = bcmasp_rx_edpkt_dma_wq, 263 - .tx_read = bcmasp_tx_spb_dma_rq, 264 - .tx_write = bcmasp_tx_spb_dma_wq, 265 - }; 266 - 267 234 static netdev_tx_t bcmasp_xmit(struct sk_buff *skb, struct net_device *dev) 268 235 { 269 236 struct bcmasp_intf *intf = netdev_priv(dev); ··· 335 368 336 369 skb_tx_timestamp(skb); 337 370 338 - bcmasp_intf_tx_write(intf, intf->tx_spb_dma_valid); 371 + tx_spb_dma_wq(intf, intf->tx_spb_dma_valid, TX_SPB_DMA_VALID); 339 372 340 373 if (tx_spb_ring_full(intf, MAX_SKB_FRAGS + 1)) 341 374 netif_stop_queue(dev); ··· 416 449 struct bcmasp_desc *desc; 417 450 dma_addr_t mapping; 418 451 419 - read = bcmasp_intf_tx_read(intf); 452 + read = tx_spb_dma_rq(intf, TX_SPB_DMA_READ); 420 453 while (intf->tx_spb_dma_read != read) { 421 454 txcb = &intf->tx_cbs[intf->tx_spb_clean_index]; 422 455 mapping = dma_unmap_addr(txcb, dma_addr); ··· 486 519 u64 flags; 487 520 u32 len; 488 521 489 - valid = bcmasp_intf_rx_desc_read(intf) + 1; 522 + valid = rx_edpkt_dma_rq(intf, RX_EDPKT_DMA_VALID) + 1; 490 523 if (valid == intf->rx_edpkt_dma_addr + DESC_RING_SIZE) 491 524 valid = intf->rx_edpkt_dma_addr; 492 525 ··· 558 591 u64_stats_update_end(&stats->syncp); 559 592 560 593 next: 561 - bcmasp_intf_rx_buffer_write(intf, (DESC_ADDR(desc->buf) + 562 - desc->size)); 594 + rx_edpkt_cfg_wq(intf, (DESC_ADDR(desc->buf) + desc->size), 595 + RX_EDPKT_RING_BUFFER_READ); 563 596 564 597 processed++; 565 598 intf->rx_edpkt_dma_read = ··· 570 603 DESC_RING_COUNT); 571 604 } 572 605 573 - bcmasp_intf_rx_desc_write(intf, intf->rx_edpkt_dma_read); 606 + rx_edpkt_dma_wq(intf, intf->rx_edpkt_dma_read, RX_EDPKT_DMA_READ); 574 607 575 608 if (processed < budget && napi_complete_done(&intf->rx_napi, processed)) 576 609 bcmasp_enable_rx_irq(intf, 1); ··· 1238 1271 } 1239 1272 1240 1273 SET_NETDEV_DEV(ndev, dev); 1241 - intf->ops = &bcmasp_intf_ops; 1242 1274 ndev->netdev_ops = &bcmasp_netdev_ops; 1243 1275 ndev->ethtool_ops = &bcmasp_ethtool_ops; 1244 1276 intf->msg_enable = netif_msg_init(-1, NETIF_MSG_DRV | ··· 1299 1333 1300 1334 umac_enable_set(intf, UMC_CMD_RX_EN, 1); 1301 1335 1302 - if (intf->parent->wol_irq > 0) { 1303 - wakeup_intr2_core_wl(intf->parent, 0xffffffff, 1304 - ASP_WAKEUP_INTR2_MASK_CLEAR); 1305 - } 1336 + wakeup_intr2_core_wl(intf->parent, 0xffffffff, 1337 + ASP_WAKEUP_INTR2_MASK_CLEAR); 1306 1338 1307 1339 if (ndev->phydev && ndev->phydev->eee_cfg.eee_enabled && 1308 1340 intf->parent->eee_fixup) ··· 1353 1389 reg &= ~UMC_MPD_CTRL_MPD_EN; 1354 1390 umac_wl(intf, reg, UMC_MPD_CTRL); 1355 1391 1356 - if (intf->parent->wol_irq > 0) { 1357 - wakeup_intr2_core_wl(intf->parent, 0xffffffff, 1358 - ASP_WAKEUP_INTR2_MASK_SET); 1359 - } 1392 + wakeup_intr2_core_wl(intf->parent, 0xffffffff, 1393 + ASP_WAKEUP_INTR2_MASK_SET); 1360 1394 } 1361 1395 1362 1396 int bcmasp_interface_resume(struct bcmasp_intf *intf)