From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [PATCH 3/4 v2] omap: hwspinlock: Created driver for OMAP hardware spinlock. Date: Mon, 20 Sep 2010 12:13:52 -0700 Message-ID: <20100920191351.GH4611@atomide.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:50642 "EHLO mho-02-ewr.mailhop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835Ab0ITTNw (ORCPT ); Mon, 20 Sep 2010 15:13:52 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: "Que, Simon" Cc: Linux Omap , "Cousson, Benoit" , "Shilimkar, Santosh" , "Premi, Sanjeev" , "Kanigeri, Hari" * Que, Simon [100811 17:22]: > Created driver for OMAP hardware spinlock. > > - Reserved spinlocks for internal use > - Dynamic allocation of unreserved locks > - Lock, unlock, and trylock functions, with or without disabling irqs/preempt > - Registered as a platform device driver > --- /dev/null > +++ b/arch/arm/mach-omap2/hwspinlocks.c > @@ -0,0 +1,65 @@ > +int __init hwspinlocks_init(void) > +{ > + int retval = 0; > + > + struct omap_hwmod *oh; > + const char *oh_name, *pdev_name; > + > + oh_name = "spinlock"; > + oh = omap_hwmod_lookup(oh_name); > + if (WARN_ON(oh == NULL)) > + return -EINVAL; > + > + pdev_name = "hwspinlock"; > + > + /* Pass data to device initialization */ > + omap_device_build(pdev_name, 0, oh, NULL, 0, omap_spinlock_latency, > + ARRAY_SIZE(omap_spinlock_latency), false); > + > + return retval; > +} > +postcore_initcall(hwspinlocks_init); Is this initcall safe to run on all omaps or do you need some extra checks for it? > --- /dev/null > +++ b/arch/arm/plat-omap/hwspinlock.c > @@ -0,0 +1,353 @@ > +EXPORT_SYMBOL(hwspinlock_lock); > +EXPORT_SYMBOL(hwspinlock_trylock); > +EXPORT_SYMBOL(hwspinlock_unlock); > +EXPORT_SYMBOL(hwspinlock_request); > +EXPORT_SYMBOL(hwspinlock_request_specific); > +EXPORT_SYMBOL(hwspinlock_free); Do we really want to export these functions? I think we're better off implementing low-level functions in the platform init code that are passed to the drivers in the platform_data. This way the drivers stay generic, and we don't add yet another non-standard layer that will get misused all over the drivers. If you really want to export these functions to the drivers, then all this code should live somewherew under drivers as well. > +static int __init hwspinlock_init(void) > +{ > + int retval = 0; > + > + /* Register spinlock driver */ > + retval = platform_driver_register(&hwspinlock_driver); > + > + return retval; > +} > +postcore_initcall(hwspinlock_init); Is this initcall safe to run on all omaps? Tony