Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1027912imw; Tue, 5 Jul 2022 02:27:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v2kTMN55vBRO0JCsOnESS1XnrpTjBvyhfZSRuezflJqQem5HzggOS966ZlSRoOodEw7aOn X-Received: by 2002:a65:6b94:0:b0:3fb:16f4:3620 with SMTP id d20-20020a656b94000000b003fb16f43620mr28901728pgw.464.1657013248704; Tue, 05 Jul 2022 02:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657013248; cv=none; d=google.com; s=arc-20160816; b=DiaYkSGl7Nb7RMx4eH0J+7Zh+KA3d5T+RLozfPNEowWKLnM5xQL5quC5OJNYpopr9c 1sm6l4xtRK7JLP3h/4hLfPRfNDsBxvMApOX66SoNbGkGRu+QpX6w3q7jNTvRDw/VtiNT FVlD1YM5/tm6j4BG0bxK6N8iWZkrgbfQ8Mlibx1hnyrezSHvY7phJQv3dRwIOxq0kfUd RcAWZFuB9MHEWs1prPHY8Y8+5yiLyVaMUmNzC5BNsedwU0Ga4IryB9Xy9QTw6+DvleLI /MuZxvQFmd135scd00WkP/ZfXJsu0I4a/7yaeAU5wEvkT0L5r75cOKy4POt8Qsbqnvuh 8OeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=k0xB10Perd+Jw8sWS32J1melEiaxGcduzBXWrX0yzOs=; b=U3Gy3FcPh3puhpzq2MdCg4hdhCTR6OYJvxcngN/UTNv5uopo7hpeR5vx95hnQPP/C9 DnBQeInAwyHCKireOb/PZvD2h3UCTpFryNxKB942InfWqKR1UYRAjmV9euasvY+4R/s1 d0ZlDKQWhQDZjl5Y7xn+v8T/6vc5fFCFmGacF7mThRSn2Po+jpk2pD6/RMmN6poGQWR9 Wj2v+my8zkFfs4Lsek0uIf+xXPY7NCVTpdmPumq6J67ksrLBflqAHtwNZSHGjd5z1i+a ujoFWsPdszVQlXq1IRihfmxk7DONgHCvbNIiOPU+sK7IWCl37s0eoMQ8UkFXGIJvfFP2 NzdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Qixjf4ql; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a056a0002c300b0051c2af24938si2516135pft.190.2022.07.05.02.27.16; Tue, 05 Jul 2022 02:27:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Qixjf4ql; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230385AbiGEJFN (ORCPT + 99 others); Tue, 5 Jul 2022 05:05:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbiGEJFK (ORCPT ); Tue, 5 Jul 2022 05:05:10 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3D9B388C; Tue, 5 Jul 2022 02:05:09 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id i14so971325yba.1; Tue, 05 Jul 2022 02:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=k0xB10Perd+Jw8sWS32J1melEiaxGcduzBXWrX0yzOs=; b=Qixjf4ql1w+8Zz+LViBF8fpy93wI5MiiTdINgX3wp5Z/C4esiA7TtuC/9+G6LIcbdt gitJpDgSBHGrpEjMoZL1tV1PfmhSNMfowzNYZWAehZS0/gH/v7195qEdtL7cLXOS03sn bN5dECcUjZw0hr8D6GOzyF/6N29Pw7kFjVr8CEr0KJq0N1Zaqj9d/JYtw6loLUQEi/KM 3wimOaFwmQLG1d5CP5cyCYtkPfpYZ6XCPafcEQ1zP4VoRGwg5d3IZRYQM4OWkvV2Ci+E ACS53b0S23dlIMXjBRukRzEHWvzzuHRuVgo86Ed2rbN1RqCtPcXJV829EnPW2Oq3Zu+z TUuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=k0xB10Perd+Jw8sWS32J1melEiaxGcduzBXWrX0yzOs=; b=5GwlFHoNoSDfp3VEnTYhKdby5W9n4ugUOV6MBIx7UCYIVLc1+Gj5E+wkIv+WNA4dS3 Y6WKmjYKECdcO0PmaJZVo0KZgyoBuhRs4bPUjf9LIKtILObk+l9Cd4pqJ8Cgu+zDwfqp 2AhrZPTEiOni8ymjnPE17cKv7fG4AjBPWy4gpDzirMVCXyTgn6zvEu3qizVpfXNLdHrt 9amFT0emPHIUKEVXei7trJOZIrUMfYLp9GEXAcnTw6r7qDafc46NpfPtchYwWgEtMFCW GwpmORpEwGp6fENwhc43MIb2MBqwuwKE3KKzJN4nmfPuG0fxsGbX45nQvrT2j4iZafvq 7LwA== X-Gm-Message-State: AJIora8Pj4msciAKuWU2NCgK2V57lVfrW3IRJ9353KCiQojUAryFKmQI LM7ULADgbEdmSOnjonLcyozowD0xwrWlAhw+gzY= X-Received: by 2002:a05:6902:c4:b0:64b:4677:331b with SMTP id i4-20020a05690200c400b0064b4677331bmr36424263ybs.93.1657011908774; Tue, 05 Jul 2022 02:05:08 -0700 (PDT) MIME-Version: 1.0 References: <1656469212-12717-1-git-send-email-u0084500@gmail.com> <1656469212-12717-3-git-send-email-u0084500@gmail.com> In-Reply-To: From: Andy Shevchenko Date: Tue, 5 Jul 2022 11:04:32 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] iio: adc: Add rtq6056 support To: ChiYuan Huang Cc: Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Lars-Peter Clausen , cy_huang , linux-iio , Linux Kernel Mailing List , devicetree Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 5, 2022 at 3:41 AM ChiYuan Huang wrote: > Andy Shevchenko =E6=96=BC 2022=E5=B9=B47=E6= =9C=885=E6=97=A5 =E9=80=B1=E4=BA=8C =E6=B8=85=E6=99=A85:52=E5=AF=AB=E9=81= =93=EF=BC=9A > > On Mon, Jul 4, 2022 at 9:27 AM ChiYuan Huang wrote= : > > > ChiYuan Huang =E6=96=BC 2022=E5=B9=B47=E6=9C=884= =E6=97=A5 =E9=80=B1=E4=B8=80 =E4=B8=8A=E5=8D=8811:16=E5=AF=AB=E9=81=93=EF= =BC=9A > > > > Andy Shevchenko =E6=96=BC 2022=E5=B9=B4= 7=E6=9C=881=E6=97=A5 =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=886:05=E5=AF=AB=E9= =81=93=EF=BC=9A > > > > > On Wed, Jun 29, 2022 at 4:23 AM cy_huang wro= te: ... > > > > > > + struct { > > > > > > + u16 vals[RTQ6056_MAX_CHANNEL]; > > > > > > + int64_t timestamp; > > > > > > + } data __aligned(8); > > > > > > > > > > Hmm... alignment of this struct will be at least 4 bytes, but > > > > > shouldn't we rather be sure that the timestamp member is aligned > > > > > properly? Otherwise this seems fragile and dependent on > > > > > RTQ6056_MAX_CHANNEL % 4 =3D=3D 0. > > > > > > > > > Yap, from the 'max channel', it already guarantee this struct will = be > > > > aligned at lease 4. > > > > Actually, It can be removed. > > > > I think for the safest side it should be given to the timestamp member.= No? > > > Sorry, following your comment, Why to use 'align' for the timestamp membe= r? > the data member already guarantee 2 * 4 =3D 8 byte, then timestamp will > be 8 byte aligned, right? Today it's true, tomorrow it might be different. Imagine if this driver will cover a new (version of) hardware and needs an additional channel, how do you guarantee alignment in that case? So, current approach is working, but fragile. > what you mentioned is to put __aligned(8) only for timestamp. Yes. > I try to put aligned in two ways ( one is only for timestamp, another > is the whole struct). the result is the same. > From my thinking, in this case, the struct is already 8 byte aligned > for timestamp member. don't you think to put 'aligned' is redundant? No. --=20 With Best Regards, Andy Shevchenko