Skip to content

Commit 8b20129

Browse files
Song Chengregkh
authored andcommitted
staging: unisys: visornic: enhance visornic to use channel_interrupt
visornic uses timer to check the response queue and drain it if needed periodically. On the other hand, visorbus provides periodic work to serve such request, therefore, timer should be replaced by channel_interrupt. Signed-off-by: Song Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1e37da4 commit 8b20129

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

drivers/staging/unisys/visornic/visornic_main.c

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ struct chanstat {
122122
* @n_rcv_packets_not_accepted: # bogs rcv packets.
123123
* @queuefullmsg_logged:
124124
* @struct chstat:
125-
* @struct irq_poll_timer:
126125
* @struct napi:
127126
* @struct cmdrsp:
128127
*/
@@ -183,7 +182,6 @@ struct visornic_devdata {
183182

184183
int queuefullmsg_logged;
185184
struct chanstat chstat;
186-
struct timer_list irq_poll_timer;
187185
struct napi_struct napi;
188186
struct uiscmdrsp cmdrsp[SIZEOF_CMDRSP];
189187
};
@@ -341,7 +339,7 @@ static void visornic_serverdown_complete(struct visornic_devdata *devdata)
341339
struct net_device *netdev = devdata->netdev;
342340

343341
/* Stop polling for interrupts */
344-
del_timer_sync(&devdata->irq_poll_timer);
342+
visorbus_disable_channel_interrupts(devdata->dev);
345343

346344
rtnl_lock();
347345
dev_close(netdev);
@@ -1749,17 +1747,17 @@ static int visornic_poll(struct napi_struct *napi, int budget)
17491747
return rx_count;
17501748
}
17511749

1752-
/* poll_for_irq - checks the status of the response queue
1753-
* @t: pointer to the 'struct timer_list' from which we can retrieve the
1754-
* the visornic devdata struct.
1750+
/* visornic_channel_interrupt - checks the status of the response queue
17551751
*
17561752
* Main function of the vnic_incoming thread. Periodically check the response
17571753
* queue and drain it if needed.
17581754
*/
1759-
static void poll_for_irq(struct timer_list *t)
1755+
static void visornic_channel_interrupt(struct visor_device *dev)
17601756
{
1761-
struct visornic_devdata *devdata = from_timer(devdata, t,
1762-
irq_poll_timer);
1757+
struct visornic_devdata *devdata = dev_get_drvdata(&dev->device);
1758+
1759+
if (!devdata)
1760+
return;
17631761

17641762
if (!visorchannel_signalempty(
17651763
devdata->dev->visorchannel,
@@ -1768,7 +1766,6 @@ static void poll_for_irq(struct timer_list *t)
17681766

17691767
atomic_set(&devdata->interrupt_rcvd, 0);
17701768

1771-
mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2));
17721769
}
17731770

17741771
/* visornic_probe - probe function for visornic devices
@@ -1890,13 +1887,6 @@ static int visornic_probe(struct visor_device *dev)
18901887
/* Let's start our threads to get responses */
18911888
netif_napi_add(netdev, &devdata->napi, visornic_poll, NAPI_WEIGHT);
18921889

1893-
timer_setup(&devdata->irq_poll_timer, poll_for_irq, 0);
1894-
/* Note: This time has to start running before the while
1895-
* loop below because the napi routine is responsible for
1896-
* setting enab_dis_acked
1897-
*/
1898-
mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2));
1899-
19001890
channel_offset = offsetof(struct visor_io_channel,
19011891
channel_header.features);
19021892
err = visorbus_read_channel(dev, channel_offset, &features, 8);
@@ -1949,7 +1939,7 @@ static int visornic_probe(struct visor_device *dev)
19491939
unregister_netdev(netdev);
19501940

19511941
cleanup_napi_add:
1952-
del_timer_sync(&devdata->irq_poll_timer);
1942+
visorbus_disable_channel_interrupts(dev);
19531943
netif_napi_del(&devdata->napi);
19541944

19551945
cleanup_xmit_cmdrsp:
@@ -2017,7 +2007,7 @@ static void visornic_remove(struct visor_device *dev)
20172007
/* this will call visornic_close() */
20182008
unregister_netdev(netdev);
20192009

2020-
del_timer_sync(&devdata->irq_poll_timer);
2010+
visorbus_disable_channel_interrupts(devdata->dev);
20212011
netif_napi_del(&devdata->napi);
20222012

20232013
dev_set_drvdata(&dev->device, NULL);
@@ -2091,7 +2081,7 @@ static int visornic_resume(struct visor_device *dev,
20912081
* we can start using the device again.
20922082
* TODO: State transitions
20932083
*/
2094-
mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2));
2084+
visorbus_enable_channel_interrupts(dev);
20952085

20962086
rtnl_lock();
20972087
dev_open(netdev, NULL);
@@ -2113,7 +2103,7 @@ static struct visor_driver visornic_driver = {
21132103
.remove = visornic_remove,
21142104
.pause = visornic_pause,
21152105
.resume = visornic_resume,
2116-
.channel_interrupt = NULL,
2106+
.channel_interrupt = visornic_channel_interrupt,
21172107
};
21182108

21192109
/* visornic_init - init function

0 commit comments

Comments
 (0)