From patchwork Fri Aug 5 11:10:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Gruszka X-Patchwork-Id: 1038302 X-Patchwork-Delegate: bhelgaas@google.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p75BBO86013141 for ; Fri, 5 Aug 2011 11:11:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755133Ab1HELL2 (ORCPT ); Fri, 5 Aug 2011 07:11:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26050 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754934Ab1HELL1 (ORCPT ); Fri, 5 Aug 2011 07:11:27 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p75BBC5T003060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Aug 2011 07:11:12 -0400 Received: from localhost (dhcp-27-232.brq.redhat.com [10.34.27.232]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p75BBA99015217; Fri, 5 Aug 2011 07:11:11 -0400 From: Stanislaw Gruszka To: "John W. Linville" , linux-wireless Cc: ath9k-devel@venema.h4ckr.net, camilo@mesias.co.uk, Jonathan Nieder , Tony Houghton , Rajkumar Manoharan , ath9k-devel@venema.h4ckr.net, Adrian Chadd , Subject: [PATCH -next 7/8] pci: aspm: add settings changed callback Date: Fri, 5 Aug 2011 13:10:38 +0200 Message-Id: <1312542639-4274-8-git-send-email-sgruszka@redhat.com> In-Reply-To: <1312542639-4274-1-git-send-email-sgruszka@redhat.com> References: <1312542639-4274-1-git-send-email-sgruszka@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 05 Aug 2011 11:11:29 +0000 (UTC) Inform drivers that register pci_drviver->aspm_changed(), about new ASPM settings. Callback is only called for child (endpoint) devices. Currently this will be used in ath9k driver. In the future we most likely will use it in iwlwifi and rtlwifi drivers and possibly some others that needs to do own ASPM related quirks. Cc: Jesse Barnes Cc: linux-pci@vger.kernel.org Signed-off-by: Stanislaw Gruszka --- drivers/pci/pcie/aspm.c | 5 ++++- include/linux/pci.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 2883fc3..d7acec8 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -474,8 +474,11 @@ static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state) */ if (state & ASPM_STATE_L1) pcie_config_aspm_dev(parent, upstream); - list_for_each_entry(child, &linkbus->devices, bus_list) + list_for_each_entry(child, &linkbus->devices, bus_list) { pcie_config_aspm_dev(child, dwstream); + if (child->driver && child->driver->aspm_changed) + child->driver->aspm_changed(child, dwstream); + } if (!(state & ASPM_STATE_L1)) pcie_config_aspm_dev(parent, upstream); diff --git a/include/linux/pci.h b/include/linux/pci.h index c446b5c..2110d63 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -555,6 +555,9 @@ struct pci_driver { int (*resume_early) (struct pci_dev *dev); int (*resume) (struct pci_dev *dev); /* Device woken up */ void (*shutdown) (struct pci_dev *dev); +#ifdef CONFIG_PCIEASPM + void (*aspm_changed) (struct pci_dev *dev, u32 state); +#endif struct pci_error_handlers *err_handler; struct device_driver driver; struct pci_dynids dynids;