libahci_platform: Fail when PHY required but PHY support disabled
authorMikko Perttunen <mperttunen@nvidia.com>
Tue, 17 Jun 2014 12:07:55 +0000 (15:07 +0300)
committerTejun Heo <tj@kernel.org>
Tue, 17 Jun 2014 16:10:59 +0000 (12:10 -0400)
commitacbd573354bb7b7b7a3891018a39f4b3976b0c43
tree28587e0f81699a09a6a58cecbd726c591ff3caf9
parentebe06187bf2aec10d537ce4595e416035367d703
libahci_platform: Fail when PHY required but PHY support disabled

ahci_platform_get_resources handles resource management for
platform AHCI drivers, including getting a possible PHY
from the device tree. Since not all drivers need a PHY, it
ignores -ENODEV and -ENOSYS from devm_get_phy. However, when
the PHY subsystem is mistakenly disabled, -ENOSYS can be
returned even when a PHY is needed.

This patch modifies the -ENOSYS case to check if a "phys"
device tree node exists. If it exists, then clearly the PHY
subsystem is mistakenly disabled and the driver cannot work,
ahci_platform_get_resources will fail and propagate the error.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/libahci_platform.c