From patchwork Fri Jun 28 18:08:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CAF53C2BD09 for ; Fri, 28 Jun 2024 18:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wmoY9MC+b9hOZcGZXOQJ0Uh4Gl8qIWXCfwHUYEIgVNk=; b=s5jK3xnE65jfGeE0hvHqVSBmog Z93KTmHrtFV25bpJmv3rwlWZYT5MP4lrZenRvBz3Vjsa9dnlD5LsfKYY+zygKYzh7NM+6GB1OetDw S4N8ufSNsqhn70tKNtkr5UiH7tgvK6aR2GYWT9C/jA0tZQNmdiw/sModEywvWxEd5DawCovPAJQvt l27ETJlvZmy6M+zSSiqsoEmGsNkfFOYu57DXAHz1XopuAM/deMWwEGW8k2QV6vRDHMpHhAMrQvigB ofeVHxReiCT2kzNwBUfQCNQptcy6mCR78g/TRsISzK5d2A4ekN5ZsuyPVRL9/7QvfceQzaMiC6yva FB7Wyudg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2W-0000000EaUF-1fte; Fri, 28 Jun 2024 18:09:40 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG1z-0000000EaEF-1a5M for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:08 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-7065e2fe7d9so721872b3a.3 for ; Fri, 28 Jun 2024 11:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598146; x=1720202946; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wmoY9MC+b9hOZcGZXOQJ0Uh4Gl8qIWXCfwHUYEIgVNk=; b=Z+ma6tmUlyfhnn3CcxWzbQgdgnviguf6cM1RLb7DsDRbCVFdrpfdd5qLMKWQyvRvo8 rrWMaIb47tqfxI8zXlBjatugtQteZff0zwlG/tqzf/ZsPc600mhvBH8U6k60CwG7ZtmM R9ef89p94yqAvfd7ot0VOOFMLyhcqnLCpS/aE60vYIDXbM/AnVMYSuKY4QdItJCfE8mD XoqMbs6I8xY5D0PekxhS5v1IdaAT2LAMH2XZlyrfNwnD5/nnCUFhW1ge/AbhsFRIoM6L Wah4PigHASDM5QNmkJ3e5f7qobfUAY82CWsOH+HRHFYk8f+fOtYjUb0KolvPUdBY35B0 J8Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598146; x=1720202946; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wmoY9MC+b9hOZcGZXOQJ0Uh4Gl8qIWXCfwHUYEIgVNk=; b=sDVdngYqRKsE12Nk4tIqF1zburju9KZzN/kOnp4oUeDmy3gt6f9kc65ZNwt9d74xHd hA8dEyNrSTqvA4iHijQe2NXTinMgOGjXwX8d1aB1fBEC2d9P2gTTHkkBoskrA/pwVXoH TjcYxDJE65ClKRxYj5UTeQvD/BuhCLbKRchkh16AQp2Rfkl4ZbMqVsTEToAoos1IuiIt WzDDggn2ZHMzYqG/dzG+vsSanWre7Tr6VKzhDWYkP4WW00A6+kjazdn1xcJ1iFYFQb4L fHr3obmu4ov0q4UMakSgbUc8ifGnlswwwgfFT9pL0qmVYQLMKdyjq2yt/iYicpfV8HzX HNHQ== X-Gm-Message-State: AOJu0Yz/Y8sITWdNJye5lQwzIHXu+IciVwDXngiQG5xeHcAtKfzfNAWT WPQb5FHlQx4zDYzo39FgeG8qtj0qwmOCtNto/EmwOnPGyciNxs2oJu47kA== X-Google-Smtp-Source: AGHT+IFym5PAI16Os9Hfp7AYeddl0ojmEh3aJykbFJxWnw9ufaFP8zsIAOZN9UfNjvXStDqZSy006Q== X-Received: by 2002:a05:6a00:b91:b0:705:b81b:6ee2 with SMTP id d2e1a72fcca58-706745e809bmr23126817b3a.19.1719598146472; Fri, 28 Jun 2024 11:09:06 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:c929:2998:720d:a104]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7080295d1f4sm1982911b3a.91.2024.06.28.11.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:06 -0700 (PDT) From: Dmitry Torokhov To: Haojian Zhuang , Daniel Mack , Robert Jarzmik , Arnd Bergmann , Linus Walleij , soc@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/10] ARM: spitz: Simplify instantiating SPI controller Date: Fri, 28 Jun 2024 11:08:44 -0700 Message-ID: <20240628180852.1738922-5-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog In-Reply-To: <20240628180852.1738922-1-dmitry.torokhov@gmail.com> References: <20240628180852.1738922-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_110907_433950_668B460A X-CRM114-Status: GOOD ( 16.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org platform_device_register_full() to instantiate SPI controller in one go instead of allocating it, creating a software node, and registering the platform device as separate steps. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/spitz.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 10ab16dcd827..b14eb2a54f80 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -580,14 +580,16 @@ static const struct property_entry spitz_spi_properties[] = { { } }; -static const struct software_node spitz_spi_node = { +static const struct platform_device_info spitz_spi_device_info = { + .name = "pxa2xx-spi", + /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */ + .id = 2, .properties = spitz_spi_properties, }; static void __init spitz_spi_init(void) { struct platform_device *pd; - int id = 2; int err; if (machine_is_akita()) @@ -598,19 +600,11 @@ static void __init spitz_spi_init(void) gpiod_add_lookup_table(&spitz_ads7846_gpio_table); gpiod_add_lookup_table(&spitz_spi_gpio_table); - /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */ - pd = platform_device_alloc("pxa2xx-spi", id); - if (pd == NULL) { - pr_err("pxa2xx-spi: failed to allocate device id %d\n", id); - } else { - err = device_add_software_node(&pd->dev, &spitz_spi_node); - if (err) { - platform_device_put(pd); - pr_err("pxa2xx-spi: failed to add software node\n"); - } else { - platform_device_add(pd); - } - } + pd = platform_device_register_full(&spitz_spi_device_info); + err = PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("pxa2xx-spi: failed to instantiate SPI controller: %d\n", + err); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); }