From patchwork Mon Aug 22 15:19:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit Cousson X-Patchwork-Id: 1085682 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7MFKLns023246 for ; Mon, 22 Aug 2011 15:20:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752718Ab1HVPUO (ORCPT ); Mon, 22 Aug 2011 11:20:14 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:37544 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751480Ab1HVPUN (ORCPT ); Mon, 22 Aug 2011 11:20:13 -0400 Received: from dlep36.itg.ti.com ([157.170.170.91]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p7MFKACc007557 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Aug 2011 10:20:10 -0500 Received: from dlep26.itg.ti.com (smtp-le.itg.ti.com [157.170.170.27]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id p7MFKAnc006121; Mon, 22 Aug 2011 10:20:10 -0500 (CDT) Received: from dlee73.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id p7MFKA0s026121; Mon, 22 Aug 2011 10:20:10 -0500 (CDT) Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE73.ent.ti.com (157.170.170.88) with Microsoft SMTP Server id 8.3.106.1; Mon, 22 Aug 2011 10:20:10 -0500 Received: from localhost.localdomain (lncpu04.tif.ti.com [137.167.102.15]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id p7MFJT1p002210; Mon, 22 Aug 2011 10:20:09 -0500 From: Benoit Cousson To: CC: , , , Nishanth Menon , Benoit Cousson Subject: [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions Date: Mon, 22 Aug 2011 17:19:02 +0200 Message-ID: <1314026347-21623-3-git-send-email-b-cousson@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1314026347-21623-1-git-send-email-b-cousson@ti.com> References: <1314026347-21623-1-git-send-email-b-cousson@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 22 Aug 2011 15:20:21 +0000 (UTC) From: Nishanth Menon Provide a quick set of access functions: a) Convert omap_device to platform_device - This is the flip of to_omap_device for equivalent usage b) Convert omap_device to device pointer - This is useful for most devices that need to go through standard linux functions that take device pointer. c) Convert hwmod to device pointer - This wrapper provides ability for drivers to convert directly from hwmod name back to device pointer without having to handle this on a driver by driver basis Signed-off-by: Nishanth Menon [b-cousson@ti.com: Adapt it to the new pdev pointer inside od] Signed-off-by: Benoit Cousson --- arch/arm/plat-omap/include/plat/omap_device.h | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h index bdc2804..903f329 100644 --- a/arch/arm/plat-omap/include/plat/omap_device.h +++ b/arch/arm/plat-omap/include/plat/omap_device.h @@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev) return pdev ? pdev->archdata.od : NULL; } +/* Convert omap_device to platform device pointer */ +#define omap_device_get_pdev(x) ((x)->pdev) +/* Convert omap_device to device pointer */ +#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev) + +/* Convert omap_hwmod name to device pointer */ +static inline struct device *omap_hwmod_name_get_dev(const char *oh_name) +{ + struct omap_device *od; + od = omap_hwmod_name_get_odev(oh_name); + if (IS_ERR_OR_NULL(od)) + return ERR_PTR(od ? PTR_ERR(od) : -ENODEV); + return omap_device_get_dev(od); +} + static inline void omap_device_disable_idle_on_suspend(struct platform_device *pdev) {