[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7cb1bf46-2a6f-4fde-a6da-3d01bec4293b@yunsilicon.com>
Date: Wed, 18 Dec 2024 23:35:39 +0800
From: "tianx" <tianx@...silicon.com>
To: "Andrew Lunn" <andrew@...n.ch>
Cc: <netdev@...r.kernel.org>, <davem@...emloft.net>, <weihg@...silicon.com>
Subject: Re: [PATCH 08/16] net-next/yunsilicon: Add ethernet interface
We need to do some cleanup work when the machine shutdown. But it's not
necessary in current series, so the reboot callback have been removed in
v1 code
On 2024/12/9 21:40, Andrew Lunn wrote:
> On Mon, Dec 09, 2024 at 03:10:53PM +0800, Tian Xin wrote:
>> From: Xin Tian <tianx@...silicon.com>
>>
>> Build a basic netdevice driver
>>
>> Signed-off-by: Xin Tian <tianx@...silicon.com>
>> Signed-off-by: Honggang Wei <weihg@...silicon.com>
>> Signed-off-by: Lei Yan <jacky@...silicon.com>
>> ---
>> drivers/net/ethernet/yunsilicon/Makefile | 2 +-
>> .../ethernet/yunsilicon/xsc/common/xsc_core.h | 1 +
>> .../net/ethernet/yunsilicon/xsc/net/main.c | 135 ++++++++++++++++++
>> .../net/ethernet/yunsilicon/xsc/net/xsc_eth.h | 16 +++
>> .../yunsilicon/xsc/net/xsc_eth_common.h | 15 ++
>> 5 files changed, 168 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/main.c
>> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth.h
>> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_common.h
>>
>> diff --git a/drivers/net/ethernet/yunsilicon/Makefile b/drivers/net/ethernet/yunsilicon/Makefile
>> index 950fd2663..c1d3e3398 100644
>> --- a/drivers/net/ethernet/yunsilicon/Makefile
>> +++ b/drivers/net/ethernet/yunsilicon/Makefile
>> @@ -4,5 +4,5 @@
>> # Makefile for the Yunsilicon device drivers.
>> #
>>
>> -# obj-$(CONFIG_YUNSILICON_XSC_ETH) += xsc/net/
>> +obj-$(CONFIG_YUNSILICON_XSC_ETH) += xsc/net/
>> obj-$(CONFIG_YUNSILICON_XSC_PCI) += xsc/pci/
>> \ No newline at end of file
>> diff --git a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
>> index 88d4c5654..5d2b28e2e 100644
>> --- a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
>> +++ b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
>> @@ -498,6 +498,7 @@ struct xsc_core_device {
>> struct pci_dev *pdev;
>> struct device *device;
>> struct xsc_priv priv;
>> + void *netdev;
>> void *eth_priv;
>> struct xsc_dev_resource *dev_res;
>>
>> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/main.c b/drivers/net/ethernet/yunsilicon/xsc/net/main.c
>> new file mode 100644
>> index 000000000..243ec7ced
>> --- /dev/null
>> +++ b/drivers/net/ethernet/yunsilicon/xsc/net/main.c
>> @@ -0,0 +1,135 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/* Copyright (C) 2021 - 2023, Shanghai Yunsilicon Technology Co., Ltd.
>> + * All rights reserved.
>> + */
>> +
>> +#include <linux/reboot.h>
> reboot.h in an ethernet driver?
>
>> +static int xsc_net_reboot_event_handler(struct notifier_block *nb, unsigned long action, void *data)
>> +{
>> + pr_info("xsc net driver recv %lu event\n", action);
>> + xsc_remove_eth_driver();
>> +
>> + return NOTIFY_OK;
>> +}
>> +
>> +struct notifier_block xsc_net_nb = {
>> + .notifier_call = xsc_net_reboot_event_handler,
>> + .next = NULL,
>> + .priority = 1,
>> +};
> This needs a comment explanation why this driver needs something
> special during reboot.
>
> Andrew
>
> ---
> pw-bot: cr
Powered by blists - more mailing lists