Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f34e924 authored by Glen Lee's avatar Glen Lee Committed by Greg Kroah-Hartman
Browse files

staging: wilc1000: linux_wlan_spi.c: return linux error value



return linux error value instead of 0 or 1 and use -EINVAL. Related codes
also changed together.

Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6d04d7a0
Loading
Loading
Loading
Loading
+3 −11
Original line number Original line Diff line number Diff line
@@ -104,13 +104,9 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
		dev_err(&spi->dev,
		dev_err(&spi->dev,
			"FAILED due to NULL buffer or ZERO length check the following length: %d\n",
			"FAILED due to NULL buffer or ZERO length check the following length: %d\n",
			len);
			len);
		ret = -1;
		ret = -EINVAL;
	}
	}


	/* change return value to match WILC interface */
	(ret < 0) ? (ret = 0) : (ret = 1);


	return ret;
	return ret;
}
}


@@ -148,10 +144,8 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
		dev_err(&spi->dev,
		dev_err(&spi->dev,
			"can't read data with the following length: %u\n",
			"can't read data with the following length: %u\n",
			rlen);
			rlen);
		ret = -1;
		ret = -EINVAL;
	}
	}
	/* change return value to match WILC interface */
	(ret < 0) ? (ret = 0) : (ret = 1);


	return ret;
	return ret;
}
}
@@ -185,10 +179,8 @@ int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
		dev_err(&spi->dev,
		dev_err(&spi->dev,
			"can't read data with the following length: %u\n",
			"can't read data with the following length: %u\n",
			rlen);
			rlen);
		ret = -1;
		ret = -EINVAL;
	}
	}
	/* change return value to match WILC interface */
	(ret < 0) ? (ret = 0) : (ret = 1);


	return ret;
	return ret;
}
}
+9 −9
Original line number Original line Diff line number Diff line
@@ -250,7 +250,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
	}
	}
	rix = len;
	rix = len;


	if (!wilc_spi_write_read(wilc, wb, rb, len2)) {
	if (wilc_spi_write_read(wilc, wb, rb, len2)) {
		dev_err(&spi->dev, "Failed cmd write, bus error...\n");
		dev_err(&spi->dev, "Failed cmd write, bus error...\n");
		result = N_FAIL;
		result = N_FAIL;
		return result;
		return result;
@@ -366,7 +366,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
				/**
				/**
				 * Read bytes
				 * Read bytes
				 **/
				 **/
				if (!wilc_spi_read(wilc, &b[ix], nbytes)) {
				if (wilc_spi_read(wilc, &b[ix], nbytes)) {
					dev_err(&spi->dev, "Failed data block read, bus error...\n");
					dev_err(&spi->dev, "Failed data block read, bus error...\n");
					result = N_FAIL;
					result = N_FAIL;
					goto _error_;
					goto _error_;
@@ -376,7 +376,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
				 * Read Crc
				 * Read Crc
				 **/
				 **/
				if (!g_spi.crc_off) {
				if (!g_spi.crc_off) {
					if (!wilc_spi_read(wilc, crc, 2)) {
					if (wilc_spi_read(wilc, crc, 2)) {
						dev_err(&spi->dev, "Failed data block crc read, bus error...\n");
						dev_err(&spi->dev, "Failed data block crc read, bus error...\n");
						result = N_FAIL;
						result = N_FAIL;
						goto _error_;
						goto _error_;
@@ -407,7 +407,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
				 **/
				 **/
				retry = 10;
				retry = 10;
				do {
				do {
					if (!wilc_spi_read(wilc, &rsp, 1)) {
					if (wilc_spi_read(wilc, &rsp, 1)) {
						dev_err(&spi->dev, "Failed data response read, bus error...\n");
						dev_err(&spi->dev, "Failed data response read, bus error...\n");
						result = N_FAIL;
						result = N_FAIL;
						break;
						break;
@@ -423,7 +423,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
				/**
				/**
				 * Read bytes
				 * Read bytes
				 **/
				 **/
				if (!wilc_spi_read(wilc, &b[ix], nbytes)) {
				if (wilc_spi_read(wilc, &b[ix], nbytes)) {
					dev_err(&spi->dev, "Failed data block read, bus error...\n");
					dev_err(&spi->dev, "Failed data block read, bus error...\n");
					result = N_FAIL;
					result = N_FAIL;
					break;
					break;
@@ -433,7 +433,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
				 * Read Crc
				 * Read Crc
				 **/
				 **/
				if (!g_spi.crc_off) {
				if (!g_spi.crc_off) {
					if (!wilc_spi_read(wilc, crc, 2)) {
					if (wilc_spi_read(wilc, crc, 2)) {
						dev_err(&spi->dev, "Failed data block crc read, bus error...\n");
						dev_err(&spi->dev, "Failed data block crc read, bus error...\n");
						result = N_FAIL;
						result = N_FAIL;
						break;
						break;
@@ -484,7 +484,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
				order = 0x2;
				order = 0x2;
		}
		}
		cmd |= order;
		cmd |= order;
		if (!wilc_spi_write(wilc, &cmd, 1)) {
		if (wilc_spi_write(wilc, &cmd, 1)) {
			dev_err(&spi->dev,
			dev_err(&spi->dev,
				"Failed data block cmd write, bus error...\n");
				"Failed data block cmd write, bus error...\n");
			result = N_FAIL;
			result = N_FAIL;
@@ -494,7 +494,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
		/**
		/**
		 *      Write data
		 *      Write data
		 **/
		 **/
		if (!wilc_spi_write(wilc, &b[ix], nbytes)) {
		if (wilc_spi_write(wilc, &b[ix], nbytes)) {
			dev_err(&spi->dev,
			dev_err(&spi->dev,
				"Failed data block write, bus error...\n");
				"Failed data block write, bus error...\n");
			result = N_FAIL;
			result = N_FAIL;
@@ -505,7 +505,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
		 *      Write Crc
		 *      Write Crc
		 **/
		 **/
		if (!g_spi.crc_off) {
		if (!g_spi.crc_off) {
			if (!wilc_spi_write(wilc, crc, 2)) {
			if (wilc_spi_write(wilc, crc, 2)) {
				dev_err(&spi->dev,"Failed data block crc write, bus error...\n");
				dev_err(&spi->dev,"Failed data block crc write, bus error...\n");
				result = N_FAIL;
				result = N_FAIL;
				break;
				break;