From patchwork Thu May 14 18:11:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1210 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C94163F03F for ; Thu, 14 May 2020 20:11:36 +0200 (CEST) Received: by mail-pj1-f71.google.com with SMTP id l3sf28413483pjk.8 for ; Thu, 14 May 2020 11:11:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589479895; cv=pass; d=google.com; s=arc-20160816; b=C4bLL9wa/fll5sH21X/emfuBNgDGB5oNuyscuQahZ1EMmX5IvdPVx224pXhP8OMBAK 1qbCWPf0PkJA4sliuPG0OrrI/rE2EAjFXbRTw+LYUXZP1Ac3+TuyT3ociJ6zDX+Rdm2c Wz3m3G8Gf1XQAKz9WgfjZWEkZiPIGTeeNryr7me3s8jtKQbJpCdzUMGn4dsxO+Q5TeDi t7YmQC951HAxu/mTZhTBP0Qw9innO6HizQ2A1tfecp8mEsQocFRAYOsFyc4ubLjO8Bni /LZMsDXYPP8c9jqrBQgu0y1VrdyCvs3TqZnA7CmAFmwH4BR5X0GsdyspnYvYEyMj68Ys VRhw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=pl9NIEc4AOk2KoCPcUyJrQRQsp4DBcPcsyUVJ+pYByc=; b=nVQ6aEInP3Ulh8bfn2PZ1yYDti+7o3P2FrLZeiooyrN/yebxTWjSMKwAC1Vgb4EEze Cg6njKrIus7ucErPY+7zfptTYV95zR/A5OgSg4gDyaLdW6WV0VhPRirPn8U6SWOmbJHE 3BqcER6Z85+XX+uSsKkYuxMSbnRw5wDAxop+GxtOyqQpY5JrbACBbAlw0QpPHs6v9RBN C/g+zVLaG6gARg/LwAbMmKqFDOWBYKMlMwE26hmu7MXh++5Ta2BhfKZ8+RxZqDi304vZ LpEmW4E010m6olsafHJGhfz98rNc+P/EBjxrQMMWAUXp+6Vi7IH4dWrl+zeDTeCxLTeE 5+rw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=joW62GSH; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=pl9NIEc4AOk2KoCPcUyJrQRQsp4DBcPcsyUVJ+pYByc=; b=hnFl9gpihtlo0eJnR2g0Qa10fmT522wRNugjasPsb6I0hK5nF3aQL2ci+RNTEBZCV0 rQxjNo7HePUxy4UGP0uPkT/EV8rkoHELvNIzDQbwtipBuYSRQD0dGpzqOH8/YHGUuSz7 fii18TtD+3Sup3wmv1yh8UIbhQIh3+vnccZM0= 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:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=pl9NIEc4AOk2KoCPcUyJrQRQsp4DBcPcsyUVJ+pYByc=; b=cPKtH8V+Zu+EdEfAl5qogQG85guz8pc28rgAjQv/aPDodQtAYcX+k94FpknDwfrFF0 cSamTYAKs8tFei9i1cCIvAjL0kNR5yPEmE5MSH20JWs5lNUPtMp66E25WuIfdvBSMHod +qr0rgXISHZXXZiHFjZkNyR3yWyaI6qqNDm0Lugzu4UtzEG/hrbQRjLivLFONedNrzpk RnuDqyH/t3+pJlLloNaLvSWnDDCJl9QeqvjNUDZwzvr1c8FPCm4cIDnc3fVFpsB9S7j8 bvWBNlsUvW4tha3wfzymlpeDhZNCGPD1IohZuCL6g1qDk1W1Plke7o/nBGa8NfGBGqsQ ZD3w== X-Gm-Message-State: AOAM530w7MXvn1JSgFadNGSjIjzT88eaRXXqX9gxwht20E0xHOCfRGG3 r6VJJ1OWJBg74jq4oloLuUZxtJ0b X-Google-Smtp-Source: ABdhPJx5wUFdZjif5SeoO0DSYDsU6T1Tid8bB8nBFjcYAAXir6KdV4FVZvmNe+91+DoTdsLcl8jWng== X-Received: by 2002:a62:19d5:: with SMTP id 204mr5905023pfz.189.1589479895558; Thu, 14 May 2020 11:11:35 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:7b82:: with SMTP id w2ls1296812pll.1.gmail; Thu, 14 May 2020 11:11:35 -0700 (PDT) X-Received: by 2002:a17:902:a989:: with SMTP id bh9mr5313621plb.44.1589479895045; Thu, 14 May 2020 11:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589479895; cv=none; d=google.com; s=arc-20160816; b=QwWXKILKe29rZGQKtLES3+OX+T7fzD+2X1wuKhEzYFP1I3C1A+qrayLLeOuhJf/XdS GdnFt7tef+w8qKLzfBXY3ywtBBfuCrc5nTdrRv8o1Z3Tr1b9wC4JPQTj+6uFW8ckAi9P utlsxkVa58dR05eIMBDJp+iFGwXYnLllq3BRWGpel0VS6L/wx++5OjLGLqICLx5adb7r 1tGbJglqrMGk9TNSTbTmHCKAqxsiDhP0lJZjmStpGXF80XhgSL1LK5VeUPmXpS7UhDv1 hR4CEC78P6F6Pe3BeScpHK+qDL7DjeYgnzXe/nfv9pK42wdYopcze7EsB8yusBJOX51R wdgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=i2S63wy31osOxe4Koc0QbBeAUvoWun+tFDgwzlkKA3w=; b=hco4zS8l/crnyci3i/swjTx+3sqPugmI5vjqcFUDc9XBA/hEkfdMGurfg1Sn7OMO7c 1/SJkGejWTvBBMQo8whYza0DNsm0oA6icauP+WavV/ilJF2X7xCJ0VL88m1fX/qNzhJs +DIHrKULZWXjdEXfseVBHir0lbJwC5EOqtciDOHWIZKPyDBXogi6nPz8kpoYjyf1Mzjf 8LWIgWsdSzOG5fn/ROTd26zPh98OeW2NERBZz/5dpK/uyvwcDxrrQniZqdgUzt3jcMWc audZDMivUstTbH9xg4dkJVOMrzBvXdFrAFadATgR0I344RKWjMmv5dnEOhaqMQXPkbhe 1NZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=joW62GSH; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a36sor4706188pgb.49.2020.05.14.11.11.34 for (Google Transport Security); Thu, 14 May 2020 11:11:34 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:f925:: with SMTP id h37mr5418700pgi.112.1589479894414; Thu, 14 May 2020 11:11:34 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id y24sm2842611pfn.211.2020.05.14.11.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 11:11:33 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Jagan Teki , Simon Glass , Vignesh R , Daniel Schwierzeck Subject: [PATCH v2 5/5] mtd: spi: Use CONFIG_IS_ENABLED to prevent ifdef Date: Thu, 14 May 2020 23:41:25 +0530 Message-Id: <20200514181125.21649-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=joW62GSH; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Use CONFIG_IS_ENABLED to prevent ifdef in sf_probe.c Cc: Simon Glass Cc: Vignesh R Cc: Daniel Schwierzeck Signed-off-by: Jagan Teki --- Changes for v2: - CONFIG_IS_ENABLED() instead of IS_ENABLED() drivers/mtd/spi/sf_internal.h | 10 ++++++++++ drivers/mtd/spi/sf_probe.c | 17 ++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h index 940b2e4c9e..544ed74a5f 100644 --- a/drivers/mtd/spi/sf_internal.h +++ b/drivers/mtd/spi/sf_internal.h @@ -81,5 +81,15 @@ int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash); #if CONFIG_IS_ENABLED(SPI_FLASH_MTD) int spi_flash_mtd_register(struct spi_flash *flash); void spi_flash_mtd_unregister(void); +#else +static inline int spi_flash_mtd_register(struct spi_flash *flash) +{ + return 0; +} + +static inline void spi_flash_mtd_unregister(void) +{ +} #endif + #endif /* _SF_INTERNAL_H_ */ diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 89e384901c..a73f521777 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -44,9 +44,8 @@ static int spi_flash_probe_slave(struct spi_flash *flash) if (ret) goto err_read_id; -#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) - ret = spi_flash_mtd_register(flash); -#endif + if (CONFIG_IS_ENABLED(SPI_FLASH_MTD)) + ret = spi_flash_mtd_register(flash); err_read_id: spi_release_bus(spi); @@ -83,9 +82,9 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs, void spi_flash_free(struct spi_flash *flash) { -#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) - spi_flash_mtd_unregister(); -#endif + if (CONFIG_IS_ENABLED(SPI_FLASH_MTD)) + spi_flash_mtd_unregister(); + spi_free_slave(flash->spi); free(flash); } @@ -150,9 +149,9 @@ int spi_flash_std_probe(struct udevice *dev) static int spi_flash_std_remove(struct udevice *dev) { -#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) - spi_flash_mtd_unregister(); -#endif + if (CONFIG_IS_ENABLED(SPI_FLASH_MTD)) + spi_flash_mtd_unregister(); + return 0; }