Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751425AbbDIELZ (ORCPT ); Thu, 9 Apr 2015 00:11:25 -0400 Received: from mail-ig0-f173.google.com ([209.85.213.173]:35962 "EHLO mail-ig0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750799AbbDIELW (ORCPT ); Thu, 9 Apr 2015 00:11:22 -0400 MIME-Version: 1.0 In-Reply-To: <1428549459.18187.56.camel@kernel.crashing.org> References: <1427857069-6789-1-git-send-email-yinghai@kernel.org> <1427857069-6789-4-git-send-email-yinghai@kernel.org> <20150406220638.GH10892@google.com> <20150406.203533.1356187749826485194.davem@davemloft.net> <20150408154759.GN10892@google.com> <1428527527.18187.28.camel@kernel.crashing.org> <1428549459.18187.56.camel@kernel.crashing.org> Date: Wed, 8 Apr 2015 21:11:21 -0700 X-Google-Sender-Auth: AcuMO3xQisS1xsUhFmdAdKrfSqY Message-ID: Subject: Re: [PATCH 3/3] PCI: Set pref for mem64 resource of pcie device From: Yinghai Lu To: Benjamin Herrenschmidt Cc: Bjorn Helgaas , David Miller , David Ahern , "linux-pci@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1317 Lines: 31 On Wed, Apr 8, 2015 at 8:17 PM, Benjamin Herrenschmidt wrote: > On Wed, 2015-04-08 at 17:06 -0700, Yinghai Lu wrote: > I'll let Bjorn be the final judge here but I am not fan of the way you > set/clear/set/clear the IORESOURCE_PREFETCH bit with > pci_set_pref_under_pref(). It's error prone and confusing, the code is > already barely readable as it is ... We only use them to wrapping final pci_claim*, sizing, and assigning. that is limited places. > > I would rather you replace those various masks compares with a helper > that does something like pci_resource_compatible(parent_res, child_res), > which has the logic to test. That or a helper that does something like > pci_calc_compatible_res_flags() which returns a "flags" that has > PREFETCH set, which you use in place of res->flags in the various > allocation path. That way should be more intrusive to current code, as we are using type_mask checking to share the code among parent(pref)/child(pref), parent(no-pref)/child(pref), and parent(no-pref)/child(pref) Yinghai -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/