kuksa-dbc-feeder: add recipe and dependencies
[AGL/meta-agl-demo.git] / recipes-kernel / sllin / files / 0004-Fix-build-with-5.9-kernel.patch
1 Use sched_set_fifo on newer kernels
2
3 The 5.9 kernel removed the export of sched_setscheduler, use
4 the new sched_set_fifo API if building on 5.9 or newer.  There
5 is a slight difference in resulting priority level, the new
6 API will yield a priority of 50 instead of the explicit value
7 of 40 being used with sched_setscheduler, but this should not
8 be an issue.
9
10 Upstream-Status: Inappropriate [no upstream]
11 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
12
13 ---
14 diff --git a/sllin/sllin.c b/sllin/sllin.c
15 index 133d6e9..92c52ad 100644
16 --- a/sllin/sllin.c
17 +++ b/sllin/sllin.c
18 @@ -1059,14 +1059,20 @@ static int sllin_kwthread(void *ptr)
19  {
20         struct sllin *sl = (struct sllin *)ptr;
21         struct tty_struct *tty = sl->tty;
22 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
23         struct sched_param schparam = { .sched_priority = 40 };
24 +#endif
25         int tx_bytes = 0; /* Used for Network statistics */
26         unsigned long flags;
27         int lin_id;
28         struct sllin_conf_entry *sce;
29  
30         netdev_dbg(sl->dev, "sllin_kwthread started.\n");
31 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
32         sched_setscheduler(current, SCHED_FIFO, &schparam);
33 +#else
34 +       sched_set_fifo(current);
35 +#endif
36  
37         clear_bit(SLF_ERROR, &sl->flags);
38         sltty_change_speed(tty, sl->lin_baud);
39 @@ -1274,8 +1280,8 @@ slstate_response_wait:
40                                         sl->lin_state = SLSTATE_RESPONSE_WAIT_BUS;
41                                 }
42                         }
43 +                       fallthrough;
44  
45 -                       /* Be aware, no BREAK here */
46                 case SLSTATE_RESPONSE_WAIT_BUS:
47                         if (sl->rx_cnt < sl->rx_expect)
48                                 continue;