public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Srinivas Pandruvada <srinivas.pandruvada@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 v2 1/5] platform/x86/intel/tpmi: Don't create devices for disabled features
Date: Mon, 4 Dec 2023 16:14:09 +0200 (EET)	[thread overview]
Message-ID: <754da92-fa4e-5340-c9be-348c4b8f97a2@linux.intel.com> (raw)
In-Reply-To: <20231130214751.3100418-2-srinivas.pandruvada@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1650 bytes --]

On Thu, 30 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>
> ---
> v2
> - Add comment for returning -EOPNOTSUPP
> 
>  drivers/platform/x86/intel/tpmi.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/intel/tpmi.c b/drivers/platform/x86/intel/tpmi.c
> index c89aa4d14bea..868067ff966e 100644
> --- a/drivers/platform/x86/intel/tpmi.c
> +++ b/drivers/platform/x86/intel/tpmi.c
> @@ -604,9 +604,21 @@ 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 not enabled, continue to look at other features in the PFS, so return -EOPNOTSUPP.
> +	 * This will not cause failure of loading of this driver.
> +	 */
> +	if (!feature_state.enabled)
> +		return -EOPNOTSUPP;
>  
>  	name = intel_tpmi_name(pfs->pfs_header.tpmi_id);
>  	if (!name)

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

  parent reply	other threads:[~2023-12-04 14:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 21:47 [PATCH v2 0/5] TPMI update for permissions Srinivas Pandruvada
2023-11-30 21:47 ` [PATCH v2 1/5] platform/x86/intel/tpmi: Don't create devices for disabled features Srinivas Pandruvada
2023-12-04 14:03   ` Hans de Goede
2023-12-04 14:14   ` Ilpo Järvinen [this message]
2023-11-30 21:47 ` [PATCH v2 2/5] platform/x86/intel/tpmi: Modify external interface to get read/write state Srinivas Pandruvada
2023-11-30 21:47 ` [PATCH v2 3/5] platform/x86/intel/tpmi: Move TPMI ID definition Srinivas Pandruvada
2023-11-30 21:47 ` [PATCH v2 4/5] platform/x86: ISST: Process read/write blocked feature status Srinivas Pandruvada
2023-12-04 14:06   ` Hans de Goede
2023-12-04 14:11     ` Ilpo Järvinen
2023-12-04 14:19       ` Hans de Goede
2023-11-30 21:47 ` [PATCH v2 5/5] platform/x86/intel-uncore-freq: " Srinivas Pandruvada
2023-11-30 23:24 ` [PATCH v2 0/5] TPMI update for permissions srinivas pandruvada
2023-12-04 14:06   ` Hans de Goede

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=754da92-fa4e-5340-c9be-348c4b8f97a2@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.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