Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1528425pxb; Wed, 20 Oct 2021 06:55:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7FOK0rDj/nWgy9sUlUiJWb9o5DWLbLHvRuN5ioGLsNQwysTlRT3HffzYZjhaUSXdhEGj+ X-Received: by 2002:a05:6402:5255:: with SMTP id t21mr162312edd.103.1634738140848; Wed, 20 Oct 2021 06:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634738140; cv=none; d=google.com; s=arc-20160816; b=sDixUN9ne34ko8IpfxPLq47Zalx07P56DEeqFe/ysK34l0F9gPE8Z6PIBj22KyXX3u opYM4104i0JgI+wIF71XTrGV08V7KecpUcrKuf5oiR5aSDuZmkozd2LVNkpWX8efr+0P LsNDKoFekC1LLPS3yC1ybAEGznBJoxEvcQiwEwRlDGUY1ijbnOiwewFJgJPwFut6ngxE N6GubCPP6zP9Ol24IyF8ZS0CMehpg2evecSf1wJIMCR9J5IU9gwiXf8rwflD9zwi0D2l mgxU+5Qbq7JuLhDyNO4ZuYLWsWkmK++m3n8Vh6T/w09r3G05xZgobqgJdexdUqSgi177 yTbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=CwhEUxCPHVkLzRGQBiP8hH4iGptagK0lYx9T2W0W338=; b=tZnNZNGRdudSYIPkf7reGyvqhyZYsBOj1NO7uVhc5bsiHJYQ04eyjoVuoqWckZFPBz 5o8PcuQrpYE/XzCa+hfbdDgNVWTSpONb4ee27FoC3jXLsGMgb8PG44kwBM2muRQgUc3w 0sWlctVCemmiNaDYy0Ib+wLWd47bsk1h2gFKdin0GYY7+67K2FEruBCnU4JQO2CDaXIi 4mjNdqMoMbDKcVdY2PZV5Yp+3JZtedauAPY8geih6dMslmhuapb3NdrEY1/O/moJLvdQ 90aEcG1MWyS0NXqs1RpmzhMzpssp72WWucQcfHY6yzsvOJoJ0mwIxAZCVKMvriiIz44y WgKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ebOZ/YM1"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz1si2497033edb.419.2021.10.20.06.55.15; Wed, 20 Oct 2021 06:55:40 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ebOZ/YM1"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbhJTNy0 (ORCPT + 99 others); Wed, 20 Oct 2021 09:54:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:49946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbhJTNyZ (ORCPT ); Wed, 20 Oct 2021 09:54:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5B7BA60EE3; Wed, 20 Oct 2021 13:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634737931; bh=SBDigKEN5g+FIb/oTr8InqTwNX3E4a1MT8ec1sBFvlQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ebOZ/YM1U8AKCU7bkBMRow9hfGEg/T5qtZOnzqYL2X4cYzQc3YBPMtGv7baBuoDor IxdawKe6lJCZFRLJV495dwO5XDDiZjfhHWiRG5x2rR3e5gOrIkJ8CIhOCSoU22mQl7 Fr07REsSQa4GqxQ09hAeA9DWeapw6ZfUUWv4jlRloaBaEgkcDf+cJSe2Txk6G+ZbUI IZfHGOVEzVKM0eAME2f2N9Ti6yAYtg5TbrDs1Q2C7bD+PYHsTqgDfrisgQtBg2Efx5 isY6pjXd7AVvCUYGh1lDcuVsz4IE5lwT4ZMo5SsCXB8DZpq0E0RjVDbZV2d83aKRcW qj3vJk/Y+E23Q== Received: by pali.im (Postfix) id E204C883; Wed, 20 Oct 2021 15:52:08 +0200 (CEST) Date: Wed, 20 Oct 2021 15:52:08 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Naveen Naidu Cc: bhelgaas@google.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring Subject: Re: [PATCH v2 02/24] PCI: Set error response in config access defines when ops->read() fails Message-ID: <20211020135208.zgm2gvhqd7ukb57m@pali> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 15 October 2021 19:58:17 Naveen Naidu wrote: > Make PCI_OP_READ and PCI_USER_READ_CONFIG set the data value with error > response (~0), when the PCI device read by a host controller fails. > > This ensures that the controller drivers no longer need to fabricate > (~0) value when they detect error. It also gurantees that the error > response (~0) is always set when the controller drivers fails to read a > config register from a device. > > This makes error response fabrication consistent and helps in removal of > a lot of repeated code. > > Suggested-by: Rob Herring > Signed-off-by: Naveen Naidu > --- > drivers/pci/access.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/access.c b/drivers/pci/access.c > index 46935695cfb9..b3b2006ed1d2 100644 > --- a/drivers/pci/access.c > +++ b/drivers/pci/access.c > @@ -42,7 +42,10 @@ int noinline pci_bus_read_config_##size \ > if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ > pci_lock_config(flags); \ > res = bus->ops->read(bus, devfn, pos, len, &data); \ > - *value = (type)data; \ > + if (res) \ > + SET_PCI_ERROR_RESPONSE(value); \ > + else \ > + *value = (type)data; \ Hello! Just one small comment. It looks like that in this patch is broken alignment of backslashes on the end of lines. Prior this patch backslashes on all lines were at the same column. With this patch they are not. > pci_unlock_config(flags); \ > return res; \ > } > @@ -228,7 +231,10 @@ int pci_user_read_config_##size \ > ret = dev->bus->ops->read(dev->bus, dev->devfn, \ > pos, sizeof(type), &data); \ > raw_spin_unlock_irq(&pci_lock); \ > - *val = (type)data; \ > + if (ret) \ > + SET_PCI_ERROR_RESPONSE(val); \ > + else \ > + *val = (type)data; \ > return pcibios_err_to_errno(ret); \ > } \ > EXPORT_SYMBOL_GPL(pci_user_read_config_##size); > -- > 2.25.1 >