2017-08-15 10:36:12

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 00/13] constify s390 ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark ccw_device_id member of struct ccw driver
as const. And change all driver relatively.

Arvind Yadav (13):
[RFT 01/13] s390: ccwdev: constify ccw_device_id
[RFT 02/13] s390: dasd_eckd: constify ccw_device_id
[RFT 03/13] s390: dasd_fba: constify ccw_device_id
[RFT 04/13] s390: con3215: constify ccw_device_id
[RFT 05/13] s390: raw3270: constify ccw_device_id
[RFT 06/13] s390: tape_34xx: constify ccw_device_id
[RFT 07/13] s390: tape_3590: constify ccw_device_id
[RFT 08/13] s390: vmur: constify ccw_device_id
[RFT 09/13] s390: ctcm: constify ccw_device_id
[RFT 10/13] s390: lcs: constify ccw_device_id
[RFT 11/13] s390: qeth: constify ccw_device_id
[RFT 12/13] s390: zfcp: constify ccw_device_id
[RFT 13/13] s390: virtio: constify ccw_device_id

arch/s390/include/asm/ccwdev.h | 2 +-
drivers/s390/block/dasd_eckd.c | 2 +-
drivers/s390/block/dasd_fba.c | 2 +-
drivers/s390/char/con3215.c | 2 +-
drivers/s390/char/raw3270.c | 2 +-
drivers/s390/char/tape_34xx.c | 2 +-
drivers/s390/char/tape_3590.c | 2 +-
drivers/s390/char/vmur.c | 2 +-
drivers/s390/net/ctcm_main.c | 2 +-
drivers/s390/net/lcs.c | 2 +-
drivers/s390/net/qeth_core_main.c | 2 +-
drivers/s390/scsi/zfcp_ccw.c | 2 +-
drivers/s390/virtio/virtio_ccw.c | 2 +-
13 files changed, 13 insertions(+), 13 deletions(-)

--
2.7.4


2017-08-15 10:36:19

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 01/13] s390: ccwdev: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. AlL functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark ccw_device_id as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/s390/include/asm/ccwdev.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
index b80e456..d5c7af2 100644
--- a/arch/s390/include/asm/ccwdev.h
+++ b/arch/s390/include/asm/ccwdev.h
@@ -132,7 +132,7 @@ enum uc_todo {
* @int_class: interruption class to use for accounting interrupts
*/
struct ccw_driver {
- struct ccw_device_id *ids;
+ const struct ccw_device_id *ids;
int (*probe) (struct ccw_device *);
void (*remove) (struct ccw_device *);
int (*set_online) (struct ccw_device *);
--
2.7.4

2017-08-15 10:36:28

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 04/13] s390: con3215: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/char/con3215.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 9ec4ae0..632874d 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -791,7 +791,7 @@ static int raw3215_pm_start(struct ccw_device *cdev)
return 0;
}

-static struct ccw_device_id raw3215_id[] = {
+static const struct ccw_device_id raw3215_id[] = {
{ CCW_DEVICE(0x3215, 0) },
{ /* end of list */ },
};
--
2.7.4

2017-08-15 10:36:34

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 05/13] s390: raw3270: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/char/raw3270.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index 710f229..e51362c 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -1267,7 +1267,7 @@ void raw3270_pm_unfreeze(struct raw3270_view *view)
#endif
}

-static struct ccw_device_id raw3270_id[] = {
+static const struct ccw_device_id raw3270_id[] = {
{ CCW_DEVICE(0x3270, 0) },
{ CCW_DEVICE(0x3271, 0) },
{ CCW_DEVICE(0x3272, 0) },
--
2.7.4

2017-08-15 10:36:40

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 07/13] s390: tape_3590: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/char/tape_3590.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index e352047..576949e 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -1627,7 +1627,7 @@ static struct tape_discipline tape_discipline_3590 = {
.mtop_array = tape_3590_mtop
};

-static struct ccw_device_id tape_3590_ids[] = {
+static const struct ccw_device_id tape_3590_ids[] = {
{CCW_DEVICE_DEVTYPE(0x3590, 0, 0x3590, 0), .driver_info = tape_3590},
{CCW_DEVICE_DEVTYPE(0x3592, 0, 0x3592, 0), .driver_info = tape_3592},
{ /* end of list */ }
--
2.7.4

2017-08-15 10:36:46

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 08/13] s390: vmur: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/char/vmur.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 04aceb6..3d0cf06 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -49,7 +49,7 @@ static struct class *vmur_class;
static struct debug_info *vmur_dbf;

/* We put the device's record length (for writes) in the driver_info field */
-static struct ccw_device_id ur_ids[] = {
+static const struct ccw_device_id ur_ids[] = {
{ CCWDEV_CU_DI(READER_PUNCH_DEVTYPE, 80) },
{ CCWDEV_CU_DI(PRINTER_DEVTYPE, 132) },
{ /* end of list */ }
--
2.7.4

2017-08-15 10:36:52

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 10/13] s390: lcs: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/net/lcs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 619da81..55179ca 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -2373,7 +2373,7 @@ static int lcs_restore(struct ccwgroup_device *gdev)
return lcs_pm_resume(card);
}

-static struct ccw_device_id lcs_ids[] = {
+static const struct ccw_device_id lcs_ids[] = {
{CCW_DEVICE(0x3088, 0x08), .driver_info = lcs_channel_type_parallel},
{CCW_DEVICE(0x3088, 0x1f), .driver_info = lcs_channel_type_2216},
{CCW_DEVICE(0x3088, 0x60), .driver_info = lcs_channel_type_osa2},
--
2.7.4

2017-08-15 10:36:56

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 11/13] s390: qeth: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/net/qeth_core_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 4792cab..205ef0e 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5053,7 +5053,7 @@ void qeth_trace_features(struct qeth_card *card)
}
EXPORT_SYMBOL_GPL(qeth_trace_features);

-static struct ccw_device_id qeth_ids[] = {
+static const struct ccw_device_id qeth_ids[] = {
{CCW_DEVICE_DEVTYPE(0x1731, 0x01, 0x1732, 0x01),
.driver_info = QETH_CARD_TYPE_OSD},
{CCW_DEVICE_DEVTYPE(0x1731, 0x05, 0x1732, 0x05),
--
2.7.4

2017-08-15 10:37:02

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 13/13] s390: virtio: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/virtio/virtio_ccw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index b18fe20..b43dbba 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -1307,7 +1307,7 @@ static int virtio_ccw_cio_notify(struct ccw_device *cdev, int event)
return rc;
}

-static struct ccw_device_id virtio_ids[] = {
+static const struct ccw_device_id virtio_ids[] = {
{ CCW_DEVICE(0x3832, 0) },
{},
};
--
2.7.4

2017-08-15 10:37:21

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 12/13] s390: zfcp: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/scsi/zfcp_ccw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index 54c7b48..af45d67 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -78,7 +78,7 @@ static int zfcp_ccw_activate(struct ccw_device *cdev, int clear, char *tag)
return 0;
}

-static struct ccw_device_id zfcp_ccw_device_id[] = {
+static const struct ccw_device_id zfcp_ccw_device_id[] = {
{ CCW_DEVICE_DEVTYPE(0x1731, 0x3, 0x1732, 0x3) },
{ CCW_DEVICE_DEVTYPE(0x1731, 0x3, 0x1732, ZFCP_MODEL_PRIV) },
{},
--
2.7.4

2017-08-15 10:38:04

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 09/13] s390: ctcm: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/net/ctcm_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index 1563b14..fb26206 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -1737,7 +1737,7 @@ static int ctcm_pm_resume(struct ccwgroup_device *gdev)
return rc;
}

-static struct ccw_device_id ctcm_ids[] = {
+static const struct ccw_device_id ctcm_ids[] = {
{CCW_DEVICE(0x3088, 0x08), .driver_info = ctcm_channel_type_parallel},
{CCW_DEVICE(0x3088, 0x1e), .driver_info = ctcm_channel_type_ficon},
{CCW_DEVICE(0x3088, 0x1f), .driver_info = ctcm_channel_type_escon},
--
2.7.4

2017-08-15 10:38:27

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 06/13] s390: tape_34xx: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/char/tape_34xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c
index de69f0d..7204b6f 100644
--- a/drivers/s390/char/tape_34xx.c
+++ b/drivers/s390/char/tape_34xx.c
@@ -1165,7 +1165,7 @@ static struct tape_discipline tape_discipline_34xx = {
.mtop_array = tape_34xx_mtop
};

-static struct ccw_device_id tape_34xx_ids[] = {
+static const struct ccw_device_id tape_34xx_ids[] = {
{ CCW_DEVICE_DEVTYPE(0x3480, 0, 0x3480, 0), .driver_info = tape_3480},
{ CCW_DEVICE_DEVTYPE(0x3490, 0, 0x3490, 0), .driver_info = tape_3490},
{ /* end of list */ },
--
2.7.4

2017-08-15 10:36:25

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 03/13] s390: dasd_fba: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/block/dasd_fba.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 462cab5..2f7c044 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -44,7 +44,7 @@ struct dasd_fba_private {
struct dasd_fba_characteristics rdc_data;
};

-static struct ccw_device_id dasd_fba_ids[] = {
+static const struct ccw_device_id dasd_fba_ids[] = {
{ CCW_DEVICE_DEVTYPE (0x6310, 0, 0x9336, 0), .driver_info = 0x1},
{ CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3370, 0), .driver_info = 0x2},
{ /* end of list */ },
--
2.7.4

2017-08-15 10:39:06

by Arvind Yadav

[permalink] [raw]
Subject: [RFT 02/13] s390: dasd_eckd: constify ccw_device_id

ccw_device_id are not supposed to change at runtime. All functions
working with ccw_device_id provided by <asm/ccwdev.h> work with
const ccw_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/s390/block/dasd_eckd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index c3e5ad6..40e7078 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -70,7 +70,7 @@ static struct dasd_discipline dasd_eckd_discipline;

/* The ccw bus type uses this table to find devices that it sends to
* dasd_eckd_probe */
-static struct ccw_device_id dasd_eckd_ids[] = {
+static const struct ccw_device_id dasd_eckd_ids[] = {
{ CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3390, 0), .driver_info = 0x1},
{ CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3390, 0), .driver_info = 0x2},
{ CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3380, 0), .driver_info = 0x3},
--
2.7.4

2017-08-15 11:12:01

by Cornelia Huck

[permalink] [raw]
Subject: Re: [RFT 13/13] s390: virtio: constify ccw_device_id

On Tue, 15 Aug 2017 16:05:44 +0530
Arvind Yadav <[email protected]> wrote:

> ccw_device_id are not supposed to change at runtime. All functions
> working with ccw_device_id provided by <asm/ccwdev.h> work with
> const ccw_device_id. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav <[email protected]>
> ---
> drivers/s390/virtio/virtio_ccw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
> index b18fe20..b43dbba 100644
> --- a/drivers/s390/virtio/virtio_ccw.c
> +++ b/drivers/s390/virtio/virtio_ccw.c
> @@ -1307,7 +1307,7 @@ static int virtio_ccw_cio_notify(struct ccw_device *cdev, int event)
> return rc;
> }
>
> -static struct ccw_device_id virtio_ids[] = {
> +static const struct ccw_device_id virtio_ids[] = {
> { CCW_DEVICE(0x3832, 0) },
> {},
> };

Acked-by: Cornelia Huck <[email protected]>

2017-08-15 11:30:53

by Heiko Carstens

[permalink] [raw]
Subject: Re: [RFT 00/13] constify s390 ccw_device_id

On Tue, Aug 15, 2017 at 04:05:31PM +0530, Arvind Yadav wrote:
> ccw_device_id are not supposed to change at runtime. All functions
> working with ccw_device_id provided by <asm/ccwdev.h> work with
> const ccw_device_id. So mark ccw_device_id member of struct ccw driver
> as const. And change all driver relatively.
>
> Arvind Yadav (13):
> [RFT 01/13] s390: ccwdev: constify ccw_device_id
> [RFT 02/13] s390: dasd_eckd: constify ccw_device_id
> [RFT 03/13] s390: dasd_fba: constify ccw_device_id
> [RFT 04/13] s390: con3215: constify ccw_device_id
> [RFT 05/13] s390: raw3270: constify ccw_device_id
> [RFT 06/13] s390: tape_34xx: constify ccw_device_id
> [RFT 07/13] s390: tape_3590: constify ccw_device_id
> [RFT 08/13] s390: vmur: constify ccw_device_id
> [RFT 09/13] s390: ctcm: constify ccw_device_id
> [RFT 10/13] s390: lcs: constify ccw_device_id
> [RFT 11/13] s390: qeth: constify ccw_device_id
> [RFT 12/13] s390: zfcp: constify ccw_device_id
> [RFT 13/13] s390: virtio: constify ccw_device_id

Did the constify work reveal a single bug until now? This causes a lot of
code churn, and I'm failing to see an added value here.
In addition this is not worth splitting it into 13(!) patches.