From patchwork Mon Feb 12 05:15:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 127922 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2878609ljc; Sun, 11 Feb 2018 21:16:44 -0800 (PST) X-Google-Smtp-Source: AH8x2270gtQNwtxfmKmxMNJsziId3uQqC6I52hirvpb2pp9iMtDtSaUinwE3gvefYVpz+c2ZcUXc X-Received: by 2002:a17:902:526d:: with SMTP id z100-v6mr9698753plh.396.1518412604590; Sun, 11 Feb 2018 21:16:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518412604; cv=none; d=google.com; s=arc-20160816; b=wKa3DgLZwqfpIdb5C2iNR0QPWarO7W1zBD6q272+YJRxcnvIREr5EpKpyArf4PWFdZ 3IL8/1SbqA6fbQ/gETYZYEvmSF0WKIaWup0y+08KoBROGBK3CoqvfCS6u5/tmo0XO/pX 5UtWT2Jm/bFmihip6UtLOi3iNLW/sheqmUL3nlxJTEf+nNSOc/ba/eMEZZ3vLc9IdndI X58zZzCbO12zbao77WcVSiqCSd6PIkUdHdvZjmO087GNfwY42978Hu7DKcS6eAS2ONps 3ILAu0XVxIpJ9fBV2jlfyVnXotMN8WzaMj2N5TQc8aTe1foOPKRrVq8mP85/e7Pec0ej PhUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=WeHkgg3H/JtN5Wm7yZmgOXs2vSIF2qixWKeOZ1QdahA=; b=HO/fRU3oLK7Rj8OmsnyzRUOTRCA4IuQTYJOoxeLt5wu2XauKpOr4S9UT0e0LUQ6VAp vY3jGOM5yHc+lcwtY6VN3hTF7FtZlqW0SZ0os2eCWjGrA5cM42rEBYRaZ9wN+bcid0Uj HARBHwo+xgxCCCLyQysr6136bZX0ioaDr8LRQf7F+s2ZgrFwJ1YPZAA2DCqq1L5W+80x bkb3Q+KP1ilKXk9PUQV8kJweh8UTAErRpYeLMSKmMCi90D1jg4gVYEnn9wL9clSXyt/k tX0RUaVtpEby3yhlq2tLz7pqGoOa1hqxipUuGARRzhb9AUGglr0Re+t3lhe4qwrN3LYy k/sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=N2xsOWQ0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q75si5779712pfq.220.2018.02.11.21.16.44; Sun, 11 Feb 2018 21:16:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=N2xsOWQ0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751633AbeBLFQi (ORCPT + 13 others); Mon, 12 Feb 2018 00:16:38 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:34760 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751263AbeBLFQc (ORCPT ); Mon, 12 Feb 2018 00:16:32 -0500 Received: by mail-pl0-f66.google.com with SMTP id q17so4551887pll.1; Sun, 11 Feb 2018 21:16:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=WeHkgg3H/JtN5Wm7yZmgOXs2vSIF2qixWKeOZ1QdahA=; b=N2xsOWQ0lklHQPBR1iyac4QtlCSxIVPXfPRhunY69TuVEF9ipADCpXL2RJgir+dygV 0jdlt6Dd2H6wKBr9Fq8uugKAwd+eDYL1wRx4wDTLFLpXwG5mIRznniv5MAsqnoNRi/BW 3Rsbvf2VMqvUAJT48wweUkoQ7XlsKSmYCDm8WVtHTTavw/dMtg5ALHCh03u+y712d9TI n/1msCONxVCxOxkhaiPpReM4dcBbqZ22CM+2vXy8aVdYNnkl2052AQQLRZ+asIAflVbd WES4hG1VUZXRIAmnffGzIiQ0vbmRaHsgRsn8fxMciSoSUsEnSXJoDLbJWb9sui4cBRiA tlrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=WeHkgg3H/JtN5Wm7yZmgOXs2vSIF2qixWKeOZ1QdahA=; b=EBA47GXL/O120mP6ZPgsODn4kK9McstZn4mwU8AmyWkFPHIvmupDC22awYgi3wqHRl iGhatbKh2W8bModxjcDjEHyOfLGvi8uyTvS9MM9fQSFIpJ8IIZJe0J1fwbkxUrg8QPbo G4clJTfKj5Fao3OQy+ghQxGTXX2YMnoARWVv0nlzxyZnpSUFNUy0P/VzsJ+qJ4UiWfbo ybxdjKpaG5jFk0sP1NMJEq31Ejkv/ZlZvoR02+W+2GLXKSo/v8HWxpl5EGoP9DiRVovn WZ4w3dRdwRg5pR1dokzKyAtRUkyshyut5GLXU7RLu5YrZ7ET9+Yx55EKPTgf97C/DHGh eoYA== X-Gm-Message-State: APf1xPBq1qAO8Uel0u6bwjoFYiUU5qKLH1KxC7eAxAxHGE1pbv5Nv2pl jRWazSf/w2lN+ERoye6l4oI= X-Received: by 2002:a17:902:347:: with SMTP id 65-v6mr1742517pld.0.1518412591510; Sun, 11 Feb 2018 21:16:31 -0800 (PST) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id e88sm27661254pfl.80.2018.02.11.21.16.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Feb 2018 21:16:30 -0800 (PST) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 12 Feb 2018 15:46:24 +1030 From: Joel Stanley To: Greg Kroah-Hartman , Rob Herring , Mark Rutland Cc: Jeremy Kerr , Christopher Bostic , Brad Bishop , Edward James , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 02/10] fsi: master-gpio: Add locking during break and link enable Date: Mon, 12 Feb 2018 15:45:41 +1030 Message-Id: <20180212051549.8575-3-joel@jms.id.au> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180212051549.8575-1-joel@jms.id.au> References: <20180212051549.8575-1-joel@jms.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeremy Kerr Currently, we perform GPIO accesses in fsi_master_gpio_break and fsi_master_link_enable, without holding cmd_lock. This change adds the appropriate locking. Signed-off-by: Jeremy Kerr Reviewed-by: Joel Stanley Reviewed-by: Christopher Bostic Signed-off-by: Joel Stanley --- drivers/fsi/fsi-master-gpio.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.15.1 diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c index ae2618768508..a6d602e89c11 100644 --- a/drivers/fsi/fsi-master-gpio.c +++ b/drivers/fsi/fsi-master-gpio.c @@ -461,12 +461,14 @@ static int fsi_master_gpio_term(struct fsi_master *_master, static int fsi_master_gpio_break(struct fsi_master *_master, int link) { struct fsi_master_gpio *master = to_fsi_master_gpio(_master); + unsigned long flags; if (link != 0) return -ENODEV; trace_fsi_master_gpio_break(master); + spin_lock_irqsave(&master->cmd_lock, flags); set_sda_output(master, 1); sda_out(master, 1); clock_toggle(master, FSI_PRE_BREAK_CLOCKS); @@ -475,6 +477,7 @@ static int fsi_master_gpio_break(struct fsi_master *_master, int link) echo_delay(master); sda_out(master, 1); clock_toggle(master, FSI_POST_BREAK_CLOCKS); + spin_unlock_irqrestore(&master->cmd_lock, flags); /* Wait for logic reset to take effect */ udelay(200); @@ -497,10 +500,14 @@ static void fsi_master_gpio_init(struct fsi_master_gpio *master) static int fsi_master_gpio_link_enable(struct fsi_master *_master, int link) { struct fsi_master_gpio *master = to_fsi_master_gpio(_master); + unsigned long flags; if (link != 0) return -ENODEV; + + spin_lock_irqsave(&master->cmd_lock, flags); gpiod_set_value(master->gpio_enable, 1); + spin_unlock_irqrestore(&master->cmd_lock, flags); return 0; }