From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E5DEC38145 for ; Thu, 8 Sep 2022 20:21:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229759AbiIHUVw (ORCPT ); Thu, 8 Sep 2022 16:21:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbiIHUVs (ORCPT ); Thu, 8 Sep 2022 16:21:48 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F992EC74A; Thu, 8 Sep 2022 13:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662668507; x=1694204507; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=a7T/JGLT6ZN2mqHLe4wvsZL3e/wJbh1R0c15TYv0olA=; b=Kyn2rGHU+Gr2WOKOPlAZ6r6W40cjNWB2GmN2NCoKaR03AfaXwY0Q4BqU W8lIOCgPUhFTHHjArWwDMH+xsfsnoaBz6c1rQqp1NY/deReN+WkOvgmbq CyESzPZtYm46HcscqthtkA5crwSqi+lLppgOy0Lsgbts6iw9jU9swmLG1 QYqpgsBrVO1yBrAA6aHPURYlleL9lWyTkcqbmhM60OsNjVjLPyTw8J/uA H9gdd5eM5QArCM6lLJP8IpJfF/pRnxKNE0YZZFldpGQ1sOgLBFeh/YAVA gsbMwdgnJx3iQhyJRqIy/eiIiKDZwxUBD2FNI5PAKw7V0Y2IvvXj2pito w==; X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="277703539" X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="277703539" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 13:21:46 -0700 X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="648182741" Received: from rhweight-wrk1.ra.intel.com ([137.102.106.43]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 13:21:45 -0700 Date: Thu, 8 Sep 2022 13:21:57 -0700 (PDT) From: matthew.gerlach@linux.intel.com X-X-Sender: mgerlach@rhweight-WRK1 To: Geert Uytterhoeven 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 , =?ISO-8859-15?Q?Niklas_S=F6derlund?= , Phil Edworthy , "Maciej W. Rozycki" , Johan Hovold , Lukas Wunner Subject: Re: [PATCH v1 4/5] fpga: dfl: add generic support for MSIX interrupts In-Reply-To: Message-ID: References: <20220906190426.3139760-1-matthew.gerlach@linux.intel.com> <20220906190426.3139760-5-matthew.gerlach@linux.intel.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 8 Sep 2022, Geert Uytterhoeven wrote: > 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 > Hi Geert, Currently, DFHs that are not version 1 should be version 0. I will fill in the switch statement to do nothing for version 0, and the default case will print a warning of an unexpected version. Thanks for the feedback. Matthew Gerlach > -- > 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 >