On Tue, Feb 11, 2025 at 12:59:53PM -0500, Kurt Borja wrote: > On Tue Feb 11, 2025 at 11:56 AM -05, Andy Shevchenko wrote: > > On Fri, Feb 07, 2025 at 10:46:07AM -0500, Kurt Borja wrote: ... > >> obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o > >> alienware-wmi-objs := alienware-wmi-base.o > >> +alienware-wmi-y += alienware-wmi-legacy.o > >> +alienware-wmi-y += alienware-wmi-wmax.o > > > > Oh my... it's even inconsistent! > > Again, this is an already used pattern: > https://elixir.bootlin.com/linux/v6.14-rc2/source/drivers/platform/x86/dell/Makefile#L14 > > I add configuration entries later. Is the order of the changes wrong? or > is it the entire approach? Do other modules here need a fix? Again, it doesn't mean it's correct. Maybe other modules also need that, I don't remember, but you may `git log --no-merges --author="Andy" --grep objs` to see changes I made in the past. ... > >> + if (!ret) { > >> + if (out_data == 0) > >> + return sysfs_emit(buf, "[disabled] s5 s5_s4\n"); > >> + else if (out_data == 1) > >> + return sysfs_emit(buf, "disabled [s5] s5_s4\n"); > >> + else if (out_data == 2) > >> + return sysfs_emit(buf, "disabled s5 [s5_s4]\n"); > > > > The whole code inherited same issues like redundant 'else'. Please, refactor. > > This is not my code, so a separate patch would be needed. Okay! ... > >> + if (strcmp(buf, "disabled\n") == 0) > >> + args.arg = 0; > >> + else if (strcmp(buf, "s5\n") == 0) > >> + args.arg = 1; > >> + else > >> + args.arg = 2; > > > > sysfs_match_string() > > Same as above. Same as above :-) ... > >> + if ((code & WMAX_THERMAL_TABLE_MASK) == WMAX_THERMAL_TABLE_USTT && > >> + (code & WMAX_THERMAL_MODE_MASK) <= THERMAL_MODE_USTT_LOW_POWER) > >> + return true; > >> + > >> + return false; > > > > return ... > > > > but if you wish, this one is okay. > > This was done for readibility. Also this would require a different > patch. No need, I'm fine with the current approach, just to show the alternatives. ... > >> + ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_SYS_DESCRIPTION, > >> + 0, (u32 *) &sys_desc); > > > > How do you guarantee an alignment? Yes, it might be good for the specific > > hardware, but in general this is broken code. > > This is a good question. I'm not really sure how to fix this tho. Is it > fine to just pass a __packed struct? Also this would require another > patch. Usual approach here is to use one of get_unaligned_le32(), get_unaligned_be32() depending on the byte ordering. > >> + if (ret < 0) > >> + return ret; ... > >> + set_bit(profile, choices); > > > > Do you need it to be atomic? > > I don't think so. `choices` belongs to this thread only. So, __set_bit() will suffice then. ... > >> +void __exit alienware_wmax_wmi_exit(void) > >> +{ > >> + wmi_driver_unregister(&alienware_wmax_wmi_driver); > >> +} > > > > Why not moving these boilerplate to ->probe() and use module_wmi_driver()? > > This 3 files are a single module and it has two WMI drivers so this > can't be used. Can it be split to two separate modules then? -- With Best Regards, Andy Shevchenko