linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Daniel Drake <drake@endlessm.com>
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
	linux-iio@vger.kernel.org, linux@endlessm.com,
	lorenzo.bianconi83@gmail.com, denis.ciocca@st.com,
	hadess@hadess.net, hdegoede@redhat.com
Subject: Re: [PATCH 1/2] iio: drop const typing from iio_mount_matrix rotation
Date: Sat, 19 Jan 2019 16:49:15 +0000	[thread overview]
Message-ID: <20190119164915.2475b713@archlinux> (raw)
In-Reply-To: <20181220065933.25964-1-drake@endlessm.com>

On Thu, 20 Dec 2018 14:59:32 +0800
Daniel Drake <drake@endlessm.com> wrote:

> In order to conform with orientation data from the firmware, we
> need to dynamically construct the mount matrix in the ST accelerometer
> driver.
> 
> Drop the const type from the mount matrix data to make this possible.
> 
> Signed-off-by: Daniel Drake <drake@endlessm.com>
Not quite that simple...

drivers/iio/industrialio-core.c:551:21: error: passing argument 3 of ‘of_property_read_string_array’ from incompatible pointer type [-Werror=incompatible-pointer-types]
     propname, matrix->rotation,
               ~~~~~~^~~~~~~~~~
In file included from ./include/linux/iio/iio.h:16,
                 from drivers/iio/industrialio-core.c:29:
./include/linux/of.h:1107:42: note: expected ‘const char **’ but argument is of type ‘char **’
       const char *propname, const char **out_strs,
                             ~~~~~~~~~~~~~^~~~~~~~
cc1: some warnings being treated as errors

Also, I didn't think that much about it until now, but I'm not sure
why you need this change in the first place. It is an array of
pointers to constant characters.  Given we allocate said array
before setting this variable to it and don't modify it via this
pointer, I believe we are fine with out this.

Compiler certainly isn't complaining about patch 2 without this
one.  Am I missing something?

Jonathan


> ---
>  include/linux/iio/iio.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> index a74cb177dc6f..d3094ffeb9da 100644
> --- a/include/linux/iio/iio.h
> +++ b/include/linux/iio/iio.h
> @@ -125,7 +125,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
>   *            main hardware
>   */
>  struct iio_mount_matrix {
> -	const char *rotation[9];
> +	char *rotation[9];
>  };
>  
>  ssize_t iio_show_mount_matrix(struct iio_dev *indio_dev, uintptr_t priv,


  parent reply	other threads:[~2019-01-19 16:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  6:59 [PATCH 1/2] iio: drop const typing from iio_mount_matrix rotation Daniel Drake
2018-12-20  6:59 ` [PATCH 2/2] iio: st_accel: use ACPI orientation data Daniel Drake
2018-12-22 18:09   ` Jonathan Cameron
2019-01-12 19:13     ` Jonathan Cameron
2019-01-15  0:18       ` Denis CIOCCA
2019-01-15  3:09         ` Daniel Drake
2019-01-19 16:50           ` Jonathan Cameron
2019-01-26 17:27             ` Jonathan Cameron
2019-01-19 16:49 ` Jonathan Cameron [this message]
2019-01-21  8:42   ` [PATCH 1/2] iio: drop const typing from iio_mount_matrix rotation Daniel Drake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190119164915.2475b713@archlinux \
    --to=jic23@kernel.org \
    --cc=denis.ciocca@st.com \
    --cc=drake@endlessm.com \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux@endlessm.com \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).