mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Baolin Wang <baolin.wang@linaro.org>,
	Jaroslav Kysela <perex@perex.cz>,
	Fabian Frederick <fabf@skynet.be>,
	Arvind Yadav <arvind.yadav.cs@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	alsa-devel@alsa-project.org, Vinod Koul <vinod.koul@intel.com>,
	hardik.t.shah@intel.com, guneshwor.o.singh@intel.com,
	Liam Girdwood <lgirdwood@gmail.com>,
	SF Markus Elfring <elfring@users.sourceforge.net>,
	gudishax.kranthikumar@intel.com, Mark Brown <broonie@kernel.org>,
	Bhumika Goyal <bhumirks@gmail.com>, Naveen M <naveen.m@intel.com>,
	jeeja.kp@intel.com, Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	subhransu.s.prusty@intel.com, Ingo Molnar <mingo@kernel.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [alsa-devel] [RFC PATCH v2 7/7] sound: core: Avoid using timespec for struct snd_timer_tread
Date: Thu, 09 Nov 2017 19:11:26 +0100	[thread overview]
Message-ID: <s5hinejuxtd.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAK8P3a2a2hummJN8AiQmngKm53CArGsWdEESmjovLyz=Qc+uFQ@mail.gmail.com>

On Thu, 09 Nov 2017 18:01:47 +0100,
Arnd Bergmann wrote:
> 
> On Thu, Nov 9, 2017 at 5:52 PM, Takashi Iwai <tiwai@suse.de> wrote:
> > On Mon, 06 Nov 2017 17:33:26 +0100,
> 
> >> --- a/include/uapi/sound/asound.h
> >> +++ b/include/uapi/sound/asound.h
> >> @@ -306,10 +306,19 @@ typedef int __bitwise snd_pcm_state_t;
> >>
> >>  enum {
> >>         SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
> >> -       SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
> >> +       SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
> >>         SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
> >> +       SNDRV_PCM_MMAP_OFFSET_STATUS64 = 0x82000000,
> >>  };
> >>
> >> +#if __BITS_PER_LONG == 64
> >> +#define SNDRV_PCM_MMAP_OFFSET_STATUS SNDRV_PCM_MMAP_OFFSET_STATUS_OLD
> >> +#else
> >> +#define SNDRV_PCM_MMAP_OFFSET_STATUS ((sizeof(time_t) >
> >> sizeof(__kernel_long_t)) ? \
> >> +                                       SNDRV_PCM_MMAP_OFFSET_STATUS64 : \
> >> +                                       SNDRV_PCM_MMAP_OFFSET_STATUS_OLD)
> >> +#endif
> >> +
> >>  union snd_pcm_sync_id {
> >>         unsigned char id[16];
> >>         unsigned short id16[8];
> >>
> >> Does that make sense?
> >
> > Yeah, that should work.
> >
> > But can we make the flip without the dynamic sizeof() comparison but
> > some ifdef?  The above doesn't allow the usage with switch(), for
> > example.
> >
> > IOW, is there any macro indicating the 64bit user time_t?
> 
> There is a macro defined by the C library, but so far we have not
> started relying on it in kernel headers, because there is no guarantee
> that this symbol is visible before sys/time.h has been included,
> and there are some cases where it's possible to include a kernel
> header before sys/time.h.
> 
> In case of sound/asound.h, that should be no problem since we rely
> on having seen the definition on 'struct timeval' already today, and
> that must come from sys/time.h. Then we just need to make sure that
> all C libraries define the same macro.
> 
> Are you sure about the switch()/case problem? I thought that worked
> in C99, the only problem would be using the macro outside of a
> function, e.g. as initalizer for a variable

Hmm, OK it seems working.

But, honestly speaking, it's too scaring.  I'm OK if it were only in
the kernel local code.  But it's the API/ABI definition, which is
referred by user-space...

A more solid condition would be really appreciated.


thanks,

Takashi

  reply	other threads:[~2017-11-09 18:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 11:06 [RFC PATCH v2 0/7] Fix year 2038 issue for sound subsystem Baolin Wang
2017-11-02 11:06 ` [RFC PATCH v2 1/7] sound: Replace timespec with timespec64 Baolin Wang
2017-11-02 11:06 ` [RFC PATCH v2 2/7] sound: core: Avoid using timespec for struct snd_pcm_status Baolin Wang
2017-11-05 10:23   ` [alsa-devel] " Takashi Iwai
2017-11-05 13:48     ` Arnd Bergmann
2017-11-02 11:06 ` [RFC PATCH v2 3/7] sound: core: Avoid using timespec for struct snd_rawmidi_status Baolin Wang
2017-11-02 11:06 ` [RFC PATCH v2 4/7] sound: core: Avoid using timespec for struct snd_timer_status Baolin Wang
2017-11-02 11:06 ` [RFC PATCH v2 5/7] uapi: sound: Avoid using timespec for struct snd_ctl_elem_value Baolin Wang
2017-11-08 13:44   ` Takashi Sakamoto
2017-11-02 11:06 ` [RFC PATCH v2 6/7] sound: core: Avoid using timespec for struct snd_pcm_sync_ptr Baolin Wang
2017-11-02 11:06 ` [RFC PATCH v2 7/7] sound: core: Avoid using timespec for struct snd_timer_tread Baolin Wang
2017-11-05 10:29   ` [alsa-devel] " Takashi Iwai
2017-11-05 13:16     ` Arnd Bergmann
2017-11-05 16:59       ` Takashi Iwai
2017-11-06 16:33         ` Arnd Bergmann
2017-11-09 16:52           ` Takashi Iwai
2017-11-09 17:01             ` Arnd Bergmann
2017-11-09 18:11               ` Takashi Iwai [this message]
2017-11-09 23:20                 ` Arnd Bergmann
2017-11-10  7:19                   ` Takashi Iwai

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=s5hinejuxtd.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=baolin.wang@linaro.org \
    --cc=bhumirks@gmail.com \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=elfring@users.sourceforge.net \
    --cc=fabf@skynet.be \
    --cc=gudishax.kranthikumar@intel.com \
    --cc=guneshwor.o.singh@intel.com \
    --cc=hardik.t.shah@intel.com \
    --cc=jeeja.kp@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=naveen.m@intel.com \
    --cc=o-takashi@sakamocchi.jp \
    --cc=perex@perex.cz \
    --cc=subhransu.s.prusty@intel.com \
    --cc=vinod.koul@intel.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

Powered by JetHome