From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751122AbdKTITq (ORCPT ); Mon, 20 Nov 2017 03:19:46 -0500 Received: from conssluserg-03.nifty.com ([210.131.2.82]:33347 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750974AbdKTITo (ORCPT ); Mon, 20 Nov 2017 03:19:44 -0500 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com vAK8JdQb004038 X-Nifty-SrcIP: [209.85.161.180] X-Google-Smtp-Source: AGs4zMbswYc9SderwE+A408cySQ7k3SJSLXxGm8cqm89SFMEOdc5N0Et1FaRV0WPspDFWE3fTMt48qgs8v0xN3KJ4us= MIME-Version: 1.0 In-Reply-To: <20171119194930.npqfzqvmh4zbcb34@tetsubishi> References: <1510042172-27220-1-git-send-email-yamada.masahiro@socionext.com> <1510042172-27220-3-git-send-email-yamada.masahiro@socionext.com> <20171119194930.npqfzqvmh4zbcb34@tetsubishi> From: Masahiro Yamada Date: Mon, 20 Nov 2017 17:18:58 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/6] mmc: tmio: set tmio_mmc_host to driver data To: Wolfram Sang Cc: Wolfram Sang , linux-mmc , Simon Horman , Yoshihiro Shimoda , Linux Kernel Mailing List , Ulf Hansson Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2017-11-20 4:49 GMT+09:00 Wolfram Sang : > On Tue, Nov 07, 2017 at 05:09:28PM +0900, Masahiro Yamada wrote: >> The remove, suspend, resume hooks need tmio_mmc_host. It is tedious >> to get mmc_host from the driver_data and pass it to mmc_priv(). >> We can directly set tmio_mmc_host to driver data to clean up the code. >> >> Signed-off-by: Masahiro Yamada > > ... > >> diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c >> index 64b7e9f..ccfbc15 100644 >> --- a/drivers/mmc/host/tmio_mmc.c >> +++ b/drivers/mmc/host/tmio_mmc.c >> @@ -128,15 +128,11 @@ static int tmio_mmc_probe(struct platform_device *pdev) >> static int tmio_mmc_remove(struct platform_device *pdev) >> { >> const struct mfd_cell *cell = mfd_get_cell(pdev); >> - struct mmc_host *mmc = platform_get_drvdata(pdev); >> + struct tmio_mmc_host *host = platform_get_drvdata(pdev); >> >> - if (mmc) { >> - struct tmio_mmc_host *host = mmc_priv(mmc); >> - >> - tmio_mmc_host_remove(host); >> - if (cell->disable) >> - cell->disable(pdev); >> - } >> + tmio_mmc_host_remove(host); >> + if (cell->disable) >> + cell->disable(pdev); > > Hmmm, this changes the code logic. Any reason this driver checks for a > valid 'mmc' and can we safely drop it? > This code has been here since the initial support of TMIO by commit 4a48998fa16121d0fe3436cce43afd6f47424103. So, we have no way to know the reason except asking the author, Ian Molton. My best guess is unnecessary if-conditional was added and overlooked in the review process. mmc has been allocated, and platform_set_drvdata() has been called in the driver probe. I do not see any case for mmc==NULL. -- Best Regards Masahiro Yamada