From patchwork Wed Oct 16 13:16:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 176475 Delivered-To: patches@linaro.org Received: by 2002:ac9:3c86:0:0:0:0:0 with SMTP id w6csp7157215ocf; Wed, 16 Oct 2019 06:16:38 -0700 (PDT) X-Received: by 2002:a2e:8197:: with SMTP id e23mr26153139ljg.218.1571231798680; Wed, 16 Oct 2019 06:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571231798; cv=none; d=google.com; s=arc-20160816; b=xZmDHK7VNyyxP80Os/74feI8Lmn2R0z+T6jC9kGsrwa4Dp3dMkVXwognbql0gYmR4r 5t+e5JEn2ZbDNLsB9HBAj1U7hIxr9jI4pLKZ0L7ceXNcJA+5x1/+5lyfUDCwzTrUtdL5 lONi2xY+ZbRbPAb20qfPh2mZ1VDjO8CFzwo/SrfJl8eJuBtPZU5Ppf3w5tC6z6qI0BIG qSvYHjQh9rwQljRRMnBZgIqYHlk4FA5upXUvyUdnhLMqaHLBHLrrYbalRbOyjHn0iPgD 4w8BIwnK7WJVeoA+2Y2jwFZjKRCtDIpu5uk6tMMPUVa3oOSnVspDlkhCU75IDBMzrYeC xEQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=8we2EpM0rjQuTwVatnTr1F948OBhtLCctpwujUnCJVM=; b=CQuhO3V7O5DQ5IzfrG3wK9Cm4qU8ofcMDnVMsKX5Vw28JCll9XnS/n1DoEsrY+x8ic bs6kV1YJyk39Thloe1299nZtdineBSLe4rZXlUtAcAbntDXVMNw2Do4rFEFfNq/U5SgN SUjY9zAGfCQ6I91fUamksPNJz5Sb4B1f2I3GpeFuFwMQFM9Hyr1r44CIt3bWEENSk5ob JXGoD3ZfiaK8AOZhOxbBhnEBwe6YlIeZ4uN/4mhdGPya/CHtLeezg+vyo8dOA3ePR7Ur jyELMy9O6cL3skrDhCcK3xl7/q0z8HKFEtAn+jfuZQ9yS0vYdrLa8AWVZ02lVz2wzpqr tJeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pJBfryhn; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a15sor6974656lff.72.2019.10.16.06.16.38 for (Google Transport Security); Wed, 16 Oct 2019 06:16:38 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pJBfryhn; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=8we2EpM0rjQuTwVatnTr1F948OBhtLCctpwujUnCJVM=; b=pJBfryhnKfTGvUXCpWb3vmCki72rWDgutvYQXZnfk3eOjMW2CFbW03pxcnkfug+2CP ORQNEmsxeCfx2aE4oKtvpa7NHMDioVAc3RyB+q4ugBabIibwgUkPEo6bx+4P8UcdAKRC Apam9W8X0hB5jNv3Apdm0WsQn54+Q/xCagrQHevdV/DsAP+W6exfTsXMT9BvynwnuYzL 3fVDQiO+xKRC5yMgsghf467iEBOqKYRwexehdQ0fdqyszBgB5UrScMguSUVSPVX3zTdn UnVVRtyORs1Ic8T2Jqh4HK9fR4EWatygNZgrpv849qJ8dOTJSDSIQ8pFSJPp0tV9y5bc sPpw== 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; bh=8we2EpM0rjQuTwVatnTr1F948OBhtLCctpwujUnCJVM=; b=goafTbJ1RZbBJDTI4J26LMnVVo4cGRUfJWCtGc6I245/gTvlpJZqvOiRSIPR87bh8r IZmy/c09mFmKRete9v971RR20fYIpUW/fD4Wfq/dDFPl5UyLlDZqJDC98apHOyRCQe3Q SSsqywCIV0VYWLJkciWo3nY1ImjVYL3jzYQzJzhL0yneDZ/lSkrxKmILz7eYcIvSnnpU HmH+tHmFE4TRPJbzYKgedprZfCa8LQP8azCbzSFFveTffYkQ8ir578kSVRz4s4H0sStp BwApb8ggVJoUtJHsQQhCnjgaByjxHgB8sbYkiTePl1jKhzJmAb8rVuv6geRetmGDY3+5 IamA== X-Gm-Message-State: APjAAAUjF66Af7zlG5si62bUW9v5LM3cLXVuFb0zmCRmh/jqKdbbrouU uY1psXC5RSkpwaqktDOfJOW5ozu5 X-Google-Smtp-Source: APXvYqz+eigY33Bwc9nKZAvdwkxNqFh2HT/skQhZ4tcXvDcDSziBF8sO2BGnhugFqk0IY2gfwd8qkQ== X-Received: by 2002:a19:4f0e:: with SMTP id d14mr24211346lfb.177.1571231798276; Wed, 16 Oct 2019 06:16:38 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i6sm6044417lfo.83.2019.10.16.06.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 06:16:37 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Geert Uytterhoeven , Wolfram Sang , Niklas Soderlund , Ulf Hansson , Kevin Hilman Subject: [PATCH 3/3] mmc: tmio: Avoid boilerplate code in ->runtime_suspend() Date: Wed, 16 Oct 2019 15:16:34 +0200 Message-Id: <20191016131634.15881-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 Rather than checking the 'runtime_synced' flag each time the ->runtime_suspend() callback is invoked, let's convert into using dev_pm_domain_start() during ->probe() and drop the corresponding boilerplate code. Signed-off-by: Ulf Hansson --- drivers/mmc/host/tmio_mmc.h | 1 - drivers/mmc/host/tmio_mmc_core.c | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 2f0b092d6dcc..c5ba13fae399 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -163,7 +163,6 @@ struct tmio_mmc_host { unsigned long last_req_ts; struct mutex ios_lock; /* protect set_ios() context */ bool native_hotplug; - bool runtime_synced; bool sdio_irq_enabled; /* Mandatory callback */ diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 9b6e1001e77c..86b591100f16 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -1248,10 +1249,12 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) /* See if we also get DMA */ tmio_mmc_request_dma(_host, pdata); + dev_pm_domain_start(&pdev->dev); + pm_runtime_get_noresume(&pdev->dev); + pm_runtime_set_active(&pdev->dev); pm_runtime_set_autosuspend_delay(&pdev->dev, 50); pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_enable(&pdev->dev); - pm_runtime_get_sync(&pdev->dev); ret = mmc_add_host(mmc); if (ret) @@ -1333,11 +1336,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev) { struct tmio_mmc_host *host = dev_get_drvdata(dev); - if (!host->runtime_synced) { - host->runtime_synced = true; - return 0; - } - tmio_mmc_clk_enable(host); tmio_mmc_hw_reset(host->mmc);