Received: by 10.192.165.148 with SMTP id m20csp4921137imm; Tue, 24 Apr 2018 10:33:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+d1HPVMwTlaHF6fr9fViujJZazsMZ/D6zoNow4HhEDvDNI+BWLGHIjNWqPDkFo71TL48NO X-Received: by 10.101.100.75 with SMTP id s11mr20819584pgv.360.1524591188428; Tue, 24 Apr 2018 10:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524591188; cv=none; d=google.com; s=arc-20160816; b=Y4njKcQTFU+YLHH57SSLI4QnWL9W2clov9Uq8UN9gBo29PZo6QCe77nKtLXycrxfk3 y4RmExzJA0FU0VExXDcSFtbq/Ts7MaWG5uwwnK4rwzKw6lUWMes1xRBBCt58m2sTGtLn vtt9+IHLMdA+rmzv700GIHGZbkAF9EMbjJGfVD9LdOmKgJeYNYXlE9fIlScDho0jwR/S 3KiF0IPXA/iNJRCgI5CWA57BvQvycbw6YEkFuU7mIbIoAkkmaEcWKWFlKrtDu3kYSlj6 qUKivKev2FHL5eQBVmQT+zgmfXUAbJV9QHKx/3aRo61uZTl94DhtDSBKvAbyHqT7MRiq RiNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=rOhxYnOz8qoV04RE1s5FyrBNURNK0WGZd6JfAutNZLU=; b=wLRz5CY01cuAwEZ4HDjtmltjKYIQSvpNLIeSS+4suPwIvhPV1wRnuMzStWEjKYbCTk iNlXykPgAnA0wm+v4kY5pvhjpjuRWZsMLmYjs4O9H4BhsMbwGs/PlA0gWtosTX1TX6OF GJFIcOeG0GL1anbGJAsFzh6QLS0ovhn0h8ulVzE5zOBoY+1WqLyItt7aQlZ7vNKXbCmW R9q3t+bWKDGgBdxTmhB59fhLCwAc0vmj3WVdvbZkG9U/by52QNRTSEWmiNSdxRQbroQN AiflYRWlRkDfi288JFuJV3tmEiVYf2GGVzU43HIgCWoa6hqWymFDhObvcu9RPjxeniPA ELvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=DkWmcWHq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t132si1819768pgb.142.2018.04.24.10.32.54; Tue, 24 Apr 2018 10:33:08 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=DkWmcWHq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752826AbeDXRbZ (ORCPT + 99 others); Tue, 24 Apr 2018 13:31:25 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37984 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752350AbeDXRbS (ORCPT ); Tue, 24 Apr 2018 13:31:18 -0400 Received: by mail-wm0-f65.google.com with SMTP id i3so2188564wmf.3 for ; Tue, 24 Apr 2018 10:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rOhxYnOz8qoV04RE1s5FyrBNURNK0WGZd6JfAutNZLU=; b=DkWmcWHqFn/ycKWeZe4Ho/zmXAb/cj7+MIpgSYoiIyThsuvJvsro7YEoI/lw0J7jrp DdJM98dNCbnFLUy+lt1IOo2EEgBncPdR1rD9cYrWeR7mCon35ukN3B2vCmr+z5JPv4fc 53CNh50C6QYmnhvpkaiCUkK+xS4+hgQnsXI79pkvwOel4sqe0gSnQ8Lq8RezbnOLN0Oi 5DdIwPGg2Y1K1P6jzmZS1f1LDDczwZBu2X/EGh4rt6JiyzuqYOrGJmhkgUM+C4QPk1ak v9FFsYLbZIu658KV7MGwmnNhIAXseIUiEOlIK+eJ6NWQ1y9Icy1fuUIEGQnDMSr9ZF0s TD5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rOhxYnOz8qoV04RE1s5FyrBNURNK0WGZd6JfAutNZLU=; b=sWut7/UlLekmSuOucZjaYbK4wtl4ci2zWqBAqiXRvFF2ogAKnKoOoXgQYiq7OpDdt/ yFTsd+D9gjE5pTpHqPTbtfQgND9A8ho3ai/aEy2sEyonzUyey5YgyUgVmpSV60cqcaIP avzNmR0Pwx1SfFTWgKGVhLziPmqFMNQjxAmzio9n/0tnWppVSjq5LBJX1r7E/aBGUWv8 vscq+hMpUgFNI4LTvDMLj6NirmY80oWvIeL9VqAEZ1roCwCuOyJuAEJvq9gSDc2iPI3/ jN/D4oYTV6WKYBcFQ9aWLRwoRPSOPUgHQB2XyHG9GtU998HZ76A0pO3VPclVuT/Hfqhk MwCg== X-Gm-Message-State: ALQs6tBmgsb0Tc3wf3RiSW8zFEljLya0MOgHWh2KpX2660YOY4+rVcdd mzpckBcl06yHuNedF+nY0vpdKg== X-Received: by 10.28.110.30 with SMTP id j30mr177807wmc.62.1524591076753; Tue, 24 Apr 2018 10:31:16 -0700 (PDT) Received: from brgl-bgdev.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id n21sm15513826wmi.37.2018.04.24.10.31.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 10:31:15 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , David Lechner , Michael Turquette , Stephen Boyd , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Mark Rutland , Yoshinori Sato , Rich Felker , Frank Rowand , "Rafael J . Wysocki" , Jarkko Sakkinen , Dmitry Torokhov , Arend van Spriel , Heikki Krogerus , Michal Suchanek , Jan Kiszka , Andy Shevchenko Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 04/11] of: platform: use pdev as name for vars of type struct platform_device Date: Tue, 24 Apr 2018 19:30:44 +0200 Message-Id: <20180424173051.15099-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180424173051.15099-1-brgl@bgdev.pl> References: <20180424173051.15099-1-brgl@bgdev.pl> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski It's a good convention to name struct device local variables 'dev' and reserve 'pdev' for struct platform_device. Otherwise the code sometimes becomes confusing to read. Rename all such instances in of/platform.c Signed-off-by: Bartosz Golaszewski --- drivers/of/platform.c | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index c00d81dfac0b..60342209fbd8 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -109,12 +109,12 @@ struct platform_device *of_device_alloc(struct device_node *np, const char *bus_id, struct device *parent) { - struct platform_device *dev; + struct platform_device *pdev; int rc, i, num_reg = 0, num_irq; struct resource *res, temp_res; - dev = platform_device_alloc("", PLATFORM_DEVID_NONE); - if (!dev) + pdev = platform_device_alloc("", PLATFORM_DEVID_NONE); + if (!pdev) return NULL; /* count the io and irq resources */ @@ -126,12 +126,12 @@ struct platform_device *of_device_alloc(struct device_node *np, if (num_irq || num_reg) { res = kzalloc(sizeof(*res) * (num_irq + num_reg), GFP_KERNEL); if (!res) { - platform_device_put(dev); + platform_device_put(pdev); return NULL; } - dev->num_resources = num_reg + num_irq; - dev->resource = res; + pdev->num_resources = num_reg + num_irq; + pdev->resource = res; for (i = 0; i < num_reg; i++, res++) { rc = of_address_to_resource(np, i, res); WARN_ON(rc); @@ -141,16 +141,16 @@ struct platform_device *of_device_alloc(struct device_node *np, np->name); } - dev->dev.of_node = of_node_get(np); - dev->dev.fwnode = &np->fwnode; - dev->dev.parent = parent ? : &platform_bus; + pdev->dev.of_node = of_node_get(np); + pdev->dev.fwnode = &np->fwnode; + pdev->dev.parent = parent ? : &platform_bus; if (bus_id) - dev_set_name(&dev->dev, "%s", bus_id); + dev_set_name(&pdev->dev, "%s", bus_id); else - of_device_make_bus_id(&dev->dev); + of_device_make_bus_id(&pdev->dev); - return dev; + return pdev; } EXPORT_SYMBOL(of_device_alloc); @@ -170,26 +170,26 @@ static struct platform_device *of_platform_device_create_pdata( void *platform_data, struct device *parent) { - struct platform_device *dev; + struct platform_device *pdev; if (!of_device_is_available(np) || of_node_test_and_set_flag(np, OF_POPULATED)) return NULL; - dev = of_device_alloc(np, bus_id, parent); - if (!dev) + pdev = of_device_alloc(np, bus_id, parent); + if (!pdev) goto err_clear_flag; - dev->dev.bus = &platform_bus_type; - dev->dev.platform_data = platform_data; - of_msi_configure(&dev->dev, dev->dev.of_node); + pdev->dev.bus = &platform_bus_type; + pdev->dev.platform_data = platform_data; + of_msi_configure(&pdev->dev, pdev->dev.of_node); - if (of_device_add(dev) != 0) { - platform_device_put(dev); + if (of_device_add(pdev) != 0) { + platform_device_put(pdev); goto err_clear_flag; } - return dev; + return pdev; err_clear_flag: of_node_clear_flag(np, OF_POPULATED); @@ -344,7 +344,7 @@ static int of_platform_bus_create(struct device_node *bus, { const struct of_dev_auxdata *auxdata; struct device_node *child; - struct platform_device *dev; + struct platform_device *pdev; const char *bus_id = NULL; void *platform_data = NULL; int rc = 0; @@ -377,13 +377,13 @@ static int of_platform_bus_create(struct device_node *bus, return 0; } - dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent); - if (!dev || !of_match_node(matches, bus)) + pdev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent); + if (!pdev || !of_match_node(matches, bus)) return 0; for_each_child_of_node(bus, child) { pr_debug(" create child: %pOF\n", child); - rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict); + rc = of_platform_bus_create(child, matches, lookup, &pdev->dev, strict); if (rc) { of_node_put(child); break; -- 2.17.0