From patchwork Mon Jan 14 13:44:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10762651 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 D7F701390 for ; Mon, 14 Jan 2019 13:53:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C45432880C for ; Mon, 14 Jan 2019 13:53:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B82A128BAF; Mon, 14 Jan 2019 13:53:38 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable 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 23602288B4 for ; Mon, 14 Jan 2019 13:53:35 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id F2D8A267129; Mon, 14 Jan 2019 14:46:10 +0100 (CET) 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 C6F05266BD4; Mon, 14 Jan 2019 14:46:01 +0100 (CET) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by alsa0.perex.cz (Postfix) with ESMTP id A18EE26699F for ; Mon, 14 Jan 2019 14:45:58 +0100 (CET) Received: by mail-wr1-f65.google.com with SMTP id x10so22875570wrs.8 for ; Mon, 14 Jan 2019 05:45:58 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=zhJfSAlmB/SXCyVXDRxBFTU7e7uygGHPig+jgFbUKkI=; b=Z3/wDbhzhopFmyHNBAS1GSnVi/sNKVPlp0oNbYpPLEEL4VqHsy+5ZLBt6oDYjcSO4T fSSE2zHTTQQ5i0sIelPEi9Kt/qThgXItG1JoSdo3gDZqGmDhbfP4J2MMFDebFOUdkHFt 0PH6bLo8xpAZlp4JFNkG55gMcPu3FtXIGRer0= 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:mime-version:content-transfer-encoding; bh=zhJfSAlmB/SXCyVXDRxBFTU7e7uygGHPig+jgFbUKkI=; b=qCg8g4z0Veq/VMox0gTCQdr5xWSCOCkUvJkAQAgz3btR1jxpv8Yl/t7FIu9CDpXHnE FWEA/I4iZ1M17+361yMEb9e7lkd1ViEXBr8lpKF0g8BStAHDGFzex4m/7zuzFYXNpUTT z3M/3whVhgKaQ2gIJxZ8hicvohuS4cOT0RMFTlzov6XqjCTKV+DqhQOZ+5n/2QW72w8q 3aKzEzwCL9KcHQ9AlZey6ngHmTkn6OuwON/20jPPDL+rIOHRnCDrUdj6/TA1gdFpmmWJ x7+tShihasJpyP/u+LChkj0qqeRXHerF9dKmH1M+OQEZhU9DgP0ZR9MBZaNR/hLxZ1Z6 yKhg== X-Gm-Message-State: AJcUukcIfWTOlIJI/5MEP0FhWqZE8vJx1e3vIDaCzQy1AWQTgHrc+8/Y V34CeduQA15o6BUF01CJPk68Vg== X-Google-Smtp-Source: ALg8bN5IB0p3NXMh0MZIhvE5oOFk11LD0A8yEBKLDOoJcNBn079uF1rverXDFyN7EkSnLe1MzonW8A== X-Received: by 2002:adf:b201:: with SMTP id u1mr24126617wra.165.1547473558066; Mon, 14 Jan 2019 05:45:58 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id x10sm86766472wrn.29.2019.01.14.05.45.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Jan 2019 05:45:57 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Date: Mon, 14 Jan 2019 13:44:48 +0000 Message-Id: <20190114134449.15367-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190114134449.15367-1-srinivas.kandagatla@linaro.org> References: <20190114134449.15367-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, broonie@kernel.org, Srinivas Kandagatla , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH 3/4] slimbus: core: use slim_device_update_status() to update status 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP use slim_device_update_status() instead of directly calling the device_status() callback. Move slim_device_update_status() before probe to avoid forward declaration too. Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/core.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c index 1ba08b5f2e78..8ffdc9876223 100644 --- a/drivers/slimbus/core.c +++ b/drivers/slimbus/core.c @@ -42,6 +42,23 @@ static int slim_device_match(struct device *dev, struct device_driver *drv) return !!slim_match(sbdrv->id_table, sbdev); } +static void slim_device_update_status(struct slim_device *sbdev, + enum slim_device_status status) +{ + struct slim_driver *sbdrv; + + if (sbdev->status == status) + return; + + sbdev->status = status; + if (!sbdev->dev.driver) + return; + + sbdrv = to_slim_driver(sbdev->dev.driver); + if (sbdrv->device_status) + sbdrv->device_status(sbdev, sbdev->status); +} + static int slim_device_probe(struct device *dev) { struct slim_device *sbdev = to_slim_device(dev); @@ -55,8 +72,7 @@ static int slim_device_probe(struct device *dev) /* 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); + slim_device_update_status(sbdev, SLIM_DEVICE_STATUS_UP); } else { dev_err(&sbdev->dev, "Failed to get logical address\n"); ret = -EPROBE_DEFER; @@ -297,23 +313,6 @@ int slim_unregister_controller(struct slim_controller *ctrl) } EXPORT_SYMBOL_GPL(slim_unregister_controller); -static void slim_device_update_status(struct slim_device *sbdev, - enum slim_device_status status) -{ - struct slim_driver *sbdrv; - - if (sbdev->status == status) - return; - - sbdev->status = status; - if (!sbdev->dev.driver) - return; - - sbdrv = to_slim_driver(sbdev->dev.driver); - if (sbdrv->device_status) - sbdrv->device_status(sbdev, sbdev->status); -} - /** * slim_report_absent() - Controller calls this function when a device * reports absent, OR when the device cannot be communicated with