One thing that's bugging me about #Linux kernel code is that variable declarations seem to only occur at start of function or occasionally block. I can't find anything about it in the coding style document. bool
is an alias for C99 _Bool
, so it can't be ancient compilers that didn't understand declarations in other places. Can anyone explain?
@pavel I see, so it's people sticking to what they saw in existing code if if it isn't formally required. Is it an unwritten rule now, or could new code declare variables wherever and still get merged?
@airtower @pavel The lift up from gnu89 to gnu99 to gnu11 actually happened surprisingly recently in the kernel. So a lot of code was also just written before that was allowed.
From memory what finally tipped someone to do it was the ability to define variables in macros.
New code seems to use the various "new" constructs pretty liberally.
@pavel Definitely something I'm curious about, but right now creating Rust bindings for sdio, mac80211, and rtw88 before I can even get really started would probably delay rtw8723cs a bit much. 😸
@airtower @pavel
Found the article on it:
https://lwn.net/Articles/885941/
2022 actually, so yeah very recent
@pavel Not that I'm aware of. My pmos-6.7 tree is just megi's orange-pi-6.7 plus the patches from the pmOS linux-postmarketos-allwinner
package.
I haven't tried booting a pure mainline kernel yet (the pmOS wiki indicates it should be possible, without details), if you try that I'd be curious about the results. I wanted to focus on the wifi driver before possibly getting into other issues, when that works it'll remove a big chunk of the diff to mainline already.
@airtower @pavel That's over the headphone jack. USB gadget mode is not functional without the anx7688 driver, which also depends on changes to the axp803 usb power driver. I'm hoping to post the axp803 patches to the lkml in the next couple weeks, but anx7688 will take longer. It was written specifically for the pinephone, and I'm not sure how much effort it'll take to get it to upstream code standards.
@airtower @pavel I started an outline with the information I know off the top of my head, I'll fill in the details as I have motivation / time. I plan to include the status, links to out of tree source, and links to patches that were sent to the lkml. Is there anything else that would be useful to have? https://wiki.pine64.org/wiki/User:Aren/PinePhone_Mainline_Status
@aren @pavel Thank you! Nothing comes to mind right now at least. Makes me wonder if I should put status and notes for #rtw8723cs somewhere.
@aren @pavel Yeah, definitely, also a good priority list for upstreaming. ​
For the #rtw8723cs status and I was mostly thinking about overview (what's done, what needs doing, known issues), and things I found out about the chip that are too long or uncertain to leave in code comments. Kinda still hoping I can get more people involved, but don't let that distract you from the USB stuff. 😉