Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp701007pxb; Thu, 19 Nov 2020 11:32:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsKmNI9vW0WaSveriLiKvZDRW9JEWb1ZL8YSSeXv04L6cgOEqmFhaEeg1tRWTW/cIWslEV X-Received: by 2002:a50:bb26:: with SMTP id y35mr21039358ede.257.1605814365751; Thu, 19 Nov 2020 11:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605814365; cv=none; d=google.com; s=arc-20160816; b=eXA9xcnLBdn65E+LZvvmRjPnZtcxWD6j371J67cvaK95g6hlluT2U/ohKGzGq3M3pG 9kshap3r2RdM3wQWwX23I+LUpoKKLfH9zG8teAw16tMEH8pAWQONQ6oN6xwrSN23AKN5 /oxYsWqBIs6SA4pZU/4OUqNa5bc3tXviX4D08YIJtMgmuvhnCLGaA86plk7lbT3ZGfsf xWMXq0mdy8PcWoTwgu9Tj49hETqmDZ4itVwDSsmETkejqZn1prBc6oK6wN4UBnZSmLiA PtdH3K08WsogYPKNklWQjKiOJqg0M/Rxnat5Ru7LNhVF/yf0rRqZdM7qERXtBLLN4oJC L/lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=5Ecn4UiWlcgp/o5Zc8vmAt9tSib8lHYaxaJsU9eKOvE=; b=v8cnJXsZt4kiOLmJfx3wvia6AUS8Ijl0XIc5r2+WorpLVimh9vMW/Lt119bT3Xey40 XFIcdM71pbKsV/XnB5boQ3CXaCo+mpwhaunAsC1NtGiTs2WS/Y3mwhFzN432uU00Xue3 8kTPQwIZ9v8V+r1GZ9C3yj57kfJKAIr4xcKIo9cXimJobLdnl3baL65MpnyZGpLxWR2L Z2pUZHzYGTQtZao7MTA+NTR6FNqRBVF6KuR8Uu4f/Desrr0WiNFQCE7R/8pfhRMNQgnw dKMKJDw4QrTwA1PSO/I1WaerULF8X7aBNl25kJn4lhx4wZupsKmlrYBW2O8nV764AMGn sFnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f14si388450edj.143.2020.11.19.11.32.22; Thu, 19 Nov 2020 11:32:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728225AbgKSTa0 (ORCPT + 99 others); Thu, 19 Nov 2020 14:30:26 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:35706 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727231AbgKSTaZ (ORCPT ); Thu, 19 Nov 2020 14:30:25 -0500 Received: by mail-ot1-f68.google.com with SMTP id n11so6454281ota.2; Thu, 19 Nov 2020 11:30:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5Ecn4UiWlcgp/o5Zc8vmAt9tSib8lHYaxaJsU9eKOvE=; b=ePaD4yxdYYiDGQ4nBl8phlWRWG4unRLBy3878XTgzIqlY8uIhcOxM8SgOFJK9gNVA5 pG6yqycV+ku8GNMim8Z2Armn3NJjDS91u5RuBKJ0U7v4kRGE0trwJE7+dBPBy/yVDmV3 1uWt5f4T18GTSqwL2AKN8SkjvXhLbBPugpakBMloDLAi6OnHhxpQrW46lAS1LFkaAM8W HWoB/Fse14bG5rkiFYmgWe/PhTUKUpMd8dP3g0PQEnxx4m25f/GvcCuTgzygSAwxZzHs vBZ9REC6YaeNJNIoxtqf/pF+S2vRKSZERHBAPPQyc3SM+0yQI32FYK5vyLcZjGrpdaHd h50g== X-Gm-Message-State: AOAM5334UjSBeVnF8Px+wOojVIKubbtyFxc09kGuQh5o6QqOslw0hK3H xZyMGqQCACv7ai9Nyf/r8EMXXGcyArA4uMJDBW6YmAwBIK4= X-Received: by 2002:a9d:5e14:: with SMTP id d20mr10559942oti.107.1605814224133; Thu, 19 Nov 2020 11:30:24 -0800 (PST) MIME-Version: 1.0 References: <20201117094517.5654-1-Sergey.Semin@baikalelectronics.ru> <20201118131604.GC4827@sirena.org.uk> <20201118162931.sdpofyw74yyr5n5z@mobilestation> <20201119184340.GJ5554@sirena.org.uk> In-Reply-To: <20201119184340.GJ5554@sirena.org.uk> From: Geert Uytterhoeven Date: Thu, 19 Nov 2020 20:30:12 +0100 Message-ID: Subject: Re: [RFC PATCH] spi: Take the SPI IO-mutex in the spi_setup() method To: Mark Brown Cc: Serge Semin , Serge Semin , Alexey Malahov , Ramil Zaripov , Pavel Parkhomenko , linux-spi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, On Thu, Nov 19, 2020 at 7:45 PM Mark Brown wrote: > On Wed, Nov 18, 2020 at 07:29:31PM +0300, Serge Semin wrote: > > On Wed, Nov 18, 2020 at 01:16:04PM +0000, Mark Brown wrote: > > > Yeah, problems with it are very common as the documentation has noted > > > since forever. IIRC there was some problem triggered by trying to force > > > it to be serialised but I can't remember what it was. > > > Does it mean nack for this patch from you? So you suggest to fix the controller > > driver instead, right? If so the best solution would be to just lock the > > IO mutex in the set_cs callback of the DW APB SSI driver... > > I'm not 100% clear what the original issue was, given that this is a > constant source of errors in drivers it seems like it should be better > to change the core but since I don't know why we have this the way it is > it's hard to tell what special cases we might have that could explode if > we try to do so. I *think* the main issue is things that don't actually > have separate per device registers trying to configure the single set of > controler registers shared by all devices in which case the locking is > fine and helps with this specific case where it's a read/modify/write > operation on per device stuff and this makes sense. It's also an issue on SPI controllers with a single native chipselect, tricking the driver author into believing that writing to registers during .setup() is not an issue. Until an integrator starts using cs-gpios... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds