19 Oct
2010
19 Oct
'10
1:02 p.m.
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.