kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Tomek The Messenger <tomekthemessenger@gmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: how to check regmap start address
Date: Thu, 2 Apr 2020 14:14:56 +0200	[thread overview]
Message-ID: <20200402121456.GB2773016@kroah.com> (raw)
In-Reply-To: <CAA4NGytueUo40VpFdudfpvtrbDkS_rOa2t22Yv003A+tmnFQXg@mail.gmail.com>

On Thu, Apr 02, 2020 at 01:48:23PM +0200, Tomek The Messenger wrote:
> Hi
> Let's see how it looks:
> https://github.com/u-boot/u-boot/blob/master/include/regmap.h
> 
> I first time ever see such thing like this:
> struct regmap_range {
> ulong start;
> ulong size;
> };
> struct regmap {
> enum regmap_endianness_t endianness;
> int range_count;
> struct regmap_range ranges[0];
> };
> 
> How I can get access to variable ranges it if is 0 size? Who develops this
> one and who reviewed:)

It is very common and standard C coding style.  It happens all the time
when you have a variable of unknown length at declaration time.

> Anyway If I have pointer to regmap can I check what is start variable in
> some other way?

What other way do you need to check it?

Why do you think the above code is incorrect?  What do you think it
should look like?

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  parent reply	other threads:[~2020-04-02 12:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-02 11:48 how to check regmap start address Tomek The Messenger
2020-04-02 11:58 ` Valentin Vidić
2020-04-02 12:14 ` Greg KH [this message]
2020-04-03 12:39   ` Tomek The Messenger
2020-04-04  9:00     ` Tomek The Messenger

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=20200402121456.GB2773016@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=tomekthemessenger@gmail.com \
    /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).