* [PATCH 0/8] drivers: phy: Constify static phy_ops structs
@ 2020-08-23 22:00 Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 2/8] phy: fsl-imx8mq-usb: Constify imx8mq_usb_phy_ops Rikard Falkeborn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul
Cc: linux-arm-kernel, Peter Chen, linux-usb, Alim Akhtar,
Martin Blumenstingl, Fabio Estevam, Sascha Hauer, Binghui Wang,
Yu Chen, linux-kernel, Rikard Falkeborn, Bjorn Andersson,
Andy Gross, NXP Linux Team, Pengutronix Kernel Team,
linux-arm-msm, Shawn Guo, Seungwon Jeon
This series constifies all static phy_ops structs in drivers/phy.
Typically the only usage is to pass the address of it to devm_phy_create()
which takes a const pointer. The lone exception is in
drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c where the address of the
structs is assigned to the data-field in of_device_id, which is a const
void pointer.
Making the structs const allows the compiler to put them in read-only
memory.
The patches are all independent of each other, and have been
compile-tested only.
Rikard Falkeborn (8):
phy: cadence: salvo: Constify cdns_salvo_phy_ops
phy: fsl-imx8mq-usb: Constify imx8mq_usb_phy_ops
phy: hisilicon; Constify hi3660_phy_ops
phy: lantiq: rcu-usb2: Constify ltq_rcu_usb2_phy_ops
phy: lantiq: vrx200-pcie: Constify ltq_vrx200_pcie_phy_ops
phy: ralink-usb: Constify ralink_usb_phy_ops
phy: samsung-ufs: Constify samsung_ufs_phy_ops
phy: qcom-ipq4019-usb: Constify static phy_ops structs
drivers/phy/cadence/phy-cadence-salvo.c | 2 +-
drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 2 +-
drivers/phy/hisilicon/phy-hi3660-usb3.c | 2 +-
drivers/phy/lantiq/phy-lantiq-rcu-usb2.c | 2 +-
drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c | 2 +-
drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c | 4 ++--
drivers/phy/ralink/phy-ralink-usb.c | 2 +-
drivers/phy/samsung/phy-samsung-ufs.c | 2 +-
8 files changed, 9 insertions(+), 9 deletions(-)
--
2.28.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/8] phy: fsl-imx8mq-usb: Constify imx8mq_usb_phy_ops
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
@ 2020-08-23 22:00 ` Rikard Falkeborn
2020-08-23 22:07 ` [PATCH 0/8] drivers: phy: Constify static phy_ops structs Joe Perches
2020-08-31 9:06 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul
Cc: Shawn Guo, Sascha Hauer, linux-kernel, Rikard Falkeborn,
NXP Linux Team, Pengutronix Kernel Team, Fabio Estevam,
linux-arm-kernel
The only usage is to pass its address to devm_phy_create() which takes a
const pointer. Make it const to allow the compiler to put it in
read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
index 0c4833da7be0..0dcca39649d2 100644
--- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
+++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
@@ -76,7 +76,7 @@ static int imx8mq_phy_power_off(struct phy *phy)
return 0;
}
-static struct phy_ops imx8mq_usb_phy_ops = {
+static const struct phy_ops imx8mq_usb_phy_ops = {
.init = imx8mq_usb_phy_init,
.power_on = imx8mq_phy_power_on,
.power_off = imx8mq_phy_power_off,
--
2.28.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/8] drivers: phy: Constify static phy_ops structs
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 2/8] phy: fsl-imx8mq-usb: Constify imx8mq_usb_phy_ops Rikard Falkeborn
@ 2020-08-23 22:07 ` Joe Perches
2020-08-31 9:06 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2020-08-23 22:07 UTC (permalink / raw)
To: Rikard Falkeborn, Kishon Vijay Abraham I, Vinod Koul
Cc: linux-arm-kernel, Peter Chen, linux-usb, Alim Akhtar,
Martin Blumenstingl, Shawn Guo, Sascha Hauer, Binghui Wang,
Yu Chen, linux-kernel, Bjorn Andersson, Andy Gross,
NXP Linux Team, Pengutronix Kernel Team, linux-arm-msm,
Fabio Estevam, Seungwon Jeon
On Mon, 2020-08-24 at 00:00 +0200, Rikard Falkeborn wrote:
> This series constifies all static phy_ops structs in drivers/phy.
> Typically the only usage is to pass the address of it to devm_phy_create()
> which takes a const pointer. The lone exception is in
> drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c where the address of the
> structs is assigned to the data-field in of_device_id, which is a const
> void pointer.
>
> Making the structs const allows the compiler to put them in read-only
> memory.
>
> The patches are all independent of each other, and have been
> compile-tested only.
Perhaps add phy_ops to scripts/const_structs.checkpatch too
---
scripts/const_structs.checkpatch | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/const_structs.checkpatch b/scripts/const_structs.checkpatch
index e9df9cc28a85..cd45cb3c2b04 100644
--- a/scripts/const_structs.checkpatch
+++ b/scripts/const_structs.checkpatch
@@ -39,6 +39,7 @@ nlmsvc_binding
nvkm_device_chip
of_device_id
pci_raw_ops
+phy_ops
pipe_buf_operations
platform_hibernation_ops
platform_suspend_ops
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/8] drivers: phy: Constify static phy_ops structs
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 2/8] phy: fsl-imx8mq-usb: Constify imx8mq_usb_phy_ops Rikard Falkeborn
2020-08-23 22:07 ` [PATCH 0/8] drivers: phy: Constify static phy_ops structs Joe Perches
@ 2020-08-31 9:06 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2020-08-31 9:06 UTC (permalink / raw)
To: Rikard Falkeborn
Cc: linux-arm-kernel, Peter Chen, linux-usb, Alim Akhtar,
Martin Blumenstingl, Fabio Estevam, Sascha Hauer, Binghui Wang,
Yu Chen, linux-kernel, Kishon Vijay Abraham I, Andy Gross,
NXP Linux Team, Pengutronix Kernel Team, linux-arm-msm,
Bjorn Andersson, Shawn Guo, Seungwon Jeon
On 24-08-20, 00:00, Rikard Falkeborn wrote:
> This series constifies all static phy_ops structs in drivers/phy.
> Typically the only usage is to pass the address of it to devm_phy_create()
> which takes a const pointer. The lone exception is in
> drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c where the address of the
> structs is assigned to the data-field in of_device_id, which is a const
> void pointer.
>
> Making the structs const allows the compiler to put them in read-only
> memory.
>
> The patches are all independent of each other, and have been
> compile-tested only.
Applied all, thanks
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-31 9:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 2/8] phy: fsl-imx8mq-usb: Constify imx8mq_usb_phy_ops Rikard Falkeborn
2020-08-23 22:07 ` [PATCH 0/8] drivers: phy: Constify static phy_ops structs Joe Perches
2020-08-31 9:06 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox