Skip to content

Commit c040862

Browse files
committed
Merge tag 'xtensa-20220804' of https://github.com/jcmvbkbc/linux-xtensa
Pull xtensa updates from Max Filippov: - support KCOV - enable ARCH_HAS_GCOV_PROFILE_ALL - minor ISS network driver cleanups * tag 'xtensa-20220804' of https://github.com/jcmvbkbc/linux-xtensa: xtensa: enable ARCH_HAS_GCOV_PROFILE_ALL xtensa: enable KCOV support xtensa: iss: fix handling error cases in iss_net_configure() xtensa: iss/network: provide release() callback xtensa: iss/network: drop 'devices' list
2 parents 995177a + 0847d16 commit c040862

File tree

5 files changed

+34
-37
lines changed

5 files changed

+34
-37
lines changed

Documentation/features/debug/gcov-profile-all/arch-support.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
| sparc: | TODO |
2828
| um: | ok |
2929
| x86: | ok |
30-
| xtensa: | TODO |
30+
| xtensa: | ok |
3131
-----------------------

Documentation/features/debug/kcov/arch-support.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
| sparc: | TODO |
2828
| um: | ok |
2929
| x86: | ok |
30-
| xtensa: | TODO |
30+
| xtensa: | ok |
3131
-----------------------

arch/xtensa/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ config XTENSA
66
select ARCH_HAS_CURRENT_STACK_POINTER
77
select ARCH_HAS_DEBUG_VM_PGTABLE
88
select ARCH_HAS_DMA_PREP_COHERENT if MMU
9+
select ARCH_HAS_GCOV_PROFILE_ALL
10+
select ARCH_HAS_KCOV
911
select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU
1012
select ARCH_HAS_SYNC_DMA_FOR_DEVICE if MMU
1113
select ARCH_HAS_DMA_SET_UNCACHED if MMU

arch/xtensa/boot/lib/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ endif
1717

1818
KASAN_SANITIZE := n
1919
KCSAN_SANITIZE := n
20+
KCOV_INSTRUMENT := n
21+
GCOV_PROFILE := n
2022

2123
CFLAGS_REMOVE_inflate.o += -fstack-protector -fstack-protector-strong
2224
CFLAGS_REMOVE_zmem.o += -fstack-protector -fstack-protector-strong

arch/xtensa/platforms/iss/network.c

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
#define ETH_HEADER_OTHER 14
3838
#define ISS_NET_TIMER_VALUE (HZ / 10)
3939

40-
41-
static DEFINE_SPINLOCK(devices_lock);
42-
static LIST_HEAD(devices);
43-
4440
/* ------------------------------------------------------------------------- */
4541

4642
/* We currently only support the TUNTAP transport protocol. */
@@ -70,8 +66,6 @@ struct iss_net_ops {
7066
/* This structure contains out private information for the driver. */
7167

7268
struct iss_net_private {
73-
struct list_head device_list;
74-
7569
spinlock_t lock;
7670
struct net_device *dev;
7771
struct platform_device pdev;
@@ -472,23 +466,30 @@ static const struct net_device_ops iss_netdev_ops = {
472466
.ndo_set_rx_mode = iss_net_set_multicast_list,
473467
};
474468

475-
static int iss_net_configure(int index, char *init)
469+
static void iss_net_pdev_release(struct device *dev)
470+
{
471+
struct platform_device *pdev = to_platform_device(dev);
472+
struct iss_net_private *lp =
473+
container_of(pdev, struct iss_net_private, pdev);
474+
475+
free_netdev(lp->dev);
476+
}
477+
478+
static void iss_net_configure(int index, char *init)
476479
{
477480
struct net_device *dev;
478481
struct iss_net_private *lp;
479-
int err;
480482

481483
dev = alloc_etherdev(sizeof(*lp));
482484
if (dev == NULL) {
483485
pr_err("eth_configure: failed to allocate device\n");
484-
return 1;
486+
return;
485487
}
486488

487489
/* Initialize private element. */
488490

489491
lp = netdev_priv(dev);
490492
*lp = (struct iss_net_private) {
491-
.device_list = LIST_HEAD_INIT(lp->device_list),
492493
.dev = dev,
493494
.index = index,
494495
};
@@ -509,25 +510,24 @@ static int iss_net_configure(int index, char *init)
509510
if (!tuntap_probe(lp, index, init)) {
510511
pr_err("%s: invalid arguments. Skipping device!\n",
511512
dev->name);
512-
goto errout;
513+
goto err_free_netdev;
513514
}
514515

515516
pr_info("Netdevice %d (%pM)\n", index, dev->dev_addr);
516517

517518
/* sysfs register */
518519

519520
if (!driver_registered) {
520-
platform_driver_register(&iss_net_driver);
521+
if (platform_driver_register(&iss_net_driver))
522+
goto err_free_netdev;
521523
driver_registered = 1;
522524
}
523525

524-
spin_lock(&devices_lock);
525-
list_add(&lp->device_list, &devices);
526-
spin_unlock(&devices_lock);
527-
528526
lp->pdev.id = index;
529527
lp->pdev.name = DRIVER_NAME;
530-
platform_device_register(&lp->pdev);
528+
lp->pdev.dev.release = iss_net_pdev_release;
529+
if (platform_device_register(&lp->pdev))
530+
goto err_free_netdev;
531531
SET_NETDEV_DEV(dev, &lp->pdev.dev);
532532

533533
dev->netdev_ops = &iss_netdev_ops;
@@ -536,23 +536,20 @@ static int iss_net_configure(int index, char *init)
536536
dev->irq = -1;
537537

538538
rtnl_lock();
539-
err = register_netdevice(dev);
540-
rtnl_unlock();
541-
542-
if (err) {
539+
if (register_netdevice(dev)) {
540+
rtnl_unlock();
543541
pr_err("%s: error registering net device!\n", dev->name);
544-
/* XXX: should we call ->remove() here? */
545-
free_netdev(dev);
546-
return 1;
542+
platform_device_unregister(&lp->pdev);
543+
return;
547544
}
545+
rtnl_unlock();
548546

549547
timer_setup(&lp->tl, iss_net_user_timer_expire, 0);
550548

551-
return 0;
549+
return;
552550

553-
errout:
554-
/* FIXME: unregister; free, etc.. */
555-
return -EIO;
551+
err_free_netdev:
552+
free_netdev(dev);
556553
}
557554

558555
/* ------------------------------------------------------------------------- */
@@ -574,7 +571,7 @@ struct iss_net_init {
574571

575572
static int __init iss_net_setup(char *str)
576573
{
577-
struct iss_net_private *device = NULL;
574+
struct iss_net_init *device = NULL;
578575
struct iss_net_init *new;
579576
struct list_head *ele;
580577
char *end;
@@ -595,16 +592,12 @@ static int __init iss_net_setup(char *str)
595592
}
596593
str = end;
597594

598-
spin_lock(&devices_lock);
599-
600-
list_for_each(ele, &devices) {
601-
device = list_entry(ele, struct iss_net_private, device_list);
595+
list_for_each(ele, &eth_cmd_line) {
596+
device = list_entry(ele, struct iss_net_init, list);
602597
if (device->index == n)
603598
break;
604599
}
605600

606-
spin_unlock(&devices_lock);
607-
608601
if (device && device->index == n) {
609602
pr_err("Device %u already configured\n", n);
610603
return 1;

0 commit comments

Comments
 (0)