Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp178633pxb; Fri, 15 Oct 2021 03:22:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCiv0VS6vnlSQUj714o4rBECkohbPluE77KH2BdtHhkDpYIPUadZsx4ePoLhFnKcVWy2eW X-Received: by 2002:a63:7d0e:: with SMTP id y14mr8404254pgc.229.1634293336914; Fri, 15 Oct 2021 03:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634293336; cv=none; d=google.com; s=arc-20160816; b=iXRzqwzhwxcdAR+5VfofvgIf/n/Ecr+zYetrMhF1HVdWS6ESUT2oRSRamXM3/7SxAk by8kq1IqJrDwCdlSn/GXJVlWPMuyJBTdJzGELJRmI6R59osFsd0TMdJedVfESPE5ol04 4gdAAlxTRfu6WsPqyOPW06BhrQgSbzVbwbxyrwe2TSZXseiU9EyfStod6bh8D0S3scpg nQjm4kemHaHl4gQusYWpVip1lAQhWO0BqHDWyUAvzxIjUsv/Aw/Or7sXjemV9XXOlJZt 7+YcdSh6xseuQ0ZztKFwAq0XW/qGT3cMfRaRFqZoSWUAVESe1tJEXu1dqP/u4RmyQbtX C75g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=hTSSI6S3CgDLvq1yJ9mSPNuVClwcsV8040nZfSXnM8U=; b=i3MlN0jQcIJZgUWAr9nw4DjzLxJh2RBjzybbXg5YilPDm3DVbo02Qw/g+kg4ejNknL TPKInJ7cRo1LEDI63MrGdG+/g8QYF8MPevMdTHKLfBMJGVfIO4W2v+HcyWEuCytE+Mn/ WFPeHke38mdba0TAZ4k99urR1jc3nZR5ZjLbhKyVpXR/15KrIJFF+Ac/lm7EM3+xsyI1 4H638VKyJxeov3yhC6sIa6dKiYLG+gLCCBPmi0wnt7XN7Zrb48cB4vpGk/OJfP0JJpbJ g6UWg2XD3gQIUVAQp0ZOUDLCzW8UMp6gvBRd/h9ZtWU4QpwArO4W1jPUsHiXJ/DDKvay t1Vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 67si7372006pgi.417.2021.10.15.03.22.03; Fri, 15 Oct 2021 03:22:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231781AbhJOBX4 (ORCPT + 99 others); Thu, 14 Oct 2021 21:23:56 -0400 Received: from mail-lf1-f41.google.com ([209.85.167.41]:36845 "EHLO mail-lf1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbhJOBXz (ORCPT ); Thu, 14 Oct 2021 21:23:55 -0400 Received: by mail-lf1-f41.google.com with SMTP id g36so17971460lfv.3; Thu, 14 Oct 2021 18:21:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hTSSI6S3CgDLvq1yJ9mSPNuVClwcsV8040nZfSXnM8U=; b=N1I6OyNSTPt2Aa3B3A72BO4ABKQ6sb9HobgeQOTLd+mnil5nmV/QNcqOV3lBCBcgkd lijJWVj93I7iQ5QNPgfV80pAkwDkfcrFxLXvDIuOFLJaD1sHHNafFUpG605KN/RHJRB/ Em0Opo27ZIta0MKhFn+mjgzzNEPvpkzTdZVPZ9PV7tDtK1QyRuRQkVFPs/F1p9Lbul0K JEfMs19itjScyStmBxi9Yq/DHDpFiv5pSDkbmOjsDjN0jJ0QFl/sVcjEjNfq46ACw9Sj 0aCtNLVzNpUqbgjDHBqo1GB5UgvviXcASTuwLdXF587cnASe4GW48KiLXdeJ2F/k11eO VeoA== X-Gm-Message-State: AOAM532YUoD37MV5DYjafHq4wiKaEwiRn+lrGL78cp5MmTBox2Tg9nUV moMp8uf0w4AVmz38Zpl/mNc= X-Received: by 2002:a19:c1d2:: with SMTP id r201mr8221619lff.364.1634260908960; Thu, 14 Oct 2021 18:21:48 -0700 (PDT) Received: from rocinante ([95.155.85.46]) by smtp.gmail.com with ESMTPSA id i27sm362865lfo.173.2021.10.14.18.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 18:21:48 -0700 (PDT) Date: Fri, 15 Oct 2021 03:21:47 +0200 From: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= To: kelvin.cao@microchip.com Cc: kurt.schwemmer@microsemi.com, logang@deltatee.com, bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kelvincao@outlook.com Subject: Re: [PATCH v2 1/5] PCI/switchtec: Error out MRPC execution when MMIO reads fail Message-ID: References: <20211014141859.11444-1-kelvin.cao@microchip.com> <20211014141859.11444-2-kelvin.cao@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211014141859.11444-2-kelvin.cao@microchip.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kelvin, Thank you for sending the series over! I am terribly sorry for a very late comment, especially since Bjorn already accepted this series to be included, but allow me for a small question below. [...] > @@ -113,6 +127,7 @@ static void stuser_set_state(struct switchtec_user *stuser, > [MRPC_QUEUED] = "QUEUED", > [MRPC_RUNNING] = "RUNNING", > [MRPC_DONE] = "DONE", > + [MRPC_IO_ERROR] = "IO_ERROR", Looking at the above, and then looking at stuser_set_state(), which contains the following local array definition: const char * const state_names[] = { [MRPC_IDLE] = "IDLE", [MRPC_QUEUED] = "QUEUED", [MRPC_RUNNING] = "RUNNING", [MRPC_DONE] = "DONE", }; I was wondering if there might be a small benefit of declaring this array state_names[], or list of states if you wish, as static so that we avoid having to allocate space and fill it in with values every time this functions runs? The function itself if referenced in few places as per: Index File Line Content 1 drivers/pci/switch/switchtec.c 159 stuser_set_state(stuser, MRPC_RUNNING); 2 drivers/pci/switch/switchtec.c 178 stuser_set_state(stuser, MRPC_QUEUED); 3 drivers/pci/switch/switchtec.c 206 stuser_set_state(stuser, MRPC_DONE); 4 drivers/pci/switch/switchtec.c 567 stuser_set_state(stuser, MRPC_IDLE); Even though the string representation of the state is ever only printed if a debug logging is requested, we would allocate and popular this array every time anyway, regardless of whether we print any debug information or not. What do you think? Krzysztof