[alsa-devel] [PATCH v4 7/9] davinci: MMC/SD support for Omapl138-Hawkboar

Cyril Chemparathy cyril at ti.com
Tue Oct 19 13:02:55 CEST 2010


Hi Victor,

[...]
> Yes you are right and as I understand gpio_request will give a 0 if it
> success and because of that the warning never will appear, if there is
> a problem there will be a -1 and the warning will be printed. I could
> fix this with a return that breaks the code like this
> 
>        ret = gpio_request(DA850_HAWK_MMCSD_CD_PIN, "MMC CD\n");
>        if (ret) {
>                pr_warning("%s: can not open GPIO %d\n",
>                        __func__, DA850_HAWK_MMCSD_CD_PIN);
>                return;
>        }
>        gpio_direction_input(DA850_HAWK_MMCSD_CD_PIN);

I think gpio_request_one() is simpler.  This requests the gpio and sets
it up:

	ret = gpio_request_one(DA850_HAWK_MMCSD_CD_PIN,
			       GPIOF_DIR_IN, "MMC CD");
	if (ret < 0) {
		... failed ...
	}

Regards
Cyril.


More information about the Alsa-devel mailing list