From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752808AbbC0VHw (ORCPT ); Fri, 27 Mar 2015 17:07:52 -0400 Received: from mail-bn1bon0131.outbound.protection.outlook.com ([157.56.111.131]:43220 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751850AbbC0VHp (ORCPT ); Fri, 27 Mar 2015 17:07:45 -0400 From: "J. German Rivera" To: , , , CC: , , , , , , , , , "J. German Rivera" Subject: [PATCH 2/6] staging: fsl-mc: Removed reordering of MC objects during bus scan Date: Fri, 27 Mar 2015 16:01:05 -0500 Message-ID: <1427490069-3142-3-git-send-email-German.Rivera@freescale.com> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1427490069-3142-1-git-send-email-German.Rivera@freescale.com> References: <1427490069-3142-1-git-send-email-German.Rivera@freescale.com> X-EOPAttributedMessage: 0 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=German.Rivera@freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;BMV:1;SFV:NSPM;SFS:(10019020)(6009001)(339900001)(199003)(189002)(87936001)(50226001)(19580405001)(229853001)(48376002)(36756003)(105606002)(62966003)(47776003)(50986999)(76176999)(106466001)(2201001)(86362001)(19580395003)(77156002)(50466002)(77096005)(85426001)(2950100001)(92566002)(46102003);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0301MB1308;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1308; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:CY1PR0301MB1308;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1308; X-Forefront-PRVS: 0528942FD8 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2015 21:07:41.7980 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1308 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MC objects discovered during an MC bus scan were being reordered to ensure that all allocatable objects are probed before all non-allocatable objects. However, this is not necessary, as drivers of non-allocatable objects, that allocate allocatable objects in their probe function, can return -EPROBE_DEFER if such allocations fail. Signed-off-by: J. German Rivera --- drivers/staging/fsl-mc/bus/dprc-driver.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 65de1d75..f02e5e4 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -205,36 +205,6 @@ static void dprc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev) dprc_cleanup_resource_pool(mc_bus_dev, pool_type); } -static void reorder_obj_desc_array(struct dprc_obj_desc *obj_desc_array, - int num_devs) -{ - struct dprc_obj_desc tmp; - struct dprc_obj_desc *top_cursor = &obj_desc_array[0]; - struct dprc_obj_desc *bottom_cursor = &obj_desc_array[num_devs - 1]; - - /* - * Reorder entries in obj_desc_array so that all allocatable devices - * are placed before all non-allocatable devices: - * - * Loop Invariant: everything before top_cursor is allocatable and - * everything after bottom_cursor is non-allocatable. - */ - while (top_cursor < bottom_cursor) { - if (FSL_MC_IS_ALLOCATABLE(top_cursor->type)) { - top_cursor++; - } else { - if (FSL_MC_IS_ALLOCATABLE(bottom_cursor->type)) { - tmp = *bottom_cursor; - *bottom_cursor = *top_cursor; - *top_cursor = tmp; - top_cursor++; - } - - bottom_cursor--; - } - } -} - /** * dprc_scan_objects - Discover objects in a DPRC * @@ -313,8 +283,6 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev) "%d out of %d devices could not be retrieved\n", dprc_get_obj_failures, num_child_objects); } - - reorder_obj_desc_array(child_obj_desc_array, num_child_objects); } dprc_remove_devices(mc_bus_dev, child_obj_desc_array, -- 2.3.3