aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2006-12-12 12:18:28 -0500
committerJean Delvare <khali@arrakis.delvare>2006-12-12 12:18:28 -0500
commit509a5e85c3a8f0a81c916fac4579b6d1b5ea58da (patch)
treed15ee83a0a5fdfd534b3d2cdc1e708b54c2a4da2 /drivers/hwmon
parent3d7f9a8697ffe76e9edaf6b1751f2a2db660e4d5 (diff)
hwmon/hdaps: Move the DMI detection data to .data
Move the DMI detection data from .text to .data. We really don't want that amount of data on the stack. Also refactor the macros used to generate the detection data, the vendor becomes a parameter. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Robert Love <rlove@rlove.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/hdaps.c68
1 files changed, 29 insertions, 39 deletions
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index e8ef62b83d6b..0b11698fe566 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -478,74 +478,64 @@ static struct attribute_group hdaps_attribute_group = {
478/* Module stuff */ 478/* Module stuff */
479 479
480/* hdaps_dmi_match - found a match. return one, short-circuiting the hunt. */ 480/* hdaps_dmi_match - found a match. return one, short-circuiting the hunt. */
481static int hdaps_dmi_match(struct dmi_system_id *id) 481static int __init hdaps_dmi_match(struct dmi_system_id *id)
482{ 482{
483 printk(KERN_INFO "hdaps: %s detected.\n", id->ident); 483 printk(KERN_INFO "hdaps: %s detected.\n", id->ident);
484 return 1; 484 return 1;
485} 485}
486 486
487/* hdaps_dmi_match_invert - found an inverted match. */ 487/* hdaps_dmi_match_invert - found an inverted match. */
488static int hdaps_dmi_match_invert(struct dmi_system_id *id) 488static int __init hdaps_dmi_match_invert(struct dmi_system_id *id)
489{ 489{
490 hdaps_invert = 1; 490 hdaps_invert = 1;
491 printk(KERN_INFO "hdaps: inverting axis readings.\n"); 491 printk(KERN_INFO "hdaps: inverting axis readings.\n");
492 return hdaps_dmi_match(id); 492 return hdaps_dmi_match(id);
493} 493}
494 494
495#define HDAPS_DMI_MATCH_NORMAL(model) { \ 495#define HDAPS_DMI_MATCH_NORMAL(vendor, model) { \
496 .ident = "IBM " model, \ 496 .ident = vendor " " model, \
497 .callback = hdaps_dmi_match, \ 497 .callback = hdaps_dmi_match, \
498 .matches = { \ 498 .matches = { \
499 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), \ 499 DMI_MATCH(DMI_BOARD_VENDOR, vendor), \
500 DMI_MATCH(DMI_PRODUCT_VERSION, model) \ 500 DMI_MATCH(DMI_PRODUCT_VERSION, model) \
501 } \ 501 } \
502} 502}
503 503
504#define HDAPS_DMI_MATCH_INVERT(model) { \ 504#define HDAPS_DMI_MATCH_INVERT(vendor, model) { \
505 .ident = "IBM " model, \ 505 .ident = vendor " " model, \
506 .callback = hdaps_dmi_match_invert, \ 506 .callback = hdaps_dmi_match_invert, \
507 .matches = { \ 507 .matches = { \
508 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), \ 508 DMI_MATCH(DMI_BOARD_VENDOR, vendor), \
509 DMI_MATCH(DMI_PRODUCT_VERSION, model) \ 509 DMI_MATCH(DMI_PRODUCT_VERSION, model) \
510 } \ 510 } \
511} 511}
512 512
513#define HDAPS_DMI_MATCH_LENOVO(model) { \ 513/* Note that HDAPS_DMI_MATCH_NORMAL("ThinkPad T42") would match
514 .ident = "Lenovo " model, \ 514 "ThinkPad T42p", so the order of the entries matters */
515 .callback = hdaps_dmi_match_invert, \ 515static struct dmi_system_id __initdata hdaps_whitelist[] = {
516 .matches = { \ 516 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad H"),
517 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), \ 517 HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad R50p"),
518 DMI_MATCH(DMI_PRODUCT_VERSION, model) \ 518 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"),
519 } \ 519 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"),
520} 520 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R52"),
521 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad H"), /* R52 (1846AQG) */
522 HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p"),
523 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T41"),
524 HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p"),
525 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T42"),
526 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T43"),
527 HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T60"),
528 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad X40"),
529 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad X41"),
530 HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X60"),
531 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad Z60m"),
532 { .ident = NULL }
533};
521 534
522static int __init hdaps_init(void) 535static int __init hdaps_init(void)
523{ 536{
524 int ret; 537 int ret;
525 538
526 /* Note that HDAPS_DMI_MATCH_NORMAL("ThinkPad T42") would match
527 "ThinkPad T42p", so the order of the entries matters */
528 struct dmi_system_id hdaps_whitelist[] = {
529 HDAPS_DMI_MATCH_NORMAL("ThinkPad H"),
530 HDAPS_DMI_MATCH_INVERT("ThinkPad R50p"),
531 HDAPS_DMI_MATCH_NORMAL("ThinkPad R50"),
532 HDAPS_DMI_MATCH_NORMAL("ThinkPad R51"),
533 HDAPS_DMI_MATCH_NORMAL("ThinkPad R52"),
534 HDAPS_DMI_MATCH_NORMAL("ThinkPad H"), /* R52 (1846AQG) */
535 HDAPS_DMI_MATCH_INVERT("ThinkPad T41p"),
536 HDAPS_DMI_MATCH_NORMAL("ThinkPad T41"),
537 HDAPS_DMI_MATCH_INVERT("ThinkPad T42p"),
538 HDAPS_DMI_MATCH_NORMAL("ThinkPad T42"),
539 HDAPS_DMI_MATCH_NORMAL("ThinkPad T43"),
540 HDAPS_DMI_MATCH_LENOVO("ThinkPad T60p"),
541 HDAPS_DMI_MATCH_LENOVO("ThinkPad T60"),
542 HDAPS_DMI_MATCH_NORMAL("ThinkPad X40"),
543 HDAPS_DMI_MATCH_NORMAL("ThinkPad X41"),
544 HDAPS_DMI_MATCH_LENOVO("ThinkPad X60"),
545 HDAPS_DMI_MATCH_NORMAL("ThinkPad Z60m"),
546 { .ident = NULL }
547 };
548
549 if (!dmi_check_system(hdaps_whitelist)) { 539 if (!dmi_check_system(hdaps_whitelist)) {
550 printk(KERN_WARNING "hdaps: supported laptop not found!\n"); 540 printk(KERN_WARNING "hdaps: supported laptop not found!\n");
551 ret = -ENODEV; 541 ret = -ENODEV;