Skip to content

Commit 10b7f3c

Browse files
authored
Harmonized with Linux kernel v6.17 (#96)
*This pull request was reviewed and approved as per team policy.* - Minor improvements
2 parents 1c3eea4 + e54cb1f commit 10b7f3c

16 files changed

Lines changed: 802 additions & 49 deletions

File tree

config/HARMONIZED_LINUX_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.16
1+
6.17

config/PROGRAM_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.10.0
1+
1.11.0

src/kernel/drivers/net/can/dev/calc_bittiming.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ void can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
226226
if (!tdc_const || !(ctrlmode_supported & CAN_CTRLMODE_TDC_AUTO))
227227
return;
228228

229-
*ctrlmode &= ~CAN_CTRLMODE_TDC_MASK;
229+
*ctrlmode &= ~CAN_CTRLMODE_FD_TDC_MASK;
230230

231231
/* As specified in ISO 11898-1 section 11.3.3 "Transmitter
232232
* delay compensation" (TDC) is only applicable if data BRP is

src/kernel/drivers/net/can/dev/netlink.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,16 @@ static int can_changelink(struct net_device *dev,
126126
dev->mtu = CAN_MTU;
127127
memset(&priv->data_bittiming, 0,
128128
sizeof(priv->data_bittiming));
129-
priv->ctrlmode &= ~CAN_CTRLMODE_TDC_MASK;
129+
priv->ctrlmode &= ~CAN_CTRLMODE_FD_TDC_MASK;
130130
memset(&priv->tdc, 0, sizeof(priv->tdc));
131131
}
132132

133-
tdc_mask = cm->mask & CAN_CTRLMODE_TDC_MASK;
133+
tdc_mask = cm->mask & CAN_CTRLMODE_FD_TDC_MASK;
134134
/* CAN_CTRLMODE_TDC_{AUTO,MANUAL} are mutually
135135
* exclusive: make sure to turn the other one off
136136
*/
137137
if (tdc_mask)
138-
priv->ctrlmode &= cm->flags | ~CAN_CTRLMODE_TDC_MASK;
138+
priv->ctrlmode &= cm->flags | ~CAN_CTRLMODE_FD_TDC_MASK;
139139
}
140140

141141
if (user->set_restart_ms) {

src/kernel/drivers/net/can/dev/skb.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,10 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx,
168168
if (!skb)
169169
return 0;
170170

171-
netif_rx(skb);
172-
173-
kfree_skb(skb);
171+
if (netif_rx(skb) == NET_RX_SUCCESS)
172+
dev_consume_skb_any(skb);
173+
else
174+
dev_kfree_skb_any(skb);
174175

175176
return len;
176177
}
@@ -198,7 +199,7 @@ void can_free_echo_skb(struct net_device *dev, unsigned int idx,
198199
if (frame_len_ptr)
199200
*frame_len_ptr = can_skb_priv->frame_len;
200201

201-
kfree_skb(skb);
202+
dev_kfree_skb_any(skb);
202203
priv->echo_skb[idx] = NULL;
203204
}
204205
}

src/kernel/drivers/net/can/sja1000/sja1000.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,9 +699,9 @@ struct net_device *alloc_sja1000dev(int sizeof_priv)
699699
priv->dev = dev;
700700
priv->can.bittiming_const = &sja1000_bittiming_const;
701701
priv->can.do_set_bittiming = sja1000_set_bittiming;
702-
priv->can.do_set_btr = sja1000_set_btr; /* Special feature to force btr0 and
703-
* btr1 to specific values needed
704-
* for some applications. */
702+
priv->can.do_set_btr = sja1000_set_btr; /* Special feature to force btr0 and
703+
* btr1 to specific values needed
704+
* for some applications. */
705705
priv->can.do_set_mode = sja1000_set_mode;
706706
priv->can.do_get_berr_counter = sja1000_get_berr_counter;
707707
priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |

src/kernel/include/linux/bits.h

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,23 @@
3131
#define BIT_ULL_MASK(nr) (ULL(1) << ((nr) % BITS_PER_LONG_LONG))
3232
#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG)
3333
#define BITS_PER_BYTE 8
34+
#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
3435

3536
/*
3637
* Create a contiguous bitmask starting at bit position @l and ending at
3738
* position @h. For example
3839
* GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
3940
*/
4041
#if !defined(__ASSEMBLY__)
42+
43+
/*
44+
* Missing asm support
45+
*
46+
* GENMASK_U*() and BIT_U*() depend on BITS_PER_TYPE() which relies on sizeof(),
47+
* something not available in asm. Nevertheless, fixed width integers is a C
48+
* concept. Assembly code can rely on the long and long long versions instead.
49+
*/
50+
4151
#include <linux/build_bug.h>
4252
#include <linux/compiler.h>
4353
#define GENMASK_INPUT_CHECK(h, l) BUILD_BUG_ON_ZERO(const_true((l) > (h)))
@@ -57,10 +67,14 @@
5767
(type_max(t) << (l) & \
5868
type_max(t) >> (BITS_PER_TYPE(t) - 1 - (h)))))
5969

70+
#define GENMASK(h, l) GENMASK_TYPE(unsigned long, h, l)
71+
#define GENMASK_ULL(h, l) GENMASK_TYPE(unsigned long long, h, l)
72+
6073
#define GENMASK_U8(h, l) GENMASK_TYPE(u8, h, l)
6174
#define GENMASK_U16(h, l) GENMASK_TYPE(u16, h, l)
6275
#define GENMASK_U32(h, l) GENMASK_TYPE(u32, h, l)
6376
#define GENMASK_U64(h, l) GENMASK_TYPE(u64, h, l)
77+
#define GENMASK_U128(h, l) GENMASK_TYPE(u128, h, l)
6478

6579
/*
6680
* Fixed-type variants of BIT(), with additional checks like GENMASK_TYPE(). The
@@ -86,28 +100,9 @@
86100
* BUILD_BUG_ON_ZERO is not available in h files included from asm files,
87101
* disable the input check if that is the case.
88102
*/
89-
#define GENMASK_INPUT_CHECK(h, l) 0
103+
#define GENMASK(h, l) __GENMASK(h, l)
104+
#define GENMASK_ULL(h, l) __GENMASK_ULL(h, l)
90105

91106
#endif /* !defined(__ASSEMBLY__) */
92107

93-
#define GENMASK(h, l) \
94-
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
95-
#define GENMASK_ULL(h, l) \
96-
(GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
97-
98-
#if !defined(__ASSEMBLY__)
99-
/*
100-
* Missing asm support
101-
*
102-
* __GENMASK_U128() depends on _BIT128() which would not work
103-
* in the asm code, as it shifts an 'unsigned __int128' data
104-
* type instead of direct representation of 128 bit constants
105-
* such as long and unsigned long. The fundamental problem is
106-
* that a 128 bit constant will get silently truncated by the
107-
* gcc compiler.
108-
*/
109-
#define GENMASK_U128(h, l) \
110-
(GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l))
111-
#endif
112-
113108
#endif /* __LINUX_BITS_H */

src/kernel/include/linux/can/bittiming.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#define CAN_BITRATE_UNSET 0
3939
#define CAN_BITRATE_UNKNOWN (-1U)
4040

41-
#define CAN_CTRLMODE_TDC_MASK \
41+
#define CAN_CTRLMODE_FD_TDC_MASK \
4242
(CAN_CTRLMODE_TDC_AUTO | CAN_CTRLMODE_TDC_MANUAL)
4343

4444
/*

src/kernel/include/linux/compiler.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,6 @@ static inline void *offset_to_ptr(const int *off)
314314
#define __ADDRESSABLE(sym) \
315315
___ADDRESSABLE(sym, __section(".discard.addressable"))
316316

317-
#define __ADDRESSABLE_ASM(sym) \
318-
.pushsection .discard.addressable,"aw"; \
319-
.align ARCH_SEL(8,4); \
320-
ARCH_SEL(.quad, .long) __stringify(sym); \
321-
.popsection;
322-
323-
#define __ADDRESSABLE_ASM_STR(sym) __stringify(__ADDRESSABLE_ASM(sym))
324-
325317
/*
326318
* This returns a constant expression while determining if an argument is
327319
* a constant expression, most importantly without evaluating the argument.

src/kernel/include/linux/log2.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,18 @@ int __bits_per(unsigned long n)
278278
) : \
279279
__bits_per(n) \
280280
)
281+
282+
/**
283+
* max_pow_of_two_factor - return highest power-of-2 factor
284+
* @n: parameter
285+
*
286+
* find highest power-of-2 which is evenly divisible into n.
287+
* 0 is returned for n == 0 or 1.
288+
*/
289+
static inline __attribute__((const))
290+
unsigned int max_pow_of_two_factor(unsigned int n)
291+
{
292+
return n & -n;
293+
}
294+
281295
#endif /* _LINUX_LOG2_H */

0 commit comments

Comments
 (0)