Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756680Ab2FULzq (ORCPT ); Thu, 21 Jun 2012 07:55:46 -0400 Received: from mail-vc0-f174.google.com ([209.85.220.174]:49595 "EHLO mail-vc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754219Ab2FULzo convert rfc822-to-8bit (ORCPT ); Thu, 21 Jun 2012 07:55:44 -0400 MIME-Version: 1.0 In-Reply-To: References: <1339678763-14509-1-git-send-email-aletes.xgr@gmail.com> Date: Thu, 21 Jun 2012 08:55:43 -0300 Message-ID: Subject: Re: [PATCH] SPI: at25: Parse dt settings From: Alexandre Pereira da Silva To: Ivo Sieben Cc: Grant Likely , Rob Herring , Rob Landley , Greg Kroah-Hartman , Wolfram Sang , Chris Wright , devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Roland Stigge Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1749 Lines: 46 On Thu, Jun 21, 2012 at 8:10 AM, Alexandre Pereira da Silva wrote: > On Thu, Jun 21, 2012 at 6:49 AM, Ivo Sieben wrote: >> One small remark: >> In case of platform_data, the "if (!chip)" check has been removed and >> is now only handled in the device tree initialization. >> Maybe add this check to the platform initialization as well: >> >> } else { >> ? ? ? ?if (!spi->dev.platform_data) { >> ? ? ? ? ? ? ? ?dev_dbg(&spi->dev, "no chip description\n"); >> ? ? ? ? ? ? ? ?err = -ENODEV; >> ? ? ? ? ? ? ? ?goto fail; >> ? ? ? ?} >> ? ? ? ?chip = ?*(struct spi_eeprom *)spi->dev.platform_data; >> } Please ignore my last email. Not enough coffee. I'm sorry. The code looks right to me. - chip = spi->dev.platform_data; - if (!chip) { - dev_dbg(&spi->dev, "no chip description\n"); - err = -ENODEV; - goto fail; - } + if (!spi->dev.platform_data) { + if (np) { /* No platform data and DT node present, DT handling */ + } else { /* No DT and No platform description, handle error */ + dev_dbg(&spi->dev, "no chip description\n"); + err = -ENODEV; + goto fail; + } + } else /* At this point chip is guaranteed to have valid data */ + chip = *(struct spi_eeprom *)spi->dev.platform_data; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/