From patchwork Tue Sep 28 08:03:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1533763 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm3 header.b=hR5m5FUx; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=WeyNm4py; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-rtc-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4HJX8v38R2z9t2b for ; Tue, 28 Sep 2021 18:04:31 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239548AbhI1IGG (ORCPT ); Tue, 28 Sep 2021 04:06:06 -0400 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]:55223 "EHLO wnew3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239330AbhI1IFa (ORCPT ); Tue, 28 Sep 2021 04:05:30 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 9AF912B0161B; Tue, 28 Sep 2021 04:03:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 28 Sep 2021 04:03:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=dEiHNKK1pcUTp srgmvewxSpAPrBEKgL3rrGk/Y3A02Y=; b=hR5m5FUxINrVN0qjHK//RVSl9tDCw Nlfq+Uk1Nt2MzA9H4e6PjUUb8MlLUxCaN3zFwXXzlLeijGpYpLcmm+gnLQUr7Xpe QVZDIQozjnzcWBAhkgJTOmYhIsu2Vg7QPOdxJxLhNR5fjofXWDrLvdLMjs7hUmf+ gYPR1lkxM9WxLFBMR5hR7iuq9rHY5/zxH48lw99PnWaK01s7M7aktkmn3NUbcgQc d9+7FXHEJu0S9wq5ZVQWibu4fwOBS/n/59ylroqzBtM+HEAy9UO1ygpvTvfku/YD cFpbIMQrZ/IAiOgo3MunwECXzJjhgDlWVWGa5FpKl15kgbgADlNSJ0FYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=dEiHNKK1pcUTpsrgmvewxSpAPrBEKgL3rrGk/Y3A02Y=; b=WeyNm4py Wxk3VKq7tJQS3B0EGithFqISMoAGwOI+cwfvU0aNAexEDagdcOQoLM9rDnbVQpRj 2cw7gLflNrkpU19oSy/6ITTJHGPJBUtFqNfxj3KT0C31yucbqIFYID7Td6vKANTk jPDdpuE3ELR89SUeVakKSECY7Ibj5iOXoCdoAgmOb0TF95TNatBAcvILDDog7QOo gxRu9iWdXNr0v74dCuiiwsTyol+YV4qmIrQWADcgC3MDstDLWQesNRZtZeYGi0xL if4LCHb79atNdvyP2bZETjvu7jlmabNHb4Ns39JnKz/BEcv6s6bbJSW2MFGlzRv0 2xqJu00o+rzNMw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudejledguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudfhjeefvdfhgfefheetgffhieeigfefhefgvddvveefgeejheej vdfgjeehueeinecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Sep 2021 04:03:49 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Rob Herring Cc: Michael Turquette , Stephen Boyd , Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-rtc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH v2 6/9] rtc: sun6i: Allow probing without an early clock provider Date: Tue, 28 Sep 2021 03:03:32 -0500 Message-Id: <20210928080335.36706-7-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210928080335.36706-1-samuel@sholland.org> References: <20210928080335.36706-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org Some SoCs have an RTC supported by this RTC driver, but do not have an early clock provider declared here. Currently, this prevents the RTC driver from probing, because it expects a global struct to already be allocated. Fix probing the driver by copying the missing pieces from the clock provider setup function, replacing them with the devm variants. Signed-off-by: Samuel Holland --- Changes since v1: - New patch. (This patch is independent of the rest of the series.) drivers/rtc/rtc-sun6i.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index adec1b14a8de..711832c758ae 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -673,8 +673,17 @@ static int sun6i_rtc_probe(struct platform_device *pdev) struct sun6i_rtc_dev *chip = sun6i_rtc; int ret; - if (!chip) - return -ENODEV; + if (!chip) { + chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + spin_lock_init(&chip->lock); + + chip->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(chip->base)) + return PTR_ERR(chip->base); + } platform_set_drvdata(pdev, chip);