mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Alexander Usyskin" <alexander.usyskin@intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Menachem Adin" <menachem.adin@intel.com>,
	"Andrzej Kacprowski" <andrzej.kacprowski@linux.intel.com>,
	"Karol Wachowski" <karol.wachowski@linux.intel.com>,
	"Reuven Abliyev" <reuvenab@gmail.com>
Subject: Re: [PATCH char-misc-next 4/4] issei: add driver to driver interface
Date: Thu, 15 Oct 2026 14:58:16 +0200	[thread overview]
Message-ID: <d753e1fa-29c1-4692-b2b3-d592475ae77f@app.fastmail.com> (raw)
In-Reply-To: <PH3PPFE241D7F14C878F571D90A5918000EED9C2@PH3PPFE241D7F14.namprd11.prod.outlook.com>

On Thu, Oct 15, 2026, at 14:47, Usyskin, Alexander wrote:
>> Subject: Re: [PATCH char-misc-next 4/4] issei: add driver to driver interface
>> 
>> On Thu, Oct 15, 2026, at 07:28, Alexander Usyskin wrote:
>> 
>> > +	if (idev->rst_state != ISSEI_RST_STATE_DONE) {
>> > +		wait_event_interruptible_timeout(idev->wait_rst_state,
>> > +						 idev->rst_state ==
>> ISSEI_RST_STATE_DONE,
>> > +
>> msecs_to_jiffies(ISSEI_DEVICE_CONNECT_TO_MS));
>> > +		if (idev->rst_state != ISSEI_RST_STATE_DONE) {
>> > +			dev_dbg(&idev->dev, "Device is in transition\n");
>> > +			return -ENODEV;
>> > +		}
>> 
>> 
>> The wait logic is inconsistent here, the first one ignores the timeout
>> and pending signal, the second one flips -ERESTARTSYS to -EINTR and
>> everything else to -ERESTARTSYS, which is also questionable.
>> 
>
> First wait ignores timeout as it only interesting in ISSEI_RST_STATE_DONE.
> If after timeout the state is ISSEI_RST_STATE_DONE - we can continue in flow.

But if it times out, it won't be in that state unless you hit
a tiny race, for consistency I would always check the return
code, not check the condition again.

>> > +#if IS_ENABLED(CONFIG_INTEL_SSEI)
>> > +
>> > +void *issei_device_open(int (*match)(struct device *, const void *),
>> > const void *data);
>> > +void issei_device_release(void *ctx);
>> ...
>> > +#else
>> > +
>> > +void *issei_device_open(int (*match)(struct device *, const void *),
>> > const void *data)
>> > +{
>> > +	return ERR_PTR(-EOPNOTSUPP);
>> > +}
>> 
>> What is the intended use case for !CONFIG_INTEL_SSEI in the caller,
>> and what do you expect to happen when CONFIG_INTEL_SSEI=m but the
>> caller is configured as built-in?
>> 
>
> For CONFIG_INTEL_SSEI=m #if IS_ENABLED(CONFIG_INTEL_SSEI) will be true, I hope.

Yes

> Caller anyway should wait for device with issei_device_register_interface() and
> it will receive devices as soon as module will be loaded.

If that configuration is allowed, then calling any of the exported
functions causes a link error. Your only options really are:

a) prevent the broken config using Kconfig
   'depends on INTEL_SSEI || !INTEL_SSEI' for every caller to force
   the caller to e a module instead of built-in driver.

b) remove the stub helpers and use a simpler 'depends on INTEL_SSEI'

       Arnd

      reply	other threads:[~2026-10-15 12:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  5:28 [PATCH char-misc-next 0/4] issei: runtime power management, dma and in-kernel interface Alexander Usyskin
2026-10-15  5:28 ` [PATCH char-misc-next 1/4] issei: save power_down flag while processing event Alexander Usyskin
2026-10-15  5:28 ` [PATCH char-misc-next 2/4] issei: add runtime pm Alexander Usyskin
2026-10-15  5:28 ` [PATCH char-misc-next 3/4] issei: host_client: add dma allocation support Alexander Usyskin
2026-10-15  5:28 ` [PATCH char-misc-next 4/4] issei: add driver to driver interface Alexander Usyskin
2026-10-15  6:29   ` Arnd Bergmann
2026-10-15 12:47     ` Usyskin, Alexander
2026-10-15 12:58       ` Arnd Bergmann [this message]

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=d753e1fa-29c1-4692-b2b3-d592475ae77f@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=alexander.usyskin@intel.com \
    --cc=andrzej.kacprowski@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=karol.wachowski@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menachem.adin@intel.com \
    --cc=reuvenab@gmail.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

all inboxes | Powered by JetHome®