[Dropped Tony Prisk from recipients as the address bounces] Hello, On Wed, Mar 18, 2020 at 11:59:53PM +0100, Thierry Reding wrote: > On Tue, Mar 17, 2020 at 10:00:42PM +0100, Uwe Kleine-König wrote: > > Hello, > > > > On Tue, Mar 17, 2020 at 06:40:43PM +0100, Thierry Reding wrote: > > > On Tue, Mar 17, 2020 at 02:32:25PM +0200, Oleksandr Suvorov wrote: > > > > The polarity enum definition PWM_POLARITY_INVERSED is misspelled. > > > > Rename it to PWM_POLARITY_INVERTED. > > > > > > It isn't misspelled. "inversed" is a synonym for "inverted". Both > > > spellings are correct. > > > > Some time ago I stumbled about "inversed", too. My spell checker doesn't > > know it and I checked some dictionaries and none of them knew that word: > > > > https://www.lexico.com/search?utf8=%E2%9C%93&filter=dictionary&dictionary=en&query=inversed > > https://de.pons.com/%C3%BCbersetzung/englisch-deutsch/inversed > > https://dictionary.cambridge.org/spellcheck/english-german/?q=inversed > > > > https://en.wiktionary.org/wiki/inverse#Verb mentions "inverse" as a verb > > having "inversed" as past participle. > > Here are the first three results from a Google query: > > https://www.yourdictionary.com/inversed There is something fishy. In the Verb section it says indeed, that it is the past participle and simple past of inverse. The entry for inverse however only has sections that identify this word as adjective or noun; not a verb. > https://www.dictionary.com/browse/inversed Not sure I'd count this as hint that inversed exists. The entry shown to me under this URL is about "inverse" and it has verb (used with object), in·versed, in·vers·ing. ? to invert. Does this mean: "Did you mean invert instead?" > https://en.wiktionary.org/wiki/inversed Yeah, that's the one I found, too. I still have the impression that "inversed" is in use because people don't know better and understand the intended meaning. And this results in leaking of this word into the references. > > Having said this I think (independent of the question if "inversed" > > exists) using two similar terms for the same thing just results in > > confusion. I hit that in the past already and I like it being addressed. > > I don't know. It's pretty common to use different words for the same > thing. They're called synonyms. In literature yes, I agree. In a novel it is annoying to repeat the same words over and over again and some variation is good. In programming however the goal is a different one. There the goal should be to be precise and consistent. > > > And as you noted in the cover letter, there's a conflict between the > > > macro defined in dt-bindings/pwm/pwm.txt. If they end up being included > > > in the wrong order you'll get a compile error. > > > > There are also other symbols that exist twice (GPIO_ACTIVE_HIGH was the > > first to come to my mind). I'm not aware of any problems related to > > these. What am I missing? > > There's currently no problem, obviously. But if for some reason the > include files end up being included in a different order (i.e. the > dt-bindings header is included before linux/pwm.h) then the macro will > be evaluated and result in something like: > > enum pwm_polarity { > PWM_POLARITY_NORMAL, > 1, > }; > > and that's not valid C, so will cause a build error. I admit I didn't look closely here and I assume you are right. If I understand Oleksandr right this is only an intermediate step and when the series is applied completely this issue is gone. Still it might be worth to improve the series here. My original question was about similar problems with GPIO_ACTIVE_HIGH. Are you aware of problems there? > > > Note that DT bindings are an ABI and can > > > never change, whereas the enum pwm_polarity is part of a Linux internal > > > API and doesn't have the same restrictions as an ABI. > > > > I thought only binary device trees (dtb) are supposed to be ABI. > > Yes, the DTB is the ABI. dt-bindings/pwm/pwm.h is used to generate DTBs, > which basically makes it ABI as well. We disagree here. With this argument you could fix quite some things as ABI. > Yes, the symbol name may not be part of the ABI, but changing the > symbol becomes very inconvenient because everyone that depends on it > would have to change. Oleksandr adapted all in-tree users, so it only affects out-of-tree users. In my book this is fine. > Why bother? To make the API more precise and consistent. That's a good goal in my eyes. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |