Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp666242pxj; Fri, 11 Jun 2021 08:27:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn6KPs2YfcjaqgkkpD145yzeQ7p1xAPvAWgB/dS+jVSisjBtbfLezWbepFOyW4CGpYLtMX X-Received: by 2002:aa7:cfd4:: with SMTP id r20mr4339437edy.237.1623425234852; Fri, 11 Jun 2021 08:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623425234; cv=none; d=google.com; s=arc-20160816; b=q+rFsn88shf8sJvBnVRC+ecizML5FAARAYcrIsm6bJc/6tcobwjHNRWwyQQPIHgRdJ qgw1a3AlAW/0xt6IDUInao8u7bH51nX6yxuHu/mcvxQsVT3mwJkSOjbfDLSyjZFK9U0c OtqjxMa7zeY/CqTVwM+5PzwIsQ5cMAdQv3VgZJYIygdW6FMlbjFCEMZk0WyG0CRqDH5/ 7QgEUFTNDkwSiM+kmLWDcLrAIkC1/bEpyr+F0aqt410J7mic6IziY1KTBtJfeVtS79yE t5SfhzwYBizUC6/jjBJEIkWVwq0E6F+21ANdodTY/N1SAvOhCYu/gsfZ1NzoMPuWYdAz LuAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XI/fHIv7cepSjwufhGZnRm8Ni3HBbmbRy48kkkOKeRc=; b=jCrA/Yke4eR4wxy2nIcMZCtDIKUSQMFAVSoxDqgW15tO5eRDSF4/hll3eU1N5KX4xV uq4HXxtI1XNf59Q8IGv4KRFTnTaEHcWU421hiTiXdCWwADFzH0W+IFZBPalvNsET0EeK LeXjt3cbujnlpmxOFM0QIrt4ig/Dxi0G+MVV6Z/+62ysh2OnaAJNiABwAncEjc6sp8sT 3IzIWL441k5Ao0vFPN9kUUUzH+wjd5TOVoCfFeU7PyoTHNO7SQMu04g4qT1hxqI1HVD9 Yll30JwprWm9FTuiRA/8TRONbS3HmYAh85HehNjiSfDd8C4DpBnX4c4WBWbmZSpFm6+a d+gQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yd19si5674624ejb.717.2021.06.11.08.26.50; Fri, 11 Jun 2021 08:27:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbhFKP0c (ORCPT + 99 others); Fri, 11 Jun 2021 11:26:32 -0400 Received: from router.aksignal.cz ([62.44.4.214]:41850 "EHLO router.aksignal.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231679AbhFKP0Z (ORCPT ); Fri, 11 Jun 2021 11:26:25 -0400 Received: from localhost (localhost [127.0.0.1]) by router.aksignal.cz (Postfix) with ESMTP id 03A064851B; Fri, 11 Jun 2021 17:24:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at router.aksignal.cz Received: from router.aksignal.cz ([127.0.0.1]) by localhost (router.aksignal.cz [127.0.0.1]) (amavisd-new, port 10026) with LMTP id pFG4DSeB0dDi; Fri, 11 Jun 2021 17:24:23 +0200 (CEST) Received: from pc-gameroom.prchals.tk (unknown [83.240.30.185]) (Authenticated sender: jiri.prchal@aksignal.cz) by router.aksignal.cz (Postfix) with ESMTPSA id 84E9D4851A; Fri, 11 Jun 2021 17:24:23 +0200 (CEST) From: Jiri Prchal To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rob Herring , Christian Eggers , Arnd Bergmann , Greg Kroah-Hartman , Jiri Prchal Subject: [PATCH] nvmem: eeprom: at25: fram discovery simplification Date: Fri, 11 Jun 2021 17:24:16 +0200 Message-Id: <20210611152416.68386-1-jiri.prchal@aksignal.cz> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changed "is_fram" to bool and set it based on compatible string. Signed-off-by: Jiri Prchal --- drivers/misc/eeprom/at25.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index 744f7abb22ee..4d09b672ac3c 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -69,9 +69,6 @@ struct at25_data { */ #define EE_TIMEOUT 25 -#define IS_EEPROM 0 -#define IS_FRAM 1 - /*-------------------------------------------------------------------------*/ #define io_limit PAGE_SIZE /* bytes */ @@ -363,8 +360,8 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip) } static const struct of_device_id at25_of_match[] = { - { .compatible = "atmel,at25", .data = (const void *)IS_EEPROM }, - { .compatible = "cypress,fm25", .data = (const void *)IS_FRAM }, + { .compatible = "atmel,at25",}, + { .compatible = "cypress,fm25",}, { } }; MODULE_DEVICE_TABLE(of, at25_of_match); @@ -379,11 +376,11 @@ static int at25_probe(struct spi_device *spi) u8 sernum[FM25_SN_LEN]; int i; const struct of_device_id *match; - unsigned long is_fram = 0; + bool is_fram = 0; match = of_match_device(of_match_ptr(at25_of_match), &spi->dev); - if (match) - is_fram = (unsigned long)match->data; + if (match && !strcmp(match->compatible, "cypress,fm25")) + is_fram = 1; /* Chip description */ if (!spi->dev.platform_data) { -- 2.25.1