Commit 1a10d67c authored by Stefan Wahren's avatar Stefan Wahren Committed by David S. Miller

qca_spi: Improve SPI thread creation

Directly storing the result of kthread_run within the private
driver data makes it harder to identify if the pointer has a
running thread or not. So better use a local variable for
the result check and we don't have to care about error pointer
in the rest of the code.
Signed-off-by: default avatarStefan Wahren <wahrenst@gmx.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c494a01a
...@@ -687,6 +687,7 @@ static int ...@@ -687,6 +687,7 @@ static int
qcaspi_netdev_open(struct net_device *dev) qcaspi_netdev_open(struct net_device *dev)
{ {
struct qcaspi *qca = netdev_priv(dev); struct qcaspi *qca = netdev_priv(dev);
struct task_struct *thread;
int ret = 0; int ret = 0;
if (!qca) if (!qca)
...@@ -697,15 +698,17 @@ qcaspi_netdev_open(struct net_device *dev) ...@@ -697,15 +698,17 @@ qcaspi_netdev_open(struct net_device *dev)
qca->sync = QCASPI_SYNC_UNKNOWN; qca->sync = QCASPI_SYNC_UNKNOWN;
qcafrm_fsm_init_spi(&qca->frm_handle); qcafrm_fsm_init_spi(&qca->frm_handle);
qca->spi_thread = kthread_run((void *)qcaspi_spi_thread, thread = kthread_run((void *)qcaspi_spi_thread,
qca, "%s", dev->name); qca, "%s", dev->name);
if (IS_ERR(qca->spi_thread)) { if (IS_ERR(thread)) {
netdev_err(dev, "%s: unable to start kernel thread.\n", netdev_err(dev, "%s: unable to start kernel thread.\n",
QCASPI_DRV_NAME); QCASPI_DRV_NAME);
return PTR_ERR(qca->spi_thread); return PTR_ERR(thread);
} }
qca->spi_thread = thread;
ret = request_irq(qca->spi_dev->irq, qcaspi_intr_handler, 0, ret = request_irq(qca->spi_dev->irq, qcaspi_intr_handler, 0,
dev->name, qca); dev->name, qca);
if (ret) { if (ret) {
......
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