* [PATCH 1/8] phy: cadence: salvo: Constify cdns_salvo_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:00 ` [PATCH 2/8] phy: fsl-imx8mq-usb: Constify imx8mq_usb_phy_ops Rikard Falkeborn
` (8 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul
Cc: linux-kernel, Rikard Falkeborn, Peter Chen
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/cadence/phy-cadence-salvo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/cadence/phy-cadence-salvo.c b/drivers/phy/cadence/phy-cadence-salvo.c
index 016514e4aa54..8c33d3215f2d 100644
--- a/drivers/phy/cadence/phy-cadence-salvo.c
+++ b/drivers/phy/cadence/phy-cadence-salvo.c
@@ -251,7 +251,7 @@ static int cdns_salvo_phy_power_off(struct phy *phy)
return 0;
}
-static struct phy_ops cdns_salvo_phy_ops = {
+static const struct phy_ops cdns_salvo_phy_ops = {
.init = cdns_salvo_phy_init,
.power_on = cdns_salvo_phy_power_on,
.power_off = cdns_salvo_phy_power_off,
--
2.28.0
^ permalink raw reply [flat|nested] 12+ 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 ` [PATCH 1/8] phy: cadence: salvo: Constify cdns_salvo_phy_ops Rikard Falkeborn
@ 2020-08-23 22:00 ` Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 3/8] phy: hisilicon; Constify hi3660_phy_ops Rikard Falkeborn
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul
Cc: linux-kernel, Rikard Falkeborn, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
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
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 3/8] phy: hisilicon; Constify hi3660_phy_ops
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 1/8] phy: cadence: salvo: Constify cdns_salvo_phy_ops 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:00 ` Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 4/8] phy: lantiq: rcu-usb2: Constify ltq_rcu_usb2_phy_ops Rikard Falkeborn
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul
Cc: linux-kernel, Rikard Falkeborn, Yu Chen, Binghui Wang, linux-usb
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/hisilicon/phy-hi3660-usb3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/hisilicon/phy-hi3660-usb3.c b/drivers/phy/hisilicon/phy-hi3660-usb3.c
index cc0af2c044d0..84adce9b4277 100644
--- a/drivers/phy/hisilicon/phy-hi3660-usb3.c
+++ b/drivers/phy/hisilicon/phy-hi3660-usb3.c
@@ -161,7 +161,7 @@ static int hi3660_phy_exit(struct phy *phy)
return ret;
}
-static struct phy_ops hi3660_phy_ops = {
+static const struct phy_ops hi3660_phy_ops = {
.init = hi3660_phy_init,
.exit = hi3660_phy_exit,
.owner = THIS_MODULE,
--
2.28.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 4/8] phy: lantiq: rcu-usb2: Constify ltq_rcu_usb2_phy_ops
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
` (2 preceding siblings ...)
2020-08-23 22:00 ` [PATCH 3/8] phy: hisilicon; Constify hi3660_phy_ops Rikard Falkeborn
@ 2020-08-23 22:00 ` Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 5/8] phy: lantiq: vrx200-pcie: Constify ltq_vrx200_pcie_phy_ops Rikard Falkeborn
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul; +Cc: linux-kernel, Rikard Falkeborn
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/lantiq/phy-lantiq-rcu-usb2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/lantiq/phy-lantiq-rcu-usb2.c b/drivers/phy/lantiq/phy-lantiq-rcu-usb2.c
index be09b1530ae6..a7d126192cf1 100644
--- a/drivers/phy/lantiq/phy-lantiq-rcu-usb2.c
+++ b/drivers/phy/lantiq/phy-lantiq-rcu-usb2.c
@@ -141,7 +141,7 @@ static int ltq_rcu_usb2_phy_power_off(struct phy *phy)
return 0;
}
-static struct phy_ops ltq_rcu_usb2_phy_ops = {
+static const struct phy_ops ltq_rcu_usb2_phy_ops = {
.init = ltq_rcu_usb2_phy_init,
.power_on = ltq_rcu_usb2_phy_power_on,
.power_off = ltq_rcu_usb2_phy_power_off,
--
2.28.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 5/8] phy: lantiq: vrx200-pcie: Constify ltq_vrx200_pcie_phy_ops
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
` (3 preceding siblings ...)
2020-08-23 22:00 ` [PATCH 4/8] phy: lantiq: rcu-usb2: Constify ltq_rcu_usb2_phy_ops Rikard Falkeborn
@ 2020-08-23 22:00 ` Rikard Falkeborn
2020-08-24 18:13 ` Martin Blumenstingl
2020-08-23 22:00 ` [PATCH 6/8] phy: ralink-usb: Constify ralink_usb_phy_ops Rikard Falkeborn
` (4 subsequent siblings)
9 siblings, 1 reply; 12+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul
Cc: linux-kernel, Rikard Falkeborn, Martin Blumenstingl
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/lantiq/phy-lantiq-vrx200-pcie.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c b/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c
index 2ff9a48d833e..22c5698123cf 100644
--- a/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c
+++ b/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c
@@ -349,7 +349,7 @@ static int ltq_vrx200_pcie_phy_power_off(struct phy *phy)
return 0;
}
-static struct phy_ops ltq_vrx200_pcie_phy_ops = {
+static const struct phy_ops ltq_vrx200_pcie_phy_ops = {
.init = ltq_vrx200_pcie_phy_init,
.exit = ltq_vrx200_pcie_phy_exit,
.power_on = ltq_vrx200_pcie_phy_power_on,
--
2.28.0
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 5/8] phy: lantiq: vrx200-pcie: Constify ltq_vrx200_pcie_phy_ops
2020-08-23 22:00 ` [PATCH 5/8] phy: lantiq: vrx200-pcie: Constify ltq_vrx200_pcie_phy_ops Rikard Falkeborn
@ 2020-08-24 18:13 ` Martin Blumenstingl
0 siblings, 0 replies; 12+ messages in thread
From: Martin Blumenstingl @ 2020-08-24 18:13 UTC (permalink / raw)
To: Rikard Falkeborn; +Cc: Kishon Vijay Abraham I, Vinod Koul, linux-kernel
On Mon, Aug 24, 2020 at 12:00 AM Rikard Falkeborn
<rikard.falkeborn@gmail.com> wrote:
>
> 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>
thank you for this patch! please add my:
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 6/8] phy: ralink-usb: Constify ralink_usb_phy_ops
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
` (4 preceding siblings ...)
2020-08-23 22:00 ` [PATCH 5/8] phy: lantiq: vrx200-pcie: Constify ltq_vrx200_pcie_phy_ops Rikard Falkeborn
@ 2020-08-23 22:00 ` Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 7/8] phy: samsung-ufs: Constify samsung_ufs_phy_ops Rikard Falkeborn
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul; +Cc: linux-kernel, Rikard Falkeborn
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/ralink/phy-ralink-usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/ralink/phy-ralink-usb.c b/drivers/phy/ralink/phy-ralink-usb.c
index ba3c197fc5b0..95dfa9fd284d 100644
--- a/drivers/phy/ralink/phy-ralink-usb.c
+++ b/drivers/phy/ralink/phy-ralink-usb.c
@@ -142,7 +142,7 @@ static int ralink_usb_phy_power_off(struct phy *_phy)
return 0;
}
-static struct phy_ops ralink_usb_phy_ops = {
+static const struct phy_ops ralink_usb_phy_ops = {
.power_on = ralink_usb_phy_power_on,
.power_off = ralink_usb_phy_power_off,
.owner = THIS_MODULE,
--
2.28.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 7/8] phy: samsung-ufs: Constify samsung_ufs_phy_ops
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
` (5 preceding siblings ...)
2020-08-23 22:00 ` [PATCH 6/8] phy: ralink-usb: Constify ralink_usb_phy_ops Rikard Falkeborn
@ 2020-08-23 22:00 ` Rikard Falkeborn
2020-08-23 22:00 ` [PATCH 8/8] phy: qcom-ipq4019-usb: Constify static phy_ops structs Rikard Falkeborn
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul
Cc: linux-kernel, Rikard Falkeborn, Alim Akhtar, Seungwon Jeon
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/samsung/phy-samsung-ufs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/samsung/phy-samsung-ufs.c b/drivers/phy/samsung/phy-samsung-ufs.c
index 9832599a0283..dd9ab1519d83 100644
--- a/drivers/phy/samsung/phy-samsung-ufs.c
+++ b/drivers/phy/samsung/phy-samsung-ufs.c
@@ -268,7 +268,7 @@ static int samsung_ufs_phy_exit(struct phy *phy)
return 0;
}
-static struct phy_ops samsung_ufs_phy_ops = {
+static const struct phy_ops samsung_ufs_phy_ops = {
.init = samsung_ufs_phy_init,
.exit = samsung_ufs_phy_exit,
.power_on = samsung_ufs_phy_power_on,
--
2.28.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 8/8] phy: qcom-ipq4019-usb: Constify static phy_ops structs
2020-08-23 22:00 [PATCH 0/8] drivers: phy: Constify static phy_ops structs Rikard Falkeborn
` (6 preceding siblings ...)
2020-08-23 22:00 ` [PATCH 7/8] phy: samsung-ufs: Constify samsung_ufs_phy_ops Rikard Falkeborn
@ 2020-08-23 22:00 ` Rikard Falkeborn
2020-08-23 22:07 ` [PATCH 0/8] drivers: phy: " Joe Perches
2020-08-31 9:06 ` Vinod Koul
9 siblings, 0 replies; 12+ messages in thread
From: Rikard Falkeborn @ 2020-08-23 22:00 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul
Cc: linux-kernel, Rikard Falkeborn, Andy Gross, Bjorn Andersson,
linux-arm-msm
Their only usages is to assign the address to the data field in the
of_device_id struct, which is a const void pointer. Make them const to
allow the compiler to put them in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
index b8ef331e1545..fc7f9df80a7b 100644
--- a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
@@ -48,7 +48,7 @@ static int ipq4019_ss_phy_power_on(struct phy *_phy)
return 0;
}
-static struct phy_ops ipq4019_usb_ss_phy_ops = {
+static const struct phy_ops ipq4019_usb_ss_phy_ops = {
.power_on = ipq4019_ss_phy_power_on,
.power_off = ipq4019_ss_phy_power_off,
};
@@ -80,7 +80,7 @@ static int ipq4019_hs_phy_power_on(struct phy *_phy)
return 0;
}
-static struct phy_ops ipq4019_usb_hs_phy_ops = {
+static const struct phy_ops ipq4019_usb_hs_phy_ops = {
.power_on = ipq4019_hs_phy_power_on,
.power_off = ipq4019_hs_phy_power_off,
};
--
2.28.0
^ permalink raw reply [flat|nested] 12+ 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
` (7 preceding siblings ...)
2020-08-23 22:00 ` [PATCH 8/8] phy: qcom-ipq4019-usb: Constify static phy_ops structs Rikard Falkeborn
@ 2020-08-23 22:07 ` Joe Perches
2020-08-31 9:06 ` Vinod Koul
9 siblings, 0 replies; 12+ 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-kernel, Peter Chen, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Yu Chen,
Binghui Wang, Martin Blumenstingl, Alim Akhtar, Seungwon Jeon,
Andy Gross, Bjorn Andersson, linux-arm-kernel, linux-usb,
linux-arm-msm
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
^ permalink raw reply [flat|nested] 12+ 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
` (8 preceding siblings ...)
2020-08-23 22:07 ` [PATCH 0/8] drivers: phy: " Joe Perches
@ 2020-08-31 9:06 ` Vinod Koul
9 siblings, 0 replies; 12+ messages in thread
From: Vinod Koul @ 2020-08-31 9:06 UTC (permalink / raw)
To: Rikard Falkeborn
Cc: Kishon Vijay Abraham I, linux-kernel, Peter Chen, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Yu Chen, Binghui Wang, Martin Blumenstingl,
Alim Akhtar, Seungwon Jeon, Andy Gross, Bjorn Andersson,
linux-arm-kernel, linux-usb, linux-arm-msm
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
^ permalink raw reply [flat|nested] 12+ messages in thread