svn commit: r234492 - in stable/8/sys: dev/mmc dev/sdhci i386/conf

Marius Strobl marius at FreeBSD.org
Fri Apr 20 14:45:58 UTC 2012


Author: marius
Date: Fri Apr 20 14:45:57 2012
New Revision: 234492
URL: http://svn.freebsd.org/changeset/base/234492

Log:
  MFC: r222475
  
  Fix read_ivar implementation for MMC and SD.
  
  1. Both mmc_read_ivar() and sdhci_read_ivar() use the expression
  '*(int *)result = val' to assign to result which is uintptr_t *.
  This does not work on big-endian 64 bit systems.
  
  2. The media_size ivar is declared as 'off_t' which does not fit
  into uintptr_t in 32bit systems, change this to long.
  
  Submitted by:	kanthms at netlogicmicro com (initial version)
  
  PR:		134745

Modified:
  stable/8/sys/dev/mmc/mmc.c
  stable/8/sys/dev/mmc/mmcvar.h
  stable/8/sys/dev/sdhci/sdhci.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)
  stable/8/sys/i386/conf/XENHVM   (props changed)

Modified: stable/8/sys/dev/mmc/mmc.c
==============================================================================
--- stable/8/sys/dev/mmc/mmc.c	Fri Apr 20 14:29:45 2012	(r234491)
+++ stable/8/sys/dev/mmc/mmc.c	Fri Apr 20 14:45:57 2012	(r234492)
@@ -1445,37 +1445,37 @@ mmc_read_ivar(device_t bus, device_t chi
 	default:
 		return (EINVAL);
 	case MMC_IVAR_DSR_IMP:
-		*(int *)result = ivar->csd.dsr_imp;
+		*result = ivar->csd.dsr_imp;
 		break;
 	case MMC_IVAR_MEDIA_SIZE:
-		*(off_t *)result = ivar->sec_count;
+		*result = ivar->sec_count;
 		break;
 	case MMC_IVAR_RCA:
-		*(int *)result = ivar->rca;
+		*result = ivar->rca;
 		break;
 	case MMC_IVAR_SECTOR_SIZE:
-		*(int *)result = MMC_SECTOR_SIZE;
+		*result = MMC_SECTOR_SIZE;
 		break;
 	case MMC_IVAR_TRAN_SPEED:
-		*(int *)result = mmcbr_get_clock(bus);
+		*result = mmcbr_get_clock(bus);
 		break;
 	case MMC_IVAR_READ_ONLY:
-		*(int *)result = ivar->read_only;
+		*result = ivar->read_only;
 		break;
 	case MMC_IVAR_HIGH_CAP:
-		*(int *)result = ivar->high_cap;
+		*result = ivar->high_cap;
 		break;
 	case MMC_IVAR_CARD_TYPE:
-		*(int *)result = ivar->mode;
+		*result = ivar->mode;
 		break;
 	case MMC_IVAR_BUS_WIDTH:
-		*(int *)result = ivar->bus_width;
+		*result = ivar->bus_width;
 		break;
 	case MMC_IVAR_ERASE_SECTOR:
-		*(int *)result = ivar->erase_sector;
+		*result = ivar->erase_sector;
 		break;
 	case MMC_IVAR_MAX_DATA:
-		*(int *)result = mmcbr_get_max_data(bus);
+		*result = mmcbr_get_max_data(bus);
 		break;
 	}
 	return (0);

Modified: stable/8/sys/dev/mmc/mmcvar.h
==============================================================================
--- stable/8/sys/dev/mmc/mmcvar.h	Fri Apr 20 14:29:45 2012	(r234491)
+++ stable/8/sys/dev/mmc/mmcvar.h	Fri Apr 20 14:45:57 2012	(r234492)
@@ -79,7 +79,7 @@ enum mmc_device_ivars {
 	__BUS_ACCESSOR(mmc, var, MMC, ivar, type)
 
 MMC_ACCESSOR(dsr_imp, DSR_IMP, int)
-MMC_ACCESSOR(media_size, MEDIA_SIZE, off_t)
+MMC_ACCESSOR(media_size, MEDIA_SIZE, long)
 MMC_ACCESSOR(rca, RCA, int)
 MMC_ACCESSOR(sector_size, SECTOR_SIZE, int)
 MMC_ACCESSOR(tran_speed, TRAN_SPEED, int)

Modified: stable/8/sys/dev/sdhci/sdhci.c
==============================================================================
--- stable/8/sys/dev/sdhci/sdhci.c	Fri Apr 20 14:29:45 2012	(r234491)
+++ stable/8/sys/dev/sdhci/sdhci.c	Fri Apr 20 14:45:57 2012	(r234492)
@@ -1441,46 +1441,46 @@ sdhci_read_ivar(device_t bus, device_t c
 	default:
 		return (EINVAL);
 	case MMCBR_IVAR_BUS_MODE:
-		*(int *)result = slot->host.ios.bus_mode;
+		*result = slot->host.ios.bus_mode;
 		break;
 	case MMCBR_IVAR_BUS_WIDTH:
-		*(int *)result = slot->host.ios.bus_width;
+		*result = slot->host.ios.bus_width;
 		break;
 	case MMCBR_IVAR_CHIP_SELECT:
-		*(int *)result = slot->host.ios.chip_select;
+		*result = slot->host.ios.chip_select;
 		break;
 	case MMCBR_IVAR_CLOCK:
-		*(int *)result = slot->host.ios.clock;
+		*result = slot->host.ios.clock;
 		break;
 	case MMCBR_IVAR_F_MIN:
-		*(int *)result = slot->host.f_min;
+		*result = slot->host.f_min;
 		break;
 	case MMCBR_IVAR_F_MAX:
-		*(int *)result = slot->host.f_max;
+		*result = slot->host.f_max;
 		break;
 	case MMCBR_IVAR_HOST_OCR:
-		*(int *)result = slot->host.host_ocr;
+		*result = slot->host.host_ocr;
 		break;
 	case MMCBR_IVAR_MODE:
-		*(int *)result = slot->host.mode;
+		*result = slot->host.mode;
 		break;
 	case MMCBR_IVAR_OCR:
-		*(int *)result = slot->host.ocr;
+		*result = slot->host.ocr;
 		break;
 	case MMCBR_IVAR_POWER_MODE:
-		*(int *)result = slot->host.ios.power_mode;
+		*result = slot->host.ios.power_mode;
 		break;
 	case MMCBR_IVAR_VDD:
-		*(int *)result = slot->host.ios.vdd;
+		*result = slot->host.ios.vdd;
 		break;
 	case MMCBR_IVAR_CAPS:
-		*(int *)result = slot->host.caps;
+		*result = slot->host.caps;
 		break;
 	case MMCBR_IVAR_TIMING:
-		*(int *)result = slot->host.ios.timing;
+		*result = slot->host.ios.timing;
 		break;
 	case MMCBR_IVAR_MAX_DATA:
-		*(int *)result = 65535;
+		*result = 65535;
 		break;
 	}
 	return (0);


More information about the svn-src-stable-8 mailing list