Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756873Ab3HLQf4 (ORCPT ); Mon, 12 Aug 2013 12:35:56 -0400 Received: from smtp.codeaurora.org ([198.145.11.231]:58924 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753614Ab3HLQfy (ORCPT ); Mon, 12 Aug 2013 12:35:54 -0400 Message-ID: <52090EE9.7030602@codeaurora.org> Date: Mon, 12 Aug 2013 09:35:53 -0700 From: Stephen Boyd User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Kumar Gala CC: ohad@wizery.com, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Jeffrey Hugo , Eric Holmberg Subject: Re: [PATCH v2] hwspinlock/msm: Add support for Qualcomm MSM HW Mutex block References: <1375135257-17222-1-git-send-email-galak@codeaurora.org> In-Reply-To: <1375135257-17222-1-git-send-email-galak@codeaurora.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2554 Lines: 82 On 07/29/13 15:00, Kumar Gala wrote: > diff --git a/drivers/hwspinlock/msm_hwspinlock.c b/drivers/hwspinlock/msm_hwspinlock.c > new file mode 100644 > index 0000000..dbd9a69 > --- /dev/null > +++ b/drivers/hwspinlock/msm_hwspinlock.c > @@ -0,0 +1,150 @@ > +/* > + * Copyright (c) 2013, The Linux Foundation. All rights reserved. > + * > + * This software is licensed under the terms of the GNU General Public > + * License version 2, as published by the Free Software Foundation, and > + * may be copied, distributed, and modified under those terms. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "hwspinlock_internal.h" > + > +#define SPINLOCK_ID_APPS_PROC 1 Is this id only for the apps processor? What about hexagon? Does it need a different number? > +#define BASE_ID 0 > + > +static int msm_hwspinlock_trylock(struct hwspinlock *lock) > +{ > + void __iomem *lock_addr = lock->priv; > + > + writel_relaxed(SPINLOCK_ID_APPS_PROC, lock_addr); > + smp_mb(); > + return readl_relaxed(lock_addr) == SPINLOCK_ID_APPS_PROC; > +} > + > +static void msm_hwspinlock_unlock(struct hwspinlock *lock) > +{ > + int lock_owner; This should probably be u32 to be explicit about the size of the register. > + void __iomem *lock_addr = lock->priv; > + > + lock_owner = readl_relaxed(lock_addr); > + if (lock_owner != SPINLOCK_ID_APPS_PROC) { > + pr_err("%s: spinlock not owned by Apps (actual owner is %d)\n", Maybe you should just say "spinlock not owned by us (actual owner is %d)" so that this driver is agnostic to the processor it runs on? > + __func__, lock_owner); > + } > + > + writel_relaxed(0, lock_addr); > + smp_mb(); > +} > -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/