From: "Danilo Krummrich" <dakr@kernel.org>
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Cc: "Mark Brown" <broonie@kernel.org>,
driver-core@lists.linux.dev, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
linux-spi@vger.kernel.org,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Jean-Baptiste Maneyrol" <jean-baptiste.maneyrol@tdk.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>
Subject: Re: [PATCH v1 2/4] spi: Support suppress_override_attrs flag
Date: Fri, 08 May 2026 17:28:47 +0200 [thread overview]
Message-ID: <DIDEH8M45VNJ.2983JIAEX3DRM@kernel.org> (raw)
In-Reply-To: <20260508095224.1275645-3-andriy.shevchenko@linux.intel.com>
On Fri May 8, 2026 at 11:42 AM CEST, Andy Shevchenko wrote:
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 5f57de24b9f7..40e738f8cbb7 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -214,8 +214,19 @@ static struct attribute *spi_dev_attrs[] = {
> NULL,
> };
>
> +static umode_t spi_dev_attr_is_visible(struct kobject *kobj, struct attribute *attr, int i)
> +{
> + struct device *dev = kobj_to_dev(kobj);
> +
> + if (attr == &dev_attr_driver_override.attr)
> + return dev->driver->suppress_override_attrs ? 0 : attr->mode;
This should have the same design problem as described in [1].
Also, wouldn't this oops the kernel right away as dev->driver should be NULL?
How did you test this?
[1] https://lore.kernel.org/driver-core/DIDE94YBOOP3.KM9I6J4JIJIY@kernel.org/
> +
> + return attr->mode;
> +}
> +
> static const struct attribute_group spi_dev_group = {
> .attrs = spi_dev_attrs,
> + .is_visible = spi_dev_attr_is_visible,
> };
>
> static struct attribute *spi_device_statistics_attrs[] = {
> --
> 2.50.1
next prev parent reply other threads:[~2026-05-08 15:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 9:42 [PATCH v1 0/4] driver core, iio: suppress driver_override Andy Shevchenko
2026-05-08 9:42 ` [PATCH v1 1/4] driver core: allow certain drivers prohibit override via sysfs Andy Shevchenko
2026-05-08 15:18 ` Danilo Krummrich
2026-05-23 14:13 ` kernel test robot
2026-05-08 9:42 ` [PATCH v1 2/4] spi: Support suppress_override_attrs flag Andy Shevchenko
2026-05-08 13:53 ` Mark Brown
2026-05-08 15:28 ` Danilo Krummrich [this message]
2026-05-08 9:42 ` [PATCH v1 3/4] iio: imu: inv_mpu6050: Suppress driver_override sysfs attribute Andy Shevchenko
2026-05-08 9:42 ` [PATCH v1 4/4] iio: imu: inv_icm42600: " Andy Shevchenko
2026-05-08 12:22 ` [PATCH v1 0/4] driver core, iio: suppress driver_override Jonathan Cameron
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=DIDEH8M45VNJ.2983JIAEX3DRM@kernel.org \
--to=dakr@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=broonie@kernel.org \
--cc=corbet@lwn.net \
--cc=dlechner@baylibre.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=jic23@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=rafael@kernel.org \
--cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.