From: Jakub Kicinski <kuba@kernel.org>
To: Jinjian Song <songjinjian@hotmail.com>
Cc: netdev@vger.kernel.org, chandrashekar.devegowda@intel.com,
chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com,
m.chetan.kumar@linux.intel.com, ricardo.martinez@linux.intel.com,
loic.poulain@linaro.org, ryazanov.s.a@gmail.com,
johannes@sipsolutions.net, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com,
linux-kernel@vger.kernel.com, vsankar@lenovo.com,
danielwinkler@google.com, nmarupaka@google.com,
joey.zhao@fibocom.com, liuqf@fibocom.com, felix.yan@fibocom.com,
Jinjian Song <jinjian.song@fibocom.com>
Subject: Re: [net-next v3 2/3] net: wwan: t7xx: Add sysfs attribute for device state machine
Date: Mon, 8 Jan 2024 07:19:33 -0800 [thread overview]
Message-ID: <20240108071933.4fd3a873@kernel.org> (raw)
In-Reply-To: <MEYP282MB2697CEBA4B69B0230089AA51BB9EA@MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM>
On Thu, 28 Dec 2023 17:44:10 +0800 Jinjian Song wrote:
> From: Jinjian Song <jinjian.song@fibocom.com>
>
> Add support for userspace to get the device mode,
> e.g., reset/ready/fastboot mode.
We need some info under Documentation/ describing the file / attr
and how it's supposed to be used.
> diff --git a/drivers/net/wwan/t7xx/t7xx_modem_ops.c b/drivers/net/wwan/t7xx/t7xx_modem_ops.c
> index 24e7d491468e..ae4578905a8d 100644
> --- a/drivers/net/wwan/t7xx/t7xx_modem_ops.c
> +++ b/drivers/net/wwan/t7xx/t7xx_modem_ops.c
> @@ -192,6 +192,7 @@ static irqreturn_t t7xx_rgu_isr_thread(int irq, void *data)
> {
> struct t7xx_pci_dev *t7xx_dev = data;
>
> + atomic_set(&t7xx_dev->mode, T7XX_RESET);
Why is ->mode atomic? There seem to be no RMW operations on it.
You can use READ_ONCE() / WRITE_ONCE() on a normal integer.
> msleep(RGU_RESET_DELAY_MS);
> t7xx_reset_device_via_pmic(t7xx_dev);
> return IRQ_HANDLED;
> diff --git a/drivers/net/wwan/t7xx/t7xx_pci.c b/drivers/net/wwan/t7xx/t7xx_pci.c
> index 91256e005b84..d5f6a8638aba 100644
> --- a/drivers/net/wwan/t7xx/t7xx_pci.c
> +++ b/drivers/net/wwan/t7xx/t7xx_pci.c
> @@ -52,6 +52,68 @@
> #define PM_RESOURCE_POLL_TIMEOUT_US 10000
> #define PM_RESOURCE_POLL_STEP_US 100
>
> +static ssize_t t7xx_mode_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct pci_dev *pdev;
> + struct t7xx_pci_dev *t7xx_dev;
> +
> + pdev = to_pci_dev(dev);
> + t7xx_dev = pci_get_drvdata(pdev);
> + if (!t7xx_dev)
> + return -ENODEV;
> +
> + atomic_set(&t7xx_dev->mode, T7XX_FASTBOOT_DL_SWITCHING);
This function doesn't use @buf at all. So whenever user does write()
to the file we set to SWITCHING? Shouldn't we narrow down the set
of accepted values to be able to add more functionality later?
> + return count;
> +};
unnecessary semi-colon
next prev parent reply other threads:[~2024-01-08 15:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20231228094411.13224-1-songjinjian@hotmail.com>
2023-12-28 9:44 ` [net-next v3 1/3] wwan: core: Add WWAN fastboot port type Jinjian Song
2023-12-28 9:44 ` [net-next v3 2/3] net: wwan: t7xx: Add sysfs attribute for device state machine Jinjian Song
2024-01-08 15:19 ` Jakub Kicinski [this message]
2024-01-08 21:37 ` Sergey Ryazanov
2024-01-09 19:56 ` Nelson, Shannon
2023-12-28 9:44 ` [net-next v3 3/3] net: wwan: t7xx: Add fastboot WWAN port Jinjian Song
2024-01-08 21:30 ` Sergey Ryazanov
2024-01-10 3:40 [net-next v3 2/3] net: wwan: t7xx: Add sysfs attribute for device state machine Jinjian Song
-- strict thread matches above, loose matches on Subject: below --
2024-01-10 7:15 Jinjian Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240108071933.4fd3a873@kernel.org \
--to=kuba@kernel.org \
--cc=chandrashekar.devegowda@intel.com \
--cc=chiranjeevi.rapolu@linux.intel.com \
--cc=danielwinkler@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=felix.yan@fibocom.com \
--cc=haijun.liu@mediatek.com \
--cc=jinjian.song@fibocom.com \
--cc=joey.zhao@fibocom.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.com \
--cc=liuqf@fibocom.com \
--cc=loic.poulain@linaro.org \
--cc=m.chetan.kumar@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=nmarupaka@google.com \
--cc=pabeni@redhat.com \
--cc=ricardo.martinez@linux.intel.com \
--cc=ryazanov.s.a@gmail.com \
--cc=songjinjian@hotmail.com \
--cc=vsankar@lenovo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).