From patchwork Thu Apr 26 15:14:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10366187 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C2C02601D3 for ; Thu, 26 Apr 2018 15:15:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0B8B28A63 for ; Thu, 26 Apr 2018 15:15:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A446428E38; Thu, 26 Apr 2018 15:15:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 053A428A63 for ; Thu, 26 Apr 2018 15:15:09 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2F5382677F6; Thu, 26 Apr 2018 17:15:06 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 142DF2677FD; Thu, 26 Apr 2018 17:15:04 +0200 (CEST) Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) by alsa0.perex.cz (Postfix) with ESMTP id B5E412677F6 for ; Thu, 26 Apr 2018 17:15:01 +0200 (CEST) Received: by mail-qt0-f193.google.com with SMTP id h2-v6so19866722qtp.7 for ; Thu, 26 Apr 2018 08:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=JxECd+M+V4mEqnlw9zbp4+eZenEaaxrbfsLhlCE/mkc=; b=ZqBi8WrPXSHGODo0pST+5Pf8wpx+ATge74ulamugv8mkygUl7mf8R8IBNoXMRDMdh+ pbUb8NErLpRtPDTaP8Nwyqm70z3Iz2AdHkZzlCfcps5vlwyGkkAl/2bun920bp2Yqo/7 +6xk9xzhoemZ8xI4Fpcfe4AFrr4KoGxn+VTfIkSSngiGwpjdbZnaP21yyEKgEukyPX/J X/gkBX4Bg0hmPpHyuMceU84rUzF8hbH/VPmhEznKdBIOxvoZ4TQyQceXms9ualmRChRx nC1SU/4dfmKp75IM4U9XDHExoDTBOFDcyWfKwNPzc9jfe9cFQ8eWQiBguwvtMn4Y+e4H Ecbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=JxECd+M+V4mEqnlw9zbp4+eZenEaaxrbfsLhlCE/mkc=; b=UvG+V5bNjL3I9DSmkKDEZwk2MGNjDOMSrxyKFuPwa1sZ69hVW4J1bEHl/EQwQwmZQ0 2RPJohDf1YVq7W4zNzXpLd2eAha79Bv7zMKCuChDl2GuS+AvP3o3F/TeTSSxyyV9heDy g5imDCJTdCl6TVvVSniX5SwZlhC2I/rWk48RcX+N+biySZeInZuEkwK0M/zn7pMrhOgF r/+9l3WBnFxQqOuPJn+XGrlPIwpAe07oZEXXhvQtn5JOTs6/0qCzQwkUHGc/kGDChDI4 5rwYUrkitVIFCYuZ8eUWyqhoNIztXmI1OPrikYhMDUjgiyo6uT4tSQnsvO76QR1PUsYH IHLQ== X-Gm-Message-State: ALQs6tC0QKTKrUG2t18QHDv2TdjKxYxmVMwsWDANC0wLTC8TJlzl70br E3FY0sWRhzkbBI0yEmK2zcQG4Qyt1aEYQlNerv8= X-Google-Smtp-Source: AB8JxZpB3YxX770EAHaVbV44WuMScsR2I+zgctXK5W6LxAwfmDCz7R2rxd1xtoN6rh/qutW38NShAkzoKZZZPt5eo8s= X-Received: by 2002:ac8:546:: with SMTP id c6-v6mr37184193qth.163.1524755700247; Thu, 26 Apr 2018 08:15:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.185.3 with HTTP; Thu, 26 Apr 2018 08:14:59 -0700 (PDT) In-Reply-To: References: From: Arnd Bergmann Date: Thu, 26 Apr 2018 17:14:59 +0200 X-Google-Sender-Auth: nYo1NyvbATjaLowW7b_gg9sdGaU Message-ID: To: Baolin Wang Cc: Fabian Frederick , Arvind Yadav , Linux Kernel Mailing List , alsa-devel@alsa-project.org, Vinod Koul , hardik.t.shah@intel.com, Takashi Iwai , Guneshwor Singh , Liam Girdwood , Takashi Sakamoto , gudishax.kranthikumar@intel.com, Mark Brown , Bhumika Goyal , Naveen M , SF Markus Elfring , jeeja.kp@intel.com, subhransu.s.prusty@intel.com, Ingo Molnar , Dan Carpenter Subject: Re: [alsa-devel] [PATCH 8/8] ALSA: add new 32-bit layout for snd_pcm_mmap_status/control X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Apr 24, 2018 at 2:06 PM, Baolin Wang wrote: > -struct snd_pcm_mmap_status { > +/* > + * For mmap operations, we need the 64-bit layout, both for compat mode, > + * and for y2038 compatibility. For 64-bit applications, the two definitions > + * are identical, so we keep the traditional version. > + */ > +#ifdef __SND_STRUCT_TIME64 > +#define __snd_pcm_mmap_status64 snd_pcm_mmap_status > +#define __snd_pcm_mmap_control64 snd_pcm_mmap_control > +#define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr > +#else > +#define __snd_pcm_mmap_status snd_pcm_mmap_status > +#define __snd_pcm_mmap_control snd_pcm_mmap_control > +#define __snd_pcm_sync_ptr snd_pcm_sync_ptr > +#endif > + > +struct __snd_pcm_mmap_status { > snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ > int pad1; /* Needed for 64 bit alignment */ > snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ One more thing here: this definition is slightly suboptimal because in an alsa-lib that gets built with 64-bit time_t, we end up with an unusable __snd_pcm_mmap_status structure (__snd_pcm_mmap_status64 works fine, and that would be the normal thing to use). Just in case we want to be able to build an alsa-lib that is capable of running both on new kernels with 64-bit time_t interfaces exposed to applications and also on old kernels that don't have the new ioctls, we probably want another fixup merged in: struct __snd_pcm_mmap_control { @@ -532,11 +543,6 @@ struct __snd_pcm_sync_ptr { } c; }; -struct __snd_timespec64 { - __s64 tv_sec; - __s64 tv_nsec; -}; - #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)]; typedef char __pad_after_uframe[0]; With this change, alsa-lib can either access whichever structure matches the glibc 'timespec' definition, or it can ask for __struct __snd_pcm_mmap_status and struct __snd_pcm_mmap_status64 explicitly, regardless of the time_t definition. Arnd diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 18fbdcb2c7b6..638c717d3eb9 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -496,19 +496,30 @@ struct snd_pcm_status { #define __snd_pcm_mmap_status64 snd_pcm_mmap_status #define __snd_pcm_mmap_control64 snd_pcm_mmap_control #define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr +#define __snd_timespec64 timespec +struct __snd_timespec { + __s32 tv_sec; + __s32 tv_nsec; +}; #else #define __snd_pcm_mmap_status snd_pcm_mmap_status #define __snd_pcm_mmap_control snd_pcm_mmap_control #define __snd_pcm_sync_ptr snd_pcm_sync_ptr +#define __snd_timespec timespec +struct __snd_timespec64 { + __s64 tv_sec; + __s64 tv_nsec; +}; + #endif struct __snd_pcm_mmap_status { snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ int pad1; /* Needed for 64 bit alignment */ snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ - struct timespec tstamp; /* Timestamp */ + struct __snd_timespec tstamp; /* Timestamp */ snd_pcm_state_t suspended_state; /* RO: suspended stream state */ - struct timespec audio_tstamp; /* from sample counter or wall clock */ + struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */ };