public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	markgross@kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] platform/x86/intel/tpmi: Don't create devices for disabled features
Date: Thu, 30 Nov 2023 09:29:02 -0500	[thread overview]
Message-ID: <29cf2ab24e5d63e2b1268516ad7ab2b1beb44c91.camel@linux.intel.com> (raw)
In-Reply-To: <9603f75-3adb-8eba-9322-cbd9551668c8@linux.intel.com>

On Thu, 2023-11-30 at 14:26 +0200, Ilpo Järvinen wrote:
> On Tue, 28 Nov 2023, Srinivas Pandruvada wrote:
> 
> > If some TPMI features are disabled, don't create auxiliary devices.
> > In
> > this way feature drivers will not load.
> > 
> > While creating auxiliary devices, call tpmi_read_feature_status()
> > to
> > check feature state and return if the feature is disabled without
> > creating a device.
> > 
> > Signed-off-by: Srinivas Pandruvada
> > <srinivas.pandruvada@linux.intel.com>
> > ---
> >  drivers/platform/x86/intel/tpmi.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/platform/x86/intel/tpmi.c
> > b/drivers/platform/x86/intel/tpmi.c
> > index c89aa4d14bea..4edaa182db04 100644
> > --- a/drivers/platform/x86/intel/tpmi.c
> > +++ b/drivers/platform/x86/intel/tpmi.c
> > @@ -604,9 +604,17 @@ static int tpmi_create_device(struct
> > intel_tpmi_info *tpmi_info,
> >         struct intel_vsec_device *vsec_dev = tpmi_info->vsec_dev;
> >         char feature_id_name[TPMI_FEATURE_NAME_LEN];
> >         struct intel_vsec_device *feature_vsec_dev;
> > +       struct tpmi_feature_state feature_state;
> >         struct resource *res, *tmp;
> >         const char *name;
> > -       int i;
> > +       int i, ret;
> > +
> > +       ret = tpmi_read_feature_status(tpmi_info, pfs-
> > >pfs_header.tpmi_id, &feature_state);
> > +       if (ret)
> > +               return ret;
> > +
> > +       if (!feature_state.enabled)
> > +               return -EOPNOTSUPP;
> 
> -ENODEV sounds more appropriate.  
The -EOPNOTSUPP is returned matching the next return statement, which
causes to continue to create devices which are supported and not
disabled. Any other error is real device creation will causes driver
modprobe to fail.

Thanks,
Srinivas


  reply	other threads:[~2023-11-30 14:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 18:55 [PATCH 0/6] TPMI update for new defines and permissions Srinivas Pandruvada
2023-11-28 18:56 ` [PATCH 1/6] platform/x86/intel/tpmi: Add additional TPMI header fields Srinivas Pandruvada
2023-11-30 12:33   ` Ilpo Järvinen
2023-11-30 14:10     ` srinivas pandruvada
2023-11-28 18:56 ` [PATCH 2/6] platform/x86/intel/tpmi: Don't create devices for disabled features Srinivas Pandruvada
2023-11-30 12:26   ` Ilpo Järvinen
2023-11-30 14:29     ` srinivas pandruvada [this message]
2023-11-30 14:33       ` Ilpo Järvinen
2023-11-30 14:38         ` Andy Shevchenko
2023-11-30 15:00           ` srinivas pandruvada
2023-11-30 21:15             ` srinivas pandruvada
2023-11-28 18:56 ` [PATCH 3/6] platform/x86/intel/tpmi: Modify external interface to get read/write state Srinivas Pandruvada
2023-11-30 12:08   ` Ilpo Järvinen
2023-11-28 18:56 ` [PATCH 4/6] platform/x86/intel/tpmi: Move TPMI ID definitions Srinivas Pandruvada
2023-11-30 12:01   ` Ilpo Järvinen
2023-11-28 18:56 ` [PATCH 5/6] platform/x86: ISST: Process read/write blocked feature status Srinivas Pandruvada
2023-11-30 12:20   ` Ilpo Järvinen
2023-11-30 14:30     ` srinivas pandruvada
2023-11-28 18:56 ` [PATCH 6/6] platform/x86/intel-uncore-freq: " Srinivas Pandruvada
2023-11-30 12:24   ` Ilpo Järvinen

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=29cf2ab24e5d63e2b1268516ad7ab2b1beb44c91.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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