Re: [PATCH v3] iio: sx9324: avoid copying property strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2023-12-17 at 13:24 +0000, Jonathan Cameron wrote:
> On Mon, 11 Dec 2023 22:30:12 -0800
> Joe Perches <joe@xxxxxxxxxxx> wrote:
> 
> > On Tue, 2023-12-12 at 00:42 +0000, Justin Stitt wrote:
> > > We're doing some needless string copies when trying to assign the proper
> > > `prop` string. We can make `prop` a const char* and simply assign to
> > > string literals.  
> > 
> > trivia:
> > 
> > I would have updated it like this moving the
> > various declarations into the case blocks
> > where they are used and removing a few unused
> > #defines
> 
> I'd definitely like to see those defines gone.
> Arguably an unrelated change as I guess they are left from a previous refactor
> of this code.
> 
> Why prop to type renaming?

random, no specific need, though I prefer not reusing
identifiers with different types in separate local scopes.

>   It's getting passed into calls where the parameter
> is propname so I'd understand renaming to that, but type just seems a bit random
> to me.  I do wonder if we are better off having some long lines and getting rid
> of the property naming local variables completely by just duplicating
> the device_property_read_u32() call and passing them in directly.

maybe, give it a try and see what you think.






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux