From patchwork Sun Sep 16 23:45:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10601927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FE8513AD for ; Sun, 16 Sep 2018 23:46:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EC0A29340 for ; Sun, 16 Sep 2018 23:46:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32E592934C; Sun, 16 Sep 2018 23:46:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 917A129340 for ; Sun, 16 Sep 2018 23:46:36 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DF07C267893; Mon, 17 Sep 2018 01:46:10 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 219FA2676AA; Mon, 17 Sep 2018 01:46:03 +0200 (CEST) Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) by alsa0.perex.cz (Postfix) with ESMTP id 02BF52677FF for ; Mon, 17 Sep 2018 01:46:00 +0200 (CEST) Received: by mail-it0-f65.google.com with SMTP id h1-v6so8782429itj.4 for ; Sun, 16 Sep 2018 16:46:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PIKaH/Ayz19S8iNTPDQor8FxL6MltyIuIX2u6+vfhek=; b=ee7g1aiNVMrlWJbii8louGa7accboQgy+AOfEg9XLtOZpHOJBDpBDYMeFIJoikkMs6 s8EyyClPK2N6P8A4yOToExebsnio4GPoC7GlrgJpUUShXH+KgqouuDSHHGs9VzOTYHIn NbtlhdZOVETN+bKhQ6HZ3gGkdpNIyHjFH85qc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PIKaH/Ayz19S8iNTPDQor8FxL6MltyIuIX2u6+vfhek=; b=tMC/WKzVpGIZM7npfYwqp/vc9nYnBaXr349ITT+whSgw/7CF98vkmIWhIE9bPsRNNl jcA6gTDZ0c86tJ/zgdkOt86lAooZfZBCJu9/13sEzyj1M6M6Qcdfd8CyAp6bx97W/6Nf OWv8aoWRgGwopGfh+DMbfc5f7RNocl28To7ZF71gjJmOooWNHjblgolF2tSxDiHcD2cX 1V2J9LPPSGixNIyqesYZ72vnxyH5TmphBDWm2mU9fsCSQNBBuBO3VimFNBQ5m/26M/Ke wKdltBUJ+uQIAHXxhcZz4+Qdoj7qyfoW6dMLYsvb0y20IPFZRvS4rPkg2dgrEgfYhH5f yDGg== X-Gm-Message-State: APzg51AN/xiYUcHj10YBPUZFdkciFce0YQgfpmL8s1wVgbO88DtfMzso E3vKyooYU8t4pED+dmQce4JhmQ== X-Google-Smtp-Source: ANB0VdY7W8TNXy3QBSFCzO+Q+M/Frdz77xjS4yobxID+qnXWZiliFhGwlWnA2oBQ/UH0Ig5gbjSV8g== X-Received: by 2002:a24:24c2:: with SMTP id f185-v6mr10666065ita.18.1537141559357; Sun, 16 Sep 2018 16:45:59 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id a11-v6sm4495177ioc.63.2018.09.16.16.45.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Sep 2018 16:45:58 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Date: Sun, 16 Sep 2018 16:45:41 -0700 Message-Id: <20180916234546.29661-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180916234546.29661-1-srinivas.kandagatla@linaro.org> References: <20180916234546.29661-1-srinivas.kandagatla@linaro.org> Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, Srinivas Kandagatla Subject: [alsa-devel] [PATCH 2/7] slimbus: core: update device status in probe X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Srinivas Kandagatla device status update can be racy with probe in some cases, so make sure it take lock during the probe. Also after probe the device is expected to be ready for communications, so make sure that a logical address can be assigned to it after probe. If it fails to do so then probe defer such instances. Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/core.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c index 31f2910..262591f 100644 --- a/drivers/slimbus/core.c +++ b/drivers/slimbus/core.c @@ -40,8 +40,23 @@ static int slim_device_probe(struct device *dev) { struct slim_device *sbdev = to_slim_device(dev); struct slim_driver *sbdrv = to_slim_driver(dev->driver); + int ret; + + ret = sbdrv->probe(sbdev); + if (ret) + return ret; - return sbdrv->probe(sbdev); + /* try getting the logical address after probe */ + ret = slim_get_logical_addr(sbdev); + if (!ret) { + if (sbdrv->device_status) + sbdrv->device_status(sbdev, sbdev->status); + } else { + dev_err(&sbdev->dev, "Failed to get logical address\n"); + ret = -EPROBE_DEFER; + } + + return ret; } static int slim_device_remove(struct device *dev)