diff options
54 files changed, 568 insertions, 500 deletions
diff --git a/arch/powerpc/kernel/mpc7450-pmu.c b/arch/powerpc/kernel/mpc7450-pmu.c index c244133c67a..cc466d039af 100644 --- a/arch/powerpc/kernel/mpc7450-pmu.c +++ b/arch/powerpc/kernel/mpc7450-pmu.c | |||
@@ -407,7 +407,8 @@ struct power_pmu mpc7450_pmu = { | |||
407 | 407 | ||
408 | static int init_mpc7450_pmu(void) | 408 | static int init_mpc7450_pmu(void) |
409 | { | 409 | { |
410 | if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc/7450")) | 410 | if (!cur_cpu_spec->oprofile_cpu_type || |
411 | strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc/7450")) | ||
411 | return -ENODEV; | 412 | return -ENODEV; |
412 | 413 | ||
413 | return register_power_pmu(&mpc7450_pmu); | 414 | return register_power_pmu(&mpc7450_pmu); |
diff --git a/arch/powerpc/kernel/power4-pmu.c b/arch/powerpc/kernel/power4-pmu.c index db90b0c5c27..3c90a3d9173 100644 --- a/arch/powerpc/kernel/power4-pmu.c +++ b/arch/powerpc/kernel/power4-pmu.c | |||
@@ -606,7 +606,8 @@ static struct power_pmu power4_pmu = { | |||
606 | 606 | ||
607 | static int init_power4_pmu(void) | 607 | static int init_power4_pmu(void) |
608 | { | 608 | { |
609 | if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power4")) | 609 | if (!cur_cpu_spec->oprofile_cpu_type || |
610 | strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power4")) | ||
610 | return -ENODEV; | 611 | return -ENODEV; |
611 | 612 | ||
612 | return register_power_pmu(&power4_pmu); | 613 | return register_power_pmu(&power4_pmu); |
diff --git a/arch/powerpc/kernel/power5+-pmu.c b/arch/powerpc/kernel/power5+-pmu.c index f4adca8e98a..31918af3e35 100644 --- a/arch/powerpc/kernel/power5+-pmu.c +++ b/arch/powerpc/kernel/power5+-pmu.c | |||
@@ -678,8 +678,9 @@ static struct power_pmu power5p_pmu = { | |||
678 | 678 | ||
679 | static int init_power5p_pmu(void) | 679 | static int init_power5p_pmu(void) |
680 | { | 680 | { |
681 | if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5+") | 681 | if (!cur_cpu_spec->oprofile_cpu_type || |
682 | && strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5++")) | 682 | (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5+") |
683 | && strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5++"))) | ||
683 | return -ENODEV; | 684 | return -ENODEV; |
684 | 685 | ||
685 | return register_power_pmu(&power5p_pmu); | 686 | return register_power_pmu(&power5p_pmu); |
diff --git a/arch/powerpc/kernel/power5-pmu.c b/arch/powerpc/kernel/power5-pmu.c index 29b2c6c0e83..867f6f66396 100644 --- a/arch/powerpc/kernel/power5-pmu.c +++ b/arch/powerpc/kernel/power5-pmu.c | |||
@@ -618,7 +618,8 @@ static struct power_pmu power5_pmu = { | |||
618 | 618 | ||
619 | static int init_power5_pmu(void) | 619 | static int init_power5_pmu(void) |
620 | { | 620 | { |
621 | if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5")) | 621 | if (!cur_cpu_spec->oprofile_cpu_type || |
622 | strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5")) | ||
622 | return -ENODEV; | 623 | return -ENODEV; |
623 | 624 | ||
624 | return register_power_pmu(&power5_pmu); | 625 | return register_power_pmu(&power5_pmu); |
diff --git a/arch/powerpc/kernel/power6-pmu.c b/arch/powerpc/kernel/power6-pmu.c index 09ae5bf5bda..fa21890531d 100644 --- a/arch/powerpc/kernel/power6-pmu.c +++ b/arch/powerpc/kernel/power6-pmu.c | |||
@@ -537,7 +537,8 @@ static struct power_pmu power6_pmu = { | |||
537 | 537 | ||
538 | static int init_power6_pmu(void) | 538 | static int init_power6_pmu(void) |
539 | { | 539 | { |
540 | if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power6")) | 540 | if (!cur_cpu_spec->oprofile_cpu_type || |
541 | strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power6")) | ||
541 | return -ENODEV; | 542 | return -ENODEV; |
542 | 543 | ||
543 | return register_power_pmu(&power6_pmu); | 544 | return register_power_pmu(&power6_pmu); |
diff --git a/arch/powerpc/kernel/power7-pmu.c b/arch/powerpc/kernel/power7-pmu.c index 5a9f5cbd40a..388cf57ad82 100644 --- a/arch/powerpc/kernel/power7-pmu.c +++ b/arch/powerpc/kernel/power7-pmu.c | |||
@@ -366,7 +366,8 @@ static struct power_pmu power7_pmu = { | |||
366 | 366 | ||
367 | static int init_power7_pmu(void) | 367 | static int init_power7_pmu(void) |
368 | { | 368 | { |
369 | if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power7")) | 369 | if (!cur_cpu_spec->oprofile_cpu_type || |
370 | strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power7")) | ||
370 | return -ENODEV; | 371 | return -ENODEV; |
371 | 372 | ||
372 | return register_power_pmu(&power7_pmu); | 373 | return register_power_pmu(&power7_pmu); |
diff --git a/arch/powerpc/kernel/ppc970-pmu.c b/arch/powerpc/kernel/ppc970-pmu.c index 833097ac45d..75dccb71a04 100644 --- a/arch/powerpc/kernel/ppc970-pmu.c +++ b/arch/powerpc/kernel/ppc970-pmu.c | |||
@@ -488,8 +488,9 @@ static struct power_pmu ppc970_pmu = { | |||
488 | 488 | ||
489 | static int init_ppc970_pmu(void) | 489 | static int init_ppc970_pmu(void) |
490 | { | 490 | { |
491 | if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/970") | 491 | if (!cur_cpu_spec->oprofile_cpu_type || |
492 | && strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/970MP")) | 492 | (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/970") |
493 | && strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/970MP"))) | ||
493 | return -ENODEV; | 494 | return -ENODEV; |
494 | 495 | ||
495 | return register_power_pmu(&ppc970_pmu); | 496 | return register_power_pmu(&ppc970_pmu); |
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c index 146f3570af8..20f17908b03 100644 --- a/drivers/gpu/drm/radeon/r600_cp.c +++ b/drivers/gpu/drm/radeon/r600_cp.c | |||
@@ -384,8 +384,9 @@ static void r600_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
384 | DRM_INFO("Loading RV670 PFP Microcode\n"); | 384 | DRM_INFO("Loading RV670 PFP Microcode\n"); |
385 | for (i = 0; i < PFP_UCODE_SIZE; i++) | 385 | for (i = 0; i < PFP_UCODE_SIZE; i++) |
386 | RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV670_pfp_microcode[i]); | 386 | RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV670_pfp_microcode[i]); |
387 | } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) { | 387 | } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || |
388 | DRM_INFO("Loading RS780 CP Microcode\n"); | 388 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880)) { |
389 | DRM_INFO("Loading RS780/RS880 CP Microcode\n"); | ||
389 | for (i = 0; i < PM4_UCODE_SIZE; i++) { | 390 | for (i = 0; i < PM4_UCODE_SIZE; i++) { |
390 | RADEON_WRITE(R600_CP_ME_RAM_DATA, | 391 | RADEON_WRITE(R600_CP_ME_RAM_DATA, |
391 | RS780_cp_microcode[i][0]); | 392 | RS780_cp_microcode[i][0]); |
@@ -396,7 +397,7 @@ static void r600_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
396 | } | 397 | } |
397 | 398 | ||
398 | RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); | 399 | RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); |
399 | DRM_INFO("Loading RS780 PFP Microcode\n"); | 400 | DRM_INFO("Loading RS780/RS880 PFP Microcode\n"); |
400 | for (i = 0; i < PFP_UCODE_SIZE; i++) | 401 | for (i = 0; i < PFP_UCODE_SIZE; i++) |
401 | RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RS780_pfp_microcode[i]); | 402 | RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RS780_pfp_microcode[i]); |
402 | } | 403 | } |
@@ -783,6 +784,7 @@ static void r600_gfx_init(struct drm_device *dev, | |||
783 | break; | 784 | break; |
784 | case CHIP_RV610: | 785 | case CHIP_RV610: |
785 | case CHIP_RS780: | 786 | case CHIP_RS780: |
787 | case CHIP_RS880: | ||
786 | case CHIP_RV620: | 788 | case CHIP_RV620: |
787 | dev_priv->r600_max_pipes = 1; | 789 | dev_priv->r600_max_pipes = 1; |
788 | dev_priv->r600_max_tile_pipes = 1; | 790 | dev_priv->r600_max_tile_pipes = 1; |
@@ -917,7 +919,8 @@ static void r600_gfx_init(struct drm_device *dev, | |||
917 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV630) || | 919 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV630) || |
918 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || | 920 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || |
919 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || | 921 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || |
920 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) | 922 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || |
923 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880)) | ||
921 | RADEON_WRITE(R600_DB_DEBUG, R600_PREZ_MUST_WAIT_FOR_POSTZ_DONE); | 924 | RADEON_WRITE(R600_DB_DEBUG, R600_PREZ_MUST_WAIT_FOR_POSTZ_DONE); |
922 | else | 925 | else |
923 | RADEON_WRITE(R600_DB_DEBUG, 0); | 926 | RADEON_WRITE(R600_DB_DEBUG, 0); |
@@ -935,7 +938,8 @@ static void r600_gfx_init(struct drm_device *dev, | |||
935 | sq_ms_fifo_sizes = RADEON_READ(R600_SQ_MS_FIFO_SIZES); | 938 | sq_ms_fifo_sizes = RADEON_READ(R600_SQ_MS_FIFO_SIZES); |
936 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || | 939 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || |
937 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || | 940 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || |
938 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) { | 941 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || |
942 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880)) { | ||
939 | sq_ms_fifo_sizes = (R600_CACHE_FIFO_SIZE(0xa) | | 943 | sq_ms_fifo_sizes = (R600_CACHE_FIFO_SIZE(0xa) | |
940 | R600_FETCH_FIFO_HIWATER(0xa) | | 944 | R600_FETCH_FIFO_HIWATER(0xa) | |
941 | R600_DONE_FIFO_HIWATER(0xe0) | | 945 | R600_DONE_FIFO_HIWATER(0xe0) | |
@@ -978,7 +982,8 @@ static void r600_gfx_init(struct drm_device *dev, | |||
978 | R600_NUM_ES_STACK_ENTRIES(0)); | 982 | R600_NUM_ES_STACK_ENTRIES(0)); |
979 | } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || | 983 | } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || |
980 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || | 984 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || |
981 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) { | 985 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || |
986 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880)) { | ||
982 | /* no vertex cache */ | 987 | /* no vertex cache */ |
983 | sq_config &= ~R600_VC_ENABLE; | 988 | sq_config &= ~R600_VC_ENABLE; |
984 | 989 | ||
@@ -1035,7 +1040,8 @@ static void r600_gfx_init(struct drm_device *dev, | |||
1035 | 1040 | ||
1036 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || | 1041 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || |
1037 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || | 1042 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || |
1038 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) | 1043 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || |
1044 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880)) | ||
1039 | RADEON_WRITE(R600_VGT_CACHE_INVALIDATION, R600_CACHE_INVALIDATION(R600_TC_ONLY)); | 1045 | RADEON_WRITE(R600_VGT_CACHE_INVALIDATION, R600_CACHE_INVALIDATION(R600_TC_ONLY)); |
1040 | else | 1046 | else |
1041 | RADEON_WRITE(R600_VGT_CACHE_INVALIDATION, R600_CACHE_INVALIDATION(R600_VC_AND_TC)); | 1047 | RADEON_WRITE(R600_VGT_CACHE_INVALIDATION, R600_CACHE_INVALIDATION(R600_VC_AND_TC)); |
@@ -1078,6 +1084,7 @@ static void r600_gfx_init(struct drm_device *dev, | |||
1078 | break; | 1084 | break; |
1079 | case CHIP_RV610: | 1085 | case CHIP_RV610: |
1080 | case CHIP_RS780: | 1086 | case CHIP_RS780: |
1087 | case CHIP_RS880: | ||
1081 | case CHIP_RV620: | 1088 | case CHIP_RV620: |
1082 | gs_prim_buffer_depth = 32; | 1089 | gs_prim_buffer_depth = 32; |
1083 | break; | 1090 | break; |
@@ -1123,6 +1130,7 @@ static void r600_gfx_init(struct drm_device *dev, | |||
1123 | switch (dev_priv->flags & RADEON_FAMILY_MASK) { | 1130 | switch (dev_priv->flags & RADEON_FAMILY_MASK) { |
1124 | case CHIP_RV610: | 1131 | case CHIP_RV610: |
1125 | case CHIP_RS780: | 1132 | case CHIP_RS780: |
1133 | case CHIP_RS880: | ||
1126 | case CHIP_RV620: | 1134 | case CHIP_RV620: |
1127 | tc_cntl = R600_TC_L2_SIZE(8); | 1135 | tc_cntl = R600_TC_L2_SIZE(8); |
1128 | break; | 1136 | break; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index a162ade74b7..9ff6dcb97f9 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -152,7 +152,9 @@ int radeon_mc_setup(struct radeon_device *rdev) | |||
152 | } | 152 | } |
153 | } else { | 153 | } else { |
154 | rdev->mc.vram_location = 0; | 154 | rdev->mc.vram_location = 0; |
155 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; | 155 | tmp = rdev->mc.mc_vram_size; |
156 | tmp = (tmp + rdev->mc.gtt_size - 1) & ~(rdev->mc.gtt_size - 1); | ||
157 | rdev->mc.gtt_location = tmp; | ||
156 | } | 158 | } |
157 | DRM_INFO("radeon: VRAM %uM\n", rdev->mc.real_vram_size >> 20); | 159 | DRM_INFO("radeon: VRAM %uM\n", rdev->mc.real_vram_size >> 20); |
158 | DRM_INFO("radeon: VRAM from 0x%08X to 0x%08X\n", | 160 | DRM_INFO("radeon: VRAM from 0x%08X to 0x%08X\n", |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h index 127d0456f62..3933f8216a3 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.h +++ b/drivers/gpu/drm/radeon/radeon_drv.h | |||
@@ -143,6 +143,7 @@ enum radeon_family { | |||
143 | CHIP_RV635, | 143 | CHIP_RV635, |
144 | CHIP_RV670, | 144 | CHIP_RV670, |
145 | CHIP_RS780, | 145 | CHIP_RS780, |
146 | CHIP_RS880, | ||
146 | CHIP_RV770, | 147 | CHIP_RV770, |
147 | CHIP_RV730, | 148 | CHIP_RV730, |
148 | CHIP_RV710, | 149 | CHIP_RV710, |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index dd9ac2fed6d..e98cae3bf4a 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -106,7 +106,7 @@ static inline uint32_t radeon_object_flags_from_domain(uint32_t domain) | |||
106 | flags |= TTM_PL_FLAG_VRAM | TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED; | 106 | flags |= TTM_PL_FLAG_VRAM | TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED; |
107 | } | 107 | } |
108 | if (domain & RADEON_GEM_DOMAIN_GTT) { | 108 | if (domain & RADEON_GEM_DOMAIN_GTT) { |
109 | flags |= TTM_PL_FLAG_TT | TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED; | 109 | flags |= TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING; |
110 | } | 110 | } |
111 | if (domain & RADEON_GEM_DOMAIN_CPU) { | 111 | if (domain & RADEON_GEM_DOMAIN_CPU) { |
112 | flags |= TTM_PL_FLAG_SYSTEM | TTM_PL_MASK_CACHING; | 112 | flags |= TTM_PL_FLAG_SYSTEM | TTM_PL_MASK_CACHING; |
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index e9b2e7cb05b..541b981ff07 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -27,6 +27,7 @@ struct matrix_keypad { | |||
27 | const struct matrix_keypad_platform_data *pdata; | 27 | const struct matrix_keypad_platform_data *pdata; |
28 | struct input_dev *input_dev; | 28 | struct input_dev *input_dev; |
29 | unsigned short *keycodes; | 29 | unsigned short *keycodes; |
30 | unsigned int row_shift; | ||
30 | 31 | ||
31 | uint32_t last_key_state[MATRIX_MAX_COLS]; | 32 | uint32_t last_key_state[MATRIX_MAX_COLS]; |
32 | struct delayed_work work; | 33 | struct delayed_work work; |
@@ -136,7 +137,7 @@ static void matrix_keypad_scan(struct work_struct *work) | |||
136 | if ((bits_changed & (1 << row)) == 0) | 137 | if ((bits_changed & (1 << row)) == 0) |
137 | continue; | 138 | continue; |
138 | 139 | ||
139 | code = (row << 4) + col; | 140 | code = MATRIX_SCAN_CODE(row, col, keypad->row_shift); |
140 | input_event(input_dev, EV_MSC, MSC_SCAN, code); | 141 | input_event(input_dev, EV_MSC, MSC_SCAN, code); |
141 | input_report_key(input_dev, | 142 | input_report_key(input_dev, |
142 | keypad->keycodes[code], | 143 | keypad->keycodes[code], |
@@ -317,6 +318,7 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev) | |||
317 | struct matrix_keypad *keypad; | 318 | struct matrix_keypad *keypad; |
318 | struct input_dev *input_dev; | 319 | struct input_dev *input_dev; |
319 | unsigned short *keycodes; | 320 | unsigned short *keycodes; |
321 | unsigned int row_shift; | ||
320 | int i; | 322 | int i; |
321 | int err; | 323 | int err; |
322 | 324 | ||
@@ -332,14 +334,11 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev) | |||
332 | return -EINVAL; | 334 | return -EINVAL; |
333 | } | 335 | } |
334 | 336 | ||
335 | if (!keymap_data->max_keymap_size) { | 337 | row_shift = get_count_order(pdata->num_col_gpios); |
336 | dev_err(&pdev->dev, "invalid keymap data supplied\n"); | ||
337 | return -EINVAL; | ||
338 | } | ||
339 | 338 | ||
340 | keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL); | 339 | keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL); |
341 | keycodes = kzalloc(keymap_data->max_keymap_size * | 340 | keycodes = kzalloc((pdata->num_row_gpios << row_shift) * |
342 | sizeof(keypad->keycodes), | 341 | sizeof(*keycodes), |
343 | GFP_KERNEL); | 342 | GFP_KERNEL); |
344 | input_dev = input_allocate_device(); | 343 | input_dev = input_allocate_device(); |
345 | if (!keypad || !keycodes || !input_dev) { | 344 | if (!keypad || !keycodes || !input_dev) { |
@@ -350,6 +349,7 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev) | |||
350 | keypad->input_dev = input_dev; | 349 | keypad->input_dev = input_dev; |
351 | keypad->pdata = pdata; | 350 | keypad->pdata = pdata; |
352 | keypad->keycodes = keycodes; | 351 | keypad->keycodes = keycodes; |
352 | keypad->row_shift = row_shift; | ||
353 | keypad->stopped = true; | 353 | keypad->stopped = true; |
354 | INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan); | 354 | INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan); |
355 | spin_lock_init(&keypad->lock); | 355 | spin_lock_init(&keypad->lock); |
@@ -363,7 +363,7 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev) | |||
363 | 363 | ||
364 | input_dev->keycode = keycodes; | 364 | input_dev->keycode = keycodes; |
365 | input_dev->keycodesize = sizeof(*keycodes); | 365 | input_dev->keycodesize = sizeof(*keycodes); |
366 | input_dev->keycodemax = keymap_data->max_keymap_size; | 366 | input_dev->keycodemax = pdata->num_row_gpios << keypad->row_shift; |
367 | 367 | ||
368 | for (i = 0; i < keymap_data->keymap_size; i++) { | 368 | for (i = 0; i < keymap_data->keymap_size; i++) { |
369 | unsigned int key = keymap_data->keymap[i]; | 369 | unsigned int key = keymap_data->keymap[i]; |
@@ -371,7 +371,7 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev) | |||
371 | unsigned int col = KEY_COL(key); | 371 | unsigned int col = KEY_COL(key); |
372 | unsigned short code = KEY_VAL(key); | 372 | unsigned short code = KEY_VAL(key); |
373 | 373 | ||
374 | keycodes[(row << 4) + col] = code; | 374 | keycodes[MATRIX_SCAN_CODE(row, col, row_shift)] = code; |
375 | __set_bit(code, input_dev->keybit); | 375 | __set_bit(code, input_dev->keybit); |
376 | } | 376 | } |
377 | __clear_bit(KEY_RESERVED, input_dev->keybit); | 377 | __clear_bit(KEY_RESERVED, input_dev->keybit); |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 26e17a9a22e..27ee976eb54 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -611,6 +611,20 @@ static struct key_entry keymap_wistron_generic[] __initdata = { | |||
611 | { KE_END, 0 } | 611 | { KE_END, 0 } |
612 | }; | 612 | }; |
613 | 613 | ||
614 | static struct key_entry keymap_prestigio[] __initdata = { | ||
615 | { KE_KEY, 0x11, {KEY_PROG1} }, | ||
616 | { KE_KEY, 0x12, {KEY_PROG2} }, | ||
617 | { KE_WIFI, 0x30 }, | ||
618 | { KE_KEY, 0x22, {KEY_REWIND} }, | ||
619 | { KE_KEY, 0x23, {KEY_FORWARD} }, | ||
620 | { KE_KEY, 0x24, {KEY_PLAYPAUSE} }, | ||
621 | { KE_KEY, 0x25, {KEY_STOPCD} }, | ||
622 | { KE_KEY, 0x31, {KEY_MAIL} }, | ||
623 | { KE_KEY, 0x36, {KEY_WWW} }, | ||
624 | { KE_END, 0 } | ||
625 | }; | ||
626 | |||
627 | |||
614 | /* | 628 | /* |
615 | * If your machine is not here (which is currently rather likely), please send | 629 | * If your machine is not here (which is currently rather likely), please send |
616 | * a list of buttons and their key codes (reported when loading this module | 630 | * a list of buttons and their key codes (reported when loading this module |
@@ -971,6 +985,8 @@ static int __init select_keymap(void) | |||
971 | if (keymap_name != NULL) { | 985 | if (keymap_name != NULL) { |
972 | if (strcmp (keymap_name, "1557/MS2141") == 0) | 986 | if (strcmp (keymap_name, "1557/MS2141") == 0) |
973 | keymap = keymap_wistron_ms2141; | 987 | keymap = keymap_wistron_ms2141; |
988 | else if (strcmp (keymap_name, "prestigio") == 0) | ||
989 | keymap = keymap_prestigio; | ||
974 | else if (strcmp (keymap_name, "generic") == 0) | 990 | else if (strcmp (keymap_name, "generic") == 0) |
975 | keymap = keymap_wistron_generic; | 991 | keymap = keymap_wistron_generic; |
976 | else { | 992 | else { |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 924e8ed7f2c..ae04d8a494e 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -78,6 +78,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { | |||
78 | }, | 78 | }, |
79 | }, | 79 | }, |
80 | { | 80 | { |
81 | .ident = "ASUS G1S", | ||
82 | .matches = { | ||
83 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."), | ||
84 | DMI_MATCH(DMI_BOARD_NAME, "G1S"), | ||
85 | DMI_MATCH(DMI_BOARD_VERSION, "1.0"), | ||
86 | }, | ||
87 | }, | ||
88 | { | ||
81 | /* AUX LOOP command does not raise AUX IRQ */ | 89 | /* AUX LOOP command does not raise AUX IRQ */ |
82 | .ident = "ASUS P65UP5", | 90 | .ident = "ASUS P65UP5", |
83 | .matches = { | 91 | .matches = { |
diff --git a/drivers/mmc/host/sdhci-of.c b/drivers/mmc/host/sdhci-of.c index 908844327db..1e8aa590bb3 100644 --- a/drivers/mmc/host/sdhci-of.c +++ b/drivers/mmc/host/sdhci-of.c | |||
@@ -234,7 +234,7 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev, | |||
234 | return -ENODEV; | 234 | return -ENODEV; |
235 | 235 | ||
236 | host = sdhci_alloc_host(&ofdev->dev, sizeof(*of_host)); | 236 | host = sdhci_alloc_host(&ofdev->dev, sizeof(*of_host)); |
237 | if (!host) | 237 | if (IS_ERR(host)) |
238 | return -ENOMEM; | 238 | return -ENOMEM; |
239 | 239 | ||
240 | of_host = sdhci_priv(host); | 240 | of_host = sdhci_priv(host); |
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 0b98654d8ee..7a58bd5522f 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -284,13 +284,6 @@ config MTD_L440GX | |||
284 | 284 | ||
285 | BE VERY CAREFUL. | 285 | BE VERY CAREFUL. |
286 | 286 | ||
287 | config MTD_SBC8240 | ||
288 | tristate "Flash device on SBC8240" | ||
289 | depends on MTD_JEDECPROBE && 8260 | ||
290 | help | ||
291 | Flash access on the SBC8240 board from Wind River. See | ||
292 | <http://www.windriver.com/products/sbc8240/> | ||
293 | |||
294 | config MTD_TQM8XXL | 287 | config MTD_TQM8XXL |
295 | tristate "CFI Flash device mapped on TQM8XXL" | 288 | tristate "CFI Flash device mapped on TQM8XXL" |
296 | depends on MTD_CFI && TQM8xxL | 289 | depends on MTD_CFI && TQM8xxL |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 8bae7f9850c..5beb0662d72 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
@@ -50,7 +50,6 @@ obj-$(CONFIG_MTD_UCLINUX) += uclinux.o | |||
50 | obj-$(CONFIG_MTD_NETtel) += nettel.o | 50 | obj-$(CONFIG_MTD_NETtel) += nettel.o |
51 | obj-$(CONFIG_MTD_SCB2_FLASH) += scb2_flash.o | 51 | obj-$(CONFIG_MTD_SCB2_FLASH) += scb2_flash.o |
52 | obj-$(CONFIG_MTD_H720X) += h720x-flash.o | 52 | obj-$(CONFIG_MTD_H720X) += h720x-flash.o |
53 | obj-$(CONFIG_MTD_SBC8240) += sbc8240.o | ||
54 | obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o | 53 | obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o |
55 | obj-$(CONFIG_MTD_IXP2000) += ixp2000.o | 54 | obj-$(CONFIG_MTD_IXP2000) += ixp2000.o |
56 | obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o | 55 | obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o |
diff --git a/drivers/mtd/maps/sbc8240.c b/drivers/mtd/maps/sbc8240.c index d5374cdcb16..e69de29bb2d 100644 --- a/drivers/mtd/maps/sbc8240.c +++ b/drivers/mtd/maps/sbc8240.c | |||
@@ -1,250 +0,0 @@ | |||
1 | /* | ||
2 | * Handle mapping of the flash memory access routines on the SBC8240 board. | ||
3 | * | ||
4 | * Carolyn Smith, Tektronix, Inc. | ||
5 | * | ||
6 | * This code is GPLed | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * The SBC8240 has 2 flash banks. | ||
11 | * Bank 0 is a 512 KiB AMD AM29F040B; 8 x 64 KiB sectors. | ||
12 | * It contains the U-Boot code (7 sectors) and the environment (1 sector). | ||
13 | * Bank 1 is 4 x 1 MiB AMD AM29LV800BT; 15 x 64 KiB sectors, 1 x 32 KiB sector, | ||
14 | * 2 x 8 KiB sectors, 1 x 16 KiB sectors. | ||
15 | * Both parts are JEDEC compatible. | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <asm/io.h> | ||
22 | |||
23 | #include <linux/mtd/mtd.h> | ||
24 | #include <linux/mtd/map.h> | ||
25 | #include <linux/mtd/cfi.h> | ||
26 | |||
27 | #ifdef CONFIG_MTD_PARTITIONS | ||
28 | #include <linux/mtd/partitions.h> | ||
29 | #endif | ||
30 | |||
31 | #define DEBUG | ||
32 | |||
33 | #ifdef DEBUG | ||
34 | # define debugk(fmt,args...) printk(fmt ,##args) | ||
35 | #else | ||
36 | # define debugk(fmt,args...) | ||
37 | #endif | ||
38 | |||
39 | |||
40 | #define WINDOW_ADDR0 0xFFF00000 /* 512 KiB */ | ||
41 | #define WINDOW_SIZE0 0x00080000 | ||
42 | #define BUSWIDTH0 1 | ||
43 | |||
44 | #define WINDOW_ADDR1 0xFF000000 /* 4 MiB */ | ||
45 | #define WINDOW_SIZE1 0x00400000 | ||
46 | #define BUSWIDTH1 8 | ||
47 | |||
48 | #define MSG_PREFIX "sbc8240:" /* prefix for our printk()'s */ | ||
49 | #define MTDID "sbc8240-%d" /* for mtdparts= partitioning */ | ||
50 | |||
51 | |||
52 | static struct map_info sbc8240_map[2] = { | ||
53 | { | ||
54 | .name = "sbc8240 Flash Bank #0", | ||
55 | .size = WINDOW_SIZE0, | ||
56 | .bankwidth = BUSWIDTH0, | ||
57 | }, | ||
58 | { | ||
59 | .name = "sbc8240 Flash Bank #1", | ||
60 | .size = WINDOW_SIZE1, | ||
61 | .bankwidth = BUSWIDTH1, | ||
62 | } | ||
63 | }; | ||
64 | |||
65 | #define NUM_FLASH_BANKS ARRAY_SIZE(sbc8240_map) | ||
66 | |||
67 | /* | ||
68 | * The following defines the partition layout of SBC8240 boards. | ||
69 | * | ||
70 | * See include/linux/mtd/partitions.h for definition of the | ||
71 | * mtd_partition structure. | ||
72 | * | ||
73 | * The *_max_flash_size is the maximum possible mapped flash size | ||
74 | * which is not necessarily the actual flash size. It must correspond | ||
75 | * to the value specified in the mapping definition defined by the | ||
76 | * "struct map_desc *_io_desc" for the corresponding machine. | ||
77 | */ | ||
78 | |||
79 | #ifdef CONFIG_MTD_PARTITIONS | ||
80 | |||
81 | static struct mtd_partition sbc8240_uboot_partitions [] = { | ||
82 | /* Bank 0 */ | ||
83 | { | ||
84 | .name = "U-boot", /* U-Boot Firmware */ | ||
85 | .offset = 0, | ||
86 | .size = 0x00070000, /* 7 x 64 KiB sectors */ | ||
87 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
88 | }, | ||
89 | { | ||
90 | .name = "environment", /* U-Boot environment */ | ||
91 | .offset = 0x00070000, | ||
92 | .size = 0x00010000, /* 1 x 64 KiB sector */ | ||
93 | }, | ||
94 | }; | ||
95 | |||
96 | static struct mtd_partition sbc8240_fs_partitions [] = { | ||
97 | { | ||
98 | .name = "jffs", /* JFFS filesystem */ | ||
99 | .offset = 0, | ||
100 | .size = 0x003C0000, /* 4 * 15 * 64KiB */ | ||
101 | }, | ||
102 | { | ||
103 | .name = "tmp32", | ||
104 | .offset = 0x003C0000, | ||
105 | .size = 0x00020000, /* 4 * 32KiB */ | ||
106 | }, | ||
107 | { | ||
108 | .name = "tmp8a", | ||
109 | .offset = 0x003E0000, | ||
110 | .size = 0x00008000, /* 4 * 8KiB */ | ||
111 | }, | ||
112 | { | ||
113 | .name = "tmp8b", | ||
114 | .offset = 0x003E8000, | ||
115 | .size = 0x00008000, /* 4 * 8KiB */ | ||
116 | }, | ||
117 | { | ||
118 | .name = "tmp16", | ||
119 | .offset = 0x003F0000, | ||
120 | .size = 0x00010000, /* 4 * 16KiB */ | ||
121 | } | ||
122 | }; | ||
123 | |||
124 | /* trivial struct to describe partition information */ | ||
125 | struct mtd_part_def | ||
126 | { | ||
127 | int nums; | ||
128 | unsigned char *type; | ||
129 | struct mtd_partition* mtd_part; | ||
130 | }; | ||
131 | |||
132 | static struct mtd_info *sbc8240_mtd[NUM_FLASH_BANKS]; | ||
133 | static struct mtd_part_def sbc8240_part_banks[NUM_FLASH_BANKS]; | ||
134 | |||
135 | |||
136 | #endif /* CONFIG_MTD_PARTITIONS */ | ||
137 | |||
138 | |||
139 | static int __init init_sbc8240_mtd (void) | ||
140 | { | ||
141 | static struct _cjs { | ||
142 | u_long addr; | ||
143 | u_long size; | ||
144 | } pt[NUM_FLASH_BANKS] = { | ||
145 | { | ||
146 | .addr = WINDOW_ADDR0, | ||
147 | .size = WINDOW_SIZE0 | ||
148 | }, | ||
149 | { | ||
150 | .addr = WINDOW_ADDR1, | ||
151 | .size = WINDOW_SIZE1 | ||
152 | }, | ||
153 | }; | ||
154 | |||
155 | int devicesfound = 0; | ||
156 | int i,j; | ||
157 | |||
158 | for (i = 0; i < NUM_FLASH_BANKS; i++) { | ||
159 | printk (KERN_NOTICE MSG_PREFIX | ||
160 | "Probing 0x%08lx at 0x%08lx\n", pt[i].size, pt[i].addr); | ||
161 | |||
162 | sbc8240_map[i].map_priv_1 = | ||
163 | (unsigned long) ioremap (pt[i].addr, pt[i].size); | ||
164 | if (!sbc8240_map[i].map_priv_1) { | ||
165 | printk (MSG_PREFIX "failed to ioremap\n"); | ||
166 | for (j = 0; j < i; j++) { | ||
167 | iounmap((void *) sbc8240_map[j].map_priv_1); | ||
168 | sbc8240_map[j].map_priv_1 = 0; | ||
169 | } | ||
170 | return -EIO; | ||
171 | } | ||
172 | simple_map_init(&sbc8240_mtd[i]); | ||
173 | |||
174 | sbc8240_mtd[i] = do_map_probe("jedec_probe", &sbc8240_map[i]); | ||
175 | |||
176 | if (sbc8240_mtd[i]) { | ||
177 | sbc8240_mtd[i]->module = THIS_MODULE; | ||
178 | devicesfound++; | ||
179 | } else { | ||
180 | if (sbc8240_map[i].map_priv_1) { | ||
181 | iounmap((void *) sbc8240_map[i].map_priv_1); | ||
182 | sbc8240_map[i].map_priv_1 = 0; | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | |||
187 | if (!devicesfound) { | ||
188 | printk(KERN_NOTICE MSG_PREFIX | ||
189 | "No suppported flash chips found!\n"); | ||
190 | return -ENXIO; | ||
191 | } | ||
192 | |||
193 | #ifdef CONFIG_MTD_PARTITIONS | ||
194 | sbc8240_part_banks[0].mtd_part = sbc8240_uboot_partitions; | ||
195 | sbc8240_part_banks[0].type = "static image"; | ||
196 | sbc8240_part_banks[0].nums = ARRAY_SIZE(sbc8240_uboot_partitions); | ||
197 | sbc8240_part_banks[1].mtd_part = sbc8240_fs_partitions; | ||
198 | sbc8240_part_banks[1].type = "static file system"; | ||
199 | sbc8240_part_banks[1].nums = ARRAY_SIZE(sbc8240_fs_partitions); | ||
200 | |||
201 | for (i = 0; i < NUM_FLASH_BANKS; i++) { | ||
202 | |||
203 | if (!sbc8240_mtd[i]) continue; | ||
204 | if (sbc8240_part_banks[i].nums == 0) { | ||
205 | printk (KERN_NOTICE MSG_PREFIX | ||
206 | "No partition info available, registering whole device\n"); | ||
207 | add_mtd_device(sbc8240_mtd[i]); | ||
208 | } else { | ||
209 | printk (KERN_NOTICE MSG_PREFIX | ||
210 | "Using %s partition definition\n", sbc8240_part_banks[i].mtd_part->name); | ||
211 | add_mtd_partitions (sbc8240_mtd[i], | ||
212 | sbc8240_part_banks[i].mtd_part, | ||
213 | sbc8240_part_banks[i].nums); | ||
214 | } | ||
215 | } | ||
216 | #else | ||
217 | printk(KERN_NOTICE MSG_PREFIX | ||
218 | "Registering %d flash banks at once\n", devicesfound); | ||
219 | |||
220 | for (i = 0; i < devicesfound; i++) { | ||
221 | add_mtd_device(sbc8240_mtd[i]); | ||
222 | } | ||
223 | #endif /* CONFIG_MTD_PARTITIONS */ | ||
224 | |||
225 | return devicesfound == 0 ? -ENXIO : 0; | ||
226 | } | ||
227 | |||
228 | static void __exit cleanup_sbc8240_mtd (void) | ||
229 | { | ||
230 | int i; | ||
231 | |||
232 | for (i = 0; i < NUM_FLASH_BANKS; i++) { | ||
233 | if (sbc8240_mtd[i]) { | ||
234 | del_mtd_device (sbc8240_mtd[i]); | ||
235 | map_destroy (sbc8240_mtd[i]); | ||
236 | } | ||
237 | if (sbc8240_map[i].map_priv_1) { | ||
238 | iounmap ((void *) sbc8240_map[i].map_priv_1); | ||
239 | sbc8240_map[i].map_priv_1 = 0; | ||
240 | } | ||
241 | } | ||
242 | } | ||
243 | |||
244 | module_init (init_sbc8240_mtd); | ||
245 | module_exit (cleanup_sbc8240_mtd); | ||
246 | |||
247 | MODULE_LICENSE ("GPL"); | ||
248 | MODULE_AUTHOR ("Carolyn Smith <carolyn.smith@tektronix.com>"); | ||
249 | MODULE_DESCRIPTION ("MTD map driver for SBC8240 boards"); | ||
250 | |||
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index c3f62654b6d..7baba40c1ed 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -144,7 +144,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) | |||
144 | struct mtd_blktrans_ops *tr = dev->tr; | 144 | struct mtd_blktrans_ops *tr = dev->tr; |
145 | int ret = -ENODEV; | 145 | int ret = -ENODEV; |
146 | 146 | ||
147 | if (!try_module_get(dev->mtd->owner)) | 147 | if (!get_mtd_device(NULL, dev->mtd->index)) |
148 | goto out; | 148 | goto out; |
149 | 149 | ||
150 | if (!try_module_get(tr->owner)) | 150 | if (!try_module_get(tr->owner)) |
@@ -158,7 +158,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) | |||
158 | ret = 0; | 158 | ret = 0; |
159 | if (tr->open && (ret = tr->open(dev))) { | 159 | if (tr->open && (ret = tr->open(dev))) { |
160 | dev->mtd->usecount--; | 160 | dev->mtd->usecount--; |
161 | module_put(dev->mtd->owner); | 161 | put_mtd_device(dev->mtd); |
162 | out_tr: | 162 | out_tr: |
163 | module_put(tr->owner); | 163 | module_put(tr->owner); |
164 | } | 164 | } |
@@ -177,7 +177,7 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode) | |||
177 | 177 | ||
178 | if (!ret) { | 178 | if (!ret) { |
179 | dev->mtd->usecount--; | 179 | dev->mtd->usecount--; |
180 | module_put(dev->mtd->owner); | 180 | put_mtd_device(dev->mtd); |
181 | module_put(tr->owner); | 181 | module_put(tr->owner); |
182 | } | 182 | } |
183 | 183 | ||
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index 208c6faa035..77db5ce24d9 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c | |||
@@ -29,6 +29,8 @@ static struct mtdblk_dev { | |||
29 | enum { STATE_EMPTY, STATE_CLEAN, STATE_DIRTY } cache_state; | 29 | enum { STATE_EMPTY, STATE_CLEAN, STATE_DIRTY } cache_state; |
30 | } *mtdblks[MAX_MTD_DEVICES]; | 30 | } *mtdblks[MAX_MTD_DEVICES]; |
31 | 31 | ||
32 | static struct mutex mtdblks_lock; | ||
33 | |||
32 | /* | 34 | /* |
33 | * Cache stuff... | 35 | * Cache stuff... |
34 | * | 36 | * |
@@ -270,15 +272,19 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd) | |||
270 | 272 | ||
271 | DEBUG(MTD_DEBUG_LEVEL1,"mtdblock_open\n"); | 273 | DEBUG(MTD_DEBUG_LEVEL1,"mtdblock_open\n"); |
272 | 274 | ||
275 | mutex_lock(&mtdblks_lock); | ||
273 | if (mtdblks[dev]) { | 276 | if (mtdblks[dev]) { |
274 | mtdblks[dev]->count++; | 277 | mtdblks[dev]->count++; |
278 | mutex_unlock(&mtdblks_lock); | ||
275 | return 0; | 279 | return 0; |
276 | } | 280 | } |
277 | 281 | ||
278 | /* OK, it's not open. Create cache info for it */ | 282 | /* OK, it's not open. Create cache info for it */ |
279 | mtdblk = kzalloc(sizeof(struct mtdblk_dev), GFP_KERNEL); | 283 | mtdblk = kzalloc(sizeof(struct mtdblk_dev), GFP_KERNEL); |
280 | if (!mtdblk) | 284 | if (!mtdblk) { |
285 | mutex_unlock(&mtdblks_lock); | ||
281 | return -ENOMEM; | 286 | return -ENOMEM; |
287 | } | ||
282 | 288 | ||
283 | mtdblk->count = 1; | 289 | mtdblk->count = 1; |
284 | mtdblk->mtd = mtd; | 290 | mtdblk->mtd = mtd; |
@@ -291,6 +297,7 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd) | |||
291 | } | 297 | } |
292 | 298 | ||
293 | mtdblks[dev] = mtdblk; | 299 | mtdblks[dev] = mtdblk; |
300 | mutex_unlock(&mtdblks_lock); | ||
294 | 301 | ||
295 | DEBUG(MTD_DEBUG_LEVEL1, "ok\n"); | 302 | DEBUG(MTD_DEBUG_LEVEL1, "ok\n"); |
296 | 303 | ||
@@ -304,6 +311,8 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd) | |||
304 | 311 | ||
305 | DEBUG(MTD_DEBUG_LEVEL1, "mtdblock_release\n"); | 312 | DEBUG(MTD_DEBUG_LEVEL1, "mtdblock_release\n"); |
306 | 313 | ||
314 | mutex_lock(&mtdblks_lock); | ||
315 | |||
307 | mutex_lock(&mtdblk->cache_mutex); | 316 | mutex_lock(&mtdblk->cache_mutex); |
308 | write_cached_data(mtdblk); | 317 | write_cached_data(mtdblk); |
309 | mutex_unlock(&mtdblk->cache_mutex); | 318 | mutex_unlock(&mtdblk->cache_mutex); |
@@ -316,6 +325,9 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd) | |||
316 | vfree(mtdblk->cache_data); | 325 | vfree(mtdblk->cache_data); |
317 | kfree(mtdblk); | 326 | kfree(mtdblk); |
318 | } | 327 | } |
328 | |||
329 | mutex_unlock(&mtdblks_lock); | ||
330 | |||
319 | DEBUG(MTD_DEBUG_LEVEL1, "ok\n"); | 331 | DEBUG(MTD_DEBUG_LEVEL1, "ok\n"); |
320 | 332 | ||
321 | return 0; | 333 | return 0; |
@@ -376,6 +388,8 @@ static struct mtd_blktrans_ops mtdblock_tr = { | |||
376 | 388 | ||
377 | static int __init init_mtdblock(void) | 389 | static int __init init_mtdblock(void) |
378 | { | 390 | { |
391 | mutex_init(&mtdblks_lock); | ||
392 | |||
379 | return register_mtd_blktrans(&mtdblock_tr); | 393 | return register_mtd_blktrans(&mtdblock_tr); |
380 | } | 394 | } |
381 | 395 | ||
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index fac54a3fa3f..00ebf7af746 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -65,8 +65,8 @@ static void mtd_release(struct device *dev) | |||
65 | static int mtd_cls_suspend(struct device *dev, pm_message_t state) | 65 | static int mtd_cls_suspend(struct device *dev, pm_message_t state) |
66 | { | 66 | { |
67 | struct mtd_info *mtd = dev_to_mtd(dev); | 67 | struct mtd_info *mtd = dev_to_mtd(dev); |
68 | 68 | ||
69 | if (mtd->suspend) | 69 | if (mtd && mtd->suspend) |
70 | return mtd->suspend(mtd); | 70 | return mtd->suspend(mtd); |
71 | else | 71 | else |
72 | return 0; | 72 | return 0; |
@@ -76,7 +76,7 @@ static int mtd_cls_resume(struct device *dev) | |||
76 | { | 76 | { |
77 | struct mtd_info *mtd = dev_to_mtd(dev); | 77 | struct mtd_info *mtd = dev_to_mtd(dev); |
78 | 78 | ||
79 | if (mtd->resume) | 79 | if (mtd && mtd->resume) |
80 | mtd->resume(mtd); | 80 | mtd->resume(mtd); |
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
@@ -298,6 +298,7 @@ int add_mtd_device(struct mtd_info *mtd) | |||
298 | mtd->dev.class = &mtd_class; | 298 | mtd->dev.class = &mtd_class; |
299 | mtd->dev.devt = MTD_DEVT(i); | 299 | mtd->dev.devt = MTD_DEVT(i); |
300 | dev_set_name(&mtd->dev, "mtd%d", i); | 300 | dev_set_name(&mtd->dev, "mtd%d", i); |
301 | dev_set_drvdata(&mtd->dev, mtd); | ||
301 | if (device_register(&mtd->dev) != 0) { | 302 | if (device_register(&mtd->dev) != 0) { |
302 | mtd_table[i] = NULL; | 303 | mtd_table[i] = NULL; |
303 | break; | 304 | break; |
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index 38d656b9b2e..0108ed42e87 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -266,7 +266,7 @@ static inline int omap2_onenand_bufferram_offset(struct mtd_info *mtd, int area) | |||
266 | 266 | ||
267 | if (ONENAND_CURRENT_BUFFERRAM(this)) { | 267 | if (ONENAND_CURRENT_BUFFERRAM(this)) { |
268 | if (area == ONENAND_DATARAM) | 268 | if (area == ONENAND_DATARAM) |
269 | return mtd->writesize; | 269 | return this->writesize; |
270 | if (area == ONENAND_SPARERAM) | 270 | if (area == ONENAND_SPARERAM) |
271 | return mtd->oobsize; | 271 | return mtd->oobsize; |
272 | } | 272 | } |
@@ -770,6 +770,7 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev) | |||
770 | } | 770 | } |
771 | iounmap(c->onenand.base); | 771 | iounmap(c->onenand.base); |
772 | release_mem_region(c->phys_base, ONENAND_IO_SIZE); | 772 | release_mem_region(c->phys_base, ONENAND_IO_SIZE); |
773 | gpmc_cs_free(c->gpmc_cs); | ||
773 | kfree(c); | 774 | kfree(c); |
774 | 775 | ||
775 | return 0; | 776 | return 0; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 471a9a60376..3a44695b9c0 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -1082,7 +1082,6 @@ static void fbcon_init(struct vc_data *vc, int init) | |||
1082 | new_rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); | 1082 | new_rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1083 | new_cols /= vc->vc_font.width; | 1083 | new_cols /= vc->vc_font.width; |
1084 | new_rows /= vc->vc_font.height; | 1084 | new_rows /= vc->vc_font.height; |
1085 | vc_resize(vc, new_cols, new_rows); | ||
1086 | 1085 | ||
1087 | /* | 1086 | /* |
1088 | * We must always set the mode. The mode of the previous console | 1087 | * We must always set the mode. The mode of the previous console |
@@ -1111,10 +1110,11 @@ static void fbcon_init(struct vc_data *vc, int init) | |||
1111 | * vc_{cols,rows}, but we must not set those if we are only | 1110 | * vc_{cols,rows}, but we must not set those if we are only |
1112 | * resizing the console. | 1111 | * resizing the console. |
1113 | */ | 1112 | */ |
1114 | if (!init) { | 1113 | if (init) { |
1115 | vc->vc_cols = new_cols; | 1114 | vc->vc_cols = new_cols; |
1116 | vc->vc_rows = new_rows; | 1115 | vc->vc_rows = new_rows; |
1117 | } | 1116 | } else |
1117 | vc_resize(vc, new_cols, new_rows); | ||
1118 | 1118 | ||
1119 | if (logo) | 1119 | if (logo) |
1120 | fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); | 1120 | fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); |
diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h index 75be5ce53dc..e233444cda6 100644 --- a/drivers/video/console/fbcon_rotate.h +++ b/drivers/video/console/fbcon_rotate.h | |||
@@ -45,7 +45,7 @@ static inline void rotate_ud(const char *in, char *out, u32 width, u32 height) | |||
45 | width = (width + 7) & ~7; | 45 | width = (width + 7) & ~7; |
46 | 46 | ||
47 | for (i = 0; i < height; i++) { | 47 | for (i = 0; i < height; i++) { |
48 | for (j = 0; j < width; j++) { | 48 | for (j = 0; j < width - shift; j++) { |
49 | if (pattern_test_bit(j, i, width, in)) | 49 | if (pattern_test_bit(j, i, width, in)) |
50 | pattern_set_bit(width - (1 + j + shift), | 50 | pattern_set_bit(width - (1 + j + shift), |
51 | height - (1 + i), | 51 | height - (1 + i), |
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index f8778cde218..054ef29be47 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c | |||
@@ -669,7 +669,8 @@ static uint32_t bpp_to_pixfmt(int bpp) | |||
669 | } | 669 | } |
670 | 670 | ||
671 | static int mx3fb_blank(int blank, struct fb_info *fbi); | 671 | static int mx3fb_blank(int blank, struct fb_info *fbi); |
672 | static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len); | 672 | static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len, |
673 | bool lock); | ||
673 | static int mx3fb_unmap_video_memory(struct fb_info *fbi); | 674 | static int mx3fb_unmap_video_memory(struct fb_info *fbi); |
674 | 675 | ||
675 | /** | 676 | /** |
@@ -711,12 +712,7 @@ static void mx3fb_dma_done(void *arg) | |||
711 | complete(&mx3_fbi->flip_cmpl); | 712 | complete(&mx3_fbi->flip_cmpl); |
712 | } | 713 | } |
713 | 714 | ||
714 | /** | 715 | static int __set_par(struct fb_info *fbi, bool lock) |
715 | * mx3fb_set_par() - set framebuffer parameters and change the operating mode. | ||
716 | * @fbi: framebuffer information pointer. | ||
717 | * @return: 0 on success or negative error code on failure. | ||
718 | */ | ||
719 | static int mx3fb_set_par(struct fb_info *fbi) | ||
720 | { | 716 | { |
721 | u32 mem_len; | 717 | u32 mem_len; |
722 | struct ipu_di_signal_cfg sig_cfg; | 718 | struct ipu_di_signal_cfg sig_cfg; |
@@ -727,10 +723,6 @@ static int mx3fb_set_par(struct fb_info *fbi) | |||
727 | struct idmac_video_param *video = &ichan->params.video; | 723 | struct idmac_video_param *video = &ichan->params.video; |
728 | struct scatterlist *sg = mx3_fbi->sg; | 724 | struct scatterlist *sg = mx3_fbi->sg; |
729 | 725 | ||
730 | dev_dbg(mx3fb->dev, "%s [%c]\n", __func__, list_empty(&ichan->queue) ? '-' : '+'); | ||
731 | |||
732 | mutex_lock(&mx3_fbi->mutex); | ||
733 | |||
734 | /* Total cleanup */ | 726 | /* Total cleanup */ |
735 | if (mx3_fbi->txd) | 727 | if (mx3_fbi->txd) |
736 | sdc_disable_channel(mx3_fbi); | 728 | sdc_disable_channel(mx3_fbi); |
@@ -742,10 +734,8 @@ static int mx3fb_set_par(struct fb_info *fbi) | |||
742 | if (fbi->fix.smem_start) | 734 | if (fbi->fix.smem_start) |
743 | mx3fb_unmap_video_memory(fbi); | 735 | mx3fb_unmap_video_memory(fbi); |
744 | 736 | ||
745 | if (mx3fb_map_video_memory(fbi, mem_len) < 0) { | 737 | if (mx3fb_map_video_memory(fbi, mem_len, lock) < 0) |
746 | mutex_unlock(&mx3_fbi->mutex); | ||
747 | return -ENOMEM; | 738 | return -ENOMEM; |
748 | } | ||
749 | } | 739 | } |
750 | 740 | ||
751 | sg_init_table(&sg[0], 1); | 741 | sg_init_table(&sg[0], 1); |
@@ -791,7 +781,6 @@ static int mx3fb_set_par(struct fb_info *fbi) | |||
791 | fbi->var.vsync_len, | 781 | fbi->var.vsync_len, |
792 | fbi->var.lower_margin + | 782 | fbi->var.lower_margin + |
793 | fbi->var.vsync_len, sig_cfg) != 0) { | 783 | fbi->var.vsync_len, sig_cfg) != 0) { |
794 | mutex_unlock(&mx3_fbi->mutex); | ||
795 | dev_err(fbi->device, | 784 | dev_err(fbi->device, |
796 | "mx3fb: Error initializing panel.\n"); | 785 | "mx3fb: Error initializing panel.\n"); |
797 | return -EINVAL; | 786 | return -EINVAL; |
@@ -810,9 +799,30 @@ static int mx3fb_set_par(struct fb_info *fbi) | |||
810 | if (mx3_fbi->blank == FB_BLANK_UNBLANK) | 799 | if (mx3_fbi->blank == FB_BLANK_UNBLANK) |
811 | sdc_enable_channel(mx3_fbi); | 800 | sdc_enable_channel(mx3_fbi); |
812 | 801 | ||
802 | return 0; | ||
803 | } | ||
804 | |||
805 | /** | ||
806 | * mx3fb_set_par() - set framebuffer parameters and change the operating mode. | ||
807 | * @fbi: framebuffer information pointer. | ||
808 | * @return: 0 on success or negative error code on failure. | ||
809 | */ | ||
810 | static int mx3fb_set_par(struct fb_info *fbi) | ||
811 | { | ||
812 | struct mx3fb_info *mx3_fbi = fbi->par; | ||
813 | struct mx3fb_data *mx3fb = mx3_fbi->mx3fb; | ||
814 | struct idmac_channel *ichan = mx3_fbi->idmac_channel; | ||
815 | int ret; | ||
816 | |||
817 | dev_dbg(mx3fb->dev, "%s [%c]\n", __func__, list_empty(&ichan->queue) ? '-' : '+'); | ||
818 | |||
819 | mutex_lock(&mx3_fbi->mutex); | ||
820 | |||
821 | ret = __set_par(fbi, true); | ||
822 | |||
813 | mutex_unlock(&mx3_fbi->mutex); | 823 | mutex_unlock(&mx3_fbi->mutex); |
814 | 824 | ||
815 | return 0; | 825 | return ret; |
816 | } | 826 | } |
817 | 827 | ||
818 | /** | 828 | /** |
@@ -966,21 +976,11 @@ static int mx3fb_setcolreg(unsigned int regno, unsigned int red, | |||
966 | return ret; | 976 | return ret; |
967 | } | 977 | } |
968 | 978 | ||
969 | /** | 979 | static void __blank(int blank, struct fb_info *fbi) |
970 | * mx3fb_blank() - blank the display. | ||
971 | */ | ||
972 | static int mx3fb_blank(int blank, struct fb_info *fbi) | ||
973 | { | 980 | { |
974 | struct mx3fb_info *mx3_fbi = fbi->par; | 981 | struct mx3fb_info *mx3_fbi = fbi->par; |
975 | struct mx3fb_data *mx3fb = mx3_fbi->mx3fb; | 982 | struct mx3fb_data *mx3fb = mx3_fbi->mx3fb; |
976 | 983 | ||
977 | dev_dbg(fbi->device, "%s, blank = %d, base %p, len %u\n", __func__, | ||
978 | blank, fbi->screen_base, fbi->fix.smem_len); | ||
979 | |||
980 | if (mx3_fbi->blank == blank) | ||
981 | return 0; | ||
982 | |||
983 | mutex_lock(&mx3_fbi->mutex); | ||
984 | mx3_fbi->blank = blank; | 984 | mx3_fbi->blank = blank; |
985 | 985 | ||
986 | switch (blank) { | 986 | switch (blank) { |
@@ -999,6 +999,23 @@ static int mx3fb_blank(int blank, struct fb_info *fbi) | |||
999 | sdc_set_brightness(mx3fb, mx3fb->backlight_level); | 999 | sdc_set_brightness(mx3fb, mx3fb->backlight_level); |
1000 | break; | 1000 | break; |
1001 | } | 1001 | } |
1002 | } | ||
1003 | |||
1004 | /** | ||
1005 | * mx3fb_blank() - blank the display. | ||
1006 | */ | ||
1007 | static int mx3fb_blank(int blank, struct fb_info *fbi) | ||
1008 | { | ||
1009 | struct mx3fb_info *mx3_fbi = fbi->par; | ||
1010 | |||
1011 | dev_dbg(fbi->device, "%s, blank = %d, base %p, len %u\n", __func__, | ||
1012 | blank, fbi->screen_base, fbi->fix.smem_len); | ||
1013 | |||
1014 | if (mx3_fbi->blank == blank) | ||
1015 | return 0; | ||
1016 | |||
1017 | mutex_lock(&mx3_fbi->mutex); | ||
1018 | __blank(blank, fbi); | ||
1002 | mutex_unlock(&mx3_fbi->mutex); | 1019 | mutex_unlock(&mx3_fbi->mutex); |
1003 | 1020 | ||
1004 | return 0; | 1021 | return 0; |
@@ -1198,6 +1215,7 @@ static int mx3fb_resume(struct platform_device *pdev) | |||
1198 | * mx3fb_map_video_memory() - allocates the DRAM memory for the frame buffer. | 1215 | * mx3fb_map_video_memory() - allocates the DRAM memory for the frame buffer. |
1199 | * @fbi: framebuffer information pointer | 1216 | * @fbi: framebuffer information pointer |
1200 | * @mem_len: length of mapped memory | 1217 | * @mem_len: length of mapped memory |
1218 | * @lock: do not lock during initialisation | ||
1201 | * @return: Error code indicating success or failure | 1219 | * @return: Error code indicating success or failure |
1202 | * | 1220 | * |
1203 | * This buffer is remapped into a non-cached, non-buffered, memory region to | 1221 | * This buffer is remapped into a non-cached, non-buffered, memory region to |
@@ -1205,7 +1223,8 @@ static int mx3fb_resume(struct platform_device *pdev) | |||
1205 | * area is remapped, all virtual memory access to the video memory should occur | 1223 | * area is remapped, all virtual memory access to the video memory should occur |
1206 | * at the new region. | 1224 | * at the new region. |
1207 | */ | 1225 | */ |
1208 | static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len) | 1226 | static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len, |
1227 | bool lock) | ||
1209 | { | 1228 | { |
1210 | int retval = 0; | 1229 | int retval = 0; |
1211 | dma_addr_t addr; | 1230 | dma_addr_t addr; |
@@ -1221,10 +1240,12 @@ static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len) | |||
1221 | goto err0; | 1240 | goto err0; |
1222 | } | 1241 | } |
1223 | 1242 | ||
1224 | mutex_lock(&fbi->mm_lock); | 1243 | if (lock) |
1244 | mutex_lock(&fbi->mm_lock); | ||
1225 | fbi->fix.smem_start = addr; | 1245 | fbi->fix.smem_start = addr; |
1226 | fbi->fix.smem_len = mem_len; | 1246 | fbi->fix.smem_len = mem_len; |
1227 | mutex_unlock(&fbi->mm_lock); | 1247 | if (lock) |
1248 | mutex_unlock(&fbi->mm_lock); | ||
1228 | 1249 | ||
1229 | dev_dbg(fbi->device, "allocated fb @ p=0x%08x, v=0x%p, size=%d.\n", | 1250 | dev_dbg(fbi->device, "allocated fb @ p=0x%08x, v=0x%p, size=%d.\n", |
1230 | (uint32_t) fbi->fix.smem_start, fbi->screen_base, fbi->fix.smem_len); | 1251 | (uint32_t) fbi->fix.smem_start, fbi->screen_base, fbi->fix.smem_len); |
@@ -1365,6 +1386,11 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan) | |||
1365 | init_completion(&mx3fbi->flip_cmpl); | 1386 | init_completion(&mx3fbi->flip_cmpl); |
1366 | disable_irq(ichan->eof_irq); | 1387 | disable_irq(ichan->eof_irq); |
1367 | dev_dbg(mx3fb->dev, "disabling irq %d\n", ichan->eof_irq); | 1388 | dev_dbg(mx3fb->dev, "disabling irq %d\n", ichan->eof_irq); |
1389 | ret = __set_par(fbi, false); | ||
1390 | if (ret < 0) | ||
1391 | goto esetpar; | ||
1392 | |||
1393 | __blank(FB_BLANK_UNBLANK, fbi); | ||
1368 | 1394 | ||
1369 | dev_info(dev, "registered, using mode %s\n", fb_mode); | 1395 | dev_info(dev, "registered, using mode %s\n", fb_mode); |
1370 | 1396 | ||
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index fcd53ceb88f..c8960003f47 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c | |||
@@ -2407,14 +2407,14 @@ int viafb_setmode(int vmode_index, int hor_res, int ver_res, int video_bpp, | |||
2407 | viafb_dvi_set_mode(viafb_get_mode_index | 2407 | viafb_dvi_set_mode(viafb_get_mode_index |
2408 | (viaparinfo->tmds_setting_info->h_active, | 2408 | (viaparinfo->tmds_setting_info->h_active, |
2409 | viaparinfo->tmds_setting_info-> | 2409 | viaparinfo->tmds_setting_info-> |
2410 | v_active, 1), | 2410 | v_active), |
2411 | video_bpp1, viaparinfo-> | 2411 | video_bpp1, viaparinfo-> |
2412 | tmds_setting_info->iga_path); | 2412 | tmds_setting_info->iga_path); |
2413 | } else { | 2413 | } else { |
2414 | viafb_dvi_set_mode(viafb_get_mode_index | 2414 | viafb_dvi_set_mode(viafb_get_mode_index |
2415 | (viaparinfo->tmds_setting_info->h_active, | 2415 | (viaparinfo->tmds_setting_info->h_active, |
2416 | viaparinfo-> | 2416 | viaparinfo-> |
2417 | tmds_setting_info->v_active, 0), | 2417 | tmds_setting_info->v_active), |
2418 | video_bpp, viaparinfo-> | 2418 | video_bpp, viaparinfo-> |
2419 | tmds_setting_info->iga_path); | 2419 | tmds_setting_info->iga_path); |
2420 | } | 2420 | } |
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c index 6c7290a6a44..78c6b338794 100644 --- a/drivers/video/via/lcd.c +++ b/drivers/video/via/lcd.c | |||
@@ -580,10 +580,7 @@ static void load_lcd_k400_patch_tbl(int set_hres, int set_vres, | |||
580 | int reg_num = 0; | 580 | int reg_num = 0; |
581 | struct io_reg *lcd_patch_reg = NULL; | 581 | struct io_reg *lcd_patch_reg = NULL; |
582 | 582 | ||
583 | if (viaparinfo->lvds_setting_info->iga_path == IGA2) | 583 | vmode_index = viafb_get_mode_index(set_hres, set_vres); |
584 | vmode_index = viafb_get_mode_index(set_hres, set_vres, 1); | ||
585 | else | ||
586 | vmode_index = viafb_get_mode_index(set_hres, set_vres, 0); | ||
587 | switch (panel_id) { | 584 | switch (panel_id) { |
588 | /* LCD 800x600 */ | 585 | /* LCD 800x600 */ |
589 | case LCD_PANEL_ID1_800X600: | 586 | case LCD_PANEL_ID1_800X600: |
@@ -761,10 +758,7 @@ static void load_lcd_p880_patch_tbl(int set_hres, int set_vres, | |||
761 | int reg_num = 0; | 758 | int reg_num = 0; |
762 | struct io_reg *lcd_patch_reg = NULL; | 759 | struct io_reg *lcd_patch_reg = NULL; |
763 | 760 | ||
764 | if (viaparinfo->lvds_setting_info->iga_path == IGA2) | 761 | vmode_index = viafb_get_mode_index(set_hres, set_vres); |
765 | vmode_index = viafb_get_mode_index(set_hres, set_vres, 1); | ||
766 | else | ||
767 | vmode_index = viafb_get_mode_index(set_hres, set_vres, 0); | ||
768 | 762 | ||
769 | switch (panel_id) { | 763 | switch (panel_id) { |
770 | case LCD_PANEL_ID5_1400X1050: | 764 | case LCD_PANEL_ID5_1400X1050: |
@@ -832,10 +826,7 @@ static void load_lcd_patch_regs(int set_hres, int set_vres, | |||
832 | { | 826 | { |
833 | int vmode_index; | 827 | int vmode_index; |
834 | 828 | ||
835 | if (viaparinfo->lvds_setting_info->iga_path == IGA2) | 829 | vmode_index = viafb_get_mode_index(set_hres, set_vres); |
836 | vmode_index = viafb_get_mode_index(set_hres, set_vres, 1); | ||
837 | else | ||
838 | vmode_index = viafb_get_mode_index(set_hres, set_vres, 0); | ||
839 | 830 | ||
840 | viafb_unlock_crt(); | 831 | viafb_unlock_crt(); |
841 | 832 | ||
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index a0fec298216..72833f3334b 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -32,7 +32,6 @@ static u32 pseudo_pal[17]; | |||
32 | /* video mode */ | 32 | /* video mode */ |
33 | static char *viafb_mode = "640x480"; | 33 | static char *viafb_mode = "640x480"; |
34 | static char *viafb_mode1 = "640x480"; | 34 | static char *viafb_mode1 = "640x480"; |
35 | static int viafb_resMode = VIA_RES_640X480; | ||
36 | 35 | ||
37 | /* Added for specifying active devices.*/ | 36 | /* Added for specifying active devices.*/ |
38 | char *viafb_active_dev = ""; | 37 | char *viafb_active_dev = ""; |
@@ -56,47 +55,47 @@ static void viafb_get_video_device(u32 *video_dev_info); | |||
56 | 55 | ||
57 | /* Mode information */ | 56 | /* Mode information */ |
58 | static const struct viafb_modeinfo viafb_modentry[] = { | 57 | static const struct viafb_modeinfo viafb_modentry[] = { |
59 | {480, 640, VIA_RES_480X640, "480x640"}, | 58 | {480, 640, VIA_RES_480X640}, |
60 | {640, 480, VIA_RES_640X480, "640x480"}, | 59 | {640, 480, VIA_RES_640X480}, |
61 | {800, 480, VIA_RES_800X480, "800x480"}, | 60 | {800, 480, VIA_RES_800X480}, |
62 | {800, 600, VIA_RES_800X600, "800x600"}, | 61 | {800, 600, VIA_RES_800X600}, |
63 | {1024, 768, VIA_RES_1024X768, "1024x768"}, | 62 | {1024, 768, VIA_RES_1024X768}, |
64 | {1152, 864, VIA_RES_1152X864, "1152x864"}, | 63 | {1152, 864, VIA_RES_1152X864}, |
65 | {1280, 1024, VIA_RES_1280X1024, "1280x1024"}, | 64 | {1280, 1024, VIA_RES_1280X1024}, |
66 | {1600, 1200, VIA_RES_1600X1200, "1600x1200"}, | 65 | {1600, 1200, VIA_RES_1600X1200}, |
67 | {1440, 1050, VIA_RES_1440X1050, "1440x1050"}, | 66 | {1440, 1050, VIA_RES_1440X1050}, |
68 | {1280, 768, VIA_RES_1280X768, "1280x768"}, | 67 | {1280, 768, VIA_RES_1280X768,}, |
69 | {1280, 800, VIA_RES_1280X800, "1280x800"}, | 68 | {1280, 800, VIA_RES_1280X800}, |
70 | {1280, 960, VIA_RES_1280X960, "1280x960"}, | 69 | {1280, 960, VIA_RES_1280X960}, |
71 | {1920, 1440, VIA_RES_1920X1440, "1920x1440"}, | 70 | {1920, 1440, VIA_RES_1920X1440}, |
72 | {848, 480, VIA_RES_848X480, "848x480"}, | 71 | {848, 480, VIA_RES_848X480}, |
73 | {1400, 1050, VIA_RES_1400X1050, "1400x1050"}, | 72 | {1400, 1050, VIA_RES_1400X1050}, |
74 | {720, 480, VIA_RES_720X480, "720x480"}, | 73 | {720, 480, VIA_RES_720X480}, |
75 | {720, 576, VIA_RES_720X576, "720x576"}, | 74 | {720, 576, VIA_RES_720X576}, |
76 | {1024, 512, VIA_RES_1024X512, "1024x512"}, | 75 | {1024, 512, VIA_RES_1024X512}, |
77 | {1024, 576, VIA_RES_1024X576, "1024x576"}, | 76 | {1024, 576, VIA_RES_1024X576}, |
78 | {1024, 600, VIA_RES_1024X600, "1024x600"}, | 77 | {1024, 600, VIA_RES_1024X600}, |
79 | {1280, 720, VIA_RES_1280X720, "1280x720"}, | 78 | {1280, 720, VIA_RES_1280X720}, |
80 | {1920, 1080, VIA_RES_1920X1080, "1920x1080"}, | 79 | {1920, 1080, VIA_RES_1920X1080}, |
81 | {1366, 768, VIA_RES_1368X768, "1368x768"}, | 80 | {1366, 768, VIA_RES_1368X768}, |
82 | {1680, 1050, VIA_RES_1680X1050, "1680x1050"}, | 81 | {1680, 1050, VIA_RES_1680X1050}, |
83 | {960, 600, VIA_RES_960X600, "960x600"}, | 82 | {960, 600, VIA_RES_960X600}, |
84 | {1000, 600, VIA_RES_1000X600, "1000x600"}, | 83 | {1000, 600, VIA_RES_1000X600}, |
85 | {1024, 576, VIA_RES_1024X576, "1024x576"}, | 84 | {1024, 576, VIA_RES_1024X576}, |
86 | {1024, 600, VIA_RES_1024X600, "1024x600"}, | 85 | {1024, 600, VIA_RES_1024X600}, |
87 | {1088, 612, VIA_RES_1088X612, "1088x612"}, | 86 | {1088, 612, VIA_RES_1088X612}, |
88 | {1152, 720, VIA_RES_1152X720, "1152x720"}, | 87 | {1152, 720, VIA_RES_1152X720}, |
89 | {1200, 720, VIA_RES_1200X720, "1200x720"}, | 88 | {1200, 720, VIA_RES_1200X720}, |
90 | {1280, 600, VIA_RES_1280X600, "1280x600"}, | 89 | {1280, 600, VIA_RES_1280X600}, |
91 | {1360, 768, VIA_RES_1360X768, "1360x768"}, | 90 | {1360, 768, VIA_RES_1360X768}, |
92 | {1440, 900, VIA_RES_1440X900, "1440x900"}, | 91 | {1440, 900, VIA_RES_1440X900}, |
93 | {1600, 900, VIA_RES_1600X900, "1600x900"}, | 92 | {1600, 900, VIA_RES_1600X900}, |
94 | {1600, 1024, VIA_RES_1600X1024, "1600x1024"}, | 93 | {1600, 1024, VIA_RES_1600X1024}, |
95 | {1792, 1344, VIA_RES_1792X1344, "1792x1344"}, | 94 | {1792, 1344, VIA_RES_1792X1344}, |
96 | {1856, 1392, VIA_RES_1856X1392, "1856x1392"}, | 95 | {1856, 1392, VIA_RES_1856X1392}, |
97 | {1920, 1200, VIA_RES_1920X1200, "1920x1200"}, | 96 | {1920, 1200, VIA_RES_1920X1200}, |
98 | {2048, 1536, VIA_RES_2048X1536, "2048x1536"}, | 97 | {2048, 1536, VIA_RES_2048X1536}, |
99 | {0, 0, VIA_RES_INVALID, "640x480"} | 98 | {0, 0, VIA_RES_INVALID} |
100 | }; | 99 | }; |
101 | 100 | ||
102 | static struct fb_ops viafb_ops; | 101 | static struct fb_ops viafb_ops; |
@@ -177,7 +176,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var, | |||
177 | if (var->vmode & FB_VMODE_INTERLACED || var->vmode & FB_VMODE_DOUBLE) | 176 | if (var->vmode & FB_VMODE_INTERLACED || var->vmode & FB_VMODE_DOUBLE) |
178 | return -EINVAL; | 177 | return -EINVAL; |
179 | 178 | ||
180 | vmode_index = viafb_get_mode_index(var->xres, var->yres, 0); | 179 | vmode_index = viafb_get_mode_index(var->xres, var->yres); |
181 | if (vmode_index == VIA_RES_INVALID) { | 180 | if (vmode_index == VIA_RES_INVALID) { |
182 | DEBUG_MSG(KERN_INFO | 181 | DEBUG_MSG(KERN_INFO |
183 | "viafb: Mode %dx%dx%d not supported!!\n", | 182 | "viafb: Mode %dx%dx%d not supported!!\n", |
@@ -233,14 +232,14 @@ static int viafb_set_par(struct fb_info *info) | |||
233 | viafb_update_device_setting(info->var.xres, info->var.yres, | 232 | viafb_update_device_setting(info->var.xres, info->var.yres, |
234 | info->var.bits_per_pixel, viafb_refresh, 0); | 233 | info->var.bits_per_pixel, viafb_refresh, 0); |
235 | 234 | ||
236 | vmode_index = viafb_get_mode_index(info->var.xres, info->var.yres, 0); | 235 | vmode_index = viafb_get_mode_index(info->var.xres, info->var.yres); |
237 | 236 | ||
238 | if (viafb_SAMM_ON == 1) { | 237 | if (viafb_SAMM_ON == 1) { |
239 | DEBUG_MSG(KERN_INFO | 238 | DEBUG_MSG(KERN_INFO |
240 | "viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n", | 239 | "viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n", |
241 | viafb_second_xres, viafb_second_yres, viafb_bpp1); | 240 | viafb_second_xres, viafb_second_yres, viafb_bpp1); |
242 | vmode_index1 = viafb_get_mode_index(viafb_second_xres, | 241 | vmode_index1 = viafb_get_mode_index(viafb_second_xres, |
243 | viafb_second_yres, 1); | 242 | viafb_second_yres); |
244 | DEBUG_MSG(KERN_INFO "->viafb_SAMM_ON: index=%d\n", | 243 | DEBUG_MSG(KERN_INFO "->viafb_SAMM_ON: index=%d\n", |
245 | vmode_index1); | 244 | vmode_index1); |
246 | 245 | ||
@@ -1262,7 +1261,7 @@ static int viafb_sync(struct fb_info *info) | |||
1262 | return 0; | 1261 | return 0; |
1263 | } | 1262 | } |
1264 | 1263 | ||
1265 | int viafb_get_mode_index(int hres, int vres, int flag) | 1264 | int viafb_get_mode_index(int hres, int vres) |
1266 | { | 1265 | { |
1267 | u32 i; | 1266 | u32 i; |
1268 | DEBUG_MSG(KERN_INFO "viafb_get_mode_index!\n"); | 1267 | DEBUG_MSG(KERN_INFO "viafb_get_mode_index!\n"); |
@@ -1272,13 +1271,7 @@ int viafb_get_mode_index(int hres, int vres, int flag) | |||
1272 | viafb_modentry[i].yres == vres) | 1271 | viafb_modentry[i].yres == vres) |
1273 | break; | 1272 | break; |
1274 | 1273 | ||
1275 | viafb_resMode = viafb_modentry[i].mode_index; | 1274 | return viafb_modentry[i].mode_index; |
1276 | if (flag) | ||
1277 | viafb_mode1 = viafb_modentry[i].mode_res; | ||
1278 | else | ||
1279 | viafb_mode = viafb_modentry[i].mode_res; | ||
1280 | |||
1281 | return viafb_resMode; | ||
1282 | } | 1275 | } |
1283 | 1276 | ||
1284 | static void check_available_device_to_enable(int device_id) | 1277 | static void check_available_device_to_enable(int device_id) |
@@ -2199,7 +2192,7 @@ static int __devinit via_pci_probe(void) | |||
2199 | strict_strtoul(tmpc, 0, &default_xres); | 2192 | strict_strtoul(tmpc, 0, &default_xres); |
2200 | strict_strtoul(tmpm, 0, &default_yres); | 2193 | strict_strtoul(tmpm, 0, &default_yres); |
2201 | 2194 | ||
2202 | vmode_index = viafb_get_mode_index(default_xres, default_yres, 0); | 2195 | vmode_index = viafb_get_mode_index(default_xres, default_yres); |
2203 | DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index); | 2196 | DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index); |
2204 | 2197 | ||
2205 | if (viafb_SAMM_ON == 1) { | 2198 | if (viafb_SAMM_ON == 1) { |
diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h index a4158e87287..227b000feb3 100644 --- a/drivers/video/via/viafbdev.h +++ b/drivers/video/via/viafbdev.h | |||
@@ -81,7 +81,6 @@ struct viafb_modeinfo { | |||
81 | u32 xres; | 81 | u32 xres; |
82 | u32 yres; | 82 | u32 yres; |
83 | int mode_index; | 83 | int mode_index; |
84 | char *mode_res; | ||
85 | }; | 84 | }; |
86 | extern unsigned int viafb_second_virtual_yres; | 85 | extern unsigned int viafb_second_virtual_yres; |
87 | extern unsigned int viafb_second_virtual_xres; | 86 | extern unsigned int viafb_second_virtual_xres; |
@@ -102,7 +101,7 @@ extern int strict_strtoul(const char *cp, unsigned int base, | |||
102 | void viafb_memory_pitch_patch(struct fb_info *info); | 101 | void viafb_memory_pitch_patch(struct fb_info *info); |
103 | void viafb_fill_var_timing_info(struct fb_var_screeninfo *var, int refresh, | 102 | void viafb_fill_var_timing_info(struct fb_var_screeninfo *var, int refresh, |
104 | int mode_index); | 103 | int mode_index); |
105 | int viafb_get_mode_index(int hres, int vres, int flag); | 104 | int viafb_get_mode_index(int hres, int vres); |
106 | u8 viafb_gpio_i2c_read_lvds(struct lvds_setting_information | 105 | u8 viafb_gpio_i2c_read_lvds(struct lvds_setting_information |
107 | *plvds_setting_info, struct lvds_chip_information | 106 | *plvds_setting_info, struct lvds_chip_information |
108 | *plvds_chip_info, u8 index); | 107 | *plvds_chip_info, u8 index); |
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index a7e3b706b9d..0d92969404c 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c | |||
@@ -687,6 +687,7 @@ static int omap_hdq_remove(struct platform_device *pdev) | |||
687 | 687 | ||
688 | if (hdq_data->hdq_usecount) { | 688 | if (hdq_data->hdq_usecount) { |
689 | dev_dbg(&pdev->dev, "removed when use count is not zero\n"); | 689 | dev_dbg(&pdev->dev, "removed when use count is not zero\n"); |
690 | mutex_unlock(&hdq_data->hdq_mutex); | ||
690 | return -EBUSY; | 691 | return -EBUSY; |
691 | } | 692 | } |
692 | 693 | ||
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 697f6b5f131..e92f229e3c6 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -828,15 +828,22 @@ static int load_flat_shared_library(int id, struct lib_info *libs) | |||
828 | if (IS_ERR(bprm.file)) | 828 | if (IS_ERR(bprm.file)) |
829 | return res; | 829 | return res; |
830 | 830 | ||
831 | bprm.cred = prepare_exec_creds(); | ||
832 | res = -ENOMEM; | ||
833 | if (!bprm.cred) | ||
834 | goto out; | ||
835 | |||
831 | res = prepare_binprm(&bprm); | 836 | res = prepare_binprm(&bprm); |
832 | 837 | ||
833 | if (res <= (unsigned long)-4096) | 838 | if (res <= (unsigned long)-4096) |
834 | res = load_flat_file(&bprm, libs, id, NULL); | 839 | res = load_flat_file(&bprm, libs, id, NULL); |
835 | if (bprm.file) { | 840 | |
836 | allow_write_access(bprm.file); | 841 | abort_creds(bprm.cred); |
837 | fput(bprm.file); | 842 | |
838 | bprm.file = NULL; | 843 | out: |
839 | } | 844 | allow_write_access(bprm.file); |
845 | fput(bprm.file); | ||
846 | |||
840 | return(res); | 847 | return(res); |
841 | } | 848 | } |
842 | 849 | ||
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index f28f070a60f..f91fd51b32e 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -1905,6 +1905,7 @@ COMPATIBLE_IOCTL(FIONCLEX) | |||
1905 | COMPATIBLE_IOCTL(FIOASYNC) | 1905 | COMPATIBLE_IOCTL(FIOASYNC) |
1906 | COMPATIBLE_IOCTL(FIONBIO) | 1906 | COMPATIBLE_IOCTL(FIONBIO) |
1907 | COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */ | 1907 | COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */ |
1908 | COMPATIBLE_IOCTL(FS_IOC_FIEMAP) | ||
1908 | /* 0x00 */ | 1909 | /* 0x00 */ |
1909 | COMPATIBLE_IOCTL(FIBMAP) | 1910 | COMPATIBLE_IOCTL(FIBMAP) |
1910 | COMPATIBLE_IOCTL(FIGETBSZ) | 1911 | COMPATIBLE_IOCTL(FIGETBSZ) |
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 5edc2bf2058..23c94753986 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c | |||
@@ -99,7 +99,7 @@ static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg) | |||
99 | kunmap(pg); | 99 | kunmap(pg); |
100 | 100 | ||
101 | D2(printk(KERN_DEBUG "readpage finished\n")); | 101 | D2(printk(KERN_DEBUG "readpage finished\n")); |
102 | return 0; | 102 | return ret; |
103 | } | 103 | } |
104 | 104 | ||
105 | int jffs2_do_readpage_unlock(struct inode *inode, struct page *pg) | 105 | int jffs2_do_readpage_unlock(struct inode *inode, struct page *pg) |
diff --git a/fs/namespace.c b/fs/namespace.c index 277c28a63ea..7230787d18b 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -316,7 +316,8 @@ EXPORT_SYMBOL_GPL(mnt_clone_write); | |||
316 | */ | 316 | */ |
317 | int mnt_want_write_file(struct file *file) | 317 | int mnt_want_write_file(struct file *file) |
318 | { | 318 | { |
319 | if (!(file->f_mode & FMODE_WRITE)) | 319 | struct inode *inode = file->f_dentry->d_inode; |
320 | if (!(file->f_mode & FMODE_WRITE) || special_file(inode->i_mode)) | ||
320 | return mnt_want_write(file->f_path.mnt); | 321 | return mnt_want_write(file->f_path.mnt); |
321 | else | 322 | else |
322 | return mnt_clone_write(file->f_path.mnt); | 323 | return mnt_clone_write(file->f_path.mnt); |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 9d4c0049154..853508499d2 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -370,6 +370,11 @@ | |||
370 | {0x1002, 0x9614, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 370 | {0x1002, 0x9614, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
371 | {0x1002, 0x9615, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 371 | {0x1002, 0x9615, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
372 | {0x1002, 0x9616, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 372 | {0x1002, 0x9616, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
373 | {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
374 | {0x1002, 0x9711, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
375 | {0x1002, 0x9712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
376 | {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
377 | {0x1002, 0x9714, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
373 | {0, 0, 0} | 378 | {0, 0, 0} |
374 | 379 | ||
375 | #define r128_PCI_IDS \ | 380 | #define r128_PCI_IDS \ |
diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h index 6dfb856327b..0c7111a55a1 100644 --- a/include/linux/decompress/generic.h +++ b/include/linux/decompress/generic.h | |||
@@ -1,31 +1,37 @@ | |||
1 | #ifndef DECOMPRESS_GENERIC_H | 1 | #ifndef DECOMPRESS_GENERIC_H |
2 | #define DECOMPRESS_GENERIC_H | 2 | #define DECOMPRESS_GENERIC_H |
3 | 3 | ||
4 | /* Minimal chunksize to be read. | ||
5 | *Bzip2 prefers at least 4096 | ||
6 | *Lzma prefers 0x10000 */ | ||
7 | #define COMPR_IOBUF_SIZE 4096 | ||
8 | |||
9 | typedef int (*decompress_fn) (unsigned char *inbuf, int len, | 4 | typedef int (*decompress_fn) (unsigned char *inbuf, int len, |
10 | int(*fill)(void*, unsigned int), | 5 | int(*fill)(void*, unsigned int), |
11 | int(*writebb)(void*, unsigned int), | 6 | int(*flush)(void*, unsigned int), |
12 | unsigned char *output, | 7 | unsigned char *outbuf, |
13 | int *posp, | 8 | int *posp, |
14 | void(*error)(char *x)); | 9 | void(*error)(char *x)); |
15 | 10 | ||
16 | /* inbuf - input buffer | 11 | /* inbuf - input buffer |
17 | *len - len of pre-read data in inbuf | 12 | *len - len of pre-read data in inbuf |
18 | *fill - function to fill inbuf if empty | 13 | *fill - function to fill inbuf when empty |
19 | *writebb - function to write out outbug | 14 | *flush - function to write out outbuf |
15 | *outbuf - output buffer | ||
20 | *posp - if non-null, input position (number of bytes read) will be | 16 | *posp - if non-null, input position (number of bytes read) will be |
21 | * returned here | 17 | * returned here |
22 | * | 18 | * |
23 | *If len != 0, the inbuf is initialized (with as much data), and fill | 19 | *If len != 0, inbuf should contain all the necessary input data, and fill |
24 | *should not be called | 20 | *should be NULL |
25 | *If len = 0, the inbuf is allocated, but empty. Its size is IOBUF_SIZE | 21 | *If len = 0, inbuf can be NULL, in which case the decompressor will allocate |
26 | *fill should be called (repeatedly...) to read data, at most IOBUF_SIZE | 22 | *the input buffer. If inbuf != NULL it must be at least XXX_IOBUF_SIZE bytes. |
23 | *fill will be called (repeatedly...) to read data, at most XXX_IOBUF_SIZE | ||
24 | *bytes should be read per call. Replace XXX with the appropriate decompressor | ||
25 | *name, i.e. LZMA_IOBUF_SIZE. | ||
26 | * | ||
27 | *If flush = NULL, outbuf must be large enough to buffer all the expected | ||
28 | *output. If flush != NULL, the output buffer will be allocated by the | ||
29 | *decompressor (outbuf = NULL), and the flush function will be called to | ||
30 | *flush the output buffer at the appropriate time (decompressor and stream | ||
31 | *dependent). | ||
27 | */ | 32 | */ |
28 | 33 | ||
34 | |||
29 | /* Utility routine to detect the decompression method */ | 35 | /* Utility routine to detect the decompression method */ |
30 | decompress_fn decompress_method(const unsigned char *inbuf, int len, | 36 | decompress_fn decompress_method(const unsigned char *inbuf, int len, |
31 | const char **name); | 37 | const char **name); |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 5c093ffc655..d7cd193c227 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -119,11 +119,9 @@ struct ftrace_event_call { | |||
119 | void *filter; | 119 | void *filter; |
120 | void *mod; | 120 | void *mod; |
121 | 121 | ||
122 | #ifdef CONFIG_EVENT_PROFILE | 122 | atomic_t profile_count; |
123 | atomic_t profile_count; | 123 | int (*profile_enable)(struct ftrace_event_call *); |
124 | int (*profile_enable)(struct ftrace_event_call *); | 124 | void (*profile_disable)(struct ftrace_event_call *); |
125 | void (*profile_disable)(struct ftrace_event_call *); | ||
126 | #endif | ||
127 | }; | 125 | }; |
128 | 126 | ||
129 | #define MAX_FILTER_PRED 32 | 127 | #define MAX_FILTER_PRED 32 |
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index 7964516c695..15d5903af2d 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h | |||
@@ -15,12 +15,13 @@ | |||
15 | #define KEY_COL(k) (((k) >> 16) & 0xff) | 15 | #define KEY_COL(k) (((k) >> 16) & 0xff) |
16 | #define KEY_VAL(k) ((k) & 0xffff) | 16 | #define KEY_VAL(k) ((k) & 0xffff) |
17 | 17 | ||
18 | #define MATRIX_SCAN_CODE(row, col, row_shift) (((row) << (row_shift)) + (col)) | ||
19 | |||
18 | /** | 20 | /** |
19 | * struct matrix_keymap_data - keymap for matrix keyboards | 21 | * struct matrix_keymap_data - keymap for matrix keyboards |
20 | * @keymap: pointer to array of uint32 values encoded with KEY() macro | 22 | * @keymap: pointer to array of uint32 values encoded with KEY() macro |
21 | * representing keymap | 23 | * representing keymap |
22 | * @keymap_size: number of entries (initialized) in this keymap | 24 | * @keymap_size: number of entries (initialized) in this keymap |
23 | * @max_keymap_size: maximum size of keymap supported by the device | ||
24 | * | 25 | * |
25 | * This structure is supposed to be used by platform code to supply | 26 | * This structure is supposed to be used by platform code to supply |
26 | * keymaps to drivers that implement matrix-like keypads/keyboards. | 27 | * keymaps to drivers that implement matrix-like keypads/keyboards. |
@@ -28,14 +29,13 @@ | |||
28 | struct matrix_keymap_data { | 29 | struct matrix_keymap_data { |
29 | const uint32_t *keymap; | 30 | const uint32_t *keymap; |
30 | unsigned int keymap_size; | 31 | unsigned int keymap_size; |
31 | unsigned int max_keymap_size; | ||
32 | }; | 32 | }; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * struct matrix_keypad_platform_data - platform-dependent keypad data | 35 | * struct matrix_keypad_platform_data - platform-dependent keypad data |
36 | * @keymap_data: pointer to &matrix_keymap_data | 36 | * @keymap_data: pointer to &matrix_keymap_data |
37 | * @row_gpios: array of gpio numbers reporesenting rows | 37 | * @row_gpios: pointer to array of gpio numbers representing rows |
38 | * @col_gpios: array of gpio numbers reporesenting colums | 38 | * @col_gpios: pointer to array of gpio numbers reporesenting colums |
39 | * @num_row_gpios: actual number of row gpios used by device | 39 | * @num_row_gpios: actual number of row gpios used by device |
40 | * @num_col_gpios: actual number of col gpios used by device | 40 | * @num_col_gpios: actual number of col gpios used by device |
41 | * @col_scan_delay_us: delay, measured in microseconds, that is | 41 | * @col_scan_delay_us: delay, measured in microseconds, that is |
@@ -48,8 +48,9 @@ struct matrix_keymap_data { | |||
48 | struct matrix_keypad_platform_data { | 48 | struct matrix_keypad_platform_data { |
49 | const struct matrix_keymap_data *keymap_data; | 49 | const struct matrix_keymap_data *keymap_data; |
50 | 50 | ||
51 | unsigned int row_gpios[MATRIX_MAX_ROWS]; | 51 | const unsigned int *row_gpios; |
52 | unsigned int col_gpios[MATRIX_MAX_COLS]; | 52 | const unsigned int *col_gpios; |
53 | |||
53 | unsigned int num_row_gpios; | 54 | unsigned int num_row_gpios; |
54 | unsigned int num_col_gpios; | 55 | unsigned int num_col_gpios; |
55 | 56 | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 5675b63a063..0f32a9b6ff5 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -251,7 +251,7 @@ struct mtd_info { | |||
251 | 251 | ||
252 | static inline struct mtd_info *dev_to_mtd(struct device *dev) | 252 | static inline struct mtd_info *dev_to_mtd(struct device *dev) |
253 | { | 253 | { |
254 | return dev ? container_of(dev, struct mtd_info, dev) : NULL; | 254 | return dev ? dev_get_drvdata(dev) : NULL; |
255 | } | 255 | } |
256 | 256 | ||
257 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) | 257 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) |
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index af6dcb992bc..b70313d33ff 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h | |||
@@ -47,6 +47,8 @@ struct mtd_partition { | |||
47 | #define MTDPART_SIZ_FULL (0) | 47 | #define MTDPART_SIZ_FULL (0) |
48 | 48 | ||
49 | 49 | ||
50 | struct mtd_info; | ||
51 | |||
50 | int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); | 52 | int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); |
51 | int del_mtd_partitions(struct mtd_info *); | 53 | int del_mtd_partitions(struct mtd_info *); |
52 | 54 | ||
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 829b94b156f..b359c4a9ec9 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h | |||
@@ -82,6 +82,12 @@ | |||
82 | * to generate slightly worse code. So use a simple one-line #define | 82 | * to generate slightly worse code. So use a simple one-line #define |
83 | * for node_isset(), instead of wrapping an inline inside a macro, the | 83 | * for node_isset(), instead of wrapping an inline inside a macro, the |
84 | * way we do the other calls. | 84 | * way we do the other calls. |
85 | * | ||
86 | * NODEMASK_SCRATCH | ||
87 | * When doing above logical AND, OR, XOR, Remap operations the callers tend to | ||
88 | * need temporary nodemask_t's on the stack. But if NODES_SHIFT is large, | ||
89 | * nodemask_t's consume too much stack space. NODEMASK_SCRATCH is a helper | ||
90 | * for such situations. See below and CPUMASK_ALLOC also. | ||
85 | */ | 91 | */ |
86 | 92 | ||
87 | #include <linux/kernel.h> | 93 | #include <linux/kernel.h> |
@@ -473,4 +479,26 @@ static inline int num_node_state(enum node_states state) | |||
473 | #define for_each_node(node) for_each_node_state(node, N_POSSIBLE) | 479 | #define for_each_node(node) for_each_node_state(node, N_POSSIBLE) |
474 | #define for_each_online_node(node) for_each_node_state(node, N_ONLINE) | 480 | #define for_each_online_node(node) for_each_node_state(node, N_ONLINE) |
475 | 481 | ||
482 | /* | ||
483 | * For nodemask scrach area.(See CPUMASK_ALLOC() in cpumask.h) | ||
484 | */ | ||
485 | |||
486 | #if NODES_SHIFT > 8 /* nodemask_t > 64 bytes */ | ||
487 | #define NODEMASK_ALLOC(x, m) struct x *m = kmalloc(sizeof(*m), GFP_KERNEL) | ||
488 | #define NODEMASK_FREE(m) kfree(m) | ||
489 | #else | ||
490 | #define NODEMASK_ALLOC(x, m) struct x _m, *m = &_m | ||
491 | #define NODEMASK_FREE(m) | ||
492 | #endif | ||
493 | |||
494 | /* A example struture for using NODEMASK_ALLOC, used in mempolicy. */ | ||
495 | struct nodemask_scratch { | ||
496 | nodemask_t mask1; | ||
497 | nodemask_t mask2; | ||
498 | }; | ||
499 | |||
500 | #define NODEMASK_SCRATCH(x) NODEMASK_ALLOC(nodemask_scratch, x) | ||
501 | #define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x) | ||
502 | |||
503 | |||
476 | #endif /* __LINUX_NODEMASK_H */ | 504 | #endif /* __LINUX_NODEMASK_H */ |
diff --git a/kernel/fork.c b/kernel/fork.c index 466531eb92c..021e1138556 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -568,18 +568,18 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm) | |||
568 | * the value intact in a core dump, and to save the unnecessary | 568 | * the value intact in a core dump, and to save the unnecessary |
569 | * trouble otherwise. Userland only wants this done for a sys_exit. | 569 | * trouble otherwise. Userland only wants this done for a sys_exit. |
570 | */ | 570 | */ |
571 | if (tsk->clear_child_tid | 571 | if (tsk->clear_child_tid) { |
572 | && !(tsk->flags & PF_SIGNALED) | 572 | if (!(tsk->flags & PF_SIGNALED) && |
573 | && atomic_read(&mm->mm_users) > 1) { | 573 | atomic_read(&mm->mm_users) > 1) { |
574 | u32 __user * tidptr = tsk->clear_child_tid; | 574 | /* |
575 | * We don't check the error code - if userspace has | ||
576 | * not set up a proper pointer then tough luck. | ||
577 | */ | ||
578 | put_user(0, tsk->clear_child_tid); | ||
579 | sys_futex(tsk->clear_child_tid, FUTEX_WAKE, | ||
580 | 1, NULL, NULL, 0); | ||
581 | } | ||
575 | tsk->clear_child_tid = NULL; | 582 | tsk->clear_child_tid = NULL; |
576 | |||
577 | /* | ||
578 | * We don't check the error code - if userspace has | ||
579 | * not set up a proper pointer then tough luck. | ||
580 | */ | ||
581 | put_user(0, tidptr); | ||
582 | sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0); | ||
583 | } | 583 | } |
584 | } | 584 | } |
585 | 585 | ||
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 199ed477131..673c1aaf733 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -1104,7 +1104,7 @@ static void perf_counter_sync_stat(struct perf_counter_context *ctx, | |||
1104 | __perf_counter_sync_stat(counter, next_counter); | 1104 | __perf_counter_sync_stat(counter, next_counter); |
1105 | 1105 | ||
1106 | counter = list_next_entry(counter, event_entry); | 1106 | counter = list_next_entry(counter, event_entry); |
1107 | next_counter = list_next_entry(counter, event_entry); | 1107 | next_counter = list_next_entry(next_counter, event_entry); |
1108 | } | 1108 | } |
1109 | } | 1109 | } |
1110 | 1110 | ||
diff --git a/kernel/smp.c b/kernel/smp.c index ad63d850120..94188b8ecc3 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -57,7 +57,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) | |||
57 | return NOTIFY_BAD; | 57 | return NOTIFY_BAD; |
58 | break; | 58 | break; |
59 | 59 | ||
60 | #ifdef CONFIG_CPU_HOTPLUG | 60 | #ifdef CONFIG_HOTPLUG_CPU |
61 | case CPU_UP_CANCELED: | 61 | case CPU_UP_CANCELED: |
62 | case CPU_UP_CANCELED_FROZEN: | 62 | case CPU_UP_CANCELED_FROZEN: |
63 | 63 | ||
diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c index 5b5895afecf..11ba5bb4ed0 100644 --- a/kernel/trace/trace_event_profile.c +++ b/kernel/trace/trace_event_profile.c | |||
@@ -14,7 +14,7 @@ int ftrace_profile_enable(int event_id) | |||
14 | 14 | ||
15 | mutex_lock(&event_mutex); | 15 | mutex_lock(&event_mutex); |
16 | list_for_each_entry(event, &ftrace_events, list) { | 16 | list_for_each_entry(event, &ftrace_events, list) { |
17 | if (event->id == event_id) { | 17 | if (event->id == event_id && event->profile_enable) { |
18 | ret = event->profile_enable(event); | 18 | ret = event->profile_enable(event); |
19 | break; | 19 | break; |
20 | } | 20 | } |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 23d2972b22d..e75276a49cf 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -940,7 +940,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events, | |||
940 | entry = trace_create_file("enable", 0644, call->dir, call, | 940 | entry = trace_create_file("enable", 0644, call->dir, call, |
941 | enable); | 941 | enable); |
942 | 942 | ||
943 | if (call->id) | 943 | if (call->id && call->profile_enable) |
944 | entry = trace_create_file("id", 0444, call->dir, call, | 944 | entry = trace_create_file("id", 0444, call->dir, call, |
945 | id); | 945 | id); |
946 | 946 | ||
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c index 708e2a86d87..600f473a561 100644 --- a/lib/decompress_bunzip2.c +++ b/lib/decompress_bunzip2.c | |||
@@ -45,12 +45,14 @@ | |||
45 | */ | 45 | */ |
46 | 46 | ||
47 | 47 | ||
48 | #ifndef STATIC | 48 | #ifdef STATIC |
49 | #define PREBOOT | ||
50 | #else | ||
49 | #include <linux/decompress/bunzip2.h> | 51 | #include <linux/decompress/bunzip2.h> |
50 | #endif /* !STATIC */ | 52 | #include <linux/slab.h> |
53 | #endif /* STATIC */ | ||
51 | 54 | ||
52 | #include <linux/decompress/mm.h> | 55 | #include <linux/decompress/mm.h> |
53 | #include <linux/slab.h> | ||
54 | 56 | ||
55 | #ifndef INT_MAX | 57 | #ifndef INT_MAX |
56 | #define INT_MAX 0x7fffffff | 58 | #define INT_MAX 0x7fffffff |
@@ -681,9 +683,7 @@ STATIC int INIT bunzip2(unsigned char *buf, int len, | |||
681 | set_error_fn(error_fn); | 683 | set_error_fn(error_fn); |
682 | if (flush) | 684 | if (flush) |
683 | outbuf = malloc(BZIP2_IOBUF_SIZE); | 685 | outbuf = malloc(BZIP2_IOBUF_SIZE); |
684 | else | 686 | |
685 | len -= 4; /* Uncompressed size hack active in pre-boot | ||
686 | environment */ | ||
687 | if (!outbuf) { | 687 | if (!outbuf) { |
688 | error("Could not allocate output bufer"); | 688 | error("Could not allocate output bufer"); |
689 | return -1; | 689 | return -1; |
@@ -733,4 +733,14 @@ exit_0: | |||
733 | return i; | 733 | return i; |
734 | } | 734 | } |
735 | 735 | ||
736 | #define decompress bunzip2 | 736 | #ifdef PREBOOT |
737 | STATIC int INIT decompress(unsigned char *buf, int len, | ||
738 | int(*fill)(void*, unsigned int), | ||
739 | int(*flush)(void*, unsigned int), | ||
740 | unsigned char *outbuf, | ||
741 | int *pos, | ||
742 | void(*error_fn)(char *x)) | ||
743 | { | ||
744 | return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error_fn); | ||
745 | } | ||
746 | #endif | ||
diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c index e36b296fc9f..68dfce59c1b 100644 --- a/lib/decompress_inflate.c +++ b/lib/decompress_inflate.c | |||
@@ -19,13 +19,13 @@ | |||
19 | #include "zlib_inflate/inflate.h" | 19 | #include "zlib_inflate/inflate.h" |
20 | 20 | ||
21 | #include "zlib_inflate/infutil.h" | 21 | #include "zlib_inflate/infutil.h" |
22 | #include <linux/slab.h> | ||
22 | 23 | ||
23 | #endif /* STATIC */ | 24 | #endif /* STATIC */ |
24 | 25 | ||
25 | #include <linux/decompress/mm.h> | 26 | #include <linux/decompress/mm.h> |
26 | #include <linux/slab.h> | ||
27 | 27 | ||
28 | #define INBUF_LEN (16*1024) | 28 | #define GZIP_IOBUF_SIZE (16*1024) |
29 | 29 | ||
30 | /* Included from initramfs et al code */ | 30 | /* Included from initramfs et al code */ |
31 | STATIC int INIT gunzip(unsigned char *buf, int len, | 31 | STATIC int INIT gunzip(unsigned char *buf, int len, |
@@ -55,7 +55,7 @@ STATIC int INIT gunzip(unsigned char *buf, int len, | |||
55 | if (buf) | 55 | if (buf) |
56 | zbuf = buf; | 56 | zbuf = buf; |
57 | else { | 57 | else { |
58 | zbuf = malloc(INBUF_LEN); | 58 | zbuf = malloc(GZIP_IOBUF_SIZE); |
59 | len = 0; | 59 | len = 0; |
60 | } | 60 | } |
61 | if (!zbuf) { | 61 | if (!zbuf) { |
@@ -77,7 +77,7 @@ STATIC int INIT gunzip(unsigned char *buf, int len, | |||
77 | } | 77 | } |
78 | 78 | ||
79 | if (len == 0) | 79 | if (len == 0) |
80 | len = fill(zbuf, INBUF_LEN); | 80 | len = fill(zbuf, GZIP_IOBUF_SIZE); |
81 | 81 | ||
82 | /* verify the gzip header */ | 82 | /* verify the gzip header */ |
83 | if (len < 10 || | 83 | if (len < 10 || |
@@ -113,7 +113,7 @@ STATIC int INIT gunzip(unsigned char *buf, int len, | |||
113 | while (rc == Z_OK) { | 113 | while (rc == Z_OK) { |
114 | if (strm->avail_in == 0) { | 114 | if (strm->avail_in == 0) { |
115 | /* TODO: handle case where both pos and fill are set */ | 115 | /* TODO: handle case where both pos and fill are set */ |
116 | len = fill(zbuf, INBUF_LEN); | 116 | len = fill(zbuf, GZIP_IOBUF_SIZE); |
117 | if (len < 0) { | 117 | if (len < 0) { |
118 | rc = -1; | 118 | rc = -1; |
119 | error("read error"); | 119 | error("read error"); |
diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c index 32123a1340e..0b954e04bd3 100644 --- a/lib/decompress_unlzma.c +++ b/lib/decompress_unlzma.c | |||
@@ -29,12 +29,14 @@ | |||
29 | *Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 29 | *Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef STATIC | 32 | #ifdef STATIC |
33 | #define PREBOOT | ||
34 | #else | ||
33 | #include <linux/decompress/unlzma.h> | 35 | #include <linux/decompress/unlzma.h> |
36 | #include <linux/slab.h> | ||
34 | #endif /* STATIC */ | 37 | #endif /* STATIC */ |
35 | 38 | ||
36 | #include <linux/decompress/mm.h> | 39 | #include <linux/decompress/mm.h> |
37 | #include <linux/slab.h> | ||
38 | 40 | ||
39 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) | 41 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
40 | 42 | ||
@@ -543,9 +545,7 @@ STATIC inline int INIT unlzma(unsigned char *buf, int in_len, | |||
543 | int ret = -1; | 545 | int ret = -1; |
544 | 546 | ||
545 | set_error_fn(error_fn); | 547 | set_error_fn(error_fn); |
546 | if (!flush) | 548 | |
547 | in_len -= 4; /* Uncompressed size hack active in pre-boot | ||
548 | environment */ | ||
549 | if (buf) | 549 | if (buf) |
550 | inbuf = buf; | 550 | inbuf = buf; |
551 | else | 551 | else |
@@ -645,4 +645,15 @@ exit_0: | |||
645 | return ret; | 645 | return ret; |
646 | } | 646 | } |
647 | 647 | ||
648 | #define decompress unlzma | 648 | #ifdef PREBOOT |
649 | STATIC int INIT decompress(unsigned char *buf, int in_len, | ||
650 | int(*fill)(void*, unsigned int), | ||
651 | int(*flush)(void*, unsigned int), | ||
652 | unsigned char *output, | ||
653 | int *posp, | ||
654 | void(*error_fn)(char *x) | ||
655 | ) | ||
656 | { | ||
657 | return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn); | ||
658 | } | ||
659 | #endif | ||
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index e08e2c4da63..7dd9d9f8069 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -191,25 +191,27 @@ static int mpol_new_bind(struct mempolicy *pol, const nodemask_t *nodes) | |||
191 | * Must be called holding task's alloc_lock to protect task's mems_allowed | 191 | * Must be called holding task's alloc_lock to protect task's mems_allowed |
192 | * and mempolicy. May also be called holding the mmap_semaphore for write. | 192 | * and mempolicy. May also be called holding the mmap_semaphore for write. |
193 | */ | 193 | */ |
194 | static int mpol_set_nodemask(struct mempolicy *pol, const nodemask_t *nodes) | 194 | static int mpol_set_nodemask(struct mempolicy *pol, |
195 | const nodemask_t *nodes, struct nodemask_scratch *nsc) | ||
195 | { | 196 | { |
196 | nodemask_t cpuset_context_nmask; | ||
197 | int ret; | 197 | int ret; |
198 | 198 | ||
199 | /* if mode is MPOL_DEFAULT, pol is NULL. This is right. */ | 199 | /* if mode is MPOL_DEFAULT, pol is NULL. This is right. */ |
200 | if (pol == NULL) | 200 | if (pol == NULL) |
201 | return 0; | 201 | return 0; |
202 | /* Check N_HIGH_MEMORY */ | ||
203 | nodes_and(nsc->mask1, | ||
204 | cpuset_current_mems_allowed, node_states[N_HIGH_MEMORY]); | ||
202 | 205 | ||
203 | VM_BUG_ON(!nodes); | 206 | VM_BUG_ON(!nodes); |
204 | if (pol->mode == MPOL_PREFERRED && nodes_empty(*nodes)) | 207 | if (pol->mode == MPOL_PREFERRED && nodes_empty(*nodes)) |
205 | nodes = NULL; /* explicit local allocation */ | 208 | nodes = NULL; /* explicit local allocation */ |
206 | else { | 209 | else { |
207 | if (pol->flags & MPOL_F_RELATIVE_NODES) | 210 | if (pol->flags & MPOL_F_RELATIVE_NODES) |
208 | mpol_relative_nodemask(&cpuset_context_nmask, nodes, | 211 | mpol_relative_nodemask(&nsc->mask2, nodes,&nsc->mask1); |
209 | &cpuset_current_mems_allowed); | ||
210 | else | 212 | else |
211 | nodes_and(cpuset_context_nmask, *nodes, | 213 | nodes_and(nsc->mask2, *nodes, nsc->mask1); |
212 | cpuset_current_mems_allowed); | 214 | |
213 | if (mpol_store_user_nodemask(pol)) | 215 | if (mpol_store_user_nodemask(pol)) |
214 | pol->w.user_nodemask = *nodes; | 216 | pol->w.user_nodemask = *nodes; |
215 | else | 217 | else |
@@ -217,8 +219,10 @@ static int mpol_set_nodemask(struct mempolicy *pol, const nodemask_t *nodes) | |||
217 | cpuset_current_mems_allowed; | 219 | cpuset_current_mems_allowed; |
218 | } | 220 | } |
219 | 221 | ||
220 | ret = mpol_ops[pol->mode].create(pol, | 222 | if (nodes) |
221 | nodes ? &cpuset_context_nmask : NULL); | 223 | ret = mpol_ops[pol->mode].create(pol, &nsc->mask2); |
224 | else | ||
225 | ret = mpol_ops[pol->mode].create(pol, NULL); | ||
222 | return ret; | 226 | return ret; |
223 | } | 227 | } |
224 | 228 | ||
@@ -620,12 +624,17 @@ static long do_set_mempolicy(unsigned short mode, unsigned short flags, | |||
620 | { | 624 | { |
621 | struct mempolicy *new, *old; | 625 | struct mempolicy *new, *old; |
622 | struct mm_struct *mm = current->mm; | 626 | struct mm_struct *mm = current->mm; |
627 | NODEMASK_SCRATCH(scratch); | ||
623 | int ret; | 628 | int ret; |
624 | 629 | ||
625 | new = mpol_new(mode, flags, nodes); | 630 | if (!scratch) |
626 | if (IS_ERR(new)) | 631 | return -ENOMEM; |
627 | return PTR_ERR(new); | ||
628 | 632 | ||
633 | new = mpol_new(mode, flags, nodes); | ||
634 | if (IS_ERR(new)) { | ||
635 | ret = PTR_ERR(new); | ||
636 | goto out; | ||
637 | } | ||
629 | /* | 638 | /* |
630 | * prevent changing our mempolicy while show_numa_maps() | 639 | * prevent changing our mempolicy while show_numa_maps() |
631 | * is using it. | 640 | * is using it. |
@@ -635,13 +644,13 @@ static long do_set_mempolicy(unsigned short mode, unsigned short flags, | |||
635 | if (mm) | 644 | if (mm) |
636 | down_write(&mm->mmap_sem); | 645 | down_write(&mm->mmap_sem); |
637 | task_lock(current); | 646 | task_lock(current); |
638 | ret = mpol_set_nodemask(new, nodes); | 647 | ret = mpol_set_nodemask(new, nodes, scratch); |
639 | if (ret) { | 648 | if (ret) { |
640 | task_unlock(current); | 649 | task_unlock(current); |
641 | if (mm) | 650 | if (mm) |
642 | up_write(&mm->mmap_sem); | 651 | up_write(&mm->mmap_sem); |
643 | mpol_put(new); | 652 | mpol_put(new); |
644 | return ret; | 653 | goto out; |
645 | } | 654 | } |
646 | old = current->mempolicy; | 655 | old = current->mempolicy; |
647 | current->mempolicy = new; | 656 | current->mempolicy = new; |
@@ -654,7 +663,10 @@ static long do_set_mempolicy(unsigned short mode, unsigned short flags, | |||
654 | up_write(&mm->mmap_sem); | 663 | up_write(&mm->mmap_sem); |
655 | 664 | ||
656 | mpol_put(old); | 665 | mpol_put(old); |
657 | return 0; | 666 | ret = 0; |
667 | out: | ||
668 | NODEMASK_SCRATCH_FREE(scratch); | ||
669 | return ret; | ||
658 | } | 670 | } |
659 | 671 | ||
660 | /* | 672 | /* |
@@ -1014,12 +1026,20 @@ static long do_mbind(unsigned long start, unsigned long len, | |||
1014 | if (err) | 1026 | if (err) |
1015 | return err; | 1027 | return err; |
1016 | } | 1028 | } |
1017 | down_write(&mm->mmap_sem); | 1029 | { |
1018 | task_lock(current); | 1030 | NODEMASK_SCRATCH(scratch); |
1019 | err = mpol_set_nodemask(new, nmask); | 1031 | if (scratch) { |
1020 | task_unlock(current); | 1032 | down_write(&mm->mmap_sem); |
1033 | task_lock(current); | ||
1034 | err = mpol_set_nodemask(new, nmask, scratch); | ||
1035 | task_unlock(current); | ||
1036 | if (err) | ||
1037 | up_write(&mm->mmap_sem); | ||
1038 | } else | ||
1039 | err = -ENOMEM; | ||
1040 | NODEMASK_SCRATCH_FREE(scratch); | ||
1041 | } | ||
1021 | if (err) { | 1042 | if (err) { |
1022 | up_write(&mm->mmap_sem); | ||
1023 | mpol_put(new); | 1043 | mpol_put(new); |
1024 | return err; | 1044 | return err; |
1025 | } | 1045 | } |
@@ -1891,6 +1911,7 @@ restart: | |||
1891 | * Install non-NULL @mpol in inode's shared policy rb-tree. | 1911 | * Install non-NULL @mpol in inode's shared policy rb-tree. |
1892 | * On entry, the current task has a reference on a non-NULL @mpol. | 1912 | * On entry, the current task has a reference on a non-NULL @mpol. |
1893 | * This must be released on exit. | 1913 | * This must be released on exit. |
1914 | * This is called at get_inode() calls and we can use GFP_KERNEL. | ||
1894 | */ | 1915 | */ |
1895 | void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) | 1916 | void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) |
1896 | { | 1917 | { |
@@ -1902,19 +1923,24 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) | |||
1902 | if (mpol) { | 1923 | if (mpol) { |
1903 | struct vm_area_struct pvma; | 1924 | struct vm_area_struct pvma; |
1904 | struct mempolicy *new; | 1925 | struct mempolicy *new; |
1926 | NODEMASK_SCRATCH(scratch); | ||
1905 | 1927 | ||
1928 | if (!scratch) | ||
1929 | return; | ||
1906 | /* contextualize the tmpfs mount point mempolicy */ | 1930 | /* contextualize the tmpfs mount point mempolicy */ |
1907 | new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask); | 1931 | new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask); |
1908 | if (IS_ERR(new)) { | 1932 | if (IS_ERR(new)) { |
1909 | mpol_put(mpol); /* drop our ref on sb mpol */ | 1933 | mpol_put(mpol); /* drop our ref on sb mpol */ |
1934 | NODEMASK_SCRATCH_FREE(scratch); | ||
1910 | return; /* no valid nodemask intersection */ | 1935 | return; /* no valid nodemask intersection */ |
1911 | } | 1936 | } |
1912 | 1937 | ||
1913 | task_lock(current); | 1938 | task_lock(current); |
1914 | ret = mpol_set_nodemask(new, &mpol->w.user_nodemask); | 1939 | ret = mpol_set_nodemask(new, &mpol->w.user_nodemask, scratch); |
1915 | task_unlock(current); | 1940 | task_unlock(current); |
1916 | mpol_put(mpol); /* drop our ref on sb mpol */ | 1941 | mpol_put(mpol); /* drop our ref on sb mpol */ |
1917 | if (ret) { | 1942 | if (ret) { |
1943 | NODEMASK_SCRATCH_FREE(scratch); | ||
1918 | mpol_put(new); | 1944 | mpol_put(new); |
1919 | return; | 1945 | return; |
1920 | } | 1946 | } |
@@ -1924,6 +1950,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) | |||
1924 | pvma.vm_end = TASK_SIZE; /* policy covers entire file */ | 1950 | pvma.vm_end = TASK_SIZE; /* policy covers entire file */ |
1925 | mpol_set_shared_policy(sp, &pvma, new); /* adds ref */ | 1951 | mpol_set_shared_policy(sp, &pvma, new); /* adds ref */ |
1926 | mpol_put(new); /* drop initial ref */ | 1952 | mpol_put(new); /* drop initial ref */ |
1953 | NODEMASK_SCRATCH_FREE(scratch); | ||
1927 | } | 1954 | } |
1928 | } | 1955 | } |
1929 | 1956 | ||
@@ -2140,13 +2167,18 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2140 | err = 1; | 2167 | err = 1; |
2141 | else { | 2168 | else { |
2142 | int ret; | 2169 | int ret; |
2143 | 2170 | NODEMASK_SCRATCH(scratch); | |
2144 | task_lock(current); | 2171 | if (scratch) { |
2145 | ret = mpol_set_nodemask(new, &nodes); | 2172 | task_lock(current); |
2146 | task_unlock(current); | 2173 | ret = mpol_set_nodemask(new, &nodes, scratch); |
2147 | if (ret) | 2174 | task_unlock(current); |
2175 | } else | ||
2176 | ret = -ENOMEM; | ||
2177 | NODEMASK_SCRATCH_FREE(scratch); | ||
2178 | if (ret) { | ||
2148 | err = 1; | 2179 | err = 1; |
2149 | else if (no_context) { | 2180 | mpol_put(new); |
2181 | } else if (no_context) { | ||
2150 | /* save for contextualization */ | 2182 | /* save for contextualization */ |
2151 | new->w.user_nodemask = nodes; | 2183 | new->w.user_nodemask = nodes; |
2152 | } | 2184 | } |
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index 1dbc1eeb4c0..6be696b0a2b 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -29,13 +29,67 @@ OPTIONS | |||
29 | Select the PMU event. Selection can be a symbolic event name | 29 | Select the PMU event. Selection can be a symbolic event name |
30 | (use 'perf list' to list all events) or a raw PMU | 30 | (use 'perf list' to list all events) or a raw PMU |
31 | event (eventsel+umask) in the form of rNNN where NNN is a | 31 | event (eventsel+umask) in the form of rNNN where NNN is a |
32 | hexadecimal event descriptor. | 32 | hexadecimal event descriptor. |
33 | 33 | ||
34 | -a:: | 34 | -a:: |
35 | system-wide collection | 35 | System-wide collection. |
36 | 36 | ||
37 | -l:: | 37 | -l:: |
38 | scale counter values | 38 | Scale counter values. |
39 | |||
40 | -p:: | ||
41 | --pid=:: | ||
42 | Record events on existing pid. | ||
43 | |||
44 | -r:: | ||
45 | --realtime=:: | ||
46 | Collect data with this RT SCHED_FIFO priority. | ||
47 | -A:: | ||
48 | --append:: | ||
49 | Append to the output file to do incremental profiling. | ||
50 | |||
51 | -f:: | ||
52 | --force:: | ||
53 | Overwrite existing data file. | ||
54 | |||
55 | -c:: | ||
56 | --count=:: | ||
57 | Event period to sample. | ||
58 | |||
59 | -o:: | ||
60 | --output=:: | ||
61 | Output file name. | ||
62 | |||
63 | -i:: | ||
64 | --inherit:: | ||
65 | Child tasks inherit counters. | ||
66 | -F:: | ||
67 | --freq=:: | ||
68 | Profile at this frequency. | ||
69 | |||
70 | -m:: | ||
71 | --mmap-pages=:: | ||
72 | Number of mmap data pages. | ||
73 | |||
74 | -g:: | ||
75 | --call-graph:: | ||
76 | Do call-graph (stack chain/backtrace) recording. | ||
77 | |||
78 | -v:: | ||
79 | --verbose:: | ||
80 | Be more verbose (show counter open errors, etc). | ||
81 | |||
82 | -s:: | ||
83 | --stat:: | ||
84 | Per thread counts. | ||
85 | |||
86 | -d:: | ||
87 | --data:: | ||
88 | Sample addresses. | ||
89 | |||
90 | -n:: | ||
91 | --no-samples:: | ||
92 | Don't sample. | ||
39 | 93 | ||
40 | SEE ALSO | 94 | SEE ALSO |
41 | -------- | 95 | -------- |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 4b20fa47c3a..1916e44b9bb 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -158,8 +158,10 @@ uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') | |||
158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') | 158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') |
159 | 159 | ||
160 | # If we're on a 64-bit kernel, use -m64 | 160 | # If we're on a 64-bit kernel, use -m64 |
161 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) | 161 | ifndef NO_64BIT |
162 | M64 := -m64 | 162 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) |
163 | M64 := -m64 | ||
164 | endif | ||
163 | endif | 165 | endif |
164 | 166 | ||
165 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 167 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
@@ -345,7 +347,6 @@ BUILTIN_OBJS += builtin-stat.o | |||
345 | BUILTIN_OBJS += builtin-top.o | 347 | BUILTIN_OBJS += builtin-top.o |
346 | 348 | ||
347 | PERFLIBS = $(LIB_FILE) | 349 | PERFLIBS = $(LIB_FILE) |
348 | EXTLIBS = -lbfd -liberty | ||
349 | 350 | ||
350 | # | 351 | # |
351 | # Platform specific tweaks | 352 | # Platform specific tweaks |
@@ -374,6 +375,28 @@ ifeq ($(uname_S),Darwin) | |||
374 | PTHREAD_LIBS = | 375 | PTHREAD_LIBS = |
375 | endif | 376 | endif |
376 | 377 | ||
378 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) | ||
379 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); | ||
380 | endif | ||
381 | |||
382 | ifdef NO_DEMANGLE | ||
383 | BASIC_CFLAGS += -DNO_DEMANGLE | ||
384 | else | ||
385 | |||
386 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd > /dev/null 2>&1 && echo y") | ||
387 | |||
388 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y") | ||
389 | |||
390 | ifeq ($(has_bfd),y) | ||
391 | EXTLIBS += -lbfd | ||
392 | else ifeq ($(has_bfd_iberty),y) | ||
393 | EXTLIBS += -lbfd -liberty | ||
394 | else | ||
395 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling) | ||
396 | BASIC_CFLAGS += -DNO_DEMANGLE | ||
397 | endif | ||
398 | endif | ||
399 | |||
377 | ifndef CC_LD_DYNPATH | 400 | ifndef CC_LD_DYNPATH |
378 | ifdef NO_R_TO_GCC_LINKER | 401 | ifdef NO_R_TO_GCC_LINKER |
379 | # Some gcc does not accept and pass -R to the linker to specify | 402 | # Some gcc does not accept and pass -R to the linker to specify |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index ce4f28645e6..8cb58d68a00 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -31,7 +31,7 @@ | |||
31 | static char const *input_name = "perf.data"; | 31 | static char const *input_name = "perf.data"; |
32 | static char *vmlinux = NULL; | 32 | static char *vmlinux = NULL; |
33 | 33 | ||
34 | static char default_sort_order[] = "comm,dso"; | 34 | static char default_sort_order[] = "comm,dso,symbol"; |
35 | static char *sort_order = default_sort_order; | 35 | static char *sort_order = default_sort_order; |
36 | static char *dso_list_str, *comm_list_str, *sym_list_str, | 36 | static char *dso_list_str, *comm_list_str, *sym_list_str, |
37 | *col_width_list_str; | 37 | *col_width_list_str; |
@@ -1424,7 +1424,7 @@ print_entries: | |||
1424 | if (sort_order == default_sort_order && | 1424 | if (sort_order == default_sort_order && |
1425 | parent_pattern == default_parent_pattern) { | 1425 | parent_pattern == default_parent_pattern) { |
1426 | fprintf(fp, "#\n"); | 1426 | fprintf(fp, "#\n"); |
1427 | fprintf(fp, "# (For more details, try: perf report --sort comm,dso,symbol)\n"); | 1427 | fprintf(fp, "# (For a higher level overview, try: perf report --sort comm,dso)\n"); |
1428 | fprintf(fp, "#\n"); | 1428 | fprintf(fp, "#\n"); |
1429 | } | 1429 | } |
1430 | fprintf(fp, "\n"); | 1430 | fprintf(fp, "\n"); |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index b4fe0579bd6..16ddca20294 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -6,7 +6,16 @@ | |||
6 | #include <libelf.h> | 6 | #include <libelf.h> |
7 | #include <gelf.h> | 7 | #include <gelf.h> |
8 | #include <elf.h> | 8 | #include <elf.h> |
9 | |||
10 | #ifndef NO_DEMANGLE | ||
9 | #include <bfd.h> | 11 | #include <bfd.h> |
12 | #else | ||
13 | static inline | ||
14 | char *bfd_demangle(void __used *v, const char __used *c, int __used i) | ||
15 | { | ||
16 | return NULL; | ||
17 | } | ||
18 | #endif | ||
10 | 19 | ||
11 | const char *sym_hist_filter; | 20 | const char *sym_hist_filter; |
12 | 21 | ||
@@ -652,10 +661,69 @@ out_close: | |||
652 | return err; | 661 | return err; |
653 | } | 662 | } |
654 | 663 | ||
664 | #define BUILD_ID_SIZE 128 | ||
665 | |||
666 | static char *dso__read_build_id(struct dso *self, int verbose) | ||
667 | { | ||
668 | int i; | ||
669 | GElf_Ehdr ehdr; | ||
670 | GElf_Shdr shdr; | ||
671 | Elf_Data *build_id_data; | ||
672 | Elf_Scn *sec; | ||
673 | char *build_id = NULL, *bid; | ||
674 | unsigned char *raw; | ||
675 | Elf *elf; | ||
676 | int fd = open(self->name, O_RDONLY); | ||
677 | |||
678 | if (fd < 0) | ||
679 | goto out; | ||
680 | |||
681 | elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); | ||
682 | if (elf == NULL) { | ||
683 | if (verbose) | ||
684 | fprintf(stderr, "%s: cannot read %s ELF file.\n", | ||
685 | __func__, self->name); | ||
686 | goto out_close; | ||
687 | } | ||
688 | |||
689 | if (gelf_getehdr(elf, &ehdr) == NULL) { | ||
690 | if (verbose) | ||
691 | fprintf(stderr, "%s: cannot get elf header.\n", __func__); | ||
692 | goto out_elf_end; | ||
693 | } | ||
694 | |||
695 | sec = elf_section_by_name(elf, &ehdr, &shdr, ".note.gnu.build-id", NULL); | ||
696 | if (sec == NULL) | ||
697 | goto out_elf_end; | ||
698 | |||
699 | build_id_data = elf_getdata(sec, NULL); | ||
700 | if (build_id_data == NULL) | ||
701 | goto out_elf_end; | ||
702 | build_id = malloc(BUILD_ID_SIZE); | ||
703 | if (build_id == NULL) | ||
704 | goto out_elf_end; | ||
705 | raw = build_id_data->d_buf + 16; | ||
706 | bid = build_id; | ||
707 | |||
708 | for (i = 0; i < 20; ++i) { | ||
709 | sprintf(bid, "%02x", *raw); | ||
710 | ++raw; | ||
711 | bid += 2; | ||
712 | } | ||
713 | if (verbose) | ||
714 | printf("%s(%s): %s\n", __func__, self->name, build_id); | ||
715 | out_elf_end: | ||
716 | elf_end(elf); | ||
717 | out_close: | ||
718 | close(fd); | ||
719 | out: | ||
720 | return build_id; | ||
721 | } | ||
722 | |||
655 | int dso__load(struct dso *self, symbol_filter_t filter, int verbose) | 723 | int dso__load(struct dso *self, symbol_filter_t filter, int verbose) |
656 | { | 724 | { |
657 | int size = strlen(self->name) + sizeof("/usr/lib/debug%s.debug"); | 725 | int size = PATH_MAX; |
658 | char *name = malloc(size); | 726 | char *name = malloc(size), *build_id = NULL; |
659 | int variant = 0; | 727 | int variant = 0; |
660 | int ret = -1; | 728 | int ret = -1; |
661 | int fd; | 729 | int fd; |
@@ -677,7 +745,18 @@ more: | |||
677 | case 1: /* Ubuntu */ | 745 | case 1: /* Ubuntu */ |
678 | snprintf(name, size, "/usr/lib/debug%s", self->name); | 746 | snprintf(name, size, "/usr/lib/debug%s", self->name); |
679 | break; | 747 | break; |
680 | case 2: /* Sane people */ | 748 | case 2: |
749 | build_id = dso__read_build_id(self, verbose); | ||
750 | if (build_id != NULL) { | ||
751 | snprintf(name, size, | ||
752 | "/usr/lib/debug/.build-id/%.2s/%s.debug", | ||
753 | build_id, build_id + 2); | ||
754 | free(build_id); | ||
755 | break; | ||
756 | } | ||
757 | variant++; | ||
758 | /* Fall thru */ | ||
759 | case 3: /* Sane people */ | ||
681 | snprintf(name, size, "%s", self->name); | 760 | snprintf(name, size, "%s", self->name); |
682 | break; | 761 | break; |
683 | 762 | ||