diff options
author | Ming Lei <ming.lei@canonical.com> | 2012-09-08 05:32:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-10 19:40:30 -0400 |
commit | cfe016b14e1ee106e906ddfe77d598a2b288d7d6 (patch) | |
tree | bd5de67d97a66269066df9509cea691e99a34605 /drivers | |
parent | ef4158c5634e3819f93499d598ca617c29307ffd (diff) |
firmware loader: fix compile warning when CONFIG_PM=n
This patch replaces the previous macro of CONFIG_PM with
CONFIG_PM_SLEEP becasue firmware cache is only used in
system sleep situations.
Also this patch fixes the below compile warning when
CONFIG_PM=n:
drivers/base/firmware_class.c:1147: warning: 'device_cache_fw_images'
defined but not used
drivers/base/firmware_class.c:1212: warning:
'device_uncache_fw_images_delay' defined but not used
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/firmware_class.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 95f6851b3010..6e210802c37b 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -96,7 +96,9 @@ struct firmware_cache { | |||
96 | /* firmware_buf instance will be added into the below list */ | 96 | /* firmware_buf instance will be added into the below list */ |
97 | spinlock_t lock; | 97 | spinlock_t lock; |
98 | struct list_head head; | 98 | struct list_head head; |
99 | int state; | ||
99 | 100 | ||
101 | #ifdef CONFIG_PM_SLEEP | ||
100 | /* | 102 | /* |
101 | * Names of firmware images which have been cached successfully | 103 | * Names of firmware images which have been cached successfully |
102 | * will be added into the below list so that device uncache | 104 | * will be added into the below list so that device uncache |
@@ -106,13 +108,12 @@ struct firmware_cache { | |||
106 | spinlock_t name_lock; | 108 | spinlock_t name_lock; |
107 | struct list_head fw_names; | 109 | struct list_head fw_names; |
108 | 110 | ||
109 | int state; | ||
110 | |||
111 | wait_queue_head_t wait_queue; | 111 | wait_queue_head_t wait_queue; |
112 | int cnt; | 112 | int cnt; |
113 | struct delayed_work work; | 113 | struct delayed_work work; |
114 | 114 | ||
115 | struct notifier_block pm_notify; | 115 | struct notifier_block pm_notify; |
116 | #endif | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | struct firmware_buf { | 119 | struct firmware_buf { |
@@ -622,6 +623,7 @@ static void fw_set_page_data(struct firmware_buf *buf, struct firmware *fw) | |||
622 | (unsigned int)buf->size); | 623 | (unsigned int)buf->size); |
623 | } | 624 | } |
624 | 625 | ||
626 | #ifdef CONFIG_PM_SLEEP | ||
625 | static void fw_name_devm_release(struct device *dev, void *res) | 627 | static void fw_name_devm_release(struct device *dev, void *res) |
626 | { | 628 | { |
627 | struct fw_name_devm *fwn = res; | 629 | struct fw_name_devm *fwn = res; |
@@ -670,6 +672,12 @@ static int fw_add_devm_name(struct device *dev, const char *name) | |||
670 | 672 | ||
671 | return 0; | 673 | return 0; |
672 | } | 674 | } |
675 | #else | ||
676 | static int fw_add_devm_name(struct device *dev, const char *name) | ||
677 | { | ||
678 | return 0; | ||
679 | } | ||
680 | #endif | ||
673 | 681 | ||
674 | static void _request_firmware_cleanup(const struct firmware **firmware_p) | 682 | static void _request_firmware_cleanup(const struct firmware **firmware_p) |
675 | { | 683 | { |
@@ -1046,6 +1054,7 @@ int uncache_firmware(const char *fw_name) | |||
1046 | return -EINVAL; | 1054 | return -EINVAL; |
1047 | } | 1055 | } |
1048 | 1056 | ||
1057 | #ifdef CONFIG_PM_SLEEP | ||
1049 | static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) | 1058 | static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) |
1050 | { | 1059 | { |
1051 | struct fw_cache_entry *fce; | 1060 | struct fw_cache_entry *fce; |
@@ -1258,7 +1267,6 @@ static void device_uncache_fw_images_delay(unsigned long delay) | |||
1258 | msecs_to_jiffies(delay)); | 1267 | msecs_to_jiffies(delay)); |
1259 | } | 1268 | } |
1260 | 1269 | ||
1261 | #ifdef CONFIG_PM | ||
1262 | static int fw_pm_notify(struct notifier_block *notify_block, | 1270 | static int fw_pm_notify(struct notifier_block *notify_block, |
1263 | unsigned long mode, void *unused) | 1271 | unsigned long mode, void *unused) |
1264 | { | 1272 | { |
@@ -1285,13 +1293,6 @@ static int fw_pm_notify(struct notifier_block *notify_block, | |||
1285 | 1293 | ||
1286 | return 0; | 1294 | return 0; |
1287 | } | 1295 | } |
1288 | #else | ||
1289 | static int fw_pm_notify(struct notifier_block *notify_block, | ||
1290 | unsigned long mode, void *unused) | ||
1291 | { | ||
1292 | return 0; | ||
1293 | } | ||
1294 | #endif | ||
1295 | 1296 | ||
1296 | /* stop caching firmware once syscore_suspend is reached */ | 1297 | /* stop caching firmware once syscore_suspend is reached */ |
1297 | static int fw_suspend(void) | 1298 | static int fw_suspend(void) |
@@ -1303,16 +1304,23 @@ static int fw_suspend(void) | |||
1303 | static struct syscore_ops fw_syscore_ops = { | 1304 | static struct syscore_ops fw_syscore_ops = { |
1304 | .suspend = fw_suspend, | 1305 | .suspend = fw_suspend, |
1305 | }; | 1306 | }; |
1307 | #else | ||
1308 | static int fw_cache_piggyback_on_request(const char *name) | ||
1309 | { | ||
1310 | return 0; | ||
1311 | } | ||
1312 | #endif | ||
1306 | 1313 | ||
1307 | static void __init fw_cache_init(void) | 1314 | static void __init fw_cache_init(void) |
1308 | { | 1315 | { |
1309 | spin_lock_init(&fw_cache.lock); | 1316 | spin_lock_init(&fw_cache.lock); |
1310 | INIT_LIST_HEAD(&fw_cache.head); | 1317 | INIT_LIST_HEAD(&fw_cache.head); |
1318 | fw_cache.state = FW_LOADER_NO_CACHE; | ||
1311 | 1319 | ||
1320 | #ifdef CONFIG_PM_SLEEP | ||
1312 | spin_lock_init(&fw_cache.name_lock); | 1321 | spin_lock_init(&fw_cache.name_lock); |
1313 | INIT_LIST_HEAD(&fw_cache.fw_names); | 1322 | INIT_LIST_HEAD(&fw_cache.fw_names); |
1314 | fw_cache.cnt = 0; | 1323 | fw_cache.cnt = 0; |
1315 | fw_cache.state = FW_LOADER_NO_CACHE; | ||
1316 | 1324 | ||
1317 | init_waitqueue_head(&fw_cache.wait_queue); | 1325 | init_waitqueue_head(&fw_cache.wait_queue); |
1318 | INIT_DELAYED_WORK(&fw_cache.work, | 1326 | INIT_DELAYED_WORK(&fw_cache.work, |
@@ -1322,6 +1330,7 @@ static void __init fw_cache_init(void) | |||
1322 | register_pm_notifier(&fw_cache.pm_notify); | 1330 | register_pm_notifier(&fw_cache.pm_notify); |
1323 | 1331 | ||
1324 | register_syscore_ops(&fw_syscore_ops); | 1332 | register_syscore_ops(&fw_syscore_ops); |
1333 | #endif | ||
1325 | } | 1334 | } |
1326 | 1335 | ||
1327 | static int __init firmware_class_init(void) | 1336 | static int __init firmware_class_init(void) |
@@ -1332,8 +1341,10 @@ static int __init firmware_class_init(void) | |||
1332 | 1341 | ||
1333 | static void __exit firmware_class_exit(void) | 1342 | static void __exit firmware_class_exit(void) |
1334 | { | 1343 | { |
1344 | #ifdef CONFIG_PM_SLEEP | ||
1335 | unregister_syscore_ops(&fw_syscore_ops); | 1345 | unregister_syscore_ops(&fw_syscore_ops); |
1336 | unregister_pm_notifier(&fw_cache.pm_notify); | 1346 | unregister_pm_notifier(&fw_cache.pm_notify); |
1347 | #endif | ||
1337 | class_unregister(&firmware_class); | 1348 | class_unregister(&firmware_class); |
1338 | } | 1349 | } |
1339 | 1350 | ||