mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
s390/cio: make sch->lock spinlock pointer a member
The lock member of struct subchannel used to be a spinlock, but became
a pointer to a spinlock with commit 2ec2298412 ("[S390] subchannel
lock conversion."). This might have been justified back then, but with
the current state of affairs, there is no reason to manage a separate
spinlock object.
Let's simplify things and pull the spinlock back into struct subchannel.
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Link: https://lore.kernel.org/r/20231101115751.2308307-1-pasic@linux.ibm.com
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
committed by
Alexander Gordeev
parent
7fe228e186
commit
b8fa3e9096
@@ -148,16 +148,10 @@ out:
|
||||
|
||||
static void css_sch_todo(struct work_struct *work);
|
||||
|
||||
static int css_sch_create_locks(struct subchannel *sch)
|
||||
static void css_sch_create_locks(struct subchannel *sch)
|
||||
{
|
||||
sch->lock = kmalloc(sizeof(*sch->lock), GFP_KERNEL);
|
||||
if (!sch->lock)
|
||||
return -ENOMEM;
|
||||
|
||||
spin_lock_init(sch->lock);
|
||||
spin_lock_init(&sch->lock);
|
||||
mutex_init(&sch->reg_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void css_subchannel_release(struct device *dev)
|
||||
@@ -167,7 +161,6 @@ static void css_subchannel_release(struct device *dev)
|
||||
sch->config.intparm = 0;
|
||||
cio_commit_config(sch);
|
||||
kfree(sch->driver_override);
|
||||
kfree(sch->lock);
|
||||
kfree(sch);
|
||||
}
|
||||
|
||||
@@ -219,9 +212,7 @@ struct subchannel *css_alloc_subchannel(struct subchannel_id schid,
|
||||
sch->schib = *schib;
|
||||
sch->st = schib->pmcw.st;
|
||||
|
||||
ret = css_sch_create_locks(sch);
|
||||
if (ret)
|
||||
goto err;
|
||||
css_sch_create_locks(sch);
|
||||
|
||||
INIT_WORK(&sch->todo_work, css_sch_todo);
|
||||
sch->dev.release = &css_subchannel_release;
|
||||
@@ -233,19 +224,17 @@ struct subchannel *css_alloc_subchannel(struct subchannel_id schid,
|
||||
*/
|
||||
ret = dma_set_coherent_mask(&sch->dev, DMA_BIT_MASK(31));
|
||||
if (ret)
|
||||
goto err_lock;
|
||||
goto err;
|
||||
/*
|
||||
* But we don't have such restrictions imposed on the stuff that
|
||||
* is handled by the streaming API.
|
||||
*/
|
||||
ret = dma_set_mask(&sch->dev, DMA_BIT_MASK(64));
|
||||
if (ret)
|
||||
goto err_lock;
|
||||
goto err;
|
||||
|
||||
return sch;
|
||||
|
||||
err_lock:
|
||||
kfree(sch->lock);
|
||||
err:
|
||||
kfree(sch);
|
||||
return ERR_PTR(ret);
|
||||
@@ -604,12 +593,12 @@ static void css_sch_todo(struct work_struct *work)
|
||||
|
||||
sch = container_of(work, struct subchannel, todo_work);
|
||||
/* Find out todo. */
|
||||
spin_lock_irq(sch->lock);
|
||||
spin_lock_irq(&sch->lock);
|
||||
todo = sch->todo;
|
||||
CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid,
|
||||
sch->schid.sch_no, todo);
|
||||
sch->todo = SCH_TODO_NOTHING;
|
||||
spin_unlock_irq(sch->lock);
|
||||
spin_unlock_irq(&sch->lock);
|
||||
/* Perform todo. */
|
||||
switch (todo) {
|
||||
case SCH_TODO_NOTHING:
|
||||
@@ -617,9 +606,9 @@ static void css_sch_todo(struct work_struct *work)
|
||||
case SCH_TODO_EVAL:
|
||||
ret = css_evaluate_known_subchannel(sch, 1);
|
||||
if (ret == -EAGAIN) {
|
||||
spin_lock_irq(sch->lock);
|
||||
spin_lock_irq(&sch->lock);
|
||||
css_sched_sch_todo(sch, todo);
|
||||
spin_unlock_irq(sch->lock);
|
||||
spin_unlock_irq(&sch->lock);
|
||||
}
|
||||
break;
|
||||
case SCH_TODO_UNREG:
|
||||
@@ -1028,12 +1017,7 @@ static int __init setup_css(int nr)
|
||||
css->pseudo_subchannel->dev.parent = &css->device;
|
||||
css->pseudo_subchannel->dev.release = css_subchannel_release;
|
||||
mutex_init(&css->pseudo_subchannel->reg_mutex);
|
||||
ret = css_sch_create_locks(css->pseudo_subchannel);
|
||||
if (ret) {
|
||||
kfree(css->pseudo_subchannel);
|
||||
device_unregister(&css->device);
|
||||
goto out_err;
|
||||
}
|
||||
css_sch_create_locks(css->pseudo_subchannel);
|
||||
|
||||
dev_set_name(&css->pseudo_subchannel->dev, "defunct");
|
||||
ret = device_register(&css->pseudo_subchannel->dev);
|
||||
|
||||
Reference in New Issue
Block a user