diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-22 16:26:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-22 16:26:24 -0500 |
commit | 7f21739301bf894607f64cbb36add761fa4cb772 (patch) | |
tree | fa01b1ddacf030c5a01691578110b666f8e48bf1 | |
parent | 6d2d91b3e463a10a745616650066e28b42af649d (diff) | |
parent | b57f9f34e27bf81c97b10d6725d71824e448c37e (diff) |
Merge tag 'staging-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO fixes from Greg KH:
"Here are some staging and iio driver fixes for 4.4-rc2. All of these
are in response to issues that have been reported and have been in
linux-next for a while"
* tag 'staging-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
Revert "Staging: wilc1000: coreconfigurator: Drop unneeded wrapper functions"
iio: adc: xilinx: Fix VREFN scale
iio: si7020: Swap data byte order
iio: adc: vf610_adc: Fix division by zero error
iio:ad7793: Fix ad7785 product ID
iio: ad5064: Fix ad5629/ad5669 shift
iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success
iio: lpc32xx_adc: fix warnings caused by enabling unprepared clock
staging: iio: select IRQ_WORK for IIO_DUMMY_EVGEN
vf610_adc: Fix internal temperature calculation
-rw-r--r-- | drivers/iio/adc/ad7793.c | 2 | ||||
-rw-r--r-- | drivers/iio/adc/vf610_adc.c | 22 | ||||
-rw-r--r-- | drivers/iio/adc/xilinx-xadc-core.c | 1 | ||||
-rw-r--r-- | drivers/iio/dac/ad5064.c | 91 | ||||
-rw-r--r-- | drivers/iio/humidity/si7020.c | 8 | ||||
-rw-r--r-- | drivers/staging/iio/Kconfig | 3 | ||||
-rw-r--r-- | drivers/staging/iio/adc/lpc32xx_adc.c | 4 | ||||
-rw-r--r-- | drivers/staging/wilc1000/coreconfigurator.c | 48 |
8 files changed, 115 insertions, 64 deletions
diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c index eea0c79111e7..4d960d3b93c0 100644 --- a/drivers/iio/adc/ad7793.c +++ b/drivers/iio/adc/ad7793.c | |||
@@ -101,7 +101,7 @@ | |||
101 | #define AD7795_CH_AIN1M_AIN1M 8 /* AIN1(-) - AIN1(-) */ | 101 | #define AD7795_CH_AIN1M_AIN1M 8 /* AIN1(-) - AIN1(-) */ |
102 | 102 | ||
103 | /* ID Register Bit Designations (AD7793_REG_ID) */ | 103 | /* ID Register Bit Designations (AD7793_REG_ID) */ |
104 | #define AD7785_ID 0xB | 104 | #define AD7785_ID 0x3 |
105 | #define AD7792_ID 0xA | 105 | #define AD7792_ID 0xA |
106 | #define AD7793_ID 0xB | 106 | #define AD7793_ID 0xB |
107 | #define AD7794_ID 0xF | 107 | #define AD7794_ID 0xF |
diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index 599cde3d03a1..b10f629cc44b 100644 --- a/drivers/iio/adc/vf610_adc.c +++ b/drivers/iio/adc/vf610_adc.c | |||
@@ -106,6 +106,13 @@ | |||
106 | 106 | ||
107 | #define DEFAULT_SAMPLE_TIME 1000 | 107 | #define DEFAULT_SAMPLE_TIME 1000 |
108 | 108 | ||
109 | /* V at 25°C of 696 mV */ | ||
110 | #define VF610_VTEMP25_3V0 950 | ||
111 | /* V at 25°C of 699 mV */ | ||
112 | #define VF610_VTEMP25_3V3 867 | ||
113 | /* Typical sensor slope coefficient at all temperatures */ | ||
114 | #define VF610_TEMP_SLOPE_COEFF 1840 | ||
115 | |||
109 | enum clk_sel { | 116 | enum clk_sel { |
110 | VF610_ADCIOC_BUSCLK_SET, | 117 | VF610_ADCIOC_BUSCLK_SET, |
111 | VF610_ADCIOC_ALTCLK_SET, | 118 | VF610_ADCIOC_ALTCLK_SET, |
@@ -197,6 +204,8 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info) | |||
197 | adc_feature->clk_div = 8; | 204 | adc_feature->clk_div = 8; |
198 | } | 205 | } |
199 | 206 | ||
207 | adck_rate = ipg_rate / adc_feature->clk_div; | ||
208 | |||
200 | /* | 209 | /* |
201 | * Determine the long sample time adder value to be used based | 210 | * Determine the long sample time adder value to be used based |
202 | * on the default minimum sample time provided. | 211 | * on the default minimum sample time provided. |
@@ -221,7 +230,6 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info) | |||
221 | * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode | 230 | * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode |
222 | * LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles | 231 | * LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles |
223 | */ | 232 | */ |
224 | adck_rate = ipg_rate / info->adc_feature.clk_div; | ||
225 | for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++) | 233 | for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++) |
226 | info->sample_freq_avail[i] = | 234 | info->sample_freq_avail[i] = |
227 | adck_rate / (6 + vf610_hw_avgs[i] * | 235 | adck_rate / (6 + vf610_hw_avgs[i] * |
@@ -663,11 +671,13 @@ static int vf610_read_raw(struct iio_dev *indio_dev, | |||
663 | break; | 671 | break; |
664 | case IIO_TEMP: | 672 | case IIO_TEMP: |
665 | /* | 673 | /* |
666 | * Calculate in degree Celsius times 1000 | 674 | * Calculate in degree Celsius times 1000 |
667 | * Using sensor slope of 1.84 mV/°C and | 675 | * Using the typical sensor slope of 1.84 mV/°C |
668 | * V at 25°C of 696 mV | 676 | * and VREFH_ADC at 3.3V, V at 25°C of 699 mV |
669 | */ | 677 | */ |
670 | *val = 25000 - ((int)info->value - 864) * 1000000 / 1840; | 678 | *val = 25000 - ((int)info->value - VF610_VTEMP25_3V3) * |
679 | 1000000 / VF610_TEMP_SLOPE_COEFF; | ||
680 | |||
671 | break; | 681 | break; |
672 | default: | 682 | default: |
673 | mutex_unlock(&indio_dev->mlock); | 683 | mutex_unlock(&indio_dev->mlock); |
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index 0370624a35db..02e636a1c49a 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c | |||
@@ -841,6 +841,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev, | |||
841 | case XADC_REG_VCCINT: | 841 | case XADC_REG_VCCINT: |
842 | case XADC_REG_VCCAUX: | 842 | case XADC_REG_VCCAUX: |
843 | case XADC_REG_VREFP: | 843 | case XADC_REG_VREFP: |
844 | case XADC_REG_VREFN: | ||
844 | case XADC_REG_VCCBRAM: | 845 | case XADC_REG_VCCBRAM: |
845 | case XADC_REG_VCCPINT: | 846 | case XADC_REG_VCCPINT: |
846 | case XADC_REG_VCCPAUX: | 847 | case XADC_REG_VCCPAUX: |
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c index 9e4d2c18b554..81ca0081a019 100644 --- a/drivers/iio/dac/ad5064.c +++ b/drivers/iio/dac/ad5064.c | |||
@@ -113,12 +113,16 @@ enum ad5064_type { | |||
113 | ID_AD5065, | 113 | ID_AD5065, |
114 | ID_AD5628_1, | 114 | ID_AD5628_1, |
115 | ID_AD5628_2, | 115 | ID_AD5628_2, |
116 | ID_AD5629_1, | ||
117 | ID_AD5629_2, | ||
116 | ID_AD5648_1, | 118 | ID_AD5648_1, |
117 | ID_AD5648_2, | 119 | ID_AD5648_2, |
118 | ID_AD5666_1, | 120 | ID_AD5666_1, |
119 | ID_AD5666_2, | 121 | ID_AD5666_2, |
120 | ID_AD5668_1, | 122 | ID_AD5668_1, |
121 | ID_AD5668_2, | 123 | ID_AD5668_2, |
124 | ID_AD5669_1, | ||
125 | ID_AD5669_2, | ||
122 | }; | 126 | }; |
123 | 127 | ||
124 | static int ad5064_write(struct ad5064_state *st, unsigned int cmd, | 128 | static int ad5064_write(struct ad5064_state *st, unsigned int cmd, |
@@ -291,7 +295,7 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { | |||
291 | { }, | 295 | { }, |
292 | }; | 296 | }; |
293 | 297 | ||
294 | #define AD5064_CHANNEL(chan, addr, bits) { \ | 298 | #define AD5064_CHANNEL(chan, addr, bits, _shift) { \ |
295 | .type = IIO_VOLTAGE, \ | 299 | .type = IIO_VOLTAGE, \ |
296 | .indexed = 1, \ | 300 | .indexed = 1, \ |
297 | .output = 1, \ | 301 | .output = 1, \ |
@@ -303,36 +307,39 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { | |||
303 | .sign = 'u', \ | 307 | .sign = 'u', \ |
304 | .realbits = (bits), \ | 308 | .realbits = (bits), \ |
305 | .storagebits = 16, \ | 309 | .storagebits = 16, \ |
306 | .shift = 20 - bits, \ | 310 | .shift = (_shift), \ |
307 | }, \ | 311 | }, \ |
308 | .ext_info = ad5064_ext_info, \ | 312 | .ext_info = ad5064_ext_info, \ |
309 | } | 313 | } |
310 | 314 | ||
311 | #define DECLARE_AD5064_CHANNELS(name, bits) \ | 315 | #define DECLARE_AD5064_CHANNELS(name, bits, shift) \ |
312 | const struct iio_chan_spec name[] = { \ | 316 | const struct iio_chan_spec name[] = { \ |
313 | AD5064_CHANNEL(0, 0, bits), \ | 317 | AD5064_CHANNEL(0, 0, bits, shift), \ |
314 | AD5064_CHANNEL(1, 1, bits), \ | 318 | AD5064_CHANNEL(1, 1, bits, shift), \ |
315 | AD5064_CHANNEL(2, 2, bits), \ | 319 | AD5064_CHANNEL(2, 2, bits, shift), \ |
316 | AD5064_CHANNEL(3, 3, bits), \ | 320 | AD5064_CHANNEL(3, 3, bits, shift), \ |
317 | AD5064_CHANNEL(4, 4, bits), \ | 321 | AD5064_CHANNEL(4, 4, bits, shift), \ |
318 | AD5064_CHANNEL(5, 5, bits), \ | 322 | AD5064_CHANNEL(5, 5, bits, shift), \ |
319 | AD5064_CHANNEL(6, 6, bits), \ | 323 | AD5064_CHANNEL(6, 6, bits, shift), \ |
320 | AD5064_CHANNEL(7, 7, bits), \ | 324 | AD5064_CHANNEL(7, 7, bits, shift), \ |
321 | } | 325 | } |
322 | 326 | ||
323 | #define DECLARE_AD5065_CHANNELS(name, bits) \ | 327 | #define DECLARE_AD5065_CHANNELS(name, bits, shift) \ |
324 | const struct iio_chan_spec name[] = { \ | 328 | const struct iio_chan_spec name[] = { \ |
325 | AD5064_CHANNEL(0, 0, bits), \ | 329 | AD5064_CHANNEL(0, 0, bits, shift), \ |
326 | AD5064_CHANNEL(1, 3, bits), \ | 330 | AD5064_CHANNEL(1, 3, bits, shift), \ |
327 | } | 331 | } |
328 | 332 | ||
329 | static DECLARE_AD5064_CHANNELS(ad5024_channels, 12); | 333 | static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8); |
330 | static DECLARE_AD5064_CHANNELS(ad5044_channels, 14); | 334 | static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6); |
331 | static DECLARE_AD5064_CHANNELS(ad5064_channels, 16); | 335 | static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4); |
332 | 336 | ||
333 | static DECLARE_AD5065_CHANNELS(ad5025_channels, 12); | 337 | static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8); |
334 | static DECLARE_AD5065_CHANNELS(ad5045_channels, 14); | 338 | static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6); |
335 | static DECLARE_AD5065_CHANNELS(ad5065_channels, 16); | 339 | static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4); |
340 | |||
341 | static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4); | ||
342 | static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0); | ||
336 | 343 | ||
337 | static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | 344 | static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { |
338 | [ID_AD5024] = { | 345 | [ID_AD5024] = { |
@@ -382,6 +389,18 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | |||
382 | .channels = ad5024_channels, | 389 | .channels = ad5024_channels, |
383 | .num_channels = 8, | 390 | .num_channels = 8, |
384 | }, | 391 | }, |
392 | [ID_AD5629_1] = { | ||
393 | .shared_vref = true, | ||
394 | .internal_vref = 2500000, | ||
395 | .channels = ad5629_channels, | ||
396 | .num_channels = 8, | ||
397 | }, | ||
398 | [ID_AD5629_2] = { | ||
399 | .shared_vref = true, | ||
400 | .internal_vref = 5000000, | ||
401 | .channels = ad5629_channels, | ||
402 | .num_channels = 8, | ||
403 | }, | ||
385 | [ID_AD5648_1] = { | 404 | [ID_AD5648_1] = { |
386 | .shared_vref = true, | 405 | .shared_vref = true, |
387 | .internal_vref = 2500000, | 406 | .internal_vref = 2500000, |
@@ -418,6 +437,18 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | |||
418 | .channels = ad5064_channels, | 437 | .channels = ad5064_channels, |
419 | .num_channels = 8, | 438 | .num_channels = 8, |
420 | }, | 439 | }, |
440 | [ID_AD5669_1] = { | ||
441 | .shared_vref = true, | ||
442 | .internal_vref = 2500000, | ||
443 | .channels = ad5669_channels, | ||
444 | .num_channels = 8, | ||
445 | }, | ||
446 | [ID_AD5669_2] = { | ||
447 | .shared_vref = true, | ||
448 | .internal_vref = 5000000, | ||
449 | .channels = ad5669_channels, | ||
450 | .num_channels = 8, | ||
451 | }, | ||
421 | }; | 452 | }; |
422 | 453 | ||
423 | static inline unsigned int ad5064_num_vref(struct ad5064_state *st) | 454 | static inline unsigned int ad5064_num_vref(struct ad5064_state *st) |
@@ -597,10 +628,16 @@ static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, | |||
597 | unsigned int addr, unsigned int val) | 628 | unsigned int addr, unsigned int val) |
598 | { | 629 | { |
599 | struct i2c_client *i2c = to_i2c_client(st->dev); | 630 | struct i2c_client *i2c = to_i2c_client(st->dev); |
631 | int ret; | ||
600 | 632 | ||
601 | st->data.i2c[0] = (cmd << 4) | addr; | 633 | st->data.i2c[0] = (cmd << 4) | addr; |
602 | put_unaligned_be16(val, &st->data.i2c[1]); | 634 | put_unaligned_be16(val, &st->data.i2c[1]); |
603 | return i2c_master_send(i2c, st->data.i2c, 3); | 635 | |
636 | ret = i2c_master_send(i2c, st->data.i2c, 3); | ||
637 | if (ret < 0) | ||
638 | return ret; | ||
639 | |||
640 | return 0; | ||
604 | } | 641 | } |
605 | 642 | ||
606 | static int ad5064_i2c_probe(struct i2c_client *i2c, | 643 | static int ad5064_i2c_probe(struct i2c_client *i2c, |
@@ -616,12 +653,12 @@ static int ad5064_i2c_remove(struct i2c_client *i2c) | |||
616 | } | 653 | } |
617 | 654 | ||
618 | static const struct i2c_device_id ad5064_i2c_ids[] = { | 655 | static const struct i2c_device_id ad5064_i2c_ids[] = { |
619 | {"ad5629-1", ID_AD5628_1}, | 656 | {"ad5629-1", ID_AD5629_1}, |
620 | {"ad5629-2", ID_AD5628_2}, | 657 | {"ad5629-2", ID_AD5629_2}, |
621 | {"ad5629-3", ID_AD5628_2}, /* similar enough to ad5629-2 */ | 658 | {"ad5629-3", ID_AD5629_2}, /* similar enough to ad5629-2 */ |
622 | {"ad5669-1", ID_AD5668_1}, | 659 | {"ad5669-1", ID_AD5669_1}, |
623 | {"ad5669-2", ID_AD5668_2}, | 660 | {"ad5669-2", ID_AD5669_2}, |
624 | {"ad5669-3", ID_AD5668_2}, /* similar enough to ad5669-2 */ | 661 | {"ad5669-3", ID_AD5669_2}, /* similar enough to ad5669-2 */ |
625 | {} | 662 | {} |
626 | }; | 663 | }; |
627 | MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids); | 664 | MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids); |
diff --git a/drivers/iio/humidity/si7020.c b/drivers/iio/humidity/si7020.c index 12128d1ca570..71991b5c0658 100644 --- a/drivers/iio/humidity/si7020.c +++ b/drivers/iio/humidity/si7020.c | |||
@@ -50,10 +50,10 @@ static int si7020_read_raw(struct iio_dev *indio_dev, | |||
50 | 50 | ||
51 | switch (mask) { | 51 | switch (mask) { |
52 | case IIO_CHAN_INFO_RAW: | 52 | case IIO_CHAN_INFO_RAW: |
53 | ret = i2c_smbus_read_word_data(*client, | 53 | ret = i2c_smbus_read_word_swapped(*client, |
54 | chan->type == IIO_TEMP ? | 54 | chan->type == IIO_TEMP ? |
55 | SI7020CMD_TEMP_HOLD : | 55 | SI7020CMD_TEMP_HOLD : |
56 | SI7020CMD_RH_HOLD); | 56 | SI7020CMD_RH_HOLD); |
57 | if (ret < 0) | 57 | if (ret < 0) |
58 | return ret; | 58 | return ret; |
59 | *val = ret >> 2; | 59 | *val = ret >> 2; |
diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index 6d5b38d69578..9d7f0004d2d7 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig | |||
@@ -18,7 +18,8 @@ source "drivers/staging/iio/resolver/Kconfig" | |||
18 | source "drivers/staging/iio/trigger/Kconfig" | 18 | source "drivers/staging/iio/trigger/Kconfig" |
19 | 19 | ||
20 | config IIO_DUMMY_EVGEN | 20 | config IIO_DUMMY_EVGEN |
21 | tristate | 21 | tristate |
22 | select IRQ_WORK | ||
22 | 23 | ||
23 | config IIO_SIMPLE_DUMMY | 24 | config IIO_SIMPLE_DUMMY |
24 | tristate "An example driver with no hardware requirements" | 25 | tristate "An example driver with no hardware requirements" |
diff --git a/drivers/staging/iio/adc/lpc32xx_adc.c b/drivers/staging/iio/adc/lpc32xx_adc.c index d11c54b72186..b51f237cd817 100644 --- a/drivers/staging/iio/adc/lpc32xx_adc.c +++ b/drivers/staging/iio/adc/lpc32xx_adc.c | |||
@@ -76,7 +76,7 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev, | |||
76 | 76 | ||
77 | if (mask == IIO_CHAN_INFO_RAW) { | 77 | if (mask == IIO_CHAN_INFO_RAW) { |
78 | mutex_lock(&indio_dev->mlock); | 78 | mutex_lock(&indio_dev->mlock); |
79 | clk_enable(info->clk); | 79 | clk_prepare_enable(info->clk); |
80 | /* Measurement setup */ | 80 | /* Measurement setup */ |
81 | __raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm, | 81 | __raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm, |
82 | LPC32XX_ADC_SELECT(info->adc_base)); | 82 | LPC32XX_ADC_SELECT(info->adc_base)); |
@@ -84,7 +84,7 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev, | |||
84 | __raw_writel(AD_PDN_CTRL | AD_STROBE, | 84 | __raw_writel(AD_PDN_CTRL | AD_STROBE, |
85 | LPC32XX_ADC_CTRL(info->adc_base)); | 85 | LPC32XX_ADC_CTRL(info->adc_base)); |
86 | wait_for_completion(&info->completion); /* set by ISR */ | 86 | wait_for_completion(&info->completion); /* set by ISR */ |
87 | clk_disable(info->clk); | 87 | clk_disable_unprepare(info->clk); |
88 | *val = info->value; | 88 | *val = info->value; |
89 | mutex_unlock(&indio_dev->mlock); | 89 | mutex_unlock(&indio_dev->mlock); |
90 | 90 | ||
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index e10c6ffa698a..9568bdb6319b 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c | |||
@@ -13,12 +13,8 @@ | |||
13 | #include "wilc_wlan.h" | 13 | #include "wilc_wlan.h" |
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/etherdevice.h> | ||
17 | #define TAG_PARAM_OFFSET (MAC_HDR_LEN + TIME_STAMP_LEN + \ | 16 | #define TAG_PARAM_OFFSET (MAC_HDR_LEN + TIME_STAMP_LEN + \ |
18 | BEACON_INTERVAL_LEN + CAP_INFO_LEN) | 17 | BEACON_INTERVAL_LEN + CAP_INFO_LEN) |
19 | #define ADDR1 4 | ||
20 | #define ADDR2 10 | ||
21 | #define ADDR3 16 | ||
22 | 18 | ||
23 | /* Basic Frame Type Codes (2-bit) */ | 19 | /* Basic Frame Type Codes (2-bit) */ |
24 | enum basic_frame_type { | 20 | enum basic_frame_type { |
@@ -175,32 +171,38 @@ static inline u8 get_from_ds(u8 *header) | |||
175 | return ((header[1] & 0x02) >> 1); | 171 | return ((header[1] & 0x02) >> 1); |
176 | } | 172 | } |
177 | 173 | ||
174 | /* This function extracts the MAC Address in 'address1' field of the MAC */ | ||
175 | /* header and updates the MAC Address in the allocated 'addr' variable. */ | ||
176 | static inline void get_address1(u8 *pu8msa, u8 *addr) | ||
177 | { | ||
178 | memcpy(addr, pu8msa + 4, 6); | ||
179 | } | ||
180 | |||
181 | /* This function extracts the MAC Address in 'address2' field of the MAC */ | ||
182 | /* header and updates the MAC Address in the allocated 'addr' variable. */ | ||
183 | static inline void get_address2(u8 *pu8msa, u8 *addr) | ||
184 | { | ||
185 | memcpy(addr, pu8msa + 10, 6); | ||
186 | } | ||
187 | |||
188 | /* This function extracts the MAC Address in 'address3' field of the MAC */ | ||
189 | /* header and updates the MAC Address in the allocated 'addr' variable. */ | ||
190 | static inline void get_address3(u8 *pu8msa, u8 *addr) | ||
191 | { | ||
192 | memcpy(addr, pu8msa + 16, 6); | ||
193 | } | ||
194 | |||
178 | /* This function extracts the BSSID from the incoming WLAN packet based on */ | 195 | /* This function extracts the BSSID from the incoming WLAN packet based on */ |
179 | /* the 'from ds' bit, and updates the MAC Address in the allocated 'data' */ | 196 | /* the 'from ds' bit, and updates the MAC Address in the allocated 'addr' */ |
180 | /* variable. */ | 197 | /* variable. */ |
181 | static inline void get_BSSID(u8 *data, u8 *bssid) | 198 | static inline void get_BSSID(u8 *data, u8 *bssid) |
182 | { | 199 | { |
183 | if (get_from_ds(data) == 1) | 200 | if (get_from_ds(data) == 1) |
184 | /* | 201 | get_address2(data, bssid); |
185 | * Extract the MAC Address in 'address2' field of the MAC | ||
186 | * header and update the MAC Address in the allocated 'data' | ||
187 | * variable. | ||
188 | */ | ||
189 | ether_addr_copy(data, bssid + ADDR2); | ||
190 | else if (get_to_ds(data) == 1) | 202 | else if (get_to_ds(data) == 1) |
191 | /* | 203 | get_address1(data, bssid); |
192 | * Extract the MAC Address in 'address1' field of the MAC | ||
193 | * header and update the MAC Address in the allocated 'data' | ||
194 | * variable. | ||
195 | */ | ||
196 | ether_addr_copy(data, bssid + ADDR1); | ||
197 | else | 204 | else |
198 | /* | 205 | get_address3(data, bssid); |
199 | * Extract the MAC Address in 'address3' field of the MAC | ||
200 | * header and update the MAC Address in the allocated 'data' | ||
201 | * variable. | ||
202 | */ | ||
203 | ether_addr_copy(data, bssid + ADDR3); | ||
204 | } | 206 | } |
205 | 207 | ||
206 | /* This function extracts the SSID from a beacon/probe response frame */ | 208 | /* This function extracts the SSID from a beacon/probe response frame */ |