mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 23:21:31 +00:00
s390/qeth: unify the tracking of active cmds on ccw device
We have one field to track _whether_ a cmd is active on a ccw device ('irq_pending'), and one to track _which_ cmd it is ('active_cmd'). Get rid of the irq_pending field, by testing active_cmd for NULL. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7a4b92e8e0
commit
3518ae76f2
@ -614,7 +614,6 @@ struct qeth_channel {
|
|||||||
struct ccw_device *ccwdev;
|
struct ccw_device *ccwdev;
|
||||||
struct qeth_cmd_buffer *active_cmd;
|
struct qeth_cmd_buffer *active_cmd;
|
||||||
enum qeth_channel_states state;
|
enum qeth_channel_states state;
|
||||||
atomic_t irq_pending;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct qeth_reply {
|
struct qeth_reply {
|
||||||
@ -664,11 +663,6 @@ static inline struct ccw1 *__ccw_from_cmd(struct qeth_cmd_buffer *iob)
|
|||||||
return (struct ccw1 *)(iob->data + ALIGN(iob->length, 8));
|
return (struct ccw1 *)(iob->data + ALIGN(iob->length, 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool qeth_trylock_channel(struct qeth_channel *channel)
|
|
||||||
{
|
|
||||||
return atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OSA card related definitions
|
* OSA card related definitions
|
||||||
*/
|
*/
|
||||||
@ -896,10 +890,16 @@ static inline bool qeth_use_tx_irqs(struct qeth_card *card)
|
|||||||
static inline void qeth_unlock_channel(struct qeth_card *card,
|
static inline void qeth_unlock_channel(struct qeth_card *card,
|
||||||
struct qeth_channel *channel)
|
struct qeth_channel *channel)
|
||||||
{
|
{
|
||||||
atomic_set(&channel->irq_pending, 0);
|
xchg(&channel->active_cmd, NULL);
|
||||||
wake_up(&card->wait_q);
|
wake_up(&card->wait_q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool qeth_trylock_channel(struct qeth_channel *channel,
|
||||||
|
struct qeth_cmd_buffer *cmd)
|
||||||
|
{
|
||||||
|
return cmpxchg(&channel->active_cmd, NULL, cmd) == NULL;
|
||||||
|
}
|
||||||
|
|
||||||
struct qeth_trap_id {
|
struct qeth_trap_id {
|
||||||
__u16 lparnr;
|
__u16 lparnr;
|
||||||
char vmname[8];
|
char vmname[8];
|
||||||
|
@ -1268,7 +1268,6 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm,
|
|||||||
iob = (struct qeth_cmd_buffer *) (addr_t)intparm;
|
iob = (struct qeth_cmd_buffer *) (addr_t)intparm;
|
||||||
}
|
}
|
||||||
|
|
||||||
channel->active_cmd = NULL;
|
|
||||||
qeth_unlock_channel(card, channel);
|
qeth_unlock_channel(card, channel);
|
||||||
|
|
||||||
rc = qeth_check_irb_error(card, cdev, irb);
|
rc = qeth_check_irb_error(card, cdev, irb);
|
||||||
@ -1715,11 +1714,10 @@ static int qeth_stop_channel(struct qeth_channel *channel)
|
|||||||
rc = ccw_device_set_offline(cdev);
|
rc = ccw_device_set_offline(cdev);
|
||||||
|
|
||||||
spin_lock_irq(get_ccwdev_lock(cdev));
|
spin_lock_irq(get_ccwdev_lock(cdev));
|
||||||
if (channel->active_cmd) {
|
if (channel->active_cmd)
|
||||||
dev_err(&cdev->dev, "Stopped channel while cmd %px was still active\n",
|
dev_err(&cdev->dev, "Stopped channel while cmd %px was still active\n",
|
||||||
channel->active_cmd);
|
channel->active_cmd);
|
||||||
channel->active_cmd = NULL;
|
|
||||||
}
|
|
||||||
cdev->handler = NULL;
|
cdev->handler = NULL;
|
||||||
spin_unlock_irq(get_ccwdev_lock(cdev));
|
spin_unlock_irq(get_ccwdev_lock(cdev));
|
||||||
|
|
||||||
@ -1732,7 +1730,7 @@ static int qeth_start_channel(struct qeth_channel *channel)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
channel->state = CH_STATE_DOWN;
|
channel->state = CH_STATE_DOWN;
|
||||||
atomic_set(&channel->irq_pending, 0);
|
xchg(&channel->active_cmd, NULL);
|
||||||
|
|
||||||
spin_lock_irq(get_ccwdev_lock(cdev));
|
spin_lock_irq(get_ccwdev_lock(cdev));
|
||||||
cdev->handler = qeth_irq;
|
cdev->handler = qeth_irq;
|
||||||
@ -2039,7 +2037,7 @@ static int qeth_send_control_data(struct qeth_card *card,
|
|||||||
reply->param = reply_param;
|
reply->param = reply_param;
|
||||||
|
|
||||||
timeout = wait_event_interruptible_timeout(card->wait_q,
|
timeout = wait_event_interruptible_timeout(card->wait_q,
|
||||||
qeth_trylock_channel(channel),
|
qeth_trylock_channel(channel, iob),
|
||||||
timeout);
|
timeout);
|
||||||
if (timeout <= 0) {
|
if (timeout <= 0) {
|
||||||
qeth_put_cmd(iob);
|
qeth_put_cmd(iob);
|
||||||
@ -2059,8 +2057,6 @@ static int qeth_send_control_data(struct qeth_card *card,
|
|||||||
spin_lock_irq(get_ccwdev_lock(channel->ccwdev));
|
spin_lock_irq(get_ccwdev_lock(channel->ccwdev));
|
||||||
rc = ccw_device_start_timeout(channel->ccwdev, __ccw_from_cmd(iob),
|
rc = ccw_device_start_timeout(channel->ccwdev, __ccw_from_cmd(iob),
|
||||||
(addr_t) iob, 0, 0, timeout);
|
(addr_t) iob, 0, 0, timeout);
|
||||||
if (!rc)
|
|
||||||
channel->active_cmd = iob;
|
|
||||||
spin_unlock_irq(get_ccwdev_lock(channel->ccwdev));
|
spin_unlock_irq(get_ccwdev_lock(channel->ccwdev));
|
||||||
if (rc) {
|
if (rc) {
|
||||||
QETH_DBF_MESSAGE(2, "qeth_send_control_data on device %x: ccw_device_start rc = %i\n",
|
QETH_DBF_MESSAGE(2, "qeth_send_control_data on device %x: ccw_device_start rc = %i\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user