* [PATCH] spi: make spi_bus_type const
@ 2024-01-05 10:32 Greg Kroah-Hartman
2024-01-05 14:55 ` Mark Brown
2024-01-22 16:49 ` Mark Brown
0 siblings, 2 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-05 10:32 UTC (permalink / raw)
To: broonie; +Cc: linux-kernel, Greg Kroah-Hartman, linux-spi
Now that the driver core can properly handle constant struct bus_type,
move the spi_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/spi/spi.c | 2 +-
include/linux/spi/spi.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 8ead7acb99f3..6e962befc450 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -459,7 +459,7 @@ static void spi_shutdown(struct device *dev)
}
}
-struct bus_type spi_bus_type = {
+const struct bus_type spi_bus_type = {
.name = "spi",
.dev_groups = spi_dev_groups,
.match = spi_match_device,
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 255a0562aea5..f6c157dee55d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -33,7 +33,7 @@ struct spi_message;
* INTERFACES between SPI master-side drivers and SPI slave protocol handlers,
* and SPI infrastructure.
*/
-extern struct bus_type spi_bus_type;
+extern const struct bus_type spi_bus_type;
/**
* struct spi_statistics - statistics for spi transfers
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] spi: make spi_bus_type const
2024-01-05 10:32 [PATCH] spi: make spi_bus_type const Greg Kroah-Hartman
@ 2024-01-05 14:55 ` Mark Brown
2024-01-05 15:05 ` Greg Kroah-Hartman
2024-01-22 16:49 ` Mark Brown
1 sibling, 1 reply; 8+ messages in thread
From: Mark Brown @ 2024-01-05 14:55 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-spi
[-- Attachment #1: Type: text/plain, Size: 396 bytes --]
On Fri, Jan 05, 2024 at 11:32:50AM +0100, Greg Kroah-Hartman wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the spi_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
Whatever makes the driver core able to handle this doesn't seem to be in
mainline yet - what's the story there?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] spi: make spi_bus_type const
2024-01-05 14:55 ` Mark Brown
@ 2024-01-05 15:05 ` Greg Kroah-Hartman
2024-01-05 15:45 ` Mark Brown
0 siblings, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-05 15:05 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, linux-spi
On Fri, Jan 05, 2024 at 02:55:01PM +0000, Mark Brown wrote:
> On Fri, Jan 05, 2024 at 11:32:50AM +0100, Greg Kroah-Hartman wrote:
> > Now that the driver core can properly handle constant struct bus_type,
> > move the spi_bus_type variable to be a constant structure as well,
> > placing it into read-only memory which can not be modified at runtime.
>
> Whatever makes the driver core able to handle this doesn't seem to be in
> mainline yet - what's the story there?
Odd, what errors are you seeing when you build? I have had to fix up a
few subsys_* calls for this type of thing, but I don't see spi_bus_type
being used in those that I saw in my local tree. Did I miss something
else?
Maybe just wait for after 6.8-rc1, it builds properly here locally :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] spi: make spi_bus_type const
2024-01-05 15:05 ` Greg Kroah-Hartman
@ 2024-01-05 15:45 ` Mark Brown
2024-01-05 15:51 ` Greg Kroah-Hartman
0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2024-01-05 15:45 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-spi
[-- Attachment #1: Type: text/plain, Size: 1037 bytes --]
On Fri, Jan 05, 2024 at 04:05:18PM +0100, Greg Kroah-Hartman wrote:
> On Fri, Jan 05, 2024 at 02:55:01PM +0000, Mark Brown wrote:
> > Whatever makes the driver core able to handle this doesn't seem to be in
> > mainline yet - what's the story there?
> Odd, what errors are you seeing when you build? I have had to fix up a
> few subsys_* calls for this type of thing, but I don't see spi_bus_type
> being used in those that I saw in my local tree. Did I miss something
> else?
> Maybe just wait for after 6.8-rc1, it builds properly here locally :)
It's this on an x86 allmodconfig:
/build/stage/linux/sound/soc/rockchip/rk3399_gru_sound.c:471:29: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
471 | .bus_type = &spi_bus_type,
| ^
cc1: all warnings being treated as errors
so not actually a core thing, I have to confess I didn't notice where
the assignment was when I glanced at the errors.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] spi: make spi_bus_type const
2024-01-05 15:45 ` Mark Brown
@ 2024-01-05 15:51 ` Greg Kroah-Hartman
2024-01-05 15:59 ` Mark Brown
0 siblings, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-05 15:51 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, linux-spi
On Fri, Jan 05, 2024 at 03:45:37PM +0000, Mark Brown wrote:
> On Fri, Jan 05, 2024 at 04:05:18PM +0100, Greg Kroah-Hartman wrote:
> > On Fri, Jan 05, 2024 at 02:55:01PM +0000, Mark Brown wrote:
>
> > > Whatever makes the driver core able to handle this doesn't seem to be in
> > > mainline yet - what's the story there?
>
> > Odd, what errors are you seeing when you build? I have had to fix up a
> > few subsys_* calls for this type of thing, but I don't see spi_bus_type
> > being used in those that I saw in my local tree. Did I miss something
> > else?
>
> > Maybe just wait for after 6.8-rc1, it builds properly here locally :)
>
> It's this on an x86 allmodconfig:
>
> /build/stage/linux/sound/soc/rockchip/rk3399_gru_sound.c:471:29: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> 471 | .bus_type = &spi_bus_type,
> | ^
> cc1: all warnings being treated as errors
>
> so not actually a core thing, I have to confess I didn't notice where
> the assignment was when I glanced at the errors.
Ah, missed that, as it was handled by this commit for the i2c tree:
https://lore.kernel.org/all/2023121942-jumble-unethical-3163@gregkh/
So just hold off on this until after 6.8-rc1 is out, or I can wait until
then as well if you ack it and take it through my tree.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] spi: make spi_bus_type const
2024-01-05 15:51 ` Greg Kroah-Hartman
@ 2024-01-05 15:59 ` Mark Brown
2024-01-05 16:02 ` Greg Kroah-Hartman
0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2024-01-05 15:59 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-spi
[-- Attachment #1: Type: text/plain, Size: 602 bytes --]
On Fri, Jan 05, 2024 at 04:51:04PM +0100, Greg Kroah-Hartman wrote:
> On Fri, Jan 05, 2024 at 03:45:37PM +0000, Mark Brown wrote:
> > so not actually a core thing, I have to confess I didn't notice where
> > the assignment was when I glanced at the errors.
> Ah, missed that, as it was handled by this commit for the i2c tree:
> https://lore.kernel.org/all/2023121942-jumble-unethical-3163@gregkh/
> So just hold off on this until after 6.8-rc1 is out, or I can wait until
> then as well if you ack it and take it through my tree.
It's OK - I can just drop it in my queue for applying after -rc1.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] spi: make spi_bus_type const
2024-01-05 15:59 ` Mark Brown
@ 2024-01-05 16:02 ` Greg Kroah-Hartman
0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-05 16:02 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, linux-spi
On Fri, Jan 05, 2024 at 03:59:04PM +0000, Mark Brown wrote:
> On Fri, Jan 05, 2024 at 04:51:04PM +0100, Greg Kroah-Hartman wrote:
> > On Fri, Jan 05, 2024 at 03:45:37PM +0000, Mark Brown wrote:
>
> > > so not actually a core thing, I have to confess I didn't notice where
> > > the assignment was when I glanced at the errors.
>
> > Ah, missed that, as it was handled by this commit for the i2c tree:
> > https://lore.kernel.org/all/2023121942-jumble-unethical-3163@gregkh/
>
> > So just hold off on this until after 6.8-rc1 is out, or I can wait until
> > then as well if you ack it and take it through my tree.
>
> It's OK - I can just drop it in my queue for applying after -rc1.
Wonderful, many thanks.
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] spi: make spi_bus_type const
2024-01-05 10:32 [PATCH] spi: make spi_bus_type const Greg Kroah-Hartman
2024-01-05 14:55 ` Mark Brown
@ 2024-01-22 16:49 ` Mark Brown
1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2024-01-22 16:49 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-spi
On Fri, 05 Jan 2024 11:32:50 +0100, Greg Kroah-Hartman wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the spi_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: make spi_bus_type const
commit: 6df534cc7136fc9e023cbd4e0011a04e3659e74d
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-01-22 16:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-05 10:32 [PATCH] spi: make spi_bus_type const Greg Kroah-Hartman
2024-01-05 14:55 ` Mark Brown
2024-01-05 15:05 ` Greg Kroah-Hartman
2024-01-05 15:45 ` Mark Brown
2024-01-05 15:51 ` Greg Kroah-Hartman
2024-01-05 15:59 ` Mark Brown
2024-01-05 16:02 ` Greg Kroah-Hartman
2024-01-22 16:49 ` Mark Brown
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).