From patchwork Sat Mar 12 22:32:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 525 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:43:21 -0000 Delivered-To: patches@linaro.org Received: by 10.224.45.75 with SMTP id d11cs13463qaf; Sat, 12 Mar 2011 14:32:24 -0800 (PST) Received: by 10.227.140.77 with SMTP id h13mr9676957wbu.217.1299969144005; Sat, 12 Mar 2011 14:32:24 -0800 (PST) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id 39si6864146wet.99.2011.03.12.14.32.22 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 Mar 2011 14:32:23 -0800 (PST) Received-SPF: pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.178 as permitted sender) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.178 as permitted sender) smtp.mail=andy.warmcat.com@googlemail.com; dkim=pass (test mode) header.i=@googlemail.com Received: by mail-wy0-f178.google.com with SMTP id 26so4056169wyj.37 for ; Sat, 12 Mar 2011 14:32:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:sender:from:subject:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding; bh=YY30FBR/hwl4XnYdeKrEqO7IJ9m0ccWLOL311hXu3r4=; b=bAjKrHBC5sjQ7Z1FZGVslt2FYKgloKqV0txG59DOwXjTDms8zJJ9VXAXea2SixYtfw m0VcUDZNOeZNzqcRGTHxy1/0nMLkzLllUZ1166J3wRFaMo4TJ4B8KQgv8oxaNHVQolsi S5KQJPmvziBd2rjOdTWzERwLg1ZEiPee6KFjY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=sender:from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=Im48EylmaCHkjpoj+qTEFtP4q9ctniFCDOxYgauWyb/oCsdI6VfogdqR8O0xXjuCGa fbRMNC0VNf9adq5x62SWS0CAJaAYb+T32VDbMm9sfJhw0b9X0stPlOmWQ+l6jXwjQ9hm WcO7UZ+ns2yr9Rz2bXfCZbcv73LKANfnfiOb0= Received: by 10.227.196.67 with SMTP id ef3mr9679954wbb.185.1299969142206; Sat, 12 Mar 2011 14:32:22 -0800 (PST) Received: from otae.warmcat.com (s15404224.onlinehome-server.info [87.106.134.80]) by mx.google.com with ESMTPS id x1sm4682571wbh.14.2011.03.12.14.32.20 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 Mar 2011 14:32:21 -0800 (PST) Sender: Andy Green From: Andy Green Subject: [RFC PATCH 2/4] PLATFORM: Introduce registration function for async platform data maps To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: patches@linaro.org, Andy Green Date: Sat, 12 Mar 2011 22:32:19 +0000 Message-ID: <20110312223219.27020.60965.stgit@otae.warmcat.com> In-Reply-To: <20110312222633.27020.19543.stgit@otae.warmcat.com> References: <20110312222633.27020.19543.stgit@otae.warmcat.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 This adds a small platform API that lets a board definition file register a mapping structure for asynchronously probed devices so platform_data can be attached to them at probe time. Signed-off-by: Andy Green --- drivers/base/platform.c | 21 +++++++++++++++++++++ include/linux/platform_device.h | 3 +++ 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index f051cff..180e372 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -31,6 +31,12 @@ struct device platform_bus = { }; EXPORT_SYMBOL_GPL(platform_bus); +struct platform_async_platform_data *platform_async_platform_data_map; +EXPORT_SYMBOL_GPL(platform_async_platform_data_map); + +int platform_async_platform_data_count; +EXPORT_SYMBOL_GPL(platform_async_platform_data_count); + /** * platform_get_resource - get a resource for a device * @dev: platform device @@ -1332,3 +1338,18 @@ void __init early_platform_cleanup(void) } } +/** + * platform_async_platform_data_register - register an array of async- + * probed bus / device names mapping to + * plaform_data for that device. + * @map: the array of devname vs platform_data mapping structs + * @count: the count of structs in the @map array + */ + +void platform_async_platform_data_register( + struct platform_async_platform_data *map, int count) +{ + platform_async_platform_data_map = map; + platform_async_platform_data_count = count; +} +EXPORT_SYMBOL_GPL(platform_async_platform_data_register); diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index d8c0ba9..19ea497 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -210,4 +210,7 @@ struct platform_async_platform_data { void *platform_data; }; +extern void platform_async_platform_data_register( + struct platform_async_platform_data *map, int count); + #endif /* _PLATFORM_DEVICE_H_ */