Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4585658imm; Wed, 30 May 2018 08:15:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL1AjT0acQf0DGu2peF7Ifp/rrJ1JMbawSV5+SXBPD0DJFmx5kL5wzpnH84UIOr7u07h3Te X-Received: by 2002:a17:902:6e4:: with SMTP id 91-v6mr3214839plh.63.1527693302098; Wed, 30 May 2018 08:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527693302; cv=none; d=google.com; s=arc-20160816; b=Oi1LZ4rpTTqcQ784bfLQXuCcMvqbsZ8cGw4LJZnrRU3i4rHqULA7U/LXWBe+yi257F nHJf3JLwo8zEmFDTnOudzKfonNVa+Fba+GlIRxtnzGABllkYXREFbxFIkvq47CbzuwpH bJh3fS4mQIDQNKCYE6uGhsmirO2UNX9TQM5LqKq0102As+tHqoyXx+hHDpp/OzOCXSMo MDOGTn+ZiCfHPaSUEqFmS5uWihKy+jbzFS4lqz9FekBG4vo5OyI/y++rWsChSoDf0Rtp iBHDB31m+e04qZT1+M87yRDvVNhZ5WHhMruq64Bng+J37zr2GCg8Ipu8ZqgRv9XFHPhp ntPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=r+0LeJhl7EmpKKtITrH/qbZ3CE9AttpQgCsRemaTEVA=; b=rdQzF1g5RV0/MSs6a1LebCs4rsnqwfAKX6j2y3HkyjffDEB1awg5gLrpTze3VvvVn5 dH/zKFyui0ITxRpte7ctsWr+aehQ/aNXzUUiXoJpH5N59mKqTnm8hVJ60WoWYyLGVa9+ cBygLa/hqhtbS2ySurvrzS7vn2zt0xm/Dy18cF5z8bbkzMjcYgv/oQ3VHJt30FvQe9G/ jvTOAKqpiHJueuIqHChhlYUPCAtFGFj4d77ff454imHoSBQ4BicGG6f3mQYCrzivnQKc o1AedNq4RvtbiwPLMFXILwobVYuXb15dmfEgpm2FGKnE2IjJU0i3h7lmj/i2pDiwfDs6 mpNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@as-electronics.de header.s=strato-dkim-0002 header.b=fPp2h7QG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5-v6si26130308pgn.453.2018.05.30.08.14.47; Wed, 30 May 2018 08:15:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@as-electronics.de header.s=strato-dkim-0002 header.b=fPp2h7QG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753569AbeE3POZ (ORCPT + 99 others); Wed, 30 May 2018 11:14:25 -0400 Received: from mo4-p05-ob.smtp.rzone.de ([85.215.255.134]:23892 "EHLO mo4-p05-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbeE3POV (ORCPT ); Wed, 30 May 2018 11:14:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1527693260; s=strato-dkim-0002; d=as-electronics.de; h=In-Reply-To:Date:Message-ID:From:References:Cc:To:Subject: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=r+0LeJhl7EmpKKtITrH/qbZ3CE9AttpQgCsRemaTEVA=; b=fPp2h7QGNz0Hs2AaNsLIwAJ7p9U01n4FLa0ZNkaserUsA4UPK0OxOCXWlwTPEPIk/g wprhuGA4AjpfSM1hGj5mxPOWJs3dKHJt1Gpj3UcMut7mLc5f2XE702pKmVyZPn+qc+tX 8um/93yYiKko+myHdD7Z1B8VhYOkTuYfEjazJtzHGpYySuBtKOX2S9I0OFsIexpsMaN5 bbFdlBgtlSHFRXA+B6yx69IKkZOmLvh10K5V0sKD9YUfIt4yssqumO/mrUh/XdMNIxR/ hI6BWHwZm3lfylQ7lyxiBDEp/OwtW9OILnjX4t6a7uMlOmOGyuVKyRGrvA/ZRtYO9EOc bSNw== X-RZG-AUTH: ":LX8JdEmkW/4tAFwMkcNJIloh1hrA5u3owhPk7bdT5Fx2zAOrX/r2ZbrrxoyOl37jyAS87PDYJ9azvnITHNpDem7ChLghAqCJU8ykdftsfK97" X-RZG-CLASS-ID: mo05 Received: from [IPv6:2001:16b8:248b:c300:d425:36c1:5a2b:334e] by smtp.strato.de (RZmta 43.9 AUTH) with ESMTPSA id g0147au4UFDi0Pg (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 30 May 2018 17:13:44 +0200 (CEST) Subject: Re: [PATCH 03/11] spi: Add a driver for the Freescale/NXP QuadSPI controller To: Boris Brezillon Cc: linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, richard@nod.at, miquel.raynal@bootlin.com, broonie@kernel.org, david.wolfe@nxp.com, fabio.estevam@nxp.com, prabhakar.kushwaha@nxp.com, yogeshnarayan.gaur@nxp.com, han.xu@nxp.com, linux-kernel@vger.kernel.org References: <1527686082-15142-1-git-send-email-frieder.schrempf@exceet.de> <1527686082-15142-4-git-send-email-frieder.schrempf@exceet.de> <20180530165816.371dc39c@bbrezillon> From: Frieder Schrempf Message-ID: Date: Wed, 30 May 2018 17:13:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180530165816.371dc39c@bbrezillon> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Boris, On 30.05.2018 16:58, Boris Brezillon wrote: > Hi Frieder, > > On Wed, 30 May 2018 15:14:32 +0200 > Frieder Schrempf wrote: > >> + >> +static const char *fsl_qspi_get_name(struct spi_mem *mem) >> +{ >> + struct fsl_qspi *q = spi_controller_get_devdata(mem->spi->master); >> + struct device *dev = &mem->spi->dev; >> + const char *name; >> + >> + /* >> + * In order to keep mtdparts compatible with the old MTD driver at >> + * mtd/spi-nor/fsl-quadspi.c, we set a custom name derived from the >> + * platform_device of the controller. >> + */ >> + if (of_get_available_child_count(q->dev->of_node) == 1) >> + name = dev_name(q->dev); >> + else >> + name = devm_kasprintf(dev, GFP_KERNEL, >> + "%s-%d", dev_name(q->dev), >> + mem->spi->chip_select); >> + >> + if (!name) { >> + dev_err(dev, "failed to get memory for custom flash name\n"); >> + return dev_name(q->dev); > > Hm, not sure that's what we want. We should probably fail when the > allocation fails. Right, we should definitely fail when the allocation fails. > > How about letting ->get_name() return an error pointer or NULL in case > of error. With the other I made suggestion in my review of patch 1 > (calling ->get_name() at probe time) you could refuse to probe the > device when ->get_name() fails. Ok, I will change that. Thanks, Frieder > >> + } >> + >> + return name; >> +} >> + > > Regards, > > Boris >