Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1433425imm; Sun, 27 May 2018 06:56:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoBDn2AfpHJMKLzU3wYZIrgeaMlv5/+cJdX09rhg1SvNPPWPSRltxF/BUm9LHQKo2JTErg2 X-Received: by 2002:a17:902:bb8d:: with SMTP id m13-v6mr6739927pls.46.1527429377725; Sun, 27 May 2018 06:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527429377; cv=none; d=google.com; s=arc-20160816; b=JQNPq76D00OPzw8tdTvBq3QzH3lAyH2sQgwrNAjsCkQojR7PSzqHM2QOkrczzaIyk0 Fm8RgM55mVKMVNKQDx/fMCe9h5dlgpNy3O1IRmB023QVvDpE0wGTqqNpMRKrpcmqTw6o A+kiDPf+SGBcodIlLpgmA2AwPp42Acrz8zG7q/uKbiAnZ50OamIOGSTyHp9ZePo1PfSv N8NNv4X5XJBgXSgdPCb849XUCJhlK+qoKZdJjNPWlaqDA+68wipyCpkWgKd0E+xhNODU padDMlJwv8OTvOwWl6bDtbGwDx6DNGVwB54CwwFnG3NuHdHCL/Y1jStEd6OI3bjLUmzF vSvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=2CHSHjj+z5Fm/a8Z0Di8aQ+UP23lseK52xtCCh+ImVM=; b=S6a5PjNawCgI88rib888EzBhoviIvxNxwTP5qXM76rv+dreRecm5n8CmctsNdfG95k aTJSZQlOj7yOfNdwRtGHR4I5AKEQRLBBr63pQmv3HmRAH3tcUQ+u6fa9qW1Jf0dvDxV4 m/dxMq+J2YlvMNU2a/4Ph/BkYGU+q42b3Gqs5BniCCnGJQqVUsDAOxLENYpYOyDBfSzL rDGwRUx1AuoPICGgHQKDGNQnjabYQnK7VO49U+3pcsrE/w5FUShGVum6WV55GStLq/GM fLIWJik8r/y9j/93Ea6lWoOBZHSyAqRkGwFS84G65qQrmvwQTsZgRcBh3iIFaFqyLOg8 xRjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZCyuj4M4; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15-v6si27278588plr.365.2018.05.27.06.56.03; Sun, 27 May 2018 06:56:17 -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=@gmail.com header.s=20161025 header.b=ZCyuj4M4; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967730AbeE0Nzv (ORCPT + 99 others); Sun, 27 May 2018 09:55:51 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:39924 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965358AbeE0Nzt (ORCPT ); Sun, 27 May 2018 09:55:49 -0400 Received: by mail-wr0-f194.google.com with SMTP id w7-v6so4283880wrn.6; Sun, 27 May 2018 06:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2CHSHjj+z5Fm/a8Z0Di8aQ+UP23lseK52xtCCh+ImVM=; b=ZCyuj4M4L6mZq8ef7HVSg/Gq2vrEktUbYCBlnssoasjHEywL4K9UTFtdUXleRQU40q UabsDuL6FbKPGRuNy1VYN/HrbFeEC9u+Ao60vjkrc0g1JjMRzr0Fud2aDkuznFsnDPiL RLUH6n/U/Q+S5R9AvA7wM1FtfUfiUDQmSSsT60t184ldCLmlBxB0183noiiJdiWE9RF9 ATVYTW5gvJw3ekgb3H4I0UClWlp98k0Uktc971q93JXIkZ9dDtGe//ISiWpvjUYoNE2D HffzvzEx8QZbmKrQdvwItXxMc/kB4ijheHlORWblPs7Wht74/20FbdzDLdNnPeAjusIr gBiA== 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; bh=2CHSHjj+z5Fm/a8Z0Di8aQ+UP23lseK52xtCCh+ImVM=; b=Nps4Wqy6oScvaVtPcEWgXAgp5q6N+T8/6yZTju8lNAMvT3dEKdn0QVPfSa2tXe8PkO bPcKjykDh5MIVGWuZEiTrHM8krNqdzXGxLKuYy7adhqDaYwkonozaSutl9pGXF1q9FWH 4nIZtQ2Msh36aQPAEf7RZlV6lCom4QasMVVjCFEqslLTUNQ0RitAKN8VqFlCLFfLNHkd CsZtEUnbIsxjKM3EPgrqfTYC185Vxz1ZG2ITHObSJgPRo2uj4VYF7fePhPYPkEMVvPfV Mwv2SHqbGs3yQLlhulsKaJxjlgTtX+Df4d00Ti4yqyOLGyAidO2fU9iWpq4DLgVKYx2s yLjA== X-Gm-Message-State: ALKqPwcXKOwSocDM9lNvH4t45g6AoIHqZ07LlcgVHgKF6/jILQR1KEI4 5SZShy3m2M8go8Xlg0NmZp8FntRy1B0= X-Received: by 2002:a19:db0c:: with SMTP id s12-v6mr5375537lfg.109.1527429348537; Sun, 27 May 2018 06:55:48 -0700 (PDT) Received: from localhost.localdomain (apn-31-0-67-177.dynamic.gprs.plus.pl. [31.0.67.177]) by smtp.gmail.com with ESMTPSA id n63-v6sm1411502lfb.46.2018.05.27.06.55.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 May 2018 06:55:47 -0700 (PDT) From: Janusz Krzysztofik To: Tony Lindgren Cc: Aaro Koskinen , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: [PATCH 1/2] ARM: OMAP1: ams-delta: refactor late_init() Date: Sun, 27 May 2018 15:55:47 +0200 Message-Id: <20180527135548.7904-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before the board level GPIO handling is converted from GPIO numbers to GPIO descriptors, split late_init() into functional blocks and move them to separate functions. While being at it, drop machine type check from late_init() - the function is now called from the board init_late callback so there is no need for yet another applicability check. Signed-off-by: Janusz Krzysztofik --- arch/arm/mach-omap1/board-ams-delta.c | 55 +++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 80f54cb54276..cdba8decc532 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -643,19 +643,19 @@ static struct platform_device ams_delta_modem_device = { }, }; -static int __init late_init(void) +static int __init ams_delta_gpio_init(void) { int err; - if (!machine_is_ams_delta()) - return -ENODEV; - err = gpio_request_array(latch_gpios, ARRAY_SIZE(latch_gpios)); - if (err) { + if (err) pr_err("Couldn't take over latch1/latch2 GPIO pins\n"); - return err; - } + return err; +} + +static void __init ams_delta_late_devices(void) +{ platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); /* @@ -666,12 +666,23 @@ static int __init late_init(void) ams_delta_nand_gpio_table.dev_id = dev_name(&ams_delta_nand_device.dev); gpiod_add_lookup_tables(late_gpio_tables, ARRAY_SIZE(late_gpio_tables)); +} + +static int __init modem_nreset_init(void) +{ + int err; err = platform_device_register(&modem_nreset_device); - if (err) { + if (err) pr_err("Couldn't register the modem regulator device\n"); - return err; - } + + return err; +} + + +static int __init ams_delta_modem_init(void) +{ + int err; omap_cfg_reg(M14_1510_GPIO2); ams_delta_modem_ports[0].irq = @@ -692,7 +703,28 @@ static int __init late_init(void) err = platform_device_register(&ams_delta_modem_device); if (err) - goto gpio_free; + gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); + + return err; +} + +static int __init late_init(void) +{ + int err; + + err = ams_delta_gpio_init(); + if (err) + return err; + + ams_delta_late_devices(); + + err = modem_nreset_init(); + if (err) + return err; + + err = ams_delta_modem_init(); + if (err) + return err; /* * Once the modem device is registered, the modem_nreset @@ -708,7 +740,6 @@ static int __init late_init(void) unregister: platform_device_unregister(&ams_delta_modem_device); -gpio_free: gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); return err; } -- 2.16.1