From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alberto Panizzo Subject: Re: [PATCH v3] input: MXC: add mxc-keypad driver to support the Keypad Port present in the mxc application processors family. Date: Wed, 27 Jan 2010 15:39:53 +0100 Message-ID: <1264603193.2463.75.camel@realization> References: <1264586106.2463.23.camel@realization> <19296.5728.557535.920849@ipc1.ka-ro> <1264594452.2463.62.camel@realization> <19296.12024.559688.606548@ipc1.ka-ro> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-ew0-f219.google.com ([209.85.219.219]:46845 "EHLO mail-ew0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752871Ab0A0OkE (ORCPT ); Wed, 27 Jan 2010 09:40:04 -0500 Received: by ewy19 with SMTP id 19so517297ewy.21 for ; Wed, 27 Jan 2010 06:40:01 -0800 (PST) In-Reply-To: <19296.12024.559688.606548@ipc1.ka-ro> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Lothar =?ISO-8859-1?Q?Wa=DFmann?= Cc: linux-input , H Hartley Sweeten , Dmitry Torokhov , Sascha linux-arm , linux-arm-kernel On mer, 2010-01-27 at 13:18 +0100, Lothar Wa=C3=9Fmann wrote: > Hi, >=20 > Alberto Panizzo writes: > > > > + irq =3D platform_get_irq(pdev, 0); > > > > + if (irq < 0) { > > > > + dev_err(&pdev->dev, "failed to get keypad irq\n"); > > > > + return -ENXIO; > > > > + } > > > > > > > This should be -ENODEV. > > >=20 > > Lot of reference keyboard driver use -ENXIO.. > > May should be better: return irq ? > >=20 > Yes, of course. If a function returns an error code that should be > promoted to the caller instead of inventing a new error code. >=20 >=20 > Lothar Wa=C3=9Fmann But, errno.h say: #define ENXIO 6 // Device not configured #define ENODEV 19 // Operation not supported by = device And looking at the code of platform_get* these functions return only wh= at it is written in the platform_device data. So the only way these functions fails is a not configured platform_devi= ce=20 with IRQ and I/O memory. Maybe the error outputs are wrong. What about these: if (pdata =3D=3D NULL) { dev_err(&pdev->dev, "no platform data defined\n"); return -ENXIO; } irq =3D platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "no irq defined in platform data\n"); return -ENXIO; } res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res =3D=3D NULL) { dev_err(&pdev->dev, "no I/O memory defined in platform data\n"); return -ENXIO; } res =3D request_mem_region(res->start, resource_size(res), pdev->name)= ; if (res =3D=3D NULL) { dev_err(&pdev->dev, "failed to request I/O memory\n"); return -EBUSY; } -- To unsubscribe from this list: send the line "unsubscribe linux-input" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html