Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4674590pxb; Tue, 28 Sep 2021 01:07:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+zIE+2VhWBWlc6qh6l+JpkSuqJ9g0a3Om5hxx4eQMSTeBTGwCeimwGWY8GezOX9rGExHX X-Received: by 2002:a17:907:d87:: with SMTP id go7mr5141151ejc.46.1632816463751; Tue, 28 Sep 2021 01:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632816463; cv=none; d=google.com; s=arc-20160816; b=ba4aZfrfXq6nXCkkyPBGWBuI7oUNwKQ/fHx/rQKwYXw1pD/hNtz94ibGlguK9qdc67 qcMp8LSYgUVENuxXNudpZHutwYK0aNObngmaeCJXvtgd7rk/udeBs+1/h4cBq9J5M/YZ 1ZeEczDhtxtzz5pVntLlJmIEFwd8VHEFPPCZQqeU7Tc9KHLHrZyduk+joD2CtNi0gJfC bWv6u0GEHZU3mPEfpqIPOD+p+onVVfqiJgyvtQoLmxOUovwabenZTUDuBTt/h6WiCbpp xDBLewR1gw+bzNhH3NOeFJPNrmoeIcPX94J8mxgfXJcq6OhRQLO0l9jsAMB8ptpnj7Ps nPYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=dEiHNKK1pcUTpsrgmvewxSpAPrBEKgL3rrGk/Y3A02Y=; b=j651TL+LjOR9BVnBYzEy3+nW4F3GJ8GFGIAXS8zdzXY13MyA2X2fgBsNzj8IAGIQj7 YYKBq7LPjbfvs+XNG5qMkDrTulchYNA0fico/I0aYMiHjtJ5QOlcOsV1mQzemsqKreok cJTYrO3NuWVtfkTyxhj1AzWMhs20WNMgtNp9MvTmR91oWu2GuFYhVM+HLv1oiAoPiA6n G+cfplq6RqWFA0QRe/Nf/Pzq2CA9AcIr2MReAAHbiDM2qlnu3x5WCfbwYn1D6vpW6+zP de03p0mz0I3dqEPsVTyzPlCFwaKbLJ0vuWBulrI8zr9BGRsT+jlFfbcMzY/hUsMPSiu+ m2+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=hR5m5FUx; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=WeyNm4py; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j30si7438071ejo.706.2021.09.28.01.07.12; Tue, 28 Sep 2021 01:07:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=hR5m5FUx; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=WeyNm4py; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239615AbhI1IGR (ORCPT + 99 others); Tue, 28 Sep 2021 04:06:17 -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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); -- 2.31.1