Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3114277yba; Sun, 28 Apr 2019 17:37:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzplHyPonK6vCO0eKLgC9V7P3qPn+5b7jvN/e3P8sRGRJM5DcNLQYCYwQJ6EVkawBhFoXBx X-Received: by 2002:aa7:8c84:: with SMTP id p4mr41709704pfd.164.1556498243974; Sun, 28 Apr 2019 17:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556498243; cv=none; d=google.com; s=arc-20160816; b=DIBqO3mmmy9WWxgkIYaGbPR+RXalWilrZSrXS+1JUsTEnV8rdyP6IAOFfuf6loC2Up 9dA6lTtBEGUgnKA4Dam6NtjhZicD0wKx8FFa75PZbx+YhHvsEJgKPYB2XtpscsmgDY5G Bpg5+LUhP0LGH/GyCC/pupM2+8WMADhuXwHwt5CRU0r79cqxi6cRVdLDq4k+RY19uH4E ZNa9W3C5ZQzoSAY0/Adv0cb7g/uY0mJDOyTNUmSrdTcrSEoELrx7WeNk63jyuJoS+ZDJ KVGOnbg5fBTD/wGLRxlok0JlB+B0XqVQd9jrR9cJwSOjMpV30hpoOrkvdS15I+1LrbMc CLVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1dAmb9ZyqAMgzZyfD+f0/Tp1pdwqpJEIqakg/jNZHKs=; b=x5eUDW42x3oR4SOja18HsKgF77NsOMMp2+7BJHn/uMnY7T8xOsYsUk/jKeJx+cNuTx WxDS72s3L2/om/kal/UjnkYTmOgJ5PnnD8oFiroYzs/MA+NvUVdyQSjIKXn/UQNgYo4a 5H82G+/UplBYNSKFeL1gTe9fmr/9feyHhpbNCuy8IOdDX1/P1pyTZturnyw93/JeWAyX kwONV/ZukjJEs3ZHgYeGQCH5Vq+MAExUSQn5RDQTli95QIqEI41kytXftcTLcuaqcQst PYwInqBFbdalKljbzlasB5yGRz7ddsfT4nvlnLmjjuGMHs1gv04y3mc7ywgD6T6LniAc SJ1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rCxqiVv4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 17si31435151pgk.72.2019.04.28.17.37.08; Sun, 28 Apr 2019 17:37:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rCxqiVv4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726908AbfD2AgV (ORCPT + 99 others); Sun, 28 Apr 2019 20:36:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:43802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726223AbfD2AgV (ORCPT ); Sun, 28 Apr 2019 20:36:21 -0400 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E052720675; Mon, 29 Apr 2019 00:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556498180; bh=lJoznh71DxyTrORc6sBQL+wEIai6vdomCwoJiWYbiDo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rCxqiVv4N/0OIGe+uhPAJZbxwI6KYlH41uyxwTmn4ky1qm/dceMGumgeNcumAtl5q 3DKUKxfzfjw+w4X7eSlGuArFuN7D98ZTnGo69NDpLo9iYNc0YskXsmYQRKmBD6tDS8 3Cc6idvcYc9Z2rXCrIWAu8kG3OockHSw37RTppVQ= Date: Sun, 28 Apr 2019 19:36:18 -0500 From: Bjorn Helgaas To: Lukas Wunner Cc: fred@fredlawl.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, keith.busch@intel.com, mr.nuke.me@gmail.com, liudongdong3@huawei.com, thesven73@gmail.com Subject: Re: [PATCH 2/4] PCI: pciehp: Replace ctrl_*() with pci_*() Message-ID: <20190429003618.GN14616@google.com> References: <20190427191304.32502-1-fred@fredlawl.com> <20190427191304.32502-3-fred@fredlawl.com> <20190427200301.tujp2535jxmlqttr@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190427200301.tujp2535jxmlqttr@wunner.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 27, 2019 at 10:03:01PM +0200, Lukas Wunner wrote: > On Sat, Apr 27, 2019 at 02:13:02PM -0500, fred@fredlawl.com wrote: > > Hotplug useses custom ctrl_*() dev_*() printk wrappers for logging > > messages. To make hotplug conform to pci logging, replace uses of these > > wrappers with pci_*() printk wrappers. In addition, replace any > > printk() calls with pr_*() wrappers. > > A lot of pciehp's messages are preceded by "Slot(%s): ", where %s is > replaced by the Physical Slot Number in the Slot Capabilities register > (which is cached in struct controller) plus an optional suffix if the > same PSN is used by multiple slots. For some reason (probably a > historic artefact), this prefix is included only in *some* of the > messages. > > I think it would be useful to make the messages consistent by *always* > including the "Slot(%s): " prefix. However the prefix is unknown until > pci_hp_initialize() has been called. I'd solve this by keeping the > ctrl_*() wrappers and amending them to print the "Slot(%s): " prefix, > then making sure that ctrl_*() is not called before pci_hp_initialize(). > (pci_*() has to be used instead). I was hoping to get rid of the ctrl_*() wrappers completely, but the "Slot(%s)" prefix is actually a pretty good reason to keep them. Moving the prefix from the call site to the ctrl_*() wrappers should be a separate patch that doesn't change the output at all (except maybe adding the prefix to messages that don't currently include it). So you probably need three steps (each in a separate patch): 1) Convert ctrl_*() to use pci_dev instead of pcie_device, something like this: + #define pr_fmt(fmt) "pciehp: " fmt + #define dev_fmt pr_fmt #define ctrl_info(ctrl, format, arg...) \ - dev_info(&ctrl->pcie->device, format, ## arg) + pci_info(&ctrl->pcie->port, format, ## arg) 2) Convert any output before pci_hp_initialize() from ctrl_*() to pci_*(). 3) Centralize the "Slot(%s): " prefix, something like this: #define ctrl_info(ctrl, format, arg...) \ - pci_info(&ctrl->pcie->port, format, ## arg) + pci_info(&ctrl->pcie->port, "Slot(%s): " format, slot_name(ctrl), ## arg) - ctrl_info(ctrl, "Slot(%s): ...", slot_name(ctrl)); + ctrl_info(ctrl, "...");