[no subject]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



    "This function can be used even if the work re-queues itself"


> +		kthread_cancel_delayed_work_sync(&s->poll_work);
> +	}

Blank line

>  	kthread_flush_worker(&s->kworker);
>  }
>  
> @@ -1537,7 +1564,13 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
>  
>  	/* Always ask for fixed clock rate from a property. */
>  	device_property_read_u32(dev, "clock-frequency", &uartclk);

Blank line

> +	s->polling = !device_property_present(dev, "interrupts");
>  

Remove blank line

> +	if (s->polling) {
> +		dev_dbg(dev,
> +			"No interrupt definition found. Falling back to polling mode.\n");

Maybe: "No interrupt pin definition, falling back to polling mode\n"

(add pin and gets rid of trailing point)

> +		irq = 0;
> +	}

Blank line

>  	s->clk = devm_clk_get_optional(dev, NULL);
>  	if (IS_ERR(s->clk))
>  		return PTR_ERR(s->clk);
> @@ -1664,6 +1697,11 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
>  	if (ret)
>  		goto out_ports;
>  #endif

Blank line

> +	if (s->polling) {
> +		/* Initialize kernel thread for polling */
> +		kthread_init_delayed_work(&s->poll_work, sc16is7xx_transmission_poll);
> +		return 0;
> +	}
>  
>  	/*
>  	 * Setup interrupt. We first try to acquire the IRQ line as level IRQ.
> @@ -1724,6 +1762,8 @@ void sc16is7xx_remove(struct device *dev)
>  		sc16is7xx_power(&s->p[i].port, 0);
>  	}
>  
> +	if (s->polling)
> +		kthread_cancel_delayed_work_sync(&s->poll_work);

Blank line

>  	kthread_flush_worker(&s->kworker);
>  	kthread_stop(s->kworker_task);
>  
> -- 
> 2.47.1
> 
> 
> 


-- 
Hugo Villeneuve




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux