Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1055128rwn; Thu, 8 Sep 2022 12:39:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR44dH7qD+bcSHzEVLwkwi+o2N/8Jd61omVogtloJK8pzYnoy/KZ4LvMANoT/PgHRDRx6bzK X-Received: by 2002:a05:6a00:174f:b0:537:6845:8b1a with SMTP id j15-20020a056a00174f00b0053768458b1amr10968817pfc.68.1662665952500; Thu, 08 Sep 2022 12:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662665952; cv=none; d=google.com; s=arc-20160816; b=oDOhUTGAYfVvBDZ3vlP3+1WHlpqq3aFDV9jDeCf2lFtWIk1gQ0Ty61xIo/dq9HbLiU bt0BZNHd0OvU7tH8kqg1pJhLaSGHpxU375qcwaqZLVNxn/zxPBG/RRW3nZ9WDFAGeE4e K4Ih+asRkBDPY3AEOHFzH8fyrenkhn4S2+GwysdehLkdFM0M++hT1Gh8SlVKAnmiySFc j6GqI9D2YxiuVL87okhCcLiajjQn2y7k028e9v9+BlYwpfbVBo/HrWBlZzHx6iSmBrn5 gmS+zveVFSGTAJf8lWJ4sgkUmhABAQf9YK/2VVv/85bvFBBU7m+p/ao7KcqG32hqxEL+ KnHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=rtjCvFMzCSvxYl+KVbiv9tLwcN6J8Pm9uw37RRRl7gg=; b=BNkcUkPBhf6IE9szeQ9Hxi8tXCKTRjrvyZoobf5jsHqwNMZc5fpaePDvAHvT33qVj2 /ugB2cB5EwCeExa+o+AUFDwKOtDKocgZcaZRVM1Am2S2NJnYzPMx50ja/DmxdaOx4uWl A5laWn9i8Q3zrjntb/1OLvVgw7D1On4jduHEbzSP0PWh1YJuLmBiG/zU8SxUir3sZjNL IX7mWXbZVYjz1xJFC1OEDbFlRsB/xIGyjkAX6siuldPviBSm01WPaSsm8O95cT7fE0PL 6dnjFd4POMKr0gy3EzJnpo1FPkxzCg/kwsQSB1+uUVjlQ2c7o+CrQZ7PRCWjoekiu8iU Z9Sw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i127-20020a625485000000b00537ac8547e9si19487908pfb.82.2022.09.08.12.39.00; Thu, 08 Sep 2022 12:39:12 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232001AbiIHT3C (ORCPT + 99 others); Thu, 8 Sep 2022 15:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230334AbiIHT3A (ORCPT ); Thu, 8 Sep 2022 15:29:00 -0400 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A340CB532D; Thu, 8 Sep 2022 12:28:59 -0700 (PDT) Received: by mail-qv1-f43.google.com with SMTP id ml1so7795446qvb.1; Thu, 08 Sep 2022 12:28:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=rtjCvFMzCSvxYl+KVbiv9tLwcN6J8Pm9uw37RRRl7gg=; b=p8E4JfUtzfT9wVWLIjZKq6B3xlI/3i6dQHGJVI6YrOKtZm6qUAEOBTQk5wTt/yh44I mSFJtUz0YjcZTaxHAsrhNyQCSdeUMUBm+f/kFTc0upKvLifovZLgNcXzBIIijUVerZIp 7QAKYrB2fRoTWJ5L2Ak9Wus5RWC4Q+ck90WCC1PqCs8M1Yz7/kgeLbrzg8IlqVYBLl5h nCWblac+Wci1w2vtrfDMCDrgqQioglDh/HRxg3VOIcFuNhZp84HogT0GG1Jd7S2+chmv uPBO/9qaioPLwk8DaBdVWK7/l2kqwmfAVYLvLegEyW/vUKue6DmP67r5rHcwm2Eth4np kUcg== X-Gm-Message-State: ACgBeo26UVIHgJCGkNsJxMSyEw0WJYiiKIFQIRYrV1Ck1KtSJPgVKpRd jJ4sk769eXHVVkZ0unHvyXr6NterjwG9OQ== X-Received: by 2002:ad4:5d65:0:b0:4a4:cac:d56b with SMTP id fn5-20020ad45d65000000b004a40cacd56bmr9207035qvb.2.1662665338625; Thu, 08 Sep 2022 12:28:58 -0700 (PDT) Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com. [209.85.128.182]) by smtp.gmail.com with ESMTPSA id 15-20020ac84e8f000000b0031f0b43629dsm15924814qtp.23.2022.09.08.12.28.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Sep 2022 12:28:57 -0700 (PDT) Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-3450990b0aeso150101287b3.12; Thu, 08 Sep 2022 12:28:57 -0700 (PDT) X-Received: by 2002:a81:758a:0:b0:345:450b:6668 with SMTP id q132-20020a81758a000000b00345450b6668mr8834017ywc.316.1662665336860; Thu, 08 Sep 2022 12:28:56 -0700 (PDT) MIME-Version: 1.0 References: <20220906190426.3139760-1-matthew.gerlach@linux.intel.com> <20220906190426.3139760-5-matthew.gerlach@linux.intel.com> In-Reply-To: From: Geert Uytterhoeven Date: Thu, 8 Sep 2022 21:28:45 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 4/5] fpga: dfl: add generic support for MSIX interrupts To: matthew.gerlach@linux.intel.com Cc: Andy Shevchenko , Wu Hao , Xu Yilun , russell.h.weight@intel.com, basheer.ahmed.muddebihal@intel.com, Tom Rix , Moritz Fischer , linux-fpga@vger.kernel.org, "open list:DOCUMENTATION" , Linux Kernel Mailing List , tianfei.zhang@intel.com, Jonathan Corbet , Greg KH , "open list:SERIAL DRIVERS" , Jiri Slaby , Geert Uytterhoeven , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Phil Edworthy , "Maciej W. Rozycki" , Johan Hovold , Lukas Wunner Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Matthew, On Thu, Sep 8, 2022 at 7:34 PM wrote: > On Thu, 8 Sep 2022, Andy Shevchenko wrote: > > On Wed, Sep 07, 2022 at 02:37:32PM -0700, matthew.gerlach@linux.intel.com wrote: > >> On Tue, 6 Sep 2022, Andy Shevchenko wrote: > >>> On Tue, Sep 06, 2022 at 12:04:25PM -0700, matthew.gerlach@linux.intel.com wrote: > > > > ... > > > >>>> + if (fid != FEATURE_ID_AFU && fid != PORT_FEATURE_ID_ERROR && > >>>> + fid != PORT_FEATURE_ID_UINT && fid != FME_FEATURE_ID_GLOBAL_ERR) { > >>>> + v = readq(base); > >>>> + v = FIELD_GET(DFH_VERSION, v); > >>>> + > >>>> + if (v == 1) { > >>>> + v = readq(base + DFHv1_CSR_SIZE_GRP); > >>> > >>> I am already lost what v keeps... > >>> > >>> Perhaps > >>> > >>> v = readq(base); > >>> switch (FIELD_GET(DFH_VERSION, v)) { > >>> case 1: > >>> ... > >>> break; > >>> } > >> > >> How about? > >> if (FIELD_GET(DFH_VERSION, readq(base)) == 1) { > >> ... > >> } > > > > This one tends to be expanded in the future, so I would keep it switch case. > > > > I'm okay with using the switch statement, but how about the following? > > switch (FIELD_GET(DFH_VERSION, readq(base))) { > case 1: > ... > break; > } Would it make sense to print an error if a newer version than 1 is detected? BTW, what is the expected value when DFHv1 is not detected? Zero or an arbitrary number? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds