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

2023-12-17 Thread Joe Perches
On Sun, 2023-12-17 at 13:24 +, Jonathan Cameron wrote: > On Mon, 11 Dec 2023 22:30:12 -0800 > Joe Perches wrote: > > > On Tue, 2023-12-12 at 00:42 +, Justin Stitt wrote: > > > We're doing some needless string copies when trying to assign the proper > > > `prop` string. We can make `prop`

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

2023-12-17 Thread Jonathan Cameron
On Mon, 11 Dec 2023 22:30:12 -0800 Joe Perches wrote: > On Tue, 2023-12-12 at 00:42 +, 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:

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

2023-12-13 Thread Stephen Boyd
Quoting Justin Stitt (2023-12-11 16:42:52) > diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c > index 438f9c9aba6e..e3bc30b57b19 100644 > --- a/drivers/iio/proximity/sx9324.c > +++ b/drivers/iio/proximity/sx9324.c > @@ -873,6 +873,32 @@ static int

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

2023-12-12 Thread Kees Cook
On Tue, Dec 12, 2023 at 12:42:52AM +, 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. > > For the case where a format string is used, let's extract the

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

2023-12-11 Thread Joe Perches
On Tue, 2023-12-12 at 00:42 +, 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

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

2023-12-11 Thread Justin Stitt
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. For the case where a format string is used, let's extract the parsing logic out into sx9324_parse_phase_prop(). We no longer need to