Commit f92519e8 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

[S390] css: move io_private to drv_data

Use the subchannels drv_data to access io_subchannel_private
for io subchannels.
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 97eb6bfc
...@@ -1030,6 +1030,7 @@ static void io_subchannel_init_fields(struct subchannel *sch) ...@@ -1030,6 +1030,7 @@ static void io_subchannel_init_fields(struct subchannel *sch)
*/ */
static int io_subchannel_probe(struct subchannel *sch) static int io_subchannel_probe(struct subchannel *sch)
{ {
struct io_subchannel_private *io_priv;
struct ccw_device *cdev; struct ccw_device *cdev;
int rc; int rc;
...@@ -1073,10 +1074,11 @@ static int io_subchannel_probe(struct subchannel *sch) ...@@ -1073,10 +1074,11 @@ static int io_subchannel_probe(struct subchannel *sch)
if (rc) if (rc)
goto out_schedule; goto out_schedule;
/* Allocate I/O subchannel private data. */ /* Allocate I/O subchannel private data. */
sch->private = kzalloc(sizeof(struct io_subchannel_private), io_priv = kzalloc(sizeof(*io_priv), GFP_KERNEL | GFP_DMA);
GFP_KERNEL | GFP_DMA); if (!io_priv)
if (!sch->private)
goto out_schedule; goto out_schedule;
set_io_private(sch, io_priv);
css_schedule_eval(sch->schid); css_schedule_eval(sch->schid);
return 0; return 0;
...@@ -1090,6 +1092,7 @@ static int io_subchannel_probe(struct subchannel *sch) ...@@ -1090,6 +1092,7 @@ static int io_subchannel_probe(struct subchannel *sch)
static int static int
io_subchannel_remove (struct subchannel *sch) io_subchannel_remove (struct subchannel *sch)
{ {
struct io_subchannel_private *io_priv = to_io_private(sch);
struct ccw_device *cdev; struct ccw_device *cdev;
cdev = sch_get_cdev(sch); cdev = sch_get_cdev(sch);
...@@ -1099,11 +1102,12 @@ io_subchannel_remove (struct subchannel *sch) ...@@ -1099,11 +1102,12 @@ io_subchannel_remove (struct subchannel *sch)
/* Set ccw device to not operational and drop reference. */ /* Set ccw device to not operational and drop reference. */
spin_lock_irq(cdev->ccwlock); spin_lock_irq(cdev->ccwlock);
sch_set_cdev(sch, NULL); sch_set_cdev(sch, NULL);
set_io_private(sch, NULL);
cdev->private->state = DEV_STATE_NOT_OPER; cdev->private->state = DEV_STATE_NOT_OPER;
spin_unlock_irq(cdev->ccwlock); spin_unlock_irq(cdev->ccwlock);
ccw_device_unregister(cdev); ccw_device_unregister(cdev);
out_free: out_free:
kfree(sch->private); kfree(io_priv);
sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group); sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group);
return 0; return 0;
} }
...@@ -1553,11 +1557,12 @@ spinlock_t * cio_get_console_lock(void) ...@@ -1553,11 +1557,12 @@ spinlock_t * cio_get_console_lock(void)
static int ccw_device_console_enable(struct ccw_device *cdev, static int ccw_device_console_enable(struct ccw_device *cdev,
struct subchannel *sch) struct subchannel *sch)
{ {
struct io_subchannel_private *io_priv = cio_get_console_priv();
int rc; int rc;
/* Attach subchannel private data. */ /* Attach subchannel private data. */
sch->private = cio_get_console_priv(); memset(io_priv, 0, sizeof(*io_priv));
memset(sch->private, 0, sizeof(struct io_subchannel_private)); set_io_private(sch, io_priv);
io_subchannel_init_fields(sch); io_subchannel_init_fields(sch);
rc = cio_commit_config(sch); rc = cio_commit_config(sch);
if (rc) if (rc)
......
...@@ -18,7 +18,9 @@ struct io_subchannel_private { ...@@ -18,7 +18,9 @@ struct io_subchannel_private {
} __packed options; } __packed options;
} __aligned(8); } __aligned(8);
#define to_io_private(n) ((struct io_subchannel_private *)n->private) #define to_io_private(n) ((struct io_subchannel_private *) \
dev_get_drvdata(&(n)->dev))
#define set_io_private(n, p) (dev_set_drvdata(&(n)->dev, p))
static inline struct ccw_device *sch_get_cdev(struct subchannel *sch) static inline struct ccw_device *sch_get_cdev(struct subchannel *sch)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment