diff options
Diffstat (limited to 'drivers')
98 files changed, 1245 insertions, 723 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index edda9ea7c626..bd112c8c7bcd 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -949,7 +949,7 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) | |||
949 | lo->lo_state = Lo_unbound; | 949 | lo->lo_state = Lo_unbound; |
950 | /* This is safe: open() is still holding a reference. */ | 950 | /* This is safe: open() is still holding a reference. */ |
951 | module_put(THIS_MODULE); | 951 | module_put(THIS_MODULE); |
952 | if (max_part > 0) | 952 | if (max_part > 0 && bdev) |
953 | ioctl_by_bdev(bdev, BLKRRPART, 0); | 953 | ioctl_by_bdev(bdev, BLKRRPART, 0); |
954 | mutex_unlock(&lo->lo_ctl_mutex); | 954 | mutex_unlock(&lo->lo_ctl_mutex); |
955 | /* | 955 | /* |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index ad41f19b8e3f..12fdd3987a36 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -76,8 +76,11 @@ static void cpuidle_idle_call(void) | |||
76 | #endif | 76 | #endif |
77 | /* ask the governor for the next state */ | 77 | /* ask the governor for the next state */ |
78 | next_state = cpuidle_curr_governor->select(dev); | 78 | next_state = cpuidle_curr_governor->select(dev); |
79 | if (need_resched()) | 79 | if (need_resched()) { |
80 | local_irq_enable(); | ||
80 | return; | 81 | return; |
82 | } | ||
83 | |||
81 | target_state = &dev->states[next_state]; | 84 | target_state = &dev->states[next_state]; |
82 | 85 | ||
83 | /* enter the state and update stats */ | 86 | /* enter the state and update stats */ |
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c index d335086f4a26..77a9579d7167 100644 --- a/drivers/edac/i5000_edac.c +++ b/drivers/edac/i5000_edac.c | |||
@@ -1173,7 +1173,7 @@ static void i5000_get_mc_regs(struct mem_ctl_info *mci) | |||
1173 | pci_read_config_word(pvt->branch_1, where, | 1173 | pci_read_config_word(pvt->branch_1, where, |
1174 | &pvt->b1_mtr[slot_row]); | 1174 | &pvt->b1_mtr[slot_row]); |
1175 | debugf2("MTR%d where=0x%x B1 value=0x%x\n", slot_row, | 1175 | debugf2("MTR%d where=0x%x B1 value=0x%x\n", slot_row, |
1176 | where, pvt->b0_mtr[slot_row]); | 1176 | where, pvt->b1_mtr[slot_row]); |
1177 | } else { | 1177 | } else { |
1178 | pvt->b1_mtr[slot_row] = 0; | 1178 | pvt->b1_mtr[slot_row] = 0; |
1179 | } | 1179 | } |
@@ -1232,7 +1232,7 @@ static int i5000_init_csrows(struct mem_ctl_info *mci) | |||
1232 | struct csrow_info *p_csrow; | 1232 | struct csrow_info *p_csrow; |
1233 | int empty, channel_count; | 1233 | int empty, channel_count; |
1234 | int max_csrows; | 1234 | int max_csrows; |
1235 | int mtr; | 1235 | int mtr, mtr1; |
1236 | int csrow_megs; | 1236 | int csrow_megs; |
1237 | int channel; | 1237 | int channel; |
1238 | int csrow; | 1238 | int csrow; |
@@ -1251,9 +1251,10 @@ static int i5000_init_csrows(struct mem_ctl_info *mci) | |||
1251 | 1251 | ||
1252 | /* use branch 0 for the basis */ | 1252 | /* use branch 0 for the basis */ |
1253 | mtr = pvt->b0_mtr[csrow >> 1]; | 1253 | mtr = pvt->b0_mtr[csrow >> 1]; |
1254 | mtr1 = pvt->b1_mtr[csrow >> 1]; | ||
1254 | 1255 | ||
1255 | /* if no DIMMS on this row, continue */ | 1256 | /* if no DIMMS on this row, continue */ |
1256 | if (!MTR_DIMMS_PRESENT(mtr)) | 1257 | if (!MTR_DIMMS_PRESENT(mtr) && !MTR_DIMMS_PRESENT(mtr1)) |
1257 | continue; | 1258 | continue; |
1258 | 1259 | ||
1259 | /* FAKE OUT VALUES, FIXME */ | 1260 | /* FAKE OUT VALUES, FIXME */ |
diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c index b08b6d8e2dc7..f99d10655ed4 100644 --- a/drivers/edac/i5400_edac.c +++ b/drivers/edac/i5400_edac.c | |||
@@ -46,9 +46,10 @@ | |||
46 | /* Limits for i5400 */ | 46 | /* Limits for i5400 */ |
47 | #define NUM_MTRS_PER_BRANCH 4 | 47 | #define NUM_MTRS_PER_BRANCH 4 |
48 | #define CHANNELS_PER_BRANCH 2 | 48 | #define CHANNELS_PER_BRANCH 2 |
49 | #define MAX_DIMMS_PER_CHANNEL NUM_MTRS_PER_BRANCH | ||
49 | #define MAX_CHANNELS 4 | 50 | #define MAX_CHANNELS 4 |
50 | #define MAX_DIMMS (MAX_CHANNELS * 4) /* Up to 4 DIMM's per channel */ | 51 | /* max possible csrows per channel */ |
51 | #define MAX_CSROWS (MAX_DIMMS * 2) /* max possible csrows per channel */ | 52 | #define MAX_CSROWS (MAX_DIMMS_PER_CHANNEL) |
52 | 53 | ||
53 | /* Device 16, | 54 | /* Device 16, |
54 | * Function 0: System Address | 55 | * Function 0: System Address |
@@ -331,7 +332,6 @@ static const struct i5400_dev_info i5400_devs[] = { | |||
331 | 332 | ||
332 | struct i5400_dimm_info { | 333 | struct i5400_dimm_info { |
333 | int megabytes; /* size, 0 means not present */ | 334 | int megabytes; /* size, 0 means not present */ |
334 | int dual_rank; | ||
335 | }; | 335 | }; |
336 | 336 | ||
337 | /* driver private data structure */ | 337 | /* driver private data structure */ |
@@ -849,11 +849,9 @@ static int determine_mtr(struct i5400_pvt *pvt, int csrow, int channel) | |||
849 | int n; | 849 | int n; |
850 | 850 | ||
851 | /* There is one MTR for each slot pair of FB-DIMMs, | 851 | /* There is one MTR for each slot pair of FB-DIMMs, |
852 | Each slot may have one or two ranks (2 csrows), | ||
853 | Each slot pair may be at branch 0 or branch 1. | 852 | Each slot pair may be at branch 0 or branch 1. |
854 | So, csrow should be divided by eight | ||
855 | */ | 853 | */ |
856 | n = csrow >> 3; | 854 | n = csrow; |
857 | 855 | ||
858 | if (n >= NUM_MTRS_PER_BRANCH) { | 856 | if (n >= NUM_MTRS_PER_BRANCH) { |
859 | debugf0("ERROR: trying to access an invalid csrow: %d\n", | 857 | debugf0("ERROR: trying to access an invalid csrow: %d\n", |
@@ -905,25 +903,22 @@ static void handle_channel(struct i5400_pvt *pvt, int csrow, int channel, | |||
905 | amb_present_reg = determine_amb_present_reg(pvt, channel); | 903 | amb_present_reg = determine_amb_present_reg(pvt, channel); |
906 | 904 | ||
907 | /* Determine if there is a DIMM present in this DIMM slot */ | 905 | /* Determine if there is a DIMM present in this DIMM slot */ |
908 | if (amb_present_reg & (1 << (csrow >> 1))) { | 906 | if (amb_present_reg & (1 << csrow)) { |
909 | dinfo->dual_rank = MTR_DIMM_RANK(mtr); | 907 | /* Start with the number of bits for a Bank |
910 | 908 | * on the DRAM */ | |
911 | if (!((dinfo->dual_rank == 0) && | 909 | addrBits = MTR_DRAM_BANKS_ADDR_BITS(mtr); |
912 | ((csrow & 0x1) == 0x1))) { | 910 | /* Add thenumber of ROW bits */ |
913 | /* Start with the number of bits for a Bank | 911 | addrBits += MTR_DIMM_ROWS_ADDR_BITS(mtr); |
914 | * on the DRAM */ | 912 | /* add the number of COLUMN bits */ |
915 | addrBits = MTR_DRAM_BANKS_ADDR_BITS(mtr); | 913 | addrBits += MTR_DIMM_COLS_ADDR_BITS(mtr); |
916 | /* Add thenumber of ROW bits */ | 914 | /* add the number of RANK bits */ |
917 | addrBits += MTR_DIMM_ROWS_ADDR_BITS(mtr); | 915 | addrBits += MTR_DIMM_RANK(mtr); |
918 | /* add the number of COLUMN bits */ | 916 | |
919 | addrBits += MTR_DIMM_COLS_ADDR_BITS(mtr); | 917 | addrBits += 6; /* add 64 bits per DIMM */ |
920 | 918 | addrBits -= 20; /* divide by 2^^20 */ | |
921 | addrBits += 6; /* add 64 bits per DIMM */ | 919 | addrBits -= 3; /* 8 bits per bytes */ |
922 | addrBits -= 20; /* divide by 2^^20 */ | 920 | |
923 | addrBits -= 3; /* 8 bits per bytes */ | 921 | dinfo->megabytes = 1 << addrBits; |
924 | |||
925 | dinfo->megabytes = 1 << addrBits; | ||
926 | } | ||
927 | } | 922 | } |
928 | } | 923 | } |
929 | } | 924 | } |
@@ -951,12 +946,12 @@ static void calculate_dimm_size(struct i5400_pvt *pvt) | |||
951 | return; | 946 | return; |
952 | } | 947 | } |
953 | 948 | ||
954 | /* Scan all the actual CSROWS (which is # of DIMMS * 2) | 949 | /* Scan all the actual CSROWS |
955 | * and calculate the information for each DIMM | 950 | * and calculate the information for each DIMM |
956 | * Start with the highest csrow first, to display it first | 951 | * Start with the highest csrow first, to display it first |
957 | * and work toward the 0th csrow | 952 | * and work toward the 0th csrow |
958 | */ | 953 | */ |
959 | max_csrows = pvt->maxdimmperch * 2; | 954 | max_csrows = pvt->maxdimmperch; |
960 | for (csrow = max_csrows - 1; csrow >= 0; csrow--) { | 955 | for (csrow = max_csrows - 1; csrow >= 0; csrow--) { |
961 | 956 | ||
962 | /* on an odd csrow, first output a 'boundary' marker, | 957 | /* on an odd csrow, first output a 'boundary' marker, |
@@ -1064,7 +1059,7 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci) | |||
1064 | 1059 | ||
1065 | /* Get the set of MTR[0-3] regs by each branch */ | 1060 | /* Get the set of MTR[0-3] regs by each branch */ |
1066 | for (slot_row = 0; slot_row < NUM_MTRS_PER_BRANCH; slot_row++) { | 1061 | for (slot_row = 0; slot_row < NUM_MTRS_PER_BRANCH; slot_row++) { |
1067 | int where = MTR0 + (slot_row * sizeof(u32)); | 1062 | int where = MTR0 + (slot_row * sizeof(u16)); |
1068 | 1063 | ||
1069 | /* Branch 0 set of MTR registers */ | 1064 | /* Branch 0 set of MTR registers */ |
1070 | pci_read_config_word(pvt->branch_0, where, | 1065 | pci_read_config_word(pvt->branch_0, where, |
@@ -1146,7 +1141,7 @@ static int i5400_init_csrows(struct mem_ctl_info *mci) | |||
1146 | pvt = mci->pvt_info; | 1141 | pvt = mci->pvt_info; |
1147 | 1142 | ||
1148 | channel_count = pvt->maxch; | 1143 | channel_count = pvt->maxch; |
1149 | max_csrows = pvt->maxdimmperch * 2; | 1144 | max_csrows = pvt->maxdimmperch; |
1150 | 1145 | ||
1151 | empty = 1; /* Assume NO memory */ | 1146 | empty = 1; /* Assume NO memory */ |
1152 | 1147 | ||
@@ -1215,28 +1210,6 @@ static void i5400_enable_error_reporting(struct mem_ctl_info *mci) | |||
1215 | } | 1210 | } |
1216 | 1211 | ||
1217 | /* | 1212 | /* |
1218 | * i5400_get_dimm_and_channel_counts(pdev, &num_csrows, &num_channels) | ||
1219 | * | ||
1220 | * ask the device how many channels are present and how many CSROWS | ||
1221 | * as well | ||
1222 | */ | ||
1223 | static void i5400_get_dimm_and_channel_counts(struct pci_dev *pdev, | ||
1224 | int *num_dimms_per_channel, | ||
1225 | int *num_channels) | ||
1226 | { | ||
1227 | u8 value; | ||
1228 | |||
1229 | /* Need to retrieve just how many channels and dimms per channel are | ||
1230 | * supported on this memory controller | ||
1231 | */ | ||
1232 | pci_read_config_byte(pdev, MAXDIMMPERCH, &value); | ||
1233 | *num_dimms_per_channel = (int)value * 2; | ||
1234 | |||
1235 | pci_read_config_byte(pdev, MAXCH, &value); | ||
1236 | *num_channels = (int)value; | ||
1237 | } | ||
1238 | |||
1239 | /* | ||
1240 | * i5400_probe1 Probe for ONE instance of device to see if it is | 1213 | * i5400_probe1 Probe for ONE instance of device to see if it is |
1241 | * present. | 1214 | * present. |
1242 | * return: | 1215 | * return: |
@@ -1263,22 +1236,16 @@ static int i5400_probe1(struct pci_dev *pdev, int dev_idx) | |||
1263 | if (PCI_FUNC(pdev->devfn) != 0) | 1236 | if (PCI_FUNC(pdev->devfn) != 0) |
1264 | return -ENODEV; | 1237 | return -ENODEV; |
1265 | 1238 | ||
1266 | /* Ask the devices for the number of CSROWS and CHANNELS so | 1239 | /* As we don't have a motherboard identification routine to determine |
1267 | * that we can calculate the memory resources, etc | ||
1268 | * | ||
1269 | * The Chipset will report what it can handle which will be greater | ||
1270 | * or equal to what the motherboard manufacturer will implement. | ||
1271 | * | ||
1272 | * As we don't have a motherboard identification routine to determine | ||
1273 | * actual number of slots/dimms per channel, we thus utilize the | 1240 | * actual number of slots/dimms per channel, we thus utilize the |
1274 | * resource as specified by the chipset. Thus, we might have | 1241 | * resource as specified by the chipset. Thus, we might have |
1275 | * have more DIMMs per channel than actually on the mobo, but this | 1242 | * have more DIMMs per channel than actually on the mobo, but this |
1276 | * allows the driver to support upto the chipset max, without | 1243 | * allows the driver to support upto the chipset max, without |
1277 | * some fancy mobo determination. | 1244 | * some fancy mobo determination. |
1278 | */ | 1245 | */ |
1279 | i5400_get_dimm_and_channel_counts(pdev, &num_dimms_per_channel, | 1246 | num_dimms_per_channel = MAX_DIMMS_PER_CHANNEL; |
1280 | &num_channels); | 1247 | num_channels = MAX_CHANNELS; |
1281 | num_csrows = num_dimms_per_channel * 2; | 1248 | num_csrows = num_dimms_per_channel; |
1282 | 1249 | ||
1283 | debugf0("MC: %s(): Number of - Channels= %d DIMMS= %d CSROWS= %d\n", | 1250 | debugf0("MC: %s(): Number of - Channels= %d DIMMS= %d CSROWS= %d\n", |
1284 | __func__, num_channels, num_dimms_per_channel, num_csrows); | 1251 | __func__, num_channels, num_dimms_per_channel, num_csrows); |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 157f6504f25e..cf27402af97b 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
@@ -26,7 +26,9 @@ | |||
26 | #include "mpc85xx_edac.h" | 26 | #include "mpc85xx_edac.h" |
27 | 27 | ||
28 | static int edac_dev_idx; | 28 | static int edac_dev_idx; |
29 | #ifdef CONFIG_PCI | ||
29 | static int edac_pci_idx; | 30 | static int edac_pci_idx; |
31 | #endif | ||
30 | static int edac_mc_idx; | 32 | static int edac_mc_idx; |
31 | 33 | ||
32 | static u32 orig_ddr_err_disable; | 34 | static u32 orig_ddr_err_disable; |
diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index afad14792141..49384a7c5492 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c | |||
@@ -460,7 +460,8 @@ no_irqs: | |||
460 | return ret; | 460 | return ret; |
461 | } | 461 | } |
462 | 462 | ||
463 | static int __devexit gpio_twl4030_remove(struct platform_device *pdev) | 463 | /* Cannot use __devexit as gpio_twl4030_probe() calls us */ |
464 | static int gpio_twl4030_remove(struct platform_device *pdev) | ||
464 | { | 465 | { |
465 | struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; | 466 | struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; |
466 | int status; | 467 | int status; |
@@ -493,7 +494,7 @@ static struct platform_driver gpio_twl4030_driver = { | |||
493 | .driver.name = "twl4030_gpio", | 494 | .driver.name = "twl4030_gpio", |
494 | .driver.owner = THIS_MODULE, | 495 | .driver.owner = THIS_MODULE, |
495 | .probe = gpio_twl4030_probe, | 496 | .probe = gpio_twl4030_probe, |
496 | .remove = __devexit_p(gpio_twl4030_remove), | 497 | .remove = gpio_twl4030_remove, |
497 | }; | 498 | }; |
498 | 499 | ||
499 | static int __init gpio_twl4030_init(void) | 500 | static int __init gpio_twl4030_init(void) |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 3c0d2b3aed76..cea665d86dd3 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -626,6 +626,12 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
626 | return NULL; | 626 | return NULL; |
627 | } | 627 | } |
628 | 628 | ||
629 | /* it is incorrect if hsync/vsync width is zero */ | ||
630 | if (!hsync_pulse_width || !vsync_pulse_width) { | ||
631 | DRM_DEBUG_KMS("Incorrect Detailed timing. " | ||
632 | "Wrong Hsync/Vsync pulse width\n"); | ||
633 | return NULL; | ||
634 | } | ||
629 | mode = drm_mode_create(dev); | 635 | mode = drm_mode_create(dev); |
630 | if (!mode) | 636 | if (!mode) |
631 | return NULL; | 637 | return NULL; |
@@ -647,6 +653,15 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
647 | mode->vsync_end = mode->vsync_start + vsync_pulse_width; | 653 | mode->vsync_end = mode->vsync_start + vsync_pulse_width; |
648 | mode->vtotal = mode->vdisplay + vblank; | 654 | mode->vtotal = mode->vdisplay + vblank; |
649 | 655 | ||
656 | /* perform the basic check for the detailed timing */ | ||
657 | if (mode->hsync_end > mode->htotal || | ||
658 | mode->vsync_end > mode->vtotal) { | ||
659 | drm_mode_destroy(dev, mode); | ||
660 | DRM_DEBUG_KMS("Incorrect detailed timing. " | ||
661 | "Sync is beyond the blank.\n"); | ||
662 | return NULL; | ||
663 | } | ||
664 | |||
650 | drm_mode_set_name(mode); | 665 | drm_mode_set_name(mode); |
651 | 666 | ||
652 | if (pt->misc & DRM_EDID_PT_INTERLACED) | 667 | if (pt->misc & DRM_EDID_PT_INTERLACED) |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 23dc9c115fd9..9c924614c418 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -454,22 +454,39 @@ out_free: | |||
454 | } | 454 | } |
455 | EXPORT_SYMBOL(drm_fb_helper_init_crtc_count); | 455 | EXPORT_SYMBOL(drm_fb_helper_init_crtc_count); |
456 | 456 | ||
457 | static void setcolreg(struct drm_crtc *crtc, u16 red, u16 green, | 457 | static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green, |
458 | u16 blue, u16 regno, struct fb_info *info) | 458 | u16 blue, u16 regno, struct fb_info *info) |
459 | { | 459 | { |
460 | struct drm_fb_helper *fb_helper = info->par; | 460 | struct drm_fb_helper *fb_helper = info->par; |
461 | struct drm_framebuffer *fb = fb_helper->fb; | 461 | struct drm_framebuffer *fb = fb_helper->fb; |
462 | int pindex; | 462 | int pindex; |
463 | 463 | ||
464 | if (info->fix.visual == FB_VISUAL_TRUECOLOR) { | ||
465 | u32 *palette; | ||
466 | u32 value; | ||
467 | /* place color in psuedopalette */ | ||
468 | if (regno > 16) | ||
469 | return -EINVAL; | ||
470 | palette = (u32 *)info->pseudo_palette; | ||
471 | red >>= (16 - info->var.red.length); | ||
472 | green >>= (16 - info->var.green.length); | ||
473 | blue >>= (16 - info->var.blue.length); | ||
474 | value = (red << info->var.red.offset) | | ||
475 | (green << info->var.green.offset) | | ||
476 | (blue << info->var.blue.offset); | ||
477 | palette[regno] = value; | ||
478 | return 0; | ||
479 | } | ||
480 | |||
464 | pindex = regno; | 481 | pindex = regno; |
465 | 482 | ||
466 | if (fb->bits_per_pixel == 16) { | 483 | if (fb->bits_per_pixel == 16) { |
467 | pindex = regno << 3; | 484 | pindex = regno << 3; |
468 | 485 | ||
469 | if (fb->depth == 16 && regno > 63) | 486 | if (fb->depth == 16 && regno > 63) |
470 | return; | 487 | return -EINVAL; |
471 | if (fb->depth == 15 && regno > 31) | 488 | if (fb->depth == 15 && regno > 31) |
472 | return; | 489 | return -EINVAL; |
473 | 490 | ||
474 | if (fb->depth == 16) { | 491 | if (fb->depth == 16) { |
475 | u16 r, g, b; | 492 | u16 r, g, b; |
@@ -493,13 +510,7 @@ static void setcolreg(struct drm_crtc *crtc, u16 red, u16 green, | |||
493 | 510 | ||
494 | if (fb->depth != 16) | 511 | if (fb->depth != 16) |
495 | fb_helper->funcs->gamma_set(crtc, red, green, blue, pindex); | 512 | fb_helper->funcs->gamma_set(crtc, red, green, blue, pindex); |
496 | 513 | return 0; | |
497 | if (regno < 16 && info->fix.visual == FB_VISUAL_DIRECTCOLOR) { | ||
498 | ((u32 *) fb->pseudo_palette)[regno] = | ||
499 | (regno << info->var.red.offset) | | ||
500 | (regno << info->var.green.offset) | | ||
501 | (regno << info->var.blue.offset); | ||
502 | } | ||
503 | } | 514 | } |
504 | 515 | ||
505 | int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info) | 516 | int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info) |
@@ -536,7 +547,9 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info) | |||
536 | if (transp) | 547 | if (transp) |
537 | htransp = *transp++; | 548 | htransp = *transp++; |
538 | 549 | ||
539 | setcolreg(crtc, hred, hgreen, hblue, start++, info); | 550 | rc = setcolreg(crtc, hred, hgreen, hblue, start++, info); |
551 | if (rc) | ||
552 | return rc; | ||
540 | } | 553 | } |
541 | crtc_funcs->load_lut(crtc); | 554 | crtc_funcs->load_lut(crtc); |
542 | } | 555 | } |
@@ -555,6 +568,7 @@ int drm_fb_helper_setcolreg(unsigned regno, | |||
555 | struct drm_device *dev = fb_helper->dev; | 568 | struct drm_device *dev = fb_helper->dev; |
556 | struct drm_crtc *crtc; | 569 | struct drm_crtc *crtc; |
557 | int i; | 570 | int i; |
571 | int ret; | ||
558 | 572 | ||
559 | if (regno > 255) | 573 | if (regno > 255) |
560 | return 1; | 574 | return 1; |
@@ -568,8 +582,10 @@ int drm_fb_helper_setcolreg(unsigned regno, | |||
568 | if (i == fb_helper->crtc_count) | 582 | if (i == fb_helper->crtc_count) |
569 | continue; | 583 | continue; |
570 | 584 | ||
585 | ret = setcolreg(crtc, red, green, blue, regno, info); | ||
586 | if (ret) | ||
587 | return ret; | ||
571 | 588 | ||
572 | setcolreg(crtc, red, green, blue, regno, info); | ||
573 | crtc_funcs->load_lut(crtc); | 589 | crtc_funcs->load_lut(crtc); |
574 | } | 590 | } |
575 | return 0; | 591 | return 0; |
@@ -928,7 +944,7 @@ void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, | |||
928 | { | 944 | { |
929 | info->fix.type = FB_TYPE_PACKED_PIXELS; | 945 | info->fix.type = FB_TYPE_PACKED_PIXELS; |
930 | info->fix.visual = depth == 8 ? FB_VISUAL_PSEUDOCOLOR : | 946 | info->fix.visual = depth == 8 ? FB_VISUAL_PSEUDOCOLOR : |
931 | FB_VISUAL_DIRECTCOLOR; | 947 | FB_VISUAL_TRUECOLOR; |
932 | info->fix.type_aux = 0; | 948 | info->fix.type_aux = 0; |
933 | info->fix.xpanstep = 1; /* doing it in hw */ | 949 | info->fix.xpanstep = 1; /* doing it in hw */ |
934 | info->fix.ypanstep = 1; /* doing it in hw */ | 950 | info->fix.ypanstep = 1; /* doing it in hw */ |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 3d667031de6e..df988142e6b0 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -582,10 +582,9 @@ int radeon_device_init(struct radeon_device *rdev, | |||
582 | DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size); | 582 | DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size); |
583 | 583 | ||
584 | /* if we have > 1 VGA cards, then disable the radeon VGA resources */ | 584 | /* if we have > 1 VGA cards, then disable the radeon VGA resources */ |
585 | r = vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); | 585 | /* this will fail for cards that aren't VGA class devices, just |
586 | if (r) { | 586 | * ignore it */ |
587 | return -EINVAL; | 587 | vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); |
588 | } | ||
589 | 588 | ||
590 | r = radeon_init(rdev); | 589 | r = radeon_init(rdev); |
591 | if (r) | 590 | if (r) |
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index 2c2cb1ec94c5..27d62574284f 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c | |||
@@ -572,7 +572,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev) | |||
572 | 572 | ||
573 | /* Sample register contents every 1 sec */ | 573 | /* Sample register contents every 1 sec */ |
574 | if (time_after(jiffies, data->last_update + HZ) || !data->valid) { | 574 | if (time_after(jiffies, data->last_update + HZ) || !data->valid) { |
575 | if (data->type != sch5027) { | 575 | if (data->type == dme1737) { |
576 | data->vid = dme1737_read(data, DME1737_REG_VID) & | 576 | data->vid = dme1737_read(data, DME1737_REG_VID) & |
577 | 0x3f; | 577 | 0x3f; |
578 | } | 578 | } |
@@ -1621,9 +1621,6 @@ static struct attribute *dme1737_misc_attr[] = { | |||
1621 | &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr, | 1621 | &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr, |
1622 | &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr, | 1622 | &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr, |
1623 | &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr, | 1623 | &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr, |
1624 | /* Misc */ | ||
1625 | &dev_attr_vrm.attr, | ||
1626 | &dev_attr_cpu0_vid.attr, | ||
1627 | NULL | 1624 | NULL |
1628 | }; | 1625 | }; |
1629 | 1626 | ||
@@ -1631,6 +1628,18 @@ static const struct attribute_group dme1737_misc_group = { | |||
1631 | .attrs = dme1737_misc_attr, | 1628 | .attrs = dme1737_misc_attr, |
1632 | }; | 1629 | }; |
1633 | 1630 | ||
1631 | /* The following struct holds VID-related attributes. Their creation | ||
1632 | depends on the chip type which is determined during module load. */ | ||
1633 | static struct attribute *dme1737_vid_attr[] = { | ||
1634 | &dev_attr_vrm.attr, | ||
1635 | &dev_attr_cpu0_vid.attr, | ||
1636 | NULL | ||
1637 | }; | ||
1638 | |||
1639 | static const struct attribute_group dme1737_vid_group = { | ||
1640 | .attrs = dme1737_vid_attr, | ||
1641 | }; | ||
1642 | |||
1634 | /* The following structs hold the PWM attributes, some of which are optional. | 1643 | /* The following structs hold the PWM attributes, some of which are optional. |
1635 | * Their creation depends on the chip configuration which is determined during | 1644 | * Their creation depends on the chip configuration which is determined during |
1636 | * module load. */ | 1645 | * module load. */ |
@@ -1902,6 +1911,9 @@ static void dme1737_remove_files(struct device *dev) | |||
1902 | if (data->type != sch5027) { | 1911 | if (data->type != sch5027) { |
1903 | sysfs_remove_group(&dev->kobj, &dme1737_misc_group); | 1912 | sysfs_remove_group(&dev->kobj, &dme1737_misc_group); |
1904 | } | 1913 | } |
1914 | if (data->type == dme1737) { | ||
1915 | sysfs_remove_group(&dev->kobj, &dme1737_vid_group); | ||
1916 | } | ||
1905 | 1917 | ||
1906 | sysfs_remove_group(&dev->kobj, &dme1737_group); | 1918 | sysfs_remove_group(&dev->kobj, &dme1737_group); |
1907 | 1919 | ||
@@ -1933,6 +1945,13 @@ static int dme1737_create_files(struct device *dev) | |||
1933 | goto exit_remove; | 1945 | goto exit_remove; |
1934 | } | 1946 | } |
1935 | 1947 | ||
1948 | /* Create VID-related sysfs attributes */ | ||
1949 | if ((data->type == dme1737) && | ||
1950 | (err = sysfs_create_group(&dev->kobj, | ||
1951 | &dme1737_vid_group))) { | ||
1952 | goto exit_remove; | ||
1953 | } | ||
1954 | |||
1936 | /* Create fan sysfs attributes */ | 1955 | /* Create fan sysfs attributes */ |
1937 | for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) { | 1956 | for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) { |
1938 | if (data->has_fan & (1 << ix)) { | 1957 | if (data->has_fan & (1 << ix)) { |
@@ -2127,7 +2146,7 @@ static int dme1737_init_device(struct device *dev) | |||
2127 | data->pwm_acz[2] = 4; /* pwm3 -> zone3 */ | 2146 | data->pwm_acz[2] = 4; /* pwm3 -> zone3 */ |
2128 | 2147 | ||
2129 | /* Set VRM */ | 2148 | /* Set VRM */ |
2130 | if (data->type != sch5027) { | 2149 | if (data->type == dme1737) { |
2131 | data->vrm = vid_which_vrm(); | 2150 | data->vrm = vid_which_vrm(); |
2132 | } | 2151 | } |
2133 | 2152 | ||
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index 2a7a85a6dc36..da1b1f9488af 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c | |||
@@ -819,7 +819,7 @@ static int watchdog_release(struct inode *inode, struct file *filp) | |||
819 | static ssize_t watchdog_write(struct file *filp, const char __user *buf, | 819 | static ssize_t watchdog_write(struct file *filp, const char __user *buf, |
820 | size_t count, loff_t *offset) | 820 | size_t count, loff_t *offset) |
821 | { | 821 | { |
822 | size_t ret; | 822 | int ret; |
823 | struct fschmd_data *data = filp->private_data; | 823 | struct fschmd_data *data = filp->private_data; |
824 | 824 | ||
825 | if (count) { | 825 | if (count) { |
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index 6679854c85b0..be475e844c2a 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
@@ -197,11 +197,13 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
197 | AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left), | 197 | AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left), |
198 | AXIS_DMI_MATCH("HP2140", "HP 2140", xy_swap_inverted), | 198 | AXIS_DMI_MATCH("HP2140", "HP 2140", xy_swap_inverted), |
199 | AXIS_DMI_MATCH("NC653x", "HP Compaq 653", xy_rotated_left_usd), | 199 | AXIS_DMI_MATCH("NC653x", "HP Compaq 653", xy_rotated_left_usd), |
200 | AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd), | 200 | AXIS_DMI_MATCH("NC6730b", "HP Compaq 6730b", xy_rotated_left_usd), |
201 | AXIS_DMI_MATCH("NC6730s", "HP Compaq 6730s", xy_swap), | ||
201 | AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), | 202 | AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), |
202 | AXIS_DMI_MATCH("NC6710x", "HP Compaq 6710", xy_swap_yz_inverted), | 203 | AXIS_DMI_MATCH("NC6710x", "HP Compaq 6710", xy_swap_yz_inverted), |
203 | AXIS_DMI_MATCH("NC6715x", "HP Compaq 6715", y_inverted), | 204 | AXIS_DMI_MATCH("NC6715x", "HP Compaq 6715", y_inverted), |
204 | AXIS_DMI_MATCH("NC693xx", "HP EliteBook 693", xy_rotated_right), | 205 | AXIS_DMI_MATCH("NC693xx", "HP EliteBook 693", xy_rotated_right), |
206 | AXIS_DMI_MATCH("NC693xx", "HP EliteBook 853", xy_swap), | ||
205 | /* Intel-based HP Pavilion dv5 */ | 207 | /* Intel-based HP Pavilion dv5 */ |
206 | AXIS_DMI_MATCH2("HPDV5_I", | 208 | AXIS_DMI_MATCH2("HPDV5_I", |
207 | PRODUCT_NAME, "HP Pavilion dv5", | 209 | PRODUCT_NAME, "HP Pavilion dv5", |
@@ -214,6 +216,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
214 | y_inverted), | 216 | y_inverted), |
215 | AXIS_DMI_MATCH("DV7", "HP Pavilion dv7", x_inverted), | 217 | AXIS_DMI_MATCH("DV7", "HP Pavilion dv7", x_inverted), |
216 | AXIS_DMI_MATCH("HP8710", "HP Compaq 8710", y_inverted), | 218 | AXIS_DMI_MATCH("HP8710", "HP Compaq 8710", y_inverted), |
219 | AXIS_DMI_MATCH("HDX18", "HP HDX 18", x_inverted), | ||
217 | { NULL, } | 220 | { NULL, } |
218 | /* Laptop models without axis info (yet): | 221 | /* Laptop models without axis info (yet): |
219 | * "NC6910" "HP Compaq 6910" | 222 | * "NC6910" "HP Compaq 6910" |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index ffeb2a10e1a7..a3749cb0f181 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -1028,12 +1028,11 @@ static int __init it87_find(unsigned short *address, | |||
1028 | chip_type, *address, sio_data->revision); | 1028 | chip_type, *address, sio_data->revision); |
1029 | 1029 | ||
1030 | /* Read GPIO config and VID value from LDN 7 (GPIO) */ | 1030 | /* Read GPIO config and VID value from LDN 7 (GPIO) */ |
1031 | if (chip_type != IT8705F_DEVID) { | 1031 | if (sio_data->type != it87) { |
1032 | int reg; | 1032 | int reg; |
1033 | 1033 | ||
1034 | superio_select(GPIO); | 1034 | superio_select(GPIO); |
1035 | if ((chip_type == it8718) || | 1035 | if (sio_data->type == it8718 || sio_data->type == it8720) |
1036 | (chip_type == it8720)) | ||
1037 | sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); | 1036 | sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); |
1038 | 1037 | ||
1039 | reg = superio_inb(IT87_SIO_PINX2_REG); | 1038 | reg = superio_inb(IT87_SIO_PINX2_REG); |
diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c index 680e5975217f..ca0c46f6580a 100644 --- a/drivers/ide/cmd64x.c +++ b/drivers/ide/cmd64x.c | |||
@@ -379,7 +379,8 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { | |||
379 | .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, | 379 | .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, |
380 | .port_ops = &cmd64x_port_ops, | 380 | .port_ops = &cmd64x_port_ops, |
381 | .host_flags = IDE_HFLAG_CLEAR_SIMPLEX | | 381 | .host_flags = IDE_HFLAG_CLEAR_SIMPLEX | |
382 | IDE_HFLAG_ABUSE_PREFETCH, | 382 | IDE_HFLAG_ABUSE_PREFETCH | |
383 | IDE_HFLAG_SERIALIZE, | ||
383 | .pio_mask = ATA_PIO5, | 384 | .pio_mask = ATA_PIO5, |
384 | .mwdma_mask = ATA_MWDMA2, | 385 | .mwdma_mask = ATA_MWDMA2, |
385 | .udma_mask = 0x00, /* no udma */ | 386 | .udma_mask = 0x00, /* no udma */ |
@@ -389,7 +390,8 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { | |||
389 | .init_chipset = init_chipset_cmd64x, | 390 | .init_chipset = init_chipset_cmd64x, |
390 | .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, | 391 | .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, |
391 | .port_ops = &cmd648_port_ops, | 392 | .port_ops = &cmd648_port_ops, |
392 | .host_flags = IDE_HFLAG_ABUSE_PREFETCH, | 393 | .host_flags = IDE_HFLAG_ABUSE_PREFETCH | |
394 | IDE_HFLAG_SERIALIZE, | ||
393 | .pio_mask = ATA_PIO5, | 395 | .pio_mask = ATA_PIO5, |
394 | .mwdma_mask = ATA_MWDMA2, | 396 | .mwdma_mask = ATA_MWDMA2, |
395 | .udma_mask = ATA_UDMA2, | 397 | .udma_mask = ATA_UDMA2, |
diff --git a/drivers/isdn/i4l/isdn_net.h b/drivers/isdn/i4l/isdn_net.h index 74032d0881ef..7511f08effa5 100644 --- a/drivers/isdn/i4l/isdn_net.h +++ b/drivers/isdn/i4l/isdn_net.h | |||
@@ -83,19 +83,19 @@ static __inline__ isdn_net_local * isdn_net_get_locked_lp(isdn_net_dev *nd) | |||
83 | 83 | ||
84 | spin_lock_irqsave(&nd->queue_lock, flags); | 84 | spin_lock_irqsave(&nd->queue_lock, flags); |
85 | lp = nd->queue; /* get lp on top of queue */ | 85 | lp = nd->queue; /* get lp on top of queue */ |
86 | spin_lock(&nd->queue->xmit_lock); | ||
87 | while (isdn_net_lp_busy(nd->queue)) { | 86 | while (isdn_net_lp_busy(nd->queue)) { |
88 | spin_unlock(&nd->queue->xmit_lock); | ||
89 | nd->queue = nd->queue->next; | 87 | nd->queue = nd->queue->next; |
90 | if (nd->queue == lp) { /* not found -- should never happen */ | 88 | if (nd->queue == lp) { /* not found -- should never happen */ |
91 | lp = NULL; | 89 | lp = NULL; |
92 | goto errout; | 90 | goto errout; |
93 | } | 91 | } |
94 | spin_lock(&nd->queue->xmit_lock); | ||
95 | } | 92 | } |
96 | lp = nd->queue; | 93 | lp = nd->queue; |
97 | nd->queue = nd->queue->next; | 94 | nd->queue = nd->queue->next; |
95 | spin_unlock_irqrestore(&nd->queue_lock, flags); | ||
96 | spin_lock(&lp->xmit_lock); | ||
98 | local_bh_disable(); | 97 | local_bh_disable(); |
98 | return lp; | ||
99 | errout: | 99 | errout: |
100 | spin_unlock_irqrestore(&nd->queue_lock, flags); | 100 | spin_unlock_irqrestore(&nd->queue_lock, flags); |
101 | return lp; | 101 | return lp; |
diff --git a/drivers/md/Makefile b/drivers/md/Makefile index 1dc4185bd781..e355e7f6a536 100644 --- a/drivers/md/Makefile +++ b/drivers/md/Makefile | |||
@@ -46,7 +46,7 @@ obj-$(CONFIG_DM_LOG_USERSPACE) += dm-log-userspace.o | |||
46 | obj-$(CONFIG_DM_ZERO) += dm-zero.o | 46 | obj-$(CONFIG_DM_ZERO) += dm-zero.o |
47 | 47 | ||
48 | quiet_cmd_unroll = UNROLL $@ | 48 | quiet_cmd_unroll = UNROLL $@ |
49 | cmd_unroll = $(PERL) $(srctree)/$(src)/unroll.pl $(UNROLL) \ | 49 | cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) \ |
50 | < $< > $@ || ( rm -f $@ && exit 1 ) | 50 | < $< > $@ || ( rm -f $@ && exit 1 ) |
51 | 51 | ||
52 | ifeq ($(CONFIG_ALTIVEC),y) | 52 | ifeq ($(CONFIG_ALTIVEC),y) |
@@ -59,56 +59,56 @@ endif | |||
59 | 59 | ||
60 | targets += raid6int1.c | 60 | targets += raid6int1.c |
61 | $(obj)/raid6int1.c: UNROLL := 1 | 61 | $(obj)/raid6int1.c: UNROLL := 1 |
62 | $(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE | 62 | $(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE |
63 | $(call if_changed,unroll) | 63 | $(call if_changed,unroll) |
64 | 64 | ||
65 | targets += raid6int2.c | 65 | targets += raid6int2.c |
66 | $(obj)/raid6int2.c: UNROLL := 2 | 66 | $(obj)/raid6int2.c: UNROLL := 2 |
67 | $(obj)/raid6int2.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE | 67 | $(obj)/raid6int2.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE |
68 | $(call if_changed,unroll) | 68 | $(call if_changed,unroll) |
69 | 69 | ||
70 | targets += raid6int4.c | 70 | targets += raid6int4.c |
71 | $(obj)/raid6int4.c: UNROLL := 4 | 71 | $(obj)/raid6int4.c: UNROLL := 4 |
72 | $(obj)/raid6int4.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE | 72 | $(obj)/raid6int4.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE |
73 | $(call if_changed,unroll) | 73 | $(call if_changed,unroll) |
74 | 74 | ||
75 | targets += raid6int8.c | 75 | targets += raid6int8.c |
76 | $(obj)/raid6int8.c: UNROLL := 8 | 76 | $(obj)/raid6int8.c: UNROLL := 8 |
77 | $(obj)/raid6int8.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE | 77 | $(obj)/raid6int8.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE |
78 | $(call if_changed,unroll) | 78 | $(call if_changed,unroll) |
79 | 79 | ||
80 | targets += raid6int16.c | 80 | targets += raid6int16.c |
81 | $(obj)/raid6int16.c: UNROLL := 16 | 81 | $(obj)/raid6int16.c: UNROLL := 16 |
82 | $(obj)/raid6int16.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE | 82 | $(obj)/raid6int16.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE |
83 | $(call if_changed,unroll) | 83 | $(call if_changed,unroll) |
84 | 84 | ||
85 | targets += raid6int32.c | 85 | targets += raid6int32.c |
86 | $(obj)/raid6int32.c: UNROLL := 32 | 86 | $(obj)/raid6int32.c: UNROLL := 32 |
87 | $(obj)/raid6int32.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE | 87 | $(obj)/raid6int32.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE |
88 | $(call if_changed,unroll) | 88 | $(call if_changed,unroll) |
89 | 89 | ||
90 | CFLAGS_raid6altivec1.o += $(altivec_flags) | 90 | CFLAGS_raid6altivec1.o += $(altivec_flags) |
91 | targets += raid6altivec1.c | 91 | targets += raid6altivec1.c |
92 | $(obj)/raid6altivec1.c: UNROLL := 1 | 92 | $(obj)/raid6altivec1.c: UNROLL := 1 |
93 | $(obj)/raid6altivec1.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE | 93 | $(obj)/raid6altivec1.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE |
94 | $(call if_changed,unroll) | 94 | $(call if_changed,unroll) |
95 | 95 | ||
96 | CFLAGS_raid6altivec2.o += $(altivec_flags) | 96 | CFLAGS_raid6altivec2.o += $(altivec_flags) |
97 | targets += raid6altivec2.c | 97 | targets += raid6altivec2.c |
98 | $(obj)/raid6altivec2.c: UNROLL := 2 | 98 | $(obj)/raid6altivec2.c: UNROLL := 2 |
99 | $(obj)/raid6altivec2.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE | 99 | $(obj)/raid6altivec2.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE |
100 | $(call if_changed,unroll) | 100 | $(call if_changed,unroll) |
101 | 101 | ||
102 | CFLAGS_raid6altivec4.o += $(altivec_flags) | 102 | CFLAGS_raid6altivec4.o += $(altivec_flags) |
103 | targets += raid6altivec4.c | 103 | targets += raid6altivec4.c |
104 | $(obj)/raid6altivec4.c: UNROLL := 4 | 104 | $(obj)/raid6altivec4.c: UNROLL := 4 |
105 | $(obj)/raid6altivec4.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE | 105 | $(obj)/raid6altivec4.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE |
106 | $(call if_changed,unroll) | 106 | $(call if_changed,unroll) |
107 | 107 | ||
108 | CFLAGS_raid6altivec8.o += $(altivec_flags) | 108 | CFLAGS_raid6altivec8.o += $(altivec_flags) |
109 | targets += raid6altivec8.c | 109 | targets += raid6altivec8.c |
110 | $(obj)/raid6altivec8.c: UNROLL := 8 | 110 | $(obj)/raid6altivec8.c: UNROLL := 8 |
111 | $(obj)/raid6altivec8.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE | 111 | $(obj)/raid6altivec8.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE |
112 | $(call if_changed,unroll) | 112 | $(call if_changed,unroll) |
113 | 113 | ||
114 | quiet_cmd_mktable = TABLE $@ | 114 | quiet_cmd_mktable = TABLE $@ |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 6986b0059d23..60e2b322db11 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1624,10 +1624,11 @@ int bitmap_create(mddev_t *mddev) | |||
1624 | bitmap->offset = mddev->bitmap_offset; | 1624 | bitmap->offset = mddev->bitmap_offset; |
1625 | if (file) { | 1625 | if (file) { |
1626 | get_file(file); | 1626 | get_file(file); |
1627 | do_sync_mapping_range(file->f_mapping, 0, LLONG_MAX, | 1627 | /* As future accesses to this file will use bmap, |
1628 | SYNC_FILE_RANGE_WAIT_BEFORE | | 1628 | * and bypass the page cache, we must sync the file |
1629 | SYNC_FILE_RANGE_WRITE | | 1629 | * first. |
1630 | SYNC_FILE_RANGE_WAIT_AFTER); | 1630 | */ |
1631 | vfs_fsync(file, file->f_dentry, 1); | ||
1631 | } | 1632 | } |
1632 | /* read superblock from bitmap file (this sets bitmap->chunksize) */ | 1633 | /* read superblock from bitmap file (this sets bitmap->chunksize) */ |
1633 | err = bitmap_read_sb(bitmap); | 1634 | err = bitmap_read_sb(bitmap); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 26ba42a79129..10eb1fce975e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2631,7 +2631,7 @@ static void analyze_sbs(mddev_t * mddev) | |||
2631 | rdev->desc_nr = i++; | 2631 | rdev->desc_nr = i++; |
2632 | rdev->raid_disk = rdev->desc_nr; | 2632 | rdev->raid_disk = rdev->desc_nr; |
2633 | set_bit(In_sync, &rdev->flags); | 2633 | set_bit(In_sync, &rdev->flags); |
2634 | } else if (rdev->raid_disk >= mddev->raid_disks) { | 2634 | } else if (rdev->raid_disk >= (mddev->raid_disks - min(0, mddev->delta_disks))) { |
2635 | rdev->raid_disk = -1; | 2635 | rdev->raid_disk = -1; |
2636 | clear_bit(In_sync, &rdev->flags); | 2636 | clear_bit(In_sync, &rdev->flags); |
2637 | } | 2637 | } |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d1b9bd5fd4f6..a053423785c9 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -64,7 +64,7 @@ static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data) | |||
64 | 64 | ||
65 | /* allocate a r1bio with room for raid_disks entries in the bios array */ | 65 | /* allocate a r1bio with room for raid_disks entries in the bios array */ |
66 | r1_bio = kzalloc(size, gfp_flags); | 66 | r1_bio = kzalloc(size, gfp_flags); |
67 | if (!r1_bio) | 67 | if (!r1_bio && pi->mddev) |
68 | unplug_slaves(pi->mddev); | 68 | unplug_slaves(pi->mddev); |
69 | 69 | ||
70 | return r1_bio; | 70 | return r1_bio; |
@@ -1683,6 +1683,7 @@ static void raid1d(mddev_t *mddev) | |||
1683 | generic_make_request(bio); | 1683 | generic_make_request(bio); |
1684 | } | 1684 | } |
1685 | } | 1685 | } |
1686 | cond_resched(); | ||
1686 | } | 1687 | } |
1687 | if (unplug) | 1688 | if (unplug) |
1688 | unplug_slaves(mddev); | 1689 | unplug_slaves(mddev); |
@@ -1978,13 +1979,14 @@ static int run(mddev_t *mddev) | |||
1978 | conf->poolinfo = kmalloc(sizeof(*conf->poolinfo), GFP_KERNEL); | 1979 | conf->poolinfo = kmalloc(sizeof(*conf->poolinfo), GFP_KERNEL); |
1979 | if (!conf->poolinfo) | 1980 | if (!conf->poolinfo) |
1980 | goto out_no_mem; | 1981 | goto out_no_mem; |
1981 | conf->poolinfo->mddev = mddev; | 1982 | conf->poolinfo->mddev = NULL; |
1982 | conf->poolinfo->raid_disks = mddev->raid_disks; | 1983 | conf->poolinfo->raid_disks = mddev->raid_disks; |
1983 | conf->r1bio_pool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, | 1984 | conf->r1bio_pool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, |
1984 | r1bio_pool_free, | 1985 | r1bio_pool_free, |
1985 | conf->poolinfo); | 1986 | conf->poolinfo); |
1986 | if (!conf->r1bio_pool) | 1987 | if (!conf->r1bio_pool) |
1987 | goto out_no_mem; | 1988 | goto out_no_mem; |
1989 | conf->poolinfo->mddev = mddev; | ||
1988 | 1990 | ||
1989 | spin_lock_init(&conf->device_lock); | 1991 | spin_lock_init(&conf->device_lock); |
1990 | mddev->queue->queue_lock = &conf->device_lock; | 1992 | mddev->queue->queue_lock = &conf->device_lock; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 51c4c5c4d87a..c2cb7b87b440 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -68,7 +68,7 @@ static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data) | |||
68 | 68 | ||
69 | /* allocate a r10bio with room for raid_disks entries in the bios array */ | 69 | /* allocate a r10bio with room for raid_disks entries in the bios array */ |
70 | r10_bio = kzalloc(size, gfp_flags); | 70 | r10_bio = kzalloc(size, gfp_flags); |
71 | if (!r10_bio) | 71 | if (!r10_bio && conf->mddev) |
72 | unplug_slaves(conf->mddev); | 72 | unplug_slaves(conf->mddev); |
73 | 73 | ||
74 | return r10_bio; | 74 | return r10_bio; |
@@ -1632,6 +1632,7 @@ static void raid10d(mddev_t *mddev) | |||
1632 | generic_make_request(bio); | 1632 | generic_make_request(bio); |
1633 | } | 1633 | } |
1634 | } | 1634 | } |
1635 | cond_resched(); | ||
1635 | } | 1636 | } |
1636 | if (unplug) | 1637 | if (unplug) |
1637 | unplug_slaves(mddev); | 1638 | unplug_slaves(mddev); |
@@ -2095,7 +2096,6 @@ static int run(mddev_t *mddev) | |||
2095 | if (!conf->tmppage) | 2096 | if (!conf->tmppage) |
2096 | goto out_free_conf; | 2097 | goto out_free_conf; |
2097 | 2098 | ||
2098 | conf->mddev = mddev; | ||
2099 | conf->raid_disks = mddev->raid_disks; | 2099 | conf->raid_disks = mddev->raid_disks; |
2100 | conf->near_copies = nc; | 2100 | conf->near_copies = nc; |
2101 | conf->far_copies = fc; | 2101 | conf->far_copies = fc; |
@@ -2132,6 +2132,7 @@ static int run(mddev_t *mddev) | |||
2132 | goto out_free_conf; | 2132 | goto out_free_conf; |
2133 | } | 2133 | } |
2134 | 2134 | ||
2135 | conf->mddev = mddev; | ||
2135 | spin_lock_init(&conf->device_lock); | 2136 | spin_lock_init(&conf->device_lock); |
2136 | mddev->queue->queue_lock = &conf->device_lock; | 2137 | mddev->queue->queue_lock = &conf->device_lock; |
2137 | 2138 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 94829804ab7f..81abefc172d9 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -156,13 +156,16 @@ static inline int raid6_next_disk(int disk, int raid_disks) | |||
156 | static int raid6_idx_to_slot(int idx, struct stripe_head *sh, | 156 | static int raid6_idx_to_slot(int idx, struct stripe_head *sh, |
157 | int *count, int syndrome_disks) | 157 | int *count, int syndrome_disks) |
158 | { | 158 | { |
159 | int slot; | 159 | int slot = *count; |
160 | 160 | ||
161 | if (sh->ddf_layout) | ||
162 | (*count)++; | ||
161 | if (idx == sh->pd_idx) | 163 | if (idx == sh->pd_idx) |
162 | return syndrome_disks; | 164 | return syndrome_disks; |
163 | if (idx == sh->qd_idx) | 165 | if (idx == sh->qd_idx) |
164 | return syndrome_disks + 1; | 166 | return syndrome_disks + 1; |
165 | slot = (*count)++; | 167 | if (!sh->ddf_layout) |
168 | (*count)++; | ||
166 | return slot; | 169 | return slot; |
167 | } | 170 | } |
168 | 171 | ||
@@ -717,7 +720,7 @@ static int set_syndrome_sources(struct page **srcs, struct stripe_head *sh) | |||
717 | int i; | 720 | int i; |
718 | 721 | ||
719 | for (i = 0; i < disks; i++) | 722 | for (i = 0; i < disks; i++) |
720 | srcs[i] = (void *)raid6_empty_zero_page; | 723 | srcs[i] = NULL; |
721 | 724 | ||
722 | count = 0; | 725 | count = 0; |
723 | i = d0_idx; | 726 | i = d0_idx; |
@@ -727,9 +730,8 @@ static int set_syndrome_sources(struct page **srcs, struct stripe_head *sh) | |||
727 | srcs[slot] = sh->dev[i].page; | 730 | srcs[slot] = sh->dev[i].page; |
728 | i = raid6_next_disk(i, disks); | 731 | i = raid6_next_disk(i, disks); |
729 | } while (i != d0_idx); | 732 | } while (i != d0_idx); |
730 | BUG_ON(count != syndrome_disks); | ||
731 | 733 | ||
732 | return count; | 734 | return syndrome_disks; |
733 | } | 735 | } |
734 | 736 | ||
735 | static struct dma_async_tx_descriptor * | 737 | static struct dma_async_tx_descriptor * |
@@ -814,7 +816,7 @@ ops_run_compute6_2(struct stripe_head *sh, struct raid5_percpu *percpu) | |||
814 | * slot number conversion for 'faila' and 'failb' | 816 | * slot number conversion for 'faila' and 'failb' |
815 | */ | 817 | */ |
816 | for (i = 0; i < disks ; i++) | 818 | for (i = 0; i < disks ; i++) |
817 | blocks[i] = (void *)raid6_empty_zero_page; | 819 | blocks[i] = NULL; |
818 | count = 0; | 820 | count = 0; |
819 | i = d0_idx; | 821 | i = d0_idx; |
820 | do { | 822 | do { |
@@ -828,7 +830,6 @@ ops_run_compute6_2(struct stripe_head *sh, struct raid5_percpu *percpu) | |||
828 | failb = slot; | 830 | failb = slot; |
829 | i = raid6_next_disk(i, disks); | 831 | i = raid6_next_disk(i, disks); |
830 | } while (i != d0_idx); | 832 | } while (i != d0_idx); |
831 | BUG_ON(count != syndrome_disks); | ||
832 | 833 | ||
833 | BUG_ON(faila == failb); | 834 | BUG_ON(faila == failb); |
834 | if (failb < faila) | 835 | if (failb < faila) |
@@ -845,7 +846,7 @@ ops_run_compute6_2(struct stripe_head *sh, struct raid5_percpu *percpu) | |||
845 | init_async_submit(&submit, ASYNC_TX_FENCE, NULL, | 846 | init_async_submit(&submit, ASYNC_TX_FENCE, NULL, |
846 | ops_complete_compute, sh, | 847 | ops_complete_compute, sh, |
847 | to_addr_conv(sh, percpu)); | 848 | to_addr_conv(sh, percpu)); |
848 | return async_gen_syndrome(blocks, 0, count+2, | 849 | return async_gen_syndrome(blocks, 0, syndrome_disks+2, |
849 | STRIPE_SIZE, &submit); | 850 | STRIPE_SIZE, &submit); |
850 | } else { | 851 | } else { |
851 | struct page *dest; | 852 | struct page *dest; |
@@ -1139,7 +1140,7 @@ static void ops_run_check_pq(struct stripe_head *sh, struct raid5_percpu *percpu | |||
1139 | &sh->ops.zero_sum_result, percpu->spare_page, &submit); | 1140 | &sh->ops.zero_sum_result, percpu->spare_page, &submit); |
1140 | } | 1141 | } |
1141 | 1142 | ||
1142 | static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request) | 1143 | static void __raid_run_ops(struct stripe_head *sh, unsigned long ops_request) |
1143 | { | 1144 | { |
1144 | int overlap_clear = 0, i, disks = sh->disks; | 1145 | int overlap_clear = 0, i, disks = sh->disks; |
1145 | struct dma_async_tx_descriptor *tx = NULL; | 1146 | struct dma_async_tx_descriptor *tx = NULL; |
@@ -1204,22 +1205,55 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request) | |||
1204 | put_cpu(); | 1205 | put_cpu(); |
1205 | } | 1206 | } |
1206 | 1207 | ||
1208 | #ifdef CONFIG_MULTICORE_RAID456 | ||
1209 | static void async_run_ops(void *param, async_cookie_t cookie) | ||
1210 | { | ||
1211 | struct stripe_head *sh = param; | ||
1212 | unsigned long ops_request = sh->ops.request; | ||
1213 | |||
1214 | clear_bit_unlock(STRIPE_OPS_REQ_PENDING, &sh->state); | ||
1215 | wake_up(&sh->ops.wait_for_ops); | ||
1216 | |||
1217 | __raid_run_ops(sh, ops_request); | ||
1218 | release_stripe(sh); | ||
1219 | } | ||
1220 | |||
1221 | static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request) | ||
1222 | { | ||
1223 | /* since handle_stripe can be called outside of raid5d context | ||
1224 | * we need to ensure sh->ops.request is de-staged before another | ||
1225 | * request arrives | ||
1226 | */ | ||
1227 | wait_event(sh->ops.wait_for_ops, | ||
1228 | !test_and_set_bit_lock(STRIPE_OPS_REQ_PENDING, &sh->state)); | ||
1229 | sh->ops.request = ops_request; | ||
1230 | |||
1231 | atomic_inc(&sh->count); | ||
1232 | async_schedule(async_run_ops, sh); | ||
1233 | } | ||
1234 | #else | ||
1235 | #define raid_run_ops __raid_run_ops | ||
1236 | #endif | ||
1237 | |||
1207 | static int grow_one_stripe(raid5_conf_t *conf) | 1238 | static int grow_one_stripe(raid5_conf_t *conf) |
1208 | { | 1239 | { |
1209 | struct stripe_head *sh; | 1240 | struct stripe_head *sh; |
1241 | int disks = max(conf->raid_disks, conf->previous_raid_disks); | ||
1210 | sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL); | 1242 | sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL); |
1211 | if (!sh) | 1243 | if (!sh) |
1212 | return 0; | 1244 | return 0; |
1213 | memset(sh, 0, sizeof(*sh) + (conf->raid_disks-1)*sizeof(struct r5dev)); | 1245 | memset(sh, 0, sizeof(*sh) + (disks-1)*sizeof(struct r5dev)); |
1214 | sh->raid_conf = conf; | 1246 | sh->raid_conf = conf; |
1215 | spin_lock_init(&sh->lock); | 1247 | spin_lock_init(&sh->lock); |
1248 | #ifdef CONFIG_MULTICORE_RAID456 | ||
1249 | init_waitqueue_head(&sh->ops.wait_for_ops); | ||
1250 | #endif | ||
1216 | 1251 | ||
1217 | if (grow_buffers(sh, conf->raid_disks)) { | 1252 | if (grow_buffers(sh, disks)) { |
1218 | shrink_buffers(sh, conf->raid_disks); | 1253 | shrink_buffers(sh, disks); |
1219 | kmem_cache_free(conf->slab_cache, sh); | 1254 | kmem_cache_free(conf->slab_cache, sh); |
1220 | return 0; | 1255 | return 0; |
1221 | } | 1256 | } |
1222 | sh->disks = conf->raid_disks; | ||
1223 | /* we just created an active stripe so... */ | 1257 | /* we just created an active stripe so... */ |
1224 | atomic_set(&sh->count, 1); | 1258 | atomic_set(&sh->count, 1); |
1225 | atomic_inc(&conf->active_stripes); | 1259 | atomic_inc(&conf->active_stripes); |
@@ -1231,7 +1265,7 @@ static int grow_one_stripe(raid5_conf_t *conf) | |||
1231 | static int grow_stripes(raid5_conf_t *conf, int num) | 1265 | static int grow_stripes(raid5_conf_t *conf, int num) |
1232 | { | 1266 | { |
1233 | struct kmem_cache *sc; | 1267 | struct kmem_cache *sc; |
1234 | int devs = conf->raid_disks; | 1268 | int devs = max(conf->raid_disks, conf->previous_raid_disks); |
1235 | 1269 | ||
1236 | sprintf(conf->cache_name[0], | 1270 | sprintf(conf->cache_name[0], |
1237 | "raid%d-%s", conf->level, mdname(conf->mddev)); | 1271 | "raid%d-%s", conf->level, mdname(conf->mddev)); |
@@ -1329,6 +1363,9 @@ static int resize_stripes(raid5_conf_t *conf, int newsize) | |||
1329 | 1363 | ||
1330 | nsh->raid_conf = conf; | 1364 | nsh->raid_conf = conf; |
1331 | spin_lock_init(&nsh->lock); | 1365 | spin_lock_init(&nsh->lock); |
1366 | #ifdef CONFIG_MULTICORE_RAID456 | ||
1367 | init_waitqueue_head(&nsh->ops.wait_for_ops); | ||
1368 | #endif | ||
1332 | 1369 | ||
1333 | list_add(&nsh->lru, &newstripes); | 1370 | list_add(&nsh->lru, &newstripes); |
1334 | } | 1371 | } |
@@ -1899,10 +1936,15 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous) | |||
1899 | case ALGORITHM_PARITY_N: | 1936 | case ALGORITHM_PARITY_N: |
1900 | break; | 1937 | break; |
1901 | case ALGORITHM_ROTATING_N_CONTINUE: | 1938 | case ALGORITHM_ROTATING_N_CONTINUE: |
1939 | /* Like left_symmetric, but P is before Q */ | ||
1902 | if (sh->pd_idx == 0) | 1940 | if (sh->pd_idx == 0) |
1903 | i--; /* P D D D Q */ | 1941 | i--; /* P D D D Q */ |
1904 | else if (i > sh->pd_idx) | 1942 | else { |
1905 | i -= 2; /* D D Q P D */ | 1943 | /* D D Q P D */ |
1944 | if (i < sh->pd_idx) | ||
1945 | i += raid_disks; | ||
1946 | i -= (sh->pd_idx + 1); | ||
1947 | } | ||
1906 | break; | 1948 | break; |
1907 | case ALGORITHM_LEFT_ASYMMETRIC_6: | 1949 | case ALGORITHM_LEFT_ASYMMETRIC_6: |
1908 | case ALGORITHM_RIGHT_ASYMMETRIC_6: | 1950 | case ALGORITHM_RIGHT_ASYMMETRIC_6: |
@@ -2896,7 +2938,7 @@ static void handle_stripe_expansion(raid5_conf_t *conf, struct stripe_head *sh, | |||
2896 | * | 2938 | * |
2897 | */ | 2939 | */ |
2898 | 2940 | ||
2899 | static bool handle_stripe5(struct stripe_head *sh) | 2941 | static void handle_stripe5(struct stripe_head *sh) |
2900 | { | 2942 | { |
2901 | raid5_conf_t *conf = sh->raid_conf; | 2943 | raid5_conf_t *conf = sh->raid_conf; |
2902 | int disks = sh->disks, i; | 2944 | int disks = sh->disks, i; |
@@ -3167,11 +3209,9 @@ static bool handle_stripe5(struct stripe_head *sh) | |||
3167 | ops_run_io(sh, &s); | 3209 | ops_run_io(sh, &s); |
3168 | 3210 | ||
3169 | return_io(return_bi); | 3211 | return_io(return_bi); |
3170 | |||
3171 | return blocked_rdev == NULL; | ||
3172 | } | 3212 | } |
3173 | 3213 | ||
3174 | static bool handle_stripe6(struct stripe_head *sh) | 3214 | static void handle_stripe6(struct stripe_head *sh) |
3175 | { | 3215 | { |
3176 | raid5_conf_t *conf = sh->raid_conf; | 3216 | raid5_conf_t *conf = sh->raid_conf; |
3177 | int disks = sh->disks; | 3217 | int disks = sh->disks; |
@@ -3455,17 +3495,14 @@ static bool handle_stripe6(struct stripe_head *sh) | |||
3455 | ops_run_io(sh, &s); | 3495 | ops_run_io(sh, &s); |
3456 | 3496 | ||
3457 | return_io(return_bi); | 3497 | return_io(return_bi); |
3458 | |||
3459 | return blocked_rdev == NULL; | ||
3460 | } | 3498 | } |
3461 | 3499 | ||
3462 | /* returns true if the stripe was handled */ | 3500 | static void handle_stripe(struct stripe_head *sh) |
3463 | static bool handle_stripe(struct stripe_head *sh) | ||
3464 | { | 3501 | { |
3465 | if (sh->raid_conf->level == 6) | 3502 | if (sh->raid_conf->level == 6) |
3466 | return handle_stripe6(sh); | 3503 | handle_stripe6(sh); |
3467 | else | 3504 | else |
3468 | return handle_stripe5(sh); | 3505 | handle_stripe5(sh); |
3469 | } | 3506 | } |
3470 | 3507 | ||
3471 | static void raid5_activate_delayed(raid5_conf_t *conf) | 3508 | static void raid5_activate_delayed(raid5_conf_t *conf) |
@@ -3503,9 +3540,10 @@ static void unplug_slaves(mddev_t *mddev) | |||
3503 | { | 3540 | { |
3504 | raid5_conf_t *conf = mddev->private; | 3541 | raid5_conf_t *conf = mddev->private; |
3505 | int i; | 3542 | int i; |
3543 | int devs = max(conf->raid_disks, conf->previous_raid_disks); | ||
3506 | 3544 | ||
3507 | rcu_read_lock(); | 3545 | rcu_read_lock(); |
3508 | for (i = 0; i < conf->raid_disks; i++) { | 3546 | for (i = 0; i < devs; i++) { |
3509 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); | 3547 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); |
3510 | if (rdev && !test_bit(Faulty, &rdev->flags) && atomic_read(&rdev->nr_pending)) { | 3548 | if (rdev && !test_bit(Faulty, &rdev->flags) && atomic_read(&rdev->nr_pending)) { |
3511 | struct request_queue *r_queue = bdev_get_queue(rdev->bdev); | 3549 | struct request_queue *r_queue = bdev_get_queue(rdev->bdev); |
@@ -4277,9 +4315,7 @@ static inline sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *ski | |||
4277 | clear_bit(STRIPE_INSYNC, &sh->state); | 4315 | clear_bit(STRIPE_INSYNC, &sh->state); |
4278 | spin_unlock(&sh->lock); | 4316 | spin_unlock(&sh->lock); |
4279 | 4317 | ||
4280 | /* wait for any blocked device to be handled */ | 4318 | handle_stripe(sh); |
4281 | while (unlikely(!handle_stripe(sh))) | ||
4282 | ; | ||
4283 | release_stripe(sh); | 4319 | release_stripe(sh); |
4284 | 4320 | ||
4285 | return STRIPE_SECTORS; | 4321 | return STRIPE_SECTORS; |
@@ -4349,37 +4385,6 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio) | |||
4349 | return handled; | 4385 | return handled; |
4350 | } | 4386 | } |
4351 | 4387 | ||
4352 | #ifdef CONFIG_MULTICORE_RAID456 | ||
4353 | static void __process_stripe(void *param, async_cookie_t cookie) | ||
4354 | { | ||
4355 | struct stripe_head *sh = param; | ||
4356 | |||
4357 | handle_stripe(sh); | ||
4358 | release_stripe(sh); | ||
4359 | } | ||
4360 | |||
4361 | static void process_stripe(struct stripe_head *sh, struct list_head *domain) | ||
4362 | { | ||
4363 | async_schedule_domain(__process_stripe, sh, domain); | ||
4364 | } | ||
4365 | |||
4366 | static void synchronize_stripe_processing(struct list_head *domain) | ||
4367 | { | ||
4368 | async_synchronize_full_domain(domain); | ||
4369 | } | ||
4370 | #else | ||
4371 | static void process_stripe(struct stripe_head *sh, struct list_head *domain) | ||
4372 | { | ||
4373 | handle_stripe(sh); | ||
4374 | release_stripe(sh); | ||
4375 | cond_resched(); | ||
4376 | } | ||
4377 | |||
4378 | static void synchronize_stripe_processing(struct list_head *domain) | ||
4379 | { | ||
4380 | } | ||
4381 | #endif | ||
4382 | |||
4383 | 4388 | ||
4384 | /* | 4389 | /* |
4385 | * This is our raid5 kernel thread. | 4390 | * This is our raid5 kernel thread. |
@@ -4393,7 +4398,6 @@ static void raid5d(mddev_t *mddev) | |||
4393 | struct stripe_head *sh; | 4398 | struct stripe_head *sh; |
4394 | raid5_conf_t *conf = mddev->private; | 4399 | raid5_conf_t *conf = mddev->private; |
4395 | int handled; | 4400 | int handled; |
4396 | LIST_HEAD(raid_domain); | ||
4397 | 4401 | ||
4398 | pr_debug("+++ raid5d active\n"); | 4402 | pr_debug("+++ raid5d active\n"); |
4399 | 4403 | ||
@@ -4430,7 +4434,9 @@ static void raid5d(mddev_t *mddev) | |||
4430 | spin_unlock_irq(&conf->device_lock); | 4434 | spin_unlock_irq(&conf->device_lock); |
4431 | 4435 | ||
4432 | handled++; | 4436 | handled++; |
4433 | process_stripe(sh, &raid_domain); | 4437 | handle_stripe(sh); |
4438 | release_stripe(sh); | ||
4439 | cond_resched(); | ||
4434 | 4440 | ||
4435 | spin_lock_irq(&conf->device_lock); | 4441 | spin_lock_irq(&conf->device_lock); |
4436 | } | 4442 | } |
@@ -4438,7 +4444,6 @@ static void raid5d(mddev_t *mddev) | |||
4438 | 4444 | ||
4439 | spin_unlock_irq(&conf->device_lock); | 4445 | spin_unlock_irq(&conf->device_lock); |
4440 | 4446 | ||
4441 | synchronize_stripe_processing(&raid_domain); | ||
4442 | async_tx_issue_pending_all(); | 4447 | async_tx_issue_pending_all(); |
4443 | unplug_slaves(mddev); | 4448 | unplug_slaves(mddev); |
4444 | 4449 | ||
@@ -4558,13 +4563,9 @@ raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks) | |||
4558 | 4563 | ||
4559 | if (!sectors) | 4564 | if (!sectors) |
4560 | sectors = mddev->dev_sectors; | 4565 | sectors = mddev->dev_sectors; |
4561 | if (!raid_disks) { | 4566 | if (!raid_disks) |
4562 | /* size is defined by the smallest of previous and new size */ | 4567 | /* size is defined by the smallest of previous and new size */ |
4563 | if (conf->raid_disks < conf->previous_raid_disks) | 4568 | raid_disks = min(conf->raid_disks, conf->previous_raid_disks); |
4564 | raid_disks = conf->raid_disks; | ||
4565 | else | ||
4566 | raid_disks = conf->previous_raid_disks; | ||
4567 | } | ||
4568 | 4569 | ||
4569 | sectors &= ~((sector_t)mddev->chunk_sectors - 1); | 4570 | sectors &= ~((sector_t)mddev->chunk_sectors - 1); |
4570 | sectors &= ~((sector_t)mddev->new_chunk_sectors - 1); | 4571 | sectors &= ~((sector_t)mddev->new_chunk_sectors - 1); |
@@ -4665,7 +4666,7 @@ static int raid5_alloc_percpu(raid5_conf_t *conf) | |||
4665 | } | 4666 | } |
4666 | per_cpu_ptr(conf->percpu, cpu)->spare_page = spare_page; | 4667 | per_cpu_ptr(conf->percpu, cpu)->spare_page = spare_page; |
4667 | } | 4668 | } |
4668 | scribble = kmalloc(scribble_len(conf->raid_disks), GFP_KERNEL); | 4669 | scribble = kmalloc(conf->scribble_len, GFP_KERNEL); |
4669 | if (!scribble) { | 4670 | if (!scribble) { |
4670 | err = -ENOMEM; | 4671 | err = -ENOMEM; |
4671 | break; | 4672 | break; |
@@ -4686,7 +4687,7 @@ static int raid5_alloc_percpu(raid5_conf_t *conf) | |||
4686 | static raid5_conf_t *setup_conf(mddev_t *mddev) | 4687 | static raid5_conf_t *setup_conf(mddev_t *mddev) |
4687 | { | 4688 | { |
4688 | raid5_conf_t *conf; | 4689 | raid5_conf_t *conf; |
4689 | int raid_disk, memory; | 4690 | int raid_disk, memory, max_disks; |
4690 | mdk_rdev_t *rdev; | 4691 | mdk_rdev_t *rdev; |
4691 | struct disk_info *disk; | 4692 | struct disk_info *disk; |
4692 | 4693 | ||
@@ -4722,15 +4723,28 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
4722 | conf = kzalloc(sizeof(raid5_conf_t), GFP_KERNEL); | 4723 | conf = kzalloc(sizeof(raid5_conf_t), GFP_KERNEL); |
4723 | if (conf == NULL) | 4724 | if (conf == NULL) |
4724 | goto abort; | 4725 | goto abort; |
4726 | spin_lock_init(&conf->device_lock); | ||
4727 | init_waitqueue_head(&conf->wait_for_stripe); | ||
4728 | init_waitqueue_head(&conf->wait_for_overlap); | ||
4729 | INIT_LIST_HEAD(&conf->handle_list); | ||
4730 | INIT_LIST_HEAD(&conf->hold_list); | ||
4731 | INIT_LIST_HEAD(&conf->delayed_list); | ||
4732 | INIT_LIST_HEAD(&conf->bitmap_list); | ||
4733 | INIT_LIST_HEAD(&conf->inactive_list); | ||
4734 | atomic_set(&conf->active_stripes, 0); | ||
4735 | atomic_set(&conf->preread_active_stripes, 0); | ||
4736 | atomic_set(&conf->active_aligned_reads, 0); | ||
4737 | conf->bypass_threshold = BYPASS_THRESHOLD; | ||
4725 | 4738 | ||
4726 | conf->raid_disks = mddev->raid_disks; | 4739 | conf->raid_disks = mddev->raid_disks; |
4727 | conf->scribble_len = scribble_len(conf->raid_disks); | ||
4728 | if (mddev->reshape_position == MaxSector) | 4740 | if (mddev->reshape_position == MaxSector) |
4729 | conf->previous_raid_disks = mddev->raid_disks; | 4741 | conf->previous_raid_disks = mddev->raid_disks; |
4730 | else | 4742 | else |
4731 | conf->previous_raid_disks = mddev->raid_disks - mddev->delta_disks; | 4743 | conf->previous_raid_disks = mddev->raid_disks - mddev->delta_disks; |
4744 | max_disks = max(conf->raid_disks, conf->previous_raid_disks); | ||
4745 | conf->scribble_len = scribble_len(max_disks); | ||
4732 | 4746 | ||
4733 | conf->disks = kzalloc(conf->raid_disks * sizeof(struct disk_info), | 4747 | conf->disks = kzalloc(max_disks * sizeof(struct disk_info), |
4734 | GFP_KERNEL); | 4748 | GFP_KERNEL); |
4735 | if (!conf->disks) | 4749 | if (!conf->disks) |
4736 | goto abort; | 4750 | goto abort; |
@@ -4744,24 +4758,11 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
4744 | if (raid5_alloc_percpu(conf) != 0) | 4758 | if (raid5_alloc_percpu(conf) != 0) |
4745 | goto abort; | 4759 | goto abort; |
4746 | 4760 | ||
4747 | spin_lock_init(&conf->device_lock); | ||
4748 | init_waitqueue_head(&conf->wait_for_stripe); | ||
4749 | init_waitqueue_head(&conf->wait_for_overlap); | ||
4750 | INIT_LIST_HEAD(&conf->handle_list); | ||
4751 | INIT_LIST_HEAD(&conf->hold_list); | ||
4752 | INIT_LIST_HEAD(&conf->delayed_list); | ||
4753 | INIT_LIST_HEAD(&conf->bitmap_list); | ||
4754 | INIT_LIST_HEAD(&conf->inactive_list); | ||
4755 | atomic_set(&conf->active_stripes, 0); | ||
4756 | atomic_set(&conf->preread_active_stripes, 0); | ||
4757 | atomic_set(&conf->active_aligned_reads, 0); | ||
4758 | conf->bypass_threshold = BYPASS_THRESHOLD; | ||
4759 | |||
4760 | pr_debug("raid5: run(%s) called.\n", mdname(mddev)); | 4761 | pr_debug("raid5: run(%s) called.\n", mdname(mddev)); |
4761 | 4762 | ||
4762 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 4763 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
4763 | raid_disk = rdev->raid_disk; | 4764 | raid_disk = rdev->raid_disk; |
4764 | if (raid_disk >= conf->raid_disks | 4765 | if (raid_disk >= max_disks |
4765 | || raid_disk < 0) | 4766 | || raid_disk < 0) |
4766 | continue; | 4767 | continue; |
4767 | disk = conf->disks + raid_disk; | 4768 | disk = conf->disks + raid_disk; |
@@ -4793,7 +4794,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
4793 | } | 4794 | } |
4794 | 4795 | ||
4795 | memory = conf->max_nr_stripes * (sizeof(struct stripe_head) + | 4796 | memory = conf->max_nr_stripes * (sizeof(struct stripe_head) + |
4796 | conf->raid_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; | 4797 | max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; |
4797 | if (grow_stripes(conf, conf->max_nr_stripes)) { | 4798 | if (grow_stripes(conf, conf->max_nr_stripes)) { |
4798 | printk(KERN_ERR | 4799 | printk(KERN_ERR |
4799 | "raid5: couldn't allocate %dkB for buffers\n", memory); | 4800 | "raid5: couldn't allocate %dkB for buffers\n", memory); |
@@ -4918,7 +4919,8 @@ static int run(mddev_t *mddev) | |||
4918 | test_bit(In_sync, &rdev->flags)) | 4919 | test_bit(In_sync, &rdev->flags)) |
4919 | working_disks++; | 4920 | working_disks++; |
4920 | 4921 | ||
4921 | mddev->degraded = conf->raid_disks - working_disks; | 4922 | mddev->degraded = (max(conf->raid_disks, conf->previous_raid_disks) |
4923 | - working_disks); | ||
4922 | 4924 | ||
4923 | if (mddev->degraded > conf->max_degraded) { | 4925 | if (mddev->degraded > conf->max_degraded) { |
4924 | printk(KERN_ERR "raid5: not enough operational devices for %s" | 4926 | printk(KERN_ERR "raid5: not enough operational devices for %s" |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 2390e0e83daf..dd708359b451 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -214,12 +214,20 @@ struct stripe_head { | |||
214 | int disks; /* disks in stripe */ | 214 | int disks; /* disks in stripe */ |
215 | enum check_states check_state; | 215 | enum check_states check_state; |
216 | enum reconstruct_states reconstruct_state; | 216 | enum reconstruct_states reconstruct_state; |
217 | /* stripe_operations | 217 | /** |
218 | * struct stripe_operations | ||
218 | * @target - STRIPE_OP_COMPUTE_BLK target | 219 | * @target - STRIPE_OP_COMPUTE_BLK target |
220 | * @target2 - 2nd compute target in the raid6 case | ||
221 | * @zero_sum_result - P and Q verification flags | ||
222 | * @request - async service request flags for raid_run_ops | ||
219 | */ | 223 | */ |
220 | struct stripe_operations { | 224 | struct stripe_operations { |
221 | int target, target2; | 225 | int target, target2; |
222 | enum sum_check_flags zero_sum_result; | 226 | enum sum_check_flags zero_sum_result; |
227 | #ifdef CONFIG_MULTICORE_RAID456 | ||
228 | unsigned long request; | ||
229 | wait_queue_head_t wait_for_ops; | ||
230 | #endif | ||
223 | } ops; | 231 | } ops; |
224 | struct r5dev { | 232 | struct r5dev { |
225 | struct bio req; | 233 | struct bio req; |
@@ -294,6 +302,8 @@ struct r6_state { | |||
294 | #define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */ | 302 | #define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */ |
295 | #define STRIPE_BIOFILL_RUN 14 | 303 | #define STRIPE_BIOFILL_RUN 14 |
296 | #define STRIPE_COMPUTE_RUN 15 | 304 | #define STRIPE_COMPUTE_RUN 15 |
305 | #define STRIPE_OPS_REQ_PENDING 16 | ||
306 | |||
297 | /* | 307 | /* |
298 | * Operation request flags | 308 | * Operation request flags |
299 | */ | 309 | */ |
@@ -478,7 +488,7 @@ static inline int algorithm_valid_raid6(int layout) | |||
478 | { | 488 | { |
479 | return (layout >= 0 && layout <= 5) | 489 | return (layout >= 0 && layout <= 5) |
480 | || | 490 | || |
481 | (layout == 8 || layout == 10) | 491 | (layout >= 8 && layout <= 10) |
482 | || | 492 | || |
483 | (layout >= 16 && layout <= 20); | 493 | (layout >= 16 && layout <= 20); |
484 | } | 494 | } |
diff --git a/drivers/md/raid6altivec.uc b/drivers/md/raid6altivec.uc index 699dfeee4944..2654d5c854be 100644 --- a/drivers/md/raid6altivec.uc +++ b/drivers/md/raid6altivec.uc | |||
@@ -15,7 +15,7 @@ | |||
15 | * | 15 | * |
16 | * $#-way unrolled portable integer math RAID-6 instruction set | 16 | * $#-way unrolled portable integer math RAID-6 instruction set |
17 | * | 17 | * |
18 | * This file is postprocessed using unroll.pl | 18 | * This file is postprocessed using unroll.awk |
19 | * | 19 | * |
20 | * <benh> hpa: in process, | 20 | * <benh> hpa: in process, |
21 | * you can just "steal" the vec unit with enable_kernel_altivec() (but | 21 | * you can just "steal" the vec unit with enable_kernel_altivec() (but |
diff --git a/drivers/md/raid6int.uc b/drivers/md/raid6int.uc index f9bf9cba357f..d1e276a14fab 100644 --- a/drivers/md/raid6int.uc +++ b/drivers/md/raid6int.uc | |||
@@ -15,7 +15,7 @@ | |||
15 | * | 15 | * |
16 | * $#-way unrolled portable integer math RAID-6 instruction set | 16 | * $#-way unrolled portable integer math RAID-6 instruction set |
17 | * | 17 | * |
18 | * This file is postprocessed using unroll.pl | 18 | * This file is postprocessed using unroll.awk |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/raid/pq.h> | 21 | #include <linux/raid/pq.h> |
diff --git a/drivers/md/raid6test/Makefile b/drivers/md/raid6test/Makefile index 58ffdf4f5161..2874cbef529d 100644 --- a/drivers/md/raid6test/Makefile +++ b/drivers/md/raid6test/Makefile | |||
@@ -7,7 +7,7 @@ CC = gcc | |||
7 | OPTFLAGS = -O2 # Adjust as desired | 7 | OPTFLAGS = -O2 # Adjust as desired |
8 | CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) | 8 | CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) |
9 | LD = ld | 9 | LD = ld |
10 | PERL = perl | 10 | AWK = awk |
11 | AR = ar | 11 | AR = ar |
12 | RANLIB = ranlib | 12 | RANLIB = ranlib |
13 | 13 | ||
@@ -35,35 +35,35 @@ raid6.a: raid6int1.o raid6int2.o raid6int4.o raid6int8.o raid6int16.o \ | |||
35 | raid6test: test.c raid6.a | 35 | raid6test: test.c raid6.a |
36 | $(CC) $(CFLAGS) -o raid6test $^ | 36 | $(CC) $(CFLAGS) -o raid6test $^ |
37 | 37 | ||
38 | raid6altivec1.c: raid6altivec.uc ../unroll.pl | 38 | raid6altivec1.c: raid6altivec.uc ../unroll.awk |
39 | $(PERL) ../unroll.pl 1 < raid6altivec.uc > $@ | 39 | $(AWK) ../unroll.awk -vN=1 < raid6altivec.uc > $@ |
40 | 40 | ||
41 | raid6altivec2.c: raid6altivec.uc ../unroll.pl | 41 | raid6altivec2.c: raid6altivec.uc ../unroll.awk |
42 | $(PERL) ../unroll.pl 2 < raid6altivec.uc > $@ | 42 | $(AWK) ../unroll.awk -vN=2 < raid6altivec.uc > $@ |
43 | 43 | ||
44 | raid6altivec4.c: raid6altivec.uc ../unroll.pl | 44 | raid6altivec4.c: raid6altivec.uc ../unroll.awk |
45 | $(PERL) ../unroll.pl 4 < raid6altivec.uc > $@ | 45 | $(AWK) ../unroll.awk -vN=4 < raid6altivec.uc > $@ |
46 | 46 | ||
47 | raid6altivec8.c: raid6altivec.uc ../unroll.pl | 47 | raid6altivec8.c: raid6altivec.uc ../unroll.awk |
48 | $(PERL) ../unroll.pl 8 < raid6altivec.uc > $@ | 48 | $(AWK) ../unroll.awk -vN=8 < raid6altivec.uc > $@ |
49 | 49 | ||
50 | raid6int1.c: raid6int.uc ../unroll.pl | 50 | raid6int1.c: raid6int.uc ../unroll.awk |
51 | $(PERL) ../unroll.pl 1 < raid6int.uc > $@ | 51 | $(AWK) ../unroll.awk -vN=1 < raid6int.uc > $@ |
52 | 52 | ||
53 | raid6int2.c: raid6int.uc ../unroll.pl | 53 | raid6int2.c: raid6int.uc ../unroll.awk |
54 | $(PERL) ../unroll.pl 2 < raid6int.uc > $@ | 54 | $(AWK) ../unroll.awk -vN=2 < raid6int.uc > $@ |
55 | 55 | ||
56 | raid6int4.c: raid6int.uc ../unroll.pl | 56 | raid6int4.c: raid6int.uc ../unroll.awk |
57 | $(PERL) ../unroll.pl 4 < raid6int.uc > $@ | 57 | $(AWK) ../unroll.awk -vN=4 < raid6int.uc > $@ |
58 | 58 | ||
59 | raid6int8.c: raid6int.uc ../unroll.pl | 59 | raid6int8.c: raid6int.uc ../unroll.awk |
60 | $(PERL) ../unroll.pl 8 < raid6int.uc > $@ | 60 | $(AWK) ../unroll.awk -vN=8 < raid6int.uc > $@ |
61 | 61 | ||
62 | raid6int16.c: raid6int.uc ../unroll.pl | 62 | raid6int16.c: raid6int.uc ../unroll.awk |
63 | $(PERL) ../unroll.pl 16 < raid6int.uc > $@ | 63 | $(AWK) ../unroll.awk -vN=16 < raid6int.uc > $@ |
64 | 64 | ||
65 | raid6int32.c: raid6int.uc ../unroll.pl | 65 | raid6int32.c: raid6int.uc ../unroll.awk |
66 | $(PERL) ../unroll.pl 32 < raid6int.uc > $@ | 66 | $(AWK) ../unroll.awk -vN=32 < raid6int.uc > $@ |
67 | 67 | ||
68 | raid6tables.c: mktables | 68 | raid6tables.c: mktables |
69 | ./mktables > raid6tables.c | 69 | ./mktables > raid6tables.c |
diff --git a/drivers/md/unroll.awk b/drivers/md/unroll.awk new file mode 100644 index 000000000000..c6aa03631df8 --- /dev/null +++ b/drivers/md/unroll.awk | |||
@@ -0,0 +1,20 @@ | |||
1 | |||
2 | # This filter requires one command line option of form -vN=n | ||
3 | # where n must be a decimal number. | ||
4 | # | ||
5 | # Repeat each input line containing $$ n times, replacing $$ with 0...n-1. | ||
6 | # Replace each $# with n, and each $* with a single $. | ||
7 | |||
8 | BEGIN { | ||
9 | n = N + 0 | ||
10 | } | ||
11 | { | ||
12 | if (/\$\$/) { rep = n } else { rep = 1 } | ||
13 | for (i = 0; i < rep; ++i) { | ||
14 | tmp = $0 | ||
15 | gsub(/\$\$/, i, tmp) | ||
16 | gsub(/\$\#/, n, tmp) | ||
17 | gsub(/\$\*/, "$", tmp) | ||
18 | print tmp | ||
19 | } | ||
20 | } | ||
diff --git a/drivers/md/unroll.pl b/drivers/md/unroll.pl deleted file mode 100644 index 3acc710a20ea..000000000000 --- a/drivers/md/unroll.pl +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # Take a piece of C code and for each line which contains the sequence $$ | ||
4 | # repeat n times with $ replaced by 0...n-1; the sequence $# is replaced | ||
5 | # by the unrolling factor, and $* with a single $ | ||
6 | # | ||
7 | |||
8 | ($n) = @ARGV; | ||
9 | $n += 0; | ||
10 | |||
11 | while ( defined($line = <STDIN>) ) { | ||
12 | if ( $line =~ /\$\$/ ) { | ||
13 | $rep = $n; | ||
14 | } else { | ||
15 | $rep = 1; | ||
16 | } | ||
17 | for ( $i = 0 ; $i < $rep ; $i++ ) { | ||
18 | $tmp = $line; | ||
19 | $tmp =~ s/\$\$/$i/g; | ||
20 | $tmp =~ s/\$\#/$n/g; | ||
21 | $tmp =~ s/\$\*/\$/g; | ||
22 | print $tmp; | ||
23 | } | ||
24 | } | ||
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c index e832e975da60..a1c47ee95c0e 100644 --- a/drivers/mfd/twl4030-core.c +++ b/drivers/mfd/twl4030-core.c | |||
@@ -795,7 +795,7 @@ twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
795 | twl->client = i2c_new_dummy(client->adapter, | 795 | twl->client = i2c_new_dummy(client->adapter, |
796 | twl->address); | 796 | twl->address); |
797 | if (!twl->client) { | 797 | if (!twl->client) { |
798 | dev_err(&twl->client->dev, | 798 | dev_err(&client->dev, |
799 | "can't attach client %d\n", i); | 799 | "can't attach client %d\n", i); |
800 | status = -ENOMEM; | 800 | status = -ENOMEM; |
801 | goto fail; | 801 | goto fail; |
diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c index d3015dfb9134..ac056ea6b66e 100644 --- a/drivers/mfd/wm831x-irq.c +++ b/drivers/mfd/wm831x-irq.c | |||
@@ -507,6 +507,8 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq) | |||
507 | { | 507 | { |
508 | int i, ret; | 508 | int i, ret; |
509 | 509 | ||
510 | mutex_init(&wm831x->irq_lock); | ||
511 | |||
510 | if (!irq) { | 512 | if (!irq) { |
511 | dev_warn(wm831x->dev, | 513 | dev_warn(wm831x->dev, |
512 | "No interrupt specified - functionality limited\n"); | 514 | "No interrupt specified - functionality limited\n"); |
@@ -521,7 +523,6 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq) | |||
521 | } | 523 | } |
522 | 524 | ||
523 | wm831x->irq = irq; | 525 | wm831x->irq = irq; |
524 | mutex_init(&wm831x->irq_lock); | ||
525 | INIT_WORK(&wm831x->irq_work, wm831x_irq_worker); | 526 | INIT_WORK(&wm831x->irq_work, wm831x_irq_worker); |
526 | 527 | ||
527 | /* Mask the individual interrupt sources */ | 528 | /* Mask the individual interrupt sources */ |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 4487cc097911..0aecaaebef3d 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -2013,7 +2013,7 @@ static struct platform_driver omap_hsmmc_driver = { | |||
2013 | static int __init omap_hsmmc_init(void) | 2013 | static int __init omap_hsmmc_init(void) |
2014 | { | 2014 | { |
2015 | /* Register the MMC driver */ | 2015 | /* Register the MMC driver */ |
2016 | return platform_driver_register(&omap_hsmmc_driver); | 2016 | return platform_driver_probe(&omap_hsmmc_driver, omap_hsmmc_probe); |
2017 | } | 2017 | } |
2018 | 2018 | ||
2019 | static void __exit omap_hsmmc_cleanup(void) | 2019 | static void __exit omap_hsmmc_cleanup(void) |
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index e1f7d0a78b9d..14cec04c34f9 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/log2.h> | 42 | #include <linux/log2.h> |
43 | #include <linux/kthread.h> | 43 | #include <linux/kthread.h> |
44 | #include <linux/reboot.h> | 44 | #include <linux/reboot.h> |
45 | #include <linux/kernel.h> | ||
45 | #include "ubi.h" | 46 | #include "ubi.h" |
46 | 47 | ||
47 | /* Maximum length of the 'mtd=' parameter */ | 48 | /* Maximum length of the 'mtd=' parameter */ |
@@ -1257,7 +1258,7 @@ static int __init bytes_str_to_int(const char *str) | |||
1257 | unsigned long result; | 1258 | unsigned long result; |
1258 | 1259 | ||
1259 | result = simple_strtoul(str, &endp, 0); | 1260 | result = simple_strtoul(str, &endp, 0); |
1260 | if (str == endp || result < 0) { | 1261 | if (str == endp || result >= INT_MAX) { |
1261 | printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n", | 1262 | printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n", |
1262 | str); | 1263 | str); |
1263 | return -EINVAL; | 1264 | return -EINVAL; |
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index e7161adc419d..90af61a2c3e4 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
@@ -794,16 +794,15 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
794 | * number. | 794 | * number. |
795 | */ | 795 | */ |
796 | image_seq = be32_to_cpu(ech->image_seq); | 796 | image_seq = be32_to_cpu(ech->image_seq); |
797 | if (!si->image_seq_set) { | 797 | if (!ubi->image_seq && image_seq) |
798 | ubi->image_seq = image_seq; | 798 | ubi->image_seq = image_seq; |
799 | si->image_seq_set = 1; | 799 | if (ubi->image_seq && image_seq && |
800 | } else if (ubi->image_seq && ubi->image_seq != image_seq) { | 800 | ubi->image_seq != image_seq) { |
801 | ubi_err("bad image sequence number %d in PEB %d, " | 801 | ubi_err("bad image sequence number %d in PEB %d, " |
802 | "expected %d", image_seq, pnum, ubi->image_seq); | 802 | "expected %d", image_seq, pnum, ubi->image_seq); |
803 | ubi_dbg_dump_ec_hdr(ech); | 803 | ubi_dbg_dump_ec_hdr(ech); |
804 | return -EINVAL; | 804 | return -EINVAL; |
805 | } | 805 | } |
806 | |||
807 | } | 806 | } |
808 | 807 | ||
809 | /* OK, we've done with the EC header, let's look at the VID header */ | 808 | /* OK, we've done with the EC header, let's look at the VID header */ |
diff --git a/drivers/mtd/ubi/scan.h b/drivers/mtd/ubi/scan.h index bab31695dace..ff179ad7ca55 100644 --- a/drivers/mtd/ubi/scan.h +++ b/drivers/mtd/ubi/scan.h | |||
@@ -103,7 +103,6 @@ struct ubi_scan_volume { | |||
103 | * @ec_sum: a temporary variable used when calculating @mean_ec | 103 | * @ec_sum: a temporary variable used when calculating @mean_ec |
104 | * @ec_count: a temporary variable used when calculating @mean_ec | 104 | * @ec_count: a temporary variable used when calculating @mean_ec |
105 | * @corr_count: count of corrupted PEBs | 105 | * @corr_count: count of corrupted PEBs |
106 | * @image_seq_set: indicates @ubi->image_seq is known | ||
107 | * | 106 | * |
108 | * This data structure contains the result of scanning and may be used by other | 107 | * This data structure contains the result of scanning and may be used by other |
109 | * UBI sub-systems to build final UBI data structures, further error-recovery | 108 | * UBI sub-systems to build final UBI data structures, further error-recovery |
@@ -127,7 +126,6 @@ struct ubi_scan_info { | |||
127 | uint64_t ec_sum; | 126 | uint64_t ec_sum; |
128 | int ec_count; | 127 | int ec_count; |
129 | int corr_count; | 128 | int corr_count; |
130 | int image_seq_set; | ||
131 | }; | 129 | }; |
132 | 130 | ||
133 | struct ubi_device; | 131 | struct ubi_device; |
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 04f63c77071d..ce6f1ac25df8 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
@@ -34,6 +34,7 @@ | |||
34 | * | 34 | * |
35 | * | 35 | * |
36 | */ | 36 | */ |
37 | #include <linux/capability.h> | ||
37 | #include <linux/dma-mapping.h> | 38 | #include <linux/dma-mapping.h> |
38 | #include <linux/module.h> | 39 | #include <linux/module.h> |
39 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 6c7f795d12de..a4d83409f205 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -361,9 +361,12 @@ struct l2_fhdr { | |||
361 | #define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE (1<<28) | 361 | #define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE (1<<28) |
362 | 362 | ||
363 | #define BNX2_L2CTX_HOST_BDIDX 0x00000004 | 363 | #define BNX2_L2CTX_HOST_BDIDX 0x00000004 |
364 | #define BNX2_L2CTX_STATUSB_NUM_SHIFT 16 | 364 | #define BNX2_L2CTX_L5_STATUSB_NUM_SHIFT 16 |
365 | #define BNX2_L2CTX_STATUSB_NUM(sb_id) \ | 365 | #define BNX2_L2CTX_L2_STATUSB_NUM_SHIFT 24 |
366 | (((sb_id) > 0) ? (((sb_id) + 7) << BNX2_L2CTX_STATUSB_NUM_SHIFT) : 0) | 366 | #define BNX2_L2CTX_L5_STATUSB_NUM(sb_id) \ |
367 | (((sb_id) > 0) ? (((sb_id) + 7) << BNX2_L2CTX_L5_STATUSB_NUM_SHIFT) : 0) | ||
368 | #define BNX2_L2CTX_L2_STATUSB_NUM(sb_id) \ | ||
369 | (((sb_id) > 0) ? (((sb_id) + 7) << BNX2_L2CTX_L2_STATUSB_NUM_SHIFT) : 0) | ||
367 | #define BNX2_L2CTX_HOST_BSEQ 0x00000008 | 370 | #define BNX2_L2CTX_HOST_BSEQ 0x00000008 |
368 | #define BNX2_L2CTX_NX_BSEQ 0x0000000c | 371 | #define BNX2_L2CTX_NX_BSEQ 0x0000000c |
369 | #define BNX2_L2CTX_NX_BDHADDR_HI 0x00000010 | 372 | #define BNX2_L2CTX_NX_BDHADDR_HI 0x00000010 |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 69c5b15e22da..40fb5eefc72e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -691,7 +691,7 @@ static int bond_check_dev_link(struct bonding *bond, | |||
691 | struct net_device *slave_dev, int reporting) | 691 | struct net_device *slave_dev, int reporting) |
692 | { | 692 | { |
693 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; | 693 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; |
694 | static int (*ioctl)(struct net_device *, struct ifreq *, int); | 694 | int (*ioctl)(struct net_device *, struct ifreq *, int); |
695 | struct ifreq ifr; | 695 | struct ifreq ifr; |
696 | struct mii_ioctl_data *mii; | 696 | struct mii_ioctl_data *mii; |
697 | 697 | ||
@@ -3665,10 +3665,10 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, | |||
3665 | 3665 | ||
3666 | if (skb->protocol == htons(ETH_P_IP)) { | 3666 | if (skb->protocol == htons(ETH_P_IP)) { |
3667 | return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ | 3667 | return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ |
3668 | (data->h_dest[5] ^ bond_dev->dev_addr[5])) % count; | 3668 | (data->h_dest[5] ^ data->h_source[5])) % count; |
3669 | } | 3669 | } |
3670 | 3670 | ||
3671 | return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; | 3671 | return (data->h_dest[5] ^ data->h_source[5]) % count; |
3672 | } | 3672 | } |
3673 | 3673 | ||
3674 | /* | 3674 | /* |
@@ -3695,7 +3695,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb, | |||
3695 | 3695 | ||
3696 | } | 3696 | } |
3697 | 3697 | ||
3698 | return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; | 3698 | return (data->h_dest[5] ^ data->h_source[5]) % count; |
3699 | } | 3699 | } |
3700 | 3700 | ||
3701 | /* | 3701 | /* |
@@ -3706,7 +3706,7 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb, | |||
3706 | { | 3706 | { |
3707 | struct ethhdr *data = (struct ethhdr *)skb->data; | 3707 | struct ethhdr *data = (struct ethhdr *)skb->data; |
3708 | 3708 | ||
3709 | return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; | 3709 | return (data->h_dest[5] ^ data->h_source[5]) % count; |
3710 | } | 3710 | } |
3711 | 3711 | ||
3712 | /*-------------------------- Device entry points ----------------------------*/ | 3712 | /*-------------------------- Device entry points ----------------------------*/ |
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 46c87ec7960c..3bf1b04f2cab 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -2264,9 +2264,9 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev) | |||
2264 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_CTX_TYPE, val); | 2264 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_CTX_TYPE, val); |
2265 | 2265 | ||
2266 | if (sb_id == 0) | 2266 | if (sb_id == 0) |
2267 | val = 2 << BNX2_L2CTX_STATUSB_NUM_SHIFT; | 2267 | val = 2 << BNX2_L2CTX_L2_STATUSB_NUM_SHIFT; |
2268 | else | 2268 | else |
2269 | val = BNX2_L2CTX_STATUSB_NUM(sb_id); | 2269 | val = BNX2_L2CTX_L2_STATUSB_NUM(sb_id); |
2270 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val); | 2270 | cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val); |
2271 | 2271 | ||
2272 | rxbd = (struct rx_bd *) (cp->l2_ring + BCM_PAGE_SIZE); | 2272 | rxbd = (struct rx_bd *) (cp->l2_ring + BCM_PAGE_SIZE); |
@@ -2423,7 +2423,7 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev) | |||
2423 | cp->int_num = 0; | 2423 | cp->int_num = 0; |
2424 | if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { | 2424 | if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { |
2425 | u32 sb_id = cp->status_blk_num; | 2425 | u32 sb_id = cp->status_blk_num; |
2426 | u32 sb = BNX2_L2CTX_STATUSB_NUM(sb_id); | 2426 | u32 sb = BNX2_L2CTX_L5_STATUSB_NUM(sb_id); |
2427 | 2427 | ||
2428 | cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT; | 2428 | cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT; |
2429 | cnic_ctx_wr(dev, cp->kwq_cid_addr, L5_KRNLQ_HOST_QIDX, sb); | 2429 | cnic_ctx_wr(dev, cp->kwq_cid_addr, L5_KRNLQ_HOST_QIDX, sb); |
diff --git a/drivers/net/dm9000.h b/drivers/net/dm9000.h index 80817c2edfb3..fb1c924d79b4 100644 --- a/drivers/net/dm9000.h +++ b/drivers/net/dm9000.h | |||
@@ -50,7 +50,7 @@ | |||
50 | #define DM9000_RCSR 0x32 | 50 | #define DM9000_RCSR 0x32 |
51 | 51 | ||
52 | #define CHIPR_DM9000A 0x19 | 52 | #define CHIPR_DM9000A 0x19 |
53 | #define CHIPR_DM9000B 0x1B | 53 | #define CHIPR_DM9000B 0x1A |
54 | 54 | ||
55 | #define DM9000_MRCMDX 0xF0 | 55 | #define DM9000_MRCMDX 0xF0 |
56 | #define DM9000_MRCMD 0xF2 | 56 | #define DM9000_MRCMD 0xF2 |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 981936c1fb46..405a144ebcad 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -519,9 +519,13 @@ extern s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw); | |||
519 | extern s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw); | 519 | extern s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw); |
520 | extern s32 e1000e_get_phy_info_igp(struct e1000_hw *hw); | 520 | extern s32 e1000e_get_phy_info_igp(struct e1000_hw *hw); |
521 | extern s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data); | 521 | extern s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data); |
522 | extern s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, | ||
523 | u16 *data); | ||
522 | extern s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw); | 524 | extern s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw); |
523 | extern s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active); | 525 | extern s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active); |
524 | extern s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data); | 526 | extern s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data); |
527 | extern s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, | ||
528 | u16 data); | ||
525 | extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw); | 529 | extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw); |
526 | extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw); | 530 | extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw); |
527 | extern s32 e1000e_get_cfg_done(struct e1000_hw *hw); | 531 | extern s32 e1000e_get_cfg_done(struct e1000_hw *hw); |
@@ -538,7 +542,11 @@ extern s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data); | |||
538 | extern s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data); | 542 | extern s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data); |
539 | extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl); | 543 | extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl); |
540 | extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); | 544 | extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); |
545 | extern s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, | ||
546 | u16 data); | ||
541 | extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); | 547 | extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); |
548 | extern s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, | ||
549 | u16 *data); | ||
542 | extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, | 550 | extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, |
543 | u32 usec_interval, bool *success); | 551 | u32 usec_interval, bool *success); |
544 | extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw); | 552 | extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw); |
@@ -546,7 +554,11 @@ extern s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data); | |||
546 | extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); | 554 | extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); |
547 | extern s32 e1000e_check_downshift(struct e1000_hw *hw); | 555 | extern s32 e1000e_check_downshift(struct e1000_hw *hw); |
548 | extern s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data); | 556 | extern s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data); |
557 | extern s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, | ||
558 | u16 *data); | ||
549 | extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data); | 559 | extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data); |
560 | extern s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, | ||
561 | u16 data); | ||
550 | extern s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow); | 562 | extern s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow); |
551 | extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); | 563 | extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); |
552 | extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); | 564 | extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index fd44d9f90769..7b05cf47f7f5 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -764,11 +764,13 @@ struct e1000_phy_operations { | |||
764 | s32 (*get_cable_length)(struct e1000_hw *); | 764 | s32 (*get_cable_length)(struct e1000_hw *); |
765 | s32 (*get_phy_info)(struct e1000_hw *); | 765 | s32 (*get_phy_info)(struct e1000_hw *); |
766 | s32 (*read_phy_reg)(struct e1000_hw *, u32, u16 *); | 766 | s32 (*read_phy_reg)(struct e1000_hw *, u32, u16 *); |
767 | s32 (*read_phy_reg_locked)(struct e1000_hw *, u32, u16 *); | ||
767 | void (*release_phy)(struct e1000_hw *); | 768 | void (*release_phy)(struct e1000_hw *); |
768 | s32 (*reset_phy)(struct e1000_hw *); | 769 | s32 (*reset_phy)(struct e1000_hw *); |
769 | s32 (*set_d0_lplu_state)(struct e1000_hw *, bool); | 770 | s32 (*set_d0_lplu_state)(struct e1000_hw *, bool); |
770 | s32 (*set_d3_lplu_state)(struct e1000_hw *, bool); | 771 | s32 (*set_d3_lplu_state)(struct e1000_hw *, bool); |
771 | s32 (*write_phy_reg)(struct e1000_hw *, u32, u16); | 772 | s32 (*write_phy_reg)(struct e1000_hw *, u32, u16); |
773 | s32 (*write_phy_reg_locked)(struct e1000_hw *, u32, u16); | ||
772 | s32 (*cfg_on_link_up)(struct e1000_hw *); | 774 | s32 (*cfg_on_link_up)(struct e1000_hw *); |
773 | }; | 775 | }; |
774 | 776 | ||
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 99df2abf82a9..b6388b9535fd 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -122,6 +122,13 @@ | |||
122 | 122 | ||
123 | #define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */ | 123 | #define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */ |
124 | 124 | ||
125 | #define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */ | ||
126 | |||
127 | /* OEM Bits Phy Register */ | ||
128 | #define HV_OEM_BITS PHY_REG(768, 25) | ||
129 | #define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */ | ||
130 | #define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */ | ||
131 | |||
125 | /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ | 132 | /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ |
126 | /* Offset 04h HSFSTS */ | 133 | /* Offset 04h HSFSTS */ |
127 | union ich8_hws_flash_status { | 134 | union ich8_hws_flash_status { |
@@ -200,6 +207,7 @@ static s32 e1000_setup_led_pchlan(struct e1000_hw *hw); | |||
200 | static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw); | 207 | static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw); |
201 | static s32 e1000_led_on_pchlan(struct e1000_hw *hw); | 208 | static s32 e1000_led_on_pchlan(struct e1000_hw *hw); |
202 | static s32 e1000_led_off_pchlan(struct e1000_hw *hw); | 209 | static s32 e1000_led_off_pchlan(struct e1000_hw *hw); |
210 | static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active); | ||
203 | 211 | ||
204 | static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) | 212 | static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) |
205 | { | 213 | { |
@@ -242,7 +250,11 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
242 | 250 | ||
243 | phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; | 251 | phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; |
244 | phy->ops.read_phy_reg = e1000_read_phy_reg_hv; | 252 | phy->ops.read_phy_reg = e1000_read_phy_reg_hv; |
253 | phy->ops.read_phy_reg_locked = e1000_read_phy_reg_hv_locked; | ||
254 | phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan; | ||
255 | phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan; | ||
245 | phy->ops.write_phy_reg = e1000_write_phy_reg_hv; | 256 | phy->ops.write_phy_reg = e1000_write_phy_reg_hv; |
257 | phy->ops.write_phy_reg_locked = e1000_write_phy_reg_hv_locked; | ||
246 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 258 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
247 | 259 | ||
248 | phy->id = e1000_phy_unknown; | 260 | phy->id = e1000_phy_unknown; |
@@ -303,6 +315,8 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) | |||
303 | case IGP03E1000_E_PHY_ID: | 315 | case IGP03E1000_E_PHY_ID: |
304 | phy->type = e1000_phy_igp_3; | 316 | phy->type = e1000_phy_igp_3; |
305 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 317 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
318 | phy->ops.read_phy_reg_locked = e1000e_read_phy_reg_igp_locked; | ||
319 | phy->ops.write_phy_reg_locked = e1000e_write_phy_reg_igp_locked; | ||
306 | break; | 320 | break; |
307 | case IFE_E_PHY_ID: | 321 | case IFE_E_PHY_ID: |
308 | case IFE_PLUS_E_PHY_ID: | 322 | case IFE_PLUS_E_PHY_ID: |
@@ -568,12 +582,39 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) | |||
568 | static DEFINE_MUTEX(nvm_mutex); | 582 | static DEFINE_MUTEX(nvm_mutex); |
569 | 583 | ||
570 | /** | 584 | /** |
585 | * e1000_acquire_nvm_ich8lan - Acquire NVM mutex | ||
586 | * @hw: pointer to the HW structure | ||
587 | * | ||
588 | * Acquires the mutex for performing NVM operations. | ||
589 | **/ | ||
590 | static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw) | ||
591 | { | ||
592 | mutex_lock(&nvm_mutex); | ||
593 | |||
594 | return 0; | ||
595 | } | ||
596 | |||
597 | /** | ||
598 | * e1000_release_nvm_ich8lan - Release NVM mutex | ||
599 | * @hw: pointer to the HW structure | ||
600 | * | ||
601 | * Releases the mutex used while performing NVM operations. | ||
602 | **/ | ||
603 | static void e1000_release_nvm_ich8lan(struct e1000_hw *hw) | ||
604 | { | ||
605 | mutex_unlock(&nvm_mutex); | ||
606 | |||
607 | return; | ||
608 | } | ||
609 | |||
610 | static DEFINE_MUTEX(swflag_mutex); | ||
611 | |||
612 | /** | ||
571 | * e1000_acquire_swflag_ich8lan - Acquire software control flag | 613 | * e1000_acquire_swflag_ich8lan - Acquire software control flag |
572 | * @hw: pointer to the HW structure | 614 | * @hw: pointer to the HW structure |
573 | * | 615 | * |
574 | * Acquires the software control flag for performing NVM and PHY | 616 | * Acquires the software control flag for performing PHY and select |
575 | * operations. This is a function pointer entry point only called by | 617 | * MAC CSR accesses. |
576 | * read/write routines for the PHY and NVM parts. | ||
577 | **/ | 618 | **/ |
578 | static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | 619 | static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) |
579 | { | 620 | { |
@@ -582,7 +623,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
582 | 623 | ||
583 | might_sleep(); | 624 | might_sleep(); |
584 | 625 | ||
585 | mutex_lock(&nvm_mutex); | 626 | mutex_lock(&swflag_mutex); |
586 | 627 | ||
587 | while (timeout) { | 628 | while (timeout) { |
588 | extcnf_ctrl = er32(EXTCNF_CTRL); | 629 | extcnf_ctrl = er32(EXTCNF_CTRL); |
@@ -599,7 +640,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
599 | goto out; | 640 | goto out; |
600 | } | 641 | } |
601 | 642 | ||
602 | timeout = PHY_CFG_TIMEOUT * 2; | 643 | timeout = SW_FLAG_TIMEOUT; |
603 | 644 | ||
604 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; | 645 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; |
605 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 646 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
@@ -623,7 +664,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
623 | 664 | ||
624 | out: | 665 | out: |
625 | if (ret_val) | 666 | if (ret_val) |
626 | mutex_unlock(&nvm_mutex); | 667 | mutex_unlock(&swflag_mutex); |
627 | 668 | ||
628 | return ret_val; | 669 | return ret_val; |
629 | } | 670 | } |
@@ -632,9 +673,8 @@ out: | |||
632 | * e1000_release_swflag_ich8lan - Release software control flag | 673 | * e1000_release_swflag_ich8lan - Release software control flag |
633 | * @hw: pointer to the HW structure | 674 | * @hw: pointer to the HW structure |
634 | * | 675 | * |
635 | * Releases the software control flag for performing NVM and PHY operations. | 676 | * Releases the software control flag for performing PHY and select |
636 | * This is a function pointer entry point only called by read/write | 677 | * MAC CSR accesses. |
637 | * routines for the PHY and NVM parts. | ||
638 | **/ | 678 | **/ |
639 | static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) | 679 | static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) |
640 | { | 680 | { |
@@ -644,7 +684,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) | |||
644 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; | 684 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; |
645 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 685 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
646 | 686 | ||
647 | mutex_unlock(&nvm_mutex); | 687 | mutex_unlock(&swflag_mutex); |
688 | |||
689 | return; | ||
648 | } | 690 | } |
649 | 691 | ||
650 | /** | 692 | /** |
@@ -844,7 +886,7 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
844 | u32 i; | 886 | u32 i; |
845 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; | 887 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; |
846 | s32 ret_val; | 888 | s32 ret_val; |
847 | u16 word_addr, reg_data, reg_addr, phy_page = 0; | 889 | u16 reg, word_addr, reg_data, reg_addr, phy_page = 0; |
848 | 890 | ||
849 | ret_val = e1000e_phy_hw_reset_generic(hw); | 891 | ret_val = e1000e_phy_hw_reset_generic(hw); |
850 | if (ret_val) | 892 | if (ret_val) |
@@ -859,6 +901,10 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
859 | return ret_val; | 901 | return ret_val; |
860 | } | 902 | } |
861 | 903 | ||
904 | /* Dummy read to clear the phy wakeup bit after lcd reset */ | ||
905 | if (hw->mac.type == e1000_pchlan) | ||
906 | e1e_rphy(hw, BM_WUC, ®); | ||
907 | |||
862 | /* | 908 | /* |
863 | * Initialize the PHY from the NVM on ICH platforms. This | 909 | * Initialize the PHY from the NVM on ICH platforms. This |
864 | * is needed due to an issue where the NVM configuration is | 910 | * is needed due to an issue where the NVM configuration is |
@@ -1054,6 +1100,38 @@ static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw) | |||
1054 | } | 1100 | } |
1055 | 1101 | ||
1056 | /** | 1102 | /** |
1103 | * e1000_set_lplu_state_pchlan - Set Low Power Link Up state | ||
1104 | * @hw: pointer to the HW structure | ||
1105 | * @active: true to enable LPLU, false to disable | ||
1106 | * | ||
1107 | * Sets the LPLU state according to the active flag. For PCH, if OEM write | ||
1108 | * bit are disabled in the NVM, writing the LPLU bits in the MAC will not set | ||
1109 | * the phy speed. This function will manually set the LPLU bit and restart | ||
1110 | * auto-neg as hw would do. D3 and D0 LPLU will call the same function | ||
1111 | * since it configures the same bit. | ||
1112 | **/ | ||
1113 | static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active) | ||
1114 | { | ||
1115 | s32 ret_val = 0; | ||
1116 | u16 oem_reg; | ||
1117 | |||
1118 | ret_val = e1e_rphy(hw, HV_OEM_BITS, &oem_reg); | ||
1119 | if (ret_val) | ||
1120 | goto out; | ||
1121 | |||
1122 | if (active) | ||
1123 | oem_reg |= HV_OEM_BITS_LPLU; | ||
1124 | else | ||
1125 | oem_reg &= ~HV_OEM_BITS_LPLU; | ||
1126 | |||
1127 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
1128 | ret_val = e1e_wphy(hw, HV_OEM_BITS, oem_reg); | ||
1129 | |||
1130 | out: | ||
1131 | return ret_val; | ||
1132 | } | ||
1133 | |||
1134 | /** | ||
1057 | * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state | 1135 | * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state |
1058 | * @hw: pointer to the HW structure | 1136 | * @hw: pointer to the HW structure |
1059 | * @active: TRUE to enable LPLU, FALSE to disable | 1137 | * @active: TRUE to enable LPLU, FALSE to disable |
@@ -1314,12 +1392,11 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1314 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || | 1392 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || |
1315 | (words == 0)) { | 1393 | (words == 0)) { |
1316 | hw_dbg(hw, "nvm parameter(s) out of bounds\n"); | 1394 | hw_dbg(hw, "nvm parameter(s) out of bounds\n"); |
1317 | return -E1000_ERR_NVM; | 1395 | ret_val = -E1000_ERR_NVM; |
1396 | goto out; | ||
1318 | } | 1397 | } |
1319 | 1398 | ||
1320 | ret_val = e1000_acquire_swflag_ich8lan(hw); | 1399 | nvm->ops.acquire_nvm(hw); |
1321 | if (ret_val) | ||
1322 | goto out; | ||
1323 | 1400 | ||
1324 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); | 1401 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); |
1325 | if (ret_val) { | 1402 | if (ret_val) { |
@@ -1345,7 +1422,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1345 | } | 1422 | } |
1346 | } | 1423 | } |
1347 | 1424 | ||
1348 | e1000_release_swflag_ich8lan(hw); | 1425 | nvm->ops.release_nvm(hw); |
1349 | 1426 | ||
1350 | out: | 1427 | out: |
1351 | if (ret_val) | 1428 | if (ret_val) |
@@ -1603,11 +1680,15 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1603 | return -E1000_ERR_NVM; | 1680 | return -E1000_ERR_NVM; |
1604 | } | 1681 | } |
1605 | 1682 | ||
1683 | nvm->ops.acquire_nvm(hw); | ||
1684 | |||
1606 | for (i = 0; i < words; i++) { | 1685 | for (i = 0; i < words; i++) { |
1607 | dev_spec->shadow_ram[offset+i].modified = 1; | 1686 | dev_spec->shadow_ram[offset+i].modified = 1; |
1608 | dev_spec->shadow_ram[offset+i].value = data[i]; | 1687 | dev_spec->shadow_ram[offset+i].value = data[i]; |
1609 | } | 1688 | } |
1610 | 1689 | ||
1690 | nvm->ops.release_nvm(hw); | ||
1691 | |||
1611 | return 0; | 1692 | return 0; |
1612 | } | 1693 | } |
1613 | 1694 | ||
@@ -1637,9 +1718,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1637 | if (nvm->type != e1000_nvm_flash_sw) | 1718 | if (nvm->type != e1000_nvm_flash_sw) |
1638 | goto out; | 1719 | goto out; |
1639 | 1720 | ||
1640 | ret_val = e1000_acquire_swflag_ich8lan(hw); | 1721 | nvm->ops.acquire_nvm(hw); |
1641 | if (ret_val) | ||
1642 | goto out; | ||
1643 | 1722 | ||
1644 | /* | 1723 | /* |
1645 | * We're writing to the opposite bank so if we're on bank 1, | 1724 | * We're writing to the opposite bank so if we're on bank 1, |
@@ -1657,7 +1736,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1657 | old_bank_offset = 0; | 1736 | old_bank_offset = 0; |
1658 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); | 1737 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); |
1659 | if (ret_val) { | 1738 | if (ret_val) { |
1660 | e1000_release_swflag_ich8lan(hw); | 1739 | nvm->ops.release_nvm(hw); |
1661 | goto out; | 1740 | goto out; |
1662 | } | 1741 | } |
1663 | } else { | 1742 | } else { |
@@ -1665,7 +1744,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1665 | new_bank_offset = 0; | 1744 | new_bank_offset = 0; |
1666 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); | 1745 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); |
1667 | if (ret_val) { | 1746 | if (ret_val) { |
1668 | e1000_release_swflag_ich8lan(hw); | 1747 | nvm->ops.release_nvm(hw); |
1669 | goto out; | 1748 | goto out; |
1670 | } | 1749 | } |
1671 | } | 1750 | } |
@@ -1723,7 +1802,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1723 | if (ret_val) { | 1802 | if (ret_val) { |
1724 | /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ | 1803 | /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ |
1725 | hw_dbg(hw, "Flash commit failed.\n"); | 1804 | hw_dbg(hw, "Flash commit failed.\n"); |
1726 | e1000_release_swflag_ich8lan(hw); | 1805 | nvm->ops.release_nvm(hw); |
1727 | goto out; | 1806 | goto out; |
1728 | } | 1807 | } |
1729 | 1808 | ||
@@ -1736,7 +1815,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1736 | act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; | 1815 | act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; |
1737 | ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); | 1816 | ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); |
1738 | if (ret_val) { | 1817 | if (ret_val) { |
1739 | e1000_release_swflag_ich8lan(hw); | 1818 | nvm->ops.release_nvm(hw); |
1740 | goto out; | 1819 | goto out; |
1741 | } | 1820 | } |
1742 | data &= 0xBFFF; | 1821 | data &= 0xBFFF; |
@@ -1744,7 +1823,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1744 | act_offset * 2 + 1, | 1823 | act_offset * 2 + 1, |
1745 | (u8)(data >> 8)); | 1824 | (u8)(data >> 8)); |
1746 | if (ret_val) { | 1825 | if (ret_val) { |
1747 | e1000_release_swflag_ich8lan(hw); | 1826 | nvm->ops.release_nvm(hw); |
1748 | goto out; | 1827 | goto out; |
1749 | } | 1828 | } |
1750 | 1829 | ||
@@ -1757,7 +1836,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1757 | act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; | 1836 | act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; |
1758 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); | 1837 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); |
1759 | if (ret_val) { | 1838 | if (ret_val) { |
1760 | e1000_release_swflag_ich8lan(hw); | 1839 | nvm->ops.release_nvm(hw); |
1761 | goto out; | 1840 | goto out; |
1762 | } | 1841 | } |
1763 | 1842 | ||
@@ -1767,7 +1846,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1767 | dev_spec->shadow_ram[i].value = 0xFFFF; | 1846 | dev_spec->shadow_ram[i].value = 0xFFFF; |
1768 | } | 1847 | } |
1769 | 1848 | ||
1770 | e1000_release_swflag_ich8lan(hw); | 1849 | nvm->ops.release_nvm(hw); |
1771 | 1850 | ||
1772 | /* | 1851 | /* |
1773 | * Reload the EEPROM, or else modifications will not appear | 1852 | * Reload the EEPROM, or else modifications will not appear |
@@ -1831,14 +1910,12 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1831 | **/ | 1910 | **/ |
1832 | void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) | 1911 | void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) |
1833 | { | 1912 | { |
1913 | struct e1000_nvm_info *nvm = &hw->nvm; | ||
1834 | union ich8_flash_protected_range pr0; | 1914 | union ich8_flash_protected_range pr0; |
1835 | union ich8_hws_flash_status hsfsts; | 1915 | union ich8_hws_flash_status hsfsts; |
1836 | u32 gfpreg; | 1916 | u32 gfpreg; |
1837 | s32 ret_val; | ||
1838 | 1917 | ||
1839 | ret_val = e1000_acquire_swflag_ich8lan(hw); | 1918 | nvm->ops.acquire_nvm(hw); |
1840 | if (ret_val) | ||
1841 | return; | ||
1842 | 1919 | ||
1843 | gfpreg = er32flash(ICH_FLASH_GFPREG); | 1920 | gfpreg = er32flash(ICH_FLASH_GFPREG); |
1844 | 1921 | ||
@@ -1859,7 +1936,7 @@ void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) | |||
1859 | hsfsts.hsf_status.flockdn = true; | 1936 | hsfsts.hsf_status.flockdn = true; |
1860 | ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval); | 1937 | ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval); |
1861 | 1938 | ||
1862 | e1000_release_swflag_ich8lan(hw); | 1939 | nvm->ops.release_nvm(hw); |
1863 | } | 1940 | } |
1864 | 1941 | ||
1865 | /** | 1942 | /** |
@@ -2229,6 +2306,7 @@ static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw) | |||
2229 | **/ | 2306 | **/ |
2230 | static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | 2307 | static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) |
2231 | { | 2308 | { |
2309 | u16 reg; | ||
2232 | u32 ctrl, icr, kab; | 2310 | u32 ctrl, icr, kab; |
2233 | s32 ret_val; | 2311 | s32 ret_val; |
2234 | 2312 | ||
@@ -2304,6 +2382,9 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2304 | hw_dbg(hw, "Auto Read Done did not complete\n"); | 2382 | hw_dbg(hw, "Auto Read Done did not complete\n"); |
2305 | } | 2383 | } |
2306 | } | 2384 | } |
2385 | /* Dummy read to clear the phy wakeup bit after lcd reset */ | ||
2386 | if (hw->mac.type == e1000_pchlan) | ||
2387 | e1e_rphy(hw, BM_WUC, ®); | ||
2307 | 2388 | ||
2308 | /* | 2389 | /* |
2309 | * For PCH, this write will make sure that any noise | 2390 | * For PCH, this write will make sure that any noise |
@@ -2843,9 +2924,8 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw) | |||
2843 | E1000_PHY_CTRL_GBE_DISABLE; | 2924 | E1000_PHY_CTRL_GBE_DISABLE; |
2844 | ew32(PHY_CTRL, phy_ctrl); | 2925 | ew32(PHY_CTRL, phy_ctrl); |
2845 | 2926 | ||
2846 | /* Workaround SWFLAG unexpectedly set during S0->Sx */ | ||
2847 | if (hw->mac.type == e1000_pchlan) | 2927 | if (hw->mac.type == e1000_pchlan) |
2848 | udelay(500); | 2928 | e1000_phy_hw_reset_ich8lan(hw); |
2849 | default: | 2929 | default: |
2850 | break; | 2930 | break; |
2851 | } | 2931 | } |
@@ -3113,9 +3193,9 @@ static struct e1000_phy_operations ich8_phy_ops = { | |||
3113 | }; | 3193 | }; |
3114 | 3194 | ||
3115 | static struct e1000_nvm_operations ich8_nvm_ops = { | 3195 | static struct e1000_nvm_operations ich8_nvm_ops = { |
3116 | .acquire_nvm = e1000_acquire_swflag_ich8lan, | 3196 | .acquire_nvm = e1000_acquire_nvm_ich8lan, |
3117 | .read_nvm = e1000_read_nvm_ich8lan, | 3197 | .read_nvm = e1000_read_nvm_ich8lan, |
3118 | .release_nvm = e1000_release_swflag_ich8lan, | 3198 | .release_nvm = e1000_release_nvm_ich8lan, |
3119 | .update_nvm = e1000_update_nvm_checksum_ich8lan, | 3199 | .update_nvm = e1000_update_nvm_checksum_ich8lan, |
3120 | .valid_led_default = e1000_valid_led_default_ich8lan, | 3200 | .valid_led_default = e1000_valid_led_default_ich8lan, |
3121 | .validate_nvm = e1000_validate_nvm_checksum_ich8lan, | 3201 | .validate_nvm = e1000_validate_nvm_checksum_ich8lan, |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 994401fd0664..f9d33ab05e97 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -164,16 +164,25 @@ s32 e1000e_get_phy_id(struct e1000_hw *hw) | |||
164 | * MDIC mode. No harm in trying again in this case since | 164 | * MDIC mode. No harm in trying again in this case since |
165 | * the PHY ID is unknown at this point anyway | 165 | * the PHY ID is unknown at this point anyway |
166 | */ | 166 | */ |
167 | ret_val = phy->ops.acquire_phy(hw); | ||
168 | if (ret_val) | ||
169 | goto out; | ||
167 | ret_val = e1000_set_mdio_slow_mode_hv(hw, true); | 170 | ret_val = e1000_set_mdio_slow_mode_hv(hw, true); |
168 | if (ret_val) | 171 | if (ret_val) |
169 | goto out; | 172 | goto out; |
173 | phy->ops.release_phy(hw); | ||
170 | 174 | ||
171 | retry_count++; | 175 | retry_count++; |
172 | } | 176 | } |
173 | out: | 177 | out: |
174 | /* Revert to MDIO fast mode, if applicable */ | 178 | /* Revert to MDIO fast mode, if applicable */ |
175 | if (retry_count) | 179 | if (retry_count) { |
180 | ret_val = phy->ops.acquire_phy(hw); | ||
181 | if (ret_val) | ||
182 | return ret_val; | ||
176 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); | 183 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); |
184 | phy->ops.release_phy(hw); | ||
185 | } | ||
177 | 186 | ||
178 | return ret_val; | 187 | return ret_val; |
179 | } | 188 | } |
@@ -354,94 +363,173 @@ s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data) | |||
354 | } | 363 | } |
355 | 364 | ||
356 | /** | 365 | /** |
357 | * e1000e_read_phy_reg_igp - Read igp PHY register | 366 | * __e1000e_read_phy_reg_igp - Read igp PHY register |
358 | * @hw: pointer to the HW structure | 367 | * @hw: pointer to the HW structure |
359 | * @offset: register offset to be read | 368 | * @offset: register offset to be read |
360 | * @data: pointer to the read data | 369 | * @data: pointer to the read data |
370 | * @locked: semaphore has already been acquired or not | ||
361 | * | 371 | * |
362 | * Acquires semaphore, if necessary, then reads the PHY register at offset | 372 | * Acquires semaphore, if necessary, then reads the PHY register at offset |
363 | * and storing the retrieved information in data. Release any acquired | 373 | * and stores the retrieved information in data. Release any acquired |
364 | * semaphores before exiting. | 374 | * semaphores before exiting. |
365 | **/ | 375 | **/ |
366 | s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) | 376 | static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data, |
377 | bool locked) | ||
367 | { | 378 | { |
368 | s32 ret_val; | 379 | s32 ret_val = 0; |
369 | 380 | ||
370 | ret_val = hw->phy.ops.acquire_phy(hw); | 381 | if (!locked) { |
371 | if (ret_val) | 382 | if (!(hw->phy.ops.acquire_phy)) |
372 | return ret_val; | 383 | goto out; |
384 | |||
385 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
386 | if (ret_val) | ||
387 | goto out; | ||
388 | } | ||
373 | 389 | ||
374 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | 390 | if (offset > MAX_PHY_MULTI_PAGE_REG) { |
375 | ret_val = e1000e_write_phy_reg_mdic(hw, | 391 | ret_val = e1000e_write_phy_reg_mdic(hw, |
376 | IGP01E1000_PHY_PAGE_SELECT, | 392 | IGP01E1000_PHY_PAGE_SELECT, |
377 | (u16)offset); | 393 | (u16)offset); |
378 | if (ret_val) { | 394 | if (ret_val) |
379 | hw->phy.ops.release_phy(hw); | 395 | goto release; |
380 | return ret_val; | ||
381 | } | ||
382 | } | 396 | } |
383 | 397 | ||
384 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, | 398 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, |
385 | data); | 399 | data); |
386 | |||
387 | hw->phy.ops.release_phy(hw); | ||
388 | 400 | ||
401 | release: | ||
402 | if (!locked) | ||
403 | hw->phy.ops.release_phy(hw); | ||
404 | out: | ||
389 | return ret_val; | 405 | return ret_val; |
390 | } | 406 | } |
391 | 407 | ||
392 | /** | 408 | /** |
409 | * e1000e_read_phy_reg_igp - Read igp PHY register | ||
410 | * @hw: pointer to the HW structure | ||
411 | * @offset: register offset to be read | ||
412 | * @data: pointer to the read data | ||
413 | * | ||
414 | * Acquires semaphore then reads the PHY register at offset and stores the | ||
415 | * retrieved information in data. | ||
416 | * Release the acquired semaphore before exiting. | ||
417 | **/ | ||
418 | s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) | ||
419 | { | ||
420 | return __e1000e_read_phy_reg_igp(hw, offset, data, false); | ||
421 | } | ||
422 | |||
423 | /** | ||
424 | * e1000e_read_phy_reg_igp_locked - Read igp PHY register | ||
425 | * @hw: pointer to the HW structure | ||
426 | * @offset: register offset to be read | ||
427 | * @data: pointer to the read data | ||
428 | * | ||
429 | * Reads the PHY register at offset and stores the retrieved information | ||
430 | * in data. Assumes semaphore already acquired. | ||
431 | **/ | ||
432 | s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data) | ||
433 | { | ||
434 | return __e1000e_read_phy_reg_igp(hw, offset, data, true); | ||
435 | } | ||
436 | |||
437 | /** | ||
393 | * e1000e_write_phy_reg_igp - Write igp PHY register | 438 | * e1000e_write_phy_reg_igp - Write igp PHY register |
394 | * @hw: pointer to the HW structure | 439 | * @hw: pointer to the HW structure |
395 | * @offset: register offset to write to | 440 | * @offset: register offset to write to |
396 | * @data: data to write at register offset | 441 | * @data: data to write at register offset |
442 | * @locked: semaphore has already been acquired or not | ||
397 | * | 443 | * |
398 | * Acquires semaphore, if necessary, then writes the data to PHY register | 444 | * Acquires semaphore, if necessary, then writes the data to PHY register |
399 | * at the offset. Release any acquired semaphores before exiting. | 445 | * at the offset. Release any acquired semaphores before exiting. |
400 | **/ | 446 | **/ |
401 | s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) | 447 | static s32 __e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data, |
448 | bool locked) | ||
402 | { | 449 | { |
403 | s32 ret_val; | 450 | s32 ret_val = 0; |
404 | 451 | ||
405 | ret_val = hw->phy.ops.acquire_phy(hw); | 452 | if (!locked) { |
406 | if (ret_val) | 453 | if (!(hw->phy.ops.acquire_phy)) |
407 | return ret_val; | 454 | goto out; |
455 | |||
456 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
457 | if (ret_val) | ||
458 | goto out; | ||
459 | } | ||
408 | 460 | ||
409 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | 461 | if (offset > MAX_PHY_MULTI_PAGE_REG) { |
410 | ret_val = e1000e_write_phy_reg_mdic(hw, | 462 | ret_val = e1000e_write_phy_reg_mdic(hw, |
411 | IGP01E1000_PHY_PAGE_SELECT, | 463 | IGP01E1000_PHY_PAGE_SELECT, |
412 | (u16)offset); | 464 | (u16)offset); |
413 | if (ret_val) { | 465 | if (ret_val) |
414 | hw->phy.ops.release_phy(hw); | 466 | goto release; |
415 | return ret_val; | ||
416 | } | ||
417 | } | 467 | } |
418 | 468 | ||
419 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, | 469 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, |
420 | data); | 470 | data); |
421 | 471 | ||
422 | hw->phy.ops.release_phy(hw); | 472 | release: |
473 | if (!locked) | ||
474 | hw->phy.ops.release_phy(hw); | ||
423 | 475 | ||
476 | out: | ||
424 | return ret_val; | 477 | return ret_val; |
425 | } | 478 | } |
426 | 479 | ||
427 | /** | 480 | /** |
428 | * e1000e_read_kmrn_reg - Read kumeran register | 481 | * e1000e_write_phy_reg_igp - Write igp PHY register |
482 | * @hw: pointer to the HW structure | ||
483 | * @offset: register offset to write to | ||
484 | * @data: data to write at register offset | ||
485 | * | ||
486 | * Acquires semaphore then writes the data to PHY register | ||
487 | * at the offset. Release any acquired semaphores before exiting. | ||
488 | **/ | ||
489 | s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) | ||
490 | { | ||
491 | return __e1000e_write_phy_reg_igp(hw, offset, data, false); | ||
492 | } | ||
493 | |||
494 | /** | ||
495 | * e1000e_write_phy_reg_igp_locked - Write igp PHY register | ||
496 | * @hw: pointer to the HW structure | ||
497 | * @offset: register offset to write to | ||
498 | * @data: data to write at register offset | ||
499 | * | ||
500 | * Writes the data to PHY register at the offset. | ||
501 | * Assumes semaphore already acquired. | ||
502 | **/ | ||
503 | s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data) | ||
504 | { | ||
505 | return __e1000e_write_phy_reg_igp(hw, offset, data, true); | ||
506 | } | ||
507 | |||
508 | /** | ||
509 | * __e1000_read_kmrn_reg - Read kumeran register | ||
429 | * @hw: pointer to the HW structure | 510 | * @hw: pointer to the HW structure |
430 | * @offset: register offset to be read | 511 | * @offset: register offset to be read |
431 | * @data: pointer to the read data | 512 | * @data: pointer to the read data |
513 | * @locked: semaphore has already been acquired or not | ||
432 | * | 514 | * |
433 | * Acquires semaphore, if necessary. Then reads the PHY register at offset | 515 | * Acquires semaphore, if necessary. Then reads the PHY register at offset |
434 | * using the kumeran interface. The information retrieved is stored in data. | 516 | * using the kumeran interface. The information retrieved is stored in data. |
435 | * Release any acquired semaphores before exiting. | 517 | * Release any acquired semaphores before exiting. |
436 | **/ | 518 | **/ |
437 | s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) | 519 | static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data, |
520 | bool locked) | ||
438 | { | 521 | { |
439 | u32 kmrnctrlsta; | 522 | u32 kmrnctrlsta; |
440 | s32 ret_val; | 523 | s32 ret_val = 0; |
441 | 524 | ||
442 | ret_val = hw->phy.ops.acquire_phy(hw); | 525 | if (!locked) { |
443 | if (ret_val) | 526 | if (!(hw->phy.ops.acquire_phy)) |
444 | return ret_val; | 527 | goto out; |
528 | |||
529 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
530 | if (ret_val) | ||
531 | goto out; | ||
532 | } | ||
445 | 533 | ||
446 | kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & | 534 | kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & |
447 | E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; | 535 | E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; |
@@ -452,41 +540,111 @@ s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) | |||
452 | kmrnctrlsta = er32(KMRNCTRLSTA); | 540 | kmrnctrlsta = er32(KMRNCTRLSTA); |
453 | *data = (u16)kmrnctrlsta; | 541 | *data = (u16)kmrnctrlsta; |
454 | 542 | ||
455 | hw->phy.ops.release_phy(hw); | 543 | if (!locked) |
544 | hw->phy.ops.release_phy(hw); | ||
456 | 545 | ||
546 | out: | ||
457 | return ret_val; | 547 | return ret_val; |
458 | } | 548 | } |
459 | 549 | ||
460 | /** | 550 | /** |
461 | * e1000e_write_kmrn_reg - Write kumeran register | 551 | * e1000e_read_kmrn_reg - Read kumeran register |
552 | * @hw: pointer to the HW structure | ||
553 | * @offset: register offset to be read | ||
554 | * @data: pointer to the read data | ||
555 | * | ||
556 | * Acquires semaphore then reads the PHY register at offset using the | ||
557 | * kumeran interface. The information retrieved is stored in data. | ||
558 | * Release the acquired semaphore before exiting. | ||
559 | **/ | ||
560 | s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) | ||
561 | { | ||
562 | return __e1000_read_kmrn_reg(hw, offset, data, false); | ||
563 | } | ||
564 | |||
565 | /** | ||
566 | * e1000_read_kmrn_reg_locked - Read kumeran register | ||
567 | * @hw: pointer to the HW structure | ||
568 | * @offset: register offset to be read | ||
569 | * @data: pointer to the read data | ||
570 | * | ||
571 | * Reads the PHY register at offset using the kumeran interface. The | ||
572 | * information retrieved is stored in data. | ||
573 | * Assumes semaphore already acquired. | ||
574 | **/ | ||
575 | s32 e1000_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data) | ||
576 | { | ||
577 | return __e1000_read_kmrn_reg(hw, offset, data, true); | ||
578 | } | ||
579 | |||
580 | /** | ||
581 | * __e1000_write_kmrn_reg - Write kumeran register | ||
462 | * @hw: pointer to the HW structure | 582 | * @hw: pointer to the HW structure |
463 | * @offset: register offset to write to | 583 | * @offset: register offset to write to |
464 | * @data: data to write at register offset | 584 | * @data: data to write at register offset |
585 | * @locked: semaphore has already been acquired or not | ||
465 | * | 586 | * |
466 | * Acquires semaphore, if necessary. Then write the data to PHY register | 587 | * Acquires semaphore, if necessary. Then write the data to PHY register |
467 | * at the offset using the kumeran interface. Release any acquired semaphores | 588 | * at the offset using the kumeran interface. Release any acquired semaphores |
468 | * before exiting. | 589 | * before exiting. |
469 | **/ | 590 | **/ |
470 | s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) | 591 | static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data, |
592 | bool locked) | ||
471 | { | 593 | { |
472 | u32 kmrnctrlsta; | 594 | u32 kmrnctrlsta; |
473 | s32 ret_val; | 595 | s32 ret_val = 0; |
474 | 596 | ||
475 | ret_val = hw->phy.ops.acquire_phy(hw); | 597 | if (!locked) { |
476 | if (ret_val) | 598 | if (!(hw->phy.ops.acquire_phy)) |
477 | return ret_val; | 599 | goto out; |
600 | |||
601 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
602 | if (ret_val) | ||
603 | goto out; | ||
604 | } | ||
478 | 605 | ||
479 | kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & | 606 | kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & |
480 | E1000_KMRNCTRLSTA_OFFSET) | data; | 607 | E1000_KMRNCTRLSTA_OFFSET) | data; |
481 | ew32(KMRNCTRLSTA, kmrnctrlsta); | 608 | ew32(KMRNCTRLSTA, kmrnctrlsta); |
482 | 609 | ||
483 | udelay(2); | 610 | udelay(2); |
484 | hw->phy.ops.release_phy(hw); | ||
485 | 611 | ||
612 | if (!locked) | ||
613 | hw->phy.ops.release_phy(hw); | ||
614 | |||
615 | out: | ||
486 | return ret_val; | 616 | return ret_val; |
487 | } | 617 | } |
488 | 618 | ||
489 | /** | 619 | /** |
620 | * e1000e_write_kmrn_reg - Write kumeran register | ||
621 | * @hw: pointer to the HW structure | ||
622 | * @offset: register offset to write to | ||
623 | * @data: data to write at register offset | ||
624 | * | ||
625 | * Acquires semaphore then writes the data to the PHY register at the offset | ||
626 | * using the kumeran interface. Release the acquired semaphore before exiting. | ||
627 | **/ | ||
628 | s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) | ||
629 | { | ||
630 | return __e1000_write_kmrn_reg(hw, offset, data, false); | ||
631 | } | ||
632 | |||
633 | /** | ||
634 | * e1000_write_kmrn_reg_locked - Write kumeran register | ||
635 | * @hw: pointer to the HW structure | ||
636 | * @offset: register offset to write to | ||
637 | * @data: data to write at register offset | ||
638 | * | ||
639 | * Write the data to PHY register at the offset using the kumeran interface. | ||
640 | * Assumes semaphore already acquired. | ||
641 | **/ | ||
642 | s32 e1000_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data) | ||
643 | { | ||
644 | return __e1000_write_kmrn_reg(hw, offset, data, true); | ||
645 | } | ||
646 | |||
647 | /** | ||
490 | * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link | 648 | * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link |
491 | * @hw: pointer to the HW structure | 649 | * @hw: pointer to the HW structure |
492 | * | 650 | * |
@@ -2105,6 +2263,10 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) | |||
2105 | u32 page = offset >> IGP_PAGE_SHIFT; | 2263 | u32 page = offset >> IGP_PAGE_SHIFT; |
2106 | u32 page_shift = 0; | 2264 | u32 page_shift = 0; |
2107 | 2265 | ||
2266 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2267 | if (ret_val) | ||
2268 | return ret_val; | ||
2269 | |||
2108 | /* Page 800 works differently than the rest so it has its own func */ | 2270 | /* Page 800 works differently than the rest so it has its own func */ |
2109 | if (page == BM_WUC_PAGE) { | 2271 | if (page == BM_WUC_PAGE) { |
2110 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, | 2272 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, |
@@ -2112,10 +2274,6 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) | |||
2112 | goto out; | 2274 | goto out; |
2113 | } | 2275 | } |
2114 | 2276 | ||
2115 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2116 | if (ret_val) | ||
2117 | goto out; | ||
2118 | |||
2119 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); | 2277 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); |
2120 | 2278 | ||
2121 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | 2279 | if (offset > MAX_PHY_MULTI_PAGE_REG) { |
@@ -2135,18 +2293,15 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) | |||
2135 | /* Page is shifted left, PHY expects (page x 32) */ | 2293 | /* Page is shifted left, PHY expects (page x 32) */ |
2136 | ret_val = e1000e_write_phy_reg_mdic(hw, page_select, | 2294 | ret_val = e1000e_write_phy_reg_mdic(hw, page_select, |
2137 | (page << page_shift)); | 2295 | (page << page_shift)); |
2138 | if (ret_val) { | 2296 | if (ret_val) |
2139 | hw->phy.ops.release_phy(hw); | ||
2140 | goto out; | 2297 | goto out; |
2141 | } | ||
2142 | } | 2298 | } |
2143 | 2299 | ||
2144 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, | 2300 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, |
2145 | data); | 2301 | data); |
2146 | 2302 | ||
2147 | hw->phy.ops.release_phy(hw); | ||
2148 | |||
2149 | out: | 2303 | out: |
2304 | hw->phy.ops.release_phy(hw); | ||
2150 | return ret_val; | 2305 | return ret_val; |
2151 | } | 2306 | } |
2152 | 2307 | ||
@@ -2167,6 +2322,10 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) | |||
2167 | u32 page = offset >> IGP_PAGE_SHIFT; | 2322 | u32 page = offset >> IGP_PAGE_SHIFT; |
2168 | u32 page_shift = 0; | 2323 | u32 page_shift = 0; |
2169 | 2324 | ||
2325 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2326 | if (ret_val) | ||
2327 | return ret_val; | ||
2328 | |||
2170 | /* Page 800 works differently than the rest so it has its own func */ | 2329 | /* Page 800 works differently than the rest so it has its own func */ |
2171 | if (page == BM_WUC_PAGE) { | 2330 | if (page == BM_WUC_PAGE) { |
2172 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, | 2331 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, |
@@ -2174,10 +2333,6 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) | |||
2174 | goto out; | 2333 | goto out; |
2175 | } | 2334 | } |
2176 | 2335 | ||
2177 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2178 | if (ret_val) | ||
2179 | goto out; | ||
2180 | |||
2181 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); | 2336 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); |
2182 | 2337 | ||
2183 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | 2338 | if (offset > MAX_PHY_MULTI_PAGE_REG) { |
@@ -2197,17 +2352,14 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) | |||
2197 | /* Page is shifted left, PHY expects (page x 32) */ | 2352 | /* Page is shifted left, PHY expects (page x 32) */ |
2198 | ret_val = e1000e_write_phy_reg_mdic(hw, page_select, | 2353 | ret_val = e1000e_write_phy_reg_mdic(hw, page_select, |
2199 | (page << page_shift)); | 2354 | (page << page_shift)); |
2200 | if (ret_val) { | 2355 | if (ret_val) |
2201 | hw->phy.ops.release_phy(hw); | ||
2202 | goto out; | 2356 | goto out; |
2203 | } | ||
2204 | } | 2357 | } |
2205 | 2358 | ||
2206 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, | 2359 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, |
2207 | data); | 2360 | data); |
2208 | hw->phy.ops.release_phy(hw); | ||
2209 | |||
2210 | out: | 2361 | out: |
2362 | hw->phy.ops.release_phy(hw); | ||
2211 | return ret_val; | 2363 | return ret_val; |
2212 | } | 2364 | } |
2213 | 2365 | ||
@@ -2226,17 +2378,17 @@ s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) | |||
2226 | s32 ret_val; | 2378 | s32 ret_val; |
2227 | u16 page = (u16)(offset >> IGP_PAGE_SHIFT); | 2379 | u16 page = (u16)(offset >> IGP_PAGE_SHIFT); |
2228 | 2380 | ||
2381 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2382 | if (ret_val) | ||
2383 | return ret_val; | ||
2384 | |||
2229 | /* Page 800 works differently than the rest so it has its own func */ | 2385 | /* Page 800 works differently than the rest so it has its own func */ |
2230 | if (page == BM_WUC_PAGE) { | 2386 | if (page == BM_WUC_PAGE) { |
2231 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, | 2387 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, |
2232 | true); | 2388 | true); |
2233 | return ret_val; | 2389 | goto out; |
2234 | } | 2390 | } |
2235 | 2391 | ||
2236 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2237 | if (ret_val) | ||
2238 | return ret_val; | ||
2239 | |||
2240 | hw->phy.addr = 1; | 2392 | hw->phy.addr = 1; |
2241 | 2393 | ||
2242 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | 2394 | if (offset > MAX_PHY_MULTI_PAGE_REG) { |
@@ -2245,16 +2397,14 @@ s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) | |||
2245 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, | 2397 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, |
2246 | page); | 2398 | page); |
2247 | 2399 | ||
2248 | if (ret_val) { | 2400 | if (ret_val) |
2249 | hw->phy.ops.release_phy(hw); | 2401 | goto out; |
2250 | return ret_val; | ||
2251 | } | ||
2252 | } | 2402 | } |
2253 | 2403 | ||
2254 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, | 2404 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, |
2255 | data); | 2405 | data); |
2406 | out: | ||
2256 | hw->phy.ops.release_phy(hw); | 2407 | hw->phy.ops.release_phy(hw); |
2257 | |||
2258 | return ret_val; | 2408 | return ret_val; |
2259 | } | 2409 | } |
2260 | 2410 | ||
@@ -2272,17 +2422,17 @@ s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) | |||
2272 | s32 ret_val; | 2422 | s32 ret_val; |
2273 | u16 page = (u16)(offset >> IGP_PAGE_SHIFT); | 2423 | u16 page = (u16)(offset >> IGP_PAGE_SHIFT); |
2274 | 2424 | ||
2425 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2426 | if (ret_val) | ||
2427 | return ret_val; | ||
2428 | |||
2275 | /* Page 800 works differently than the rest so it has its own func */ | 2429 | /* Page 800 works differently than the rest so it has its own func */ |
2276 | if (page == BM_WUC_PAGE) { | 2430 | if (page == BM_WUC_PAGE) { |
2277 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, | 2431 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, |
2278 | false); | 2432 | false); |
2279 | return ret_val; | 2433 | goto out; |
2280 | } | 2434 | } |
2281 | 2435 | ||
2282 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2283 | if (ret_val) | ||
2284 | return ret_val; | ||
2285 | |||
2286 | hw->phy.addr = 1; | 2436 | hw->phy.addr = 1; |
2287 | 2437 | ||
2288 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | 2438 | if (offset > MAX_PHY_MULTI_PAGE_REG) { |
@@ -2290,17 +2440,15 @@ s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) | |||
2290 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, | 2440 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, |
2291 | page); | 2441 | page); |
2292 | 2442 | ||
2293 | if (ret_val) { | 2443 | if (ret_val) |
2294 | hw->phy.ops.release_phy(hw); | 2444 | goto out; |
2295 | return ret_val; | ||
2296 | } | ||
2297 | } | 2445 | } |
2298 | 2446 | ||
2299 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, | 2447 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, |
2300 | data); | 2448 | data); |
2301 | 2449 | ||
2450 | out: | ||
2302 | hw->phy.ops.release_phy(hw); | 2451 | hw->phy.ops.release_phy(hw); |
2303 | |||
2304 | return ret_val; | 2452 | return ret_val; |
2305 | } | 2453 | } |
2306 | 2454 | ||
@@ -2320,6 +2468,8 @@ s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) | |||
2320 | * 3) Write the address using the address opcode (0x11) | 2468 | * 3) Write the address using the address opcode (0x11) |
2321 | * 4) Read or write the data using the data opcode (0x12) | 2469 | * 4) Read or write the data using the data opcode (0x12) |
2322 | * 5) Restore 769_17.2 to its original value | 2470 | * 5) Restore 769_17.2 to its original value |
2471 | * | ||
2472 | * Assumes semaphore already acquired. | ||
2323 | **/ | 2473 | **/ |
2324 | static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, | 2474 | static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, |
2325 | u16 *data, bool read) | 2475 | u16 *data, bool read) |
@@ -2327,20 +2477,12 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, | |||
2327 | s32 ret_val; | 2477 | s32 ret_val; |
2328 | u16 reg = BM_PHY_REG_NUM(offset); | 2478 | u16 reg = BM_PHY_REG_NUM(offset); |
2329 | u16 phy_reg = 0; | 2479 | u16 phy_reg = 0; |
2330 | u8 phy_acquired = 1; | ||
2331 | |||
2332 | 2480 | ||
2333 | /* Gig must be disabled for MDIO accesses to page 800 */ | 2481 | /* Gig must be disabled for MDIO accesses to page 800 */ |
2334 | if ((hw->mac.type == e1000_pchlan) && | 2482 | if ((hw->mac.type == e1000_pchlan) && |
2335 | (!(er32(PHY_CTRL) & E1000_PHY_CTRL_GBE_DISABLE))) | 2483 | (!(er32(PHY_CTRL) & E1000_PHY_CTRL_GBE_DISABLE))) |
2336 | hw_dbg(hw, "Attempting to access page 800 while gig enabled\n"); | 2484 | hw_dbg(hw, "Attempting to access page 800 while gig enabled\n"); |
2337 | 2485 | ||
2338 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2339 | if (ret_val) { | ||
2340 | phy_acquired = 0; | ||
2341 | goto out; | ||
2342 | } | ||
2343 | |||
2344 | /* All operations in this function are phy address 1 */ | 2486 | /* All operations in this function are phy address 1 */ |
2345 | hw->phy.addr = 1; | 2487 | hw->phy.addr = 1; |
2346 | 2488 | ||
@@ -2397,8 +2539,6 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, | |||
2397 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); | 2539 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); |
2398 | 2540 | ||
2399 | out: | 2541 | out: |
2400 | if (phy_acquired == 1) | ||
2401 | hw->phy.ops.release_phy(hw); | ||
2402 | return ret_val; | 2542 | return ret_val; |
2403 | } | 2543 | } |
2404 | 2544 | ||
@@ -2439,52 +2579,63 @@ static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) | |||
2439 | return 0; | 2579 | return 0; |
2440 | } | 2580 | } |
2441 | 2581 | ||
2582 | /** | ||
2583 | * e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode | ||
2584 | * @hw: pointer to the HW structure | ||
2585 | * @slow: true for slow mode, false for normal mode | ||
2586 | * | ||
2587 | * Assumes semaphore already acquired. | ||
2588 | **/ | ||
2442 | s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow) | 2589 | s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow) |
2443 | { | 2590 | { |
2444 | s32 ret_val = 0; | 2591 | s32 ret_val = 0; |
2445 | u16 data = 0; | 2592 | u16 data = 0; |
2446 | 2593 | ||
2447 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2448 | if (ret_val) | ||
2449 | return ret_val; | ||
2450 | |||
2451 | /* Set MDIO mode - page 769, register 16: 0x2580==slow, 0x2180==fast */ | 2594 | /* Set MDIO mode - page 769, register 16: 0x2580==slow, 0x2180==fast */ |
2452 | hw->phy.addr = 1; | 2595 | hw->phy.addr = 1; |
2453 | ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, | 2596 | ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, |
2454 | (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); | 2597 | (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); |
2455 | if (ret_val) { | 2598 | if (ret_val) |
2456 | hw->phy.ops.release_phy(hw); | 2599 | goto out; |
2457 | return ret_val; | 2600 | |
2458 | } | ||
2459 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_CS_CTRL1, | 2601 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_CS_CTRL1, |
2460 | (0x2180 | (slow << 10))); | 2602 | (0x2180 | (slow << 10))); |
2603 | if (ret_val) | ||
2604 | goto out; | ||
2461 | 2605 | ||
2462 | /* dummy read when reverting to fast mode - throw away result */ | 2606 | /* dummy read when reverting to fast mode - throw away result */ |
2463 | if (!slow) | 2607 | if (!slow) |
2464 | e1000e_read_phy_reg_mdic(hw, BM_CS_CTRL1, &data); | 2608 | ret_val = e1000e_read_phy_reg_mdic(hw, BM_CS_CTRL1, &data); |
2465 | |||
2466 | hw->phy.ops.release_phy(hw); | ||
2467 | 2609 | ||
2610 | out: | ||
2468 | return ret_val; | 2611 | return ret_val; |
2469 | } | 2612 | } |
2470 | 2613 | ||
2471 | /** | 2614 | /** |
2472 | * e1000_read_phy_reg_hv - Read HV PHY register | 2615 | * __e1000_read_phy_reg_hv - Read HV PHY register |
2473 | * @hw: pointer to the HW structure | 2616 | * @hw: pointer to the HW structure |
2474 | * @offset: register offset to be read | 2617 | * @offset: register offset to be read |
2475 | * @data: pointer to the read data | 2618 | * @data: pointer to the read data |
2619 | * @locked: semaphore has already been acquired or not | ||
2476 | * | 2620 | * |
2477 | * Acquires semaphore, if necessary, then reads the PHY register at offset | 2621 | * Acquires semaphore, if necessary, then reads the PHY register at offset |
2478 | * and storing the retrieved information in data. Release any acquired | 2622 | * and stores the retrieved information in data. Release any acquired |
2479 | * semaphore before exiting. | 2623 | * semaphore before exiting. |
2480 | **/ | 2624 | **/ |
2481 | s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) | 2625 | static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, |
2626 | bool locked) | ||
2482 | { | 2627 | { |
2483 | s32 ret_val; | 2628 | s32 ret_val; |
2484 | u16 page = BM_PHY_REG_PAGE(offset); | 2629 | u16 page = BM_PHY_REG_PAGE(offset); |
2485 | u16 reg = BM_PHY_REG_NUM(offset); | 2630 | u16 reg = BM_PHY_REG_NUM(offset); |
2486 | bool in_slow_mode = false; | 2631 | bool in_slow_mode = false; |
2487 | 2632 | ||
2633 | if (!locked) { | ||
2634 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2635 | if (ret_val) | ||
2636 | return ret_val; | ||
2637 | } | ||
2638 | |||
2488 | /* Workaround failure in MDIO access while cable is disconnected */ | 2639 | /* Workaround failure in MDIO access while cable is disconnected */ |
2489 | if ((hw->phy.type == e1000_phy_82577) && | 2640 | if ((hw->phy.type == e1000_phy_82577) && |
2490 | !(er32(STATUS) & E1000_STATUS_LU)) { | 2641 | !(er32(STATUS) & E1000_STATUS_LU)) { |
@@ -2508,10 +2659,6 @@ s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) | |||
2508 | goto out; | 2659 | goto out; |
2509 | } | 2660 | } |
2510 | 2661 | ||
2511 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2512 | if (ret_val) | ||
2513 | goto out; | ||
2514 | |||
2515 | hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); | 2662 | hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); |
2516 | 2663 | ||
2517 | if (page == HV_INTC_FC_PAGE_START) | 2664 | if (page == HV_INTC_FC_PAGE_START) |
@@ -2529,42 +2676,76 @@ s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) | |||
2529 | ret_val = e1000e_write_phy_reg_mdic(hw, | 2676 | ret_val = e1000e_write_phy_reg_mdic(hw, |
2530 | IGP01E1000_PHY_PAGE_SELECT, | 2677 | IGP01E1000_PHY_PAGE_SELECT, |
2531 | (page << IGP_PAGE_SHIFT)); | 2678 | (page << IGP_PAGE_SHIFT)); |
2532 | if (ret_val) { | ||
2533 | hw->phy.ops.release_phy(hw); | ||
2534 | goto out; | ||
2535 | } | ||
2536 | hw->phy.addr = phy_addr; | 2679 | hw->phy.addr = phy_addr; |
2537 | } | 2680 | } |
2538 | } | 2681 | } |
2539 | 2682 | ||
2540 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, | 2683 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, |
2541 | data); | 2684 | data); |
2542 | hw->phy.ops.release_phy(hw); | ||
2543 | |||
2544 | out: | 2685 | out: |
2545 | /* Revert to MDIO fast mode, if applicable */ | 2686 | /* Revert to MDIO fast mode, if applicable */ |
2546 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) | 2687 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) |
2547 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); | 2688 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); |
2548 | 2689 | ||
2690 | if (!locked) | ||
2691 | hw->phy.ops.release_phy(hw); | ||
2692 | |||
2549 | return ret_val; | 2693 | return ret_val; |
2550 | } | 2694 | } |
2551 | 2695 | ||
2552 | /** | 2696 | /** |
2553 | * e1000_write_phy_reg_hv - Write HV PHY register | 2697 | * e1000_read_phy_reg_hv - Read HV PHY register |
2698 | * @hw: pointer to the HW structure | ||
2699 | * @offset: register offset to be read | ||
2700 | * @data: pointer to the read data | ||
2701 | * | ||
2702 | * Acquires semaphore then reads the PHY register at offset and stores | ||
2703 | * the retrieved information in data. Release the acquired semaphore | ||
2704 | * before exiting. | ||
2705 | **/ | ||
2706 | s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) | ||
2707 | { | ||
2708 | return __e1000_read_phy_reg_hv(hw, offset, data, false); | ||
2709 | } | ||
2710 | |||
2711 | /** | ||
2712 | * e1000_read_phy_reg_hv_locked - Read HV PHY register | ||
2713 | * @hw: pointer to the HW structure | ||
2714 | * @offset: register offset to be read | ||
2715 | * @data: pointer to the read data | ||
2716 | * | ||
2717 | * Reads the PHY register at offset and stores the retrieved information | ||
2718 | * in data. Assumes semaphore already acquired. | ||
2719 | **/ | ||
2720 | s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) | ||
2721 | { | ||
2722 | return __e1000_read_phy_reg_hv(hw, offset, data, true); | ||
2723 | } | ||
2724 | |||
2725 | /** | ||
2726 | * __e1000_write_phy_reg_hv - Write HV PHY register | ||
2554 | * @hw: pointer to the HW structure | 2727 | * @hw: pointer to the HW structure |
2555 | * @offset: register offset to write to | 2728 | * @offset: register offset to write to |
2556 | * @data: data to write at register offset | 2729 | * @data: data to write at register offset |
2730 | * @locked: semaphore has already been acquired or not | ||
2557 | * | 2731 | * |
2558 | * Acquires semaphore, if necessary, then writes the data to PHY register | 2732 | * Acquires semaphore, if necessary, then writes the data to PHY register |
2559 | * at the offset. Release any acquired semaphores before exiting. | 2733 | * at the offset. Release any acquired semaphores before exiting. |
2560 | **/ | 2734 | **/ |
2561 | s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) | 2735 | static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, |
2736 | bool locked) | ||
2562 | { | 2737 | { |
2563 | s32 ret_val; | 2738 | s32 ret_val; |
2564 | u16 page = BM_PHY_REG_PAGE(offset); | 2739 | u16 page = BM_PHY_REG_PAGE(offset); |
2565 | u16 reg = BM_PHY_REG_NUM(offset); | 2740 | u16 reg = BM_PHY_REG_NUM(offset); |
2566 | bool in_slow_mode = false; | 2741 | bool in_slow_mode = false; |
2567 | 2742 | ||
2743 | if (!locked) { | ||
2744 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2745 | if (ret_val) | ||
2746 | return ret_val; | ||
2747 | } | ||
2748 | |||
2568 | /* Workaround failure in MDIO access while cable is disconnected */ | 2749 | /* Workaround failure in MDIO access while cable is disconnected */ |
2569 | if ((hw->phy.type == e1000_phy_82577) && | 2750 | if ((hw->phy.type == e1000_phy_82577) && |
2570 | !(er32(STATUS) & E1000_STATUS_LU)) { | 2751 | !(er32(STATUS) & E1000_STATUS_LU)) { |
@@ -2588,10 +2769,6 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) | |||
2588 | goto out; | 2769 | goto out; |
2589 | } | 2770 | } |
2590 | 2771 | ||
2591 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2592 | if (ret_val) | ||
2593 | goto out; | ||
2594 | |||
2595 | hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); | 2772 | hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); |
2596 | 2773 | ||
2597 | if (page == HV_INTC_FC_PAGE_START) | 2774 | if (page == HV_INTC_FC_PAGE_START) |
@@ -2607,15 +2784,10 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) | |||
2607 | ((MAX_PHY_REG_ADDRESS & reg) == 0) && | 2784 | ((MAX_PHY_REG_ADDRESS & reg) == 0) && |
2608 | (data & (1 << 11))) { | 2785 | (data & (1 << 11))) { |
2609 | u16 data2 = 0x7EFF; | 2786 | u16 data2 = 0x7EFF; |
2610 | hw->phy.ops.release_phy(hw); | ||
2611 | ret_val = e1000_access_phy_debug_regs_hv(hw, (1 << 6) | 0x3, | 2787 | ret_val = e1000_access_phy_debug_regs_hv(hw, (1 << 6) | 0x3, |
2612 | &data2, false); | 2788 | &data2, false); |
2613 | if (ret_val) | 2789 | if (ret_val) |
2614 | goto out; | 2790 | goto out; |
2615 | |||
2616 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2617 | if (ret_val) | ||
2618 | goto out; | ||
2619 | } | 2791 | } |
2620 | 2792 | ||
2621 | if (reg > MAX_PHY_MULTI_PAGE_REG) { | 2793 | if (reg > MAX_PHY_MULTI_PAGE_REG) { |
@@ -2630,27 +2802,53 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) | |||
2630 | ret_val = e1000e_write_phy_reg_mdic(hw, | 2802 | ret_val = e1000e_write_phy_reg_mdic(hw, |
2631 | IGP01E1000_PHY_PAGE_SELECT, | 2803 | IGP01E1000_PHY_PAGE_SELECT, |
2632 | (page << IGP_PAGE_SHIFT)); | 2804 | (page << IGP_PAGE_SHIFT)); |
2633 | if (ret_val) { | ||
2634 | hw->phy.ops.release_phy(hw); | ||
2635 | goto out; | ||
2636 | } | ||
2637 | hw->phy.addr = phy_addr; | 2805 | hw->phy.addr = phy_addr; |
2638 | } | 2806 | } |
2639 | } | 2807 | } |
2640 | 2808 | ||
2641 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, | 2809 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, |
2642 | data); | 2810 | data); |
2643 | hw->phy.ops.release_phy(hw); | ||
2644 | 2811 | ||
2645 | out: | 2812 | out: |
2646 | /* Revert to MDIO fast mode, if applicable */ | 2813 | /* Revert to MDIO fast mode, if applicable */ |
2647 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) | 2814 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) |
2648 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); | 2815 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); |
2649 | 2816 | ||
2817 | if (!locked) | ||
2818 | hw->phy.ops.release_phy(hw); | ||
2819 | |||
2650 | return ret_val; | 2820 | return ret_val; |
2651 | } | 2821 | } |
2652 | 2822 | ||
2653 | /** | 2823 | /** |
2824 | * e1000_write_phy_reg_hv - Write HV PHY register | ||
2825 | * @hw: pointer to the HW structure | ||
2826 | * @offset: register offset to write to | ||
2827 | * @data: data to write at register offset | ||
2828 | * | ||
2829 | * Acquires semaphore then writes the data to PHY register at the offset. | ||
2830 | * Release the acquired semaphores before exiting. | ||
2831 | **/ | ||
2832 | s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) | ||
2833 | { | ||
2834 | return __e1000_write_phy_reg_hv(hw, offset, data, false); | ||
2835 | } | ||
2836 | |||
2837 | /** | ||
2838 | * e1000_write_phy_reg_hv_locked - Write HV PHY register | ||
2839 | * @hw: pointer to the HW structure | ||
2840 | * @offset: register offset to write to | ||
2841 | * @data: data to write at register offset | ||
2842 | * | ||
2843 | * Writes the data to PHY register at the offset. Assumes semaphore | ||
2844 | * already acquired. | ||
2845 | **/ | ||
2846 | s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data) | ||
2847 | { | ||
2848 | return __e1000_write_phy_reg_hv(hw, offset, data, true); | ||
2849 | } | ||
2850 | |||
2851 | /** | ||
2654 | * e1000_get_phy_addr_for_hv_page - Get PHY adrress based on page | 2852 | * e1000_get_phy_addr_for_hv_page - Get PHY adrress based on page |
2655 | * @page: page to be accessed | 2853 | * @page: page to be accessed |
2656 | **/ | 2854 | **/ |
@@ -2671,10 +2869,9 @@ static u32 e1000_get_phy_addr_for_hv_page(u32 page) | |||
2671 | * @data: pointer to the data to be read or written | 2869 | * @data: pointer to the data to be read or written |
2672 | * @read: determines if operation is read or written | 2870 | * @read: determines if operation is read or written |
2673 | * | 2871 | * |
2674 | * Acquires semaphore, if necessary, then reads the PHY register at offset | 2872 | * Reads the PHY register at offset and stores the retreived information |
2675 | * and storing the retreived information in data. Release any acquired | 2873 | * in data. Assumes semaphore already acquired. Note that the procedure |
2676 | * semaphores before exiting. Note that the procedure to read these regs | 2874 | * to read these regs uses the address port and data port to read/write. |
2677 | * uses the address port and data port to read/write. | ||
2678 | **/ | 2875 | **/ |
2679 | static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, | 2876 | static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, |
2680 | u16 *data, bool read) | 2877 | u16 *data, bool read) |
@@ -2682,20 +2879,12 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, | |||
2682 | s32 ret_val; | 2879 | s32 ret_val; |
2683 | u32 addr_reg = 0; | 2880 | u32 addr_reg = 0; |
2684 | u32 data_reg = 0; | 2881 | u32 data_reg = 0; |
2685 | u8 phy_acquired = 1; | ||
2686 | 2882 | ||
2687 | /* This takes care of the difference with desktop vs mobile phy */ | 2883 | /* This takes care of the difference with desktop vs mobile phy */ |
2688 | addr_reg = (hw->phy.type == e1000_phy_82578) ? | 2884 | addr_reg = (hw->phy.type == e1000_phy_82578) ? |
2689 | I82578_ADDR_REG : I82577_ADDR_REG; | 2885 | I82578_ADDR_REG : I82577_ADDR_REG; |
2690 | data_reg = addr_reg + 1; | 2886 | data_reg = addr_reg + 1; |
2691 | 2887 | ||
2692 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
2693 | if (ret_val) { | ||
2694 | hw_dbg(hw, "Could not acquire PHY\n"); | ||
2695 | phy_acquired = 0; | ||
2696 | goto out; | ||
2697 | } | ||
2698 | |||
2699 | /* All operations in this function are phy address 2 */ | 2888 | /* All operations in this function are phy address 2 */ |
2700 | hw->phy.addr = 2; | 2889 | hw->phy.addr = 2; |
2701 | 2890 | ||
@@ -2718,8 +2907,6 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, | |||
2718 | } | 2907 | } |
2719 | 2908 | ||
2720 | out: | 2909 | out: |
2721 | if (phy_acquired == 1) | ||
2722 | hw->phy.ops.release_phy(hw); | ||
2723 | return ret_val; | 2910 | return ret_val; |
2724 | } | 2911 | } |
2725 | 2912 | ||
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 801f088c134f..030913f8bd26 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -98,12 +98,13 @@ static void ri_tasklet(unsigned long dev) | |||
98 | stats->tx_packets++; | 98 | stats->tx_packets++; |
99 | stats->tx_bytes +=skb->len; | 99 | stats->tx_bytes +=skb->len; |
100 | 100 | ||
101 | skb->dev = __dev_get_by_index(&init_net, skb->iif); | 101 | skb->dev = dev_get_by_index(&init_net, skb->iif); |
102 | if (!skb->dev) { | 102 | if (!skb->dev) { |
103 | dev_kfree_skb(skb); | 103 | dev_kfree_skb(skb); |
104 | stats->tx_dropped++; | 104 | stats->tx_dropped++; |
105 | break; | 105 | break; |
106 | } | 106 | } |
107 | dev_put(skb->dev); | ||
107 | skb->iif = _dev->ifindex; | 108 | skb->iif = _dev->ifindex; |
108 | 109 | ||
109 | if (from & AT_EGRESS) { | 110 | if (from & AT_EGRESS) { |
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index deaea8fa1032..b243ed3b0c36 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
@@ -732,7 +732,7 @@ static int igb_set_ringparam(struct net_device *netdev, | |||
732 | { | 732 | { |
733 | struct igb_adapter *adapter = netdev_priv(netdev); | 733 | struct igb_adapter *adapter = netdev_priv(netdev); |
734 | struct igb_ring *temp_ring; | 734 | struct igb_ring *temp_ring; |
735 | int i, err; | 735 | int i, err = 0; |
736 | u32 new_rx_count, new_tx_count; | 736 | u32 new_rx_count, new_tx_count; |
737 | 737 | ||
738 | if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) | 738 | if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) |
@@ -752,18 +752,30 @@ static int igb_set_ringparam(struct net_device *netdev, | |||
752 | return 0; | 752 | return 0; |
753 | } | 753 | } |
754 | 754 | ||
755 | while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) | ||
756 | msleep(1); | ||
757 | |||
758 | if (!netif_running(adapter->netdev)) { | ||
759 | for (i = 0; i < adapter->num_tx_queues; i++) | ||
760 | adapter->tx_ring[i].count = new_tx_count; | ||
761 | for (i = 0; i < adapter->num_rx_queues; i++) | ||
762 | adapter->rx_ring[i].count = new_rx_count; | ||
763 | adapter->tx_ring_count = new_tx_count; | ||
764 | adapter->rx_ring_count = new_rx_count; | ||
765 | goto clear_reset; | ||
766 | } | ||
767 | |||
755 | if (adapter->num_tx_queues > adapter->num_rx_queues) | 768 | if (adapter->num_tx_queues > adapter->num_rx_queues) |
756 | temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring)); | 769 | temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring)); |
757 | else | 770 | else |
758 | temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring)); | 771 | temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring)); |
759 | if (!temp_ring) | ||
760 | return -ENOMEM; | ||
761 | 772 | ||
762 | while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) | 773 | if (!temp_ring) { |
763 | msleep(1); | 774 | err = -ENOMEM; |
775 | goto clear_reset; | ||
776 | } | ||
764 | 777 | ||
765 | if (netif_running(adapter->netdev)) | 778 | igb_down(adapter); |
766 | igb_down(adapter); | ||
767 | 779 | ||
768 | /* | 780 | /* |
769 | * We can't just free everything and then setup again, | 781 | * We can't just free everything and then setup again, |
@@ -820,14 +832,11 @@ static int igb_set_ringparam(struct net_device *netdev, | |||
820 | 832 | ||
821 | adapter->rx_ring_count = new_rx_count; | 833 | adapter->rx_ring_count = new_rx_count; |
822 | } | 834 | } |
823 | |||
824 | err = 0; | ||
825 | err_setup: | 835 | err_setup: |
826 | if (netif_running(adapter->netdev)) | 836 | igb_up(adapter); |
827 | igb_up(adapter); | ||
828 | |||
829 | clear_bit(__IGB_RESETTING, &adapter->state); | ||
830 | vfree(temp_ring); | 837 | vfree(temp_ring); |
838 | clear_reset: | ||
839 | clear_bit(__IGB_RESETTING, &adapter->state); | ||
831 | return err; | 840 | return err; |
832 | } | 841 | } |
833 | 842 | ||
diff --git a/drivers/net/igbvf/ethtool.c b/drivers/net/igbvf/ethtool.c index ee17a097d1ca..c68265bd0d1a 100644 --- a/drivers/net/igbvf/ethtool.c +++ b/drivers/net/igbvf/ethtool.c | |||
@@ -279,7 +279,7 @@ static int igbvf_set_ringparam(struct net_device *netdev, | |||
279 | { | 279 | { |
280 | struct igbvf_adapter *adapter = netdev_priv(netdev); | 280 | struct igbvf_adapter *adapter = netdev_priv(netdev); |
281 | struct igbvf_ring *temp_ring; | 281 | struct igbvf_ring *temp_ring; |
282 | int err; | 282 | int err = 0; |
283 | u32 new_rx_count, new_tx_count; | 283 | u32 new_rx_count, new_tx_count; |
284 | 284 | ||
285 | if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) | 285 | if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) |
@@ -299,15 +299,22 @@ static int igbvf_set_ringparam(struct net_device *netdev, | |||
299 | return 0; | 299 | return 0; |
300 | } | 300 | } |
301 | 301 | ||
302 | temp_ring = vmalloc(sizeof(struct igbvf_ring)); | ||
303 | if (!temp_ring) | ||
304 | return -ENOMEM; | ||
305 | |||
306 | while (test_and_set_bit(__IGBVF_RESETTING, &adapter->state)) | 302 | while (test_and_set_bit(__IGBVF_RESETTING, &adapter->state)) |
307 | msleep(1); | 303 | msleep(1); |
308 | 304 | ||
309 | if (netif_running(adapter->netdev)) | 305 | if (!netif_running(adapter->netdev)) { |
310 | igbvf_down(adapter); | 306 | adapter->tx_ring->count = new_tx_count; |
307 | adapter->rx_ring->count = new_rx_count; | ||
308 | goto clear_reset; | ||
309 | } | ||
310 | |||
311 | temp_ring = vmalloc(sizeof(struct igbvf_ring)); | ||
312 | if (!temp_ring) { | ||
313 | err = -ENOMEM; | ||
314 | goto clear_reset; | ||
315 | } | ||
316 | |||
317 | igbvf_down(adapter); | ||
311 | 318 | ||
312 | /* | 319 | /* |
313 | * We can't just free everything and then setup again, | 320 | * We can't just free everything and then setup again, |
@@ -339,14 +346,11 @@ static int igbvf_set_ringparam(struct net_device *netdev, | |||
339 | 346 | ||
340 | memcpy(adapter->rx_ring, temp_ring,sizeof(struct igbvf_ring)); | 347 | memcpy(adapter->rx_ring, temp_ring,sizeof(struct igbvf_ring)); |
341 | } | 348 | } |
342 | |||
343 | err = 0; | ||
344 | err_setup: | 349 | err_setup: |
345 | if (netif_running(adapter->netdev)) | 350 | igbvf_up(adapter); |
346 | igbvf_up(adapter); | ||
347 | |||
348 | clear_bit(__IGBVF_RESETTING, &adapter->state); | ||
349 | vfree(temp_ring); | 351 | vfree(temp_ring); |
352 | clear_reset: | ||
353 | clear_bit(__IGBVF_RESETTING, &adapter->state); | ||
350 | return err; | 354 | return err; |
351 | } | 355 | } |
352 | 356 | ||
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index fa314cb005a4..856c18c207f3 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -798,7 +798,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev, | |||
798 | { | 798 | { |
799 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 799 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
800 | struct ixgbe_ring *temp_tx_ring, *temp_rx_ring; | 800 | struct ixgbe_ring *temp_tx_ring, *temp_rx_ring; |
801 | int i, err; | 801 | int i, err = 0; |
802 | u32 new_rx_count, new_tx_count; | 802 | u32 new_rx_count, new_tx_count; |
803 | bool need_update = false; | 803 | bool need_update = false; |
804 | 804 | ||
@@ -822,6 +822,16 @@ static int ixgbe_set_ringparam(struct net_device *netdev, | |||
822 | while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) | 822 | while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) |
823 | msleep(1); | 823 | msleep(1); |
824 | 824 | ||
825 | if (!netif_running(adapter->netdev)) { | ||
826 | for (i = 0; i < adapter->num_tx_queues; i++) | ||
827 | adapter->tx_ring[i].count = new_tx_count; | ||
828 | for (i = 0; i < adapter->num_rx_queues; i++) | ||
829 | adapter->rx_ring[i].count = new_rx_count; | ||
830 | adapter->tx_ring_count = new_tx_count; | ||
831 | adapter->rx_ring_count = new_rx_count; | ||
832 | goto err_setup; | ||
833 | } | ||
834 | |||
825 | temp_tx_ring = kcalloc(adapter->num_tx_queues, | 835 | temp_tx_ring = kcalloc(adapter->num_tx_queues, |
826 | sizeof(struct ixgbe_ring), GFP_KERNEL); | 836 | sizeof(struct ixgbe_ring), GFP_KERNEL); |
827 | if (!temp_tx_ring) { | 837 | if (!temp_tx_ring) { |
@@ -879,8 +889,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev, | |||
879 | 889 | ||
880 | /* if rings need to be updated, here's the place to do it in one shot */ | 890 | /* if rings need to be updated, here's the place to do it in one shot */ |
881 | if (need_update) { | 891 | if (need_update) { |
882 | if (netif_running(netdev)) | 892 | ixgbe_down(adapter); |
883 | ixgbe_down(adapter); | ||
884 | 893 | ||
885 | /* tx */ | 894 | /* tx */ |
886 | if (new_tx_count != adapter->tx_ring_count) { | 895 | if (new_tx_count != adapter->tx_ring_count) { |
@@ -897,13 +906,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, | |||
897 | temp_rx_ring = NULL; | 906 | temp_rx_ring = NULL; |
898 | adapter->rx_ring_count = new_rx_count; | 907 | adapter->rx_ring_count = new_rx_count; |
899 | } | 908 | } |
900 | } | ||
901 | |||
902 | /* success! */ | ||
903 | err = 0; | ||
904 | if (netif_running(netdev)) | ||
905 | ixgbe_up(adapter); | 909 | ixgbe_up(adapter); |
906 | 910 | } | |
907 | err_setup: | 911 | err_setup: |
908 | clear_bit(__IXGBE_RESETTING, &adapter->state); | 912 | clear_bit(__IXGBE_RESETTING, &adapter->state); |
909 | return err; | 913 | return err; |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 5dd7225b178e..291a505fd4fc 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -1282,6 +1282,7 @@ static struct pci_device_id mlx4_pci_table[] = { | |||
1282 | { PCI_VDEVICE(MELLANOX, 0x6372) }, /* MT25458 ConnectX EN 10GBASE-T 10GigE */ | 1282 | { PCI_VDEVICE(MELLANOX, 0x6372) }, /* MT25458 ConnectX EN 10GBASE-T 10GigE */ |
1283 | { PCI_VDEVICE(MELLANOX, 0x675a) }, /* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */ | 1283 | { PCI_VDEVICE(MELLANOX, 0x675a) }, /* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */ |
1284 | { PCI_VDEVICE(MELLANOX, 0x6764) }, /* MT26468 ConnectX EN 10GigE PCIe gen2*/ | 1284 | { PCI_VDEVICE(MELLANOX, 0x6764) }, /* MT26468 ConnectX EN 10GigE PCIe gen2*/ |
1285 | { PCI_VDEVICE(MELLANOX, 0x6746) }, /* MT26438 ConnectX EN 40GigE PCIe gen2 5GT/s */ | ||
1285 | { PCI_VDEVICE(MELLANOX, 0x676e) }, /* MT26478 ConnectX2 40GigE PCIe gen2 */ | 1286 | { PCI_VDEVICE(MELLANOX, 0x676e) }, /* MT26478 ConnectX2 40GigE PCIe gen2 */ |
1286 | { 0, } | 1287 | { 0, } |
1287 | }; | 1288 | }; |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 6930c87f362e..f3624517cb0e 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -75,7 +75,7 @@ | |||
75 | #include "myri10ge_mcp.h" | 75 | #include "myri10ge_mcp.h" |
76 | #include "myri10ge_mcp_gen_header.h" | 76 | #include "myri10ge_mcp_gen_header.h" |
77 | 77 | ||
78 | #define MYRI10GE_VERSION_STR "1.5.0-1.432" | 78 | #define MYRI10GE_VERSION_STR "1.5.1-1.451" |
79 | 79 | ||
80 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); | 80 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); |
81 | MODULE_AUTHOR("Maintainer: help@myri.com"); | 81 | MODULE_AUTHOR("Maintainer: help@myri.com"); |
@@ -1624,10 +1624,21 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) | |||
1624 | return 0; | 1624 | return 0; |
1625 | } | 1625 | } |
1626 | } | 1626 | } |
1627 | if (*ptr == 'R' || *ptr == 'Q') { | 1627 | if (*ptr == '2') |
1628 | /* We've found either an XFP or quad ribbon fiber */ | 1628 | ptr++; |
1629 | if (*ptr == 'R' || *ptr == 'Q' || *ptr == 'S') { | ||
1630 | /* We've found either an XFP, quad ribbon fiber, or SFP+ */ | ||
1629 | cmd->port = PORT_FIBRE; | 1631 | cmd->port = PORT_FIBRE; |
1632 | cmd->supported |= SUPPORTED_FIBRE; | ||
1633 | cmd->advertising |= ADVERTISED_FIBRE; | ||
1634 | } else { | ||
1635 | cmd->port = PORT_OTHER; | ||
1630 | } | 1636 | } |
1637 | if (*ptr == 'R' || *ptr == 'S') | ||
1638 | cmd->transceiver = XCVR_EXTERNAL; | ||
1639 | else | ||
1640 | cmd->transceiver = XCVR_INTERNAL; | ||
1641 | |||
1631 | return 0; | 1642 | return 0; |
1632 | } | 1643 | } |
1633 | 1644 | ||
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 7a7177421d7c..1c46da632125 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -419,6 +419,7 @@ enum { | |||
419 | #define NETXEN_CRB_ROMUSB \ | 419 | #define NETXEN_CRB_ROMUSB \ |
420 | NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_ROMUSB) | 420 | NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_ROMUSB) |
421 | #define NETXEN_CRB_I2Q NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_I2Q) | 421 | #define NETXEN_CRB_I2Q NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_I2Q) |
422 | #define NETXEN_CRB_I2C0 NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_I2C0) | ||
422 | #define NETXEN_CRB_SMB NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_SMB) | 423 | #define NETXEN_CRB_SMB NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_SMB) |
423 | #define NETXEN_CRB_MAX NETXEN_PCI_CRB_WINDOW(64) | 424 | #define NETXEN_CRB_MAX NETXEN_PCI_CRB_WINDOW(64) |
424 | 425 | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 32314000dfcd..3185a98b0917 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -1901,22 +1901,16 @@ netxen_setup_hwops(struct netxen_adapter *adapter) | |||
1901 | 1901 | ||
1902 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) | 1902 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) |
1903 | { | 1903 | { |
1904 | int offset, board_type, magic, header_version; | 1904 | int offset, board_type, magic; |
1905 | struct pci_dev *pdev = adapter->pdev; | 1905 | struct pci_dev *pdev = adapter->pdev; |
1906 | 1906 | ||
1907 | offset = NX_FW_MAGIC_OFFSET; | 1907 | offset = NX_FW_MAGIC_OFFSET; |
1908 | if (netxen_rom_fast_read(adapter, offset, &magic)) | 1908 | if (netxen_rom_fast_read(adapter, offset, &magic)) |
1909 | return -EIO; | 1909 | return -EIO; |
1910 | 1910 | ||
1911 | offset = NX_HDR_VERSION_OFFSET; | 1911 | if (magic != NETXEN_BDINFO_MAGIC) { |
1912 | if (netxen_rom_fast_read(adapter, offset, &header_version)) | 1912 | dev_err(&pdev->dev, "invalid board config, magic=%08x\n", |
1913 | return -EIO; | 1913 | magic); |
1914 | |||
1915 | if (magic != NETXEN_BDINFO_MAGIC || | ||
1916 | header_version != NETXEN_BDINFO_VERSION) { | ||
1917 | dev_err(&pdev->dev, | ||
1918 | "invalid board config, magic=%08x, version=%08x\n", | ||
1919 | magic, header_version); | ||
1920 | return -EIO; | 1914 | return -EIO; |
1921 | } | 1915 | } |
1922 | 1916 | ||
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 91c2bc61c8eb..e40b914d6faf 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -531,6 +531,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
531 | continue; | 531 | continue; |
532 | 532 | ||
533 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | 533 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { |
534 | if (off == (NETXEN_CRB_I2C0 + 0x1c)) | ||
535 | continue; | ||
534 | /* do not reset PCI */ | 536 | /* do not reset PCI */ |
535 | if (off == (ROMUSB_GLB + 0xbc)) | 537 | if (off == (ROMUSB_GLB + 0xbc)) |
536 | continue; | 538 | continue; |
@@ -553,12 +555,6 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
553 | continue; | 555 | continue; |
554 | } | 556 | } |
555 | 557 | ||
556 | if (off == NETXEN_ADDR_ERROR) { | ||
557 | printk(KERN_ERR "%s: Err: Unknown addr: 0x%08x\n", | ||
558 | netxen_nic_driver_name, buf[i].addr); | ||
559 | continue; | ||
560 | } | ||
561 | |||
562 | init_delay = 1; | 558 | init_delay = 1; |
563 | /* After writing this register, HW needs time for CRB */ | 559 | /* After writing this register, HW needs time for CRB */ |
564 | /* to quiet down (else crb_window returns 0xffffffff) */ | 560 | /* to quiet down (else crb_window returns 0xffffffff) */ |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 7fc15e9e8adb..0b4a56a8c8d5 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -1919,6 +1919,7 @@ static void netxen_tx_timeout_task(struct work_struct *work) | |||
1919 | 1919 | ||
1920 | request_reset: | 1920 | request_reset: |
1921 | adapter->need_fw_reset = 1; | 1921 | adapter->need_fw_reset = 1; |
1922 | clear_bit(__NX_RESETTING, &adapter->state); | ||
1922 | } | 1923 | } |
1923 | 1924 | ||
1924 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | 1925 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 7cbf6f9b51de..2559991eea6a 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -111,9 +111,6 @@ struct pppoe_net { | |||
111 | rwlock_t hash_lock; | 111 | rwlock_t hash_lock; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | /* to eliminate a race btw pppoe_flush_dev and pppoe_release */ | ||
115 | static DEFINE_SPINLOCK(flush_lock); | ||
116 | |||
117 | /* | 114 | /* |
118 | * PPPoE could be in the following stages: | 115 | * PPPoE could be in the following stages: |
119 | * 1) Discovery stage (to obtain remote MAC and Session ID) | 116 | * 1) Discovery stage (to obtain remote MAC and Session ID) |
@@ -303,45 +300,48 @@ static void pppoe_flush_dev(struct net_device *dev) | |||
303 | write_lock_bh(&pn->hash_lock); | 300 | write_lock_bh(&pn->hash_lock); |
304 | for (i = 0; i < PPPOE_HASH_SIZE; i++) { | 301 | for (i = 0; i < PPPOE_HASH_SIZE; i++) { |
305 | struct pppox_sock *po = pn->hash_table[i]; | 302 | struct pppox_sock *po = pn->hash_table[i]; |
303 | struct sock *sk; | ||
306 | 304 | ||
307 | while (po != NULL) { | 305 | while (po) { |
308 | struct sock *sk; | 306 | while (po && po->pppoe_dev != dev) { |
309 | if (po->pppoe_dev != dev) { | ||
310 | po = po->next; | 307 | po = po->next; |
311 | continue; | ||
312 | } | 308 | } |
309 | |||
310 | if (!po) | ||
311 | break; | ||
312 | |||
313 | sk = sk_pppox(po); | 313 | sk = sk_pppox(po); |
314 | spin_lock(&flush_lock); | ||
315 | po->pppoe_dev = NULL; | ||
316 | spin_unlock(&flush_lock); | ||
317 | dev_put(dev); | ||
318 | 314 | ||
319 | /* We always grab the socket lock, followed by the | 315 | /* We always grab the socket lock, followed by the |
320 | * hash_lock, in that order. Since we should | 316 | * hash_lock, in that order. Since we should hold the |
321 | * hold the sock lock while doing any unbinding, | 317 | * sock lock while doing any unbinding, we need to |
322 | * we need to release the lock we're holding. | 318 | * release the lock we're holding. Hold a reference to |
323 | * Hold a reference to the sock so it doesn't disappear | 319 | * the sock so it doesn't disappear as we're jumping |
324 | * as we're jumping between locks. | 320 | * between locks. |
325 | */ | 321 | */ |
326 | 322 | ||
327 | sock_hold(sk); | 323 | sock_hold(sk); |
328 | |||
329 | write_unlock_bh(&pn->hash_lock); | 324 | write_unlock_bh(&pn->hash_lock); |
330 | lock_sock(sk); | 325 | lock_sock(sk); |
331 | 326 | ||
332 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { | 327 | if (po->pppoe_dev == dev |
328 | && sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { | ||
333 | pppox_unbind_sock(sk); | 329 | pppox_unbind_sock(sk); |
334 | sk->sk_state = PPPOX_ZOMBIE; | 330 | sk->sk_state = PPPOX_ZOMBIE; |
335 | sk->sk_state_change(sk); | 331 | sk->sk_state_change(sk); |
332 | po->pppoe_dev = NULL; | ||
333 | dev_put(dev); | ||
336 | } | 334 | } |
337 | 335 | ||
338 | release_sock(sk); | 336 | release_sock(sk); |
339 | sock_put(sk); | 337 | sock_put(sk); |
340 | 338 | ||
341 | /* Restart scan at the beginning of this hash chain. | 339 | /* Restart the process from the start of the current |
342 | * While the lock was dropped the chain contents may | 340 | * hash chain. We dropped locks so the world may have |
343 | * have changed. | 341 | * change from underneath us. |
344 | */ | 342 | */ |
343 | |||
344 | BUG_ON(pppoe_pernet(dev_net(dev)) == NULL); | ||
345 | write_lock_bh(&pn->hash_lock); | 345 | write_lock_bh(&pn->hash_lock); |
346 | po = pn->hash_table[i]; | 346 | po = pn->hash_table[i]; |
347 | } | 347 | } |
@@ -388,11 +388,16 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb) | |||
388 | struct pppox_sock *po = pppox_sk(sk); | 388 | struct pppox_sock *po = pppox_sk(sk); |
389 | struct pppox_sock *relay_po; | 389 | struct pppox_sock *relay_po; |
390 | 390 | ||
391 | /* Backlog receive. Semantics of backlog rcv preclude any code from | ||
392 | * executing in lock_sock()/release_sock() bounds; meaning sk->sk_state | ||
393 | * can't change. | ||
394 | */ | ||
395 | |||
391 | if (sk->sk_state & PPPOX_BOUND) { | 396 | if (sk->sk_state & PPPOX_BOUND) { |
392 | ppp_input(&po->chan, skb); | 397 | ppp_input(&po->chan, skb); |
393 | } else if (sk->sk_state & PPPOX_RELAY) { | 398 | } else if (sk->sk_state & PPPOX_RELAY) { |
394 | relay_po = get_item_by_addr(dev_net(po->pppoe_dev), | 399 | relay_po = get_item_by_addr(sock_net(sk), |
395 | &po->pppoe_relay); | 400 | &po->pppoe_relay); |
396 | if (relay_po == NULL) | 401 | if (relay_po == NULL) |
397 | goto abort_kfree; | 402 | goto abort_kfree; |
398 | 403 | ||
@@ -447,6 +452,10 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev, | |||
447 | goto drop; | 452 | goto drop; |
448 | 453 | ||
449 | pn = pppoe_pernet(dev_net(dev)); | 454 | pn = pppoe_pernet(dev_net(dev)); |
455 | |||
456 | /* Note that get_item does a sock_hold(), so sk_pppox(po) | ||
457 | * is known to be safe. | ||
458 | */ | ||
450 | po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex); | 459 | po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex); |
451 | if (!po) | 460 | if (!po) |
452 | goto drop; | 461 | goto drop; |
@@ -561,6 +570,7 @@ static int pppoe_release(struct socket *sock) | |||
561 | struct sock *sk = sock->sk; | 570 | struct sock *sk = sock->sk; |
562 | struct pppox_sock *po; | 571 | struct pppox_sock *po; |
563 | struct pppoe_net *pn; | 572 | struct pppoe_net *pn; |
573 | struct net *net = NULL; | ||
564 | 574 | ||
565 | if (!sk) | 575 | if (!sk) |
566 | return 0; | 576 | return 0; |
@@ -571,44 +581,28 @@ static int pppoe_release(struct socket *sock) | |||
571 | return -EBADF; | 581 | return -EBADF; |
572 | } | 582 | } |
573 | 583 | ||
584 | po = pppox_sk(sk); | ||
585 | |||
586 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { | ||
587 | dev_put(po->pppoe_dev); | ||
588 | po->pppoe_dev = NULL; | ||
589 | } | ||
590 | |||
574 | pppox_unbind_sock(sk); | 591 | pppox_unbind_sock(sk); |
575 | 592 | ||
576 | /* Signal the death of the socket. */ | 593 | /* Signal the death of the socket. */ |
577 | sk->sk_state = PPPOX_DEAD; | 594 | sk->sk_state = PPPOX_DEAD; |
578 | 595 | ||
579 | /* | 596 | net = sock_net(sk); |
580 | * pppoe_flush_dev could lead to a race with | 597 | pn = pppoe_pernet(net); |
581 | * this routine so we use flush_lock to eliminate | ||
582 | * such a case (we only need per-net specific data) | ||
583 | */ | ||
584 | spin_lock(&flush_lock); | ||
585 | po = pppox_sk(sk); | ||
586 | if (!po->pppoe_dev) { | ||
587 | spin_unlock(&flush_lock); | ||
588 | goto out; | ||
589 | } | ||
590 | pn = pppoe_pernet(dev_net(po->pppoe_dev)); | ||
591 | spin_unlock(&flush_lock); | ||
592 | 598 | ||
593 | /* | 599 | /* |
594 | * protect "po" from concurrent updates | 600 | * protect "po" from concurrent updates |
595 | * on pppoe_flush_dev | 601 | * on pppoe_flush_dev |
596 | */ | 602 | */ |
597 | write_lock_bh(&pn->hash_lock); | 603 | delete_item(pn, po->pppoe_pa.sid, po->pppoe_pa.remote, |
604 | po->pppoe_ifindex); | ||
598 | 605 | ||
599 | po = pppox_sk(sk); | ||
600 | if (stage_session(po->pppoe_pa.sid)) | ||
601 | __delete_item(pn, po->pppoe_pa.sid, po->pppoe_pa.remote, | ||
602 | po->pppoe_ifindex); | ||
603 | |||
604 | if (po->pppoe_dev) { | ||
605 | dev_put(po->pppoe_dev); | ||
606 | po->pppoe_dev = NULL; | ||
607 | } | ||
608 | |||
609 | write_unlock_bh(&pn->hash_lock); | ||
610 | |||
611 | out: | ||
612 | sock_orphan(sk); | 606 | sock_orphan(sk); |
613 | sock->sk = NULL; | 607 | sock->sk = NULL; |
614 | 608 | ||
@@ -625,8 +619,9 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
625 | struct sock *sk = sock->sk; | 619 | struct sock *sk = sock->sk; |
626 | struct sockaddr_pppox *sp = (struct sockaddr_pppox *)uservaddr; | 620 | struct sockaddr_pppox *sp = (struct sockaddr_pppox *)uservaddr; |
627 | struct pppox_sock *po = pppox_sk(sk); | 621 | struct pppox_sock *po = pppox_sk(sk); |
628 | struct net_device *dev; | 622 | struct net_device *dev = NULL; |
629 | struct pppoe_net *pn; | 623 | struct pppoe_net *pn; |
624 | struct net *net = NULL; | ||
630 | int error; | 625 | int error; |
631 | 626 | ||
632 | lock_sock(sk); | 627 | lock_sock(sk); |
@@ -652,12 +647,14 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
652 | /* Delete the old binding */ | 647 | /* Delete the old binding */ |
653 | if (stage_session(po->pppoe_pa.sid)) { | 648 | if (stage_session(po->pppoe_pa.sid)) { |
654 | pppox_unbind_sock(sk); | 649 | pppox_unbind_sock(sk); |
650 | pn = pppoe_pernet(sock_net(sk)); | ||
651 | delete_item(pn, po->pppoe_pa.sid, | ||
652 | po->pppoe_pa.remote, po->pppoe_ifindex); | ||
655 | if (po->pppoe_dev) { | 653 | if (po->pppoe_dev) { |
656 | pn = pppoe_pernet(dev_net(po->pppoe_dev)); | ||
657 | delete_item(pn, po->pppoe_pa.sid, | ||
658 | po->pppoe_pa.remote, po->pppoe_ifindex); | ||
659 | dev_put(po->pppoe_dev); | 654 | dev_put(po->pppoe_dev); |
655 | po->pppoe_dev = NULL; | ||
660 | } | 656 | } |
657 | |||
661 | memset(sk_pppox(po) + 1, 0, | 658 | memset(sk_pppox(po) + 1, 0, |
662 | sizeof(struct pppox_sock) - sizeof(struct sock)); | 659 | sizeof(struct pppox_sock) - sizeof(struct sock)); |
663 | sk->sk_state = PPPOX_NONE; | 660 | sk->sk_state = PPPOX_NONE; |
@@ -666,16 +663,15 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
666 | /* Re-bind in session stage only */ | 663 | /* Re-bind in session stage only */ |
667 | if (stage_session(sp->sa_addr.pppoe.sid)) { | 664 | if (stage_session(sp->sa_addr.pppoe.sid)) { |
668 | error = -ENODEV; | 665 | error = -ENODEV; |
669 | dev = dev_get_by_name(sock_net(sk), sp->sa_addr.pppoe.dev); | 666 | net = sock_net(sk); |
667 | dev = dev_get_by_name(net, sp->sa_addr.pppoe.dev); | ||
670 | if (!dev) | 668 | if (!dev) |
671 | goto end; | 669 | goto err_put; |
672 | 670 | ||
673 | po->pppoe_dev = dev; | 671 | po->pppoe_dev = dev; |
674 | po->pppoe_ifindex = dev->ifindex; | 672 | po->pppoe_ifindex = dev->ifindex; |
675 | pn = pppoe_pernet(dev_net(dev)); | 673 | pn = pppoe_pernet(net); |
676 | write_lock_bh(&pn->hash_lock); | ||
677 | if (!(dev->flags & IFF_UP)) { | 674 | if (!(dev->flags & IFF_UP)) { |
678 | write_unlock_bh(&pn->hash_lock); | ||
679 | goto err_put; | 675 | goto err_put; |
680 | } | 676 | } |
681 | 677 | ||
@@ -683,6 +679,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
683 | &sp->sa_addr.pppoe, | 679 | &sp->sa_addr.pppoe, |
684 | sizeof(struct pppoe_addr)); | 680 | sizeof(struct pppoe_addr)); |
685 | 681 | ||
682 | write_lock_bh(&pn->hash_lock); | ||
686 | error = __set_item(pn, po); | 683 | error = __set_item(pn, po); |
687 | write_unlock_bh(&pn->hash_lock); | 684 | write_unlock_bh(&pn->hash_lock); |
688 | if (error < 0) | 685 | if (error < 0) |
@@ -696,8 +693,11 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
696 | po->chan.ops = &pppoe_chan_ops; | 693 | po->chan.ops = &pppoe_chan_ops; |
697 | 694 | ||
698 | error = ppp_register_net_channel(dev_net(dev), &po->chan); | 695 | error = ppp_register_net_channel(dev_net(dev), &po->chan); |
699 | if (error) | 696 | if (error) { |
697 | delete_item(pn, po->pppoe_pa.sid, | ||
698 | po->pppoe_pa.remote, po->pppoe_ifindex); | ||
700 | goto err_put; | 699 | goto err_put; |
700 | } | ||
701 | 701 | ||
702 | sk->sk_state = PPPOX_CONNECTED; | 702 | sk->sk_state = PPPOX_CONNECTED; |
703 | } | 703 | } |
@@ -915,6 +915,14 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) | |||
915 | struct pppoe_hdr *ph; | 915 | struct pppoe_hdr *ph; |
916 | int data_len = skb->len; | 916 | int data_len = skb->len; |
917 | 917 | ||
918 | /* The higher-level PPP code (ppp_unregister_channel()) ensures the PPP | ||
919 | * xmit operations conclude prior to an unregistration call. Thus | ||
920 | * sk->sk_state cannot change, so we don't need to do lock_sock(). | ||
921 | * But, we also can't do a lock_sock since that introduces a potential | ||
922 | * deadlock as we'd reverse the lock ordering used when calling | ||
923 | * ppp_unregister_channel(). | ||
924 | */ | ||
925 | |||
918 | if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) | 926 | if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) |
919 | goto abort; | 927 | goto abort; |
920 | 928 | ||
@@ -944,7 +952,6 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) | |||
944 | po->pppoe_pa.remote, NULL, data_len); | 952 | po->pppoe_pa.remote, NULL, data_len); |
945 | 953 | ||
946 | dev_queue_xmit(skb); | 954 | dev_queue_xmit(skb); |
947 | |||
948 | return 1; | 955 | return 1; |
949 | 956 | ||
950 | abort: | 957 | abort: |
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index e7285f01bd04..c2383adcd527 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -95,6 +95,7 @@ enum { | |||
95 | 95 | ||
96 | /* Misc. stuff */ | 96 | /* Misc. stuff */ |
97 | MAILBOX_COUNT = 16, | 97 | MAILBOX_COUNT = 16, |
98 | MAILBOX_TIMEOUT = 5, | ||
98 | 99 | ||
99 | PROC_ADDR_RDY = (1 << 31), | 100 | PROC_ADDR_RDY = (1 << 31), |
100 | PROC_ADDR_R = (1 << 30), | 101 | PROC_ADDR_R = (1 << 30), |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 48b45df85ec9..cea7531f4f40 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -3916,6 +3916,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
3916 | goto err_out; | 3916 | goto err_out; |
3917 | } | 3917 | } |
3918 | 3918 | ||
3919 | pci_save_state(pdev); | ||
3919 | qdev->reg_base = | 3920 | qdev->reg_base = |
3920 | ioremap_nocache(pci_resource_start(pdev, 1), | 3921 | ioremap_nocache(pci_resource_start(pdev, 1), |
3921 | pci_resource_len(pdev, 1)); | 3922 | pci_resource_len(pdev, 1)); |
@@ -4070,6 +4071,33 @@ static void __devexit qlge_remove(struct pci_dev *pdev) | |||
4070 | free_netdev(ndev); | 4071 | free_netdev(ndev); |
4071 | } | 4072 | } |
4072 | 4073 | ||
4074 | /* Clean up resources without touching hardware. */ | ||
4075 | static void ql_eeh_close(struct net_device *ndev) | ||
4076 | { | ||
4077 | int i; | ||
4078 | struct ql_adapter *qdev = netdev_priv(ndev); | ||
4079 | |||
4080 | if (netif_carrier_ok(ndev)) { | ||
4081 | netif_carrier_off(ndev); | ||
4082 | netif_stop_queue(ndev); | ||
4083 | } | ||
4084 | |||
4085 | if (test_bit(QL_ADAPTER_UP, &qdev->flags)) | ||
4086 | cancel_delayed_work_sync(&qdev->asic_reset_work); | ||
4087 | cancel_delayed_work_sync(&qdev->mpi_reset_work); | ||
4088 | cancel_delayed_work_sync(&qdev->mpi_work); | ||
4089 | cancel_delayed_work_sync(&qdev->mpi_idc_work); | ||
4090 | cancel_delayed_work_sync(&qdev->mpi_port_cfg_work); | ||
4091 | |||
4092 | for (i = 0; i < qdev->rss_ring_count; i++) | ||
4093 | netif_napi_del(&qdev->rx_ring[i].napi); | ||
4094 | |||
4095 | clear_bit(QL_ADAPTER_UP, &qdev->flags); | ||
4096 | ql_tx_ring_clean(qdev); | ||
4097 | ql_free_rx_buffers(qdev); | ||
4098 | ql_release_adapter_resources(qdev); | ||
4099 | } | ||
4100 | |||
4073 | /* | 4101 | /* |
4074 | * This callback is called by the PCI subsystem whenever | 4102 | * This callback is called by the PCI subsystem whenever |
4075 | * a PCI bus error is detected. | 4103 | * a PCI bus error is detected. |
@@ -4078,17 +4106,21 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev, | |||
4078 | enum pci_channel_state state) | 4106 | enum pci_channel_state state) |
4079 | { | 4107 | { |
4080 | struct net_device *ndev = pci_get_drvdata(pdev); | 4108 | struct net_device *ndev = pci_get_drvdata(pdev); |
4081 | struct ql_adapter *qdev = netdev_priv(ndev); | ||
4082 | |||
4083 | netif_device_detach(ndev); | ||
4084 | 4109 | ||
4085 | if (state == pci_channel_io_perm_failure) | 4110 | switch (state) { |
4111 | case pci_channel_io_normal: | ||
4112 | return PCI_ERS_RESULT_CAN_RECOVER; | ||
4113 | case pci_channel_io_frozen: | ||
4114 | netif_device_detach(ndev); | ||
4115 | if (netif_running(ndev)) | ||
4116 | ql_eeh_close(ndev); | ||
4117 | pci_disable_device(pdev); | ||
4118 | return PCI_ERS_RESULT_NEED_RESET; | ||
4119 | case pci_channel_io_perm_failure: | ||
4120 | dev_err(&pdev->dev, | ||
4121 | "%s: pci_channel_io_perm_failure.\n", __func__); | ||
4086 | return PCI_ERS_RESULT_DISCONNECT; | 4122 | return PCI_ERS_RESULT_DISCONNECT; |
4087 | 4123 | } | |
4088 | if (netif_running(ndev)) | ||
4089 | ql_adapter_down(qdev); | ||
4090 | |||
4091 | pci_disable_device(pdev); | ||
4092 | 4124 | ||
4093 | /* Request a slot reset. */ | 4125 | /* Request a slot reset. */ |
4094 | return PCI_ERS_RESULT_NEED_RESET; | 4126 | return PCI_ERS_RESULT_NEED_RESET; |
@@ -4105,25 +4137,15 @@ static pci_ers_result_t qlge_io_slot_reset(struct pci_dev *pdev) | |||
4105 | struct net_device *ndev = pci_get_drvdata(pdev); | 4137 | struct net_device *ndev = pci_get_drvdata(pdev); |
4106 | struct ql_adapter *qdev = netdev_priv(ndev); | 4138 | struct ql_adapter *qdev = netdev_priv(ndev); |
4107 | 4139 | ||
4140 | pdev->error_state = pci_channel_io_normal; | ||
4141 | |||
4142 | pci_restore_state(pdev); | ||
4108 | if (pci_enable_device(pdev)) { | 4143 | if (pci_enable_device(pdev)) { |
4109 | QPRINTK(qdev, IFUP, ERR, | 4144 | QPRINTK(qdev, IFUP, ERR, |
4110 | "Cannot re-enable PCI device after reset.\n"); | 4145 | "Cannot re-enable PCI device after reset.\n"); |
4111 | return PCI_ERS_RESULT_DISCONNECT; | 4146 | return PCI_ERS_RESULT_DISCONNECT; |
4112 | } | 4147 | } |
4113 | |||
4114 | pci_set_master(pdev); | 4148 | pci_set_master(pdev); |
4115 | |||
4116 | netif_carrier_off(ndev); | ||
4117 | ql_adapter_reset(qdev); | ||
4118 | |||
4119 | /* Make sure the EEPROM is good */ | ||
4120 | memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); | ||
4121 | |||
4122 | if (!is_valid_ether_addr(ndev->perm_addr)) { | ||
4123 | QPRINTK(qdev, IFUP, ERR, "After reset, invalid MAC address.\n"); | ||
4124 | return PCI_ERS_RESULT_DISCONNECT; | ||
4125 | } | ||
4126 | |||
4127 | return PCI_ERS_RESULT_RECOVERED; | 4149 | return PCI_ERS_RESULT_RECOVERED; |
4128 | } | 4150 | } |
4129 | 4151 | ||
@@ -4131,17 +4153,21 @@ static void qlge_io_resume(struct pci_dev *pdev) | |||
4131 | { | 4153 | { |
4132 | struct net_device *ndev = pci_get_drvdata(pdev); | 4154 | struct net_device *ndev = pci_get_drvdata(pdev); |
4133 | struct ql_adapter *qdev = netdev_priv(ndev); | 4155 | struct ql_adapter *qdev = netdev_priv(ndev); |
4156 | int err = 0; | ||
4134 | 4157 | ||
4135 | pci_set_master(pdev); | 4158 | if (ql_adapter_reset(qdev)) |
4136 | 4159 | QPRINTK(qdev, DRV, ERR, "reset FAILED!\n"); | |
4137 | if (netif_running(ndev)) { | 4160 | if (netif_running(ndev)) { |
4138 | if (ql_adapter_up(qdev)) { | 4161 | err = qlge_open(ndev); |
4162 | if (err) { | ||
4139 | QPRINTK(qdev, IFUP, ERR, | 4163 | QPRINTK(qdev, IFUP, ERR, |
4140 | "Device initialization failed after reset.\n"); | 4164 | "Device initialization failed after reset.\n"); |
4141 | return; | 4165 | return; |
4142 | } | 4166 | } |
4167 | } else { | ||
4168 | QPRINTK(qdev, IFUP, ERR, | ||
4169 | "Device was not running prior to EEH.\n"); | ||
4143 | } | 4170 | } |
4144 | |||
4145 | netif_device_attach(ndev); | 4171 | netif_device_attach(ndev); |
4146 | } | 4172 | } |
4147 | 4173 | ||
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 99e58e3f8e22..bcf13c96f73f 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -470,7 +470,8 @@ end: | |||
470 | */ | 470 | */ |
471 | static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | 471 | static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) |
472 | { | 472 | { |
473 | int status, count; | 473 | int status; |
474 | unsigned long count; | ||
474 | 475 | ||
475 | 476 | ||
476 | /* Begin polled mode for MPI */ | 477 | /* Begin polled mode for MPI */ |
@@ -491,9 +492,9 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
491 | /* Wait for the command to complete. We loop | 492 | /* Wait for the command to complete. We loop |
492 | * here because some AEN might arrive while | 493 | * here because some AEN might arrive while |
493 | * we're waiting for the mailbox command to | 494 | * we're waiting for the mailbox command to |
494 | * complete. If more than 5 arrive then we can | 495 | * complete. If more than 5 seconds expire we can |
495 | * assume something is wrong. */ | 496 | * assume something is wrong. */ |
496 | count = 5; | 497 | count = jiffies + HZ * MAILBOX_TIMEOUT; |
497 | do { | 498 | do { |
498 | /* Wait for the interrupt to come in. */ | 499 | /* Wait for the interrupt to come in. */ |
499 | status = ql_wait_mbx_cmd_cmplt(qdev); | 500 | status = ql_wait_mbx_cmd_cmplt(qdev); |
@@ -517,15 +518,15 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
517 | MB_CMD_STS_GOOD) || | 518 | MB_CMD_STS_GOOD) || |
518 | ((mbcp->mbox_out[0] & 0x0000f000) == | 519 | ((mbcp->mbox_out[0] & 0x0000f000) == |
519 | MB_CMD_STS_INTRMDT)) | 520 | MB_CMD_STS_INTRMDT)) |
520 | break; | 521 | goto done; |
521 | } while (--count); | 522 | } while (time_before(jiffies, count)); |
522 | 523 | ||
523 | if (!count) { | 524 | QPRINTK(qdev, DRV, ERR, |
524 | QPRINTK(qdev, DRV, ERR, | 525 | "Timed out waiting for mailbox complete.\n"); |
525 | "Timed out waiting for mailbox complete.\n"); | 526 | status = -ETIMEDOUT; |
526 | status = -ETIMEDOUT; | 527 | goto end; |
527 | goto end; | 528 | |
528 | } | 529 | done: |
529 | 530 | ||
530 | /* Now we can clear the interrupt condition | 531 | /* Now we can clear the interrupt condition |
531 | * and look at our status. | 532 | * and look at our status. |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 83c47d95c3aa..f98ef523f525 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1029,7 +1029,10 @@ static void rtl8169_vlan_rx_register(struct net_device *dev, | |||
1029 | 1029 | ||
1030 | spin_lock_irqsave(&tp->lock, flags); | 1030 | spin_lock_irqsave(&tp->lock, flags); |
1031 | tp->vlgrp = grp; | 1031 | tp->vlgrp = grp; |
1032 | if (tp->vlgrp) | 1032 | /* |
1033 | * Do not disable RxVlan on 8110SCd. | ||
1034 | */ | ||
1035 | if (tp->vlgrp || (tp->mac_version == RTL_GIGA_MAC_VER_05)) | ||
1033 | tp->cp_cmd |= RxVlan; | 1036 | tp->cp_cmd |= RxVlan; |
1034 | else | 1037 | else |
1035 | tp->cp_cmd &= ~RxVlan; | 1038 | tp->cp_cmd &= ~RxVlan; |
@@ -3197,6 +3200,14 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3197 | } | 3200 | } |
3198 | 3201 | ||
3199 | rtl8169_init_phy(dev, tp); | 3202 | rtl8169_init_phy(dev, tp); |
3203 | |||
3204 | /* | ||
3205 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
3206 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
3207 | */ | ||
3208 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | ||
3209 | RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) | RxVlan); | ||
3210 | |||
3200 | device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL); | 3211 | device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL); |
3201 | 3212 | ||
3202 | out: | 3213 | out: |
diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c index 01f9432c31ef..98bff5ada09a 100644 --- a/drivers/net/sfc/rx.c +++ b/drivers/net/sfc/rx.c | |||
@@ -444,7 +444,8 @@ static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue, | |||
444 | * the appropriate LRO method | 444 | * the appropriate LRO method |
445 | */ | 445 | */ |
446 | static void efx_rx_packet_lro(struct efx_channel *channel, | 446 | static void efx_rx_packet_lro(struct efx_channel *channel, |
447 | struct efx_rx_buffer *rx_buf) | 447 | struct efx_rx_buffer *rx_buf, |
448 | bool checksummed) | ||
448 | { | 449 | { |
449 | struct napi_struct *napi = &channel->napi_str; | 450 | struct napi_struct *napi = &channel->napi_str; |
450 | 451 | ||
@@ -466,7 +467,8 @@ static void efx_rx_packet_lro(struct efx_channel *channel, | |||
466 | skb->len = rx_buf->len; | 467 | skb->len = rx_buf->len; |
467 | skb->data_len = rx_buf->len; | 468 | skb->data_len = rx_buf->len; |
468 | skb->truesize += rx_buf->len; | 469 | skb->truesize += rx_buf->len; |
469 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 470 | skb->ip_summed = |
471 | checksummed ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE; | ||
470 | 472 | ||
471 | napi_gro_frags(napi); | 473 | napi_gro_frags(napi); |
472 | 474 | ||
@@ -475,6 +477,7 @@ out: | |||
475 | rx_buf->page = NULL; | 477 | rx_buf->page = NULL; |
476 | } else { | 478 | } else { |
477 | EFX_BUG_ON_PARANOID(!rx_buf->skb); | 479 | EFX_BUG_ON_PARANOID(!rx_buf->skb); |
480 | EFX_BUG_ON_PARANOID(!checksummed); | ||
478 | 481 | ||
479 | napi_gro_receive(napi, rx_buf->skb); | 482 | napi_gro_receive(napi, rx_buf->skb); |
480 | rx_buf->skb = NULL; | 483 | rx_buf->skb = NULL; |
@@ -570,7 +573,7 @@ void __efx_rx_packet(struct efx_channel *channel, | |||
570 | } | 573 | } |
571 | 574 | ||
572 | if (likely(checksummed || rx_buf->page)) { | 575 | if (likely(checksummed || rx_buf->page)) { |
573 | efx_rx_packet_lro(channel, rx_buf); | 576 | efx_rx_packet_lro(channel, rx_buf, checksummed); |
574 | goto done; | 577 | goto done; |
575 | } | 578 | } |
576 | 579 | ||
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index f49d0800c1d1..528b912a4b0d 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/phy.h> | 30 | #include <linux/phy.h> |
31 | #include <linux/cache.h> | 31 | #include <linux/cache.h> |
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <asm/cacheflush.h> | ||
33 | 34 | ||
34 | #include "sh_eth.h" | 35 | #include "sh_eth.h" |
35 | 36 | ||
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 72470f77f556..a2b30a10064f 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -649,6 +649,10 @@ static const struct usb_device_id products[] = { | |||
649 | USB_DEVICE(0x0fe6, 0x8101), /* DM9601 USB to Fast Ethernet Adapter */ | 649 | USB_DEVICE(0x0fe6, 0x8101), /* DM9601 USB to Fast Ethernet Adapter */ |
650 | .driver_info = (unsigned long)&dm9601_info, | 650 | .driver_info = (unsigned long)&dm9601_info, |
651 | }, | 651 | }, |
652 | { | ||
653 | USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ | ||
654 | .driver_info = (unsigned long)&dm9601_info, | ||
655 | }, | ||
652 | {}, // END | 656 | {}, // END |
653 | }; | 657 | }; |
654 | 658 | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 3709d6af9abf..05630f2f6930 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -516,8 +516,7 @@ again: | |||
516 | /* Free up any pending old buffers before queueing new ones. */ | 516 | /* Free up any pending old buffers before queueing new ones. */ |
517 | free_old_xmit_skbs(vi); | 517 | free_old_xmit_skbs(vi); |
518 | 518 | ||
519 | /* Put new one in send queue and do transmit */ | 519 | /* Try to transmit */ |
520 | __skb_queue_head(&vi->send, skb); | ||
521 | capacity = xmit_skb(vi, skb); | 520 | capacity = xmit_skb(vi, skb); |
522 | 521 | ||
523 | /* This can happen with OOM and indirect buffers. */ | 522 | /* This can happen with OOM and indirect buffers. */ |
@@ -531,8 +530,17 @@ again: | |||
531 | } | 530 | } |
532 | return NETDEV_TX_BUSY; | 531 | return NETDEV_TX_BUSY; |
533 | } | 532 | } |
534 | |||
535 | vi->svq->vq_ops->kick(vi->svq); | 533 | vi->svq->vq_ops->kick(vi->svq); |
534 | |||
535 | /* | ||
536 | * Put new one in send queue. You'd expect we'd need this before | ||
537 | * xmit_skb calls add_buf(), since the callback can be triggered | ||
538 | * immediately after that. But since the callback just triggers | ||
539 | * another call back here, normal network xmit locking prevents the | ||
540 | * race. | ||
541 | */ | ||
542 | __skb_queue_head(&vi->send, skb); | ||
543 | |||
536 | /* Don't wait up for transmitted skbs to be freed. */ | 544 | /* Don't wait up for transmitted skbs to be freed. */ |
537 | skb_orphan(skb); | 545 | skb_orphan(skb); |
538 | nf_reset(skb); | 546 | nf_reset(skb); |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 7116a1aa20ce..abf896a7390e 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -4790,9 +4790,8 @@ static int proc_stats_rid_open( struct inode *inode, | |||
4790 | static int get_dec_u16( char *buffer, int *start, int limit ) { | 4790 | static int get_dec_u16( char *buffer, int *start, int limit ) { |
4791 | u16 value; | 4791 | u16 value; |
4792 | int valid = 0; | 4792 | int valid = 0; |
4793 | for( value = 0; buffer[*start] >= '0' && | 4793 | for (value = 0; *start < limit && buffer[*start] >= '0' && |
4794 | buffer[*start] <= '9' && | 4794 | buffer[*start] <= '9'; (*start)++) { |
4795 | *start < limit; (*start)++ ) { | ||
4796 | valid = 1; | 4795 | valid = 1; |
4797 | value *= 10; | 4796 | value *= 10; |
4798 | value += buffer[*start] - '0'; | 4797 | value += buffer[*start] - '0'; |
diff --git a/drivers/net/wireless/b43/leds.h b/drivers/net/wireless/b43/leds.h index 4c56187810fc..32b66d53cdac 100644 --- a/drivers/net/wireless/b43/leds.h +++ b/drivers/net/wireless/b43/leds.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef B43_LEDS_H_ | 1 | #ifndef B43_LEDS_H_ |
2 | #define B43_LEDS_H_ | 2 | #define B43_LEDS_H_ |
3 | 3 | ||
4 | struct b43_wl; | ||
4 | struct b43_wldev; | 5 | struct b43_wldev; |
5 | 6 | ||
6 | #ifdef CONFIG_B43_LEDS | 7 | #ifdef CONFIG_B43_LEDS |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index df6b26a0c05e..86f35827f008 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -4501,7 +4501,6 @@ static void b43_op_stop(struct ieee80211_hw *hw) | |||
4501 | 4501 | ||
4502 | cancel_work_sync(&(wl->beacon_update_trigger)); | 4502 | cancel_work_sync(&(wl->beacon_update_trigger)); |
4503 | 4503 | ||
4504 | wiphy_rfkill_stop_polling(hw->wiphy); | ||
4505 | mutex_lock(&wl->mutex); | 4504 | mutex_lock(&wl->mutex); |
4506 | if (b43_status(dev) >= B43_STAT_STARTED) { | 4505 | if (b43_status(dev) >= B43_STAT_STARTED) { |
4507 | dev = b43_wireless_core_stop(dev); | 4506 | dev = b43_wireless_core_stop(dev); |
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c index 7a3218c5ba7d..ffdce6f3c909 100644 --- a/drivers/net/wireless/b43/rfkill.c +++ b/drivers/net/wireless/b43/rfkill.c | |||
@@ -33,7 +33,8 @@ bool b43_is_hw_radio_enabled(struct b43_wldev *dev) | |||
33 | & B43_MMIO_RADIO_HWENABLED_HI_MASK)) | 33 | & B43_MMIO_RADIO_HWENABLED_HI_MASK)) |
34 | return 1; | 34 | return 1; |
35 | } else { | 35 | } else { |
36 | if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO) | 36 | if (b43_status(dev) >= B43_STAT_STARTED && |
37 | b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO) | ||
37 | & B43_MMIO_RADIO_HWENABLED_LO_MASK) | 38 | & B43_MMIO_RADIO_HWENABLED_LO_MASK) |
38 | return 1; | 39 | return 1; |
39 | } | 40 | } |
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c index cb8be8d7abc1..5b3672c4d0cc 100644 --- a/drivers/net/wireless/libertas/if_spi.c +++ b/drivers/net/wireless/libertas/if_spi.c | |||
@@ -134,7 +134,7 @@ static void spu_transaction_finish(struct if_spi_card *card) | |||
134 | static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len) | 134 | static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len) |
135 | { | 135 | { |
136 | int err = 0; | 136 | int err = 0; |
137 | u16 reg_out = cpu_to_le16(reg | IF_SPI_WRITE_OPERATION_MASK); | 137 | __le16 reg_out = cpu_to_le16(reg | IF_SPI_WRITE_OPERATION_MASK); |
138 | struct spi_message m; | 138 | struct spi_message m; |
139 | struct spi_transfer reg_trans; | 139 | struct spi_transfer reg_trans; |
140 | struct spi_transfer data_trans; | 140 | struct spi_transfer data_trans; |
@@ -166,7 +166,7 @@ static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len) | |||
166 | 166 | ||
167 | static inline int spu_write_u16(struct if_spi_card *card, u16 reg, u16 val) | 167 | static inline int spu_write_u16(struct if_spi_card *card, u16 reg, u16 val) |
168 | { | 168 | { |
169 | u16 buff; | 169 | __le16 buff; |
170 | 170 | ||
171 | buff = cpu_to_le16(val); | 171 | buff = cpu_to_le16(val); |
172 | return spu_write(card, reg, (u8 *)&buff, sizeof(u16)); | 172 | return spu_write(card, reg, (u8 *)&buff, sizeof(u16)); |
@@ -188,7 +188,7 @@ static int spu_read(struct if_spi_card *card, u16 reg, u8 *buf, int len) | |||
188 | { | 188 | { |
189 | unsigned int delay; | 189 | unsigned int delay; |
190 | int err = 0; | 190 | int err = 0; |
191 | u16 reg_out = cpu_to_le16(reg | IF_SPI_READ_OPERATION_MASK); | 191 | __le16 reg_out = cpu_to_le16(reg | IF_SPI_READ_OPERATION_MASK); |
192 | struct spi_message m; | 192 | struct spi_message m; |
193 | struct spi_transfer reg_trans; | 193 | struct spi_transfer reg_trans; |
194 | struct spi_transfer dummy_trans; | 194 | struct spi_transfer dummy_trans; |
@@ -235,7 +235,7 @@ static int spu_read(struct if_spi_card *card, u16 reg, u8 *buf, int len) | |||
235 | /* Read 16 bits from an SPI register */ | 235 | /* Read 16 bits from an SPI register */ |
236 | static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val) | 236 | static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val) |
237 | { | 237 | { |
238 | u16 buf; | 238 | __le16 buf; |
239 | int ret; | 239 | int ret; |
240 | 240 | ||
241 | ret = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); | 241 | ret = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); |
@@ -248,7 +248,7 @@ static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val) | |||
248 | * The low 16 bits are read first. */ | 248 | * The low 16 bits are read first. */ |
249 | static int spu_read_u32(struct if_spi_card *card, u16 reg, u32 *val) | 249 | static int spu_read_u32(struct if_spi_card *card, u16 reg, u32 *val) |
250 | { | 250 | { |
251 | u32 buf; | 251 | __le32 buf; |
252 | int err; | 252 | int err; |
253 | 253 | ||
254 | err = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); | 254 | err = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 88cd58eb3b9f..1c88c2ea59aa 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -2879,7 +2879,7 @@ static int write_essid(struct file *file, const char __user *buffer, | |||
2879 | unsigned long count, void *data) | 2879 | unsigned long count, void *data) |
2880 | { | 2880 | { |
2881 | static char proc_essid[33]; | 2881 | static char proc_essid[33]; |
2882 | int len = count; | 2882 | unsigned int len = count; |
2883 | 2883 | ||
2884 | if (len > 32) | 2884 | if (len > 32) |
2885 | len = 32; | 2885 | len = 32; |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index a084077a1c61..9fe770f7d7bb 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -1994,7 +1994,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1994 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | 1994 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); |
1995 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | 1995 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, |
1996 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | 1996 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? |
1997 | (skbdesc->entry->entry_idx + 1) : 0xff); | 1997 | txdesc->key_idx : 0xff); |
1998 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | 1998 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, |
1999 | skb->len - txdesc->l2pad); | 1999 | skb->len - txdesc->l2pad); |
2000 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, | 2000 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index bacaa536fd51..4b22ba568b19 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -97,6 +97,12 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
97 | } | 97 | } |
98 | EXPORT_SYMBOL(of_mdiobus_register); | 98 | EXPORT_SYMBOL(of_mdiobus_register); |
99 | 99 | ||
100 | /* Helper function for of_phy_find_device */ | ||
101 | static int of_phy_match(struct device *dev, void *phy_np) | ||
102 | { | ||
103 | return dev_archdata_get_node(&dev->archdata) == phy_np; | ||
104 | } | ||
105 | |||
100 | /** | 106 | /** |
101 | * of_phy_find_device - Give a PHY node, find the phy_device | 107 | * of_phy_find_device - Give a PHY node, find the phy_device |
102 | * @phy_np: Pointer to the phy's device tree node | 108 | * @phy_np: Pointer to the phy's device tree node |
@@ -106,15 +112,10 @@ EXPORT_SYMBOL(of_mdiobus_register); | |||
106 | struct phy_device *of_phy_find_device(struct device_node *phy_np) | 112 | struct phy_device *of_phy_find_device(struct device_node *phy_np) |
107 | { | 113 | { |
108 | struct device *d; | 114 | struct device *d; |
109 | int match(struct device *dev, void *phy_np) | ||
110 | { | ||
111 | return dev_archdata_get_node(&dev->archdata) == phy_np; | ||
112 | } | ||
113 | |||
114 | if (!phy_np) | 115 | if (!phy_np) |
115 | return NULL; | 116 | return NULL; |
116 | 117 | ||
117 | d = bus_find_device(&mdio_bus_type, NULL, phy_np, match); | 118 | d = bus_find_device(&mdio_bus_type, NULL, phy_np, of_phy_match); |
118 | return d ? to_phy_device(d) : NULL; | 119 | return d ? to_phy_device(d) : NULL; |
119 | } | 120 | } |
120 | EXPORT_SYMBOL(of_phy_find_device); | 121 | EXPORT_SYMBOL(of_phy_find_device); |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 0959430534b2..cb1a027eb552 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -299,17 +299,8 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned lon | |||
299 | r = bus->resource[i]; | 299 | r = bus->resource[i]; |
300 | if (r == &ioport_resource || r == &iomem_resource) | 300 | if (r == &ioport_resource || r == &iomem_resource) |
301 | continue; | 301 | continue; |
302 | if (r && (r->flags & type_mask) == type) { | 302 | if (r && (r->flags & type_mask) == type && !r->parent) |
303 | if (!r->parent) | 303 | return r; |
304 | return r; | ||
305 | /* | ||
306 | * if there is no child under that, we should release | ||
307 | * and use it. don't need to reset it, pbus_size_* will | ||
308 | * set it again | ||
309 | */ | ||
310 | if (!r->child && !release_resource(r)) | ||
311 | return r; | ||
312 | } | ||
313 | } | 304 | } |
314 | return NULL; | 305 | return NULL; |
315 | } | 306 | } |
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 4a110b7b2673..6c4a4fc83630 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
@@ -1463,7 +1463,9 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t | |||
1463 | return -ENOMEM; | 1463 | return -ENOMEM; |
1464 | } | 1464 | } |
1465 | tuple.DesiredTuple = code; | 1465 | tuple.DesiredTuple = code; |
1466 | tuple.Attributes = TUPLE_RETURN_COMMON; | 1466 | tuple.Attributes = 0; |
1467 | if (function == BIND_FN_ALL) | ||
1468 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
1467 | ret = pccard_get_first_tuple(s, function, &tuple); | 1469 | ret = pccard_get_first_tuple(s, function, &tuple); |
1468 | if (ret != 0) | 1470 | if (ret != 0) |
1469 | goto done; | 1471 | goto done; |
@@ -1490,7 +1492,7 @@ EXPORT_SYMBOL(pccard_read_tuple); | |||
1490 | 1492 | ||
1491 | ======================================================================*/ | 1493 | ======================================================================*/ |
1492 | 1494 | ||
1493 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *info) | 1495 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info) |
1494 | { | 1496 | { |
1495 | tuple_t *tuple; | 1497 | tuple_t *tuple; |
1496 | cisparse_t *p; | 1498 | cisparse_t *p; |
@@ -1515,30 +1517,30 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned | |||
1515 | count = reserved = 0; | 1517 | count = reserved = 0; |
1516 | tuple->DesiredTuple = RETURN_FIRST_TUPLE; | 1518 | tuple->DesiredTuple = RETURN_FIRST_TUPLE; |
1517 | tuple->Attributes = TUPLE_RETURN_COMMON; | 1519 | tuple->Attributes = TUPLE_RETURN_COMMON; |
1518 | ret = pccard_get_first_tuple(s, function, tuple); | 1520 | ret = pccard_get_first_tuple(s, BIND_FN_ALL, tuple); |
1519 | if (ret != 0) | 1521 | if (ret != 0) |
1520 | goto done; | 1522 | goto done; |
1521 | 1523 | ||
1522 | /* First tuple should be DEVICE; we should really have either that | 1524 | /* First tuple should be DEVICE; we should really have either that |
1523 | or a CFTABLE_ENTRY of some sort */ | 1525 | or a CFTABLE_ENTRY of some sort */ |
1524 | if ((tuple->TupleCode == CISTPL_DEVICE) || | 1526 | if ((tuple->TupleCode == CISTPL_DEVICE) || |
1525 | (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == 0) || | 1527 | (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY, p) == 0) || |
1526 | (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == 0)) | 1528 | (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY_CB, p) == 0)) |
1527 | dev_ok++; | 1529 | dev_ok++; |
1528 | 1530 | ||
1529 | /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 | 1531 | /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 |
1530 | tuple, for card identification. Certain old D-Link and Linksys | 1532 | tuple, for card identification. Certain old D-Link and Linksys |
1531 | cards have only a broken VERS_2 tuple; hence the bogus test. */ | 1533 | cards have only a broken VERS_2 tuple; hence the bogus test. */ |
1532 | if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == 0) || | 1534 | if ((pccard_read_tuple(s, BIND_FN_ALL, CISTPL_MANFID, p) == 0) || |
1533 | (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == 0) || | 1535 | (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_1, p) == 0) || |
1534 | (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != -ENOSPC)) | 1536 | (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_2, p) != -ENOSPC)) |
1535 | ident_ok++; | 1537 | ident_ok++; |
1536 | 1538 | ||
1537 | if (!dev_ok && !ident_ok) | 1539 | if (!dev_ok && !ident_ok) |
1538 | goto done; | 1540 | goto done; |
1539 | 1541 | ||
1540 | for (count = 1; count < MAX_TUPLES; count++) { | 1542 | for (count = 1; count < MAX_TUPLES; count++) { |
1541 | ret = pccard_get_next_tuple(s, function, tuple); | 1543 | ret = pccard_get_next_tuple(s, BIND_FN_ALL, tuple); |
1542 | if (ret != 0) | 1544 | if (ret != 0) |
1543 | break; | 1545 | break; |
1544 | if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || | 1546 | if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || |
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 79615e6d540b..1f4098f1354d 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -197,8 +197,7 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, | |||
197 | cisdata_t code, void *parse); | 197 | cisdata_t code, void *parse); |
198 | int pcmcia_replace_cis(struct pcmcia_socket *s, | 198 | int pcmcia_replace_cis(struct pcmcia_socket *s, |
199 | const u8 *data, const size_t len); | 199 | const u8 *data, const size_t len); |
200 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, | 200 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count); |
201 | unsigned int *count); | ||
202 | 201 | ||
203 | /* rsrc_mgr.c */ | 202 | /* rsrc_mgr.c */ |
204 | int pcmcia_validate_mem(struct pcmcia_socket *s); | 203 | int pcmcia_validate_mem(struct pcmcia_socket *s); |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 9f300d3cb125..f5b7079f13d3 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -547,7 +547,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) | |||
547 | if (!vers1) | 547 | if (!vers1) |
548 | return -ENOMEM; | 548 | return -ENOMEM; |
549 | 549 | ||
550 | if (!pccard_read_tuple(p_dev->socket, p_dev->func, | 550 | if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL, |
551 | CISTPL_MANFID, &manf_id)) { | 551 | CISTPL_MANFID, &manf_id)) { |
552 | p_dev->manf_id = manf_id.manf; | 552 | p_dev->manf_id = manf_id.manf; |
553 | p_dev->card_id = manf_id.card; | 553 | p_dev->card_id = manf_id.card; |
@@ -581,9 +581,9 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) | |||
581 | kfree(devgeo); | 581 | kfree(devgeo); |
582 | } | 582 | } |
583 | 583 | ||
584 | if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_VERS_1, | 584 | if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL, CISTPL_VERS_1, |
585 | vers1)) { | 585 | vers1)) { |
586 | for (i=0; i < vers1->ns; i++) { | 586 | for (i = 0; i < min_t(unsigned int, 4, vers1->ns); i++) { |
587 | char *tmp; | 587 | char *tmp; |
588 | unsigned int length; | 588 | unsigned int length; |
589 | 589 | ||
@@ -733,7 +733,7 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
733 | return -EAGAIN; /* try again, but later... */ | 733 | return -EAGAIN; /* try again, but later... */ |
734 | } | 734 | } |
735 | 735 | ||
736 | ret = pccard_validate_cis(s, BIND_FN_ALL, &no_chains); | 736 | ret = pccard_validate_cis(s, &no_chains); |
737 | if (ret || !no_chains) { | 737 | if (ret || !no_chains) { |
738 | ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n"); | 738 | ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n"); |
739 | return -ENODEV; | 739 | return -ENODEV; |
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index b906abe26ad0..a4aacb830b80 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
@@ -1053,8 +1053,8 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io) | |||
1053 | u_char map, ioctl; | 1053 | u_char map, ioctl; |
1054 | 1054 | ||
1055 | debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " | 1055 | debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " |
1056 | "%#x-%#x)\n", sock, io->map, io->flags, | 1056 | "%#llx-%#llx)\n", sock, io->map, io->flags, io->speed, |
1057 | io->speed, io->start, io->stop); | 1057 | (unsigned long long)io->start, (unsigned long long)io->stop); |
1058 | map = io->map; | 1058 | map = io->map; |
1059 | if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || | 1059 | if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || |
1060 | (io->stop < io->start)) return -EINVAL; | 1060 | (io->stop < io->start)) return -EINVAL; |
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index d1d89c4491ad..7dfbee1dcd76 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c | |||
@@ -537,8 +537,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) | |||
537 | u_char map; | 537 | u_char map; |
538 | 538 | ||
539 | debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " | 539 | debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " |
540 | "%#lx-%#lx)\n", sock, io->map, io->flags, | 540 | "%#llx-%#llx)\n", sock, io->map, io->flags, |
541 | io->speed, io->start, io->stop); | 541 | io->speed, (unsigned long long)io->start, |
542 | (unsigned long long)io->stop); | ||
542 | map = io->map; | 543 | map = io->map; |
543 | 544 | ||
544 | return 0; | 545 | return 0; |
@@ -554,8 +555,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) | |||
554 | pcc_socket_t *t = &socket[sock]; | 555 | pcc_socket_t *t = &socket[sock]; |
555 | 556 | ||
556 | debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " | 557 | debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " |
557 | "%#lx, %#x)\n", sock, map, mem->flags, | 558 | "%#llx, %#x)\n", sock, map, mem->flags, |
558 | mem->speed, mem->static_start, mem->card_start); | 559 | mem->speed, (unsigned long long)mem->static_start, |
560 | mem->card_start); | ||
559 | 561 | ||
560 | /* | 562 | /* |
561 | * sanity check | 563 | * sanity check |
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index a0655839c8d3..c6524f99ccc3 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c | |||
@@ -492,8 +492,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) | |||
492 | u_char map; | 492 | u_char map; |
493 | 493 | ||
494 | debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " | 494 | debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " |
495 | "%#x-%#x)\n", sock, io->map, io->flags, | 495 | "%#llx-%#llx)\n", sock, io->map, io->flags, |
496 | io->speed, io->start, io->stop); | 496 | io->speed, (unsigned long long)io->start, |
497 | (unsigned long long)io->stop); | ||
497 | map = io->map; | 498 | map = io->map; |
498 | 499 | ||
499 | return 0; | 500 | return 0; |
@@ -515,8 +516,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) | |||
515 | #endif | 516 | #endif |
516 | 517 | ||
517 | debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " | 518 | debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " |
518 | "%#lx, %#x)\n", sock, map, mem->flags, | 519 | "%#llx, %#x)\n", sock, map, mem->flags, |
519 | mem->speed, mem->static_start, mem->card_start); | 520 | mem->speed, (unsigned long long)mem->static_start, |
521 | mem->card_start); | ||
520 | 522 | ||
521 | /* | 523 | /* |
522 | * sanity check | 524 | * sanity check |
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index c69f2c4fe520..403559ba49dd 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
@@ -975,8 +975,9 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
975 | #define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) | 975 | #define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) |
976 | 976 | ||
977 | dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, " | 977 | dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, " |
978 | "%#4.4x-%#4.4x)\n", lsock, io->map, io->flags, | 978 | "%#4.4llx-%#4.4llx)\n", lsock, io->map, io->flags, |
979 | io->speed, io->start, io->stop); | 979 | io->speed, (unsigned long long)io->start, |
980 | (unsigned long long)io->stop); | ||
980 | 981 | ||
981 | if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0xffff) | 982 | if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0xffff) |
982 | || (io->stop > 0xffff) || (io->stop < io->start)) | 983 | || (io->stop > 0xffff) || (io->stop < io->start)) |
@@ -1055,8 +1056,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, | |||
1055 | pcmconf8xx_t *pcmcia = s->pcmcia; | 1056 | pcmconf8xx_t *pcmcia = s->pcmcia; |
1056 | 1057 | ||
1057 | dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " | 1058 | dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " |
1058 | "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, | 1059 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, |
1059 | mem->speed, mem->static_start, mem->card_start); | 1060 | mem->speed, (unsigned long long)mem->static_start, |
1061 | mem->card_start); | ||
1060 | 1062 | ||
1061 | if ((mem->map >= PCMCIA_MEM_WIN_NO) | 1063 | if ((mem->map >= PCMCIA_MEM_WIN_NO) |
1062 | // || ((mem->s) >= PCMCIA_MEM_WIN_SIZE) | 1064 | // || ((mem->s) >= PCMCIA_MEM_WIN_SIZE) |
@@ -1107,8 +1109,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, | |||
1107 | } | 1109 | } |
1108 | 1110 | ||
1109 | dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " | 1111 | dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " |
1110 | "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, | 1112 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, |
1111 | mem->speed, mem->static_start, mem->card_start); | 1113 | mem->speed, (unsigned long long)mem->static_start, |
1114 | mem->card_start); | ||
1112 | 1115 | ||
1113 | /* copy the struct and modify the copy */ | 1116 | /* copy the struct and modify the copy */ |
1114 | 1117 | ||
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 32c44040c1e8..30cf71d2ee23 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -881,7 +881,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
881 | mutex_lock(&s->skt_mutex); | 881 | mutex_lock(&s->skt_mutex); |
882 | pcmcia_validate_mem(s); | 882 | pcmcia_validate_mem(s); |
883 | mutex_unlock(&s->skt_mutex); | 883 | mutex_unlock(&s->skt_mutex); |
884 | ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo.Chains); | 884 | ret = pccard_validate_cis(s, &buf->cisinfo.Chains); |
885 | break; | 885 | break; |
886 | case DS_SUSPEND_CARD: | 886 | case DS_SUSPEND_CARD: |
887 | ret = pcmcia_suspend_card(s); | 887 | ret = pcmcia_suspend_card(s); |
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 1c39d3438f20..70a33468bcd0 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -641,6 +641,12 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
641 | if ((ret = pci_enable_device(dev))) | 641 | if ((ret = pci_enable_device(dev))) |
642 | goto err_out_free_mem; | 642 | goto err_out_free_mem; |
643 | 643 | ||
644 | if (!pci_resource_start(dev, 0)) { | ||
645 | printk(KERN_INFO "pd6729: refusing to load the driver " | ||
646 | "as the io_base is 0.\n"); | ||
647 | goto err_out_free_mem; | ||
648 | } | ||
649 | |||
644 | printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " | 650 | printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " |
645 | "at 0x%llx on irq %d\n", | 651 | "at 0x%llx on irq %d\n", |
646 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); | 652 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); |
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 9ca22c7aafb2..7039f3cf5b77 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
@@ -206,6 +206,7 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base, | |||
206 | /* First, what does a floating port look like? */ | 206 | /* First, what does a floating port look like? */ |
207 | b = kzalloc(256, GFP_KERNEL); | 207 | b = kzalloc(256, GFP_KERNEL); |
208 | if (!b) { | 208 | if (!b) { |
209 | printk("\n"); | ||
209 | dev_printk(KERN_ERR, &s->dev, | 210 | dev_printk(KERN_ERR, &s->dev, |
210 | "do_io_probe: unable to kmalloc 256 bytes"); | 211 | "do_io_probe: unable to kmalloc 256 bytes"); |
211 | return; | 212 | return; |
@@ -275,7 +276,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res, | |||
275 | s->cis_mem.res = res; | 276 | s->cis_mem.res = res; |
276 | s->cis_virt = ioremap(res->start, s->map_size); | 277 | s->cis_virt = ioremap(res->start, s->map_size); |
277 | if (s->cis_virt) { | 278 | if (s->cis_virt) { |
278 | ret = pccard_validate_cis(s, BIND_FN_ALL, count); | 279 | ret = pccard_validate_cis(s, count); |
279 | /* invalidate mapping and CIS cache */ | 280 | /* invalidate mapping and CIS cache */ |
280 | iounmap(s->cis_virt); | 281 | iounmap(s->cis_virt); |
281 | s->cis_virt = NULL; | 282 | s->cis_virt = NULL; |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 163cf98e2386..ef7e9e58782b 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
@@ -336,8 +336,9 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m | |||
336 | struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock); | 336 | struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock); |
337 | unsigned short speed = map->speed; | 337 | unsigned short speed = map->speed; |
338 | 338 | ||
339 | debug(skt, 2, "map %u speed %u start 0x%08x stop 0x%08x\n", | 339 | debug(skt, 2, "map %u speed %u start 0x%08llx stop 0x%08llx\n", |
340 | map->map, map->speed, map->start, map->stop); | 340 | map->map, map->speed, (unsigned long long)map->start, |
341 | (unsigned long long)map->stop); | ||
341 | debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n", | 342 | debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n", |
342 | (map->flags==0)?"<NONE>":"", | 343 | (map->flags==0)?"<NONE>":"", |
343 | (map->flags&MAP_ACTIVE)?"ACTIVE ":"", | 344 | (map->flags&MAP_ACTIVE)?"ACTIVE ":"", |
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index ff9a3bb3c88d..78d5aab542f7 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -300,7 +300,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, | |||
300 | 300 | ||
301 | if (!(s->state & SOCKET_PRESENT)) | 301 | if (!(s->state & SOCKET_PRESENT)) |
302 | return -ENODEV; | 302 | return -ENODEV; |
303 | if (pccard_validate_cis(s, BIND_FN_ALL, &chains)) | 303 | if (pccard_validate_cis(s, &chains)) |
304 | return -EIO; | 304 | return -EIO; |
305 | if (!chains) | 305 | if (!chains) |
306 | return -ENODATA; | 306 | return -ENODATA; |
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 582413fcb62f..6918849d511e 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c | |||
@@ -732,8 +732,8 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
732 | u_short base, len, ioctl; | 732 | u_short base, len, ioctl; |
733 | 733 | ||
734 | debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " | 734 | debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " |
735 | "%#x-%#x)\n", psock, io->map, io->flags, | 735 | "%#llx-%#llx)\n", psock, io->map, io->flags, io->speed, |
736 | io->speed, io->start, io->stop); | 736 | (unsigned long long)io->start, (unsigned long long)io->stop); |
737 | if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || | 737 | if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || |
738 | (io->stop < io->start)) return -EINVAL; | 738 | (io->stop < io->start)) return -EINVAL; |
739 | tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT)); | 739 | tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT)); |
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 0f79f3af4f54..2889e5f2dfd3 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -128,12 +128,13 @@ out_ccwdev: | |||
128 | static void __init zfcp_init_device_setup(char *devstr) | 128 | static void __init zfcp_init_device_setup(char *devstr) |
129 | { | 129 | { |
130 | char *token; | 130 | char *token; |
131 | char *str; | 131 | char *str, *str_saved; |
132 | char busid[ZFCP_BUS_ID_SIZE]; | 132 | char busid[ZFCP_BUS_ID_SIZE]; |
133 | u64 wwpn, lun; | 133 | u64 wwpn, lun; |
134 | 134 | ||
135 | /* duplicate devstr and keep the original for sysfs presentation*/ | 135 | /* duplicate devstr and keep the original for sysfs presentation*/ |
136 | str = kmalloc(strlen(devstr) + 1, GFP_KERNEL); | 136 | str_saved = kmalloc(strlen(devstr) + 1, GFP_KERNEL); |
137 | str = str_saved; | ||
137 | if (!str) | 138 | if (!str) |
138 | return; | 139 | return; |
139 | 140 | ||
@@ -152,12 +153,12 @@ static void __init zfcp_init_device_setup(char *devstr) | |||
152 | if (!token || strict_strtoull(token, 0, (unsigned long long *) &lun)) | 153 | if (!token || strict_strtoull(token, 0, (unsigned long long *) &lun)) |
153 | goto err_out; | 154 | goto err_out; |
154 | 155 | ||
155 | kfree(str); | 156 | kfree(str_saved); |
156 | zfcp_init_device_configure(busid, wwpn, lun); | 157 | zfcp_init_device_configure(busid, wwpn, lun); |
157 | return; | 158 | return; |
158 | 159 | ||
159 | err_out: | 160 | err_out: |
160 | kfree(str); | 161 | kfree(str_saved); |
161 | pr_err("%s is not a valid SCSI device\n", devstr); | 162 | pr_err("%s is not a valid SCSI device\n", devstr); |
162 | } | 163 | } |
163 | 164 | ||
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 73d366ba31e5..f73e2180f333 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -858,10 +858,7 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act) | |||
858 | if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) | 858 | if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) |
859 | return zfcp_erp_open_ptp_port(act); | 859 | return zfcp_erp_open_ptp_port(act); |
860 | if (!port->d_id) { | 860 | if (!port->d_id) { |
861 | zfcp_port_get(port); | 861 | zfcp_fc_trigger_did_lookup(port); |
862 | if (!queue_work(adapter->work_queue, | ||
863 | &port->gid_pn_work)) | ||
864 | zfcp_port_put(port); | ||
865 | return ZFCP_ERP_EXIT; | 862 | return ZFCP_ERP_EXIT; |
866 | } | 863 | } |
867 | return zfcp_erp_port_strategy_open_port(act); | 864 | return zfcp_erp_port_strategy_open_port(act); |
@@ -869,12 +866,11 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act) | |||
869 | case ZFCP_ERP_STEP_PORT_OPENING: | 866 | case ZFCP_ERP_STEP_PORT_OPENING: |
870 | /* D_ID might have changed during open */ | 867 | /* D_ID might have changed during open */ |
871 | if (p_status & ZFCP_STATUS_COMMON_OPEN) { | 868 | if (p_status & ZFCP_STATUS_COMMON_OPEN) { |
872 | if (port->d_id) | 869 | if (!port->d_id) { |
873 | return ZFCP_ERP_SUCCEEDED; | 870 | zfcp_fc_trigger_did_lookup(port); |
874 | else { | 871 | return ZFCP_ERP_EXIT; |
875 | act->step = ZFCP_ERP_STEP_PORT_CLOSING; | ||
876 | return ZFCP_ERP_CONTINUES; | ||
877 | } | 872 | } |
873 | return ZFCP_ERP_SUCCEEDED; | ||
878 | } | 874 | } |
879 | if (port->d_id && !(p_status & ZFCP_STATUS_COMMON_NOESC)) { | 875 | if (port->d_id && !(p_status & ZFCP_STATUS_COMMON_NOESC)) { |
880 | port->d_id = 0; | 876 | port->d_id = 0; |
@@ -889,19 +885,21 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act) | |||
889 | static int zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action) | 885 | static int zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action) |
890 | { | 886 | { |
891 | struct zfcp_port *port = erp_action->port; | 887 | struct zfcp_port *port = erp_action->port; |
888 | int p_status = atomic_read(&port->status); | ||
892 | 889 | ||
893 | if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_NOESC) | 890 | if ((p_status & ZFCP_STATUS_COMMON_NOESC) && |
891 | !(p_status & ZFCP_STATUS_COMMON_OPEN)) | ||
894 | goto close_init_done; | 892 | goto close_init_done; |
895 | 893 | ||
896 | switch (erp_action->step) { | 894 | switch (erp_action->step) { |
897 | case ZFCP_ERP_STEP_UNINITIALIZED: | 895 | case ZFCP_ERP_STEP_UNINITIALIZED: |
898 | zfcp_erp_port_strategy_clearstati(port); | 896 | zfcp_erp_port_strategy_clearstati(port); |
899 | if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_OPEN) | 897 | if (p_status & ZFCP_STATUS_COMMON_OPEN) |
900 | return zfcp_erp_port_strategy_close(erp_action); | 898 | return zfcp_erp_port_strategy_close(erp_action); |
901 | break; | 899 | break; |
902 | 900 | ||
903 | case ZFCP_ERP_STEP_PORT_CLOSING: | 901 | case ZFCP_ERP_STEP_PORT_CLOSING: |
904 | if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_OPEN) | 902 | if (p_status & ZFCP_STATUS_COMMON_OPEN) |
905 | return ZFCP_ERP_FAILED; | 903 | return ZFCP_ERP_FAILED; |
906 | break; | 904 | break; |
907 | } | 905 | } |
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 629edec70405..b3f28deb4505 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h | |||
@@ -96,6 +96,7 @@ extern int zfcp_fc_scan_ports(struct zfcp_adapter *); | |||
96 | extern void _zfcp_fc_scan_ports_later(struct work_struct *); | 96 | extern void _zfcp_fc_scan_ports_later(struct work_struct *); |
97 | extern void zfcp_fc_incoming_els(struct zfcp_fsf_req *); | 97 | extern void zfcp_fc_incoming_els(struct zfcp_fsf_req *); |
98 | extern void zfcp_fc_port_did_lookup(struct work_struct *); | 98 | extern void zfcp_fc_port_did_lookup(struct work_struct *); |
99 | extern void zfcp_fc_trigger_did_lookup(struct zfcp_port *); | ||
99 | extern void zfcp_fc_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *); | 100 | extern void zfcp_fc_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *); |
100 | extern void zfcp_fc_test_link(struct zfcp_port *); | 101 | extern void zfcp_fc_test_link(struct zfcp_port *); |
101 | extern void zfcp_fc_link_test_work(struct work_struct *); | 102 | extern void zfcp_fc_link_test_work(struct work_struct *); |
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index 722f22de8753..df23bcead23d 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c | |||
@@ -361,6 +361,17 @@ out: | |||
361 | } | 361 | } |
362 | 362 | ||
363 | /** | 363 | /** |
364 | * zfcp_fc_trigger_did_lookup - trigger the d_id lookup using a GID_PN request | ||
365 | * @port: The zfcp_port to lookup the d_id for. | ||
366 | */ | ||
367 | void zfcp_fc_trigger_did_lookup(struct zfcp_port *port) | ||
368 | { | ||
369 | zfcp_port_get(port); | ||
370 | if (!queue_work(port->adapter->work_queue, &port->gid_pn_work)) | ||
371 | zfcp_port_put(port); | ||
372 | } | ||
373 | |||
374 | /** | ||
364 | * zfcp_fc_plogi_evaluate - evaluate PLOGI playload | 375 | * zfcp_fc_plogi_evaluate - evaluate PLOGI playload |
365 | * @port: zfcp_port structure | 376 | * @port: zfcp_port structure |
366 | * @plogi: plogi payload | 377 | * @plogi: plogi payload |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 38a7e4a6b639..4e41baa0c141 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -1079,7 +1079,7 @@ static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req, | |||
1079 | /* common settings for ct/gs and els requests */ | 1079 | /* common settings for ct/gs and els requests */ |
1080 | req->qtcb->bottom.support.service_class = FSF_CLASS_3; | 1080 | req->qtcb->bottom.support.service_class = FSF_CLASS_3; |
1081 | req->qtcb->bottom.support.timeout = 2 * R_A_TOV; | 1081 | req->qtcb->bottom.support.timeout = 2 * R_A_TOV; |
1082 | zfcp_fsf_start_timer(req, 2 * R_A_TOV + 10); | 1082 | zfcp_fsf_start_timer(req, (2 * R_A_TOV + 10) * HZ); |
1083 | 1083 | ||
1084 | return 0; | 1084 | return 0; |
1085 | } | 1085 | } |
@@ -1475,9 +1475,16 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req) | |||
1475 | plogi = (struct fsf_plogi *) req->qtcb->bottom.support.els; | 1475 | plogi = (struct fsf_plogi *) req->qtcb->bottom.support.els; |
1476 | if (req->qtcb->bottom.support.els1_length >= | 1476 | if (req->qtcb->bottom.support.els1_length >= |
1477 | FSF_PLOGI_MIN_LEN) { | 1477 | FSF_PLOGI_MIN_LEN) { |
1478 | if (plogi->serv_param.wwpn != port->wwpn) | 1478 | if (plogi->serv_param.wwpn != port->wwpn) { |
1479 | port->d_id = 0; | 1479 | port->d_id = 0; |
1480 | else { | 1480 | dev_warn(&port->adapter->ccw_device->dev, |
1481 | "A port opened with WWPN 0x%016Lx " | ||
1482 | "returned data that identifies it as " | ||
1483 | "WWPN 0x%016Lx\n", | ||
1484 | (unsigned long long) port->wwpn, | ||
1485 | (unsigned long long) | ||
1486 | plogi->serv_param.wwpn); | ||
1487 | } else { | ||
1481 | port->wwnn = plogi->serv_param.wwnn; | 1488 | port->wwnn = plogi->serv_param.wwnn; |
1482 | zfcp_fc_plogi_evaluate(port, plogi); | 1489 | zfcp_fc_plogi_evaluate(port, plogi); |
1483 | } | 1490 | } |
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c index 079a8cf518a3..d31000886ca8 100644 --- a/drivers/s390/scsi/zfcp_sysfs.c +++ b/drivers/s390/scsi/zfcp_sysfs.c | |||
@@ -224,6 +224,7 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev, | |||
224 | 224 | ||
225 | zfcp_erp_unit_reopen(unit, 0, "syuas_1", NULL); | 225 | zfcp_erp_unit_reopen(unit, 0, "syuas_1", NULL); |
226 | zfcp_erp_wait(unit->port->adapter); | 226 | zfcp_erp_wait(unit->port->adapter); |
227 | flush_work(&unit->scsi_work); | ||
227 | zfcp_unit_put(unit); | 228 | zfcp_unit_put(unit); |
228 | out: | 229 | out: |
229 | mutex_unlock(&zfcp_data.config_mutex); | 230 | mutex_unlock(&zfcp_data.config_mutex); |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index b6af63ca980b..496764349c41 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -1918,6 +1918,10 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg) | |||
1918 | } | 1918 | } |
1919 | size = size>>16; | 1919 | size = size>>16; |
1920 | size *= 4; | 1920 | size *= 4; |
1921 | if (size > MAX_MESSAGE_SIZE) { | ||
1922 | rcode = -EINVAL; | ||
1923 | goto cleanup; | ||
1924 | } | ||
1921 | /* Copy in the user's I2O command */ | 1925 | /* Copy in the user's I2O command */ |
1922 | if (copy_from_user (msg, user_msg, size)) { | 1926 | if (copy_from_user (msg, user_msg, size)) { |
1923 | rcode = -EFAULT; | 1927 | rcode = -EFAULT; |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index c44783801402..0547a7f44d42 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -317,6 +317,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, | |||
317 | out_device_destroy: | 317 | out_device_destroy: |
318 | scsi_device_set_state(sdev, SDEV_DEL); | 318 | scsi_device_set_state(sdev, SDEV_DEL); |
319 | transport_destroy_device(&sdev->sdev_gendev); | 319 | transport_destroy_device(&sdev->sdev_gendev); |
320 | put_device(&sdev->sdev_dev); | ||
320 | put_device(&sdev->sdev_gendev); | 321 | put_device(&sdev->sdev_gendev); |
321 | out: | 322 | out: |
322 | if (display_failure_msg) | 323 | if (display_failure_msg) |
@@ -957,6 +958,7 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev) | |||
957 | if (sdev->host->hostt->slave_destroy) | 958 | if (sdev->host->hostt->slave_destroy) |
958 | sdev->host->hostt->slave_destroy(sdev); | 959 | sdev->host->hostt->slave_destroy(sdev); |
959 | transport_destroy_device(&sdev->sdev_gendev); | 960 | transport_destroy_device(&sdev->sdev_gendev); |
961 | put_device(&sdev->sdev_dev); | ||
960 | put_device(&sdev->sdev_gendev); | 962 | put_device(&sdev->sdev_gendev); |
961 | } | 963 | } |
962 | 964 | ||
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index fde54537d715..5c7eb63a19d1 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -864,10 +864,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
864 | goto clean_device; | 864 | goto clean_device; |
865 | } | 865 | } |
866 | 866 | ||
867 | /* take a reference for the sdev_dev; this is | ||
868 | * released by the sdev_class .release */ | ||
869 | get_device(&sdev->sdev_gendev); | ||
870 | |||
871 | /* create queue files, which may be writable, depending on the host */ | 867 | /* create queue files, which may be writable, depending on the host */ |
872 | if (sdev->host->hostt->change_queue_depth) | 868 | if (sdev->host->hostt->change_queue_depth) |
873 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw); | 869 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw); |
@@ -917,6 +913,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
917 | 913 | ||
918 | device_del(&sdev->sdev_gendev); | 914 | device_del(&sdev->sdev_gendev); |
919 | transport_destroy_device(&sdev->sdev_gendev); | 915 | transport_destroy_device(&sdev->sdev_gendev); |
916 | put_device(&sdev->sdev_dev); | ||
920 | put_device(&sdev->sdev_gendev); | 917 | put_device(&sdev->sdev_gendev); |
921 | 918 | ||
922 | return error; | 919 | return error; |
@@ -1065,7 +1062,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev) | |||
1065 | sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); | 1062 | sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); |
1066 | 1063 | ||
1067 | device_initialize(&sdev->sdev_dev); | 1064 | device_initialize(&sdev->sdev_dev); |
1068 | sdev->sdev_dev.parent = &sdev->sdev_gendev; | 1065 | sdev->sdev_dev.parent = get_device(&sdev->sdev_gendev); |
1069 | sdev->sdev_dev.class = &sdev_class; | 1066 | sdev->sdev_dev.class = &sdev_class; |
1070 | dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%d", | 1067 | dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%d", |
1071 | sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); | 1068 | sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index e7108e75653d..42e8550cd2b6 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -1561,11 +1561,16 @@ enum pci_board_num_t { | |||
1561 | pbn_exar_XR17C152, | 1561 | pbn_exar_XR17C152, |
1562 | pbn_exar_XR17C154, | 1562 | pbn_exar_XR17C154, |
1563 | pbn_exar_XR17C158, | 1563 | pbn_exar_XR17C158, |
1564 | pbn_exar_ibm_saturn, | ||
1564 | pbn_pasemi_1682M, | 1565 | pbn_pasemi_1682M, |
1565 | pbn_ni8430_2, | 1566 | pbn_ni8430_2, |
1566 | pbn_ni8430_4, | 1567 | pbn_ni8430_4, |
1567 | pbn_ni8430_8, | 1568 | pbn_ni8430_8, |
1568 | pbn_ni8430_16, | 1569 | pbn_ni8430_16, |
1570 | pbn_ADDIDATA_PCIe_1_3906250, | ||
1571 | pbn_ADDIDATA_PCIe_2_3906250, | ||
1572 | pbn_ADDIDATA_PCIe_4_3906250, | ||
1573 | pbn_ADDIDATA_PCIe_8_3906250, | ||
1569 | }; | 1574 | }; |
1570 | 1575 | ||
1571 | /* | 1576 | /* |
@@ -2146,6 +2151,13 @@ static struct pciserial_board pci_boards[] __devinitdata = { | |||
2146 | .base_baud = 921600, | 2151 | .base_baud = 921600, |
2147 | .uart_offset = 0x200, | 2152 | .uart_offset = 0x200, |
2148 | }, | 2153 | }, |
2154 | [pbn_exar_ibm_saturn] = { | ||
2155 | .flags = FL_BASE0, | ||
2156 | .num_ports = 1, | ||
2157 | .base_baud = 921600, | ||
2158 | .uart_offset = 0x200, | ||
2159 | }, | ||
2160 | |||
2149 | /* | 2161 | /* |
2150 | * PA Semi PWRficient PA6T-1682M on-chip UART | 2162 | * PA Semi PWRficient PA6T-1682M on-chip UART |
2151 | */ | 2163 | */ |
@@ -2185,6 +2197,37 @@ static struct pciserial_board pci_boards[] __devinitdata = { | |||
2185 | .uart_offset = 0x10, | 2197 | .uart_offset = 0x10, |
2186 | .first_offset = 0x800, | 2198 | .first_offset = 0x800, |
2187 | }, | 2199 | }, |
2200 | /* | ||
2201 | * ADDI-DATA GmbH PCI-Express communication cards <info@addi-data.com> | ||
2202 | */ | ||
2203 | [pbn_ADDIDATA_PCIe_1_3906250] = { | ||
2204 | .flags = FL_BASE0, | ||
2205 | .num_ports = 1, | ||
2206 | .base_baud = 3906250, | ||
2207 | .uart_offset = 0x200, | ||
2208 | .first_offset = 0x1000, | ||
2209 | }, | ||
2210 | [pbn_ADDIDATA_PCIe_2_3906250] = { | ||
2211 | .flags = FL_BASE0, | ||
2212 | .num_ports = 2, | ||
2213 | .base_baud = 3906250, | ||
2214 | .uart_offset = 0x200, | ||
2215 | .first_offset = 0x1000, | ||
2216 | }, | ||
2217 | [pbn_ADDIDATA_PCIe_4_3906250] = { | ||
2218 | .flags = FL_BASE0, | ||
2219 | .num_ports = 4, | ||
2220 | .base_baud = 3906250, | ||
2221 | .uart_offset = 0x200, | ||
2222 | .first_offset = 0x1000, | ||
2223 | }, | ||
2224 | [pbn_ADDIDATA_PCIe_8_3906250] = { | ||
2225 | .flags = FL_BASE0, | ||
2226 | .num_ports = 8, | ||
2227 | .base_baud = 3906250, | ||
2228 | .uart_offset = 0x200, | ||
2229 | .first_offset = 0x1000, | ||
2230 | }, | ||
2188 | }; | 2231 | }; |
2189 | 2232 | ||
2190 | static const struct pci_device_id softmodem_blacklist[] = { | 2233 | static const struct pci_device_id softmodem_blacklist[] = { |
@@ -2649,6 +2692,9 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
2649 | PCI_SUBVENDOR_ID_CONNECT_TECH, | 2692 | PCI_SUBVENDOR_ID_CONNECT_TECH, |
2650 | PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0, | 2693 | PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0, |
2651 | pbn_b0_8_1843200_200 }, | 2694 | pbn_b0_8_1843200_200 }, |
2695 | { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152, | ||
2696 | PCI_VENDOR_ID_IBM, PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT, | ||
2697 | 0, 0, pbn_exar_ibm_saturn }, | ||
2652 | 2698 | ||
2653 | { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530, | 2699 | { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530, |
2654 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 2700 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
@@ -3556,6 +3602,38 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
3556 | 0, | 3602 | 0, |
3557 | pbn_b0_8_115200 }, | 3603 | pbn_b0_8_115200 }, |
3558 | 3604 | ||
3605 | { PCI_VENDOR_ID_ADDIDATA, | ||
3606 | PCI_DEVICE_ID_ADDIDATA_APCIe7500, | ||
3607 | PCI_ANY_ID, | ||
3608 | PCI_ANY_ID, | ||
3609 | 0, | ||
3610 | 0, | ||
3611 | pbn_ADDIDATA_PCIe_4_3906250 }, | ||
3612 | |||
3613 | { PCI_VENDOR_ID_ADDIDATA, | ||
3614 | PCI_DEVICE_ID_ADDIDATA_APCIe7420, | ||
3615 | PCI_ANY_ID, | ||
3616 | PCI_ANY_ID, | ||
3617 | 0, | ||
3618 | 0, | ||
3619 | pbn_ADDIDATA_PCIe_2_3906250 }, | ||
3620 | |||
3621 | { PCI_VENDOR_ID_ADDIDATA, | ||
3622 | PCI_DEVICE_ID_ADDIDATA_APCIe7300, | ||
3623 | PCI_ANY_ID, | ||
3624 | PCI_ANY_ID, | ||
3625 | 0, | ||
3626 | 0, | ||
3627 | pbn_ADDIDATA_PCIe_1_3906250 }, | ||
3628 | |||
3629 | { PCI_VENDOR_ID_ADDIDATA, | ||
3630 | PCI_DEVICE_ID_ADDIDATA_APCIe7800, | ||
3631 | PCI_ANY_ID, | ||
3632 | PCI_ANY_ID, | ||
3633 | 0, | ||
3634 | 0, | ||
3635 | pbn_ADDIDATA_PCIe_8_3906250 }, | ||
3636 | |||
3559 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835, | 3637 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835, |
3560 | PCI_VENDOR_ID_IBM, 0x0299, | 3638 | PCI_VENDOR_ID_IBM, 0x0299, |
3561 | 0, 0, pbn_b0_bt_2_115200 }, | 3639 | 0, 0, pbn_b0_bt_2_115200 }, |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 3551c5cb7094..9d948bccafaf 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -1531,7 +1531,7 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev) | |||
1531 | void *data; | 1531 | void *data; |
1532 | int ret; | 1532 | int ret; |
1533 | 1533 | ||
1534 | BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); | 1534 | BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1)); |
1535 | 1535 | ||
1536 | port = &atmel_ports[pdev->id]; | 1536 | port = &atmel_ports[pdev->id]; |
1537 | port->backup_imr = 0; | 1537 | port->backup_imr = 0; |
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index d7bcd074d383..7ce9e9f567a3 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -705,7 +705,7 @@ mpc52xx_uart_verify_port(struct uart_port *port, struct serial_struct *ser) | |||
705 | return -EINVAL; | 705 | return -EINVAL; |
706 | 706 | ||
707 | if ((ser->irq != port->irq) || | 707 | if ((ser->irq != port->irq) || |
708 | (ser->io_type != SERIAL_IO_MEM) || | 708 | (ser->io_type != UPIO_MEM) || |
709 | (ser->baud_base != port->uartclk) || | 709 | (ser->baud_base != port->uartclk) || |
710 | (ser->iomem_base != (void *)port->mapbase) || | 710 | (ser->iomem_base != (void *)port->mapbase) || |
711 | (ser->hub6 != 0)) | 711 | (ser->hub6 != 0)) |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 33351312327f..a18e3c5dd82e 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -223,6 +223,7 @@ config USB_OTG | |||
223 | config USB_GADGET_PXA25X | 223 | config USB_GADGET_PXA25X |
224 | boolean "PXA 25x or IXP 4xx" | 224 | boolean "PXA 25x or IXP 4xx" |
225 | depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX | 225 | depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX |
226 | select USB_OTG_UTILS | ||
226 | help | 227 | help |
227 | Intel's PXA 25x series XScale ARM-5TE processors include | 228 | Intel's PXA 25x series XScale ARM-5TE processors include |
228 | an integrated full speed USB 1.1 device controller. The | 229 | an integrated full speed USB 1.1 device controller. The |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 4a1f1ebff7bf..28d9cf7cf72f 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -530,19 +530,22 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs, | |||
530 | err = PTR_ERR(vqs[i]); | 530 | err = PTR_ERR(vqs[i]); |
531 | goto error_find; | 531 | goto error_find; |
532 | } | 532 | } |
533 | |||
534 | if (!vp_dev->per_vq_vectors || msix_vec == VIRTIO_MSI_NO_VECTOR) | ||
535 | continue; | ||
536 | |||
533 | /* allocate per-vq irq if available and necessary */ | 537 | /* allocate per-vq irq if available and necessary */ |
534 | if (vp_dev->per_vq_vectors) { | 538 | snprintf(vp_dev->msix_names[msix_vec], |
535 | snprintf(vp_dev->msix_names[msix_vec], | 539 | sizeof *vp_dev->msix_names, |
536 | sizeof *vp_dev->msix_names, | 540 | "%s-%s", |
537 | "%s-%s", | 541 | dev_name(&vp_dev->vdev.dev), names[i]); |
538 | dev_name(&vp_dev->vdev.dev), names[i]); | 542 | err = request_irq(vp_dev->msix_entries[msix_vec].vector, |
539 | err = request_irq(msix_vec, vring_interrupt, 0, | 543 | vring_interrupt, 0, |
540 | vp_dev->msix_names[msix_vec], | 544 | vp_dev->msix_names[msix_vec], |
541 | vqs[i]); | 545 | vqs[i]); |
542 | if (err) { | 546 | if (err) { |
543 | vp_del_vq(vqs[i]); | 547 | vp_del_vq(vqs[i]); |
544 | goto error_find; | 548 | goto error_find; |
545 | } | ||
546 | } | 549 | } |
547 | } | 550 | } |
548 | return 0; | 551 | return 0; |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index f53600580726..fbd2ecde93e4 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -285,6 +285,9 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len) | |||
285 | return NULL; | 285 | return NULL; |
286 | } | 286 | } |
287 | 287 | ||
288 | /* Only get used array entries after they have been exposed by host. */ | ||
289 | rmb(); | ||
290 | |||
288 | i = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].id; | 291 | i = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].id; |
289 | *len = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].len; | 292 | *len = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].len; |
290 | 293 | ||