From f81197b8a31b8fb287ae57f597b5b6841e1ece92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= Date: Sun, 25 Jan 2015 18:28:19 +0200 Subject: iio: mxs-lradc: separate touchscreen and buffer virtual channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The touchscreen was initially designed [1] to map all of its physical channels to one virtual channel, leaving buffered capture to use the remaining 7 virtual channels. When the touchscreen was reimplemented [2], it was made to use four virtual channels, which overlap and conflict with the channels the buffer uses. As a result, when the buffer is enabled, the touchscreen's virtual channels are remapped to whichever physical channels the buffer was configured with, causing the touchscreen to read those instead of the touch measurement channels. Effectively the touchscreen stops working. So here we separate the channels again, giving the touchscreen 2 virtual channels and the buffer 6. We can't give the touchscreen just 1 channel as before, as the current pressure calculation requires 2 channels to be read at the same time. This makes the touchscreen continue to work during buffered capture. It has been tested on i.MX28, but not on i.MX23. [1] 06ddd353f5c8 ("iio: mxs: Implement support for touchscreen") [2] dee05308f602 ("Staging/iio/adc/touchscreen/MXS: add interrupt driven touch detection") Signed-off-by: Kristina Martšenko Reviewed-by: Marek Vasut Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 166 ++++++++++++++++-------------------- 1 file changed, 75 insertions(+), 91 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index f053535385bf..4e574b76ead0 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -214,11 +214,14 @@ struct mxs_lradc { unsigned long is_divided; /* - * Touchscreen LRADC channels receives a private slot in the CTRL4 - * register, the slot #7. Therefore only 7 slots instead of 8 in the - * CTRL4 register can be mapped to LRADC channels when using the - * touchscreen. - * + * When the touchscreen is enabled, we give it two private virtual + * channels: #6 and #7. This means that only 6 virtual channels (instead + * of 8) will be available for buffered capture. + */ +#define TOUCHSCREEN_VCHANNEL1 7 +#define TOUCHSCREEN_VCHANNEL2 6 + + /* * Furthermore, certain LRADC channels are shared between touchscreen * and/or touch-buttons and generic LRADC block. Therefore when using * either of these, these channels are not available for the regular @@ -342,6 +345,9 @@ struct mxs_lradc { #define LRADC_CTRL4 0x140 #define LRADC_CTRL4_LRADCSELECT_MASK(n) (0xf << ((n) * 4)) #define LRADC_CTRL4_LRADCSELECT_OFFSET(n) ((n) * 4) +#define LRADC_CTRL4_LRADCSELECT(n, x) \ + (((x) << LRADC_CTRL4_LRADCSELECT_OFFSET(n)) & \ + LRADC_CTRL4_LRADCSELECT_MASK(n)) #define LRADC_RESOLUTION 12 #define LRADC_SINGLE_SAMPLE_MASK ((1 << LRADC_RESOLUTION) - 1) @@ -416,6 +422,14 @@ static bool mxs_lradc_check_touch_event(struct mxs_lradc *lradc) LRADC_STATUS_TOUCH_DETECT_RAW); } +static void mxs_lradc_map_channel(struct mxs_lradc *lradc, unsigned vch, + unsigned ch) +{ + mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(vch), + LRADC_CTRL4); + mxs_lradc_reg_set(lradc, LRADC_CTRL4_LRADCSELECT(vch, ch), LRADC_CTRL4); +} + static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) { /* @@ -443,12 +457,8 @@ static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), LRADC_DELAY(3)); - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | - LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | - LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch), LRADC_CTRL1); - /* wake us again, when the complete conversion is done */ - mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch), LRADC_CTRL1); /* * after changing the touchscreen plates setting * the signals need some initial time to settle. Start the @@ -502,12 +512,8 @@ static void mxs_lradc_setup_ts_pressure(struct mxs_lradc *lradc, unsigned ch1, LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), LRADC_DELAY(3)); - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | - LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | - LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch2), LRADC_CTRL1); - /* wake us again, when the conversions are done */ - mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch2), LRADC_CTRL1); /* * after changing the touchscreen plates setting * the signals need some initial time to settle. Start the @@ -573,36 +579,6 @@ static unsigned mxs_lradc_read_ts_pressure(struct mxs_lradc *lradc, #define TS_CH_XM 4 #define TS_CH_YM 5 -static int mxs_lradc_read_ts_channel(struct mxs_lradc *lradc) -{ - u32 reg; - int val; - - reg = readl(lradc->base + LRADC_CTRL1); - - /* only channels 3 to 5 are of interest here */ - if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YP)) { - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YP) | - LRADC_CTRL1_LRADC_IRQ(TS_CH_YP), LRADC_CTRL1); - val = mxs_lradc_read_raw_channel(lradc, TS_CH_YP); - } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_XM)) { - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_XM) | - LRADC_CTRL1_LRADC_IRQ(TS_CH_XM), LRADC_CTRL1); - val = mxs_lradc_read_raw_channel(lradc, TS_CH_XM); - } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YM)) { - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YM) | - LRADC_CTRL1_LRADC_IRQ(TS_CH_YM), LRADC_CTRL1); - val = mxs_lradc_read_raw_channel(lradc, TS_CH_YM); - } else { - return -EIO; - } - - mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); - mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); - - return val; -} - /* * YP(open)--+-------------+ * | |--+ @@ -646,7 +622,8 @@ static void mxs_lradc_prepare_x_pos(struct mxs_lradc *lradc) mxs_lradc_reg_set(lradc, mxs_lradc_drive_x_plate(lradc), LRADC_CTRL0); lradc->cur_plate = LRADC_SAMPLE_X; - mxs_lradc_setup_ts_channel(lradc, TS_CH_YP); + mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YP); + mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); } /* @@ -667,7 +644,8 @@ static void mxs_lradc_prepare_y_pos(struct mxs_lradc *lradc) mxs_lradc_reg_set(lradc, mxs_lradc_drive_y_plate(lradc), LRADC_CTRL0); lradc->cur_plate = LRADC_SAMPLE_Y; - mxs_lradc_setup_ts_channel(lradc, TS_CH_XM); + mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_XM); + mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); } /* @@ -688,7 +666,10 @@ static void mxs_lradc_prepare_pressure(struct mxs_lradc *lradc) mxs_lradc_reg_set(lradc, mxs_lradc_drive_pressure(lradc), LRADC_CTRL0); lradc->cur_plate = LRADC_SAMPLE_PRESSURE; - mxs_lradc_setup_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); + mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YM); + mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL2, TS_CH_XP); + mxs_lradc_setup_ts_pressure(lradc, TOUCHSCREEN_VCHANNEL2, + TOUCHSCREEN_VCHANNEL1); } static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) @@ -701,6 +682,19 @@ static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); } +static void mxs_lradc_start_touch_event(struct mxs_lradc *lradc) +{ + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, + LRADC_CTRL1); + mxs_lradc_reg_set(lradc, + LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); + /* + * start with the Y-pos, because it uses nearly the same plate + * settings like the touch detection + */ + mxs_lradc_prepare_y_pos(lradc); +} + static void mxs_lradc_report_ts_event(struct mxs_lradc *lradc) { input_report_abs(lradc->ts_input, ABS_X, lradc->ts_x_pos); @@ -718,10 +712,12 @@ static void mxs_lradc_complete_touch_event(struct mxs_lradc *lradc) * start a dummy conversion to burn time to settle the signals * note: we are not interested in the conversion's value */ - mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(5)); - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); - mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(5), LRADC_CTRL1); - mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << 5) | + mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(TOUCHSCREEN_VCHANNEL1)); + mxs_lradc_reg_clear(lradc, + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); + mxs_lradc_reg_wrt(lradc, + LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) | LRADC_DELAY_KICK | LRADC_DELAY_DELAY(10), /* waste 5 ms */ LRADC_DELAY(2)); } @@ -753,59 +749,45 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid) /* if it is released, wait for the next touch via IRQ */ lradc->cur_plate = LRADC_TOUCH; - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); + mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); + mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ | + LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); } /* touchscreen's state machine */ static void mxs_lradc_handle_touch(struct mxs_lradc *lradc) { - int val; - switch (lradc->cur_plate) { case LRADC_TOUCH: - /* - * start with the Y-pos, because it uses nearly the same plate - * settings like the touch detection - */ - if (mxs_lradc_check_touch_event(lradc)) { - mxs_lradc_reg_clear(lradc, - LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, - LRADC_CTRL1); - mxs_lradc_prepare_y_pos(lradc); - } + if (mxs_lradc_check_touch_event(lradc)) + mxs_lradc_start_touch_event(lradc); mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); return; case LRADC_SAMPLE_Y: - val = mxs_lradc_read_ts_channel(lradc); - if (val < 0) { - mxs_lradc_enable_touch_detection(lradc); /* re-start */ - return; - } - lradc->ts_y_pos = val; + lradc->ts_y_pos = mxs_lradc_read_raw_channel(lradc, + TOUCHSCREEN_VCHANNEL1); mxs_lradc_prepare_x_pos(lradc); return; case LRADC_SAMPLE_X: - val = mxs_lradc_read_ts_channel(lradc); - if (val < 0) { - mxs_lradc_enable_touch_detection(lradc); /* re-start */ - return; - } - lradc->ts_x_pos = val; + lradc->ts_x_pos = mxs_lradc_read_raw_channel(lradc, + TOUCHSCREEN_VCHANNEL1); mxs_lradc_prepare_pressure(lradc); return; case LRADC_SAMPLE_PRESSURE: - lradc->ts_pressure = - mxs_lradc_read_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); + lradc->ts_pressure = mxs_lradc_read_ts_pressure(lradc, + TOUCHSCREEN_VCHANNEL2, + TOUCHSCREEN_VCHANNEL1); mxs_lradc_complete_touch_event(lradc); return; case LRADC_SAMPLE_VALID: - val = mxs_lradc_read_ts_channel(lradc); /* ignore the value */ mxs_lradc_finish_touch_event(lradc, 1); break; } @@ -1083,9 +1065,8 @@ static void mxs_lradc_disable_ts(struct mxs_lradc *lradc) { /* stop all interrupts from firing */ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN | - LRADC_CTRL1_LRADC_IRQ_EN(2) | LRADC_CTRL1_LRADC_IRQ_EN(3) | - LRADC_CTRL1_LRADC_IRQ_EN(4) | LRADC_CTRL1_LRADC_IRQ_EN(5), - LRADC_CTRL1); + LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | + LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); /* Power-down touchscreen touch-detect circuitry. */ mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0); @@ -1151,26 +1132,29 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data) struct iio_dev *iio = data; struct mxs_lradc *lradc = iio_priv(iio); unsigned long reg = readl(lradc->base + LRADC_CTRL1); + uint32_t clr_irq = mxs_lradc_irq_mask(lradc); const uint32_t ts_irq_mask = LRADC_CTRL1_TOUCH_DETECT_IRQ | - LRADC_CTRL1_LRADC_IRQ(2) | - LRADC_CTRL1_LRADC_IRQ(3) | - LRADC_CTRL1_LRADC_IRQ(4) | - LRADC_CTRL1_LRADC_IRQ(5); + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2); if (!(reg & mxs_lradc_irq_mask(lradc))) return IRQ_NONE; - if (lradc->use_touchscreen && (reg & ts_irq_mask)) + if (lradc->use_touchscreen && (reg & ts_irq_mask)) { mxs_lradc_handle_touch(lradc); + /* Make sure we don't clear the next conversion's interrupt. */ + clr_irq &= ~(LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2)); + } + if (iio_buffer_enabled(iio)) iio_trigger_poll(iio->trig); else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) complete(&lradc->completion); - mxs_lradc_reg_clear(lradc, reg & mxs_lradc_irq_mask(lradc), - LRADC_CTRL1); + mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1); return IRQ_HANDLED; } @@ -1346,7 +1330,7 @@ static bool mxs_lradc_validate_scan_mask(struct iio_dev *iio, if (lradc->use_touchbutton) rsvd_chans++; if (lradc->use_touchscreen) - rsvd_chans++; + rsvd_chans += 2; /* Test for attempts to map channels with special mode of operation. */ if (bitmap_intersects(mask, &rsvd_mask, LRADC_MAX_TOTAL_CHANS)) -- cgit v1.2.3 From 86bf7f3ef7e961e91e16dceb31ae0f583483b204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= Date: Sun, 25 Jan 2015 18:28:20 +0200 Subject: iio: mxs-lradc: make ADC reads not disable touchscreen interrupts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reading a channel through sysfs, or starting a buffered capture, will currently turn off the touchscreen. This is because the read_raw() and buffer preenable()/postdisable() callbacks disable interrupts for all LRADC channels, including those the touchscreen uses. So make the callbacks only disable interrupts for the channels they use. This means channel 0 for read_raw() and channels 0-5 for the buffer (if the touchscreen is enabled). Since the touchscreen uses different channels (6 and 7), it no longer gets turned off. Note that only i.MX28 is affected by this issue, i.MX23 should be fine. Signed-off-by: Kristina Martšenko Reviewed-by: Marek Vasut Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 4e574b76ead0..653af03bc69d 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -220,6 +220,9 @@ struct mxs_lradc { */ #define TOUCHSCREEN_VCHANNEL1 7 #define TOUCHSCREEN_VCHANNEL2 6 +#define BUFFER_VCHANS_LIMITED 0x3f +#define BUFFER_VCHANS_ALL 0xff + u8 buffer_vchans; /* * Furthermore, certain LRADC channels are shared between touchscreen @@ -819,7 +822,7 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) * used if doing raw sampling. */ if (lradc->soc == IMX28_LRADC) - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), LRADC_CTRL1); mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); @@ -1266,8 +1269,9 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio) } if (lradc->soc == IMX28_LRADC) - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, - LRADC_CTRL1); + mxs_lradc_reg_clear(lradc, + lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, + LRADC_CTRL1); mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) { @@ -1303,8 +1307,9 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio) mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); if (lradc->soc == IMX28_LRADC) - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, - LRADC_CTRL1); + mxs_lradc_reg_clear(lradc, + lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, + LRADC_CTRL1); kfree(lradc->buffer); mutex_unlock(&lradc->lock); @@ -1542,6 +1547,11 @@ static int mxs_lradc_probe(struct platform_device *pdev) touch_ret = mxs_lradc_probe_touchscreen(lradc, node); + if (touch_ret == 0) + lradc->buffer_vchans = BUFFER_VCHANS_LIMITED; + else + lradc->buffer_vchans = BUFFER_VCHANS_ALL; + /* Grab all IRQ sources */ for (i = 0; i < of_cfg->irq_count; i++) { lradc->irq[i] = platform_get_irq(pdev, i); -- cgit v1.2.3 From 6abe0300a1d5242f4ff89257197f284679af1a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= Date: Sun, 25 Jan 2015 18:28:21 +0200 Subject: iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reading a channel through sysfs, or starting a buffered capture, can occasionally turn off the touchscreen. This is because the read_raw() and buffer preenable()/postdisable() callbacks unschedule current conversions on all channels. If a delay channel happens to schedule a touchscreen conversion at the same time, the conversion gets cancelled and the touchscreen sequence stops. This is probably related to this note from the reference manual: "If a delay group schedules channels to be sampled and a manual write to the schedule field in CTRL0 occurs while the block is discarding samples, the LRADC will switch to the new schedule and will not sample the channels that were previously scheduled. The time window for this to happen is very small and lasts only while the LRADC is discarding samples." So make the callbacks only unschedule conversions for the channels they use. This means channel 0 for read_raw() and channels 0-5 for the buffer (if the touchscreen is enabled). Since the touchscreen uses different channels (6 and 7), it no longer gets turned off. This is tested and fixes the issue on i.MX28, but hasn't been tested on i.MX23. Signed-off-by: Kristina Martšenko Reviewed-by: Marek Vasut Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 653af03bc69d..d2e0c275bf4d 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -824,7 +824,7 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) if (lradc->soc == IMX28_LRADC) mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), LRADC_CTRL1); - mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); + mxs_lradc_reg_clear(lradc, 0x1, LRADC_CTRL0); /* Enable / disable the divider per requirement */ if (test_bit(chan, &lradc->is_divided)) @@ -1272,7 +1272,7 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio) mxs_lradc_reg_clear(lradc, lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, LRADC_CTRL1); - mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); + mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) { ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs); @@ -1305,7 +1305,7 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio) mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK | LRADC_DELAY_KICK, LRADC_DELAY(0)); - mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); + mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); if (lradc->soc == IMX28_LRADC) mxs_lradc_reg_clear(lradc, lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, -- cgit v1.2.3 From 89bb35e200bee745c539a96666e0792301ca40f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= Date: Sun, 25 Jan 2015 18:28:22 +0200 Subject: iio: mxs-lradc: only update the buffer when its conversions have finished MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using the touchscreen while running buffered capture results in the buffer reporting lots of wrong values, often just zeros. This is because we push readings to the buffer every time a touchscreen interrupt arrives, including when the buffer's own conversions have not yet finished. So let's only push to the buffer when its conversions are ready. Signed-off-by: Kristina Martšenko Reviewed-by: Marek Vasut Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index d2e0c275bf4d..ebcbd12d48b9 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -1152,10 +1152,12 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data) LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2)); } - if (iio_buffer_enabled(iio)) - iio_trigger_poll(iio->trig); - else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) + if (iio_buffer_enabled(iio)) { + if (reg & lradc->buffer_vchans) + iio_trigger_poll(iio->trig); + } else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) { complete(&lradc->completion); + } mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1); -- cgit v1.2.3 From f7067a5ad717d4dbb4faa3ec56744152f6ba97ad Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 23 Jan 2015 00:09:56 +0100 Subject: staging: iio: ad2s1200: Fix sign extension The line above makes vel a 12-bit quantity (st->rx[] is u8). The intention is to sign-extend vel using bit 11 as the sign bit. But because of C's promotion rules "vel = (vel << 4) >> 4;" is actually a no-op, since vel is promoted to int before the inner shift. sign_extend32 works equally well for 8 and 16 bits types, so use that. Signed-off-by: Rasmus Villemoes Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/staging/iio/resolver/ad2s1200.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c index 017d2f8379b7..c17893b4918c 100644 --- a/drivers/staging/iio/resolver/ad2s1200.c +++ b/drivers/staging/iio/resolver/ad2s1200.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -68,7 +69,7 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev, break; case IIO_ANGL_VEL: vel = (((s16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4); - vel = (vel << 4) >> 4; + vel = sign_extend32(vel, 11); *val = vel; break; default: -- cgit v1.2.3 From 03305e535cd5cdc1079b32909bf4b2dd67d46f7f Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sat, 3 Jan 2015 20:34:12 +0000 Subject: iio: mxs-lradc: fix iio channel map regression Since commit c8231a9af8147f8a ("iio: mxs-lradc: compute temperature from channel 8 and 9") with the removal of adc channel 9 there is no 1-1 mapping in the channel spec. All hwmon channel values above 9 are accessible via there index minus one. So add a hidden iio channel 9 to fix this issue. Signed-off-by: Stefan Wahren Acked-by: Alexandre Belloni Reviewed-by: Marek Vasut Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index ebcbd12d48b9..351339ccaad6 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -1397,6 +1397,13 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = { .channel = 8, .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,}, }, + /* Hidden channel to keep indexes */ + { + .type = IIO_TEMP, + .indexed = 1, + .scan_index = -1, + .channel = 9, + }, MXS_ADC_CHAN(10, IIO_VOLTAGE), /* VDDIO */ MXS_ADC_CHAN(11, IIO_VOLTAGE), /* VTH */ MXS_ADC_CHAN(12, IIO_VOLTAGE), /* VDDA */ -- cgit v1.2.3 From abe4e26bb7edb7b36ef99e2e78e86de79b18f922 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Fri, 2 Jan 2015 04:02:54 -0500 Subject: iio: meter: ade7754: add error handling in _reset and _stop_device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds the error handling for the value returned from ade7754_spi_read_reg_8. With this patch, the following randconfig warnings get fixed automatically. drivers/staging/iio/meter/ade7754.c:222:6: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/staging/iio/meter/ade7754.c:368:6: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Devendra Naga Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7754.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c index 81f67318974a..746b18894ebf 100644 --- a/drivers/staging/iio/meter/ade7754.c +++ b/drivers/staging/iio/meter/ade7754.c @@ -216,9 +216,13 @@ error_ret: static int ade7754_reset(struct device *dev) { + int ret; u8 val; - ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val); + ret = ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val); + if (ret < 0) + return ret; + val |= 1 << 6; /* Software Chip Reset */ return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val); } @@ -362,9 +366,16 @@ error_ret: /* Power down the device */ static int ade7754_stop_device(struct device *dev) { + int ret; u8 val; - ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val); + ret = ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val); + if (ret < 0) { + dev_err(dev, "unable to power down the device, error: %d", + ret); + return ret; + } + val |= 7 << 3; /* ADE7754 powered down */ return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val); } -- cgit v1.2.3 From 1e716a15ce5e5840cac0fb4cd6ca79d70d3568a9 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Fri, 2 Jan 2015 04:02:55 -0500 Subject: iio: meter: ade7759: add error handling in _reset and _stop_device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds the error handling for the value returned from ade7759_spi_read_reg_16. With this patch, the following randconfig warnings get fixed automatically. drivers/staging/iio/meter/ade7759.c:224:6: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/staging/iio/meter/ade7759.c:309:6: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Devendra Naga Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7759.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c index b0c7dbc8a428..9afdb1e1a222 100644 --- a/drivers/staging/iio/meter/ade7759.c +++ b/drivers/staging/iio/meter/ade7759.c @@ -218,9 +218,12 @@ static int ade7759_reset(struct device *dev) int ret; u16 val; - ade7759_spi_read_reg_16(dev, + ret = ade7759_spi_read_reg_16(dev, ADE7759_MODE, &val); + if (ret < 0) + return ret; + val |= 1 << 6; /* Software Chip Reset */ ret = ade7759_spi_write_reg_16(dev, ADE7759_MODE, @@ -301,11 +304,18 @@ error_ret: /* Power down the device */ static int ade7759_stop_device(struct device *dev) { + int ret; u16 val; - ade7759_spi_read_reg_16(dev, + ret = ade7759_spi_read_reg_16(dev, ADE7759_MODE, &val); + if (ret < 0) { + dev_err(dev, "unable to power down the device, error: %d\n", + ret); + return ret; + } + val |= 1 << 4; /* AD converters can be turned off */ return ade7759_spi_write_reg_16(dev, ADE7759_MODE, val); -- cgit v1.2.3 From 98a3d2e1d57611840b0c252e718f1fc7fb32b381 Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Sun, 8 Feb 2015 00:04:53 -0800 Subject: Staging:iio:hmc5843:Coding Style Correction Indentation corrections in struct initializations and one line over 80 characters split into two lines Signed-off-by: Tolga Ceylan Signed-off-by: Jonathan Cameron --- drivers/staging/iio/magnetometer/hmc5843_i2c.c | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843_i2c.c b/drivers/staging/iio/magnetometer/hmc5843_i2c.c index 6acd614cdbc6..e221a58a7673 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_i2c.c +++ b/drivers/staging/iio/magnetometer/hmc5843_i2c.c @@ -19,49 +19,49 @@ #include "hmc5843.h" static const struct regmap_range hmc5843_readable_ranges[] = { - regmap_reg_range(0, HMC5843_ID_END), + regmap_reg_range(0, HMC5843_ID_END), }; static struct regmap_access_table hmc5843_readable_table = { - .yes_ranges = hmc5843_readable_ranges, - .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges), + .yes_ranges = hmc5843_readable_ranges, + .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges), }; static const struct regmap_range hmc5843_writable_ranges[] = { - regmap_reg_range(0, HMC5843_MODE_REG), + regmap_reg_range(0, HMC5843_MODE_REG), }; static struct regmap_access_table hmc5843_writable_table = { - .yes_ranges = hmc5843_writable_ranges, - .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges), + .yes_ranges = hmc5843_writable_ranges, + .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges), }; static const struct regmap_range hmc5843_volatile_ranges[] = { - regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG), + regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG), }; static struct regmap_access_table hmc5843_volatile_table = { - .yes_ranges = hmc5843_volatile_ranges, - .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges), + .yes_ranges = hmc5843_volatile_ranges, + .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges), }; static struct regmap_config hmc5843_i2c_regmap_config = { - .reg_bits = 8, - .val_bits = 8, + .reg_bits = 8, + .val_bits = 8, - .rd_table = &hmc5843_readable_table, - .wr_table = &hmc5843_writable_table, - .volatile_table = &hmc5843_volatile_table, + .rd_table = &hmc5843_readable_table, + .wr_table = &hmc5843_writable_table, + .volatile_table = &hmc5843_volatile_table, - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_RBTREE, }; static int hmc5843_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { return hmc5843_common_probe(&client->dev, - devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config), - id->driver_data); + devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config), + id->driver_data); } static int hmc5843_i2c_remove(struct i2c_client *client) -- cgit v1.2.3 From c726aadd731de7b3cd2a0c2ceb2cc5ce9745c5ad Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Sat, 7 Feb 2015 23:40:33 -0800 Subject: Staging:iio:ade7854 Coding style correction Line over 80 characters corrected Signed-off-by: Tolga Ceylan Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7854-i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index 5b33c7f1aa91..5d0671a198fe 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -195,7 +195,8 @@ static int ade7854_i2c_read_reg_32(struct device *dev, if (ret) goto out; - *val = (st->rx[0] << 24) | (st->rx[1] << 16) | (st->rx[2] << 8) | st->rx[3]; + *val = (st->rx[0] << 24) | (st->rx[1] << 16) | + (st->rx[2] << 8) | st->rx[3]; out: mutex_unlock(&st->buf_lock); return ret; -- cgit v1.2.3 From 31a3dda6489dd68552e1e6af56abcf65405d6b5c Mon Sep 17 00:00:00 2001 From: Rickard Strandqvist Date: Tue, 27 Jan 2015 23:22:34 +0100 Subject: staging: iio: resolver: ad2s1210: Change type in printf format string Wrong type in printf format string, requires 'int' but the argument type is 'unsigned int' This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist Signed-off-by: Jonathan Cameron --- drivers/staging/iio/resolver/ad2s1210.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index b4c14ba5fdee..a8ecf87ef4a9 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -198,7 +198,7 @@ static ssize_t ad2s1210_show_fclkin(struct device *dev, { struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev)); - return sprintf(buf, "%d\n", st->fclkin); + return sprintf(buf, "%u\n", st->fclkin); } static ssize_t ad2s1210_store_fclkin(struct device *dev, @@ -237,7 +237,7 @@ static ssize_t ad2s1210_show_fexcit(struct device *dev, { struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev)); - return sprintf(buf, "%d\n", st->fexcit); + return sprintf(buf, "%u\n", st->fexcit); } static ssize_t ad2s1210_store_fexcit(struct device *dev, -- cgit v1.2.3 From e257a16e680a27ddc3dcbfc9fd39ad7f9d7ea135 Mon Sep 17 00:00:00 2001 From: Rickard Strandqvist Date: Tue, 27 Jan 2015 23:23:33 +0100 Subject: staging: iio: adc: mxs-lradc: Change type in printf format string Wrong type in printf format string, requires 'int' but the argument type is 'unsigned int' This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist Reviewed-by: Marek Vasut Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index d9d6fad7cb00..d5f8ea96f4bc 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -1008,7 +1008,7 @@ static ssize_t mxs_lradc_show_scale_available_ch(struct device *dev, int i, len = 0; for (i = 0; i < ARRAY_SIZE(lradc->scale_avail[ch]); i++) - len += sprintf(buf + len, "%d.%09u ", + len += sprintf(buf + len, "%u.%09u ", lradc->scale_avail[ch][i].integer, lradc->scale_avail[ch][i].nano); -- cgit v1.2.3 From 1a179a14d152467da7038205af52883f38973afe Mon Sep 17 00:00:00 2001 From: Rickard Strandqvist Date: Sun, 8 Feb 2015 19:22:54 +0100 Subject: staging: iio: trigger: iio-trig-periodic-rtc: Change frequency type to unsigned int Change struct iio_prtc_trigger_info frequency type from int to unsigned int. Since it is always treated as such in the driver so they type should probably reflect this. Signed-off-by: Rickard Strandqvist Signed-off-by: Jonathan Cameron --- drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c index a24caf73ae0b..89df1d32874d 100644 --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c @@ -24,7 +24,7 @@ static DEFINE_MUTEX(iio_prtc_trigger_list_lock); struct iio_prtc_trigger_info { struct rtc_device *rtc; - int frequency; + unsigned int frequency; struct rtc_task task; bool state; }; @@ -36,7 +36,7 @@ static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state) if (trig_info->frequency == 0 && state) return -EINVAL; - dev_dbg(&trig_info->rtc->dev, "trigger frequency is %d\n", + dev_dbg(&trig_info->rtc->dev, "trigger frequency is %u\n", trig_info->frequency); ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, state); if (ret == 0) @@ -62,10 +62,10 @@ static ssize_t iio_trig_periodic_write_freq(struct device *dev, { struct iio_trigger *trig = to_iio_trigger(dev); struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig); - int val; + unsigned int val; int ret; - ret = kstrtoint(buf, 10, &val); + ret = kstrtouint(buf, 10, &val); if (ret) goto error_ret; @@ -74,10 +74,8 @@ static ssize_t iio_trig_periodic_write_freq(struct device *dev, if (ret == 0 && trig_info->state && trig_info->frequency == 0) ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, 1); - } else if (val == 0) { - ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, 0); } else - ret = -EINVAL; + ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, 0); if (ret) goto error_ret; -- cgit v1.2.3 From 985d251b7e508b5358c38b456012c34dc031a95f Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Tue, 17 Feb 2015 02:44:42 +0530 Subject: Staging: dgnc: Indented code to increase readability Indented code and fixed checkpatch warning to enhance readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h index 465d79a6f75f..032e4a469b9a 100644 --- a/drivers/staging/dgnc/dgnc_cls.h +++ b/drivers/staging/dgnc/dgnc_cls.h @@ -36,9 +36,9 @@ ************************************************************************/ struct cls_uart_struct { - u8 txrx; /* WR RHR/THR - Holding Reg */ + u8 txrx; /* WR RHR/THR - Holding Reg */ u8 ier; /* WR IER - Interrupt Enable Reg */ - u8 isr_fcr; /* WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg */ + u8 isr_fcr; /* WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg */ u8 lcr; /* WR LCR - Line Control Reg */ u8 mcr; /* WR MCR - Modem Control Reg */ u8 lsr; /* WR LSR - Line Status Reg */ -- cgit v1.2.3 From 9e39ab27fbc30c4aba0db8799e63c92e57cd7d46 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Tue, 17 Feb 2015 00:10:44 +0530 Subject: Staging: dgnc: Removed trailing whitespace to improve readability. Removed trailing whitespaces to improve code readability and remove checkpatch warning. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index a8157eba28da..734bdc2be446 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -398,11 +398,11 @@ struct channel_t { /* * Our Global Variables. */ -extern uint dgnc_Major; /* Our driver/mgmt major */ -extern int dgnc_poll_tick; /* Poll interval - 20 ms */ -extern spinlock_t dgnc_global_lock; /* Driver global spinlock */ -extern uint dgnc_NumBoards; /* Total number of boards */ -extern struct dgnc_board *dgnc_Board[MAXBOARDS]; /* Array of board structs */ -extern char *dgnc_state_text[]; /* Array of state text */ +extern uint dgnc_Major; /* Our driver/mgmt major */ +extern int dgnc_poll_tick; /* Poll interval - 20 ms */ +extern spinlock_t dgnc_global_lock; /* Driver global spinlock */ +extern uint dgnc_NumBoards; /* Total number of boards */ +extern struct dgnc_board *dgnc_Board[MAXBOARDS]; /* Array of board structs */ +extern char *dgnc_state_text[]; /* Array of state text */ #endif -- cgit v1.2.3 From 371ec40392e2a774f4b6a637c30bf0d010607578 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Mon, 16 Feb 2015 20:25:03 +0530 Subject: Staging: dgnc: Fix warning of code style This patch fixes checkpatch.pl WARNING: Line longer than 80 chars. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index f177d3a258c2..ace2af67e593 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -606,7 +606,9 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) dgnc_create_ports_sysfiles(brd); /* init our poll helper tasklet */ - tasklet_init(&brd->helper_tasklet, brd->bd_ops->tasklet, (unsigned long) brd); + tasklet_init(&brd->helper_tasklet, + brd->bd_ops->tasklet, + (unsigned long) brd); spin_lock_irqsave(&dgnc_global_lock, flags); brd->msgbuf = NULL; -- cgit v1.2.3 From 4a0721bf84da588bec013220f74563add71c0bbe Mon Sep 17 00:00:00 2001 From: Tapasweni Pathak Date: Fri, 20 Feb 2015 18:43:53 +0530 Subject: staging: emxx_udc: Replace GFP_KERNEL with GFP_ATOMIC To avoid deadlock, do not call blocking functions with spinlocks held. Replace GFP_KERNEL with GFP_ATOMIC, as the latter will fail if the pile doesn't have enough free pages but will not sleep and hence deadlock can be avoided. Found by Coccinelle. Signed-off-by: Tapasweni Pathak Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 4be646ce8a12..6c1de2770e6a 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -2794,7 +2794,7 @@ static int nbu2ss_ep_queue( if (ep->virt_buf == NULL) ep->virt_buf = (u8 *)dma_alloc_coherent( NULL, PAGE_SIZE, - &ep->phys_buf, GFP_KERNEL | GFP_DMA); + &ep->phys_buf, GFP_ATOMIC | GFP_DMA); if (ep->epnum > 0) { if (ep->direct == USB_DIR_IN) memcpy(ep->virt_buf, req->req.buf, -- cgit v1.2.3 From ce5aebd67848fd319c61cfa5248be4a0ec5646c7 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Tue, 17 Feb 2015 20:20:54 +0530 Subject: Staging: emxx_udc: Convert from __attribute__((aligned(size))) to __aligned(size) This patch addresses the checkpatch.pl warning WARNING: __aligned(size) is preferred over __attribute__((aligned(size))) aligned(x) is a macro : #define __aligned(x) __attribute__((aligned(x))) Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h index 202e2dc72bba..6f90d5e3cd25 100644 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ b/drivers/staging/emxx_udc/emxx_udc.h @@ -535,7 +535,7 @@ typedef struct _T_FC_REGS { u8 Reserved1200[0x1000-0x200]; /* Reserved */ -} __attribute__ ((aligned(32))) T_FC_REGS, *PT_FC_REGS; +} __aligned(32) T_FC_REGS, *PT_FC_REGS; -- cgit v1.2.3 From 171c44fcbbf243a327cd2667a74b59b871489b91 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 17 Feb 2015 19:48:51 +0200 Subject: staging: fbtft: fix spacing errors This patch fixes the following checkpatch.pl errors for the file fb_bd663474.c: ERROR: space prohibited before that close parenthesis ')' ERROR: space prohibited after that open parenthesis '(' ERROR: space required after that ',' Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_bd663474.c | 100 ++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_bd663474.c b/drivers/staging/fbtft/fb_bd663474.c index 7e00c609c7fe..17a2162a7e5b 100644 --- a/drivers/staging/fbtft/fb_bd663474.c +++ b/drivers/staging/fbtft/fb_bd663474.c @@ -47,49 +47,49 @@ static int init_display(struct fbtft_par *par) /* Initialization sequence from Lib_UTFT */ /* oscillator start */ - write_reg(par, 0x000,0x0001); /*oscillator 0: stop, 1: operation */ + write_reg(par, 0x000, 0x0001); /*oscillator 0: stop, 1: operation */ mdelay(10); /* Power settings */ - write_reg(par, 0x100, 0x0000 ); /* power supply setup */ - write_reg(par, 0x101, 0x0000 ); - write_reg(par, 0x102, 0x3110 ); - write_reg(par, 0x103, 0xe200 ); - write_reg(par, 0x110, 0x009d ); - write_reg(par, 0x111, 0x0022 ); - write_reg(par, 0x100, 0x0120 ); - mdelay( 20 ); - - write_reg(par, 0x100, 0x3120 ); - mdelay( 80 ); + write_reg(par, 0x100, 0x0000); /* power supply setup */ + write_reg(par, 0x101, 0x0000); + write_reg(par, 0x102, 0x3110); + write_reg(par, 0x103, 0xe200); + write_reg(par, 0x110, 0x009d); + write_reg(par, 0x111, 0x0022); + write_reg(par, 0x100, 0x0120); + mdelay(20); + + write_reg(par, 0x100, 0x3120); + mdelay(80); /* Display control */ - write_reg(par, 0x001, 0x0100 ); - write_reg(par, 0x002, 0x0000 ); - write_reg(par, 0x003, 0x1230 ); - write_reg(par, 0x006, 0x0000 ); - write_reg(par, 0x007, 0x0101 ); - write_reg(par, 0x008, 0x0808 ); - write_reg(par, 0x009, 0x0000 ); - write_reg(par, 0x00b, 0x0000 ); - write_reg(par, 0x00c, 0x0000 ); - write_reg(par, 0x00d, 0x0018 ); + write_reg(par, 0x001, 0x0100); + write_reg(par, 0x002, 0x0000); + write_reg(par, 0x003, 0x1230); + write_reg(par, 0x006, 0x0000); + write_reg(par, 0x007, 0x0101); + write_reg(par, 0x008, 0x0808); + write_reg(par, 0x009, 0x0000); + write_reg(par, 0x00b, 0x0000); + write_reg(par, 0x00c, 0x0000); + write_reg(par, 0x00d, 0x0018); /* LTPS control settings */ - write_reg(par, 0x012, 0x0000 ); - write_reg(par, 0x013, 0x0000 ); - write_reg(par, 0x018, 0x0000 ); - write_reg(par, 0x019, 0x0000 ); - - write_reg(par, 0x203, 0x0000 ); - write_reg(par, 0x204, 0x0000 ); - - write_reg(par, 0x210, 0x0000 ); - write_reg(par, 0x211, 0x00ef ); - write_reg(par, 0x212, 0x0000 ); - write_reg(par, 0x213, 0x013f ); - write_reg(par, 0x214, 0x0000 ); - write_reg(par, 0x215, 0x0000 ); - write_reg(par, 0x216, 0x0000 ); - write_reg(par, 0x217, 0x0000 ); + write_reg(par, 0x012, 0x0000); + write_reg(par, 0x013, 0x0000); + write_reg(par, 0x018, 0x0000); + write_reg(par, 0x019, 0x0000); + + write_reg(par, 0x203, 0x0000); + write_reg(par, 0x204, 0x0000); + + write_reg(par, 0x210, 0x0000); + write_reg(par, 0x211, 0x00ef); + write_reg(par, 0x212, 0x0000); + write_reg(par, 0x213, 0x013f); + write_reg(par, 0x214, 0x0000); + write_reg(par, 0x215, 0x0000); + write_reg(par, 0x216, 0x0000); + write_reg(par, 0x217, 0x0000); /* Gray scale settings */ write_reg(par, 0x300, 0x5343); @@ -104,18 +104,18 @@ static int init_display(struct fbtft_par *par) write_reg(par, 0x309, 0x050a); /* RAM access settings */ - write_reg(par, 0x400, 0x4027 ); - write_reg(par, 0x401, 0x0000 ); - write_reg(par, 0x402, 0x0000 ); /* First screen drive position (1) */ - write_reg(par, 0x403, 0x013f ); /* First screen drive position (2) */ - write_reg(par, 0x404, 0x0000 ); - - write_reg(par, 0x200, 0x0000 ); - write_reg(par, 0x201, 0x0000 ); - write_reg(par, 0x100, 0x7120 ); - write_reg(par, 0x007, 0x0103 ); - mdelay( 10 ); - write_reg(par, 0x007, 0x0113 ); + write_reg(par, 0x400, 0x4027); + write_reg(par, 0x401, 0x0000); + write_reg(par, 0x402, 0x0000); /* First screen drive position (1) */ + write_reg(par, 0x403, 0x013f); /* First screen drive position (2) */ + write_reg(par, 0x404, 0x0000); + + write_reg(par, 0x200, 0x0000); + write_reg(par, 0x201, 0x0000); + write_reg(par, 0x100, 0x7120); + write_reg(par, 0x007, 0x0103); + mdelay(10); + write_reg(par, 0x007, 0x0113); return 0; } -- cgit v1.2.3 From 43da0d92ab7d05dd817bb6f3381629162bf25ecd Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 04:43:51 +0200 Subject: staging: fbtft: fix space prohibited before that ',' This patch fixes the following checkpatch.pl error: space prohibited before that ',' Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_ili9340.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_ili9340.c b/drivers/staging/fbtft/fb_ili9340.c index 985687d94ec2..c8698710e108 100644 --- a/drivers/staging/fbtft/fb_ili9340.c +++ b/drivers/staging/fbtft/fb_ili9340.c @@ -39,12 +39,12 @@ static int init_display(struct fbtft_par *par) par->fbtftops.reset(par); write_reg(par, 0xEF, 0x03, 0x80, 0x02); - write_reg(par, 0xCF, 0x00 , 0XC1 , 0X30); - write_reg(par, 0xED, 0x64 , 0x03 , 0X12 , 0X81); - write_reg(par, 0xE8, 0x85 , 0x00 , 0x78); - write_reg(par, 0xCB, 0x39 , 0x2C , 0x00 , 0x34 , 0x02); + write_reg(par, 0xCF, 0x00, 0XC1, 0X30); + write_reg(par, 0xED, 0x64, 0x03, 0X12, 0X81); + write_reg(par, 0xE8, 0x85, 0x00, 0x78); + write_reg(par, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02); write_reg(par, 0xF7, 0x20); - write_reg(par, 0xEA, 0x00 , 0x00); + write_reg(par, 0xEA, 0x00, 0x00); /* Power Control 1 */ write_reg(par, 0xC0, 0x23); -- cgit v1.2.3 From 15313309cbfe0ebba7f660677d2625abe27fb077 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Tue, 24 Feb 2015 10:41:48 +0100 Subject: staging:iio:hmc5843: Constify register tables and struct regmap_config The regmap_access_table and regmap_config structures may be const because they are not modified by the driver and regmap_init() accepts pointer to const. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Jonathan Cameron --- drivers/staging/iio/magnetometer/hmc5843_i2c.c | 8 ++++---- drivers/staging/iio/magnetometer/hmc5843_spi.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843_i2c.c b/drivers/staging/iio/magnetometer/hmc5843_i2c.c index e221a58a7673..2beff253bd0d 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_i2c.c +++ b/drivers/staging/iio/magnetometer/hmc5843_i2c.c @@ -22,7 +22,7 @@ static const struct regmap_range hmc5843_readable_ranges[] = { regmap_reg_range(0, HMC5843_ID_END), }; -static struct regmap_access_table hmc5843_readable_table = { +static const struct regmap_access_table hmc5843_readable_table = { .yes_ranges = hmc5843_readable_ranges, .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges), }; @@ -31,7 +31,7 @@ static const struct regmap_range hmc5843_writable_ranges[] = { regmap_reg_range(0, HMC5843_MODE_REG), }; -static struct regmap_access_table hmc5843_writable_table = { +static const struct regmap_access_table hmc5843_writable_table = { .yes_ranges = hmc5843_writable_ranges, .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges), }; @@ -40,12 +40,12 @@ static const struct regmap_range hmc5843_volatile_ranges[] = { regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG), }; -static struct regmap_access_table hmc5843_volatile_table = { +static const struct regmap_access_table hmc5843_volatile_table = { .yes_ranges = hmc5843_volatile_ranges, .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges), }; -static struct regmap_config hmc5843_i2c_regmap_config = { +static const struct regmap_config hmc5843_i2c_regmap_config = { .reg_bits = 8, .val_bits = 8, diff --git a/drivers/staging/iio/magnetometer/hmc5843_spi.c b/drivers/staging/iio/magnetometer/hmc5843_spi.c index 98c4b57101c9..8e658f736e1f 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_spi.c +++ b/drivers/staging/iio/magnetometer/hmc5843_spi.c @@ -19,7 +19,7 @@ static const struct regmap_range hmc5843_readable_ranges[] = { regmap_reg_range(0, HMC5843_ID_END), }; -static struct regmap_access_table hmc5843_readable_table = { +static const struct regmap_access_table hmc5843_readable_table = { .yes_ranges = hmc5843_readable_ranges, .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges), }; @@ -28,7 +28,7 @@ static const struct regmap_range hmc5843_writable_ranges[] = { regmap_reg_range(0, HMC5843_MODE_REG), }; -static struct regmap_access_table hmc5843_writable_table = { +static const struct regmap_access_table hmc5843_writable_table = { .yes_ranges = hmc5843_writable_ranges, .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges), }; @@ -37,12 +37,12 @@ static const struct regmap_range hmc5843_volatile_ranges[] = { regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG), }; -static struct regmap_access_table hmc5843_volatile_table = { +static const struct regmap_access_table hmc5843_volatile_table = { .yes_ranges = hmc5843_volatile_ranges, .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges), }; -static struct regmap_config hmc5843_spi_regmap_config = { +static const struct regmap_config hmc5843_spi_regmap_config = { .reg_bits = 8, .val_bits = 8, -- cgit v1.2.3 From 17ca290e25e6c2056dbf8a6fe0a146c191f10689 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 17 Feb 2015 20:34:18 +0200 Subject: staging: lustre: ldlm: remove commented call to LBUG This patch removes a commented call to LBUG since lustre should be cleaned out of debugging macros before moving out of staging. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 287da325d928..53226b8fff63 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -1779,7 +1779,6 @@ int ldlm_cancel_resource_local(struct ldlm_resource *res, if (opaque != NULL && lock->l_ast_data != opaque) { LDLM_ERROR(lock, "data %p doesn't match opaque %p", lock->l_ast_data, opaque); - //LBUG(); continue; } -- cgit v1.2.3 From d501e5641a44ac8bd4e1c2da28bf4b7fea63653f Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Thu, 19 Feb 2015 22:25:40 +0200 Subject: Staging: lustre: include: linux: libcfs: Remove spaces at the start of a line This patch fixes checpatch.pl warning WARNING: please, no spaces at the start of a line Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 808e49411a30..4dcae612946f 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -469,7 +469,7 @@ cfs_hash_key(struct cfs_hash *hs, struct hlist_node *hnode) static inline void cfs_hash_keycpy(struct cfs_hash *hs, struct hlist_node *hnode, void *key) { - if (hs->hs_ops->hs_keycpy) + if (hs->hs_ops->hs_keycpy) hs->hs_ops->hs_keycpy(hnode, key); } -- cgit v1.2.3 From 95c3fe337b0c9e3a848be2c2778cbe028325d633 Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 19 Feb 2015 23:06:46 +0200 Subject: Staging: lustre: lnet: add spaces around '||' This fixes the checkpatch.pl error in conctl.c: ERROR: spaces required around that '||' (ctx:VxE) Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/conctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index fbff84cea52f..371a54df4f2f 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -203,7 +203,7 @@ lst_group_add_ioctl(lstio_group_add_args_t *args) if (args->lstio_grp_key != console_session.ses_key) return -EACCES; - if (args->lstio_grp_namep == NULL|| + if (args->lstio_grp_namep == NULL || args->lstio_grp_nmlen <= 0 || args->lstio_grp_nmlen > LST_NAME_SIZE) return -EINVAL; -- cgit v1.2.3 From 2aa53ff69e32ac3b53bf554bec0af88a6805b41a Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 20 Feb 2015 15:23:18 +0200 Subject: Staging: lustre: lnet: klnds: o2iblnd: Remove intialization of static to 0 ERROR: do not initialise statics to 0 or NULL checkpatch.pl error in o2iblnd_modparams.c initial value unassigned static variables are automatically set to zero. so it is unnecessary to assign the initial value to zero Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c index 8b4a8e9a29b4..8036d8b18be7 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c @@ -44,7 +44,7 @@ static int service = 987; module_param(service, int, 0444); MODULE_PARM_DESC(service, "service number (within RDMA_PS_TCP)"); -static int cksum = 0; +static int cksum; module_param(cksum, int, 0644); MODULE_PARM_DESC(cksum, "set non-zero to enable message (not RDMA) checksums"); @@ -72,11 +72,11 @@ static int peer_credits = 8; module_param(peer_credits, int, 0444); MODULE_PARM_DESC(peer_credits, "# concurrent sends to 1 peer"); -static int peer_credits_hiw = 0; +static int peer_credits_hiw; module_param(peer_credits_hiw, int, 0444); MODULE_PARM_DESC(peer_credits_hiw, "when eagerly to return credits"); -static int peer_buffer_credits = 0; +static int peer_buffer_credits; module_param(peer_buffer_credits, int, 0444); MODULE_PARM_DESC(peer_buffer_credits, "# per-peer router buffer credits"); @@ -100,15 +100,15 @@ static int keepalive = 100; module_param(keepalive, int, 0644); MODULE_PARM_DESC(keepalive, "Idle time in seconds before sending a keepalive"); -static int ib_mtu = 0; +static int ib_mtu; module_param(ib_mtu, int, 0444); MODULE_PARM_DESC(ib_mtu, "IB MTU 256/512/1024/2048/4096"); -static int concurrent_sends = 0; +static int concurrent_sends; module_param(concurrent_sends, int, 0444); MODULE_PARM_DESC(concurrent_sends, "send work-queue sizing"); -static int map_on_demand = 0; +static int map_on_demand; module_param(map_on_demand, int, 0444); MODULE_PARM_DESC(map_on_demand, "map on demand"); @@ -136,12 +136,12 @@ MODULE_PARM_DESC(pmr_pool_size, "size of MR cache pmr pool on each CPT"); * 1: enable failover if necessary * 2: force to failover (for debug) */ -static int dev_failover = 0; +static int dev_failover; module_param(dev_failover, int, 0444); MODULE_PARM_DESC(dev_failover, "HCA failover for bonding (0 off, 1 on, other values reserved)"); -static int require_privileged_port = 0; +static int require_privileged_port; module_param(require_privileged_port, int, 0644); MODULE_PARM_DESC(require_privileged_port, "require privileged port when accepting connection"); -- cgit v1.2.3 From b656d5fd7eedf210e8166bb8c63e0ac8b157a4b5 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 20 Feb 2015 15:35:30 +0200 Subject: Staging: lustre: lnet: klnds: o2iblnd: Deleted space prohibited between function name and open parenthesis WARNING: space prohibited between function name and open parenthesis '(' checkpatch.pl warning in o2iblnd_modparams.c Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c index 8036d8b18be7..eedf01afd57f 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c @@ -177,7 +177,7 @@ kib_tunables_t kiblnd_tunables = { }; int -kiblnd_tunables_init (void) +kiblnd_tunables_init(void) { if (kiblnd_translate_mtu(*kiblnd_tunables.kib_ib_mtu) < 0) { CERROR("Invalid ib_mtu %d, expected 256/512/1024/2048/4096\n", -- cgit v1.2.3 From b15a85fc494d5d18fa190585f7f6db50bb054d98 Mon Sep 17 00:00:00 2001 From: Gulsah Kose Date: Sun, 22 Feb 2015 05:08:04 +0200 Subject: staging: lustre: lnet: klnds: o2iblnd: Removed unnecessary spaces. Removed unnecessary spaces between function name and open parenthesis '('. Removed following checkpatch.pl warnings: WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Gulsah Kose Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 208 ++++++++++----------- 1 file changed, 104 insertions(+), 104 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 651016919669..64d5ea349a76 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -147,7 +147,7 @@ kiblnd_unpack_rd(kib_msg_t *msg, int flip) int n; int i; - LASSERT (msg->ibm_type == IBLND_MSG_GET_REQ || + LASSERT(msg->ibm_type == IBLND_MSG_GET_REQ || msg->ibm_type == IBLND_MSG_PUT_ACK); rd = msg->ibm_type == IBLND_MSG_GET_REQ ? @@ -167,7 +167,7 @@ kiblnd_unpack_rd(kib_msg_t *msg, int flip) return 1; } - nob = offsetof (kib_msg_t, ibm_u) + + nob = offsetof(kib_msg_t, ibm_u) + kiblnd_rd_msg_size(rd, msg->ibm_type, n); if (msg->ibm_nob < nob) { @@ -188,7 +188,7 @@ kiblnd_unpack_rd(kib_msg_t *msg, int flip) } void -kiblnd_pack_msg (lnet_ni_t *ni, kib_msg_t *msg, int version, +kiblnd_pack_msg(lnet_ni_t *ni, kib_msg_t *msg, int version, int credits, lnet_nid_t dstnid, __u64 dststamp) { kib_net_t *net = ni->ni_data; @@ -269,8 +269,8 @@ kiblnd_unpack_msg(kib_msg_t *msg, int nob) if (flip) { /* leave magic unflipped as a clue to peer endianness */ msg->ibm_version = version; - CLASSERT (sizeof(msg->ibm_type) == 1); - CLASSERT (sizeof(msg->ibm_credits) == 1); + CLASSERT(sizeof(msg->ibm_type) == 1); + CLASSERT(sizeof(msg->ibm_credits) == 1); msg->ibm_nob = msg_nob; __swab64s(&msg->ibm_srcnid); __swab64s(&msg->ibm_srcstamp); @@ -356,7 +356,7 @@ kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid) write_lock_irqsave(&kiblnd_data.kib_global_lock, flags); /* always called with a ref on ni, which prevents ni being shutdown */ - LASSERT (net->ibn_shutdown == 0); + LASSERT(net->ibn_shutdown == 0); /* npeers only grows with the global lock held */ atomic_inc(&net->ibn_npeers); @@ -368,17 +368,17 @@ kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid) } void -kiblnd_destroy_peer (kib_peer_t *peer) +kiblnd_destroy_peer(kib_peer_t *peer) { kib_net_t *net = peer->ibp_ni->ni_data; - LASSERT (net != NULL); - LASSERT (atomic_read(&peer->ibp_refcount) == 0); - LASSERT (!kiblnd_peer_active(peer)); - LASSERT (peer->ibp_connecting == 0); - LASSERT (peer->ibp_accepting == 0); - LASSERT (list_empty(&peer->ibp_conns)); - LASSERT (list_empty(&peer->ibp_tx_queue)); + LASSERT(net != NULL); + LASSERT(atomic_read(&peer->ibp_refcount) == 0); + LASSERT(!kiblnd_peer_active(peer)); + LASSERT(peer->ibp_connecting == 0); + LASSERT(peer->ibp_accepting == 0); + LASSERT(list_empty(&peer->ibp_conns)); + LASSERT(list_empty(&peer->ibp_tx_queue)); LIBCFS_FREE(peer, sizeof(*peer)); @@ -390,7 +390,7 @@ kiblnd_destroy_peer (kib_peer_t *peer) } kib_peer_t * -kiblnd_find_peer_locked (lnet_nid_t nid) +kiblnd_find_peer_locked(lnet_nid_t nid) { /* the caller is responsible for accounting the additional reference * that this creates */ @@ -398,11 +398,11 @@ kiblnd_find_peer_locked (lnet_nid_t nid) struct list_head *tmp; kib_peer_t *peer; - list_for_each (tmp, peer_list) { + list_for_each(tmp, peer_list) { peer = list_entry(tmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || /* creating conns */ + LASSERT(peer->ibp_connecting > 0 || /* creating conns */ peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); /* active conn */ @@ -419,11 +419,11 @@ kiblnd_find_peer_locked (lnet_nid_t nid) } void -kiblnd_unlink_peer_locked (kib_peer_t *peer) +kiblnd_unlink_peer_locked(kib_peer_t *peer) { - LASSERT (list_empty(&peer->ibp_conns)); + LASSERT(list_empty(&peer->ibp_conns)); - LASSERT (kiblnd_peer_active(peer)); + LASSERT(kiblnd_peer_active(peer)); list_del_init(&peer->ibp_list); /* lose peerlist's ref */ kiblnd_peer_decref(peer); @@ -442,10 +442,10 @@ kiblnd_get_peer_info(lnet_ni_t *ni, int index, for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { - list_for_each (ptmp, &kiblnd_data.kib_peers[i]) { + list_for_each(ptmp, &kiblnd_data.kib_peers[i]) { peer = list_entry(ptmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || + LASSERT(peer->ibp_connecting > 0 || peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); @@ -478,7 +478,7 @@ kiblnd_del_peer_locked(kib_peer_t *peer) if (list_empty(&peer->ibp_conns)) { kiblnd_unlink_peer_locked(peer); } else { - list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { + list_for_each_safe(ctmp, cnxt, &peer->ibp_conns) { conn = list_entry(ctmp, kib_conn_t, ibc_list); kiblnd_close_conn_locked(conn, 0); @@ -492,7 +492,7 @@ kiblnd_del_peer_locked(kib_peer_t *peer) static int kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); struct list_head *ptmp; struct list_head *pnxt; kib_peer_t *peer; @@ -512,9 +512,9 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) } for (i = lo; i <= hi; i++) { - list_for_each_safe (ptmp, pnxt, &kiblnd_data.kib_peers[i]) { + list_for_each_safe(ptmp, pnxt, &kiblnd_data.kib_peers[i]) { peer = list_entry(ptmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || + LASSERT(peer->ibp_connecting > 0 || peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); @@ -525,7 +525,7 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) continue; if (!list_empty(&peer->ibp_tx_queue)) { - LASSERT (list_empty(&peer->ibp_conns)); + LASSERT(list_empty(&peer->ibp_conns)); list_splice_init(&peer->ibp_tx_queue, &zombies); @@ -556,17 +556,17 @@ kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index) read_lock_irqsave(&kiblnd_data.kib_global_lock, flags); for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { - list_for_each (ptmp, &kiblnd_data.kib_peers[i]) { + list_for_each(ptmp, &kiblnd_data.kib_peers[i]) { peer = list_entry(ptmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || + LASSERT(peer->ibp_connecting > 0 || peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); if (peer->ibp_ni != ni) continue; - list_for_each (ctmp, &peer->ibp_conns) { + list_for_each(ctmp, &peer->ibp_conns) { if (index-- > 0) continue; @@ -615,7 +615,7 @@ kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid) return; mtu = kiblnd_translate_mtu(*kiblnd_tunables.kib_ib_mtu); - LASSERT (mtu >= 0); + LASSERT(mtu >= 0); if (mtu != 0) cmid->route.path_rec->mtu = mtu; } @@ -835,7 +835,7 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, } /* Init successful! */ - LASSERT (state == IBLND_CONN_ACTIVE_CONNECT || + LASSERT(state == IBLND_CONN_ACTIVE_CONNECT || state == IBLND_CONN_PASSIVE_WAIT); conn->ibc_state = state; @@ -852,22 +852,22 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, } void -kiblnd_destroy_conn (kib_conn_t *conn) +kiblnd_destroy_conn(kib_conn_t *conn) { struct rdma_cm_id *cmid = conn->ibc_cmid; kib_peer_t *peer = conn->ibc_peer; int rc; - LASSERT (!in_interrupt()); - LASSERT (atomic_read(&conn->ibc_refcount) == 0); - LASSERT (list_empty(&conn->ibc_early_rxs)); - LASSERT (list_empty(&conn->ibc_tx_noops)); - LASSERT (list_empty(&conn->ibc_tx_queue)); - LASSERT (list_empty(&conn->ibc_tx_queue_rsrvd)); - LASSERT (list_empty(&conn->ibc_tx_queue_nocred)); - LASSERT (list_empty(&conn->ibc_active_txs)); - LASSERT (conn->ibc_noops_posted == 0); - LASSERT (conn->ibc_nsends_posted == 0); + LASSERT(!in_interrupt()); + LASSERT(atomic_read(&conn->ibc_refcount) == 0); + LASSERT(list_empty(&conn->ibc_early_rxs)); + LASSERT(list_empty(&conn->ibc_tx_noops)); + LASSERT(list_empty(&conn->ibc_tx_queue)); + LASSERT(list_empty(&conn->ibc_tx_queue_rsrvd)); + LASSERT(list_empty(&conn->ibc_tx_queue_nocred)); + LASSERT(list_empty(&conn->ibc_active_txs)); + LASSERT(conn->ibc_noops_posted == 0); + LASSERT(conn->ibc_nsends_posted == 0); switch (conn->ibc_state) { default: @@ -876,7 +876,7 @@ kiblnd_destroy_conn (kib_conn_t *conn) case IBLND_CONN_DISCONNECTED: /* connvars should have been freed already */ - LASSERT (conn->ibc_connvars == NULL); + LASSERT(conn->ibc_connvars == NULL); break; case IBLND_CONN_INIT: @@ -920,14 +920,14 @@ kiblnd_destroy_conn (kib_conn_t *conn) } int -kiblnd_close_peer_conns_locked (kib_peer_t *peer, int why) +kiblnd_close_peer_conns_locked(kib_peer_t *peer, int why) { kib_conn_t *conn; struct list_head *ctmp; struct list_head *cnxt; int count = 0; - list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { + list_for_each_safe(ctmp, cnxt, &peer->ibp_conns) { conn = list_entry(ctmp, kib_conn_t, ibc_list); CDEBUG(D_NET, "Closing conn -> %s, version: %x, reason: %d\n", @@ -942,7 +942,7 @@ kiblnd_close_peer_conns_locked (kib_peer_t *peer, int why) } int -kiblnd_close_stale_conns_locked (kib_peer_t *peer, +kiblnd_close_stale_conns_locked(kib_peer_t *peer, int version, __u64 incarnation) { kib_conn_t *conn; @@ -950,7 +950,7 @@ kiblnd_close_stale_conns_locked (kib_peer_t *peer, struct list_head *cnxt; int count = 0; - list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { + list_for_each_safe(ctmp, cnxt, &peer->ibp_conns) { conn = list_entry(ctmp, kib_conn_t, ibc_list); if (conn->ibc_version == version && @@ -991,10 +991,10 @@ kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid) } for (i = lo; i <= hi; i++) { - list_for_each_safe (ptmp, pnxt, &kiblnd_data.kib_peers[i]) { + list_for_each_safe(ptmp, pnxt, &kiblnd_data.kib_peers[i]) { peer = list_entry(ptmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || + LASSERT(peer->ibp_connecting > 0 || peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); @@ -1049,7 +1049,7 @@ kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) break; } - LASSERT (conn->ibc_cmid != NULL); + LASSERT(conn->ibc_cmid != NULL); data->ioc_nid = conn->ibc_peer->ibp_nid; if (conn->ibc_cmid->route.path_rec == NULL) data->ioc_u32[0] = 0; /* iWarp has no path MTU */ @@ -1072,7 +1072,7 @@ kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) } void -kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) +kiblnd_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) { unsigned long last_alive = 0; unsigned long now = cfs_time_current(); @@ -1084,7 +1084,7 @@ kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) peer = kiblnd_find_peer_locked(nid); if (peer != NULL) { - LASSERT (peer->ibp_connecting > 0 || /* creating conns */ + LASSERT(peer->ibp_connecting > 0 || /* creating conns */ peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); /* active conn */ last_alive = peer->ibp_last_alive; @@ -1157,13 +1157,13 @@ kiblnd_unmap_rx_descs(kib_conn_t *conn) kib_rx_t *rx; int i; - LASSERT (conn->ibc_rxs != NULL); - LASSERT (conn->ibc_hdev != NULL); + LASSERT(conn->ibc_rxs != NULL); + LASSERT(conn->ibc_hdev != NULL); for (i = 0; i < IBLND_RX_MSGS(conn->ibc_version); i++) { rx = &conn->ibc_rxs[i]; - LASSERT (rx->rx_nob >= 0); /* not posted */ + LASSERT(rx->rx_nob >= 0); /* not posted */ kiblnd_dma_unmap_single(conn->ibc_hdev->ibh_ibdev, KIBLND_UNMAP_ADDR(rx, rx_msgunmap, @@ -1196,7 +1196,7 @@ kiblnd_map_rx_descs(kib_conn_t *conn) rx->rx_msgaddr = kiblnd_dma_map_single(conn->ibc_hdev->ibh_ibdev, rx->rx_msg, IBLND_MSG_SIZE, DMA_FROM_DEVICE); - LASSERT (!kiblnd_dma_mapping_error(conn->ibc_hdev->ibh_ibdev, + LASSERT(!kiblnd_dma_mapping_error(conn->ibc_hdev->ibh_ibdev, rx->rx_msgaddr)); KIBLND_UNMAP_ADDR_SET(rx, rx_msgunmap, rx->rx_msgaddr); @@ -1205,12 +1205,12 @@ kiblnd_map_rx_descs(kib_conn_t *conn) lnet_page2phys(pg) + pg_off); pg_off += IBLND_MSG_SIZE; - LASSERT (pg_off <= PAGE_SIZE); + LASSERT(pg_off <= PAGE_SIZE); if (pg_off == PAGE_SIZE) { pg_off = 0; ipg++; - LASSERT (ipg <= IBLND_RX_MSG_PAGES(conn->ibc_version)); + LASSERT(ipg <= IBLND_RX_MSG_PAGES(conn->ibc_version)); } } } @@ -1222,7 +1222,7 @@ kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo) kib_tx_t *tx; int i; - LASSERT (tpo->tpo_pool.po_allocated == 0); + LASSERT(tpo->tpo_pool.po_allocated == 0); if (hdev == NULL) return; @@ -1278,15 +1278,15 @@ kiblnd_map_tx_pool(kib_tx_pool_t *tpo) int ipage; int i; - LASSERT (net != NULL); + LASSERT(net != NULL); dev = net->ibn_dev; /* pre-mapped messages are not bigger than 1 page */ - CLASSERT (IBLND_MSG_SIZE <= PAGE_SIZE); + CLASSERT(IBLND_MSG_SIZE <= PAGE_SIZE); /* No fancy arithmetic when we do the buffer calculations */ - CLASSERT (PAGE_SIZE % IBLND_MSG_SIZE == 0); + CLASSERT(PAGE_SIZE % IBLND_MSG_SIZE == 0); tpo->tpo_hdev = kiblnd_current_hdev(dev); @@ -1300,19 +1300,19 @@ kiblnd_map_tx_pool(kib_tx_pool_t *tpo) tx->tx_msgaddr = kiblnd_dma_map_single( tpo->tpo_hdev->ibh_ibdev, tx->tx_msg, IBLND_MSG_SIZE, DMA_TO_DEVICE); - LASSERT (!kiblnd_dma_mapping_error(tpo->tpo_hdev->ibh_ibdev, + LASSERT(!kiblnd_dma_mapping_error(tpo->tpo_hdev->ibh_ibdev, tx->tx_msgaddr)); KIBLND_UNMAP_ADDR_SET(tx, tx_msgunmap, tx->tx_msgaddr); list_add(&tx->tx_list, &pool->po_free_list); page_offset += IBLND_MSG_SIZE; - LASSERT (page_offset <= PAGE_SIZE); + LASSERT(page_offset <= PAGE_SIZE); if (page_offset == PAGE_SIZE) { page_offset = 0; ipage++; - LASSERT (ipage <= txpgs->ibp_npages); + LASSERT(ipage <= txpgs->ibp_npages); } } } @@ -1322,7 +1322,7 @@ kiblnd_find_dma_mr(kib_hca_dev_t *hdev, __u64 addr, __u64 size) { __u64 index; - LASSERT (hdev->ibh_mrs[0] != NULL); + LASSERT(hdev->ibh_mrs[0] != NULL); if (hdev->ibh_nmrs == 1) return hdev->ibh_mrs[0]; @@ -1343,7 +1343,7 @@ kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd) struct ib_mr *mr; int i; - LASSERT (hdev->ibh_mrs[0] != NULL); + LASSERT(hdev->ibh_mrs[0] != NULL); if (*kiblnd_tunables.kib_map_on_demand > 0 && *kiblnd_tunables.kib_map_on_demand <= rd->rd_nfrags) @@ -1373,7 +1373,7 @@ kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd) static void kiblnd_destroy_fmr_pool(kib_fmr_pool_t *pool) { - LASSERT (pool->fpo_map_count == 0); + LASSERT(pool->fpo_map_count == 0); if (pool->fpo_fmr_pool != NULL) ib_destroy_fmr_pool(pool->fpo_fmr_pool); @@ -1519,7 +1519,7 @@ kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now) void kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); kib_fmr_pool_t *fpo = fmr->fmr_pool; kib_fmr_poolset_t *fps = fpo->fpo_owner; unsigned long now = cfs_time_current(); @@ -1527,11 +1527,11 @@ kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status) int rc; rc = ib_fmr_pool_unmap(fmr->fmr_pfmr); - LASSERT (rc == 0); + LASSERT(rc == 0); if (status != 0) { rc = ib_flush_fmr_pool(fpo->fpo_fmr_pool); - LASSERT (rc == 0); + LASSERT(rc == 0); } fmr->fmr_pool = NULL; @@ -1630,8 +1630,8 @@ kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, static void kiblnd_fini_pool(kib_pool_t *pool) { - LASSERT (list_empty(&pool->po_free_list)); - LASSERT (pool->po_allocated == 0); + LASSERT(list_empty(&pool->po_free_list)); + LASSERT(pool->po_allocated == 0); CDEBUG(D_NET, "Finalize %s pool\n", pool->po_owner->ps_name); } @@ -1657,7 +1657,7 @@ kiblnd_destroy_pool_list(struct list_head *head) pool = list_entry(head->next, kib_pool_t, po_list); list_del(&pool->po_list); - LASSERT (pool->po_owner != NULL); + LASSERT(pool->po_owner != NULL); pool->po_owner->ps_pool_destroy(pool); } } @@ -1740,7 +1740,7 @@ kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now) void kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); kib_poolset_t *ps = pool->po_owner; kib_pool_t *tmp; unsigned long now = cfs_time_current(); @@ -1750,7 +1750,7 @@ kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node) if (ps->ps_node_fini != NULL) ps->ps_node_fini(pool, node); - LASSERT (pool->po_allocated > 0); + LASSERT(pool->po_allocated > 0); list_add(node, &pool->po_free_list); pool->po_allocated--; @@ -1895,13 +1895,13 @@ kiblnd_destroy_pmr_pool(kib_pool_t *pool) kib_pmr_pool_t *ppo = container_of(pool, kib_pmr_pool_t, ppo_pool); kib_phys_mr_t *pmr; - LASSERT (pool->po_allocated == 0); + LASSERT(pool->po_allocated == 0); while (!list_empty(&pool->po_free_list)) { pmr = list_entry(pool->po_free_list.next, kib_phys_mr_t, pmr_list); - LASSERT (pmr->pmr_mr == NULL); + LASSERT(pmr->pmr_mr == NULL); list_del(&pmr->pmr_list); if (pmr->pmr_ipb != NULL) { @@ -1976,7 +1976,7 @@ kiblnd_destroy_tx_pool(kib_pool_t *pool) kib_tx_pool_t *tpo = container_of(pool, kib_tx_pool_t, tpo_pool); int i; - LASSERT (pool->po_allocated == 0); + LASSERT(pool->po_allocated == 0); if (tpo->tpo_tx_pages != NULL) { kiblnd_unmap_tx_pool(tpo); @@ -2442,7 +2442,7 @@ kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) return PTR_ERR(mr); } - LASSERT (iova == ipb.addr); + LASSERT(iova == ipb.addr); hdev->ibh_mrs[i] = mr; } @@ -2519,9 +2519,9 @@ kiblnd_dev_need_failover(kib_dev_t *dev) int kiblnd_dev_failover(kib_dev_t *dev) { - LIST_HEAD (zombie_tpo); - LIST_HEAD (zombie_ppo); - LIST_HEAD (zombie_fpo); + LIST_HEAD(zombie_tpo); + LIST_HEAD(zombie_ppo); + LIST_HEAD(zombie_fpo); struct rdma_cm_id *cmid = NULL; kib_hca_dev_t *hdev = NULL; kib_hca_dev_t *old; @@ -2532,7 +2532,7 @@ kiblnd_dev_failover(kib_dev_t *dev) int rc = 0; int i; - LASSERT (*kiblnd_tunables.kib_dev_failover > 1 || + LASSERT(*kiblnd_tunables.kib_dev_failover > 1 || dev->ibd_can_failover || dev->ibd_hdev == NULL); @@ -2656,10 +2656,10 @@ kiblnd_dev_failover(kib_dev_t *dev) } void -kiblnd_destroy_dev (kib_dev_t *dev) +kiblnd_destroy_dev(kib_dev_t *dev) { - LASSERT (dev->ibd_nnets == 0); - LASSERT (list_empty(&dev->ibd_nets)); + LASSERT(dev->ibd_nnets == 0); + LASSERT(list_empty(&dev->ibd_nets)); list_del(&dev->ibd_fail_list); list_del(&dev->ibd_list); @@ -2729,7 +2729,7 @@ kiblnd_base_shutdown(void) struct kib_sched_info *sched; int i; - LASSERT (list_empty(&kiblnd_data.kib_devs)); + LASSERT(list_empty(&kiblnd_data.kib_devs)); CDEBUG(D_MALLOC, "before LND base cleanup: kmem %d\n", atomic_read(&libcfs_kmemory)); @@ -2740,12 +2740,12 @@ kiblnd_base_shutdown(void) case IBLND_INIT_ALL: case IBLND_INIT_DATA: - LASSERT (kiblnd_data.kib_peers != NULL); + LASSERT(kiblnd_data.kib_peers != NULL); for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { - LASSERT (list_empty(&kiblnd_data.kib_peers[i])); + LASSERT(list_empty(&kiblnd_data.kib_peers[i])); } - LASSERT (list_empty(&kiblnd_data.kib_connd_zombies)); - LASSERT (list_empty(&kiblnd_data.kib_connd_conns)); + LASSERT(list_empty(&kiblnd_data.kib_connd_zombies)); + LASSERT(list_empty(&kiblnd_data.kib_connd_conns)); /* flag threads to terminate; wake and wait for them to die */ kiblnd_data.kib_shutdown = 1; @@ -2792,7 +2792,7 @@ kiblnd_base_shutdown(void) } void -kiblnd_shutdown (lnet_ni_t *ni) +kiblnd_shutdown(lnet_ni_t *ni) { kib_net_t *net = ni->ni_data; rwlock_t *g_lock = &kiblnd_data.kib_global_lock; @@ -2842,7 +2842,7 @@ kiblnd_shutdown (lnet_ni_t *ni) /* fall through */ case IBLND_INIT_NOTHING: - LASSERT (atomic_read(&net->ibn_nconns) == 0); + LASSERT(atomic_read(&net->ibn_nconns) == 0); if (net->ibn_dev != NULL && net->ibn_dev->ibd_nnets == 0) @@ -2872,7 +2872,7 @@ kiblnd_base_startup(void) int rc; int i; - LASSERT (kiblnd_data.kib_init == IBLND_INIT_NOTHING); + LASSERT(kiblnd_data.kib_init == IBLND_INIT_NOTHING); try_module_get(THIS_MODULE); memset(&kiblnd_data, 0, sizeof(kiblnd_data)); /* zero pointers, flags etc */ @@ -3056,7 +3056,7 @@ kiblnd_dev_search(char *ifname) } int -kiblnd_startup (lnet_ni_t *ni) +kiblnd_startup(lnet_ni_t *ni) { char *ifname; kib_dev_t *ibdev = NULL; @@ -3066,7 +3066,7 @@ kiblnd_startup (lnet_ni_t *ni) int rc; int newdev; - LASSERT (ni->ni_lnd == &the_o2iblnd); + LASSERT(ni->ni_lnd == &the_o2iblnd); if (kiblnd_data.kib_init == IBLND_INIT_NOTHING) { rc = kiblnd_base_startup(); @@ -3090,7 +3090,7 @@ kiblnd_startup (lnet_ni_t *ni) if (ni->ni_interfaces[0] != NULL) { /* Use the IPoIB interface specified in 'networks=' */ - CLASSERT (LNET_MAX_INTERFACES > 1); + CLASSERT(LNET_MAX_INTERFACES > 1); if (ni->ni_interfaces[1] != NULL) { CERROR("Multiple interfaces not supported\n"); goto failed; @@ -3151,20 +3151,20 @@ net_failed: } static void __exit -kiblnd_module_fini (void) +kiblnd_module_fini(void) { lnet_unregister_lnd(&the_o2iblnd); } static int __init -kiblnd_module_init (void) +kiblnd_module_init(void) { int rc; - CLASSERT (sizeof(kib_msg_t) <= IBLND_MSG_SIZE); - CLASSERT (offsetof(kib_msg_t, ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) + CLASSERT(sizeof(kib_msg_t) <= IBLND_MSG_SIZE); + CLASSERT(offsetof(kib_msg_t, ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) <= IBLND_MSG_SIZE); - CLASSERT (offsetof(kib_msg_t, ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) + CLASSERT(offsetof(kib_msg_t, ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) <= IBLND_MSG_SIZE); rc = kiblnd_tunables_init(); -- cgit v1.2.3 From b2ff386821d929ddf7f5e8167273fbc38aa3a9ba Mon Sep 17 00:00:00 2001 From: Gulsah Kose Date: Sun, 22 Feb 2015 05:08:07 +0200 Subject: staging: lustre: lnet: klnds: o2iblnd: Added missing blank line. Added missing blank line after declaration. Removed following checkpatch.pl warning: WARNING: Missing a blank line after declarations Signed-off-by: Gulsah Kose Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 64d5ea349a76..4e7d91dab6c4 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2980,6 +2980,7 @@ kiblnd_start_schedulers(struct kib_sched_info *sched) for (i = 0; i < nthrs; i++) { long id; char name[20]; + id = KIB_THREAD_ID(sched->ibs_cpt, sched->ibs_nthreads + i); snprintf(name, sizeof(name), "kiblnd_sd_%02ld_%02ld", KIB_THREAD_CPT(id), KIB_THREAD_TID(id)); -- cgit v1.2.3 From 17155544f6f03a7846f5c78a9668a41b28eb9452 Mon Sep 17 00:00:00 2001 From: Gulsah Kose Date: Sun, 22 Feb 2015 05:08:05 +0200 Subject: staging: lustre: lnet: klnds: o2iblnd: Removed useless return keywords. Removed return keyword from void functions. Removed following checkpatch.pl warnings: WARNING: void function return statements are not generally useful Signed-off-by: Gulsah Kose Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 4e7d91dab6c4..109f44c18dd9 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -1103,7 +1103,6 @@ kiblnd_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) CDEBUG(D_NET, "Peer %s %p, alive %ld secs ago\n", libcfs_nid2str(nid), peer, last_alive ? cfs_duration_sec(now - last_alive) : -1); - return; } void @@ -2862,7 +2861,6 @@ kiblnd_shutdown(lnet_ni_t *ni) out: if (list_empty(&kiblnd_data.kib_devs)) kiblnd_base_shutdown(); - return; } static int -- cgit v1.2.3 From 31982482c066eb4fdb06ff65d4c7fd059422099b Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Fri, 20 Feb 2015 23:51:36 +0200 Subject: Staging: lustre: Used "linux" instead of "asm" This patch fixes "Use #include instead of checkpatch.pl warning in dir.c Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index a18201913273..cb632a121a6f 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include /* for wait_on_buffer */ #include #include -- cgit v1.2.3 From 7979219006690da703dd7f08ec7cbc03dfeb984c Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Fri, 20 Feb 2015 23:51:37 +0200 Subject: Staging: lustre: Add blank line after variable declarations This patch fixes "Missing a blank line after declarations" checkpatch.pl warning in dir.c Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/dir.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index cb632a121a6f..2b7482499847 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1518,6 +1518,7 @@ out_rmdir: lump = (struct lov_user_md *)arg; } else { struct lov_user_mds_data *lmdp; + lmdp = (struct lov_user_mds_data *)arg; lump = &lmdp->lmd_lmm; } -- cgit v1.2.3 From e17f5594d59d9140ee12fcfe6b8f63de2b1574cc Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Fri, 20 Feb 2015 23:51:38 +0200 Subject: Staging: lustre: Edit switch-case indent This patch fixes indent as the codingStyle of the kernel recommends in dir.c Fix checkpatch.pl error: ERROR: switch and case should be at the same indent. Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/dir.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 2b7482499847..a5bc694dcb64 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1910,21 +1910,21 @@ static loff_t ll_dir_seek(struct file *file, loff_t offset, int origin) mutex_lock(&inode->i_mutex); switch (origin) { - case SEEK_SET: - break; - case SEEK_CUR: - offset += file->f_pos; - break; - case SEEK_END: - if (offset > 0) - goto out; - if (api32) - offset += LL_DIR_END_OFF_32BIT; - else - offset += LL_DIR_END_OFF; - break; - default: + case SEEK_SET: + break; + case SEEK_CUR: + offset += file->f_pos; + break; + case SEEK_END: + if (offset > 0) goto out; + if (api32) + offset += LL_DIR_END_OFF_32BIT; + else + offset += LL_DIR_END_OFF; + break; + default: + goto out; } if (offset >= 0 && -- cgit v1.2.3 From 99d08456b3937cb32245e4f4d35a5469cf12d280 Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Sat, 21 Feb 2015 23:19:46 +0200 Subject: Staging: lustre: Removed unnecessary braces This patch fixes checkpatch.pl warning in llite_lib.c WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_lib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 0c1b583a4ea1..a2b11ef89d91 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -87,11 +87,10 @@ static struct ll_sb_info *ll_init_sbi(void) si_meminfo(&si); pages = si.totalram - si.totalhigh; - if (pages >> (20 - PAGE_CACHE_SHIFT) < 512) { + if (pages >> (20 - PAGE_CACHE_SHIFT) < 512) lru_page_max = pages / 2; - } else { + else lru_page_max = (pages / 4) * 3; - } /* initialize lru data */ atomic_set(&sbi->ll_cache.ccc_users, 0); -- cgit v1.2.3 From 692f2b6cc298b86b9386bb26ea457aae957cc6ff Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Sat, 21 Feb 2015 22:47:43 +0200 Subject: Staging: lustre: use kstrtoul() instead of sscanf() This patch makes checkpatch.pl by fixing the following warning: WARNING: Prefer kstrto to single variable sscanf. I used to kstrtoul can convert unsigned long instead of sscanf Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index a2b11ef89d91..4ebc28cf37dd 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -2151,7 +2151,8 @@ int ll_process_config(struct lustre_cfg *lcfg) ptr = strrchr(lustre_cfg_string(lcfg, 0), '-'); if (!ptr || !*(++ptr)) return -EINVAL; - if (sscanf(ptr, "%lx", &x) != 1) + rc = kstrtoul(ptr, 16, &x); + if (rc != 0) return -EINVAL; sb = (void *)x; /* This better be a real Lustre superblock! */ -- cgit v1.2.3 From 4f211c20faec32fa3803bdee97406355eb4b9be9 Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Sat, 21 Feb 2015 23:23:24 +0200 Subject: Staging: lustre: Removed unnecessary spaces Fix checkpatch.pl issues with "unnecessary whitespace before a quoted newline" in llite_lib.c Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 4ebc28cf37dd..59f8387b4487 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -620,7 +620,7 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize) rc = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_MAX_EASIZE), KEY_MAX_EASIZE, &size, lmmsize, NULL); if (rc) - CERROR("Get max mdsize error rc %d \n", rc); + CERROR("Get max mdsize error rc %d\n", rc); return rc; } -- cgit v1.2.3 From 6341898323d3a671e766e229fd7d0c90117dfa2f Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Sun, 22 Feb 2015 12:18:04 +0200 Subject: Staging: lustre: Deleted space prohibited between function name and open parenthesis WARNING: space prohibited between function name and open parenthesis '(' Remove unnecessary space between function name and opening parenthesis. That was found by running checkpatch Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/framework.c | 220 +++++++++++------------ 1 file changed, 110 insertions(+), 110 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 570914828b8c..a93a90de0f85 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -115,18 +115,18 @@ static struct smoketest_framework { } sfw_data; /* forward ref's */ -int sfw_stop_batch (sfw_batch_t *tsb, int force); -void sfw_destroy_session (sfw_session_t *sn); +int sfw_stop_batch(sfw_batch_t *tsb, int force); +void sfw_destroy_session(sfw_session_t *sn); static inline sfw_test_case_t * sfw_find_test_case(int id) { sfw_test_case_t *tsc; - LASSERT (id <= SRPC_SERVICE_MAX_ID); - LASSERT (id > SRPC_FRAMEWORK_SERVICE_MAX_ID); + LASSERT(id <= SRPC_SERVICE_MAX_ID); + LASSERT(id > SRPC_FRAMEWORK_SERVICE_MAX_ID); - list_for_each_entry (tsc, &sfw_data.fw_tests, tsc_list) { + list_for_each_entry(tsc, &sfw_data.fw_tests, tsc_list) { if (tsc->tsc_srv_service->sv_id == id) return tsc; } @@ -135,12 +135,12 @@ sfw_find_test_case(int id) } static int -sfw_register_test (srpc_service_t *service, sfw_test_client_ops_t *cliops) +sfw_register_test(srpc_service_t *service, sfw_test_client_ops_t *cliops) { sfw_test_case_t *tsc; if (sfw_find_test_case(service->sv_id) != NULL) { - CERROR ("Failed to register test %s (%d)\n", + CERROR("Failed to register test %s (%d)\n", service->sv_name, service->sv_id); return -EEXIST; } @@ -157,17 +157,17 @@ sfw_register_test (srpc_service_t *service, sfw_test_client_ops_t *cliops) } static void -sfw_add_session_timer (void) +sfw_add_session_timer(void) { sfw_session_t *sn = sfw_data.fw_session; stt_timer_t *timer = &sn->sn_timer; - LASSERT (!sfw_data.fw_shuttingdown); + LASSERT(!sfw_data.fw_shuttingdown); if (sn == NULL || sn->sn_timeout == 0) return; - LASSERT (!sn->sn_timer_active); + LASSERT(!sn->sn_timer_active); sn->sn_timer_active = 1; timer->stt_expires = cfs_time_add(sn->sn_timeout, @@ -177,14 +177,14 @@ sfw_add_session_timer (void) } static int -sfw_del_session_timer (void) +sfw_del_session_timer(void) { sfw_session_t *sn = sfw_data.fw_session; if (sn == NULL || !sn->sn_timer_active) return 0; - LASSERT (sn->sn_timeout != 0); + LASSERT(sn->sn_timeout != 0); if (stt_del_timer(&sn->sn_timer)) { /* timer defused */ sn->sn_timer_active = 0; @@ -195,7 +195,7 @@ sfw_del_session_timer (void) } static void -sfw_deactivate_session (void) +sfw_deactivate_session(void) __must_hold(&sfw_data.fw_lock) { sfw_session_t *sn = sfw_data.fw_session; @@ -205,7 +205,7 @@ sfw_deactivate_session (void) if (sn == NULL) return; - LASSERT (!sn->sn_timer_active); + LASSERT(!sn->sn_timer_active); sfw_data.fw_session = NULL; atomic_inc(&sfw_data.fw_nzombies); @@ -219,7 +219,7 @@ sfw_deactivate_session (void) spin_lock(&sfw_data.fw_lock); - list_for_each_entry (tsb, &sn->sn_batches, bat_list) { + list_for_each_entry(tsb, &sn->sn_batches, bat_list) { if (sfw_batch_active(tsb)) { nactive++; sfw_stop_batch(tsb, 1); @@ -239,16 +239,16 @@ sfw_deactivate_session (void) static void -sfw_session_expired (void *data) +sfw_session_expired(void *data) { sfw_session_t *sn = data; spin_lock(&sfw_data.fw_lock); - LASSERT (sn->sn_timer_active); - LASSERT (sn == sfw_data.fw_session); + LASSERT(sn->sn_timer_active); + LASSERT(sn == sfw_data.fw_session); - CWARN ("Session expired! sid: %s-%llu, name: %s\n", + CWARN("Session expired! sid: %s-%llu, name: %s\n", libcfs_nid2str(sn->sn_id.ses_nid), sn->sn_id.ses_stamp, &sn->sn_name[0]); @@ -290,7 +290,7 @@ sfw_server_rpc_done(struct srpc_server_rpc *rpc) struct srpc_service *sv = rpc->srpc_scd->scd_svc; int status = rpc->srpc_status; - CDEBUG (D_NET, + CDEBUG(D_NET, "Incoming framework RPC done: service %s, peer %s, status %s:%d\n", sv->sv_name, libcfs_id2str(rpc->srpc_peer), swi_state2str(rpc->srpc_wi.swi_state), @@ -302,13 +302,13 @@ sfw_server_rpc_done(struct srpc_server_rpc *rpc) } static void -sfw_client_rpc_fini (srpc_client_rpc_t *rpc) +sfw_client_rpc_fini(srpc_client_rpc_t *rpc) { - LASSERT (rpc->crpc_bulk.bk_niov == 0); - LASSERT (list_empty(&rpc->crpc_list)); - LASSERT (atomic_read(&rpc->crpc_refcount) == 0); + LASSERT(rpc->crpc_bulk.bk_niov == 0); + LASSERT(list_empty(&rpc->crpc_list)); + LASSERT(atomic_read(&rpc->crpc_refcount) == 0); - CDEBUG (D_NET, + CDEBUG(D_NET, "Outgoing framework RPC done: service %d, peer %s, status %s:%d:%d\n", rpc->crpc_service, libcfs_id2str(rpc->crpc_dest), swi_state2str(rpc->crpc_wi.swi_state), @@ -324,14 +324,14 @@ sfw_client_rpc_fini (srpc_client_rpc_t *rpc) } static sfw_batch_t * -sfw_find_batch (lst_bid_t bid) +sfw_find_batch(lst_bid_t bid) { sfw_session_t *sn = sfw_data.fw_session; sfw_batch_t *bat; - LASSERT (sn != NULL); + LASSERT(sn != NULL); - list_for_each_entry (bat, &sn->sn_batches, bat_list) { + list_for_each_entry(bat, &sn->sn_batches, bat_list) { if (bat->bat_id.bat_id == bid.bat_id) return bat; } @@ -340,12 +340,12 @@ sfw_find_batch (lst_bid_t bid) } static sfw_batch_t * -sfw_bid2batch (lst_bid_t bid) +sfw_bid2batch(lst_bid_t bid) { sfw_session_t *sn = sfw_data.fw_session; sfw_batch_t *bat; - LASSERT (sn != NULL); + LASSERT(sn != NULL); bat = sfw_find_batch(bid); if (bat != NULL) @@ -366,7 +366,7 @@ sfw_bid2batch (lst_bid_t bid) } static int -sfw_get_stats (srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) +sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) { sfw_session_t *sn = sfw_data.fw_session; sfw_counters_t *cnt = &reply->str_fw; @@ -399,7 +399,7 @@ sfw_get_stats (srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) cnt->zombie_sessions = atomic_read(&sfw_data.fw_nzombies); cnt->active_batches = 0; - list_for_each_entry (bat, &sn->sn_batches, bat_list) { + list_for_each_entry(bat, &sn->sn_batches, bat_list) { if (atomic_read(&bat->bat_nactive) > 0) cnt->active_batches++; } @@ -456,7 +456,7 @@ sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) /* brand new or create by force */ LIBCFS_ALLOC(sn, sizeof(sfw_session_t)); if (sn == NULL) { - CERROR ("Dropping RPC (mksn) under memory pressure.\n"); + CERROR("Dropping RPC (mksn) under memory pressure.\n"); return -ENOMEM; } @@ -478,7 +478,7 @@ sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) } static int -sfw_remove_session (srpc_rmsn_reqst_t *request, srpc_rmsn_reply_t *reply) +sfw_remove_session(srpc_rmsn_reqst_t *request, srpc_rmsn_reply_t *reply) { sfw_session_t *sn = sfw_data.fw_session; @@ -510,7 +510,7 @@ sfw_remove_session (srpc_rmsn_reqst_t *request, srpc_rmsn_reply_t *reply) } static int -sfw_debug_session (srpc_debug_reqst_t *request, srpc_debug_reply_t *reply) +sfw_debug_session(srpc_debug_reqst_t *request, srpc_debug_reply_t *reply) { sfw_session_t *sn = sfw_data.fw_session; @@ -531,13 +531,13 @@ sfw_debug_session (srpc_debug_reqst_t *request, srpc_debug_reply_t *reply) } static void -sfw_test_rpc_fini (srpc_client_rpc_t *rpc) +sfw_test_rpc_fini(srpc_client_rpc_t *rpc) { sfw_test_unit_t *tsu = rpc->crpc_priv; sfw_test_instance_t *tsi = tsu->tsu_instance; /* Called with hold of tsi->tsi_lock */ - LASSERT (list_empty(&rpc->crpc_list)); + LASSERT(list_empty(&rpc->crpc_list)); list_add(&rpc->crpc_list, &tsi->tsi_free_rpcs); } @@ -608,7 +608,7 @@ sfw_unload_test(struct sfw_test_instance *tsi) } static void -sfw_destroy_test_instance (sfw_test_instance_t *tsi) +sfw_destroy_test_instance(sfw_test_instance_t *tsi) { srpc_client_rpc_t *rpc; sfw_test_unit_t *tsu; @@ -617,9 +617,9 @@ sfw_destroy_test_instance (sfw_test_instance_t *tsi) tsi->tsi_ops->tso_fini(tsi); - LASSERT (!tsi->tsi_stopping); - LASSERT (list_empty(&tsi->tsi_active_rpcs)); - LASSERT (!sfw_test_active(tsi)); + LASSERT(!tsi->tsi_stopping); + LASSERT(list_empty(&tsi->tsi_active_rpcs)); + LASSERT(!sfw_test_active(tsi)); while (!list_empty(&tsi->tsi_units)) { tsu = list_entry(tsi->tsi_units.next, @@ -642,12 +642,12 @@ clean: } static void -sfw_destroy_batch (sfw_batch_t *tsb) +sfw_destroy_batch(sfw_batch_t *tsb) { sfw_test_instance_t *tsi; - LASSERT (!sfw_batch_active(tsb)); - LASSERT (list_empty(&tsb->bat_list)); + LASSERT(!sfw_batch_active(tsb)); + LASSERT(list_empty(&tsb->bat_list)); while (!list_empty(&tsb->bat_tests)) { tsi = list_entry(tsb->bat_tests.next, @@ -661,12 +661,12 @@ sfw_destroy_batch (sfw_batch_t *tsb) } void -sfw_destroy_session (sfw_session_t *sn) +sfw_destroy_session(sfw_session_t *sn) { sfw_batch_t *batch; - LASSERT (list_empty(&sn->sn_list)); - LASSERT (sn != sfw_data.fw_session); + LASSERT(list_empty(&sn->sn_list)); + LASSERT(sn != sfw_data.fw_session); while (!list_empty(&sn->sn_batches)) { batch = list_entry(sn->sn_batches.next, @@ -685,13 +685,13 @@ sfw_unpack_addtest_req(srpc_msg_t *msg) { srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; - LASSERT (msg->msg_type == SRPC_MSG_TEST_REQST); - LASSERT (req->tsr_is_client); + LASSERT(msg->msg_type == SRPC_MSG_TEST_REQST); + LASSERT(req->tsr_is_client); if (msg->msg_magic == SRPC_MSG_MAGIC) return; /* no flipping needed */ - LASSERT (msg->msg_magic == __swab32(SRPC_MSG_MAGIC)); + LASSERT(msg->msg_magic == __swab32(SRPC_MSG_MAGIC)); if (req->tsr_service == SRPC_SERVICE_BRW) { if ((msg->msg_ses_feats & LST_FEAT_BULK_LEN) == 0) { @@ -721,12 +721,12 @@ sfw_unpack_addtest_req(srpc_msg_t *msg) return; } - LBUG (); + LBUG(); return; } static int -sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) +sfw_add_test_instance(sfw_batch_t *tsb, srpc_server_rpc_t *rpc) { srpc_msg_t *msg = &rpc->srpc_reqstbuf->buf_msg; srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; @@ -739,7 +739,7 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) LIBCFS_ALLOC(tsi, sizeof(*tsi)); if (tsi == NULL) { - CERROR ("Can't allocate test instance for batch: %llu\n", + CERROR("Can't allocate test instance for batch: %llu\n", tsb->bat_id.bat_id); return -ENOMEM; } @@ -764,7 +764,7 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) return rc; } - LASSERT (!sfw_batch_active(tsb)); + LASSERT(!sfw_batch_active(tsb)); if (!tsi->tsi_is_client) { /* it's test server, just add it to tsb */ @@ -772,8 +772,8 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) return 0; } - LASSERT (bk != NULL); - LASSERT (bk->bk_niov * SFW_ID_PER_PAGE >= (unsigned int)ndest); + LASSERT(bk != NULL); + LASSERT(bk->bk_niov * SFW_ID_PER_PAGE >= (unsigned int)ndest); LASSERT((unsigned int)bk->bk_len >= sizeof(lnet_process_id_packed_t) * ndest); @@ -786,7 +786,7 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) int j; dests = page_address(bk->bk_iovs[i / SFW_ID_PER_PAGE].kiov_page); - LASSERT (dests != NULL); /* my pages are within KVM always */ + LASSERT(dests != NULL); /* my pages are within KVM always */ id = dests[i % SFW_ID_PER_PAGE]; if (msg->msg_magic != SRPC_MSG_MAGIC) sfw_unpack_id(id); @@ -795,7 +795,7 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) LIBCFS_ALLOC(tsu, sizeof(sfw_test_unit_t)); if (tsu == NULL) { rc = -ENOMEM; - CERROR ("Can't allocate tsu for %d\n", + CERROR("Can't allocate tsu for %d\n", tsi->tsi_service); goto error; } @@ -815,19 +815,19 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) } error: - LASSERT (rc != 0); + LASSERT(rc != 0); sfw_destroy_test_instance(tsi); return rc; } static void -sfw_test_unit_done (sfw_test_unit_t *tsu) +sfw_test_unit_done(sfw_test_unit_t *tsu) { sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_batch_t *tsb = tsi->tsi_batch; sfw_session_t *sn = tsb->bat_session; - LASSERT (sfw_test_active(tsi)); + LASSERT(sfw_test_active(tsi)); if (!atomic_dec_and_test(&tsi->tsi_nactive)) return; @@ -847,9 +847,9 @@ sfw_test_unit_done (sfw_test_unit_t *tsu) return; } - LASSERT (!list_empty(&sn->sn_list)); /* I'm a zombie! */ + LASSERT(!list_empty(&sn->sn_list)); /* I'm a zombie! */ - list_for_each_entry (tsb, &sn->sn_batches, bat_list) { + list_for_each_entry(tsb, &sn->sn_batches, bat_list) { if (sfw_batch_active(tsb)) { spin_unlock(&sfw_data.fw_lock); return; @@ -864,7 +864,7 @@ sfw_test_unit_done (sfw_test_unit_t *tsu) } static void -sfw_test_rpc_done (srpc_client_rpc_t *rpc) +sfw_test_rpc_done(srpc_client_rpc_t *rpc) { sfw_test_unit_t *tsu = rpc->crpc_priv; sfw_test_instance_t *tsi = tsu->tsu_instance; @@ -874,8 +874,8 @@ sfw_test_rpc_done (srpc_client_rpc_t *rpc) spin_lock(&tsi->tsi_lock); - LASSERT (sfw_test_active(tsi)); - LASSERT (!list_empty(&rpc->crpc_list)); + LASSERT(sfw_test_active(tsi)); + LASSERT(!list_empty(&rpc->crpc_list)); list_del_init(&rpc->crpc_list); @@ -909,13 +909,13 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, spin_lock(&tsi->tsi_lock); - LASSERT (sfw_test_active(tsi)); + LASSERT(sfw_test_active(tsi)); if (!list_empty(&tsi->tsi_free_rpcs)) { /* pick request from buffer */ rpc = list_entry(tsi->tsi_free_rpcs.next, srpc_client_rpc_t, crpc_list); - LASSERT (nblk == rpc->crpc_bulk.bk_niov); + LASSERT(nblk == rpc->crpc_bulk.bk_niov); list_del_init(&rpc->crpc_list); } @@ -943,20 +943,20 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, } static int -sfw_run_test (swi_workitem_t *wi) +sfw_run_test(swi_workitem_t *wi) { sfw_test_unit_t *tsu = wi->swi_workitem.wi_data; sfw_test_instance_t *tsi = tsu->tsu_instance; srpc_client_rpc_t *rpc = NULL; - LASSERT (wi == &tsu->tsu_worker); + LASSERT(wi == &tsu->tsu_worker); if (tsi->tsi_ops->tso_prep_rpc(tsu, tsu->tsu_dest, &rpc) != 0) { - LASSERT (rpc == NULL); + LASSERT(rpc == NULL); goto test_done; } - LASSERT (rpc != NULL); + LASSERT(rpc != NULL); spin_lock(&tsi->tsi_lock); @@ -993,7 +993,7 @@ test_done: } static int -sfw_run_batch (sfw_batch_t *tsb) +sfw_run_batch(sfw_batch_t *tsb) { swi_workitem_t *wi; sfw_test_unit_t *tsu; @@ -1005,16 +1005,16 @@ sfw_run_batch (sfw_batch_t *tsb) return 0; } - list_for_each_entry (tsi, &tsb->bat_tests, tsi_list) { + list_for_each_entry(tsi, &tsb->bat_tests, tsi_list) { if (!tsi->tsi_is_client) /* skip server instances */ continue; - LASSERT (!tsi->tsi_stopping); - LASSERT (!sfw_test_active(tsi)); + LASSERT(!tsi->tsi_stopping); + LASSERT(!sfw_test_active(tsi)); atomic_inc(&tsb->bat_nactive); - list_for_each_entry (tsu, &tsi->tsi_units, tsu_list) { + list_for_each_entry(tsu, &tsi->tsi_units, tsu_list) { atomic_inc(&tsi->tsi_nactive); tsu->tsu_loop = tsi->tsi_loop; wi = &tsu->tsu_worker; @@ -1029,7 +1029,7 @@ sfw_run_batch (sfw_batch_t *tsb) } int -sfw_stop_batch (sfw_batch_t *tsb, int force) +sfw_stop_batch(sfw_batch_t *tsb, int force) { sfw_test_instance_t *tsi; srpc_client_rpc_t *rpc; @@ -1039,7 +1039,7 @@ sfw_stop_batch (sfw_batch_t *tsb, int force) return 0; } - list_for_each_entry (tsi, &tsb->bat_tests, tsi_list) { + list_for_each_entry(tsi, &tsb->bat_tests, tsi_list) { spin_lock(&tsi->tsi_lock); if (!tsi->tsi_is_client || @@ -1071,7 +1071,7 @@ sfw_stop_batch (sfw_batch_t *tsb, int force) } static int -sfw_query_batch (sfw_batch_t *tsb, int testidx, srpc_batch_reply_t *reply) +sfw_query_batch(sfw_batch_t *tsb, int testidx, srpc_batch_reply_t *reply) { sfw_test_instance_t *tsi; @@ -1083,7 +1083,7 @@ sfw_query_batch (sfw_batch_t *tsb, int testidx, srpc_batch_reply_t *reply) return 0; } - list_for_each_entry (tsi, &tsb->bat_tests, tsi_list) { + list_for_each_entry(tsi, &tsb->bat_tests, tsi_list) { if (testidx-- > 1) continue; @@ -1095,7 +1095,7 @@ sfw_query_batch (sfw_batch_t *tsb, int testidx, srpc_batch_reply_t *reply) } void -sfw_free_pages (srpc_server_rpc_t *rpc) +sfw_free_pages(srpc_server_rpc_t *rpc) { srpc_free_bulk(rpc->srpc_bulk); rpc->srpc_bulk = NULL; @@ -1116,7 +1116,7 @@ sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, } static int -sfw_add_test (srpc_server_rpc_t *rpc) +sfw_add_test(srpc_server_rpc_t *rpc) { sfw_session_t *sn = sfw_data.fw_session; srpc_test_reply_t *reply = &rpc->srpc_replymsg.msg_body.tes_reply; @@ -1147,7 +1147,7 @@ sfw_add_test (srpc_server_rpc_t *rpc) bat = sfw_bid2batch(request->tsr_bid); if (bat == NULL) { - CERROR ("Dropping RPC (%s) from %s under memory pressure.\n", + CERROR("Dropping RPC (%s) from %s under memory pressure.\n", rpc->srpc_scd->scd_svc->sv_name, libcfs_id2str(rpc->srpc_peer)); return -ENOMEM; @@ -1175,7 +1175,7 @@ sfw_add_test (srpc_server_rpc_t *rpc) } rc = sfw_add_test_instance(bat, rpc); - CDEBUG (rc == 0 ? D_NET : D_WARNING, + CDEBUG(rc == 0 ? D_NET : D_WARNING, "%s test: sv %d %s, loop %d, concur %d, ndest %d\n", rc == 0 ? "Added" : "Failed to add", request->tsr_service, request->tsr_is_client ? "client" : "server", @@ -1186,7 +1186,7 @@ sfw_add_test (srpc_server_rpc_t *rpc) } static int -sfw_control_batch (srpc_batch_reqst_t *request, srpc_batch_reply_t *reply) +sfw_control_batch(srpc_batch_reqst_t *request, srpc_batch_reply_t *reply) { sfw_session_t *sn = sfw_data.fw_session; int rc = 0; @@ -1285,7 +1285,7 @@ sfw_handle_server_rpc(struct srpc_server_rpc *rpc) switch (sv->sv_id) { default: - LBUG (); + LBUG(); case SRPC_SERVICE_TEST: rc = sfw_add_test(rpc); break; @@ -1387,8 +1387,8 @@ sfw_create_rpc(lnet_process_id_t peer, int service, spin_lock(&sfw_data.fw_lock); - LASSERT (!sfw_data.fw_shuttingdown); - LASSERT (service <= SRPC_FRAMEWORK_SERVICE_MAX_ID); + LASSERT(!sfw_data.fw_shuttingdown); + LASSERT(service <= SRPC_FRAMEWORK_SERVICE_MAX_ID); if (nbulkiov == 0 && !list_empty(&sfw_data.fw_zombie_rpcs)) { rpc = list_entry(sfw_data.fw_zombie_rpcs.next, @@ -1416,13 +1416,13 @@ sfw_create_rpc(lnet_process_id_t peer, int service, } void -sfw_unpack_message (srpc_msg_t *msg) +sfw_unpack_message(srpc_msg_t *msg) { if (msg->msg_magic == SRPC_MSG_MAGIC) return; /* no flipping needed */ /* srpc module should guarantee I wouldn't get crap */ - LASSERT (msg->msg_magic == __swab32(SRPC_MSG_MAGIC)); + LASSERT(msg->msg_magic == __swab32(SRPC_MSG_MAGIC)); if (msg->msg_type == SRPC_MSG_STAT_REQST) { srpc_stat_reqst_t *req = &msg->msg_body.stat_reqst; @@ -1555,12 +1555,12 @@ sfw_unpack_message (srpc_msg_t *msg) return; } - LBUG (); + LBUG(); return; } void -sfw_abort_rpc (srpc_client_rpc_t *rpc) +sfw_abort_rpc(srpc_client_rpc_t *rpc) { LASSERT(atomic_read(&rpc->crpc_refcount) > 0); LASSERT(rpc->crpc_service <= SRPC_FRAMEWORK_SERVICE_MAX_ID); @@ -1572,14 +1572,14 @@ sfw_abort_rpc (srpc_client_rpc_t *rpc) } void -sfw_post_rpc (srpc_client_rpc_t *rpc) +sfw_post_rpc(srpc_client_rpc_t *rpc) { spin_lock(&rpc->crpc_lock); - LASSERT (!rpc->crpc_closed); - LASSERT (!rpc->crpc_aborted); - LASSERT (list_empty(&rpc->crpc_list)); - LASSERT (!sfw_data.fw_shuttingdown); + LASSERT(!rpc->crpc_closed); + LASSERT(!rpc->crpc_aborted); + LASSERT(list_empty(&rpc->crpc_list)); + LASSERT(!sfw_data.fw_shuttingdown); rpc->crpc_timeout = rpc_timeout; srpc_post_rpc(rpc); @@ -1638,7 +1638,7 @@ extern void brw_init_test_service(void); int -sfw_startup (void) +sfw_startup(void) { int i; int rc; @@ -1648,13 +1648,13 @@ sfw_startup (void) if (session_timeout < 0) { - CERROR ("Session timeout must be non-negative: %d\n", + CERROR("Session timeout must be non-negative: %d\n", session_timeout); return -EINVAL; } if (rpc_timeout < 0) { - CERROR ("RPC timeout must be non-negative: %d\n", + CERROR("RPC timeout must be non-negative: %d\n", rpc_timeout); return -EINVAL; } @@ -1678,21 +1678,21 @@ sfw_startup (void) brw_init_test_client(); brw_init_test_service(); rc = sfw_register_test(&brw_test_service, &brw_test_client); - LASSERT (rc == 0); + LASSERT(rc == 0); ping_init_test_client(); ping_init_test_service(); rc = sfw_register_test(&ping_test_service, &ping_test_client); - LASSERT (rc == 0); + LASSERT(rc == 0); error = 0; - list_for_each_entry (tsc, &sfw_data.fw_tests, tsc_list) { + list_for_each_entry(tsc, &sfw_data.fw_tests, tsc_list) { sv = tsc->tsc_srv_service; rc = srpc_add_service(sv); - LASSERT (rc != -EBUSY); + LASSERT(rc != -EBUSY); if (rc != 0) { - CWARN ("Failed to add %s service: %d\n", + CWARN("Failed to add %s service: %d\n", sv->sv_name, rc); error = rc; } @@ -1709,9 +1709,9 @@ sfw_startup (void) sv->sv_bulk_ready = sfw_bulk_ready; rc = srpc_add_service(sv); - LASSERT (rc != -EBUSY); + LASSERT(rc != -EBUSY); if (rc != 0) { - CWARN ("Failed to add %s service: %d\n", + CWARN("Failed to add %s service: %d\n", sv->sv_name, rc); error = rc; } @@ -1733,7 +1733,7 @@ sfw_startup (void) } void -sfw_shutdown (void) +sfw_shutdown(void) { srpc_service_t *sv; sfw_test_case_t *tsc; @@ -1766,7 +1766,7 @@ sfw_shutdown (void) srpc_remove_service(sv); } - list_for_each_entry (tsc, &sfw_data.fw_tests, tsc_list) { + list_for_each_entry(tsc, &sfw_data.fw_tests, tsc_list) { sv = tsc->tsc_srv_service; srpc_shutdown_service(sv); srpc_remove_service(sv); -- cgit v1.2.3 From 0cc5a4f9d5d7389cc01ee676adbb45bcbd77228c Mon Sep 17 00:00:00 2001 From: Katie Dunne Date: Thu, 19 Feb 2015 15:43:12 -0800 Subject: Staging: vt6655: Replace C99 comments with C89 Addresses the checkpatch.pl error: ERROR: Do not use C99 // comments Remove an unneeded comment line Replace C99 comments with C89 Reduce multiple line comments to one line Shorten comments over 80 line by removing blank space Signed-off-by: Katie Dunne Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/srom.h | 47 ++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/srom.h b/drivers/staging/vt6655/srom.h index 7d3e3ef9f17f..fc4b1799efff 100644 --- a/drivers/staging/vt6655/srom.h +++ b/drivers/staging/vt6655/srom.h @@ -24,7 +24,6 @@ * Author: Jerry Chen * * Date: Jan 29, 2003 - * */ #ifndef __SROM_H__ @@ -34,56 +33,50 @@ #define EEP_MAX_CONTEXT_SIZE 256 -#define CB_EEPROM_READBYTE_WAIT 900 //us +#define CB_EEPROM_READBYTE_WAIT 900 /* us */ #define W_MAX_I2CRETRY 0x0fff -// -// Contents in the EEPROM -// -#define EEP_OFS_PAR 0x00 // physical address +/* Contents in the EEPROM */ +#define EEP_OFS_PAR 0x00 /* physical address */ #define EEP_OFS_ANTENNA 0x16 #define EEP_OFS_RADIOCTL 0x17 -#define EEP_OFS_RFTYPE 0x1B // for select RF -#define EEP_OFS_MINCHANNEL 0x1C // Min Channel # -#define EEP_OFS_MAXCHANNEL 0x1D // Max Channel # -#define EEP_OFS_SIGNATURE 0x1E // -#define EEP_OFS_ZONETYPE 0x1F // -#define EEP_OFS_RFTABLE 0x20 // RF POWER TABLE +#define EEP_OFS_RFTYPE 0x1B /* for select RF */ +#define EEP_OFS_MINCHANNEL 0x1C /* Min Channel # */ +#define EEP_OFS_MAXCHANNEL 0x1D /* Max Channel # */ +#define EEP_OFS_SIGNATURE 0x1E +#define EEP_OFS_ZONETYPE 0x1F +#define EEP_OFS_RFTABLE 0x20 /* RF POWER TABLE */ #define EEP_OFS_PWR_CCK 0x20 #define EEP_OFS_SETPT_CCK 0x21 #define EEP_OFS_PWR_OFDMG 0x23 #define EEP_OFS_SETPT_OFDMG 0x24 -#define EEP_OFS_PWR_FORMULA_OST 0x26 // +#define EEP_OFS_PWR_FORMULA_OST 0x26 #define EEP_OFS_MAJOR_VER 0x2E #define EEP_OFS_MINOR_VER 0x2F #define EEP_OFS_CCK_PWR_TBL 0x30 #define EEP_OFS_CCK_PWR_dBm 0x3F #define EEP_OFS_OFDM_PWR_TBL 0x40 #define EEP_OFS_OFDM_PWR_dBm 0x4F -//{{ RobertYu: 20041124 +/*{{ RobertYu: 20041124 */ #define EEP_OFS_SETPT_OFDMA 0x4E #define EEP_OFS_OFDMA_PWR_TBL 0x50 -//}} +/*}}*/ #define EEP_OFS_OFDMA_PWR_dBm 0xD2 -//----------need to remove -------------------- -#define EEP_OFS_BBTAB_LEN 0x70 // BB Table Length -#define EEP_OFS_BBTAB_ADR 0x71 // BB Table Offset -#define EEP_OFS_CHECKSUM 0xFF // reserved area for baseband 28h ~ 78h +/*----------need to remove --------------------*/ +#define EEP_OFS_BBTAB_LEN 0x70 /* BB Table Length */ +#define EEP_OFS_BBTAB_ADR 0x71 /* BB Table Offset */ +#define EEP_OFS_CHECKSUM 0xFF /* reserved area for baseband 28h~78h */ -#define EEP_I2C_DEV_ID 0x50 // EEPROM device address on the I2C bus +#define EEP_I2C_DEV_ID 0x50 /* EEPROM device address on I2C bus */ -// -// Bits in EEP_OFS_ANTENNA -// +/* Bits in EEP_OFS_ANTENNA */ #define EEP_ANTENNA_MAIN 0x01 #define EEP_ANTENNA_AUX 0x02 #define EEP_ANTINV 0x04 -// -// Bits in EEP_OFS_RADIOCTL -// +/* Bits in EEP_OFS_RADIOCTL */ #define EEP_RADIOCTL_ENABLE 0x80 #define EEP_RADIOCTL_INV 0x01 @@ -103,4 +96,4 @@ void SROMvReadAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs); void SROMvReadEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress); -#endif // __EEPROM_H__ +#endif /* __EEPROM_H__*/ -- cgit v1.2.3 From 4d36302448dde607faac07f76d9da92654404981 Mon Sep 17 00:00:00 2001 From: Katie Dunne Date: Fri, 20 Feb 2015 14:51:02 -0800 Subject: Staging: vt6655: break lines over 80 characters Addresses checkpatch.pl warning: WARNING: line over 80 characters Break 2 lines over 80 characters and align with opening parenthesis Signed-off-by: Katie Dunne Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/srom.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/srom.h b/drivers/staging/vt6655/srom.h index fc4b1799efff..531bf0069373 100644 --- a/drivers/staging/vt6655/srom.h +++ b/drivers/staging/vt6655/srom.h @@ -90,10 +90,12 @@ /*--------------------- Export Functions --------------------------*/ -unsigned char SROMbyReadEmbedded(void __iomem *dwIoBase, unsigned char byContntOffset); +unsigned char SROMbyReadEmbedded(void __iomem *dwIoBase, + unsigned char byContntOffset); void SROMvReadAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs); -void SROMvReadEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress); +void SROMvReadEtherAddress(void __iomem *dwIoBase, + unsigned char *pbyEtherAddress); #endif /* __EEPROM_H__*/ -- cgit v1.2.3 From 34c3a15061af61d73f90aa7d87e8531550878ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Sat, 21 Feb 2015 22:37:16 +0200 Subject: Staging: vt6655: changed C99 // comments // erased and replace it with /* */ used. Error found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/mib.c | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/mib.c b/drivers/staging/vt6655/mib.c index d2f351d19ff8..d55c762027ed 100644 --- a/drivers/staging/vt6655/mib.c +++ b/drivers/staging/vt6655/mib.c @@ -63,51 +63,51 @@ void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr) /**********************/ /* ABNORMAL interrupt */ /**********************/ - // not any IMR bit invoke irq + /* not any IMR bit invoke irq */ if (dwIsr == 0) { pStatistic->ISRStat.dwIsrUnknown++; return; } -//Added by Kyle - if (dwIsr & ISR_TXDMA0) // ISR, bit0 - pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful +/* Added by Kyle */ + if (dwIsr & ISR_TXDMA0) /* ISR, bit0 */ + pStatistic->ISRStat.dwIsrTx0OK++; /* TXDMA0 successful */ - if (dwIsr & ISR_AC0DMA) // ISR, bit1 - pStatistic->ISRStat.dwIsrAC0TxOK++; // AC0DMA successful + if (dwIsr & ISR_AC0DMA) /* ISR, bit1 */ + pStatistic->ISRStat.dwIsrAC0TxOK++; /* AC0DMA successful */ - if (dwIsr & ISR_BNTX) // ISR, bit2 - pStatistic->ISRStat.dwIsrBeaconTxOK++; // BeaconTx successful + if (dwIsr & ISR_BNTX) /* ISR, bit2 */ + pStatistic->ISRStat.dwIsrBeaconTxOK++; /* BeaconTx successful */ - if (dwIsr & ISR_RXDMA0) // ISR, bit3 - pStatistic->ISRStat.dwIsrRx0OK++; // Rx0 successful + if (dwIsr & ISR_RXDMA0) /* ISR, bit3 */ + pStatistic->ISRStat.dwIsrRx0OK++; /* Rx0 successful */ - if (dwIsr & ISR_TBTT) // ISR, bit4 - pStatistic->ISRStat.dwIsrTBTTInt++; // TBTT successful + if (dwIsr & ISR_TBTT) /* ISR, bit4 */ + pStatistic->ISRStat.dwIsrTBTTInt++; /* TBTT successful */ - if (dwIsr & ISR_SOFTTIMER) // ISR, bit6 + if (dwIsr & ISR_SOFTTIMER) /* ISR, bit6 */ pStatistic->ISRStat.dwIsrSTIMERInt++; - if (dwIsr & ISR_WATCHDOG) // ISR, bit7 + if (dwIsr & ISR_WATCHDOG) /* ISR, bit7 */ pStatistic->ISRStat.dwIsrWatchDog++; - if (dwIsr & ISR_FETALERR) // ISR, bit8 + if (dwIsr & ISR_FETALERR) /* ISR, bit8 */ pStatistic->ISRStat.dwIsrUnrecoverableError++; - if (dwIsr & ISR_SOFTINT) // ISR, bit9 - pStatistic->ISRStat.dwIsrSoftInterrupt++; // software interrupt + if (dwIsr & ISR_SOFTINT) /* ISR, bit9 */ + pStatistic->ISRStat.dwIsrSoftInterrupt++; /* software interrupt */ - if (dwIsr & ISR_MIBNEARFULL) // ISR, bit10 + if (dwIsr & ISR_MIBNEARFULL) /* ISR, bit10 */ pStatistic->ISRStat.dwIsrMIBNearfull++; - if (dwIsr & ISR_RXNOBUF) // ISR, bit11 - pStatistic->ISRStat.dwIsrRxNoBuf++; // Rx No Buff + if (dwIsr & ISR_RXNOBUF) /* ISR, bit11 */ + pStatistic->ISRStat.dwIsrRxNoBuf++; /* Rx No Buff */ - if (dwIsr & ISR_RXDMA1) // ISR, bit12 - pStatistic->ISRStat.dwIsrRx1OK++; // Rx1 successful + if (dwIsr & ISR_RXDMA1) /* ISR, bit12 */ + pStatistic->ISRStat.dwIsrRx1OK++; /* Rx1 successful */ - if (dwIsr & ISR_SOFTTIMER1) // ISR, bit21 + if (dwIsr & ISR_SOFTTIMER1) /* ISR, bit21 */ pStatistic->ISRStat.dwIsrSTIMER1Int++; } -- cgit v1.2.3 From 1aba012174629ecc8088979de6d45e09cf6ab88d Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Sun, 22 Feb 2015 15:27:56 +0200 Subject: Staging: vt6656: replace memcpy() by ether_addr_copy() using coccinelle and pack variable This patch focuses on fixing the following warning generated by checkpatch.pl for the file rxtx.c Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); According to ether_addr_copy() description and functionality, all Ethernet addresses should align to the u16 datatype. The changes were applied using the following coccinelle rule: Here is the output of pahole for the relevant datastructures: struct vnt_usb_send_context { void * priv; /* 0 8*/ struct sk_buff * skb; /* 8 8*/ struct urb * urb; /* 16 8*/ struct ieee80211_hdr * hdr; /* 24 8*/ unsigned int buf_len; /* 32 4*/ u32 frame_len; /* 36 4*/ u16 tx_hdr_size; /* 40 2*/ u16 tx_rate; /* 42 2*/ u8 type; /* 44 1*/ u8 pkt_no; /* 45 1*/ u8 pkt_type; /* 46 1*/ u8 need_ack; /* 47 1*/ u8 fb_option; /* 48 1*/ bool in_use; /* 49 1*/ unsigned char data[2900]; /* 50 2900*/ /* --- cacheline 46 boundary (2944 bytes) was 6 bytes ago --- */ /* size: 2952, cachelines: 47, members: 15 */ /* padding: 2 */ /* last cacheline: 8 bytes */ }; struct ieee80211_key_conf { u32 cipher; /* 0 4*/ u8 icv_len; /* 4 1*/ u8 iv_len; /* 5 1*/ u8 hw_key_idx; /* 6 1*/ u8 flags; /* 7 1*/ s8 keyidx; /* 8 1*/ u8 keylen; /* 9 1*/ u8 key[0]; /* 10 0*/ /* size: 12, cachelines: 1, members: 8 */ /* padding: 2 */ /* last cacheline: 12 bytes */ }; struct vnt_mic_hdr { u8 id; /* 0 1*/ u8 tx_priority; /* 1 1*/ u8 mic_addr2[6]; /* 2 6*/ u8 ccmp_pn[6]; /* 8 6*/ __be16 payload_len; /* 14 2*/ __be16 hlen; /* 16 2*/ __le16 frame_control; /* 18 2*/ u8 addr1[6]; /* 20 6*/ u8 addr2[6]; /* 26 6*/ u8 addr3[6]; /* 32 6*/ __le16 seq_ctrl; /* 38 2*/ u8 addr4[6]; /* 40 6*/ u16 packing; /* 46 2*/ /* size: 48, cachelines: 1, members: 13 */ /* last cacheline: 48 bytes */ }; Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rxtx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 33baf26de4b5..f6c2cf8590c4 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -755,9 +755,9 @@ static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context, else mic_hdr->hlen = cpu_to_be16(22); - memcpy(mic_hdr->addr1, hdr->addr1, ETH_ALEN); - memcpy(mic_hdr->addr2, hdr->addr2, ETH_ALEN); - memcpy(mic_hdr->addr3, hdr->addr3, ETH_ALEN); + ether_addr_copy(mic_hdr->addr1, hdr->addr1); + ether_addr_copy(mic_hdr->addr2, hdr->addr2); + ether_addr_copy(mic_hdr->addr3, hdr->addr3); mic_hdr->frame_control = cpu_to_le16( le16_to_cpu(hdr->frame_control) & 0xc78f); @@ -765,7 +765,7 @@ static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context, le16_to_cpu(hdr->seq_ctrl) & 0xf); if (ieee80211_has_a4(hdr->frame_control)) - memcpy(mic_hdr->addr4, hdr->addr4, ETH_ALEN); + ether_addr_copy(mic_hdr->addr4, hdr->addr4); memcpy(key_buffer, tx_key->key, WLAN_KEY_LEN_CCMP); -- cgit v1.2.3 From f643bad17fde32dcc4700801a97f147aa3cb3977 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Wed, 18 Feb 2015 03:07:20 +0530 Subject: Staging: i2o: Use preferred library linux/uaccess.h over asm/uaccess.h This patch fixes checkpatch.pl warning "Use #include instead of " in i2o/config-osm.c . Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/config-osm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/config-osm.c b/drivers/staging/i2o/config-osm.c index 519f52f9f688..45091ac66154 100644 --- a/drivers/staging/i2o/config-osm.c +++ b/drivers/staging/i2o/config-osm.c @@ -19,7 +19,7 @@ #include #include -#include +#include #define OSM_NAME "config-osm" #define OSM_VERSION "1.323" -- cgit v1.2.3 From e267cc5e48fbc1acba6f0b0dd7e6871f2733a8fc Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Wed, 18 Feb 2015 03:52:07 +0530 Subject: Staging: i2o: Convert comment from C99 style to C89 style This patch fixes checkpatch.pl error in debug.c ERROR: do not use C99 // comments Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/debug.c b/drivers/staging/i2o/debug.c index 7a16114ed8ea..6a760db0565c 100644 --- a/drivers/staging/i2o/debug.c +++ b/drivers/staging/i2o/debug.c @@ -22,7 +22,7 @@ void i2o_report_status(const char *severity, const char *str, u16 detailed_status = msg[4] & 0xFFFF; if (cmd == I2O_CMD_UTIL_EVT_REGISTER) - return; // No status in this reply + return; /* No status in this reply */ printk("%s%s: ", severity, str); -- cgit v1.2.3 From 9e95ff88fe26fdbdce5679339b87641ec43175cf Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 19 Feb 2015 00:22:24 +0530 Subject: Staging: i2o: Remove space after the * in a pointer type variable This patch is to remove space after the * in pointer type function parameters in function prototype and definition to follow kernel coding conventions. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/debug.c b/drivers/staging/i2o/debug.c index 6a760db0565c..73123ca6b9a1 100644 --- a/drivers/staging/i2o/debug.c +++ b/drivers/staging/i2o/debug.c @@ -5,7 +5,7 @@ static void i2o_report_util_cmd(u8 cmd); static void i2o_report_exec_cmd(u8 cmd); -static void i2o_report_fail_status(u8 req_status, u32 * msg); +static void i2o_report_fail_status(u8 req_status, u32 *msg); static void i2o_report_common_status(u8 req_status); static void i2o_report_common_dsc(u16 detailed_status); @@ -66,7 +66,7 @@ void i2o_dump_message(struct i2o_message *m) * Following fail status are common to all classes. * The preserved message must be handled in the reply handler. */ -static void i2o_report_fail_status(u8 req_status, u32 * msg) +static void i2o_report_fail_status(u8 req_status, u32 *msg) { static char *FAIL_STATUS[] = { "0x80", /* not used */ -- cgit v1.2.3 From f0a6fb6624964c9df17e1519d98c6609e7604be9 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 19 Feb 2015 01:19:16 +0530 Subject: Staging: i2o: Join quoted string split across lines This patch removes the checkpatch.pl warnings "quoted string split accross lines" Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/driver.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/driver.c b/drivers/staging/i2o/driver.c index 111c3edde035..06119bb3eb5f 100644 --- a/drivers/staging/i2o/driver.c +++ b/drivers/staging/i2o/driver.c @@ -102,8 +102,7 @@ int i2o_driver_register(struct i2o_driver *drv) for (i = 0; i2o_drivers[i]; i++) if (i >= i2o_max_drivers) { - osm_err("too many drivers registered, increase " - "max_drivers\n"); + osm_err("too many drivers registered, increase max_drivers\n"); spin_unlock_irqrestore(&i2o_drivers_lock, flags); rc = -EFAULT; goto out; @@ -244,8 +243,8 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m) } if (unlikely(!drv->reply)) { - osm_debug("%s: Reply to driver %s, but no reply function" - " defined!\n", c->name, drv->name); + osm_debug("%s: Reply to driver %s, but no reply function defined!\n", + c->name, drv->name); return -EIO; } -- cgit v1.2.3 From 7c4550aff76cb7f1deb86b67041d4c77001bcc8c Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 20 Feb 2015 03:43:52 +0200 Subject: staging: i2o: Use #include instead of This patch fixes the following checkpatch.pl warning: Use #include instead of Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/i2o_config.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/i2o_config.c b/drivers/staging/i2o/i2o_config.c index 04bd3b6de401..574866311b43 100644 --- a/drivers/staging/i2o/i2o_config.c +++ b/drivers/staging/i2o/i2o_config.c @@ -34,8 +34,7 @@ #include #include #include - -#include +#include #include "core.h" -- cgit v1.2.3 From 30463dcfa2c19d72b6ebdd4073abbe65531656a2 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 20 Feb 2015 03:44:31 +0200 Subject: staging: i2o: Use #include instead of This patch fixes the following checkpatch.pl warning: Use #include instead of Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/i2o_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/i2o_proc.c b/drivers/staging/i2o/i2o_proc.c index ad84f3304f3c..cea536a8df6f 100644 --- a/drivers/staging/i2o/i2o_proc.c +++ b/drivers/staging/i2o/i2o_proc.c @@ -48,9 +48,9 @@ #include #include #include +#include #include -#include #include /* Structure used to define /proc entries */ -- cgit v1.2.3 From 924954f12448249756ccbc45ba1e5e53bf9cfaee Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 26 Feb 2015 00:10:20 +0200 Subject: Staging: i2o: Remove unnecessary 'out of memory' message This patch removes unnecessay out of memory message fixing the following checkpach.pl warning in device.c Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/device.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/device.c b/drivers/staging/i2o/device.c index 2af22553dd4e..162a88762ff1 100644 --- a/drivers/staging/i2o/device.c +++ b/drivers/staging/i2o/device.c @@ -566,7 +566,6 @@ int i2o_parm_table_get(struct i2o_device *dev, int oper, int group, opblk = kmalloc(size, GFP_KERNEL); if (opblk == NULL) { - printk(KERN_ERR "i2o: no memory for query buffer.\n"); return -ENOMEM; } -- cgit v1.2.3 From 1e0e76508c55eac8475735b1ae79d41288edda94 Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 26 Feb 2015 00:10:21 +0200 Subject: Staging: i2o: Remove unnecessary braces Brackets were removed from the expression that containing single statement. Removed following checkpatch.pl warnings: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/device.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/device.c b/drivers/staging/i2o/device.c index 162a88762ff1..e47496cb0ac2 100644 --- a/drivers/staging/i2o/device.c +++ b/drivers/staging/i2o/device.c @@ -565,9 +565,8 @@ int i2o_parm_table_get(struct i2o_device *dev, int oper, int group, size += 4 - size % 4; opblk = kmalloc(size, GFP_KERNEL); - if (opblk == NULL) { + if (opblk == NULL) return -ENOMEM; - } opblk[0] = 1; /* operation count */ opblk[1] = 0; /* pad */ -- cgit v1.2.3 From cbd8e0863a0ab335b9cce2aa9e7471e3895764f4 Mon Sep 17 00:00:00 2001 From: Yeliz Taneroglu Date: Thu, 26 Feb 2015 01:45:36 +0200 Subject: Staging: i2o: Removed unnecessary braces The following patch fixes the checkpatch.pl warning: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Yeliz Taneroglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/i2o_proc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/i2o_proc.c b/drivers/staging/i2o/i2o_proc.c index cea536a8df6f..27d6b824aff8 100644 --- a/drivers/staging/i2o/i2o_proc.c +++ b/drivers/staging/i2o/i2o_proc.c @@ -85,9 +85,8 @@ static int print_serial_number(struct seq_file *seq, u8 * serialno, int max_len) switch (serialno[0]) { case I2O_SNFORMAT_BINARY: /* Binary */ seq_printf(seq, "0x"); - for (i = 0; i < serialno[1]; i++) { + for (i = 0; i < serialno[1]; i++) seq_printf(seq, "%02X", serialno[2 + i]); - } break; case I2O_SNFORMAT_ASCII: /* ASCII */ @@ -101,9 +100,8 @@ static int print_serial_number(struct seq_file *seq, u8 * serialno, int max_len) seq_printf(seq, "%s", &serialno[2]); } else { /* print chars for specified length */ - for (i = 0; i < serialno[1]; i++) { + for (i = 0; i < serialno[1]; i++) seq_printf(seq, "%c", serialno[2 + i]); - } } break; -- cgit v1.2.3 From 96748c9635d736cceb1ba0ad4fd66857f1d5aef5 Mon Sep 17 00:00:00 2001 From: Yeliz Taneroglu Date: Thu, 26 Feb 2015 01:26:36 +0200 Subject: Staging: i2o: Add blank line This patch fixes the checkpatch.pl warning: WARNING: "Missing a blank line after declarations" Signed-off-by: Yeliz Taneroglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/debug.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/debug.c b/drivers/staging/i2o/debug.c index 73123ca6b9a1..12b783b2a86c 100644 --- a/drivers/staging/i2o/debug.c +++ b/drivers/staging/i2o/debug.c @@ -54,6 +54,7 @@ void i2o_dump_message(struct i2o_message *m) #ifdef DEBUG u32 *msg = (u32 *) m; int i; + printk(KERN_INFO "Dumping I2O message size %d @ %p\n", msg[0] >> 16 & 0xffff, msg); for (i = 0; i < ((msg[0] >> 16) & 0xffff); i++) -- cgit v1.2.3 From 08e28893b3886e7f2a2b77adcbdb2bfa91301d3a Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 18 Feb 2015 22:22:29 +0530 Subject: Staging: media: lirc: Use setup_timer This patch introduces the use of function setup_timer instead of structure assignments as it is the preferred way to setup and set the timer. This is done using Coccinelle and semantic patch used is as follows: @@ expression x,y,z; @@ - init_timer (&x); + setup_timer (&x, y, z); - x.function = y; - x.data = z; Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_sir.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c index 39f4733fb1ee..d1ada8c72f0d 100644 --- a/drivers/staging/media/lirc/lirc_sir.c +++ b/drivers/staging/media/lirc/lirc_sir.c @@ -683,9 +683,7 @@ static int init_port(void) } pr_info("I/O port 0x%.4x, IRQ %d.\n", io, irq); - init_timer(&timerlist); - timerlist.function = sir_timeout; - timerlist.data = 0xabadcafe; + setup_timer(&timerlist, sir_timeout, 0xabadcafe); return 0; } -- cgit v1.2.3 From b856e0f7b2727e6de293a67e71a1ddec8648fa64 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 18 Feb 2015 22:22:38 +0530 Subject: Staging: media: Change data value in setup_timer function Here, data value 0xabadcafe in function setup_timer seems like a nonsense value and timer handler function is not using it anyway. So, change it to 0. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_sir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c index d1ada8c72f0d..29087f66e2f4 100644 --- a/drivers/staging/media/lirc/lirc_sir.c +++ b/drivers/staging/media/lirc/lirc_sir.c @@ -683,7 +683,7 @@ static int init_port(void) } pr_info("I/O port 0x%.4x, IRQ %d.\n", io, irq); - setup_timer(&timerlist, sir_timeout, 0xabadcafe); + setup_timer(&timerlist, sir_timeout, 0); return 0; } -- cgit v1.2.3 From b4c2c314c140611f3f9c1496a60e55174ba96da7 Mon Sep 17 00:00:00 2001 From: Katie Dunne Date: Wed, 18 Feb 2015 18:05:40 -0800 Subject: Staging: media: mn88473: Match alignment with open parenthesis Fixes the checkpatch.pl Check: CHECK: Alignment should match open parenthesis Increases readability by standardizing 7 argument indentations Signed-off-by: Katie Dunne Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/mn88473/mn88473.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/mn88473/mn88473.c b/drivers/staging/media/mn88473/mn88473.c index a333744b76b9..197e2d0871f4 100644 --- a/drivers/staging/media/mn88473/mn88473.c +++ b/drivers/staging/media/mn88473/mn88473.c @@ -17,7 +17,7 @@ #include "mn88473_priv.h" static int mn88473_get_tune_settings(struct dvb_frontend *fe, - struct dvb_frontend_tune_settings *s) + struct dvb_frontend_tune_settings *s) { s->min_delay_ms = 1000; return 0; @@ -33,10 +33,14 @@ static int mn88473_set_frontend(struct dvb_frontend *fe) u8 delivery_system_val, if_val[3], bw_val[7]; dev_dbg(&client->dev, - "delivery_system=%u modulation=%u frequency=%u bandwidth_hz=%u symbol_rate=%u inversion=%d stream_id=%d\n", - c->delivery_system, c->modulation, - c->frequency, c->bandwidth_hz, c->symbol_rate, - c->inversion, c->stream_id); + "delivery_system=%u modulation=%u frequency=%u bandwidth_hz=%u symbol_rate=%u inversion=%d stream_id=%d\n", + c->delivery_system, + c->modulation, + c->frequency, + c->bandwidth_hz, + c->symbol_rate, + c->inversion, + c->stream_id); if (!dev->warm) { ret = -EAGAIN; @@ -112,7 +116,7 @@ static int mn88473_set_frontend(struct dvb_frontend *fe) break; default: dev_err(&client->dev, "IF frequency %d not supported\n", - if_frequency); + if_frequency); ret = -EINVAL; goto err; } @@ -229,7 +233,7 @@ static int mn88473_init(struct dvb_frontend *fe) } dev_info(&client->dev, "downloading firmware from file '%s'\n", - fw_file); + fw_file); ret = regmap_write(dev->regmap[0], 0xf5, 0x03); if (ret) @@ -242,10 +246,10 @@ static int mn88473_init(struct dvb_frontend *fe) len = (dev->i2c_wr_max - 1); ret = regmap_bulk_write(dev->regmap[0], 0xf6, - &fw->data[fw->size - remaining], len); + &fw->data[fw->size - remaining], len); if (ret) { dev_err(&client->dev, "firmware download failed=%d\n", - ret); + ret); goto err; } } @@ -325,7 +329,7 @@ static struct dvb_frontend_ops mn88473_ops = { }; static int mn88473_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { struct mn88473_config *config = client->dev.platform_data; struct mn88473_dev *dev; -- cgit v1.2.3 From 9a9bdd689c12d09fe2554947b053f8964e28e440 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 21:14:41 +0200 Subject: staging: comedi: drivers: replace init_timer by setup_timer This patch replaces init_timer and 2 step initialization of function and data by setup_timer to make the code more concise. The issue was discovered using the following coccinelle script: @@ expression ds, e1, e2; @@ -init_timer (&ds); +setup_timer (&ds, e1, e2); ... -ds.function = e1; ... -ds.data = e2; Acked-by: Julia Lawall Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_test.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index e56525a1c8f3..fbc43420f698 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -420,9 +420,8 @@ static int waveform_attach(struct comedi_device *dev, for (i = 0; i < s->n_chan; i++) devpriv->ao_loopbacks[i] = s->maxdata / 2; - init_timer(&devpriv->timer); - devpriv->timer.function = waveform_ai_interrupt; - devpriv->timer.data = (unsigned long)dev; + setup_timer(&devpriv->timer, waveform_ai_interrupt, + (unsigned long)dev); dev_info(dev->class_dev, "%s: %i microvolt, %li microsecond waveform attached\n", -- cgit v1.2.3 From 78f5d8f9f98fdc4df86b5d0002c55fd270f36b43 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 20 Feb 2015 12:58:50 +0530 Subject: Staging: rtl8188eu: Remove unused struct ndis_802_11_key This patch removes struct ndis_802_11_key as it is defined in a header file but never used. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/wlan_bssdef.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/include/wlan_bssdef.h b/drivers/staging/rtl8188eu/include/wlan_bssdef.h index 53b1bd8e9946..85b99da49a2d 100644 --- a/drivers/staging/rtl8188eu/include/wlan_bssdef.h +++ b/drivers/staging/rtl8188eu/include/wlan_bssdef.h @@ -156,16 +156,6 @@ enum ndis_802_11_reload_def { Ndis802_11ReloadWEPKeys }; -/* Key mapping keys require a BSSID */ -struct ndis_802_11_key { - u32 Length; /* Length of this structure */ - u32 KeyIndex; - u32 KeyLength; /* length of key in bytes */ - unsigned char BSSID[ETH_ALEN]; - unsigned long long KeyRSC; - u8 KeyMaterial[32]; /* var len depending on above field */ -}; - struct ndis_802_11_remove_key { u32 Length; /* Length */ u32 KeyIndex; -- cgit v1.2.3 From e4504a1519544f40675fccbe0d93e993cbb04f06 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 20 Feb 2015 14:18:37 +0530 Subject: Staging: rtl8188eu: Use put_unaligned_le16 Using byte ordering functions and then memcpy() is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of function put_unaligned_le16 which makes the code clear. Here, use of variable tim_bitmap_le and variable itself is removed. Also, to be compatible with the changes header file is added too. Coccinelle is used to do this change and semantic patch used for this is as follows: @a@ typedef __le16; __le16 e16; identifier tmp; expression ptr; expression y,e; type T; @@ - tmp = cpu_to_le16(y); <+... when != tmp ( - memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\)); + put_unaligned_le16(y,ptr); | - memcpy(ptr, (T)&tmp, ...); + put_unaligned_le16(y,ptr); ) ...+> ? tmp = e @@ type T; identifier a.tmp; @@ - T tmp; ...when != tmp Signed-off-by: Vaishali Thakkar Reviewed-by: Arnd Bergmann Reviewed-by: Preeti U Murthy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index da19145c49c5..e65ee6e858a8 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef CONFIG_88EU_AP_MODE @@ -78,11 +79,8 @@ static void update_BCNTIM(struct adapter *padapter) if (true) { u8 *p, *dst_ie, *premainder_ie = NULL; u8 *pbackup_remainder_ie = NULL; - __le16 tim_bitmap_le; uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap); - p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); if (p != NULL && tim_ielen > 0) { tim_ielen += 2; @@ -137,9 +135,9 @@ static void update_BCNTIM(struct adapter *padapter) *dst_ie++ = 0; if (tim_ielen == 4) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap & 0xff; } else if (tim_ielen == 5) { - memcpy(dst_ie, &tim_bitmap_le, 2); + put_unaligned_le16(pstapriv->tim_bitmap, dst_ie); dst_ie += 2; } -- cgit v1.2.3 From 3da741ff942d48ea33608fce6ca16ff67a0b61c8 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Sun, 22 Feb 2015 18:07:33 +0530 Subject: Staging: rtl8188eu: Fix line over 80 characters Added a variable to reduce line size and enhance code readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/bb_cfg.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c b/drivers/staging/rtl8188eu/hal/bb_cfg.c index 1e963bf9e48b..262da889d360 100644 --- a/drivers/staging/rtl8188eu/hal/bb_cfg.c +++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c @@ -511,42 +511,43 @@ static u32 array_phy_reg_pg_8188e[] = { static void store_pwrindex_offset(struct adapter *Adapter, u32 regaddr, u32 bitmask, u32 data) { struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); + u8 pwrGrpCnt = hal_data->pwrGroupCnt; if (regaddr == rTxAGC_A_Rate18_06) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][0] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][0] = data; if (regaddr == rTxAGC_A_Rate54_24) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][1] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][1] = data; if (regaddr == rTxAGC_A_CCK1_Mcs32) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][6] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][6] = data; if (regaddr == rTxAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][7] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][7] = data; if (regaddr == rTxAGC_A_Mcs03_Mcs00) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][2] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][2] = data; if (regaddr == rTxAGC_A_Mcs07_Mcs04) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][3] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][3] = data; if (regaddr == rTxAGC_A_Mcs11_Mcs08) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][4] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][4] = data; if (regaddr == rTxAGC_A_Mcs15_Mcs12) { - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][5] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][5] = data; if (hal_data->rf_type == RF_1T1R) hal_data->pwrGroupCnt++; } if (regaddr == rTxAGC_B_Rate18_06) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][8] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][8] = data; if (regaddr == rTxAGC_B_Rate54_24) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][9] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][9] = data; if (regaddr == rTxAGC_B_CCK1_55_Mcs32) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][14] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][14] = data; if (regaddr == rTxAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][15] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][15] = data; if (regaddr == rTxAGC_B_Mcs03_Mcs00) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][10] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][10] = data; if (regaddr == rTxAGC_B_Mcs07_Mcs04) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][11] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][11] = data; if (regaddr == rTxAGC_B_Mcs11_Mcs08) - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][12] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][12] = data; if (regaddr == rTxAGC_B_Mcs15_Mcs12) { - hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][13] = data; + hal_data->MCSTxPowerLevelOriginalOffset[pwrGrpCnt][13] = data; if (hal_data->rf_type != RF_1T1R) hal_data->pwrGroupCnt++; } -- cgit v1.2.3 From 9734d632bb5d05723b675643ff5f5da1fdb3ac2a Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Mon, 23 Feb 2015 14:20:30 +0530 Subject: Staging: rtl8188eu: Remove unnecessary variable Remove unneccessary variable and replace its uses with another variable which is previously defined. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 3f663fe151ba..3950cb35029e 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -72,12 +72,10 @@ static u32 rf_serial_read(struct adapter *adapt, u32 ret = 0; struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); struct bb_reg_def *phyreg = &hal_data->PHYRegDef[rfpath]; - u32 newoffset; u32 tmplong, tmplong2; u8 rfpi_enable = 0; offset &= 0xff; - newoffset = offset; tmplong = phy_query_bb_reg(adapt, rFPGA0_XA_HSSIParameter2, bMaskDWord); if (rfpath == RF_PATH_A) @@ -87,7 +85,7 @@ static u32 rf_serial_read(struct adapter *adapt, bMaskDWord); tmplong2 = (tmplong2 & (~bLSSIReadAddress)) | - (newoffset<<23) | bLSSIReadEdge; + (offset<<23) | bLSSIReadEdge; phy_set_bb_reg(adapt, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong&(~bLSSIReadEdge)); -- cgit v1.2.3 From efb8d497941fc2f97d87da65dfa93b7df620143a Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Mon, 23 Feb 2015 14:41:07 +0530 Subject: Staging: rtl8188eu: Replace unneeded switch-case block Replace switch-case block with single if statement to increase code readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 3950cb35029e..623fb4f4335a 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -302,21 +302,8 @@ static void phy_set_bw_mode_callback(struct adapter *adapt) } /* Set RF related register */ - switch (hal_data->rf_chip) { - case RF_8225: - break; - case RF_8256: - break; - case RF_8258: - break; - case RF_PSEUDO_11N: - break; - case RF_6052: + if (hal_data->rf_chip == RF_6052) rtl88eu_phy_rf6052_set_bandwidth(adapt, hal_data->CurrentChannelBW); - break; - default: - break; - } } void phy_set_bw_mode(struct adapter *adapt, enum ht_channel_width bandwidth, -- cgit v1.2.3 From 93ab486d3f2f87118c5a268a9ceeaf8721bfcb1b Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Mon, 23 Feb 2015 19:32:38 +0530 Subject: Staging: rtl8188eu: Changed array and loop construct This function only required the array from the 14th element onwards. Therefore, the array size is reduced and the loop counter is modified so as to start from 0. Also, the assignment of variable place is redundant as it is initialized again in the loop. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 623fb4f4335a..6448fca5365e 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -371,19 +371,18 @@ void phy_sw_chnl(struct adapter *adapt, u8 channel) static u8 get_right_chnl_for_iqk(u8 chnl) { + u8 place; u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153, 155, 157, 159, 161, 163, 165 }; - u8 place = chnl; if (chnl > 14) { - for (place = 14; place < sizeof(channel_all); place++) { + for (place = 0; place < sizeof(channel_all); place++) { if (channel_all[place] == chnl) - return place-13; + return ++place; } } return 0; -- cgit v1.2.3 From 1068fb676aaed35c30b96f6327d97e99d1be88b2 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Tue, 24 Feb 2015 00:32:44 +0200 Subject: Staging: rtl8188eu: Add blank line after declarations WARNING: "Missing a blank line after declarations" That was found by running checkpatch Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c index 3c651d5c6824..2c23aa92e696 100644 --- a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c +++ b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c @@ -538,6 +538,7 @@ int ODM_RAInfo_Init(struct odm_dm_struct *dm_odm, u8 macid) struct odm_ra_info *pRaInfo = &dm_odm->RAInfo[macid]; u8 WirelessMode = 0xFF; /* invalid value */ u8 max_rate_idx = 0x13; /* MCS7 */ + if (dm_odm->pWirelessMode != NULL) WirelessMode = *(dm_odm->pWirelessMode); -- cgit v1.2.3 From 8e2c69b62d700a3d813ddc82fc9fe538460bc4a7 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 26 Feb 2015 18:31:52 +0530 Subject: Staging: rtl8188eu: Remove redundant if condition Remove redundant if condition as !result is always false. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 6448fca5365e..e1d192fade6b 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -346,7 +346,6 @@ void phy_sw_chnl(struct adapter *adapt, u8 channel) { struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); u8 tmpchannel = hal_data->CurrentChannel; - bool result = true; if (hal_data->rf_chip == RF_PSEUDO_11N) return; @@ -356,15 +355,10 @@ void phy_sw_chnl(struct adapter *adapt, u8 channel) hal_data->CurrentChannel = channel; - if ((!adapt->bDriverStopped) && (!adapt->bSurpriseRemoved)) { + if ((!adapt->bDriverStopped) && (!adapt->bSurpriseRemoved)) phy_sw_chnl_callback(adapt, channel); - - if (!result) - hal_data->CurrentChannel = tmpchannel; - - } else { + else hal_data->CurrentChannel = tmpchannel; - } } #define ODM_TXPWRTRACK_MAX_IDX_88E 6 -- cgit v1.2.3 From d5dd06ea01807a6d32af1eb53f10ff5e08532e29 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Tue, 24 Feb 2015 00:06:14 +0530 Subject: Staging: rtl8188eu: Replace ternary operator with existing macro Replace ternary operator with existing abs() macro to increase code readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index e1d192fade6b..175b87ef8889 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -577,9 +577,8 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) } if (delta > 0 && dm_odm->RFCalibrateInfo.TxPowerTrackControl) { - delta = thermal_val > hal_data->EEPROMThermalMeter ? - (thermal_val - hal_data->EEPROMThermalMeter) : - (hal_data->EEPROMThermalMeter - thermal_val); + delta = abs(hal_data->EEPROMThermalMeter - thermal_val); + /* calculate new OFDM / CCK offset */ if (thermal_val > hal_data->EEPROMThermalMeter) j = 1; -- cgit v1.2.3 From 4c3fa640387e70b31cd1aee098f76559e50afe95 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Mon, 23 Feb 2015 23:40:27 +0530 Subject: Staging: rtl8188eu: Refactored code to increase readility Refactored the conditional code to make it more compact. Replaced the ternary operators with abs() macro to increase readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 175b87ef8889..cee7cb7979d7 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -548,27 +548,19 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) if (thermal_avg_count) thermal_val = (u8)(thermal_avg / thermal_avg_count); - if (dm_odm->RFCalibrateInfo.bReloadtxpowerindex) { - delta = thermal_val > hal_data->EEPROMThermalMeter ? - (thermal_val - hal_data->EEPROMThermalMeter) : - (hal_data->EEPROMThermalMeter - thermal_val); - dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false; - dm_odm->RFCalibrateInfo.bDoneTxpower = false; - } else if (dm_odm->RFCalibrateInfo.bDoneTxpower) { - delta = (thermal_val > dm_odm->RFCalibrateInfo.ThermalValue) ? - (thermal_val - dm_odm->RFCalibrateInfo.ThermalValue) : - (dm_odm->RFCalibrateInfo.ThermalValue - thermal_val); - } else { - delta = thermal_val > hal_data->EEPROMThermalMeter ? - (thermal_val - hal_data->EEPROMThermalMeter) : - (hal_data->EEPROMThermalMeter - thermal_val); + if (dm_odm->RFCalibrateInfo.bDoneTxpower && + !dm_odm->RFCalibrateInfo.bReloadtxpowerindex) + delta = abs(thermal_val - dm_odm->RFCalibrateInfo.ThermalValue); + else { + delta = abs(thermal_val - hal_data->EEPROMThermalMeter); + if (dm_odm->RFCalibrateInfo.bReloadtxpowerindex) { + dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false; + dm_odm->RFCalibrateInfo.bDoneTxpower = false; + } } - delta_lck = (thermal_val > dm_odm->RFCalibrateInfo.ThermalValue_LCK) ? - (thermal_val - dm_odm->RFCalibrateInfo.ThermalValue_LCK) : - (dm_odm->RFCalibrateInfo.ThermalValue_LCK - thermal_val); - delta_iqk = (thermal_val > dm_odm->RFCalibrateInfo.ThermalValue_IQK) ? - (thermal_val - dm_odm->RFCalibrateInfo.ThermalValue_IQK) : - (dm_odm->RFCalibrateInfo.ThermalValue_IQK - thermal_val); + + delta_lck = abs(dm_odm->RFCalibrateInfo.ThermalValue_LCK - thermal_val); + delta_iqk = abs(dm_odm->RFCalibrateInfo.ThermalValue_IQK - thermal_val); /* Delta temperature is equal to or larger than 20 centigrade.*/ if ((delta_lck >= 8)) { -- cgit v1.2.3 From 065be69f262ab24ce6ece597046e637ea5530da2 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Mon, 23 Feb 2015 14:46:13 +0530 Subject: Staging: rtl8188eu: Remove unnecessary variable Remove unnecessary variable and replace its uses with previously defined variable. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index cee7cb7979d7..3a3ae17d384c 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -117,10 +117,9 @@ static void rf_serial_write(struct adapter *adapt, u32 data_and_addr = 0; struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); struct bb_reg_def *phyreg = &hal_data->PHYRegDef[rfpath]; - u32 newoffset; - newoffset = offset & 0xff; - data_and_addr = ((newoffset<<20) | (data&0x000fffff)) & 0x0fffffff; + offset &= 0xff; + data_and_addr = ((offset<<20) | (data&0x000fffff)) & 0x0fffffff; phy_set_bb_reg(adapt, phyreg->rf3wireOffset, bMaskDWord, data_and_addr); } -- cgit v1.2.3 From 0ed83e995e17f8ef5688a7a597943a9ef88362c3 Mon Sep 17 00:00:00 2001 From: Katie Dunne Date: Wed, 25 Feb 2015 07:41:14 -0800 Subject: Staging: rtl8188eu: Remove unused macros Removes macro definitions that are unused elsewhere Signed-off-by: Katie Dunne Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/wifi.h | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index 8dbdfafd52b5..a68b52208192 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -301,22 +301,12 @@ enum WIFI_REG_DOMAIN { #define GetPrivacy(pbuf) \ (((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0) -#define ClearPrivacy(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_PRIVACY_)) - - #define GetOrder(pbuf) \ (((*(__le16 *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0) #define GetFrameType(pbuf) \ (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2))) -#define SetFrameType(pbuf, type) \ - do { \ - *(unsigned short *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | BIT(2))); \ - *(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \ - } while (0) - #define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) |\ BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))) @@ -333,17 +323,6 @@ enum WIFI_REG_DOMAIN { #define GetFragNum(pbuf) \ (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) & 0x0f) -#define GetTupleCache(pbuf) \ - (cpu_to_le16(*(unsigned short *)((size_t)(pbuf) + 22))) - -#define SetFragNum(pbuf, num) \ - do { \ - *(unsigned short *)((size_t)(pbuf) + 22) = \ - ((*(unsigned short *)((size_t)(pbuf) + 22)) & \ - le16_to_cpu(~(0x000f))) | \ - cpu_to_le16(0x0f & (num)); \ - } while (0) - #define SetSeqNum(pbuf, num) \ do { \ *(__le16 *)((size_t)(pbuf) + 22) = \ @@ -370,15 +349,8 @@ enum WIFI_REG_DOMAIN { #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1) -#define SetAMsdu(pbuf, amsdu) \ - *(__le16 *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7) - #define GetAid(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 2)) & 0x3fff) -#define GetTid(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + \ - (((GetToDs(pbuf)<<1) | GetFrDs(pbuf)) == 3 ? \ - 30 : 24))) & 0x000f) - #define GetAddr1Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 4)) #define GetAddr2Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 10)) -- cgit v1.2.3 From 1d6871f8dc2351f8fdb9cc47a6ef2b3b189ed640 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Fri, 27 Feb 2015 01:39:32 +0530 Subject: Staging: rtl8188eu: Remove unnecessary if condition Remove this branch as is2t is defined false and is not modified. The variable value32 is then unused. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 3a3ae17d384c..9eaf2300caa2 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -442,7 +442,7 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) u8 thermal_val = 0, delta, delta_lck, delta_iqk, offset; u8 thermal_avg_count = 0; u32 thermal_avg = 0; - s32 ele_a = 0, ele_d, temp_cck, x, value32; + s32 ele_a = 0, ele_d, temp_cck, x; s32 y, ele_c = 0; s8 ofdm_index[2], cck_index = 0; s8 ofdm_index_old[2] = {0, 0}, cck_index_old = 0; @@ -635,41 +635,6 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) ele_c = ((y * ele_d)>>8)&0x000003FF; } - - if (is2t) { - ele_d = (OFDMSwingTable[(u8)ofdm_index[1]] & 0xFFC00000)>>22; - - /* new element A = element D x X */ - x = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[indexforchannel].Value[0][4]; - y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[indexforchannel].Value[0][5]; - - if ((x != 0) && (*(dm_odm->pBandType) == ODM_BAND_2_4G)) { - if ((x & 0x00000200) != 0) /* consider minus */ - x = x | 0xFFFFFC00; - ele_a = ((x * ele_d)>>8)&0x000003FF; - - /* new element C = element D x Y */ - if ((y & 0x00000200) != 0) - y = y | 0xFFFFFC00; - ele_c = ((y * ele_d)>>8)&0x00003FF; - - /* wtite new elements A, C, D to regC88 and regC9C, element B is always 0 */ - value32 = (ele_d<<22) | ((ele_c&0x3F)<<16) | ele_a; - phy_set_bb_reg(adapt, rOFDM0_XBTxIQImbalance, bMaskDWord, value32); - - value32 = (ele_c&0x000003C0)>>6; - phy_set_bb_reg(adapt, rOFDM0_XDTxAFE, bMaskH4Bits, value32); - - value32 = ((x * ele_d)>>7)&0x01; - phy_set_bb_reg(adapt, rOFDM0_ECCAThreshold, BIT28, value32); - } else { - phy_set_bb_reg(adapt, rOFDM0_XBTxIQImbalance, bMaskDWord, OFDMSwingTable[(u8)ofdm_index[1]]); - phy_set_bb_reg(adapt, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00); - phy_set_bb_reg(adapt, rOFDM0_ECCAThreshold, BIT28, 0x00); - } - - } - } } -- cgit v1.2.3 From 4ceb7f723372336f4d9e1ccfe7697a08eff2860f Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 26 Feb 2015 23:47:39 +0530 Subject: Staging: rtl8188eu: Combine two loops to increase readability The first loop assigns values to ofdm_index array and the second checks for boundary conditions. They are combined and a comment is added to increase clarity. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 9eaf2300caa2..d94ce61647b6 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -584,17 +584,17 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) } if (offset >= index_mapping_NUM_88E) offset = index_mapping_NUM_88E-1; - for (i = 0; i < rf; i++) - ofdm_index[i] = dm_odm->RFCalibrateInfo.OFDM_index[i] + ofdm_index_mapping[j][offset]; - cck_index = dm_odm->RFCalibrateInfo.CCK_index + ofdm_index_mapping[j][offset]; + /* Updating ofdm_index values with new OFDM / CCK offset */ for (i = 0; i < rf; i++) { + ofdm_index[i] = dm_odm->RFCalibrateInfo.OFDM_index[i] + ofdm_index_mapping[j][offset]; if (ofdm_index[i] > OFDM_TABLE_SIZE_92D-1) ofdm_index[i] = OFDM_TABLE_SIZE_92D-1; else if (ofdm_index[i] < ofdm_min_index) ofdm_index[i] = ofdm_min_index; } + cck_index = dm_odm->RFCalibrateInfo.CCK_index + ofdm_index_mapping[j][offset]; if (cck_index > CCK_TABLE_SIZE-1) cck_index = CCK_TABLE_SIZE-1; else if (cck_index < 0) -- cgit v1.2.3 From 294a7fcc85f5fbfdec782c5fad590b49735a35c4 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 26 Feb 2015 23:05:11 +0530 Subject: Staging: rtl8188eu: Refactor conditional code to increase readability Remove the nested conditionals. The if and else-if have the same code so they are combined to make the code more compact. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index d94ce61647b6..c8d8abcde16d 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -506,18 +506,12 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) temp_cck = dm_odm->RFCalibrateInfo.RegA24; for (i = 0; i < CCK_TABLE_SIZE; i++) { - if (dm_odm->RFCalibrateInfo.bCCKinCH14) { - if (memcmp(&temp_cck, &CCKSwingTable_Ch14[i][2], 4)) { + if ((dm_odm->RFCalibrateInfo.bCCKinCH14 && + memcmp(&temp_cck, &CCKSwingTable_Ch14[i][2], 4)) || + memcmp(&temp_cck, &CCKSwingTable_Ch1_Ch13[i][2], 4)) { cck_index_old = (u8)i; dm_odm->BbSwingIdxCckBase = (u8)i; break; - } - } else { - if (memcmp(&temp_cck, &CCKSwingTable_Ch1_Ch13[i][2], 4)) { - cck_index_old = (u8)i; - dm_odm->BbSwingIdxCckBase = (u8)i; - break; - } } } -- cgit v1.2.3 From e790d442b05518dab79135203a1a1b580959b1c9 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 26 Feb 2015 18:14:02 +0530 Subject: Staging: rtl8188eu: Replace if-else block with switch-case Replace if-else block with switch-case to make it more compact and increase readability. Signed-off-by: Vatika Harlalka Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/bb_cfg.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c b/drivers/staging/rtl8188eu/hal/bb_cfg.c index 262da889d360..2d3d012d3736 100644 --- a/drivers/staging/rtl8188eu/hal/bb_cfg.c +++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c @@ -553,21 +553,29 @@ static void store_pwrindex_offset(struct adapter *Adapter, u32 regaddr, u32 bitm } } -static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask, u32 data) +static void rtl_addr_delay(struct adapter *adapt, + u32 addr, u32 bit_mask, u32 data) { - if (addr == 0xfe) { + switch (addr) { + case 0xfe: msleep(50); - } else if (addr == 0xfd) { + break; + case 0xfd: mdelay(5); - } else if (addr == 0xfc) { + break; + case 0xfc: mdelay(1); - } else if (addr == 0xfb) { + break; + case 0xfb: udelay(50); - } else if (addr == 0xfa) { + break; + case 0xfa: udelay(5); - } else if (addr == 0xf9) { + break; + case 0xf9: udelay(1); - } else{ + break; + default: store_pwrindex_offset(adapt, addr, bit_mask, data); } } -- cgit v1.2.3 From 24f455236db580901c053357c553f3e86b592692 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 18 Feb 2015 00:21:25 +0300 Subject: Staging: rts5208: Remove braces around single if-statement This patch removes unneeded braces around a single if-statement. This problem was found using checkpatch.pl. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/rtsx_scsi.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c index 11610826acf1..426458345534 100644 --- a/drivers/staging/rts5208/rtsx_scsi.c +++ b/drivers/staging/rts5208/rtsx_scsi.c @@ -519,10 +519,8 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip *chip) #else if (chip->mspro_formatter_enable) #endif - { if (!card || (card == MS_CARD)) pro_formatter_flag = 1; - } if (pro_formatter_flag) { if (scsi_bufflen(srb) < 56) -- cgit v1.2.3 From b5e38b10e42a14d78ebb92172dada4af328e64ad Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 20 Feb 2015 14:18:45 +0530 Subject: Staging: rtl8723au: Use put_unaligned_le16 Using byte ordering functions and then memcpy() is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of function put_unaligned_le16 which makes the code clear. Here, use of variable tim_bitmap_le and variable itself is removed. Also, to be compatible with the changes header file is added too. Coccinelle is used to do this change and semantic patch used for this is as follows: @a@ typedef __le16; __le16 e16; identifier tmp; expression ptr; expression y,e; type T; @@ - tmp = cpu_to_le16(y); <+... when != tmp ( - memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\)); + put_unaligned_le16(y,ptr); | - memcpy(ptr, (T)&tmp, ...); + put_unaligned_le16(y,ptr); ) ...+> ? tmp = e @@ type T; identifier a.tmp; @@ - T tmp; ...when != tmp Signed-off-by: Vaishali Thakkar Reviewed-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index c6327c072918..7fa43528fa33 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -20,6 +20,7 @@ #include #include #include +#include extern unsigned char WMM_OUI23A[]; extern unsigned char WPS_OUI23A[]; @@ -72,11 +73,8 @@ static void update_BCNTIM(struct rtw_adapter *padapter) struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network; unsigned char *pie = pnetwork_mlmeext->IEs; u8 *p, *dst_ie, *premainder_ie = NULL, *pbackup_remainder_ie = NULL; - __le16 tim_bitmap_le; uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap); - p = rtw_get_ie23a(pie, WLAN_EID_TIM, &tim_ielen, pnetwork_mlmeext->IELength); if (p != NULL && tim_ielen > 0) { @@ -143,9 +141,9 @@ static void update_BCNTIM(struct rtw_adapter *padapter) *dst_ie++ = 0; if (tim_ielen == 4) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap & 0xff; } else if (tim_ielen == 5) { - memcpy(dst_ie, &tim_bitmap_le, 2); + put_unaligned_le16(pstapriv->tim_bitmap, dst_ie); dst_ie += 2; } -- cgit v1.2.3 From 6d59efcb10676aacb5dea5ccdf407532548d8176 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sun, 22 Feb 2015 00:12:35 +0200 Subject: Staging: rtl8723au: core: Fix quoted string split across lines This patch fixes "quoted string split across lines warning" warning in rtw_ap.c Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_ap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 7fa43528fa33..b0da82f42a55 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -1475,8 +1475,8 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info if (psta->flags & WLAN_STA_HT) { u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info); - DBG_8723A("HT: STA " MAC_FMT " HT Capabilities " - "Info: 0x%04x\n", MAC_ARG(psta->hwaddr), ht_capab); + DBG_8723A("HT: STA " MAC_FMT " HT Capabilities Info: 0x%04x\n", + MAC_ARG(psta->hwaddr), ht_capab); if (psta->no_ht_set) { psta->no_ht_set = 0; -- cgit v1.2.3 From 91701e44261c13123ec931173ac1e29a7cd8f939 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Tue, 24 Feb 2015 15:14:26 +0200 Subject: Staging: rtl8723au: Add blank line after declarations The following patch fixes the checkpatch.pl warning: drivers/staging/rtl8723au/core/rtw_ap.c WARNING: Missing a blank line after declarations Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_ap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index b0da82f42a55..bed13db03da2 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -783,6 +783,7 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, struct wlan_bssid_ex *pbss_network = &pmlmepriv->cur_network.network; u8 *ie = pbss_network->IEs; u8 *pbuf = mgmt->u.beacon.variable; + len -= offsetof(struct ieee80211_mgmt, u.beacon.variable); /* SSID */ /* Supported rates */ -- cgit v1.2.3 From 62e9a35ffa90bad5e724fdeef8e470b45a16184d Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Wed, 25 Feb 2015 23:26:21 +0200 Subject: Staging: rtl8723au: Remove return in void function WARNING: void function return statements are not generally useful Remove return in void function. That was found by running checkpatch. Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/hal_com.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/hal_com.c b/drivers/staging/rtl8723au/hal/hal_com.c index bf4cae20bd12..a7751c9aecad 100644 --- a/drivers/staging/rtl8723au/hal/hal_com.c +++ b/drivers/staging/rtl8723au/hal/hal_com.c @@ -236,8 +236,6 @@ void HalSetBrateCfg23a(struct rtw_adapter *padapter, u8 *mBratesOS) } /* Ziv - Check */ rtl8723au_write8(padapter, REG_INIRTS_RATE_SEL, rate_index); - - return; } static void _OneOutPipeMapping(struct rtw_adapter *pAdapter) -- cgit v1.2.3 From 1b7176e7a3224942cd144a81a023f5d25e29498f Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Thu, 26 Feb 2015 00:08:21 +0200 Subject: Staging: rtl8723au: remove unnecessary break after return WARNING: break is not useful after a goto or return. Remove unnecessary break after return. That was found by running checkpatch. Signed-off-by: Melike Yurtoglu Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c b/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c index 33777d2852f4..2dc18560a381 100644 --- a/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c +++ b/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c @@ -148,7 +148,6 @@ u8 HalPwrSeqCmdParsing23a(struct rtw_adapter *padapter, u8 CutVersion, ("HalPwrSeqCmdParsing23a: " "PWR_CMD_END\n")); return true; - break; default: RT_TRACE(_module_hal_init_c_, _drv_err_, -- cgit v1.2.3 From ef37b77ef629e1219205aca8748233560725c0ea Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Thu, 26 Feb 2015 08:51:03 +0200 Subject: Staging: rtl8723au: Tabs should be used WARNING: please, no spaces at the start of a line That was found by running checkpatch. Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 5269b46445f4..375f85db2067 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -216,16 +216,16 @@ static void ODM_EdcaTurboInit23a(struct dm_odm_t *pDM_Odm); #define RxDefaultAnt2 0x569a bool odm_StaDefAntSel(struct dm_odm_t *pDM_Odm, - u32 OFDM_Ant1_Cnt, - u32 OFDM_Ant2_Cnt, - u32 CCK_Ant1_Cnt, - u32 CCK_Ant2_Cnt, - u8 *pDefAnt + u32 OFDM_Ant1_Cnt, + u32 OFDM_Ant2_Cnt, + u32 CCK_Ant1_Cnt, + u32 CCK_Ant2_Cnt, + u8 *pDefAnt ); void odm_SetRxIdleAnt(struct dm_odm_t *pDM_Odm, u8 Ant, - bool bDualPath + bool bDualPath ); /* 3 Export Interface */ -- cgit v1.2.3 From ab4f931f3173dc1250c29a1e0367f92dfbe88a27 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Thu, 26 Feb 2015 09:52:07 +0200 Subject: Staging: rtl8723au: Remove return in void function WARNING: void function return statements are not generally useful Remove return in void function. That was found by running checkpatch. Signed-off-by: Melike Yurtoglu Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/os_dep/usb_intf.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/os_dep/usb_intf.c b/drivers/staging/rtl8723au/os_dep/usb_intf.c index 05755b870a5f..a6969a08dfb7 100644 --- a/drivers/staging/rtl8723au/os_dep/usb_intf.c +++ b/drivers/staging/rtl8723au/os_dep/usb_intf.c @@ -599,8 +599,6 @@ static void rtw_disconnect(struct usb_interface *pusb_intf) RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-dev_remove()\n")); DBG_8723A("-r871xu_dev_remove, done\n"); - - return; } static int __init rtw_drv_entry(void) -- cgit v1.2.3 From a6736415f057cd64ae86e9577e594dc1f0ad86f1 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Thu, 26 Feb 2015 09:52:08 +0200 Subject: Staging: rtl8723au: Add blank line after declarations WARNING: "Missing a blank line after declarations" Add blank line after declarations. That was found by running checkpatch Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/os_dep/usb_intf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/os_dep/usb_intf.c b/drivers/staging/rtl8723au/os_dep/usb_intf.c index a6969a08dfb7..bab06995078b 100644 --- a/drivers/staging/rtl8723au/os_dep/usb_intf.c +++ b/drivers/staging/rtl8723au/os_dep/usb_intf.c @@ -237,6 +237,7 @@ void rtl8723a_usb_intf_stop(struct rtw_adapter *padapter) static void rtw_dev_unload(struct rtw_adapter *padapter) { struct submit_ctx *pack_tx_ops = &padapter->xmitpriv.ack_tx_ops; + RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_dev_unload\n")); if (padapter->bup) { -- cgit v1.2.3 From b124fee6576d6f5a2193e3b3a09e183eef23078a Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 04:45:22 +0200 Subject: staging: fbtft: fix code indent should use tabs where possible This patch fixes the following checkpatch.pl error: code indent should use tabs where possible Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_ili9486.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_ili9486.c b/drivers/staging/fbtft/fb_ili9486.c index 95b89999d32a..5ce3e201aac0 100644 --- a/drivers/staging/fbtft/fb_ili9486.c +++ b/drivers/staging/fbtft/fb_ili9486.c @@ -44,13 +44,13 @@ static int default_init_sequence[] = { -1, 0xC5, 0x00, 0x00, 0x00, 0x00, /* PGAMCTRL(Positive Gamma Control) */ -1, 0xE0, 0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98, - 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00, + 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00, /* NGAMCTRL(Negative Gamma Control) */ -1, 0xE1, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, - 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, + 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, /* Digital Gamma Control 1 */ -1, 0xE2, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, - 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, + 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, /* Sleep OUT */ -1, 0x11, /* Display ON */ -- cgit v1.2.3 From 9d1d0a38bd7f0ee22081beabb2baac89ce6a4e58 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 04:53:59 +0200 Subject: staging: fbtft: fix braces {} are not necessary for single statement blocks This patch fixes the following checkpatch.pl warning: braces {} are not necessary for single statement blocks Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_pcd8544.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_pcd8544.c b/drivers/staging/fbtft/fb_pcd8544.c index 8b9ebfb49ef8..5e08a70c25b4 100644 --- a/drivers/staging/fbtft/fb_pcd8544.c +++ b/drivers/staging/fbtft/fb_pcd8544.c @@ -120,9 +120,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) for (x = 0; x < 84; x++) { for (y = 0; y < 6; y++) { *buf = 0x00; - for (i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) *buf |= (vmem16[(y*8+i)*84+x] ? 1 : 0) << i; - } buf++; } } -- cgit v1.2.3 From bedc844d82336668dbb8835389cdc0df93048d0b Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 04:48:34 +0200 Subject: staging: fbtft: fix space prohibited before that ',' This patch fixes the following checkpatch.pl error: space prohibited before that ',' Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_ra8875.c | 150 +++++++++++++++++++------------------- 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_ra8875.c b/drivers/staging/fbtft/fb_ra8875.c index c323c06344fd..8df97373e183 100644 --- a/drivers/staging/fbtft/fb_ra8875.c +++ b/drivers/staging/fbtft/fb_ra8875.c @@ -79,112 +79,112 @@ static int init_display(struct fbtft_par *par) if ((par->info->var.xres == 320) && (par->info->var.yres == 240)) { /* PLL clock frequency */ - write_reg(par, 0x88 , 0x0A); - write_reg(par, 0x89 , 0x02); + write_reg(par, 0x88, 0x0A); + write_reg(par, 0x89, 0x02); mdelay(10); /* color deep / MCU Interface */ - write_reg(par, 0x10 , 0x0C); + write_reg(par, 0x10, 0x0C); /* pixel clock period */ - write_reg(par, 0x04 , 0x03); + write_reg(par, 0x04, 0x03); mdelay(1); /* horizontal settings */ - write_reg(par, 0x14 , 0x27); - write_reg(par, 0x15 , 0x00); - write_reg(par, 0x16 , 0x05); - write_reg(par, 0x17 , 0x04); - write_reg(par, 0x18 , 0x03); + write_reg(par, 0x14, 0x27); + write_reg(par, 0x15, 0x00); + write_reg(par, 0x16, 0x05); + write_reg(par, 0x17, 0x04); + write_reg(par, 0x18, 0x03); /* vertical settings */ - write_reg(par, 0x19 , 0xEF); - write_reg(par, 0x1A , 0x00); - write_reg(par, 0x1B , 0x05); - write_reg(par, 0x1C , 0x00); - write_reg(par, 0x1D , 0x0E); - write_reg(par, 0x1E , 0x00); - write_reg(par, 0x1F , 0x02); + write_reg(par, 0x19, 0xEF); + write_reg(par, 0x1A, 0x00); + write_reg(par, 0x1B, 0x05); + write_reg(par, 0x1C, 0x00); + write_reg(par, 0x1D, 0x0E); + write_reg(par, 0x1E, 0x00); + write_reg(par, 0x1F, 0x02); } else if ((par->info->var.xres == 480) && (par->info->var.yres == 272)) { /* PLL clock frequency */ - write_reg(par, 0x88 , 0x0A); - write_reg(par, 0x89 , 0x02); + write_reg(par, 0x88, 0x0A); + write_reg(par, 0x89, 0x02); mdelay(10); /* color deep / MCU Interface */ - write_reg(par, 0x10 , 0x0C); + write_reg(par, 0x10, 0x0C); /* pixel clock period */ - write_reg(par, 0x04 , 0x82); + write_reg(par, 0x04, 0x82); mdelay(1); /* horizontal settings */ - write_reg(par, 0x14 , 0x3B); - write_reg(par, 0x15 , 0x00); - write_reg(par, 0x16 , 0x01); - write_reg(par, 0x17 , 0x00); - write_reg(par, 0x18 , 0x05); + write_reg(par, 0x14, 0x3B); + write_reg(par, 0x15, 0x00); + write_reg(par, 0x16, 0x01); + write_reg(par, 0x17, 0x00); + write_reg(par, 0x18, 0x05); /* vertical settings */ - write_reg(par, 0x19 , 0x0F); - write_reg(par, 0x1A , 0x01); - write_reg(par, 0x1B , 0x02); - write_reg(par, 0x1C , 0x00); - write_reg(par, 0x1D , 0x07); - write_reg(par, 0x1E , 0x00); - write_reg(par, 0x1F , 0x09); + write_reg(par, 0x19, 0x0F); + write_reg(par, 0x1A, 0x01); + write_reg(par, 0x1B, 0x02); + write_reg(par, 0x1C, 0x00); + write_reg(par, 0x1D, 0x07); + write_reg(par, 0x1E, 0x00); + write_reg(par, 0x1F, 0x09); } else if ((par->info->var.xres == 640) && (par->info->var.yres == 480)) { /* PLL clock frequency */ - write_reg(par, 0x88 , 0x0B); - write_reg(par, 0x89 , 0x02); + write_reg(par, 0x88, 0x0B); + write_reg(par, 0x89, 0x02); mdelay(10); /* color deep / MCU Interface */ - write_reg(par, 0x10 , 0x0C); + write_reg(par, 0x10, 0x0C); /* pixel clock period */ - write_reg(par, 0x04 , 0x01); + write_reg(par, 0x04, 0x01); mdelay(1); /* horizontal settings */ - write_reg(par, 0x14 , 0x4F); - write_reg(par, 0x15 , 0x05); - write_reg(par, 0x16 , 0x0F); - write_reg(par, 0x17 , 0x01); - write_reg(par, 0x18 , 0x00); + write_reg(par, 0x14, 0x4F); + write_reg(par, 0x15, 0x05); + write_reg(par, 0x16, 0x0F); + write_reg(par, 0x17, 0x01); + write_reg(par, 0x18, 0x00); /* vertical settings */ - write_reg(par, 0x19 , 0xDF); - write_reg(par, 0x1A , 0x01); - write_reg(par, 0x1B , 0x0A); - write_reg(par, 0x1C , 0x00); - write_reg(par, 0x1D , 0x0E); - write_reg(par, 0x1E , 0x00); - write_reg(par, 0x1F , 0x01); + write_reg(par, 0x19, 0xDF); + write_reg(par, 0x1A, 0x01); + write_reg(par, 0x1B, 0x0A); + write_reg(par, 0x1C, 0x00); + write_reg(par, 0x1D, 0x0E); + write_reg(par, 0x1E, 0x00); + write_reg(par, 0x1F, 0x01); } else if ((par->info->var.xres == 800) && (par->info->var.yres == 480)) { /* PLL clock frequency */ - write_reg(par, 0x88 , 0x0B); - write_reg(par, 0x89 , 0x02); + write_reg(par, 0x88, 0x0B); + write_reg(par, 0x89, 0x02); mdelay(10); /* color deep / MCU Interface */ - write_reg(par, 0x10 , 0x0C); + write_reg(par, 0x10, 0x0C); /* pixel clock period */ - write_reg(par, 0x04 , 0x81); + write_reg(par, 0x04, 0x81); mdelay(1); /* horizontal settings */ - write_reg(par, 0x14 , 0x63); - write_reg(par, 0x15 , 0x03); - write_reg(par, 0x16 , 0x03); - write_reg(par, 0x17 , 0x02); - write_reg(par, 0x18 , 0x00); + write_reg(par, 0x14, 0x63); + write_reg(par, 0x15, 0x03); + write_reg(par, 0x16, 0x03); + write_reg(par, 0x17, 0x02); + write_reg(par, 0x18, 0x00); /* vertical settings */ - write_reg(par, 0x19 , 0xDF); - write_reg(par, 0x1A , 0x01); - write_reg(par, 0x1B , 0x14); - write_reg(par, 0x1C , 0x00); - write_reg(par, 0x1D , 0x06); - write_reg(par, 0x1E , 0x00); - write_reg(par, 0x1F , 0x01); + write_reg(par, 0x19, 0xDF); + write_reg(par, 0x1A, 0x01); + write_reg(par, 0x1B, 0x14); + write_reg(par, 0x1C, 0x00); + write_reg(par, 0x1D, 0x06); + write_reg(par, 0x1E, 0x00); + write_reg(par, 0x1F, 0x01); } else { dev_err(par->info->device, "display size is not supported!!"); return -1; } /* PWM clock */ - write_reg(par, 0x8a , 0x81); - write_reg(par, 0x8b , 0xFF); + write_reg(par, 0x8a, 0x81); + write_reg(par, 0x8b, 0xFF); mdelay(10); /* Display ON */ - write_reg(par, 0x01 , 0x80); + write_reg(par, 0x01, 0x80); mdelay(10); return 0; @@ -196,14 +196,14 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); /* Set_Active_Window */ - write_reg(par, 0x30 , xs & 0x00FF); - write_reg(par, 0x31 , (xs & 0xFF00) >> 8); - write_reg(par, 0x32 , ys & 0x00FF); - write_reg(par, 0x33 , (ys & 0xFF00) >> 8); - write_reg(par, 0x34 , (xs+xe) & 0x00FF); - write_reg(par, 0x35 , ((xs+xe) & 0xFF00) >> 8); - write_reg(par, 0x36 , (ys+ye) & 0x00FF); - write_reg(par, 0x37 , ((ys+ye) & 0xFF00) >> 8); + write_reg(par, 0x30, xs & 0x00FF); + write_reg(par, 0x31, (xs & 0xFF00) >> 8); + write_reg(par, 0x32, ys & 0x00FF); + write_reg(par, 0x33, (ys & 0xFF00) >> 8); + write_reg(par, 0x34, (xs+xe) & 0x00FF); + write_reg(par, 0x35, ((xs+xe) & 0xFF00) >> 8); + write_reg(par, 0x36, (ys+ye) & 0x00FF); + write_reg(par, 0x37, ((ys+ye) & 0xFF00) >> 8); /* Set_Memory_Write_Cursor */ write_reg(par, 0x46, xs & 0xff); -- cgit v1.2.3 From 0728b01c6b3259b9d6f48885608e0f30a5908b20 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 04:50:25 +0200 Subject: staging: fbtft: fix braces {} are not necessary for single statement blocks This patch fixes the following checkpatch.pl warning: braces {} are not necessary for single statement blocks Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_ssd1331.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_ssd1331.c b/drivers/staging/fbtft/fb_ssd1331.c index da7464f90e37..a7b77a548a89 100644 --- a/drivers/staging/fbtft/fb_ssd1331.c +++ b/drivers/staging/fbtft/fb_ssd1331.c @@ -69,9 +69,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) { va_start(args, len); - for (i = 0; i < len; i++) { + for (i = 0; i < len; i++) buf[i] = (u8)va_arg(args, unsigned int); - } va_end(args); fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, u8, buf, len, "%s: ", __func__); } @@ -91,9 +90,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) if (len) { i = len; - while (i--) { + while (i--) *buf++ = (u8)va_arg(args, unsigned int); - } ret = par->fbtftops.write(par, par->buf, len * (sizeof(u8))); if (ret < 0) { va_end(args); -- cgit v1.2.3 From 9f8a89e6e7580ecfde4b249dde197de761ad96fb Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 04:55:45 +0200 Subject: staging: fbtft: fix space required after that ',' This patch fixes the following checkpatch.pl error: space required after that ',' Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_st7735r.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_st7735r.c b/drivers/staging/fbtft/fb_st7735r.c index b63aa38e51cf..078f502884bd 100644 --- a/drivers/staging/fbtft/fb_st7735r.c +++ b/drivers/staging/fbtft/fb_st7735r.c @@ -68,7 +68,7 @@ static int default_init_sequence[] = { /* PWCTR4 - Power Control BCLK/2, Opamp current small & Medium low */ - -1, 0xC3,0x8A,0x2A, + -1, 0xC3, 0x8A, 0x2A, /* PWCTR5 - Power Control */ -1, 0xC4, 0x8A, 0xEE, @@ -148,21 +148,21 @@ static int set_var(struct fbtft_par *par) #define CURVE(num, idx) curves[num*par->gamma.num_values + idx] static int set_gamma(struct fbtft_par *par, unsigned long *curves) { - int i,j; + int i, j; fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); /* apply mask */ for (i = 0; i < par->gamma.num_curves; i++) for (j = 0; j < par->gamma.num_values; j++) - CURVE(i,j) &= 0b111111; + CURVE(i, j) &= 0b111111; for (i = 0; i < par->gamma.num_curves; i++) write_reg(par, 0xE0 + i, CURVE(i, 0), CURVE(i, 1), CURVE(i, 2), CURVE(i, 3), CURVE(i, 4), CURVE(i, 5), CURVE(i, 6), CURVE(i, 7), CURVE(i, 8), CURVE(i, 9), CURVE(i, 10), CURVE(i, 11), - CURVE(i, 12), CURVE(i, 13), CURVE(i, 14), CURVE(i,15)); + CURVE(i, 12), CURVE(i, 13), CURVE(i, 14), CURVE(i, 15)); return 0; } -- cgit v1.2.3 From 7e059db65515c0c11aac3d036745c621b7a2567c Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 04:56:50 +0200 Subject: staging: fbtft: fix space prohibited before that ',' This patch fixes the following checkpatch.pl error: fix space prohibited before that ',' Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 37dcf7eb191a..ac4287f9d6b8 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -49,7 +49,7 @@ extern int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves, const char *str, int size); static unsigned long debug; -module_param(debug, ulong , 0); +module_param(debug, ulong, 0); MODULE_PARM_DESC(debug, "override device debug level"); static bool dma = true; -- cgit v1.2.3 From 73762b9dcb8398b00cda5af9bb36ed80504f9ef5 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 05:02:24 +0200 Subject: staging: fbtft: fix spacing errors This patch fixes the following checkpatch.pl errors: space prohibited before that ',' space required after that ',' spaces required around that '=' Given that the addition of spaces triggered the line over 80 characters warning, some lines were divided into two. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft_device.c | 88 +++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 31 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index b9f4c30e39c6..7cc169981c0d 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -109,7 +109,7 @@ module_param_array(init, int, &init_num, 0); MODULE_PARM_DESC(init, "Init sequence, used with the custom argument"); static unsigned long debug; -module_param(debug, ulong , 0); +module_param(debug, ulong, 0); MODULE_PARM_DESC(debug, "level: 0-7 (the remaining 29 bits is for advanced usage)"); @@ -136,43 +136,69 @@ static void adafruit18_green_tab_set_addr_win(struct fbtft_par *par, "03 1d 07 06 2E 2C 29 2D 2E 2E 37 3F 00 00 02 10" static int hy28b_init_sequence[] = { - -1,0x00e7,0x0010,-1,0x0000,0x0001,-1,0x0001,0x0100,-1,0x0002,0x0700, - -1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0008,0x0207,-1,0x0009,0x0000, - -1,0x000a,0x0000,-1,0x000c,0x0001,-1,0x000d,0x0000,-1,0x000f,0x0000, - -1,0x0010,0x0000,-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000, - -2,50,-1,0x0010,0x1590,-1,0x0011,0x0227,-2,50,-1,0x0012,0x009c,-2,50, - -1,0x0013,0x1900,-1,0x0029,0x0023,-1,0x002b,0x000e,-2,50, - -1,0x0020,0x0000,-1,0x0021,0x0000,-2,50,-1,0x0050,0x0000, - -1,0x0051,0x00ef,-1,0x0052,0x0000,-1,0x0053,0x013f,-1,0x0060,0xa700, - -1,0x0061,0x0001,-1,0x006a,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000, - -1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000, - -1,0x0090,0x0010,-1,0x0092,0x0000,-1,0x0093,0x0003,-1,0x0095,0x0110, - -1,0x0097,0x0000,-1,0x0098,0x0000,-1,0x0007,0x0133,-1,0x0020,0x0000, - -1,0x0021,0x0000,-2,100,-3 }; + -1, 0x00e7, 0x0010, -1, 0x0000, 0x0001, + -1, 0x0001, 0x0100, -1, 0x0002, 0x0700, + -1, 0x0003, 0x1030, -1, 0x0004, 0x0000, + -1, 0x0008, 0x0207, -1, 0x0009, 0x0000, + -1, 0x000a, 0x0000, -1, 0x000c, 0x0001, + -1, 0x000d, 0x0000, -1, 0x000f, 0x0000, + -1, 0x0010, 0x0000, -1, 0x0011, 0x0007, + -1, 0x0012, 0x0000, -1, 0x0013, 0x0000, + -2, 50, -1, 0x0010, 0x1590, -1, 0x0011, + 0x0227, -2, 50, -1, 0x0012, 0x009c, -2, 50, + -1, 0x0013, 0x1900, -1, 0x0029, 0x0023, + -1, 0x002b, 0x000e, -2, 50, + -1, 0x0020, 0x0000, -1, 0x0021, 0x0000, + -2, 50, -1, 0x0050, 0x0000, + -1, 0x0051, 0x00ef, -1, 0x0052, 0x0000, + -1, 0x0053, 0x013f, -1, 0x0060, 0xa700, + -1, 0x0061, 0x0001, -1, 0x006a, 0x0000, + -1, 0x0080, 0x0000, -1, 0x0081, 0x0000, + -1, 0x0082, 0x0000, -1, 0x0083, 0x0000, + -1, 0x0084, 0x0000, -1, 0x0085, 0x0000, + -1, 0x0090, 0x0010, -1, 0x0092, 0x0000, + -1, 0x0093, 0x0003, -1, 0x0095, 0x0110, + -1, 0x0097, 0x0000, -1, 0x0098, 0x0000, + -1, 0x0007, 0x0133, -1, 0x0020, 0x0000, + -1, 0x0021, 0x0000, -2, 100, -3 }; #define HY28B_GAMMA \ "04 1F 4 7 7 0 7 7 6 0\n" \ "0F 00 1 7 4 0 0 0 6 7" static int pitft_init_sequence[] = { - -1,0x01,-2,5,-1,0x28,-1,0xEF,0x03,0x80,0x02,-1,0xCF,0x00,0xC1,0x30, - -1,0xED,0x64,0x03,0x12,0x81,-1,0xE8,0x85,0x00,0x78, - -1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xF7,0x20,-1,0xEA,0x00,0x00, - -1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,-1,0x3A,0x55, - -1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,-1,0xF2,0x00,-1,0x26,0x01, - -1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03, - 0x0E,0x09,0x00,-1,0xE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48, - 0x08,0x0F,0x0C,0x31,0x36,0x0F,-1,0x11,-2,100,-1,0x29,-2,20,-3 }; + -1, 0x01, -2, 5, -1, 0x28, -1, 0xEF, + 0x03, 0x80, 0x02, -1, 0xCF, 0x00, 0xC1, 0x30, + -1, 0xED, 0x64, 0x03, 0x12, 0x81, + -1, 0xE8, 0x85, 0x00, 0x78, + -1, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02, + -1, 0xF7, 0x20, -1, 0xEA, 0x00, 0x00, + -1, 0xC0, 0x23, -1, 0xC1, 0x10, -1, 0xC5, + 0x3e, 0x28, -1, 0xC7, 0x86, -1, 0x3A, 0x55, + -1, 0xB1, 0x00, 0x18, -1, 0xB6, 0x08, 0x82, + 0x27, -1, 0xF2, 0x00, -1, 0x26, 0x01, + -1, 0xE0, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, + 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, + 0x0E, 0x09, 0x00, -1, 0xE1, 0x00, 0x0E, 0x14, + 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, + 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, -1, + 0x11, -2, 100, -1, 0x29, -2, 20, -3 }; static int waveshare32b_init_sequence[] = { - -1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xCF,0x00,0xC1,0x30, - -1,0xE8,0x85,0x00,0x78,-1,0xEA,0x00,0x00,-1,0xED,0x64,0x03,0x12,0x81, - -1,0xF7,0x20,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86, - -1,0x36,0x28,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27, - -1,0xF2,0x00,-1,0x26,0x01, - -1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00, - -1,0xE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F, - -1,0x11,-2,120,-1,0x29,-1,0x2c,-3 }; + -1, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02, + -1, 0xCF, 0x00, 0xC1, 0x30, + -1, 0xE8, 0x85, 0x00, 0x78, -1, 0xEA, 0x00, + 0x00, -1, 0xED, 0x64, 0x03, 0x12, 0x81, + -1, 0xF7, 0x20, -1, 0xC0, 0x23, -1, 0xC1, + 0x10, -1, 0xC5, 0x3e, 0x28, -1, 0xC7, 0x86, + -1, 0x36, 0x28, -1, 0x3A, 0x55, -1, 0xB1, 0x00, + 0x18, -1, 0xB6, 0x08, 0x82, 0x27, + -1, 0xF2, 0x00, -1, 0x26, 0x01, + -1, 0xE0, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, + 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, + -1, 0xE1, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, + 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, + -1, 0x11, -2, 120, -1, 0x29, -1, 0x2c, -3 }; /* Supported displays in alphabetical order */ static struct fbtft_device_display displays[] = { @@ -486,7 +512,7 @@ static struct fbtft_device_display displays[] = { }, .startbyte = 0b01110000, .bgr = true, - .fps= 50, + .fps = 50, .gpios = (const struct fbtft_gpio []) { { "reset", 25 }, { "led", 18 }, -- cgit v1.2.3 From 9247a2a150728f6525bb177cc146b523befdcb7a Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 19 Feb 2015 19:50:50 +0200 Subject: Staging: fbtft: Added blank line after declaration WARNING: Missing a blank line after declaration chackpatch.pl warning in fb_ili9320.c Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_ili9320.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_ili9320.c b/drivers/staging/fbtft/fb_ili9320.c index b26d89368da7..880f548158e6 100644 --- a/drivers/staging/fbtft/fb_ili9320.c +++ b/drivers/staging/fbtft/fb_ili9320.c @@ -47,6 +47,7 @@ static unsigned read_devicecode(struct fbtft_par *par) static int init_display(struct fbtft_par *par) { unsigned devcode; + fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); par->fbtftops.reset(par); -- cgit v1.2.3 From 54a8de19a004fe62bebf84837906adcf346fcd2d Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 19 Feb 2015 20:42:43 +0200 Subject: Staging: fbtft: Added blank line after declaration WARNING: Missing a blank line after declaration chackpatch.pl warning in fb_ssd1351.c Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_ssd1351.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c index 062d98660f63..b59120c0eb70 100644 --- a/drivers/staging/fbtft/fb_ssd1351.c +++ b/drivers/staging/fbtft/fb_ssd1351.c @@ -72,6 +72,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) static int set_var(struct fbtft_par *par) { unsigned remap; + fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); if (par->fbtftops.init_display != init_display) { -- cgit v1.2.3 From b6935e2911ab64d0687e8a495a48ef2a1205b582 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Thu, 19 Feb 2015 20:56:48 +0200 Subject: Staging: fbtft: remove trailing whitespace This patch fixes checkpatch.pl error trailing whitespace. Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/README | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/README b/drivers/staging/fbtft/README index bc89b5805f7b..ba4c74c92e4c 100644 --- a/drivers/staging/fbtft/README +++ b/drivers/staging/fbtft/README @@ -9,20 +9,20 @@ Development is done on a Raspberry Pi running the Raspbian "wheezy" distribution INSTALLATION Download kernel sources - From Linux 3.15 + From Linux 3.15 cd drivers/video/fbdev/fbtft git clone https://github.com/notro/fbtft.git - + Add to drivers/video/fbdev/Kconfig: source "drivers/video/fbdev/fbtft/Kconfig" Add to drivers/video/fbdev/Makefile: obj-y += fbtft/ - - Before Linux 3.15 + + Before Linux 3.15 cd drivers/video git clone https://github.com/notro/fbtft.git - + Add to drivers/video/Kconfig: source "drivers/video/fbtft/Kconfig" Add to drivers/video/Makefile: obj-y += fbtft/ - + Enable driver(s) in menuconfig and build the kernel -- cgit v1.2.3 From e64e00473ba50479aac300fc76ed72f08b15410e Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Thu, 19 Feb 2015 21:18:18 +0200 Subject: Staging: fbtft: Convert comment from C99 style to C89 style This patch fixes checkpatch.pl error ERROR: do not use C99 // comments Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_ssd1331.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_ssd1331.c b/drivers/staging/fbtft/fb_ssd1331.c index a7b77a548a89..ba17f0c83ec5 100644 --- a/drivers/staging/fbtft/fb_ssd1331.c +++ b/drivers/staging/fbtft/fb_ssd1331.c @@ -29,24 +29,24 @@ static int init_display(struct fbtft_par *par) write_reg(par, 0xae); /* Display Off */ write_reg(par, 0xa0, 0x70 | (par->bgr << 2)); /* Set Colour Depth */ - write_reg(par, 0x72); // RGB colour + write_reg(par, 0x72); /* RGB colour */ write_reg(par, 0xa1, 0x00); /* Set Display Start Line */ write_reg(par, 0xa2, 0x00); /* Set Display Offset */ write_reg(par, 0xa4); /* NORMALDISPLAY */ - write_reg(par, 0xa8, 0x3f); // Set multiplex - write_reg(par, 0xad, 0x8e); // Set master - // write_reg(par, 0xb0, 0x0b); // Set power mode - write_reg(par, 0xb1, 0x31); // Precharge - write_reg(par, 0xb3, 0xf0); // Clock div - write_reg(par, 0x8a, 0x64); // Precharge A - write_reg(par, 0x8b, 0x78); // Precharge B - write_reg(par, 0x8c, 0x64); // Precharge C - write_reg(par, 0xbb, 0x3a); // Precharge level - write_reg(par, 0xbe, 0x3e); // vcomh - write_reg(par, 0x87, 0x06); // Master current - write_reg(par, 0x81, 0x91); // Contrast A - write_reg(par, 0x82, 0x50); // Contrast B - write_reg(par, 0x83, 0x7d); // Contrast C + write_reg(par, 0xa8, 0x3f); /* Set multiplex */ + write_reg(par, 0xad, 0x8e); /* Set master */ + /* write_reg(par, 0xb0, 0x0b); Set power mode */ + write_reg(par, 0xb1, 0x31); /* Precharge */ + write_reg(par, 0xb3, 0xf0); /* Clock div */ + write_reg(par, 0x8a, 0x64); /* Precharge A */ + write_reg(par, 0x8b, 0x78); /* Precharge B */ + write_reg(par, 0x8c, 0x64); /* Precharge C */ + write_reg(par, 0xbb, 0x3a); /* Precharge level */ + write_reg(par, 0xbe, 0x3e); /* vcomh */ + write_reg(par, 0x87, 0x06); /* Master current */ + write_reg(par, 0x81, 0x91); /* Contrast A */ + write_reg(par, 0x82, 0x50); /* Contrast B */ + write_reg(par, 0x83, 0x7d); /* Contrast C */ write_reg(par, 0xaf); /* Set Sleep Mode Display On */ return 0; -- cgit v1.2.3 From e469616ba6d48d1ee157062a0b5c2580d8edf9c0 Mon Sep 17 00:00:00 2001 From: Yeliz Taneroglu Date: Thu, 26 Feb 2015 01:04:47 +0200 Subject: Staging: fbtft: removed trailing whitespace The following patch fixes the checkpatch.pl warning: Removed all trailing whitespace in fb_s6d1121.c Signed-off-by: Yeliz Taneroglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_s6d1121.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_s6d1121.c b/drivers/staging/fbtft/fb_s6d1121.c index 1ef8c1ad827e..7bbb21b28eff 100644 --- a/drivers/staging/fbtft/fb_s6d1121.c +++ b/drivers/staging/fbtft/fb_s6d1121.c @@ -143,7 +143,7 @@ static int set_var(struct fbtft_par *par) static int set_gamma(struct fbtft_par *par, unsigned long *curves) { unsigned long mask[] = { - 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, + 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b11111, 0b11111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, -- cgit v1.2.3 From 2f83aeda567a9f5347153fb21f29e0b09b3aa83a Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 07:55:43 +0200 Subject: staging: wlan-ng: replace init_timer by setup_timer This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise. The issue was discovered using the following coccinelle script: @@ expression ds, e1, e2; @@ -init_timer (&ds); +setup_timer (&ds, e1, e2); ... ( -ds.function = e1; ... -ds.data = e2; | -ds.data = e2; ... -ds.function = e1; ) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x_usb.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index 28cd1c4c02c8..c85b1b55fdb3 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -557,17 +557,13 @@ void hfa384x_create(hfa384x_t *hw, struct usb_device *usb) INIT_WORK(&hw->link_bh, prism2sta_processing_defer); INIT_WORK(&hw->usb_work, hfa384x_usb_defer); - init_timer(&hw->throttle); - hw->throttle.function = hfa384x_usb_throttlefn; - hw->throttle.data = (unsigned long)hw; + setup_timer(&hw->throttle, hfa384x_usb_throttlefn, (unsigned long)hw); - init_timer(&hw->resptimer); - hw->resptimer.function = hfa384x_usbctlx_resptimerfn; - hw->resptimer.data = (unsigned long)hw; + setup_timer(&hw->resptimer, hfa384x_usbctlx_resptimerfn, + (unsigned long)hw); - init_timer(&hw->reqtimer); - hw->reqtimer.function = hfa384x_usbctlx_reqtimerfn; - hw->reqtimer.data = (unsigned long)hw; + setup_timer(&hw->reqtimer, hfa384x_usbctlx_reqtimerfn, + (unsigned long)hw); usb_init_urb(&hw->rx_urb); usb_init_urb(&hw->tx_urb); @@ -577,9 +573,8 @@ void hfa384x_create(hfa384x_t *hw, struct usb_device *usb) hw->state = HFA384x_STATE_INIT; INIT_WORK(&hw->commsqual_bh, prism2sta_commsqual_defer); - init_timer(&hw->commsqual_timer); - hw->commsqual_timer.data = (unsigned long)hw; - hw->commsqual_timer.function = prism2sta_commsqual_timer; + setup_timer(&hw->commsqual_timer, prism2sta_commsqual_timer, + (unsigned long)hw); } /*---------------------------------------------------------------- -- cgit v1.2.3 From 38e0c9d27a5695f9ad92a6f98ee43b5811491f40 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 07:57:25 +0200 Subject: staging: dgnc: replace init_timer by setup_timer This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise. The issue was discovered using the following coccinelle script: @@ expression ds, e1, e2; @@ -init_timer (&ds); +setup_timer (&ds, e1, e2); ... ( -ds.function = e1; ... -ds.data = e2; | -ds.data = e2; ... -ds.function = e1; ) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index ace2af67e593..a2543cf05f88 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -285,9 +285,7 @@ static int dgnc_start(void) /* Start the poller */ spin_lock_irqsave(&dgnc_poll_lock, flags); - init_timer(&dgnc_poll_timer); - dgnc_poll_timer.function = dgnc_poll_handler; - dgnc_poll_timer.data = 0; + setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0); dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick); dgnc_poll_timer.expires = dgnc_poll_time; spin_unlock_irqrestore(&dgnc_poll_lock, flags); @@ -733,9 +731,7 @@ static void dgnc_poll_handler(ulong dummy) if ((ulong) new_time >= 2 * dgnc_poll_tick) dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick); - init_timer(&dgnc_poll_timer); - dgnc_poll_timer.function = dgnc_poll_handler; - dgnc_poll_timer.data = 0; + setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0); dgnc_poll_timer.expires = dgnc_poll_time; spin_unlock_irqrestore(&dgnc_poll_lock, flags); -- cgit v1.2.3 From 8f6e36c55a7fc445c584711ff8eea9261f1285cb Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 07:58:29 +0200 Subject: staging: panel: replace init_timer by setup_timer This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise. The issue was discovered using the following coccinelle script: @@ expression ds, e1, e2; @@ -init_timer (&ds); +setup_timer (&ds, e1, e2); ... ( -ds.function = e1; ... -ds.data = e2; | -ds.data = e2; ... -ds.function = e1; ) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/panel/panel.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index 6ed35b6ecf0d..4da854ca3115 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -2010,10 +2010,8 @@ static void init_scan_timer(void) if (scan_timer.function != NULL) return; /* already started */ - init_timer(&scan_timer); + setup_timer(&scan_timer, (void *)&panel_scan_timer, 0); scan_timer.expires = jiffies + INPUT_POLL_TIME; - scan_timer.data = 0; - scan_timer.function = (void *)&panel_scan_timer; add_timer(&scan_timer); } -- cgit v1.2.3 From 4fde58bb43512fc283ea76e90d20198da177fb69 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 07:59:51 +0200 Subject: staging: rtl8192u: ieee80211: replace init_timer by setup_timer This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise. The issue was discovered using the following coccinelle script: @@ expression ds, e1, e2; @@ -init_timer (&ds); +setup_timer (&ds, e1, e2); ... ( -ds.function = e1; ... -ds.data = e2; | -ds.data = e2; ... -ds.function = e1; ) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index d1471877e19d..3a5407158963 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -2722,13 +2722,11 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) ieee->enable_rx_imm_BA = 1; ieee->tx_pending.txb = NULL; - init_timer(&ieee->associate_timer); - ieee->associate_timer.data = (unsigned long)ieee; - ieee->associate_timer.function = ieee80211_associate_abort_cb; + setup_timer(&ieee->associate_timer, ieee80211_associate_abort_cb, + (unsigned long)ieee); - init_timer(&ieee->beacon_timer); - ieee->beacon_timer.data = (unsigned long) ieee; - ieee->beacon_timer.function = ieee80211_send_beacon_cb; + setup_timer(&ieee->beacon_timer, ieee80211_send_beacon_cb, + (unsigned long)ieee); ieee->wq = create_workqueue(DRV_NAME); -- cgit v1.2.3 From 7d2b3cf7cfb328cc494cc4775c60bbf5f2fa2ce2 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 19 Feb 2015 08:00:56 +0200 Subject: staging: slicloss: replace init_timer by setup_timer This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise. The issue was discovered using the following coccinelle script: @@ expression ds, e1, e2; @@ -init_timer (&ds); +setup_timer (&ds, e1, e2); ... ( -ds.function = e1; ... -ds.data = e2; | -ds.data = e2; ... -ds.function = e1; ) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/slicoss/slicoss.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 42d62ef56cb8..1248f629e2d4 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2362,22 +2362,19 @@ static int slic_if_init(struct adapter *adapter) adapter->state = ADAPT_UP; if (!card->loadtimerset) { - init_timer(&card->loadtimer); + setup_timer(&card->loadtimer, &slic_timer_load_check, + (ulong)card); card->loadtimer.expires = jiffies + (SLIC_LOADTIMER_PERIOD * HZ); - card->loadtimer.data = (ulong) card; - card->loadtimer.function = &slic_timer_load_check; add_timer(&card->loadtimer); card->loadtimerset = 1; } if (!adapter->pingtimerset) { - init_timer(&adapter->pingtimer); + setup_timer(&adapter->pingtimer, &slic_timer_ping, (ulong)dev); adapter->pingtimer.expires = jiffies + (PING_TIMER_INTERVAL * HZ); - adapter->pingtimer.data = (ulong) dev; - adapter->pingtimer.function = &slic_timer_ping; add_timer(&adapter->pingtimer); adapter->pingtimerset = 1; adapter->card->pingstatus = ISR_PINGMASK; -- cgit v1.2.3 From b0487a7c7304536527095f9999ee18c76a6006d7 Mon Sep 17 00:00:00 2001 From: Gamze POLAT Date: Thu, 19 Feb 2015 10:43:07 +0200 Subject: Staging: dgnc: Removed trailing whitespace Removed trailing whitespaces to improve code readability and remove checkpatch warning. Signed-off-by: Gamze POLAT Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/TODO | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO index 22adff1078f3..2b2c6ea03c61 100644 --- a/drivers/staging/dgnc/TODO +++ b/drivers/staging/dgnc/TODO @@ -1,10 +1,10 @@ * checkpatch fixes * remove unecessary comments -* remove unecessary error messages. Example kzalloc() has its +* remove unecessary error messages. Example kzalloc() has its own error message. Adding an extra one is useless. * use goto statements for error handling when appropriate -* there is a lot of unecessary code in the driver. It was +* there is a lot of unecessary code in the driver. It was originally a standalone driver. Remove uneeded code. -Please send patches to Greg Kroah-Hartman and +Please send patches to Greg Kroah-Hartman and Cc: Lidza Louina -- cgit v1.2.3 From 98bedd77dc99a1eb835ab527ce5c74b09a0f4d88 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Thu, 19 Feb 2015 23:05:20 +0100 Subject: Staging: rtl8192u: Remove space before tab This patch fixes the checkpatch.pl warning: WARNING: "please, no space before tabs" Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_phy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 058960251bac..dbd3321c6d4a 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -106,10 +106,10 @@ void rtl8192_setBBreg(struct net_device *dev, u32 reg_addr, u32 bitmask, /****************************************************************************** * function: This function reads specific bits from BB register * input: net_device *dev - * u32 reg_addr //target addr to be readback - * u32 bitmask //taget bit pos to be readback + * u32 reg_addr //target addr to be readback + * u32 bitmask //taget bit pos to be readback * output: none - * return: u32 data //the readback register value + * return: u32 data //the readback register value * notice: ******************************************************************************/ u32 rtl8192_QueryBBReg(struct net_device *dev, u32 reg_addr, u32 bitmask) @@ -478,7 +478,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev, /****************************************************************************** * function: This function reads BB parameters from header file we generate, * and do register read/write - * input: net_device *dev + * input: net_device *dev * output: none * return: none * notice: BB parameters may change all the time, so please make -- cgit v1.2.3 From 3033669eb2606c705b09b5bbcadcfca1108f6947 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Fri, 20 Feb 2015 22:26:57 +0100 Subject: Staging: rtl8192u: Replace header files Files and should not be included directly. This patch fixes the following checkpatch.pl warnings: Use #include instead of Use #include instead of Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 55332217c29f..1fb6d85385e0 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -15,8 +15,8 @@ #include #include #include -#include -#include +#include +#include #include "ieee80211.h" -- cgit v1.2.3 From bf1c66e8158d36daf1598b9350a10b7a235252fa Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Fri, 20 Feb 2015 22:54:27 +0100 Subject: Staging: rtl8192u: Remove else after return This patch simplifies the code by removing else and fixes the following checkpatch.pl warning: "else is not useful after break or return". Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_phy.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index dbd3321c6d4a..84a8a9a78a46 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1365,11 +1365,10 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, if ((*stage) == 2) { (*delay) = CurrentCmd->msDelay; return true; - } else { - (*stage)++; - (*step) = 0; - continue; } + (*stage)++; + (*step) = 0; + continue; } switch (CurrentCmd->CmdID) { -- cgit v1.2.3 From fb99f8741d03cde77ad200583eb747d729295a71 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 21 Feb 2015 12:24:38 +0100 Subject: Staging: rtl8192u: Replace printk() with pr_debug() and netdev_dbg(). For dynamic debugging pr_debug() or netdev_dbg (if there is a ponter to a device net structure) is preferred over printk(), which is the raw way to print something. Issue found by checkpatch.pl. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 1fb6d85385e0..da3cb29fc02d 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -66,7 +66,7 @@ void ieee80211_crypt_deinit_handler(unsigned long data) spin_lock_irqsave(&ieee->lock, flags); ieee80211_crypt_deinit_entries(ieee, 0); if (!list_empty(&ieee->crypt_deinit_list)) { - printk(KERN_DEBUG "%s: entries remaining in delayed crypt " + netdev_dbg(ieee->dev, "%s: entries remaining in delayed crypt " "deletion list\n", ieee->dev->name); ieee->crypt_deinit_timer.expires = jiffies + HZ; add_timer(&ieee->crypt_deinit_timer); @@ -118,7 +118,7 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) list_add(&alg->list, &hcrypt->algs); spin_unlock_irqrestore(&hcrypt->lock, flags); - printk(KERN_DEBUG "ieee80211_crypt: registered algorithm '%s'\n", + pr_debug("ieee80211_crypt: registered algorithm '%s'\n", ops->name); return 0; @@ -146,7 +146,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) spin_unlock_irqrestore(&hcrypt->lock, flags); if (del_alg) { - printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " + pr_debug("ieee80211_crypt: unregistered algorithm " "'%s'\n", ops->name); kfree(del_alg); } @@ -232,7 +232,7 @@ void __exit ieee80211_crypto_deinit(void) struct ieee80211_crypto_alg *alg = (struct ieee80211_crypto_alg *) ptr; list_del(ptr); - printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " + pr_debug("ieee80211_crypt: unregistered algorithm " "'%s' (deinit)\n", alg->ops->name); kfree(alg); } -- cgit v1.2.3 From 36f7c381d3c3cf5dc2b4e9a1155a8f121a0158b1 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sat, 21 Feb 2015 21:03:23 +0200 Subject: Staging: rtl8192u: Fix do not use // c99 comments. This patch fixes "do not use // C99 comments" errors in r8190_rtl8256.h Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8190_rtl8256.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index fa6dd37d85e6..1e4afb7e87f6 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -13,7 +13,7 @@ #ifndef RTL8225H #define RTL8225H -#define RTL819X_TOTAL_RF_PATH 2 //for 8192U +#define RTL819X_TOTAL_RF_PATH 2 /* for 8192U */ extern void PHY_SetRF8256Bandwidth(struct net_device *dev , HT_CHANNEL_WIDTH Bandwidth); extern void PHY_RF8256_Config(struct net_device *dev); extern void phy_RF8256_Config_ParaFile(struct net_device *dev); -- cgit v1.2.3 From d6413982b48658b025ca3879fdcf7c0d080c9e7e Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sat, 21 Feb 2015 21:16:34 +0200 Subject: Staging: rtl8192u: Remove space before ',' This patch fixes checkpatch.pl error in file r8190_rtl8256.h ERROR: space prohibited before that ',' (ctx:WxW) Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8190_rtl8256.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index 1e4afb7e87f6..7a5a38854681 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -14,7 +14,7 @@ #define RTL8225H #define RTL819X_TOTAL_RF_PATH 2 /* for 8192U */ -extern void PHY_SetRF8256Bandwidth(struct net_device *dev , HT_CHANNEL_WIDTH Bandwidth); +extern void PHY_SetRF8256Bandwidth(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth); extern void PHY_RF8256_Config(struct net_device *dev); extern void phy_RF8256_Config_ParaFile(struct net_device *dev); extern void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); -- cgit v1.2.3 From 6205895296ff6fc0f593cce937a45ff461b016ef Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sun, 22 Feb 2015 14:50:06 +0200 Subject: Staging: rtl8192u: Fix do not use // c99 comments. This patch fixes "do not use // C99 comments" errors in ieee80211_module.c Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index afbd09d7300a..d8900dd9236c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -31,7 +31,7 @@ *******************************************************************************/ #include -//#include +/* #include */ #include #include #include @@ -141,7 +141,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) spin_lock_init(&ieee->wpax_suitlist_lock); spin_lock_init(&ieee->bw_spinlock); spin_lock_init(&ieee->reorder_spinlock); - //added by WB + /* added by WB */ atomic_set(&(ieee->atm_chnlop), 0); atomic_set(&(ieee->atm_swbw), 0); @@ -153,7 +153,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->ieee802_1x = 1; ieee->raw_tx = 0; //ieee->hwsec_support = 1; //defalt support hw security. //use module_param instead. - ieee->hwsec_active = 0; //disable hwsec, switch it on when necessary. + ieee->hwsec_active = 0; /* disable hwsec, switch it on when necessary. */ ieee80211_softmac_init(ieee); @@ -164,7 +164,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) goto failed; } HTUpdateDefaultSetting(ieee); - HTInitializeHTInfo(ieee); //may move to other place. + HTInitializeHTInfo(ieee); /* may move to other place. */ TSInitialize(ieee); for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) @@ -176,7 +176,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->last_packet_time[i] = 0; } -//These function were added to load crypte module autoly +/* These function were added to load crypte module autoly */ ieee80211_tkip_null(); ieee80211_wep_null(); ieee80211_ccmp_null(); @@ -195,7 +195,7 @@ void free_ieee80211(struct net_device *dev) { struct ieee80211_device *ieee = netdev_priv(dev); int i; - //struct list_head *p, *q; + /* struct list_head *p, *q; */ // del_timer_sync(&ieee->SwBwTimer); kfree(ieee->pHTInfo); ieee->pHTInfo = NULL; @@ -239,7 +239,7 @@ static int debug = \ // IEEE80211_DL_REORDER| // IEEE80211_DL_TRACE | //IEEE80211_DL_DATA | - IEEE80211_DL_ERR //awayls open this flags to show error out + IEEE80211_DL_ERR /* awayls open this flags to show error out */ ; static struct proc_dir_entry *ieee80211_proc; -- cgit v1.2.3 From 97567a9064086043f5a6860ab8a5f6df80911fa1 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sun, 22 Feb 2015 17:22:51 +0100 Subject: Staging: rtl8192u: Remove trailing whitespace. This patch removes whitespace at the end of the line. Issue found by checkpatch.pl. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index d8900dd9236c..a35ba01247ef 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -284,7 +284,7 @@ int __init ieee80211_debug_init(void) " proc directory\n"); return -EIO; } - e = proc_create("debug_level", S_IRUGO | S_IWUSR, + e = proc_create("debug_level", S_IRUGO | S_IWUSR, ieee80211_proc, &fops); if (!e) { remove_proc_entry(DRV_NAME, init_net.proc_net); -- cgit v1.2.3 From e5e339655a0b1c85df30fb7ca8aacfa11ce8d6a1 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Mon, 23 Feb 2015 03:13:15 +0530 Subject: staging: rtl8192u: Remove commented header. This patch removes the commented header as it is not used in modern linux systems. Signed-off-by: Navya Sri Nizamkari Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index fca73c7c9fbe..96ab304d327c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -32,7 +32,6 @@ ******************************************************************************/ #include -//#include #include #include #include -- cgit v1.2.3 From 609de3ae934edbd996af73436fc7509161010b02 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Mon, 23 Feb 2015 03:12:52 +0530 Subject: staging: rtl8192u: Remove commented header. This patch removes the commented header as it is not used in modern linux systems. Signed-off-by: Navya Sri Nizamkari Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index d401dbf4c7c6..286b71d35212 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -22,7 +22,6 @@ #include -//#include #include #include #include -- cgit v1.2.3 From 7ea8b64d3b6da711f415cc01454dcc1d6924ee8b Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Mon, 23 Feb 2015 03:11:59 +0530 Subject: staging: rtl8192u: Remove commented header. This patch removes the commented header as it is not used in modern linux systems. Signed-off-by: Navya Sri Nizamkari Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 8c1bf1f56883..c43d0fe7edf7 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -9,7 +9,6 @@ * more details. */ -//#include #include #include #include -- cgit v1.2.3 From 45466a5c933fd0d2c3278957de8067133f186732 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Mon, 23 Feb 2015 03:11:34 +0530 Subject: staging: rtl8192u: Remove commented header. This patch removes the commented header as it is not used in modern linux systems. Signed-off-by: Navya Sri Nizamkari Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index fcc90a5700d6..6201712e9c7d 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -9,7 +9,6 @@ * more details. */ -//#include #include #include #include -- cgit v1.2.3 From f79483ea0b7723d3402c24a156610d79dc279b94 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Mon, 23 Feb 2015 03:10:57 +0530 Subject: staging: rtl8192u: Remove commented header. This patch removes the commented header as it is not used in modern linux systems. Signed-off-by: Navya Sri Nizamkari Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 143b682477e5..95f5fc7834a0 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -9,7 +9,6 @@ * more details. */ -//#include #include #include #include -- cgit v1.2.3 From a064d27a5bff8aa142cbe2da1f0f0a008ef7988a Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Sun, 22 Feb 2015 22:11:20 +0530 Subject: staging: rtl8192u: Remove unnecessary comment The header file is not used anymore, so it is commented out in this file.This patch deletes that unnecessary comment. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index da3cb29fc02d..f80dd08b0668 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -11,7 +11,6 @@ * */ -//#include #include #include #include -- cgit v1.2.3 From ff757c8a269b941b28ffc5c19273c284955267f5 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Mon, 23 Feb 2015 20:15:48 +0100 Subject: Staging: rtl8192u: Convert comments from C99 to C89 style Kernel style for comments is C89 style. Issue found by checkpatch.pl. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h index 7ed7243b1fb0..873969c9f226 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h @@ -1,14 +1,14 @@ #ifndef _TSTYPE_H_ #define _TSTYPE_H_ #include "rtl819x_Qos.h" -#define TS_SETUP_TIMEOUT 60 // In millisecond +#define TS_SETUP_TIMEOUT 60 /* In millisecond */ #define TS_INACT_TIMEOUT 60 #define TS_ADDBA_DELAY 60 #define TOTAL_TS_NUM 16 #define TCLAS_NUM 4 -// This define the Tx/Rx directions +/* This define the Tx/Rx directions */ typedef enum _TR_SELECT { TX_DIR = 0, RX_DIR = 1, @@ -28,9 +28,9 @@ typedef struct _TS_COMMON_INFO{ typedef struct _TX_TS_RECORD{ TS_COMMON_INFO TsCommonInfo; u16 TxCurSeq; - BA_RECORD TxPendingBARecord; // For BA Originator - BA_RECORD TxAdmittedBARecord; // For BA Originator -// QOS_DL_RECORD DLRecord; + BA_RECORD TxPendingBARecord; /* For BA Originator */ + BA_RECORD TxAdmittedBARecord; /* For BA Originator */ +/* QOS_DL_RECORD DLRecord; */ u8 bAddBaReqInProgress; u8 bAddBaReqDelayed; u8 bUsingBa; @@ -44,11 +44,11 @@ typedef struct _RX_TS_RECORD { u16 RxTimeoutIndicateSeq; struct list_head RxPendingPktList; struct timer_list RxPktPendingTimer; - BA_RECORD RxAdmittedBARecord; // For BA Recipient + BA_RECORD RxAdmittedBARecord; /* For BA Recipient */ u16 RxLastSeqNum; u8 RxLastFragNum; u8 num; -// QOS_DL_RECORD DLRecord; +/* QOS_DL_RECORD DLRecord; */ } RX_TS_RECORD, *PRX_TS_RECORD; -- cgit v1.2.3 From 72b16fe3f1a0f50db8dd9c80ea4eb7736f2a66ed Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Tue, 24 Feb 2015 21:54:08 +0100 Subject: Staging: rtl8192u: Simplify if condition. Remove unnecessary TRUE statement. Fields bDynamicTxLowPower and bDynamicTxHighPower are of bool type so such change is correct. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8190_rtl8256.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c index 1868352d3789..e00032947e0f 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.c +++ b/drivers/staging/rtl8192u/r8190_rtl8256.c @@ -225,7 +225,7 @@ void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel) struct r8192_priv *priv = ieee80211_priv(dev); TxAGC = powerlevel; - if (priv->bDynamicTxLowPower == TRUE) { + if (priv->bDynamicTxLowPower) { if (priv->CustomerID == RT_CID_819x_Netcore) TxAGC = 0x22; else @@ -275,7 +275,7 @@ void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel) priv->Pwr_Track = writeVal_tmp; } - if (priv->bDynamicTxHighPower == TRUE) { + if (priv->bDynamicTxHighPower) { /*Add by Jacken 2008/03/06 *Emily, 20080613. Set low tx power for both MCS and legacy OFDM */ -- cgit v1.2.3 From 352e579da8c9253b4cdf6d3135c6fe909a1b1f5e Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Tue, 24 Feb 2015 22:21:12 +0100 Subject: Staging: rtl8192u: Simplify if condition Remove unnecessary TRUE statement. Field bMediaConnect is of bool type, so such change is correct. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 84a8a9a78a46..3b2c954ff292 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1187,7 +1187,7 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, /* Turn on RF we are still linked, which might happen when we quickly turn off and on HW RF. */ - if (pMgntInfo->bMediaConnect == TRUE) + if (pMgntInfo->bMediaConnect) Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK); else /* Turn off LED if RF is not ON. */ -- cgit v1.2.3 From da07768909319820703e7a6729fbda8682040ceb Mon Sep 17 00:00:00 2001 From: Gamze POLAT Date: Fri, 20 Feb 2015 22:42:17 +0200 Subject: staing: rtl8712: else after return or break warning This patch fixes checkpatch.pl warning. WARNING: else is not generally useful after a break or return Signed-off-by: Gamze POLAT Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_recv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c index 06f15f81c4d8..046a46c4cd7f 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.c +++ b/drivers/staging/rtl8712/rtl871x_recv.c @@ -517,8 +517,7 @@ static sint validate_recv_data_frame(struct _adapter *adapter, return _FAIL; if (psta == NULL) return _FAIL; - else - precv_frame->u.hdr.psta = psta; + precv_frame->u.hdr.psta = psta; pattrib->amsdu = 0; /* parsing QC field */ if (pattrib->qos == 1) { -- cgit v1.2.3 From c7c42826f9afb017ee8927cfdc9c85f2e6d7bf0c Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Mon, 23 Feb 2015 08:42:56 +0200 Subject: Staging: rtl8712: replace memcpy() by ether_addr_copy() using coccinelle and pack variable This patch focuses on fixing the following warning generated by checkpatch.pl for the file rxtx.c Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); struct _adapter { struct dvobj_priv dvobjpriv; /* 0 40*/ struct mlme_priv mlmepriv; /* 40 1560*/ /* --- cacheline 25 boundary (1600 bytes) --- */ struct cmd_priv cmdpriv; /* 1600 136*/ /* --- cacheline 27 boundary (1728 bytes) was 8 bytes ago --- */ struct evt_priv evtpriv; /* 1736 96*/ /* --- cacheline 28 boundary (1792 bytes) was 40 bytes ago --- * */ struct io_queue * pio_queue; /* 1832 8*/ struct xmit_priv xmitpriv; /* 1840 912*/ /* --- cacheline 43 boundary (2752 bytes) --- */ struct recv_priv recvpriv; /* 2752 1088*/ /* --- cacheline 60 boundary (3840 bytes) --- */ struct sta_priv stapriv; /* 3840 672*/ /* --- cacheline 70 boundary (4480 bytes) was 32 bytes ago --- * */ struct security_priv securitypriv; /* 4512 4816*/ /* --- cacheline 145 boundary (9280 bytes) was 48 bytes ago --- * */ struct registry_priv registrypriv; /* 9328 968*/ /* --- cacheline 160 boundary (10240 bytes) was 56 bytes ago --- * */ struct wlan_acl_pool acl_list; /* 10296 1536*/ /* --- cacheline 184 boundary (11776 bytes) was 56 bytes ago --- * */ struct pwrctrl_priv pwrctrlpriv; /* 11832 224*/ /* --- cacheline 188 boundary (12032 bytes) was 24 bytes ago --- * */ struct eeprom_priv eeprompriv; /* 12056 508*/ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 196 boundary (12544 bytes) was 24 bytes ago --- * */ struct hal_priv halpriv; /* 12568 88*/ /* --- cacheline 197 boundary (12608 bytes) was 48 bytes ago --- * */ struct led_priv ledpriv; /* 12656 304*/ /* --- cacheline 202 boundary (12928 bytes) was 32 bytes ago --- * */ struct mp_priv mppriv; /* 12960 1080*/ /* --- cacheline 219 boundary (14016 bytes) was 24 bytes ago --- * */ s32 bDriverStopped; /* 14040 4*/ s32 bSurpriseRemoved; /* 14044 4*/ u32 IsrContent; /* 14048 4*/ u32 ImrContent; /* 14052 4*/ u8 EepromAddressSize; /* 14056 1*/ u8 hw_init_completed; /* 14057 1*/ /* XXX 6 bytes hole, try to pack */ struct task_struct * cmdThread; /* 14064 8*/ pid_t evtThread; /* 14072 4*/ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 220 boundary (14080 bytes) --- */ struct task_struct * xmitThread; /* 14080 8*/ pid_t recvThread; /* 14088 4*/ /* XXX 4 bytes hole, try to pack */ uint (*dvobj_init)(struct _adapter *); /*14096 8 */ void (*dvobj_deinit)(struct _adapter *);/* 14104 8 */ struct net_device * pnetdev; /* 14112 8*/ int bup; /* 14120 4*/ /* XXX 4 bytes hole, try to pack */ struct net_device_stats stats; /* 14128 184*/ /* --- cacheline 223 boundary (14272 bytes) was 40 bytes ago --- * */ struct iw_statistics iwstats; /* 14312 32*/ /* --- cacheline 224 boundary (14336 bytes) was 8 bytes ago --- * */ int pid; /* 14344 4*/ /* XXX 4 bytes hole, try to pack */ struct work_struct wkFilterRxFF0; /* 14352 32*/ u8 blnEnableRxFF0Filter; /* 14384 1*/ /* XXX 3 bytes hole, try to pack */ spinlock_t lockRxFF0Filter; /* 14388 4*/ const struct firmware * fw; /* 14392 8*/ u8 EepromAddressSize; /* 14056 1*/ u8 hw_init_completed; /* 14057 1*/ /* XXX 6 bytes hole, try to pack */ struct task_struct * cmdThread; /* 14064 8*/ pid_t evtThread; /* 14072 4*/ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 220 boundary (14080 bytes) --- */ struct task_struct * xmitThread; /* 14080 8*/ pid_t recvThread; /* 14088 4*/ /* XXX 4 bytes hole, try to pack */ uint (*dvobj_init)(struct _adapter *); /*14096 8 */ void (*dvobj_deinit)(struct _adapter *);/* 14104 8 */ struct net_device * pnetdev; /* 14112 8*/ int bup; /* 14120 4*/ /* XXX 4 bytes hole, try to pack */ struct net_device_stats stats; /* 14128 184*/ /* --- cacheline 223 boundary (14272 bytes) was 40 bytes ago --- * */ struct iw_statistics iwstats; /* 14312 32*/ /* --- cacheline 224 boundary (14336 bytes) was 8 bytes ago --- * */ int pid; /* 14344 4*/ /* XXX 4 bytes hole, try to pack */ struct work_struct wkFilterRxFF0; /* 14352 32*/ u8 blnEnableRxFF0Filter; /* 14384 1*/ /* XXX 3 bytes hole, try to pack */ spinlock_t lockRxFF0Filter; /* 14388 4*/ const struct firmware * fw; /* 14392 8*/ /* --- cacheline 225 boundary (14400 bytes) --- */ struct usb_interface * pusb_intf; /* 14400 8*/ struct mutex mutex_start; /* 14408 40*/ /* XXX last struct has 4 bytes of padding */ struct completion rtl8712_fw_ready; /* 14448 32*/ /* --- cacheline 226 boundary (14464 bytes) was 16 bytes ago --- * */ /* size: 14480, cachelines: 227, members: 40 */ /* sum members: 14451, holes: 7, sum holes: 29 */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 16 bytes */ }; Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/recv_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/recv_linux.c b/drivers/staging/rtl8712/recv_linux.c index 409c8c897256..3640dd48febe 100644 --- a/drivers/staging/rtl8712/recv_linux.c +++ b/drivers/staging/rtl8712/recv_linux.c @@ -96,7 +96,7 @@ void r8712_handle_tkip_mic_err(struct _adapter *padapter, u8 bgroup) else ev.flags |= IW_MICFAILURE_PAIRWISE; ev.src_addr.sa_family = ARPHRD_ETHER; - memcpy(ev.src_addr.sa_data, &pmlmepriv->assoc_bssid[0], ETH_ALEN); + ether_addr_copy(ev.src_addr.sa_data, &pmlmepriv->assoc_bssid[0]); memset(&wrqu, 0x00, sizeof(wrqu)); wrqu.data.length = sizeof(ev); wireless_send_event(padapter->pnetdev, IWEVMICHAELMICFAILURE, &wrqu, -- cgit v1.2.3 From d55519ab9b20b0961bc13018506fb413d5a752d7 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Mon, 23 Feb 2015 09:11:57 +0200 Subject: Staging: rtl8712: replace memcpy() by ether_addr_copy() using coccinelle and pack variable This patch focuses on fixing the following warning generated by checkpatch.pl for the file rtl871x_cmd.c Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); struct _adapter { struct dvobj_priv dvobjpriv; /* 0 40*/ struct mlme_priv mlmepriv; /* 40 1560*/ /* --- cacheline 25 boundary (1600 bytes) --- */ struct cmd_priv cmdpriv; /* 1600 136*/ /* --- cacheline 27 boundary (1728 bytes) was 8 bytes ago --- */ struct evt_priv evtpriv; /* 1736 96*/ /* --- cacheline 28 boundary (1792 bytes) was 40 bytes ago --- * */ struct io_queue * pio_queue; /* 1832 8*/ struct xmit_priv xmitpriv; /* 1840 912*/ /* --- cacheline 43 boundary (2752 bytes) --- */ struct recv_priv recvpriv; /* 2752 1088*/ /* --- cacheline 60 boundary (3840 bytes) --- */ struct sta_priv stapriv; /* 3840 672*/ /* --- cacheline 70 boundary (4480 bytes) was 32 bytes ago --- * */ struct security_priv securitypriv; /* 4512 4816*/ /* --- cacheline 145 boundary (9280 bytes) was 48 bytes ago --- * */ struct registry_priv registrypriv; /* 9328 968*/ /* --- cacheline 160 boundary (10240 bytes) was 56 bytes ago --- * */ struct wlan_acl_pool acl_list; /* 10296 1536*/ /* --- cacheline 184 boundary (11776 bytes) was 56 bytes ago --- * */ struct pwrctrl_priv pwrctrlpriv; /* 11832 224*/ /* --- cacheline 188 boundary (12032 bytes) was 24 bytes ago --- * */ struct eeprom_priv eeprompriv; /* 12056 508*/ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 196 boundary (12544 bytes) was 24 bytes ago --- * */ struct hal_priv halpriv; /* 12568 88*/ /* --- cacheline 197 boundary (12608 bytes) was 48 bytes ago --- * */ struct led_priv ledpriv; /* 12656 304*/ /* --- cacheline 202 boundary (12928 bytes) was 32 bytes ago --- * */ struct mp_priv mppriv; /* 12960 1080*/ /* --- cacheline 219 boundary (14016 bytes) was 24 bytes ago * --- */ s32 bDriverStopped; /* 14040 4*/ s32 bSurpriseRemoved; /* 14044 4*/ u32 IsrContent; /* 14048 4*/ u32 ImrContent; /* 14052 4*/ u8 EepromAddressSize; /* 14056 1*/ u8 hw_init_completed; /* 14057 1*/ /* XXX 6 bytes hole, try to pack */ struct task_struct * cmdThread; /* 14064 8*/ pid_t evtThread; /* 14072 4*/ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 220 boundary (14080 bytes) --- */ struct task_struct * xmitThread; /* 14080 8*/ pid_t recvThread; /* 14088 4*/ /* XXX 4 bytes hole, try to pack */ uint (*dvobj_init)(struct _adapter *); /*14096 8 */ void (*dvobj_deinit)(struct _adapter *);/* 14104 8 */ struct net_device * pnetdev; /* 14112 8*/ int bup; /* 14120 4*/ /* XXX 4 bytes hole, try to pack */ struct net_device_stats stats; /* 14128 184*/ /* --- cacheline 223 boundary (14272 bytes) was 40 bytes ago --- * */ struct iw_statistics iwstats; /* 14312 32*/ /* --- cacheline 224 boundary (14336 bytes) was 8 bytes ago --- * */ int pid; /* 14344 4*/ /* XXX 4 bytes hole, try to pack */ struct work_struct wkFilterRxFF0; /* 14352 32*/ u8 blnEnableRxFF0Filter; /* 14384 1*/ /* XXX 3 bytes hole, try to pack */ spinlock_t lockRxFF0Filter; /* 14388 4*/ const struct firmware * fw; /* 14392 8*/ /* --- cacheline 225 boundary (14400 bytes) --- */ struct usb_interface * pusb_intf; /* 14400 8*/ struct mutex mutex_start; /* 14408 40*/ /* XXX last struct has 4 bytes of padding */ struct completion rtl8712_fw_ready; /* 14448 32*/ /* --- cacheline 226 boundary (14464 bytes) was 16 bytes ago --- * */ /* size: 14480, cachelines: 227, members: 40 */ /* sum members: 14451, holes: 7, sum holes: 29 */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 16 bytes */ }; Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_cmd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index fe5e315319f7..939a2ec54796 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -530,8 +530,8 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) * the driver just has the bssid information for PMKIDList searching. */ if (pmlmepriv->assoc_by_bssid == false) - memcpy(&pmlmepriv->assoc_bssid[0], - &pnetwork->network.MacAddress[0], ETH_ALEN); + ether_addr_copy(&pmlmepriv->assoc_bssid[0], + &pnetwork->network.MacAddress[0]); psecnetwork->IELength = r8712_restruct_sec_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], @@ -682,7 +682,7 @@ u8 r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key) init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_); ph2c->rsp = (u8 *) psetstakey_rsp; ph2c->rspsz = sizeof(struct set_stakey_rsp); - memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN); + ether_addr_copy(psetstakey_para->addr, sta->hwaddr); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) psetstakey_para->algorithm = (unsigned char) psecuritypriv->PrivacyAlgrthm; @@ -784,7 +784,7 @@ u8 r8712_setMacAddr_cmd(struct _adapter *padapter, u8 *mac_addr) } init_h2fwcmd_w_parm_no_rsp(ph2c, psetMacAddr_para, _SetMacAddress_CMD_); - memcpy(psetMacAddr_para->MacAddr, mac_addr, ETH_ALEN); + ether_addr_copy(psetMacAddr_para->MacAddr, mac_addr); r8712_enqueue_cmd(pcmdpriv, ph2c); return _SUCCESS; } @@ -813,7 +813,7 @@ u8 r8712_setassocsta_cmd(struct _adapter *padapter, u8 *mac_addr) init_h2fwcmd_w_parm_no_rsp(ph2c, psetassocsta_para, _SetAssocSta_CMD_); ph2c->rsp = (u8 *) psetassocsta_rsp; ph2c->rspsz = sizeof(struct set_assocsta_rsp); - memcpy(psetassocsta_para->addr, mac_addr, ETH_ALEN); + ether_addr_copy(psetassocsta_para->addr, mac_addr); r8712_enqueue_cmd(pcmdpriv, ph2c); return _SUCCESS; } -- cgit v1.2.3 From a6c6e298170e5fad9a759abf305eadcf5780b658 Mon Sep 17 00:00:00 2001 From: Katie Dunne Date: Wed, 25 Feb 2015 07:40:37 -0800 Subject: Staging: rtl8712: Remove unused macros Removes several macro definitions that are unused Patch 2 will remove the same definitions in rtl8188eu/include/wifi.h Signed-off-by: Katie Dunne Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/wifi.h | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h index 73d7cd280607..6b1e1fa59cbd 100644 --- a/drivers/staging/rtl8712/wifi.h +++ b/drivers/staging/rtl8712/wifi.h @@ -235,11 +235,6 @@ enum WIFI_REG_DOMAIN { #define GetPrivacy(pbuf) (((*(unsigned short *)(pbuf)) & \ le16_to_cpu(_PRIVACY_)) != 0) -#define ClearPrivacy(pbuf) ({ \ - *(unsigned short *)(pbuf) &= (~cpu_to_le16(_PRIVACY_)); \ -}) - - #define GetOrder(pbuf) (((*(unsigned short *)(pbuf)) & \ le16_to_cpu(_ORDER_)) != 0) @@ -270,16 +265,6 @@ enum WIFI_REG_DOMAIN { #define GetFragNum(pbuf) (cpu_to_le16(*(unsigned short *)((addr_t)\ (pbuf) + 22)) & 0x0f) -#define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)\ - ((addr_t)(pbuf) + 22))) - -#define SetFragNum(pbuf, num) ({ \ - *(unsigned short *)((addr_t)(pbuf) + 22) = \ - ((*(unsigned short *)((addr_t)(pbuf) + 22)) & \ - le16_to_cpu(~(0x000f))) | \ - cpu_to_le16(0x0f & (num)); \ -}) - #define SetSeqNum(pbuf, num) ({ \ *(unsigned short *)((addr_t)(pbuf) + 22) = \ ((*(unsigned short *)((addr_t)(pbuf) + 22)) & \ @@ -306,17 +291,9 @@ enum WIFI_REG_DOMAIN { #define GetAMsdu(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 7) & 0x1) -#define SetAMsdu(pbuf, amsdu) ({ \ - *(unsigned short *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7); \ -}) - #define GetAid(pbuf) (cpu_to_le16(*(unsigned short *)((addr_t)(pbuf) + 2)) \ & 0x3fff) -#define GetTid(pbuf) (cpu_to_le16(*(unsigned short *)((addr_t)(pbuf) + \ - (((GetToDs(pbuf) << 1)|GetFrDs(pbuf)) == 3 ? \ - 30 : 24))) & 0x000f) - #define GetAddr1Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 4)) #define GetAddr2Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 10)) -- cgit v1.2.3 From 875b7dec47533e2a26489420c7964e8efe647175 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 25 Feb 2015 09:35:32 +0530 Subject: Staging: rtl8712: Use mod_timer This patch introduces the use of API function mod_timer instead of driver specific function as it is a more efficient and standard way to update the expire field of an active timer. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 9bb364f04fd4..5d4470a9aeb5 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -129,7 +129,8 @@ static inline void handle_pairwise_key(struct sta_info *psta, memcpy(psta->tkiprxmickey. skey, &(param->u.crypt. key[24]), 8); padapter->securitypriv. busetkipkey = false; - _set_timer(&padapter->securitypriv.tkip_timer, 50); + mod_timer(&padapter->securitypriv.tkip_timer, + jiffies + msecs_to_jiffies(50)); } r8712_setstakey_cmd(padapter, (unsigned char *)psta, true); } @@ -153,8 +154,8 @@ static inline void handle_group_key(struct ieee_param *param, if (padapter->registrypriv.power_mgnt > PS_MODE_ACTIVE) { if (padapter->registrypriv.power_mgnt != padapter-> pwrctrlpriv.pwr_mode) - _set_timer(&(padapter->mlmepriv.dhcp_timer), - 60000); + mod_timer(&padapter->mlmepriv.dhcp_timer, + jiffies + msecs_to_jiffies(60000)); } } } -- cgit v1.2.3 From 1f3aefb5dfcaf28c0a0b5c270ca120818da88f58 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Sun, 22 Feb 2015 16:58:08 +0200 Subject: Staging: rtl8192e: replace memcpy() by ether_addr_copy() using coccinelle and pack variable This patch focuses on fixing the following warning generated by checkpatch.pl for the file rxtx.c Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); struct net_device { char name[16]; /* 0 16*/ struct hlist_node name_hlist; /* 16 16*/ char * ifalias; /* 32 8*/ long unsigned int mem_end; /* 40 8*/ long unsigned int mem_start; /* 48 8*/ long unsigned int base_addr; /* 56 8*/ /* --- cacheline 1 boundary (64 bytes) --- */ int irq; /* 64 4*/ /* XXX 4 bytes hole, try to pack */ long unsigned int state; /* 72 8*/ struct list_head dev_list; /* 80 16*/ struct list_head napi_list; /* 96 16*/ struct list_head unreg_list; /* 112 16*/ /* --- cacheline 2 boundary (128 bytes) --- */ struct list_head close_list; /* 128 16*/ struct { struct list_head upper; /* 144 16*/ struct list_head lower; /* 160 16*/ } adj_list; /* 144 32*/ struct { struct list_head upper; /* 176 16*/ struct list_head lower; /* 192 16*/ } all_adj_list; /* 176 32*/ /* --- cacheline 3 boundary (192 bytes) was 16 bytes ago --- */ netdev_features_t features; /* 208 8*/ netdev_features_t hw_features; /* 216 8*/ netdev_features_t wanted_features; /* 224 8*/ netdev_features_t vlan_features; /* 232 8*/ netdev_features_t hw_enc_features; /* 240 8*/ netdev_features_t mpls_features; /* 248 8*/ /* --- cacheline 4 boundary (256 bytes) --- */ int ifindex; /* 256 4*/ int iflink; /* 260 4*/ struct net_device_stats stats; /* 264 184*/ /* --- cacheline 7 boundary (448 bytes) --- */ atomic_long_t rx_dropped; /* 448 8*/ atomic_long_t tx_dropped; /* 456 8*/ atomic_t carrier_changes; /* 464 4*/ /* XXX 4 bytes hole, try to pack */ const struct iw_handler_def * wireless_handlers; /* 472 8*/ struct iw_public_data * wireless_data; /* 480 8*/ const struct net_device_ops * netdev_ops; /* 488 8*/ const struct ethtool_ops * ethtool_ops; /* 496 8*/ const struct forwarding_accel_ops * fwd_ops; /* 504 8*/ /* --- cacheline 8 boundary (512 bytes) --- */ const struct header_ops * header_ops; /* 512 8*/ unsigned int flags; /* 520 4*/ unsigned int priv_flags; /* 524 4*/ short unsigned int gflags; /* 528 2*/ short unsigned int padded; /* 530 2*/ unsigned char operstate; /* 532 1*/ unsigned char link_mode; /* 533 1*/ unsigned char if_port; /* 534 1*/ unsigned char dma; /* 535 1*/ unsigned int mtu; /* 536 4*/ short unsigned int type; /* 540 2*/ short unsigned int hard_header_len; /* 542 2*/ short unsigned int needed_headroom; /* 544 2*/ short unsigned int needed_tailroom; /* 546 2*/ unsigned char perm_addr[32]; /* 548 32*/ /* --- cacheline 9 boundary (576 bytes) was 4 bytes ago --- */ unsigned char addr_assign_type; /* 580 1*/ unsigned char addr_len; /* 581 1*/ short unsigned int neigh_priv_len; /* 582 2*/ short unsigned int dev_id; /* 584 2*/ short unsigned int dev_port; /* 586 2*/ spinlock_t addr_list_lock; /* 588 4*/ struct netdev_hw_addr_list uc; /* 592 24*/ struct netdev_hw_addr_list mc; /* 616 24*/ /* --- cacheline 10 boundary (640 bytes) --- */ struct netdev_hw_addr_list dev_addrs; /* 640 24*/ struct kset * queues_kset; /* 664 8*/ unsigned char name_assign_type; /* 672 1*/ bool uc_promisc; /* 673 1*/ /* XXX 2 bytes hole, try to pack */ unsigned int promiscuity; /* 676 4*/ unsigned int allmulti; /* 680 4*/ /* XXX 4 bytes hole, try to pack */ struct vlan_info * vlan_info; /* 688 8*/ struct dsa_switch_tree * dsa_ptr; /* 696 8*/ /* --- cacheline 11 boundary (704 bytes) --- */ struct tipc_bearer * tipc_ptr; /* 704 8*/ void * atalk_ptr; /* 712 8*/ struct in_device * ip_ptr; /* 720 8*/ struct dn_dev * dn_ptr; /* 728 8*/ struct inet6_dev * ip6_ptr; /* 736 8*/ void * ax25_ptr; /* 744 8*/ struct wireless_dev * ieee80211_ptr; /* 752 8*/ struct wpan_dev * ieee802154_ptr; /* 760 8*/ /* --- cacheline 12 boundary (768 bytes) --- */ long unsigned int last_rx; /* 768 8*/ unsigned char * dev_addr; /* 776 8*/ struct netdev_rx_queue * _rx; /* 784 8*/ unsigned int num_rx_queues; /* 792 4*/ unsigned int real_num_rx_queues; /* 796 4*/ long unsigned int gro_flush_timeout; /* 800 8*/ rx_handler_func_t * rx_handler; /* 808 8*/ void * rx_handler_data; /* 816 8*/ struct netdev_queue * ingress_queue; /* 824 8*/ /* --- cacheline 13 boundary (832 bytes) --- */ unsigned char broadcast[32]; /* 832 32*/ /* XXX 32 bytes hole, try to pack */ /* --- cacheline 14 boundary (896 bytes) --- */ struct netdev_queue * _tx; /* 896 8*/ unsigned int num_tx_queues; /* 904 4*/ unsigned int real_num_tx_queues; /* 908 4*/ struct Qdisc * qdisc; /* 912 8*/ long unsigned int tx_queue_len; /* 920 8*/ spinlock_t tx_global_lock; /* 928 4*/ /* XXX 4 bytes hole, try to pack */ struct xps_dev_maps * xps_maps; /* 936 8*/ struct cpu_rmap * rx_cpu_rmap; /* 944 8*/ long unsigned int trans_start; /* 952 8*/ /* --- cacheline 15 boundary (960 bytes) --- */ int watchdog_timeo; /* 960 4*/ /* XXX 4 bytes hole, try to pack */ struct timer_list watchdog_timer; /* 968 80*/ /* --- cacheline 16 boundary (1024 bytes) was 24 bytes ago ---* */ int * pcpu_refcnt; /* 1048 8*/ struct list_head todo_list; /* 1056 16*/ struct hlist_node index_hlist; /* 1072 16*/ /* --- cacheline 17 boundary (1088 bytes) --- */ struct list_head link_watch_list; /* 1088 16*/ enum { NETREG_UNINITIALIZED = 0, NETREG_REGISTERED = 1, NETREG_UNREGISTERING = 2, NETREG_UNREGISTERED = 3, NETREG_RELEASED = 4, NETREG_DUMMY = 5, } reg_state:8; /* 1104 4 */ /* Bitfield combined with next fields */ bool dismantle; /* 1105 1*/ /* Bitfield combined with previous fields */ enum { RTNL_LINK_INITIALIZED = 0, RTNL_LINK_INITIALIZING = 1, } rtnl_link_state:16; /* 1104 4 */ /* XXX 4 bytes hole, try to pack */ void (*destructor)(struct net_device *);/* 1112 8 */ struct netpoll_info * npinfo; /* 1120 8*/ struct net * nd_net; /* 1128 8*/ union { void * ml_priv; /* 8*/ struct pcpu_lstats * lstats; /* 8*/ struct pcpu_sw_netstats * tstats; /* 8*/ struct pcpu_dstats * dstats; /* 8*/ struct pcpu_vstats * vstats; /* 8*/ }; /* 1136 8*/ struct garp_port * garp_port; /* 1144 8*/ /* --- cacheline 18 boundary (1152 bytes) was 4 bytes ago --- */ struct mrp_port * mrp_port; /* 1152 8*/ struct device dev; /* 1160 696*/ /* XXX last struct has 7 bytes of padding */ /* --- cacheline 29 boundary (1856 bytes) was 4 bytes ago --- */ const struct attribute_group * sysfs_groups[4]; /* 1856 32*/ const struct attribute_group * sysfs_rx_queue_group; /* 18888 */ const struct rtnl_link_ops * rtnl_link_ops; /* 1896 8*/ unsigned int gso_max_size; /* 1904 4*/ u16 gso_max_segs; /* 1908 2*/ u16 gso_min_segs; /* 1910 2*/ const struct dcbnl_rtnl_ops * dcbnl_ops; /* 1912 8*/ /* --- cacheline 30 boundary (1920 bytes) was 4 bytes ago --- */ u8 num_tc; /* 1920 1*/ /* XXX 1 byte hole, try to pack */ struct netdev_tc_txq tc_to_txq[16]; /* 1922 64*/ /* --- cacheline 31 boundary (1984 bytes) was 6 bytes ago --- */ u8 prio_tc_map[16]; /* 1986 16*/ /* XXX 2 bytes hole, try to pack */ unsigned int fcoe_ddp_xid; /* 2004 4*/ struct phy_device * phydev; /* 2008 8*/ struct lock_class_key * qdisc_tx_busylock; /* 2016 8*/ int group; /* 2024 4*/ /* XXX 4 bytes hole, try to pack */ struct pm_qos_request pm_qos_req; /* 2032 176*/ /* --- cacheline 34 boundary (2176 bytes) was 36 bytes ago --- * */ /* size: 2240, cachelines: 35, members: 120 */ /* sum members: 2147, holes: 11, sum holes: 65 */ /* padding: 32 */ /* paddings: 1, sum paddings: 7 */ /* BRAIN FART ALERT! 2240 != 2147 + 65(holes), diff = 28 */ }; Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 5615c80f614c..2fbb96485dac 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2567,7 +2567,7 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac) down(&priv->wx_sem); - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + ether_addr_copy(dev->dev_addr, addr->sa_data); schedule_work(&priv->reset_wq); up(&priv->wx_sem); -- cgit v1.2.3 From d0049dfc88d18657da302023782473b615f3fcf4 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Fri, 20 Feb 2015 18:14:30 +0100 Subject: Staging: rtl8192: Simplifying if-else statement This patch simplifies the code by not having two identical paths and fixes the warning given by checkpatch.pl: "else is not useful after a break or return". Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_phy.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 3b2c954ff292..c8dc648a59ee 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -352,16 +352,14 @@ u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, return 0; if (priv->Rf_Mode == RF_OP_By_FW) { reg = phy_FwRFSerialRead(dev, eRFPath, reg_addr); - bitshift = rtl8192_CalculateBitShift(bitmask); - reg = (reg & bitmask) >> bitshift; udelay(200); - return reg; } else { reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr); - bitshift = rtl8192_CalculateBitShift(bitmask); - reg = (reg & bitmask) >> bitshift; - return reg; } + bitshift = rtl8192_CalculateBitShift(bitmask); + reg = (reg & bitmask) >> bitshift; + return reg; + } /****************************************************************************** -- cgit v1.2.3 From eeca3458e6412a3797e2ca1247e2beda046591f2 Mon Sep 17 00:00:00 2001 From: Gulsah Kose Date: Sun, 22 Feb 2015 03:52:00 +0200 Subject: staging: ft1000: ft1000-pcmcia: Removed all useless "else" Removed all else keywords that used after break or return. Removed following checkpatch.pl warnings: WARNING: else is not generally useful after a break or return Signed-off-by: Gulsah Kose Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 285 +++++++++++------------ 1 file changed, 141 insertions(+), 144 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 017c3b92f51b..8c5a801fce74 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -459,9 +459,8 @@ static int ft1000_reset_card(struct net_device *dev) if (card_download(dev, fw_entry->data, fw_entry->size)) { pr_debug("card download unsuccessful\n"); return false; - } else { - pr_debug("card download successful\n"); } + pr_debug("card download successful\n"); mdelay(10); @@ -860,64 +859,63 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, if (size > maxsz) { pr_debug("Invalid command length = %d\n", size); return false; + } + ppseudohdr = (u16 *)pbuffer; + spin_lock_irqsave(&info->dpram_lock, flags); + if (info->AsicID == ELECTRABUZZ_ID) { + ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, + FT1000_DPRAM_RX_BASE + 2); + for (i = 0; i <= (size >> 1); i++) { + tempword = + ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA); + *pbuffer++ = ntohs(tempword); + } } else { - ppseudohdr = (u16 *)pbuffer; - spin_lock_irqsave(&info->dpram_lock, flags); - if (info->AsicID == ELECTRABUZZ_ID) { - ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, - FT1000_DPRAM_RX_BASE + 2); - for (i = 0; i <= (size >> 1); i++) { - tempword = - ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA); - *pbuffer++ = ntohs(tempword); - } - } else { - ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, - FT1000_DPRAM_MAG_RX_BASE); - *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAH); - pr_debug("received data = 0x%x\n", *pbuffer); - pbuffer++; - ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, - FT1000_DPRAM_MAG_RX_BASE + 1); - for (i = 0; i <= (size >> 2); i++) { - *pbuffer = - inw(dev->base_addr + - FT1000_REG_MAG_DPDATAL); - pbuffer++; - *pbuffer = - inw(dev->base_addr + - FT1000_REG_MAG_DPDATAH); - pbuffer++; - } - /* copy odd aligned word */ - *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAL); - pr_debug("received data = 0x%x\n", *pbuffer); + ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, + FT1000_DPRAM_MAG_RX_BASE); + *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAH); + pr_debug("received data = 0x%x\n", *pbuffer); + pbuffer++; + ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, + FT1000_DPRAM_MAG_RX_BASE + 1); + for (i = 0; i <= (size >> 2); i++) { + *pbuffer = + inw(dev->base_addr + + FT1000_REG_MAG_DPDATAL); pbuffer++; - *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAH); - pr_debug("received data = 0x%x\n", *pbuffer); + *pbuffer = + inw(dev->base_addr + + FT1000_REG_MAG_DPDATAH); pbuffer++; } - if (size & 0x0001) { - /* copy odd byte from fifo */ - tempword = ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA); - *pbuffer = ntohs(tempword); - } - spin_unlock_irqrestore(&info->dpram_lock, flags); + /* copy odd aligned word */ + *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAL); + pr_debug("received data = 0x%x\n", *pbuffer); + pbuffer++; + *pbuffer = inw(dev->base_addr + FT1000_REG_MAG_DPDATAH); + pr_debug("received data = 0x%x\n", *pbuffer); + pbuffer++; + } + if (size & 0x0001) { + /* copy odd byte from fifo */ + tempword = ft1000_read_reg(dev, FT1000_REG_DPRAM_DATA); + *pbuffer = ntohs(tempword); + } + spin_unlock_irqrestore(&info->dpram_lock, flags); - /* - * Check if pseudo header checksum is good - * Calculate pseudo header checksum - */ - tempword = *ppseudohdr++; - for (i = 1; i < 7; i++) - tempword ^= *ppseudohdr++; - if ((tempword != *ppseudohdr)) { - pr_debug("Pseudo header checksum mismatch\n"); - /* Drop this message */ - return false; - } - return true; + /* + * Check if pseudo header checksum is good + * Calculate pseudo header checksum + */ + tempword = *ppseudohdr++; + for (i = 1; i < 7; i++) + tempword ^= *ppseudohdr++; + if ((tempword != *ppseudohdr)) { + pr_debug("Pseudo header checksum mismatch\n"); + /* Drop this message */ + return false; } + return true; } /*--------------------------------------------------------------------------- @@ -1400,105 +1398,104 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) info->DrvErrNum = DrvErrNum; ft1000_reset_card(dev); return; - } else { - /* Flush corrupted pkt from FIFO */ - i = 0; - do { + } + /* Flush corrupted pkt from FIFO */ + i = 0; + do { + if (info->AsicID == ELECTRABUZZ_ID) { + tempword = + ft1000_read_reg(dev, FT1000_REG_DFIFO); + tempword = + ft1000_read_reg(dev, FT1000_REG_DFIFO_STAT); + } else { + templong = + inl(dev->base_addr + FT1000_REG_MAG_DFR); + tempword = + inw(dev->base_addr + FT1000_REG_MAG_DFSR); + } + i++; + /* + * This should never happen unless the ASIC is broken. + * We must reset to recover. + */ + if ((i > 2048) || (tempword == 0)) { if (info->AsicID == ELECTRABUZZ_ID) { - tempword = - ft1000_read_reg(dev, FT1000_REG_DFIFO); - tempword = - ft1000_read_reg(dev, FT1000_REG_DFIFO_STAT); + info->DSP_TIME[0] = + ft1000_read_dpram(dev, + FT1000_DSP_TIMER0); + info->DSP_TIME[1] = + ft1000_read_dpram(dev, + FT1000_DSP_TIMER1); + info->DSP_TIME[2] = + ft1000_read_dpram(dev, + FT1000_DSP_TIMER2); + info->DSP_TIME[3] = + ft1000_read_dpram(dev, + FT1000_DSP_TIMER3); } else { - templong = - inl(dev->base_addr + FT1000_REG_MAG_DFR); - tempword = - inw(dev->base_addr + FT1000_REG_MAG_DFSR); + info->DSP_TIME[0] = + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER0, + FT1000_MAG_DSP_TIMER0_INDX); + info->DSP_TIME[1] = + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER1, + FT1000_MAG_DSP_TIMER1_INDX); + info->DSP_TIME[2] = + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER2, + FT1000_MAG_DSP_TIMER2_INDX); + info->DSP_TIME[3] = + ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DSP_TIMER3, + FT1000_MAG_DSP_TIMER3_INDX); } - i++; - /* - * This should never happen unless the ASIC is broken. - * We must reset to recover. - */ - if ((i > 2048) || (tempword == 0)) { - if (info->AsicID == ELECTRABUZZ_ID) { - info->DSP_TIME[0] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER0); - info->DSP_TIME[1] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER1); - info->DSP_TIME[2] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER2); - info->DSP_TIME[3] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER3); - } else { - info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); - info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); - info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); - info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); - } + if (tempword == 0) { + /* + * Let's check if ASIC reads are still ok by reading the Mask register + * which is never zero at this point of the code. + */ + tempword = + inw(dev->base_addr + + FT1000_REG_SUP_IMASK); if (tempword == 0) { - /* - * Let's check if ASIC reads are still ok by reading the Mask register - * which is never zero at this point of the code. - */ - tempword = - inw(dev->base_addr + - FT1000_REG_SUP_IMASK); - if (tempword == 0) { - /* This indicates that we can not communicate with the ASIC */ - info->DrvErrNum = - FIFO_FLUSH_BADCNT; - } else { - /* Let's assume that we really flush the FIFO */ - pcmcia->PktIntfErr++; - return; - } + /* This indicates that we can not communicate with the ASIC */ + info->DrvErrNum = + FIFO_FLUSH_BADCNT; } else { - info->DrvErrNum = FIFO_FLUSH_MAXLIMIT; + /* Let's assume that we really flush the FIFO */ + pcmcia->PktIntfErr++; + return; } - return; + } else { + info->DrvErrNum = FIFO_FLUSH_MAXLIMIT; } - tempword = inw(dev->base_addr + FT1000_REG_SUP_STAT); - } while ((tempword & 0x03) != 0x03); - if (info->AsicID == ELECTRABUZZ_ID) { - i++; - pr_debug("Flushing FIFO complete = %x\n", tempword); - /* Flush last word in FIFO. */ - tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); - /* Update FIFO counter for DSP */ - i = i * 2; - pr_debug("Flush Data byte count to dsp = %d\n", i); - info->fifo_cnt += i; - ft1000_write_dpram(dev, FT1000_FIFO_LEN, - info->fifo_cnt); - } else { - pr_debug("Flushing FIFO complete = %x\n", tempword); - /* Flush last word in FIFO */ - templong = inl(dev->base_addr + FT1000_REG_MAG_DFR); - tempword = inw(dev->base_addr + FT1000_REG_SUP_STAT); - pr_debug("FT1000_REG_SUP_STAT = 0x%x\n", tempword); - tempword = inw(dev->base_addr + FT1000_REG_MAG_DFSR); - pr_debug("FT1000_REG_MAG_DFSR = 0x%x\n", tempword); + return; } - if (DrvErrNum) - pcmcia->PktIntfErr++; + tempword = inw(dev->base_addr + FT1000_REG_SUP_STAT); + } while ((tempword & 0x03) != 0x03); + if (info->AsicID == ELECTRABUZZ_ID) { + i++; + pr_debug("Flushing FIFO complete = %x\n", tempword); + /* Flush last word in FIFO. */ + tempword = ft1000_read_reg(dev, FT1000_REG_DFIFO); + /* Update FIFO counter for DSP */ + i = i * 2; + pr_debug("Flush Data byte count to dsp = %d\n", i); + info->fifo_cnt += i; + ft1000_write_dpram(dev, FT1000_FIFO_LEN, + info->fifo_cnt); + } else { + pr_debug("Flushing FIFO complete = %x\n", tempword); + /* Flush last word in FIFO */ + templong = inl(dev->base_addr + FT1000_REG_MAG_DFR); + tempword = inw(dev->base_addr + FT1000_REG_SUP_STAT); + pr_debug("FT1000_REG_SUP_STAT = 0x%x\n", tempword); + tempword = inw(dev->base_addr + FT1000_REG_MAG_DFSR); + pr_debug("FT1000_REG_MAG_DFSR = 0x%x\n", tempword); } + if (DrvErrNum) + pcmcia->PktIntfErr++; } /*--------------------------------------------------------------------------- -- cgit v1.2.3 From 057b28f5bc8d90584ac8bd1f42a2de2e4a4b5bf3 Mon Sep 17 00:00:00 2001 From: Gulsah Kose Date: Sun, 22 Feb 2015 03:52:01 +0200 Subject: staging: ft1000: ft1000-pcmcia: Deleted unnecessary braces. Brackets were removed from the expression that containing single line in the phrase "if else". Removed following checkpatch.pl warnings: WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Gulsah Kose Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 8c5a801fce74..b95622304f09 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -1945,11 +1945,10 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) ft1000_read_reg(dev, FT1000_REG_MAG_DFSR); } - if (tempword & 0x1f) { + if (tempword & 0x1f) ft1000_copy_up_pkt(dev); - } else { + else break; - } cnt++; } while (cnt < MAX_RCV_LOOP); -- cgit v1.2.3 From 3a49f752de17ebf060d66742a4a287670dfe75d9 Mon Sep 17 00:00:00 2001 From: Gulsah Kose Date: Sun, 22 Feb 2015 03:52:02 +0200 Subject: staging: ft1000: ft1000-pcmcia: Removed unnecessary parentheses. This patch removes unnecessary parentheses from control expression. Removed following checkpatch.pl warning: WARNING: Unnecessary parentheses Signed-off-by: Gulsah Kose Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index b95622304f09..2da776d6811e 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -910,7 +910,7 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, tempword = *ppseudohdr++; for (i = 1; i < 7; i++) tempword ^= *ppseudohdr++; - if ((tempword != *ppseudohdr)) { + if (tempword != *ppseudohdr) { pr_debug("Pseudo header checksum mismatch\n"); /* Drop this message */ return false; -- cgit v1.2.3 From a5d5030dc3c00c28404abb9babea9720930304d1 Mon Sep 17 00:00:00 2001 From: Gulsah Kose Date: Sun, 22 Feb 2015 03:52:03 +0200 Subject: staging: ft1000: ft1000-pcmcia: Added missing blank line. Added missing blank line after declaration. Removed following checkpatch.pl warning: WARNING: Missing a blank line after declarations Signed-off-by: Gulsah Kose Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 2da776d6811e..bc959ff9a942 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -2004,6 +2004,7 @@ static void ft1000_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { struct ft1000_info *ft_info; + ft_info = netdev_priv(dev); strlcpy(info->driver, "ft1000", sizeof(info->driver)); -- cgit v1.2.3 From a786b7789345a7c918c947d2a0e218ac8e918ae6 Mon Sep 17 00:00:00 2001 From: Yeliz Taneroglu Date: Thu, 26 Feb 2015 22:05:02 +0200 Subject: Staging: ft1000: Removed unnecessary braces The following patch fixes the checkpatch.pl warning: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Yeliz Taneroglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index c8d278229940..da34257f0e2b 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -317,9 +317,8 @@ static int ft1000_open(struct inode *inode, struct file *file) /* Search for available application info block */ for (i = 0; i < MAX_NUM_APP; i++) { - if ((dev->app_info[i].fileobject == NULL)) { + if ((dev->app_info[i].fileobject == NULL)) break; - } } /* Fail due to lack of application info block */ @@ -575,9 +574,8 @@ static long ft1000_ioctl(struct file *file, unsigned int command, } else { /* Check if this message came from a registered application */ for (i = 0; i < MAX_NUM_APP; i++) { - if (ft1000dev->app_info[i].fileobject == &file->f_owner) { + if (ft1000dev->app_info[i].fileobject == &file->f_owner) break; - } } if (i == MAX_NUM_APP) { pr_debug("No matching application fileobject\n"); @@ -629,9 +627,8 @@ static long ft1000_ioctl(struct file *file, unsigned int command, pmsg = (u16 *)&dpram_data->pseudohdr; ppseudo_hdr = (struct pseudo_hdr *)pmsg; total_len = msgsz+2; - if (total_len & 0x1) { + if (total_len & 0x1) total_len++; - } /* Insert slow queue sequence number */ ppseudo_hdr->seq_num = info->squeseqnum++; -- cgit v1.2.3 From 1cd0989e08a9764d311417fae825c302ffa45cb6 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Mon, 23 Feb 2015 18:47:07 +0100 Subject: Staging: slicoss: Join split string. This patch fixes warning issue by checkpatch.pl by joining the split string. And also creates new warning that line exceeds 80 characters. In this case this is more beneficial because of possibility to grep the string. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/slicoss/slicoss.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 1248f629e2d4..5bf5300e2d8b 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -99,8 +99,7 @@ #include "slic.h" static uint slic_first_init = 1; -static char *slic_banner = "Alacritech SLIC Technology(tm) Server " - "and Storage Accelerator (Non-Accelerated)"; +static char *slic_banner = "Alacritech SLIC Technology(tm) Server and Storage Accelerator (Non-Accelerated)"; static char *slic_proc_version = "2.0.351 2006/07/14 12:26:00"; -- cgit v1.2.3 From 462833726c5461ba357ad75cf44625804b0671ba Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:27:44 +0200 Subject: staging: xgifb: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/xgifb/vb_setmode.c | 140 ++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 70 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 1f6f699e238c..a47395e92d20 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -308,11 +308,11 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, data |= data1; xgifb_reg_set(pVBInfo->P3d4, 0x05, data); data = xgifb_reg_get(pVBInfo->P3c4, 0x0e); - data = data >> 5; + data >>= 5; data = data + 3; if (data > 7) data = data - 7; - data = data << 5; + data <<= 5; xgifb_reg_and_or(pVBInfo->P3c4, 0x0e, ~0xE0, data); } } @@ -347,7 +347,7 @@ static void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, data = pVBInfo->TimingV.data[6]; data &= 0x80; - data = data >> 2; + data >>= 2; i = XGI330_EModeIDTable[ModeIdIndex].Ext_ModeFlag; i &= DoubleScanMode; @@ -693,18 +693,18 @@ static void XGI_SetCRT1DE(unsigned short ModeIdIndex, tempbx = XGI330_ModeResInfo[resindex].VTotal; if (modeflag & HalfDCLK) - tempax = tempax >> 1; + tempax >>= 1; if (modeflag & HalfDCLK) - tempax = tempax << 1; + tempax <<= 1; temp = XGI330_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; if (temp & InterlaceMode) - tempbx = tempbx >> 1; + tempbx >>= 1; if (modeflag & DoubleScanMode) - tempbx = tempbx << 1; + tempbx <<= 1; tempcx = 8; @@ -721,7 +721,7 @@ static void XGI_SetCRT1DE(unsigned short ModeIdIndex, (unsigned short) ((tempcx & 0x0ff00) >> 10)); xgifb_reg_set(pVBInfo->P3d4, 0x12, (unsigned short) (tempbx & 0xff)); tempax = 0; - tempbx = tempbx >> 8; + tempbx >>= 8; if (tempbx & 0x01) tempax |= 0x02; @@ -750,14 +750,14 @@ static void XGI_SetCRT1Offset(unsigned short ModeNo, /* GetOffset */ temp = XGI330_EModeIDTable[ModeIdIndex].Ext_ModeInfo; - temp = temp >> 8; + temp >>= 8; temp = XGI330_ScreenOffset[temp]; temp2 = XGI330_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; temp2 &= InterlaceMode; if (temp2) - temp = temp << 1; + temp <<= 1; temp2 = pVBInfo->ModeType - ModeEGA; @@ -792,7 +792,7 @@ static void XGI_SetCRT1Offset(unsigned short ModeNo, /* SetOffset */ DisplayUnit = temp; temp2 = temp; - temp = temp >> 8; /* ah */ + temp >>= 8; /* ah */ temp &= 0x0F; i = xgifb_reg_get(pVBInfo->P3c4, 0x0E); i &= 0xF0; @@ -809,7 +809,7 @@ static void XGI_SetCRT1Offset(unsigned short ModeNo, if (temp2) DisplayUnit >>= 1; - DisplayUnit = DisplayUnit << 5; + DisplayUnit <<= 5; ah = (DisplayUnit & 0xff00) >> 8; al = DisplayUnit & 0x00ff; if (al == 0) @@ -912,7 +912,7 @@ static void XGI_SetCRT1VCLK(unsigned short ModeIdIndex, index = data; index &= 0xE0; data &= 0x1F; - data = data << 1; + data <<= 1; data += 1; data |= index; xgifb_reg_set(pVBInfo->P3c4, 0x2C, data); @@ -1011,7 +1011,7 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, data2 = 0; data2 |= 0x02; data3 = pVBInfo->ModeType - ModeVGA; - data3 = data3 << 2; + data3 <<= 2; data2 |= data3; data &= InterlaceMode; @@ -1126,7 +1126,7 @@ static void XGI_LoadDAC(struct vb_device_info *pVBInfo) data2 += 0x15; outb(data2, pVBInfo->P3c9); - data = data >> 2; + data >>= 2; } } @@ -1185,10 +1185,10 @@ static void XGI_GetLVDSResInfo(unsigned short ModeIdIndex, yres = XGI330_ModeResInfo[resindex].VTotal; if (modeflag & HalfDCLK) - xres = xres << 1; + xres <<= 1; if (modeflag & DoubleScanMode) - yres = yres << 1; + yres <<= 1; if (xres == 720) xres = 640; @@ -1450,8 +1450,8 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part1Port, 0x1A, tempbx & 0x07); - tempcx = tempcx >> 3; - tempbx = tempbx >> 3; + tempcx >>= 3; + tempbx >>= 3; xgifb_reg_set(pVBInfo->Part1Port, 0x16, (unsigned short) (tempbx & 0xff)); @@ -1473,9 +1473,9 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, tempcx -= tempax; tempax = tempbx & 0x07; - tempax = tempax >> 5; - tempcx = tempcx >> 3; - tempbx = tempbx >> 3; + tempax >>= 5; + tempcx >>= 3; + tempbx >>= 3; tempcx &= 0x1f; tempax |= tempcx; @@ -1600,7 +1600,7 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, temp1 = pVBInfo->VGAHDE << 16; temp1 /= temp3; - temp3 = temp3 << 16; + temp3 <<= 16; temp1 -= 1; temp3 = (temp3 & 0xffff0000) + (temp1 & 0xffff); @@ -1622,10 +1622,10 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part1Port, 0x21, (unsigned short) (tempbx & 0xff)); - temp3 = temp3 >> 16; + temp3 >>= 16; if (modeflag & HalfDCLK) - temp3 = temp3 >> 1; + temp3 >>= 1; xgifb_reg_set(pVBInfo->Part1Port, 0x22, (unsigned short) ((temp3 >> 8) & 0xff)); @@ -1909,7 +1909,7 @@ static void XGI_GetVBInfo(unsigned short ModeIdIndex, tempbx = tempbx | temp; temp = xgifb_reg_get(pVBInfo->P3d4, 0x31); push = temp; - push = push << 8; + push <<= 8; tempax = temp << 8; tempbx = tempbx | tempax; temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr525750 | XGI_SetCRT2ToLCDA @@ -2107,7 +2107,7 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeIdIndex, if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) tempax &= 0x0F; else - tempax = tempax >> 4; + tempax >>= 4; if ((resinfo == 6) || (resinfo == 9)) { if (tempax >= 3) @@ -2182,7 +2182,7 @@ static unsigned char XG21GPIODataTransfer(unsigned char ujDate) unsigned char i = 0; for (i = 0; i < 8; i++) { - ujRet = ujRet << 1; + ujRet <<= 1; ujRet |= (ujDate >> i) & 1; } @@ -2494,7 +2494,7 @@ static void XGI_GetRAMDAC2DATA(unsigned short ModeIdIndex, tempcx = (unsigned short) XGI_CRT1Table[CRT1Index].CR[14] << 8; tempcx &= 0x0100; - tempcx = tempcx << 2; + tempcx <<= 2; tempbx |= tempcx; temp1 = (unsigned short) XGI_CRT1Table[CRT1Index].CR[9]; @@ -2745,7 +2745,7 @@ static unsigned short XGI_GetOffset(unsigned short ModeNo, temp = XGI330_ScreenOffset[index]; if (infoflag & InterlaceMode) - temp = temp << 1; + temp <<= 1; colordepth = XGI_GetColorDepth(ModeIdIndex); @@ -2754,7 +2754,7 @@ static unsigned short XGI_GetOffset(unsigned short ModeNo, colordepth = ColorDepth[temp]; temp = 0x6B; if (infoflag & InterlaceMode) - temp = temp << 1; + temp <<= 1; } return temp * colordepth; } @@ -2826,7 +2826,7 @@ static void XGI_SetGroup1(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part1Port, 0x0A, temp); tempcx = ((pVBInfo->VGAHT - pVBInfo->VGAHDE) / 2) >> 2; pushbx = pVBInfo->VGAHDE / 2 + 16; - tempcx = tempcx >> 1; + tempcx >>= 1; tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */ tempcx += tempbx; @@ -2861,7 +2861,7 @@ static void XGI_SetGroup1(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part1Port, 0x0A, temp); tempcx = (pVBInfo->VGAHT - pVBInfo->VGAHDE) >> 2; /* cx */ pushbx = pVBInfo->VGAHDE + 16; - tempcx = tempcx >> 1; + tempcx >>= 1; tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */ tempcx += tempbx; @@ -2980,7 +2980,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, tempax = pVBInfo->VGAHDE; /* 0x04 Horizontal Display End */ if (modeflag & HalfDCLK) - tempax = tempax >> 1; + tempax >>= 1; tempax = (tempax / tempcx) - 1; tempbx |= ((tempax & 0x00FF) << 8); @@ -3015,7 +3015,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, tempax = pVBInfo->VGAHT; if (modeflag & HalfDCLK) - tempax = tempax >> 1; + tempax >>= 1; tempax = (tempax / tempcx) - 5; tempcx = tempax; /* 20030401 0x07 horizontal Retrace Start */ @@ -3142,11 +3142,11 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, tempax = push1; tempax -= tempbx; /* 0x0C Vertical Retrace Start */ - tempax = tempax >> 2; + tempax >>= 2; push1 = tempax; /* push ax */ if (resinfo != 0x09) { - tempax = tempax << 1; + tempax <<= 1; tempbx += tempax; } @@ -3179,7 +3179,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, } } tempax = push1; - tempax = tempax >> 2; + tempax >>= 2; tempax++; tempax += tempbx; push1 = tempax; /* push ax */ @@ -3332,7 +3332,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, if (pVBInfo->VDE <= tempax) { tempax -= pVBInfo->VDE; - tempax = tempax >> 2; + tempax >>= 2; tempax = (tempax & 0x00FF) | ((tempax & 0x00FF) << 8); push1 = tempax; temp = (tempax & 0xFF00) >> 8; @@ -3377,7 +3377,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, tempcx = pVBInfo->HT; if (XGI_IsLCDDualLink(pVBInfo)) - tempcx = tempcx >> 1; + tempcx >>= 1; tempcx -= 2; temp = tempcx & 0x00FF; @@ -3394,7 +3394,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, tempcx -= 4; temp = tempcx & 0x00FF; - temp = temp << 4; + temp <<= 4; xgifb_reg_and_or(pVBInfo->Part2Port, 0x22, 0x0F, temp); tempbx = TimingPoint[j] | ((TimingPoint[j + 1]) << 8); @@ -3403,7 +3403,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, temp = tempbx & 0x00FF; xgifb_reg_set(pVBInfo->Part2Port, 0x24, temp); temp = (tempbx & 0xFF00) >> 8; - temp = temp << 4; + temp <<= 4; xgifb_reg_and_or(pVBInfo->Part2Port, 0x25, 0x0F, temp); tempbx = push2; @@ -3428,7 +3428,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, tempcx -= 4; temp = tempcx & 0xFF; - temp = temp << 4; + temp <<= 4; xgifb_reg_and_or(pVBInfo->Part2Port, 0x2A, 0x0F, temp); tempcx = push1; /* pop cx */ @@ -3436,7 +3436,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, temp = TimingPoint[j] | ((TimingPoint[j + 1]) << 8); tempcx -= temp; temp = tempcx & 0x00FF; - temp = temp << 4; + temp <<= 4; xgifb_reg_and_or(pVBInfo->Part2Port, 0x2D, 0x0F, temp); tempcx -= 11; @@ -3462,9 +3462,9 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, (VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) { if (!(pVBInfo->TVInfo & (TVSetYPbPr525p | TVSetYPbPr750p))) - tempbx = tempbx >> 1; + tempbx >>= 1; } else - tempbx = tempbx >> 1; + tempbx >>= 1; } tempbx -= 2; @@ -3514,7 +3514,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, if (pVBInfo->VBInfo & SetCRT2ToTV) { if (!(pVBInfo->TVInfo & (TVSetYPbPr525p | TVSetYPbPr750p))) - tempbx = tempbx >> 1; + tempbx >>= 1; } if (pVBInfo->VBType & (VB_SIS302LV | VB_XGI301C)) { @@ -3627,7 +3627,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part2Port, 0x4c, temp); temp = ((tempcx & 0xFF00) >> 8) & 0x03; - temp = temp << 2; + temp <<= 2; temp |= ((tempbx & 0xFF00) >> 8) & 0x03; if (pVBInfo->VBInfo & SetCRT2ToYPbPr525750) { @@ -3691,13 +3691,13 @@ static void XGI_SetLCDRegs(unsigned short ModeIdIndex, tempbx = pVBInfo->HDE; /* RHACTE=HDE-1 */ if (XGI_IsLCDDualLink(pVBInfo)) - tempbx = tempbx >> 1; + tempbx >>= 1; tempbx -= 1; temp = tempbx & 0x00FF; xgifb_reg_set(pVBInfo->Part2Port, 0x2C, temp); temp = (tempbx & 0xFF00) >> 8; - temp = temp << 4; + temp <<= 4; xgifb_reg_and_or(pVBInfo->Part2Port, 0x2B, 0x0F, temp); temp = 0x01; @@ -3713,7 +3713,7 @@ static void XGI_SetLCDRegs(unsigned short ModeIdIndex, temp = tempcx & 0x00FF; /* RVTVT=VT-1 */ xgifb_reg_set(pVBInfo->Part2Port, 0x19, temp); temp = (tempcx & 0xFF00) >> 8; - temp = temp << 5; + temp <<= 5; xgifb_reg_set(pVBInfo->Part2Port, 0x1A, temp); xgifb_reg_and_or(pVBInfo->Part2Port, 0x09, 0xF0, 0x00); xgifb_reg_and_or(pVBInfo->Part2Port, 0x0A, 0xF0, 0x00); @@ -3770,7 +3770,7 @@ static void XGI_SetLCDRegs(unsigned short ModeIdIndex, tempch = ((tempcx & 0xFF00) >> 8) & 0x07; tempbh = ((tempbx & 0xFF00) >> 8) & 0x07; tempah = tempch; - tempah = tempah << 3; + tempah <<= 3; tempah |= tempbh; xgifb_reg_set(pVBInfo->Part2Port, 0x02, tempah); @@ -3787,7 +3787,7 @@ static void XGI_SetLCDRegs(unsigned short ModeIdIndex, temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */ xgifb_reg_set(pVBInfo->Part2Port, 0x04, temp); temp = (tempbx & 0xFF00) >> 8; - temp = temp << 4; + temp <<= 4; temp |= (tempcx & 0x000F); xgifb_reg_set(pVBInfo->Part2Port, 0x01, temp); tempcx = pushbx; @@ -3796,9 +3796,9 @@ static void XGI_SetLCDRegs(unsigned short ModeIdIndex, tempbx &= 0x0FFF; if (XGI_IsLCDDualLink(pVBInfo)) { - tempax = tempax >> 1; - tempbx = tempbx >> 1; - tempcx = tempcx >> 1; + tempax >>= 1; + tempbx >>= 1; + tempcx >>= 1; } if (pVBInfo->VBType & VB_SIS302LV) @@ -3826,9 +3826,9 @@ static void XGI_SetLCDRegs(unsigned short ModeIdIndex, tempax = pVBInfo->HT; tempbx = pVBInfo->LCDHRS; if (XGI_IsLCDDualLink(pVBInfo)) { - tempax = tempax >> 1; - tempbx = tempbx >> 1; - tempcx = tempcx >> 1; + tempax >>= 1; + tempbx >>= 1; + tempcx >>= 1; } if (pVBInfo->VBType & VB_SIS302LV) @@ -3843,7 +3843,7 @@ static void XGI_SetLCDRegs(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part2Port, 0x1C, temp); temp = (tempbx & 0xFF00) >> 8; - temp = temp << 4; + temp <<= 4; xgifb_reg_and_or(pVBInfo->Part2Port, 0x1D, ~0x0F0, temp); temp = tempcx & 0x00FF; /* RHSYEXP2S=lcdhre */ xgifb_reg_set(pVBInfo->Part2Port, 0x21, temp); @@ -4044,10 +4044,10 @@ static void XGI_SetGroup4(unsigned short ModeIdIndex, tempbx = pVBInfo->VGAHDE; if (modeflag & HalfDCLK) - tempbx = tempbx >> 1; + tempbx >>= 1; if (XGI_IsLCDDualLink(pVBInfo)) - tempbx = tempbx >> 1; + tempbx >>= 1; if (tempcx & SetCRT2ToHiVision) { temp = 0; @@ -4107,7 +4107,7 @@ static void XGI_SetGroup4(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part4Port, 0x1A, temp); tempbx = (unsigned short) (tempebx >> 16); temp = tempbx & 0x00FF; - temp = temp << 4; + temp <<= 4; temp |= ((tempcx & 0xFF00) >> 8); xgifb_reg_set(pVBInfo->Part4Port, 0x19, temp); @@ -4118,10 +4118,10 @@ static void XGI_SetGroup4(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part4Port, 0x1C, temp); tempax = pVBInfo->VGAHDE; if (modeflag & HalfDCLK) - tempax = tempax >> 1; + tempax >>= 1; if (XGI_IsLCDDualLink(pVBInfo)) - tempax = tempax >> 1; + tempax >>= 1; if (pVBInfo->VBInfo & SetCRT2ToLCD) { if (tempax > 800) @@ -4162,7 +4162,7 @@ static void XGI_SetGroup4(unsigned short ModeIdIndex, xgifb_reg_and_or(pVBInfo->Part4Port, 0x1F, 0x00C0, temp); tempbx = pVBInfo->HT; if (XGI_IsLCDDualLink(pVBInfo)) - tempbx = tempbx >> 1; + tempbx >>= 1; tempbx = (tempbx >> 1) - 2; temp = ((tempbx & 0x0700) >> 8) << 3; xgifb_reg_and_or(pVBInfo->Part4Port, 0x21, 0x00C0, temp); @@ -4622,7 +4622,7 @@ static void XGI_SetDelayComp(struct vb_device_info *pVBInfo) tempbl = XGI301TVDelay; if (pVBInfo->VBInfo & SetCRT2ToDualEdge) - tempbl = tempbl >> 4; + tempbl >>= 4; if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { tempbh = XGI301LCDDelay; @@ -4785,7 +4785,7 @@ static void XGI_SetAntiFlicker(struct vb_device_info *pVBInfo) tempbx = XGI_GetTVPtrIndex(pVBInfo); tempbx &= 0xFE; tempah = TVAntiFlickList[tempbx]; - tempah = tempah << 4; + tempah <<= 4; xgifb_reg_and_or(pVBInfo->Part2Port, 0x0A, 0x8F, tempah); } @@ -4799,7 +4799,7 @@ static void XGI_SetEdgeEnhance(struct vb_device_info *pVBInfo) tempbx = XGI_GetTVPtrIndex(pVBInfo); tempbx &= 0xFE; tempah = TVEdgeList[tempbx]; - tempah = tempah << 5; + tempah <<= 5; xgifb_reg_and_or(pVBInfo->Part2Port, 0x3A, 0x1F, tempah); } @@ -5101,7 +5101,7 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, unsigned short RefreshRateTableIndex, i, index, temp; index = xgifb_reg_get(pVBInfo->P3d4, 0x33); - index = index >> pVBInfo->SelectCRT2Rate; + index >>= pVBInfo->SelectCRT2Rate; index &= 0x0F; if (pVBInfo->LCDInfo & LCDNonExpanding) -- cgit v1.2.3 From 26aab2b14cfef377e8a339348d8c5057bcba30e8 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:29:04 +0200 Subject: staging: rtl8723au: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/hal_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/hal_com.c b/drivers/staging/rtl8723au/hal/hal_com.c index a7751c9aecad..c9bb3e1ff0e8 100644 --- a/drivers/staging/rtl8723au/hal/hal_com.c +++ b/drivers/staging/rtl8723au/hal/hal_com.c @@ -231,7 +231,7 @@ void HalSetBrateCfg23a(struct rtw_adapter *padapter, u8 *mBratesOS) rate_index = 0; /* Set RTS initial rate */ while (brate_cfg > 0x1) { - brate_cfg = (brate_cfg >> 1); + brate_cfg >>= 1; rate_index++; } /* Ziv - Check */ -- cgit v1.2.3 From a9dbc808e97b34684d570e4654b03f48b0eba3a8 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:30:01 +0200 Subject: staging: rtl8723au: hal: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c b/drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c index 00480f5fcdab..d63c852aa857 100644 --- a/drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c +++ b/drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c @@ -30,12 +30,12 @@ static bool CheckCondition(const u32 Condition, const u32 Hex) return false; cond = Condition & 0x0000FF00; - cond = cond >> 8; + cond >>= 8; if ((_interface & cond) == 0 && cond != 0x07) return false; cond = Condition & 0x00FF0000; - cond = cond >> 16; + cond >>= 16; if ((_platform & cond) == 0 && cond != 0x0F) return false; return true; -- cgit v1.2.3 From 5092450c9dee65a046fdf6ff6e9f25c05f231840 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:30:50 +0200 Subject: staging: rtl8723au: hal: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c b/drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c index 12071453be97..83018301ec27 100644 --- a/drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c +++ b/drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c @@ -30,12 +30,12 @@ static bool CheckCondition(const u32 Condition, const u32 Hex) return false; cond = Condition & 0x0000FF00; - cond = cond >> 8; + cond >>= 8; if ((_interface & cond) == 0 && cond != 0x07) return false; cond = Condition & 0x00FF0000; - cond = cond >> 16; + cond >>= 16; if ((_platform & cond) == 0 && cond != 0x0F) return false; return true; -- cgit v1.2.3 From 6bd70089b3c1882a86e21eb3779f1cf4a8259c8d Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:31:42 +0200 Subject: staging: rtl8723au: hal: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c b/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c index 9d4f6bed4269..67d985c21712 100644 --- a/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c +++ b/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c @@ -30,12 +30,12 @@ static bool CheckCondition(const u32 Condition, const u32 Hex) return false; cond = Condition & 0x0000FF00; - cond = cond >> 8; + cond >>= 8; if ((_interface & cond) == 0 && cond != 0x07) return false; cond = Condition & 0x00FF0000; - cond = cond >> 16; + cond >>= 16; if ((_platform & cond) == 0 && cond != 0x0F) return false; return true; -- cgit v1.2.3 From cb329d837dce4cdb23ecf1fe38713675552751c0 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:32:40 +0200 Subject: staging: rtl8712: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index c653ad6854b4..743dd93688b5 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -1045,7 +1045,7 @@ static sint aes_cipher(u8 *key, uint hdrlen, uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); - frsubtype = frsubtype >> 4; + frsubtype >>= 4; memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); memset((void *)mic_header2, 0, 16); @@ -1216,7 +1216,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); - frsubtype = frsubtype >> 4; + frsubtype >>= 4; memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); memset((void *)mic_header2, 0, 16); -- cgit v1.2.3 From bc5b749a4640ea028cfa9bde5dac98366aa8f44a Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:35:45 +0200 Subject: staging: rtl8712: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_eeprom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_eeprom.c b/drivers/staging/rtl8712/rtl871x_eeprom.c index 2f145d63fcec..50339e67da07 100644 --- a/drivers/staging/rtl8712/rtl871x_eeprom.c +++ b/drivers/staging/rtl8712/rtl871x_eeprom.c @@ -64,7 +64,7 @@ static void shift_out_bits(struct _adapter *padapter, u16 data, u16 count) udelay(CLOCK_RATE); up_clk(padapter, &x); down_clk(padapter, &x); - mask = mask >> 1; + mask >>= 1; } while (mask); if (padapter->bSurpriseRemoved == true) goto out; @@ -83,7 +83,7 @@ static u16 shift_in_bits(struct _adapter *padapter) x &= ~(_EEDO | _EEDI); d = 0; for (i = 0; i < 16; i++) { - d = d << 1; + d <<= 1; up_clk(padapter, &x); if (padapter->bSurpriseRemoved == true) goto out; -- cgit v1.2.3 From 5c7c5d800e380e28deb9e6dfac8d66a6c4f4d3c3 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:36:56 +0200 Subject: staging: rtl8712: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl8712_recv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index cd8b444b255b..e4fc9e0dedb0 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -161,7 +161,7 @@ static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib, u16 drvinfo_sz = 0; drvinfo_sz = (le32_to_cpu(prxstat->rxdw0)&0x000f0000)>>16; - drvinfo_sz = drvinfo_sz<<3; + drvinfo_sz <<= 3; /*TODO: * Offset 0 */ pattrib->bdecrypted = ((le32_to_cpu(prxstat->rxdw0) & BIT(27)) >> 27) @@ -436,7 +436,7 @@ void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf) voffset = *(uint *)poffset; prxstat = (struct recv_stat *)prxcmdbuf; drvinfo_sz = ((le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16); - drvinfo_sz = drvinfo_sz << 3; + drvinfo_sz <<= 3; poffset += RXDESC_SIZE + drvinfo_sz; do { voffset = *(uint *)poffset; @@ -749,7 +749,7 @@ static void query_rx_phy_status(struct _adapter *padapter, */ if (!cck_highpwr) { report = pcck_buf->cck_agc_rpt & 0xc0; - report = report >> 6; + report >>= 6; switch (report) { /* Modify the RF RNA gain value to -40, -20, * -2, 14 by Jenyu's suggestion @@ -775,7 +775,7 @@ static void query_rx_phy_status(struct _adapter *padapter, } else { report = ((u8)(le32_to_cpu(pphy_stat->phydw1) >> 8)) & 0x60; - report = report >> 5; + report >>= 5; switch (report) { case 0x3: rx_pwr_all = -40 - ((pcck_buf->cck_agc_rpt & @@ -1039,7 +1039,7 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb) frag = (le32_to_cpu(prxstat->rxdw2) >> 12) & 0xf; /* uint 2^3 = 8 bytes */ drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16; - drvinfo_sz = drvinfo_sz<<3; + drvinfo_sz <<= 3; if (pkt_len <= 0) goto _exit_recvbuf2recvframe; /* Qos data, wireless lan header length is 26 */ -- cgit v1.2.3 From ae52e527c9c0b05bff9cfcea11f1e1b4ce94325a Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:38:12 +0200 Subject: staging: rtl8712: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl8712_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c index 62e53cc1d8b9..007f0a3ab13d 100644 --- a/drivers/staging/rtl8712/rtl8712_cmd.c +++ b/drivers/staging/rtl8712/rtl8712_cmd.c @@ -95,7 +95,7 @@ static void query_fw_rx_phy_status(struct _adapter *padapter) val32 = r8712_read32(padapter, IOCMD_DATA_REG); else /* time out */ val32 = 0; - val32 = val32 >> 4; + val32 >>= 4; padapter->recvpriv.fw_rssi = (u8)r8712_signal_scale_mapping(val32); } -- cgit v1.2.3 From 278c0942c37b69e929da429548ddb4030051a5e5 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:39:17 +0200 Subject: staging: rtl8192u: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index e031a253e2ae..8d2714083e78 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4038,7 +4038,7 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, if (!priv->bCckHighPower) { report = pcck_buf->cck_agc_rpt & 0xc0; - report = report>>6; + report >>= 6; switch (report) { //Fixed by Jacken from Bryant 2008-03-20 //Original value is -38 , -26 , -14 , -2 @@ -4058,7 +4058,7 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, } } else { report = pcck_buf->cck_agc_rpt & 0x60; - report = report>>5; + report >>= 5; switch (report) { case 0x3: rx_pwr_all = -35 - ((pcck_buf->cck_agc_rpt & 0x1f)<<1); -- cgit v1.2.3 From 1339078956e5d96c978602b918bce37d08b78c72 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:40:21 +0200 Subject: staging: rtl8192u: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index e60d926a3973..c322881d853b 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -889,7 +889,7 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet, u8 *pMCSF if(HTMcsToDataRate(ieee, (8*i+j)) > HTMcsToDataRate(ieee, mcsRate)) mcsRate = (8*i+j); } - bitMap = bitMap>>1; + bitMap >>= 1; } } } -- cgit v1.2.3 From be31fed4f917e67a504ef837486cef798fba0fd7 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:40:50 +0200 Subject: staging: rtl8192e: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_HTProc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 1ea426b7b7ac..165975ad4ce5 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -654,7 +654,7 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, HTMcsToDataRate(ieee, mcsRate)) mcsRate = (8*i+j); } - bitMap = bitMap>>1; + bitMap >>= 1; } } } -- cgit v1.2.3 From 0dbffe07b15d43b80fbdff16bc643b8483bc315d Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:41:23 +0200 Subject: staging: rtl8192e: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 552d943b1761..a85fb7118b7b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1527,7 +1527,7 @@ static void rtl8192_query_rxphystatus( priv->stats.numqry_phystatusCCK++; if (!reg824_bit9) { report = pcck_buf->cck_agc_rpt & 0xc0; - report = report>>6; + report >>= 6; switch (report) { case 0x3: rx_pwr_all = -35 - (pcck_buf->cck_agc_rpt & @@ -1547,7 +1547,7 @@ static void rtl8192_query_rxphystatus( } } else { report = pcck_buf->cck_agc_rpt & 0x60; - report = report>>5; + report >>= 5; switch (report) { case 0x3: rx_pwr_all = -35 - -- cgit v1.2.3 From 945f0185610dbad16b6741b55cad86cc72fb559d Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:41:51 +0200 Subject: staging: rtl8188eu: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/usb_halinit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 14650e91c78a..122e9b37aa79 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -1352,7 +1352,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) /* Set RTS initial rate */ while (BrateCfg > 0x1) { - BrateCfg = (BrateCfg >> 1); + BrateCfg >>= 1; RateIndex++; } /* Ziv - Check */ -- cgit v1.2.3 From c6112e4839326c254da7cf37a6376aa543dcc659 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:42:14 +0200 Subject: staging: rtl8188eu: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/rf_cfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/rf_cfg.c b/drivers/staging/rtl8188eu/hal/rf_cfg.c index 5dc11cae2ef9..455ecdc8d9fa 100644 --- a/drivers/staging/rtl8188eu/hal/rf_cfg.c +++ b/drivers/staging/rtl8188eu/hal/rf_cfg.c @@ -38,12 +38,12 @@ static bool check_condition(struct adapter *adapt, const u32 condition) return false; cond = condition & 0x0000FF00; - cond = cond >> 8; + cond >>= 8; if ((_interface & cond) == 0 && cond != 0x07) return false; cond = condition & 0x00FF0000; - cond = cond >> 16; + cond >>= 16; if ((_platform & cond) == 0 && cond != 0x0F) return false; return true; -- cgit v1.2.3 From 74ff87997fe28b58ddeca7b9294a868b1ea66668 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:42:42 +0200 Subject: staging: rtl8188eu: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c index 2c23aa92e696..8d63c83afee4 100644 --- a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c +++ b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c @@ -487,7 +487,7 @@ static void odm_PTDecision_8188E(struct odm_ra_info *pRaInfo) break; } - j = j >> 1; + j >>= 1; temp_stage = (pRaInfo->PTStage + 1) >> 1; if (temp_stage > j) stage_id = temp_stage-j; -- cgit v1.2.3 From 10a8643b766b10230e9f795d6c1ac716ee03b40c Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:43:09 +0200 Subject: staging: rtl8188eu: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c b/drivers/staging/rtl8188eu/core/rtw_security.c index bd8d60a230e9..f8981f56bafe 100644 --- a/drivers/staging/rtl8188eu/core/rtw_security.c +++ b/drivers/staging/rtl8188eu/core/rtw_security.c @@ -1079,7 +1079,7 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); - frsubtype = frsubtype>>4; + frsubtype >>= 4; memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); @@ -1277,7 +1277,7 @@ static int aes_decipher(u8 *key, uint hdrlen, /* uint offset = 0; */ uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); - frsubtype = frsubtype>>4; + frsubtype >>= 4; memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); -- cgit v1.2.3 From 8e80fe16092464a145dccaf65863cdcc0c5df305 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:43:54 +0200 Subject: staging: media: davinci_vpfe: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c index 87d42e18377d..878abddf99dc 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c @@ -212,7 +212,7 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd) pr_err("ipipeif: links setup required"); return -EINVAL; } - val = val << ONESHOT_SHIFT; + val <<= ONESHOT_SHIFT; ipipeif_source = ipipeif_get_source(ipipeif); val |= ipipeif_source << INPSRC_SHIFT; -- cgit v1.2.3 From 09c99f8f41434ac70b7a7b79569984cdaf266a1d Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:44:18 +0200 Subject: staging: lustre: lov: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_obd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index ea503d2a19f8..2c6c55837c7a 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -553,7 +553,7 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp, newsize = max_t(__u32, lov->lov_tgt_size, 2); while (newsize < index + 1) - newsize = newsize << 1; + newsize <<= 1; OBD_ALLOC(newtgts, sizeof(*newtgts) * newsize); if (newtgts == NULL) { mutex_unlock(&lov->lov_lock); -- cgit v1.2.3 From 302727b658d948b47ec69bdd9caefac3f7b10b5e Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:44:40 +0200 Subject: staging: lustre: lmv: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index b779f47384c5..6e446ac8d9e7 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -487,7 +487,7 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp, __u32 oldsize = 0; while (newsize < index + 1) - newsize = newsize << 1; + newsize <<= 1; OBD_ALLOC(newtgts, sizeof(*newtgts) * newsize); if (newtgts == NULL) { lmv_init_unlock(lmv); -- cgit v1.2.3 From 0c8e4d70e001f7528be9d06739ecd28736396867 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:45:03 +0200 Subject: staging: lustre: libcfs: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 76c62e87a415..54352368ac14 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -410,7 +410,7 @@ int libcfs_debug_init(unsigned long bufsize) max = TCD_MAX_PAGES; } else { max = (max / num_possible_cpus()); - max = max << (20 - PAGE_CACHE_SHIFT); + max <<= (20 - PAGE_CACHE_SHIFT); } rc = cfs_tracefile_init(max); -- cgit v1.2.3 From 1525ecfce19b56e8c26b52d15f7b4617c9f503ba Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:45:26 +0200 Subject: staging: iio: Documentation: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/Documentation/generic_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index de4647e2495e..59b250545d4c 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -72,7 +72,7 @@ void print2byte(int input, struct iio_channel_info *info) * Shift before conversion to avoid sign extension * of left aligned data */ - input = input >> info->shift; + input >>= info->shift; if (info->is_signed) { int16_t val = input; -- cgit v1.2.3 From 410c944eda7287a3c68e7e5886ad4280467b2a5b Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:45:51 +0200 Subject: staging: emxx_udc: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 6c1de2770e6a..ee8f69f69eac 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -1454,7 +1454,7 @@ static int _nbu2ss_set_feature_device( break; case USB_DEVICE_TEST_MODE: - wIndex = wIndex >> 8; + wIndex >>= 8; if (wIndex <= MAX_TEST_MODE_NUM) result = 0; break; @@ -1671,7 +1671,7 @@ static int std_req_set_address(struct nbu2ss_udc *udc) if (wValue != (wValue & 0x007F)) return -EINVAL; - wValue = wValue << USB_ADRS_SHIFT; + wValue <<= USB_ADRS_SHIFT; _nbu2ss_writel(&udc->p_regs->USB_ADDRESS, wValue); _nbu2ss_create_ep0_packet(udc, udc->ep0_buf, 0); -- cgit v1.2.3 From f559108b4b3253f5d3e01d0e671eb94702dcb77d Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 26 Feb 2015 11:46:12 +0200 Subject: staging: comedi: rewrite the right hand side of an assignment This patch rewrites the right hand side of an assignment for expressions of the form: a = (a b); to be: a = b; where = << | >>. This issue was detected and resolved using the following coccinelle script: @@ identifier i; expression e; @@ -i = (i >> e); +i >>= e; @@ identifier i; expression e; @@ -i = (i << e); +i <<= e; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/rtd520.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index c94ad12ed446..a7255d13775a 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -579,7 +579,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, /* read data */ d = readw(devpriv->las1 + LAS1_ADC_FIFO); - d = d >> 3; /* low 3 bits are marker lines */ + d >>= 3; /* low 3 bits are marker lines */ /* convert bipolar data to comedi unsigned data */ if (comedi_range_is_bipolar(s, range)) @@ -616,7 +616,7 @@ static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, } d = readw(devpriv->las1 + LAS1_ADC_FIFO); - d = d >> 3; /* low 3 bits are marker lines */ + d >>= 3; /* low 3 bits are marker lines */ /* convert bipolar data to comedi unsigned data */ if (comedi_range_is_bipolar(s, range)) -- cgit v1.2.3 From 0395e554f840344796799d538b020deb124bf764 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Fri, 27 Feb 2015 02:12:10 +0530 Subject: Staging: rtl8188eu: Remove unnecessary code Code removed as variables assigned are not used anywhere. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index c8d8abcde16d..2af3013f1d0f 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -442,15 +442,13 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) u8 thermal_val = 0, delta, delta_lck, delta_iqk, offset; u8 thermal_avg_count = 0; u32 thermal_avg = 0; - s32 ele_a = 0, ele_d, temp_cck, x; - s32 y, ele_c = 0; + s32 ele_d, temp_cck; s8 ofdm_index[2], cck_index = 0; s8 ofdm_index_old[2] = {0, 0}, cck_index_old = 0; u32 i = 0, j = 0; bool is2t = false; u8 ofdm_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB */ - u8 indexforchannel = 0; s8 ofdm_index_mapping[2][index_mapping_NUM_88E] = { /* 2.4G, decrease power */ {0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11}, @@ -599,11 +597,6 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) if (dm_odm->RFCalibrateInfo.TxPowerTrackControl) { dm_odm->RFCalibrateInfo.bDoneTxpower = true; - /* Adujst OFDM Ant_A according to IQK result */ - ele_d = (OFDMSwingTable[(u8)ofdm_index[0]] & 0xFFC00000)>>22; - x = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[indexforchannel].Value[0][0]; - y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[indexforchannel].Value[0][1]; - /* Revse TX power table. */ dm_odm->BbSwingIdxOfdm = (u8)ofdm_index[0]; dm_odm->BbSwingIdxCck = (u8)cck_index; @@ -617,18 +610,6 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) dm_odm->BbSwingIdxCckCurrent = dm_odm->BbSwingIdxCck; dm_odm->BbSwingFlagCck = true; } - - if (x != 0) { - if ((x & 0x00000200) != 0) - x = x | 0xFFFFFC00; - ele_a = ((x * ele_d)>>8)&0x000003FF; - - /* new element C = element D x Y */ - if ((y & 0x00000200) != 0) - y = y | 0xFFFFFC00; - ele_c = ((y * ele_d)>>8)&0x000003FF; - - } } } -- cgit v1.2.3 From 93133eb42ed698a6ac23fb320074e6abc17b091e Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 26 Feb 2015 23:45:44 +0200 Subject: Staging: lustre: Move export_symbol below its function This patch fixes "EXPORT_SYMBOL(foo); should immediately follow its function/variable" checkpatch.pl warning in file.c Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 5ebee6ca0a10..25bd51389ff7 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3233,6 +3233,7 @@ void *ll_iocontrol_register(llioc_callback_t cb, int count, unsigned int *cmd) return in_data; } +EXPORT_SYMBOL(ll_iocontrol_register); void ll_iocontrol_unregister(void *magic) { @@ -3257,8 +3258,6 @@ void ll_iocontrol_unregister(void *magic) CWARN("didn't find iocontrol register block with magic: %p\n", magic); } - -EXPORT_SYMBOL(ll_iocontrol_register); EXPORT_SYMBOL(ll_iocontrol_unregister); static enum llioc_iter -- cgit v1.2.3 From cea812cd69dc5eb37b087b8fdb68b695f7de94ec Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 26 Feb 2015 23:45:45 +0200 Subject: Staging: lustre: Added blank line after declarations This patch fixes "Missing a blank line after declarations" checkpatch.pl warning in file.c Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 25bd51389ff7..d14fc9c22ad5 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -197,6 +197,7 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp, } if (rc == 0 && op_data->op_bias & MDS_HSM_RELEASE) { struct mdt_body *body; + body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); if (!(body->valid & OBD_MD_FLRELEASED)) rc = -EBUSY; -- cgit v1.2.3 From ef075edcc92be64746bfb184071707fa5890cc3a Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 26 Feb 2015 23:45:46 +0200 Subject: Staging: lustre: Corrected code indentation This patch fixes these warning messages found by checkpatch.pl: WARNING: suspect code indent for conditional statements(8,15) Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index d14fc9c22ad5..247b4f038588 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2822,7 +2822,7 @@ int ll_have_md_lock(struct inode *inode, __u64 *bits, ldlm_mode_t l_req_mode) int i; if (!inode) - return 0; + return 0; fid = &ll_i2info(inode)->lli_fid; CDEBUG(D_INFO, "trying to match res "DFID" mode %s\n", PFID(fid), -- cgit v1.2.3 From c7849595f56862480cabbbae4f445c9f158168db Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 26 Feb 2015 23:45:47 +0200 Subject: Staging: lustre: Added spaces around '=' Add spaces around =, to conform to kernel coding type. This problem was found by checkpatch. Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 247b4f038588..ab8f1a98c746 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -270,7 +270,7 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode, int lockmode; __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK; struct lustre_handle lockh; - ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}}; + ldlm_policy_data_t policy = {.l_inodebits = {MDS_INODELOCK_OPEN}}; int rc = 0; /* clear group lock, if present */ -- cgit v1.2.3 From ff0dd127432f003f11d8312c37bb384da009307a Mon Sep 17 00:00:00 2001 From: aybuke ozdemir Date: Thu, 26 Feb 2015 23:45:48 +0200 Subject: Staging: lustre: Remove space after the name of that function Fix checkpatch.pl issues with "space prohibited between function name and open parenthesis" in file.c Signed-off-by: aybuke ozdemir Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index ab8f1a98c746..0fd113d58da0 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -693,7 +693,7 @@ restart: out_och_free: if (rc) { if (och_p && *och_p) { - OBD_FREE(*och_p, sizeof (struct obd_client_handle)); + OBD_FREE(*och_p, sizeof(struct obd_client_handle)); *och_p = NULL; /* OBD_FREE writes some magic there */ (*och_usecount)--; } -- cgit v1.2.3 From 6a3718cfd0f6608362f5aaea37f896ff629d0f43 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Thu, 26 Feb 2015 23:04:42 +0100 Subject: Staging: rtl8192u: Remove break statement This patch fixes the checkpatch.pl warning: WARNING: "break is not useful after a goto or return" Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_phy.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index c8dc648a59ee..3d4f57d97d51 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1342,7 +1342,6 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, default: RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip); return true; - break; } -- cgit v1.2.3 From 6518c10be952ef0afb95e5ea5d277458e273b662 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Fri, 27 Feb 2015 00:03:02 +0100 Subject: Staging: rtl8192u: Replace printk() with pr_debug() For dynamic debugging netdev_dbg(), dev_dbg() or pr_debug() macro is preferred over printk(), which is the raw way to print something. Network system has it's own printk format, netdev_dbg, but in this case function's argument list has no pointer to a struct netdevice so pr_debug is used instead. Issue found by checkpatch.pl. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index c43d0fe7edf7..8962de7668ed 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -48,14 +48,14 @@ static void *prism2_wep_init(int keyidx) priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + pr_debug("ieee80211_crypt_wep: could not allocate " "crypto API arc4\n"); priv->tx_tfm = NULL; goto fail; } priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + pr_debug("ieee80211_crypt_wep: could not allocate " "crypto API arc4\n"); priv->rx_tfm = NULL; goto fail; -- cgit v1.2.3 From c5f9e99b6ae704dd67f6b5f9e0f6dec968baea0f Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 03:06:53 +0200 Subject: staging: vt6656: replace memcpy by ether_addr_copy This patch fixes the following checkpatch.pl warning: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) The changes were applied using the following coccinelle rule: @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index bb37e33b9ffa..5dfac05b9cf1 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -30,6 +30,8 @@ * Revision History: */ +#include + #include "desc.h" #include "mac.h" #include "usbpipe.h" @@ -126,7 +128,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, offset += (entry_idx * MISCFIFO_KEYENTRYSIZE); set_key.u.write.key_ctl = cpu_to_le16(key_ctl); - memcpy(set_key.u.write.addr, addr, ETH_ALEN); + ether_addr_copy(set_key.u.write.addr, addr); /* swap over swap[0] and swap[1] to get correct write order */ swap(set_key.u.swap[0], set_key.u.swap[1]); -- cgit v1.2.3 From 35a90a563be777e40c5b107cda27ae93cb31e63d Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 27 Feb 2015 02:59:23 +0300 Subject: Staging: nvec: Add paragraph to describe kconfig symbol This patch updates kconfig with paragraphs that describe config symbol fully. Issue addressed by checkpatch.pl warning. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/Kconfig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/nvec/Kconfig b/drivers/staging/nvec/Kconfig index 9475e20c3d64..e3a89fb1a4a2 100644 --- a/drivers/staging/nvec/Kconfig +++ b/drivers/staging/nvec/Kconfig @@ -6,6 +6,9 @@ config MFD_NVEC Say Y here to enable support for a nVidia compliant embedded controller. + To compile this driver as a module, say M here: the module will be + called mfd-nvec + config KEYBOARD_NVEC tristate "Keyboard on nVidia compliant EC" depends on MFD_NVEC && INPUT @@ -13,6 +16,9 @@ config KEYBOARD_NVEC Say Y here to enable support for a keyboard connected to a nVidia compliant embedded controller. + To compile this driver as a module, say M here: the module will be + called keyboard-nvec + config SERIO_NVEC_PS2 tristate "PS2 on nVidia EC" depends on MFD_NVEC && SERIO @@ -20,6 +26,10 @@ config SERIO_NVEC_PS2 Say Y here to enable support for a Touchpad / Mouse connected to a nVidia compliant embedded controller. + To compile this driver as a module, say M here: the module will be + called serio-nvec-ps2 + + config NVEC_POWER tristate "NVEC charger and battery" depends on MFD_NVEC && POWER_SUPPLY @@ -27,9 +37,17 @@ config NVEC_POWER Say Y to enable support for battery and charger interface for nVidia compliant embedded controllers. + To compile this driver as a module, say M here: the module will be + called nvec-power + + config NVEC_PAZ00 tristate "Support for OEM specific functions on Compal PAZ00 based devices" depends on MFD_NVEC && LEDS_CLASS help Say Y to enable control of the yellow side leds on Compal PAZ00 based devices, e.g. Toshbia AC100 and Dynabooks AZ netbooks. + + To compile this driver as a module, say M here: the module will be + called nvec-paz00 + -- cgit v1.2.3 From 2e81513b05d9b694df8c19011e76dea866092df1 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Feb 2015 17:09:43 +0530 Subject: staging: unisys: remove unused variable we were getting lots of warnings about _tempresult set but not used. _tempresult was used in the macro ISSUE_IO_VMCALL_POSTCODE_SEVERITY which was again using another macro ISSUE_IO_EXTENDED_VMCALL. but the value assigned to it was never used. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/common-spar/include/vmcallinterface.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/common-spar/include/vmcallinterface.h b/drivers/staging/unisys/common-spar/include/vmcallinterface.h index 78333719c496..59a7459eb962 100644 --- a/drivers/staging/unisys/common-spar/include/vmcallinterface.h +++ b/drivers/staging/unisys/common-spar/include/vmcallinterface.h @@ -79,18 +79,15 @@ enum vmcall_monitor_interface_method_tuple { /* VMCALL identification tuples */ #define ISSUE_IO_VMCALL(method, param, result) \ (result = unisys_vmcall(method, (param) & 0xFFFFFFFF, \ (param) >> 32)) -#define ISSUE_IO_EXTENDED_VMCALL(method, param1, param2, \ - param3, result) \ - (result = unisys_extended_vmcall(method, param1, \ - param2, param3)) +#define ISSUE_IO_EXTENDED_VMCALL(method, param1, param2, param3) \ + unisys_extended_vmcall(method, param1, param2, param3) /* The following uses VMCALL_POST_CODE_LOGEVENT interface but is currently * not used much */ #define ISSUE_IO_VMCALL_POSTCODE_SEVERITY(postcode, severity) \ do { \ - u32 _tempresult = VMCALL_SUCCESS; \ ISSUE_IO_EXTENDED_VMCALL(VMCALL_POST_CODE_LOGEVENT, severity, \ - MDS_APPOS, postcode, _tempresult); \ + MDS_APPOS, postcode); \ } while (0) #endif -- cgit v1.2.3 From b247d4087a6afc3ad41a15b49b7555ba4840c4bc Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Feb 2015 17:09:44 +0530 Subject: staging: unisys: fix directory warning we were getting three warnings about timskmod and sparstopdriver and channels. These warnings were about no such file or directory. These directory names were included in the Makefile, but the directories were not existing. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/uislib/Makefile | 2 -- drivers/staging/unisys/virthba/Makefile | 1 - 2 files changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/uislib/Makefile b/drivers/staging/unisys/uislib/Makefile index 08e620d17497..860f494f132f 100644 --- a/drivers/staging/unisys/uislib/Makefile +++ b/drivers/staging/unisys/uislib/Makefile @@ -7,8 +7,6 @@ obj-$(CONFIG_UNISYS_UISLIB) += visoruislib.o visoruislib-y := uislib.o uisqueue.o uisthread.o uisutils.o ccflags-y += -Idrivers/staging/unisys/include -ccflags-y += -Idrivers/staging/unisys/channels ccflags-y += -Idrivers/staging/unisys/visorchipset -ccflags-y += -Idrivers/staging/unisys/sparstopdriver ccflags-y += -Idrivers/staging/unisys/common-spar/include ccflags-y += -Idrivers/staging/unisys/common-spar/include/channels diff --git a/drivers/staging/unisys/virthba/Makefile b/drivers/staging/unisys/virthba/Makefile index ba55ae12488e..a4e403739183 100644 --- a/drivers/staging/unisys/virthba/Makefile +++ b/drivers/staging/unisys/virthba/Makefile @@ -6,7 +6,6 @@ obj-$(CONFIG_UNISYS_VIRTHBA) += virthba.o ccflags-y += -Idrivers/staging/unisys/include ccflags-y += -Idrivers/staging/unisys/uislib -ccflags-y += -Idrivers/staging/unisys/timskmod ccflags-y += -Idrivers/staging/unisys/visorchipset ccflags-y += -Idrivers/staging/unisys/virtpci ccflags-y += -Idrivers/staging/unisys/common-spar/include -- cgit v1.2.3 From ea0dcfcf6d6e76ed4ded11c3027e7f5478746010 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Tue, 10 Feb 2015 15:12:07 +0100 Subject: staging: unisys: Remove allocation from declaration line This patch removes allocation from declaration line because people are known to gloss over declarations. Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 6 +++--- drivers/staging/unisys/visorutil/charqueue.c | 3 ++- drivers/staging/unisys/visorutil/memregion_direct.c | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index f606ee9e0de9..149d4bc953ac 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1604,9 +1604,9 @@ parahotplug_next_expiration(void) static struct parahotplug_request * parahotplug_request_create(struct controlvm_message *msg) { - struct parahotplug_request *req = - kmalloc(sizeof(struct parahotplug_request), - GFP_KERNEL|__GFP_NORETRY); + struct parahotplug_request *req; + + req = kmalloc(sizeof(*req), GFP_KERNEL|__GFP_NORETRY); if (req == NULL) return NULL; diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index ac7acb7c5b79..e2ee5ee7585e 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -36,8 +36,9 @@ struct charqueue { struct charqueue *visor_charqueue_create(ulong nslots) { int alloc_size = sizeof(struct charqueue) + nslots + 1; - struct charqueue *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); + struct charqueue *cq; + cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); if (cq == NULL) { ERRDRV("visor_charqueue_create allocation failed (alloc_size=%d)", alloc_size); diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index 33522cc8c22c..f4ecac0e5092 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -41,8 +41,9 @@ struct memregion * visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) { struct memregion *rc = NULL; - struct memregion *memregion = kzalloc(sizeof(*memregion), - GFP_KERNEL | __GFP_NORETRY); + struct memregion *memregion; + + memregion = kzalloc(sizeof(*memregion), GFP_KERNEL | __GFP_NORETRY); if (memregion == NULL) { ERRDRV("visor_memregion_create allocation failed"); return NULL; -- cgit v1.2.3 From 9729018cd6012e0628a3f97269fdbe252ce2e26a Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Thu, 12 Feb 2015 17:53:35 +0530 Subject: staging: unisys: remove unneeded functions these functions are not being used anywhere.so we can remove them. has been verified by "git grep" that they are not being referenced anywhere also has been build tested. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/uisutils.h | 31 ----- drivers/staging/unisys/uislib/uisutils.c | 191 ------------------------------ 2 files changed, 222 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/uisutils.h b/drivers/staging/unisys/include/uisutils.h index 7414220676d3..e2dfb2e784de 100644 --- a/drivers/staging/unisys/include/uisutils.h +++ b/drivers/staging/unisys/include/uisutils.h @@ -65,17 +65,7 @@ struct req_handler_info { struct list_head list_link; /* links into ReqHandlerInfo_list */ }; -struct req_handler_info *req_handler_add(uuid_le switch_uuid, - const char *switch_type_name, - int (*controlfunc)(struct io_msgs *), - unsigned long min_channel_bytes, - int (*svr_channel_ok)(unsigned long - channel_bytes), - int (*svr_channel_init)(void *x, - unsigned char *client_str, - u32 client_str_len, u64 bytes)); struct req_handler_info *req_handler_find(uuid_le switch_uuid); -int req_handler_del(uuid_le switch_uuid); #define uislib_ioremap_cache(addr, size) \ dbg_ioremap_cache(addr, size, __FILE__, __LINE__) @@ -115,19 +105,7 @@ int uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining, int uisctrl_register_req_handler(int type, void *fptr, struct ultra_vbus_deviceinfo *chipset_driver_info); -int uisctrl_register_req_handler_ex(uuid_le switch_guid, - const char *switch_type_name, - int (*fptr)(struct io_msgs *), - unsigned long min_channel_bytes, - int (*svr_channel_ok)(unsigned long - channel_bytes), - int (*svr_channel_init)(void *x, - unsigned char *client_str, - u32 client_str_len, - u64 bytes), - struct ultra_vbus_deviceinfo *chipset_driver_info); -int uisctrl_unregister_req_handler_ex(uuid_le switch_uuid); unsigned char *util_map_virt(struct phys_info *sg); void util_unmap_virt(struct phys_info *sg); unsigned char *util_map_virt_atomic(struct phys_info *sg); @@ -212,15 +190,6 @@ wait_for_valid_guid(uuid_le __iomem *guid) LOGERR("OK... GUID is non-0 now\n"); } -/* CopyFragsInfoFromSkb returns the number of entries added to frags array - * Returns -1 on failure. - */ -unsigned int uisutil_copy_fragsinfo_from_skb(unsigned char *calling_ctx, - void *skb_in, - unsigned int firstfraglen, - unsigned int frags_max, - struct phys_info frags[]); - static inline unsigned int issue_vmcall_io_controlvm_addr(u64 *control_addr, u32 *control_bytes) { diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c index 31318d246252..1ba6c15bcbe0 100644 --- a/drivers/staging/unisys/uislib/uisutils.c +++ b/drivers/staging/unisys/uislib/uisutils.c @@ -102,71 +102,6 @@ uisctrl_register_req_handler(int type, void *fptr, } EXPORT_SYMBOL_GPL(uisctrl_register_req_handler); -int -uisctrl_register_req_handler_ex(uuid_le switch_uuid, - const char *switch_type_name, - int (*controlfunc)(struct io_msgs *), - unsigned long min_channel_bytes, - int (*server_channel_ok)(unsigned long channel_bytes), - int (*server_channel_init)(void *x, - unsigned char *client_str, - u32 client_str_len, u64 bytes), - struct ultra_vbus_deviceinfo *chipset_driver_info) -{ - struct req_handler_info *req_handler; - - LOGINF("type=%pUL, controlfunc=0x%p.\n", - &switch_uuid, controlfunc); - if (!controlfunc) { - LOGERR("%pUL: controlfunc must be supplied\n", &switch_uuid); - return 0; - } - if (!server_channel_ok) { - LOGERR("%pUL: Server_Channel_Ok must be supplied\n", - &switch_uuid); - return 0; - } - if (!server_channel_init) { - LOGERR("%pUL: Server_Channel_Init must be supplied\n", - &switch_uuid); - return 0; - } - req_handler = req_handler_add(switch_uuid, - switch_type_name, - controlfunc, - min_channel_bytes, - server_channel_ok, server_channel_init); - if (!req_handler) { - LOGERR("failed to add %pUL to server list\n", &switch_uuid); - return 0; - } - - atomic_inc(&uisutils_registered_services); - if (chipset_driver_info) { - bus_device_info_init(chipset_driver_info, "chipset", - "uislib", VERSION, NULL); - return 1; - } - - LOGERR("failed to register type %pUL.\n", &switch_uuid); - return 0; -} -EXPORT_SYMBOL_GPL(uisctrl_register_req_handler_ex); - -int -uisctrl_unregister_req_handler_ex(uuid_le switch_uuid) -{ - LOGINF("type=%pUL.\n", &switch_uuid); - if (req_handler_del(switch_uuid) < 0) { - LOGERR("failed to remove %pUL from server list\n", - &switch_uuid); - return 0; - } - atomic_dec(&uisutils_registered_services); - return 1; -} -EXPORT_SYMBOL_GPL(uisctrl_unregister_req_handler_ex); - /* * unsigned int uisutil_copy_fragsinfo_from_skb(unsigned char *calling_ctx, * void *skb_in, @@ -185,116 +120,10 @@ EXPORT_SYMBOL_GPL(uisctrl_unregister_req_handler_ex); * return value indicates number of * entries filled in frags */ -unsigned int -uisutil_copy_fragsinfo_from_skb(unsigned char *calling_ctx, void *skb_in, - unsigned int firstfraglen, - unsigned int frags_max, - struct phys_info frags[]) -{ - unsigned int count = 0, ii, size, offset = 0, numfrags; - struct sk_buff *skb = skb_in; - - numfrags = skb_shinfo(skb)->nr_frags; - - while (firstfraglen) { - if (count == frags_max) { - LOGERR("%s frags array too small: max:%d count:%d\n", - calling_ctx, frags_max, count); - return -1; /* failure */ - } - frags[count].pi_pfn = - page_to_pfn(virt_to_page(skb->data + offset)); - frags[count].pi_off = - (unsigned long)(skb->data + offset) & PI_PAGE_MASK; - size = - min(firstfraglen, - (unsigned int)(PI_PAGE_SIZE - frags[count].pi_off)); - /* can take smallest of firstfraglen(what's left) OR - * bytes left in the page - */ - frags[count].pi_len = size; - firstfraglen -= size; - offset += size; - count++; - } - if (!numfrags) - goto dolist; - - if ((count + numfrags) > frags_max) { - LOGERR("**** FAILED %s frags array too small: max:%d count+nr_frags:%d\n", - calling_ctx, frags_max, count + numfrags); - return -1; /* failure */ - } - - for (ii = 0; ii < numfrags; ii++) { - count = add_physinfo_entries(page_to_pfn( - skb_frag_page(&skb_shinfo(skb)->frags[ii])), - skb_shinfo(skb)->frags[ii]. - page_offset, - skb_shinfo(skb)->frags[ii]. - size, count, frags_max, - frags); - if (count == 0) { - LOGERR("**** FAILED to add physinfo entries\n"); - return -1; /* failure */ - } - } - -dolist: if (skb_shinfo(skb)->frag_list) { - struct sk_buff *skbinlist; - int c; - - for (skbinlist = skb_shinfo(skb)->frag_list; skbinlist; - skbinlist = skbinlist->next) { - c = uisutil_copy_fragsinfo_from_skb("recursive", - skbinlist, - skbinlist->len - skbinlist->data_len, - frags_max - count, - &frags[count]); - if (c == -1) { - LOGERR("**** FAILED recursive call failed\n"); - return -1; - } - count += c; - } - } - return count; -} -EXPORT_SYMBOL_GPL(uisutil_copy_fragsinfo_from_skb); static LIST_HEAD(req_handler_info_list); /* list of struct req_handler_info */ static DEFINE_SPINLOCK(req_handler_info_list_lock); -struct req_handler_info * -req_handler_add(uuid_le switch_uuid, - const char *switch_type_name, - int (*controlfunc)(struct io_msgs *), - unsigned long min_channel_bytes, - int (*server_channel_ok)(unsigned long channel_bytes), - int (*server_channel_init) - (void *x, unsigned char *clientstr, u32 clientstr_len, - u64 bytes)) -{ - struct req_handler_info *rc = NULL; - - rc = kzalloc(sizeof(*rc), GFP_ATOMIC); - if (!rc) - return NULL; - rc->switch_uuid = switch_uuid; - rc->controlfunc = controlfunc; - rc->min_channel_bytes = min_channel_bytes; - rc->server_channel_ok = server_channel_ok; - rc->server_channel_init = server_channel_init; - if (switch_type_name) - strncpy(rc->switch_type_name, switch_type_name, - sizeof(rc->switch_type_name) - 1); - spin_lock(&req_handler_info_list_lock); - list_add_tail(&rc->list_link, &req_handler_info_list); - spin_unlock(&req_handler_info_list_lock); - - return rc; -} - struct req_handler_info * req_handler_find(uuid_le switch_uuid) { @@ -312,23 +141,3 @@ req_handler_find(uuid_le switch_uuid) spin_unlock(&req_handler_info_list_lock); return NULL; } - -int -req_handler_del(uuid_le switch_uuid) -{ - struct list_head *lelt, *tmp; - struct req_handler_info *entry = NULL; - int rc = -1; - - spin_lock(&req_handler_info_list_lock); - list_for_each_safe(lelt, tmp, &req_handler_info_list) { - entry = list_entry(lelt, struct req_handler_info, list_link); - if (uuid_le_cmp(entry->switch_uuid, switch_uuid) == 0) { - list_del(lelt); - kfree(entry); - rc++; - } - } - spin_unlock(&req_handler_info_list_lock); - return rc; -} -- cgit v1.2.3 From cee158b5a60149798f6034a67484a503253d6f77 Mon Sep 17 00:00:00 2001 From: Frederico Cadete Date: Wed, 18 Feb 2015 19:53:38 +0100 Subject: staging: unisys: declare visorchipset_ioctl static This symbol is not exported nor referenced anywhere else in the kernel. Signed-off-by: Frederico Cadete Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index e51fd4e3fa2d..b2b1b619c0b4 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -36,7 +36,8 @@ static BOOL registered = FALSE; static int visorchipset_open(struct inode *inode, struct file *file); static int visorchipset_release(struct inode *inode, struct file *file); static int visorchipset_mmap(struct file *file, struct vm_area_struct *vma); -long visorchipset_ioctl(struct file *file, unsigned int cmd, unsigned long arg); +static long visorchipset_ioctl(struct file *file, unsigned int cmd, + unsigned long arg); static const struct file_operations visorchipset_fops = { .owner = THIS_MODULE, @@ -165,7 +166,8 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma) return 0; } -long visorchipset_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +static long visorchipset_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) { s64 adjustment; s64 vrtc_offset; -- cgit v1.2.3 From 5058bb45be19e84da2394a22647f117278ee60ad Mon Sep 17 00:00:00 2001 From: Frederico Cadete Date: Wed, 18 Feb 2015 19:53:39 +0100 Subject: staging: unisys: remove unused MESSAGE_ENVELOPE typedef Signed-off-by: Frederico Cadete Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 149d4bc953ac..05eea465f3de 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -70,11 +70,6 @@ static struct delayed_work Periodic_controlvm_work; static struct workqueue_struct *Periodic_controlvm_workqueue; static DEFINE_SEMAPHORE(NotifierLock); -typedef struct { - struct controlvm_message message; - unsigned int crc; -} MESSAGE_ENVELOPE; - static struct controlvm_message_header g_DiagMsgHdr; static struct controlvm_message_header g_ChipSetMsgHdr; static struct controlvm_message_header g_DelDumpMsgHdr; -- cgit v1.2.3 From 84b11dfd1ec14cb40944e35b4aff36c78f276598 Mon Sep 17 00:00:00 2001 From: Frederico Cadete Date: Wed, 18 Feb 2015 19:53:40 +0100 Subject: staging: unisys: style: Replace typedefs with structs in visorchipset_main.c Signed-off-by: Frederico Cadete Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 05eea465f3de..cad036c0c66a 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -98,19 +98,19 @@ static LIST_HEAD(DevInfoList); static struct visorchannel *ControlVm_channel; -typedef struct { +struct controlvm_payload_info { u8 __iomem *ptr; /* pointer to base address of payload pool */ u64 offset; /* offset from beginning of controlvm * channel to beginning of payload * pool */ u32 bytes; /* number of bytes in payload pool */ -} CONTROLVM_PAYLOAD_INFO; +}; /* Manages the request payload in the controlvm channel */ -static CONTROLVM_PAYLOAD_INFO ControlVm_payload_info; +static struct controlvm_payload_info ControlVm_payload_info; static struct channel_header *Test_Vnic_channel; -typedef struct { +struct livedump_info { struct controlvm_message_header Dumpcapture_header; struct controlvm_message_header Gettextdump_header; struct controlvm_message_header Dumpcomplete_header; @@ -119,11 +119,11 @@ typedef struct { ulong length; atomic_t buffers_in_use; ulong destination; -} LIVEDUMP_INFO; +}; /* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE / * CONTROLVM_DUMP_GETTEXTDUMP / CONTROLVM_DUMP_COMPLETE conversation. */ -static LIVEDUMP_INFO LiveDump_info; +static struct livedump_info LiveDump_info; /* The following globals are used to handle the scenario where we are unable to * offload the payload from a controlvm message due to memory requirements. In @@ -1374,12 +1374,12 @@ Away: /* When provided with the physical address of the controlvm channel * (phys_addr), the offset to the payload area we need to manage * (offset), and the size of this payload area (bytes), fills in the - * CONTROLVM_PAYLOAD_INFO struct. Returns TRUE for success or FALSE + * controlvm_payload_info struct. Returns TRUE for success or FALSE * for failure. */ static int initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes, - CONTROLVM_PAYLOAD_INFO *info) + struct controlvm_payload_info *info) { u8 __iomem *payload = NULL; int rc = CONTROLVM_RESP_SUCCESS; @@ -1390,7 +1390,7 @@ initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes, rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID; goto Away; } - memset(info, 0, sizeof(CONTROLVM_PAYLOAD_INFO)); + memset(info, 0, sizeof(struct controlvm_payload_info)); if ((offset == 0) || (bytes == 0)) { LOGERR("CONTROLVM_PAYLOAD_INIT Failed: request_payload_offset=%llu request_payload_bytes=%llu!", (u64) offset, (u64) bytes); @@ -1422,13 +1422,13 @@ Away: } static void -destroy_controlvm_payload_info(CONTROLVM_PAYLOAD_INFO *info) +destroy_controlvm_payload_info(struct controlvm_payload_info *info) { if (info->ptr != NULL) { iounmap(info->ptr); info->ptr = NULL; } - memset(info, 0, sizeof(CONTROLVM_PAYLOAD_INFO)); + memset(info, 0, sizeof(struct controlvm_payload_info)); } static void -- cgit v1.2.3 From 9a174ad446c90d2b6a748c701efe127b2c47c315 Mon Sep 17 00:00:00 2001 From: Frederico Cadete Date: Wed, 18 Feb 2015 19:53:41 +0100 Subject: staging: unisys: style: remove unnecessary braces Signed-off-by: Frederico Cadete Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index 0188ef866fdd..4d11b512de07 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c @@ -416,9 +416,8 @@ signalremove_inner(struct visorchannel *channel, u32 queue, void *msg) { struct signal_queue_header sig_hdr; - if (!sig_read_header(channel, queue, &sig_hdr)) { + if (!sig_read_header(channel, queue, &sig_hdr)) return FALSE; - } if (sig_hdr.head == sig_hdr.tail) return FALSE; /* no signals to remove */ @@ -466,9 +465,8 @@ signalinsert_inner(struct visorchannel *channel, u32 queue, void *msg) { struct signal_queue_header sig_hdr; - if (!sig_read_header(channel, queue, &sig_hdr)) { + if (!sig_read_header(channel, queue, &sig_hdr)) return FALSE; - } sig_hdr.head = ((sig_hdr.head + 1) % sig_hdr.max_slots); if (sig_hdr.head == sig_hdr.tail) { -- cgit v1.2.3 From edff162ce38ec1cea17f3cadd095e8e449d79735 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Thu, 19 Feb 2015 13:49:20 +0100 Subject: staging: unisys: Remove unnecessary OOM message This patch reduces the kernel size by removing error messages that duplicate the normal OOM message. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr) @@ identifier f,print,l; expression e; constant char[] c; @@ e = \(kzalloc\|kmalloc\|devm_kzalloc\|devm_kmalloc\)(...); if (e == NULL) { <+... - print(...,c,...); ... when any ( goto l; | return ...; ) ...+> } Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/uislib/uislib.c | 2 -- drivers/staging/unisys/virthba/virthba.c | 21 ++++++--------------- drivers/staging/unisys/virtpci/virtpci.c | 1 - .../unisys/visorchannel/visorchannel_funcs.c | 1 - drivers/staging/unisys/visorchipset/parser.c | 2 -- .../staging/unisys/visorchipset/visorchipset_main.c | 4 ---- drivers/staging/unisys/visorutil/memregion_direct.c | 4 +--- drivers/staging/unisys/visorutil/procobjecttree.c | 21 +++++---------------- 8 files changed, 12 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index a9eeddeba735..77bf24761e05 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -172,7 +172,6 @@ create_bus(struct controlvm_message *msg, char *buf) (dev_count * sizeof(struct device_info *)); bus = kzalloc(size, GFP_ATOMIC); if (!bus) { - LOGERR("CONTROLVM_BUS_CREATE Failed: kmalloc for bus failed.\n"); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); return CONTROLVM_RESP_ERROR_KMALLOC_FAILED; @@ -357,7 +356,6 @@ static int create_device(struct controlvm_message *msg, char *buf) dev = kzalloc(sizeof(*dev), GFP_ATOMIC); if (!dev) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: kmalloc for dev failed.\n"); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); return CONTROLVM_RESP_ERROR_KMALLOC_FAILED; diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index e6ecea560495..e7af2858942d 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -695,10 +695,8 @@ forward_vdiskmgmt_command(enum vdisk_mgmt_types vdiskcmdtype, } cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); - if (cmdrsp == NULL) { - LOGERR("kmalloc of cmdrsp failed.\n"); - return FAILED; /* reject */ - } + if (cmdrsp == NULL) + return FAILED; /* reject */ init_waitqueue_head(¬ifyevent); @@ -758,10 +756,8 @@ forward_taskmgmt_command(enum task_mgmt_types tasktype, } cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); - if (cmdrsp == NULL) { - LOGERR("kmalloc of cmdrsp failed.\n"); - return FAILED; /* reject */ - } + if (cmdrsp == NULL) + return FAILED; /* reject */ init_waitqueue_head(¬ifyevent); @@ -929,10 +925,8 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, } cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); - if (cmdrsp == NULL) { - LOGERR("kmalloc of cmdrsp failed.\n"); + if (cmdrsp == NULL) return 1; /* reject the command */ - } /* now saving everything we need from scsi_cmd into cmdrsp * before we queue cmdrsp set type to command - as opposed to @@ -1064,10 +1058,8 @@ virthba_slave_alloc(struct scsi_device *scsidev) return 0; } tmpvdisk = kzalloc(sizeof(*tmpvdisk), GFP_ATOMIC); - if (!tmpvdisk) { /* error allocating */ - LOGERR("Could not allocate memory for disk\n"); + if (!tmpvdisk) return 0; - } tmpvdisk->channel = scsidev->channel; tmpvdisk->id = scsidev->id; @@ -1342,7 +1334,6 @@ process_incoming_rsps(void *v) /* alloc once and reuse */ cmdrsp = kmalloc(SZ, GFP_ATOMIC); if (cmdrsp == NULL) { - LOGERR("process_incoming_rsps ****FAILED to malloc - thread exiting\n"); complete_and_exit(&dc->threadinfo.has_stopped, 0); return 0; } diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index 8fdfd6f3605f..edaf43f5a77d 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -931,7 +931,6 @@ static int virtpci_device_add(struct device *parentbus, int devtype, /* add a Virtual Device */ virtpcidev = kzalloc(sizeof(*virtpcidev), GFP_ATOMIC); if (virtpcidev == NULL) { - LOGERR("can't add device - malloc FALLED\n"); POSTCODE_LINUX_2(MALLOC_FAILURE_PC, POSTCODE_SEVERITY_ERR); return 0; } diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index 4d11b512de07..01b0b200feb6 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c @@ -59,7 +59,6 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, p = kmalloc(sizeof(*p), GFP_KERNEL|__GFP_NORETRY); if (p == NULL) { - ERRDRV("allocation failed: (status=0)\n"); rc = NULL; goto cleanup; } diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 9edbd3bbd186..686fe6474ee3 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -69,8 +69,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, } ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY); if (ctx == NULL) { - ERRDRV("%s (%s:%d) - failed to allocate %d bytes", - __func__, __FILE__, __LINE__, allocbytes); if (tryAgain) *tryAgain = TRUE; rc = NULL; diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index cad036c0c66a..4b5def838ebb 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1113,8 +1113,6 @@ bus_create(struct controlvm_message *inmsg) } pBusInfo = kzalloc(sizeof(struct visorchipset_bus_info), GFP_KERNEL); if (pBusInfo == NULL) { - LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu kzalloc failed", - busNo); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; @@ -1263,8 +1261,6 @@ my_device_create(struct controlvm_message *inmsg) } pDevInfo = kzalloc(sizeof(struct visorchipset_device_info), GFP_KERNEL); if (pDevInfo == NULL) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: busNo=%lu, devNo=%lu kmaloc failed", - busNo, devNo); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index f4ecac0e5092..aa52a6fd1bf0 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -86,10 +86,8 @@ visor_memregion_create_overlapped(struct memregion *parent, ulong offset, return NULL; } memregion = kzalloc(sizeof(*memregion), GFP_KERNEL|__GFP_NORETRY); - if (memregion == NULL) { - ERRDRV("%s allocation failed", __func__); + if (memregion == NULL) return NULL; - } memregion->physaddr = parent->physaddr + offset; memregion->nbytes = nbytes; diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c index 82279ca5fbe1..0672e8c9f686 100644 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ b/drivers/staging/unisys/visorutil/procobjecttree.c @@ -146,10 +146,8 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot, goto Away; } type = kzalloc(sizeof(MYPROCTYPE), GFP_KERNEL | __GFP_NORETRY); - if (type == NULL) { - ERRDRV("out of memory\n"); + if (type == NULL) goto Away; - } type->name = name; type->propertyNames = propertyNames; type->nProperties = 0; @@ -164,10 +162,8 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot, type->procDirs = kzalloc((type->nNames + 1) * sizeof(struct proc_dir_entry *), GFP_KERNEL | __GFP_NORETRY); - if (type->procDirs == NULL) { - ERRDRV("out of memory\n"); + if (type->procDirs == NULL) goto Away; - } parent = procDirRoot; for (i = 0; i < type->nNames; i++) { type->procDirs[i] = createProcDir(type->name[i], parent); @@ -231,10 +227,8 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, goto Away; } obj = kzalloc(sizeof(MYPROCOBJECT), GFP_KERNEL | __GFP_NORETRY); - if (obj == NULL) { - ERRDRV("out of memory\n"); + if (obj == NULL) goto Away; - } obj->type = type; obj->context = context; if (name == NULL) { @@ -245,7 +239,6 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, obj->name = kmalloc(obj->namesize, GFP_KERNEL | __GFP_NORETRY); if (obj->name == NULL) { obj->namesize = 0; - ERRDRV("out of memory\n"); goto Away; } strcpy(obj->name, name); @@ -257,17 +250,13 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, kzalloc((type->nProperties + 1) * sizeof(struct proc_dir_entry_context), GFP_KERNEL | __GFP_NORETRY); - if (obj->procDirPropertyContexts == NULL) { - ERRDRV("out of memory\n"); + if (obj->procDirPropertyContexts == NULL) goto Away; - } obj->procDirProperties = kzalloc((type->nProperties + 1) * sizeof(struct proc_dir_entry *), GFP_KERNEL | __GFP_NORETRY); - if (obj->procDirProperties == NULL) { - ERRDRV("out of memory\n"); + if (obj->procDirProperties == NULL) goto Away; - } for (i = 0; i < type->nProperties; i++) { obj->procDirPropertyContexts[i].procObject = obj; obj->procDirPropertyContexts[i].propertyIndex = i; -- cgit v1.2.3 From 31c9b9cf40f8f03f6a7484f2c06c5eb31b3735ce Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 19 Feb 2015 14:08:30 -0500 Subject: unisys: replace kthread_create and wake_up_process with kthread_run kthread_run calls kthread_create and if the thread is created it then calls wake_up_process on the corresponding returned task struct. So the code can be simplified by calling just kthread_run. Cc: Ken Cox Cc: Benjamin Romer Signed-off-by: Devendra Naga Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/uislib/uisthread.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/uislib/uisthread.c b/drivers/staging/unisys/uislib/uisthread.c index 25adf1a7307c..c5c68cb1286b 100644 --- a/drivers/staging/unisys/uislib/uisthread.c +++ b/drivers/staging/unisys/uislib/uisthread.c @@ -44,13 +44,12 @@ uisthread_start(struct uisthread_info *thrinfo, thrinfo->should_stop = 0; /* used to stop the thread */ init_completion(&thrinfo->has_stopped); - thrinfo->task = kthread_create(threadfn, thrcontext, name, NULL); + thrinfo->task = kthread_run(threadfn, thrcontext, name); if (IS_ERR(thrinfo->task)) { thrinfo->id = 0; return 0; /* failure */ } thrinfo->id = thrinfo->task->pid; - wake_up_process(thrinfo->task); LOGINF("started thread pid:%d\n", thrinfo->id); return 1; } -- cgit v1.2.3 From 18216fefbe26e95189c6628fde731ff1b239a7f6 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 19 Feb 2015 14:08:31 -0500 Subject: unisys: use simpler kthread_ API The code does the checks on should_stop variable in the kernel threads. The uisthread_stop function sets the should_stop and calls KILL (eventually kill_pid) to stop the thread. The checking of should_stop variable can be replaced to a call to kthread_should_stop function and the setting of the should_stop and a call to KILL can be replaced with kthread_stop function. Cc: Ken Cox Cc: Benjamin Romer Signed-off-by: Devendra Naga Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/uislib/uisthread.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/uislib/uisthread.c b/drivers/staging/unisys/uislib/uisthread.c index c5c68cb1286b..20a2a1bb1ba4 100644 --- a/drivers/staging/unisys/uislib/uisthread.c +++ b/drivers/staging/unisys/uislib/uisthread.c @@ -41,7 +41,6 @@ int uisthread_start(struct uisthread_info *thrinfo, int (*threadfn)(void *), void *thrcontext, char *name) { - thrinfo->should_stop = 0; /* used to stop the thread */ init_completion(&thrinfo->has_stopped); thrinfo->task = kthread_run(threadfn, thrcontext, name); @@ -58,24 +57,19 @@ EXPORT_SYMBOL_GPL(uisthread_start); void uisthread_stop(struct uisthread_info *thrinfo) { - int ret; int stopped = 0; if (thrinfo->id == 0) return; /* thread not running */ LOGINF("uisthread_stop stopping id:%d\n", thrinfo->id); - thrinfo->should_stop = 1; - ret = KILL(thrinfo->id, SIGHUP, 1); - if (ret) { - LOGERR("unable to signal thread %d\n", ret); - } else { - /* give up if the thread has NOT died in 1 minute */ - if (wait_for_completion_timeout(&thrinfo->has_stopped, 60 * HZ)) - stopped = 1; - else - LOGERR("timed out trying to signal thread\n"); - } + kthread_stop(thrinfo->task); + /* give up if the thread has NOT died in 1 minute */ + if (wait_for_completion_timeout(&thrinfo->has_stopped, 60 * HZ)) + stopped = 1; + else + LOGERR("timed out trying to signal thread\n"); + if (stopped) { LOGINF("uisthread_stop stopped id:%d\n", thrinfo->id); thrinfo->id = 0; -- cgit v1.2.3 From 010c9f8ebd27f4af484cbe752ed583bf72675882 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 19 Feb 2015 14:08:32 -0500 Subject: unisys: use kthread_should_stop in the thread convert the users of should_stop variable into kthread_should_stop() API. Cc: Ken Cox Cc: Benjamin Romer Signed-off-by: Devendra Naga Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/virthba/virthba.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index e7af2858942d..ca89e76fbf7e 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -1339,6 +1339,8 @@ process_incoming_rsps(void *v) } mask = ULTRA_CHANNEL_ENABLE_INTS; while (1) { + if (kthread_should_stop()) + break; wait_event_interruptible_timeout(virthbainfo->rsp_queue, (atomic_read(&virthbainfo->interrupt_rcvd) == 1), usecs_to_jiffies(rsltq_wait_usecs)); @@ -1346,8 +1348,6 @@ process_incoming_rsps(void *v) /* drain queue */ drain_queue(virthbainfo, dc, cmdrsp); rc1 = uisqueue_interlocked_or(virthbainfo->flags_addr, mask); - if (dc->threadinfo.should_stop) - break; } kfree(cmdrsp); -- cgit v1.2.3 From e0f2f18eb2e856ac8fd7efc6af0671c1fdc50e69 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 19 Feb 2015 14:08:33 -0500 Subject: unisys: use kthread_should_stop API in the lib thread convert the users of should_stop into using kthread_should_stop API. Cc: Ken Cox Cc: Benjamin Romer Signed-off-by: Devendra Naga Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/uislib/uislib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 77bf24761e05..6d2432bed267 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -1292,7 +1292,7 @@ static int process_incoming(void *v) } } } - if (incoming_ti.should_stop) + if (kthread_should_stop()) break; } if (new_tail != NULL) { @@ -1309,7 +1309,7 @@ static int process_incoming(void *v) * - there is no input waiting on any of the channels * - we have received a signal to stop this thread */ - if (incoming_ti.should_stop) + if (kthread_should_stop()) break; if (en_smart_wakeup == 0xFF) { LOGINF("en_smart_wakeup set to 0xff, to force exiting process_incoming"); -- cgit v1.2.3 From 58701e5a5906ddfbabe245eda0e1cb42dd2b9468 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 19 Feb 2015 14:08:34 -0500 Subject: unisys: remove the thread variable and API remove the should_stop variable and KILL API as they are no longer required Cc: Ken Cox Cc: Benjamin Romer Signed-off-by: Devendra Naga Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/uisthread.h | 1 - drivers/staging/unisys/uislib/uisthread.c | 2 -- 2 files changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/uisthread.h b/drivers/staging/unisys/include/uisthread.h index aa86ade7cb13..52c3eb4ded2c 100644 --- a/drivers/staging/unisys/include/uisthread.h +++ b/drivers/staging/unisys/include/uisthread.h @@ -27,7 +27,6 @@ struct uisthread_info { struct task_struct *task; int id; - int should_stop; struct completion has_stopped; }; diff --git a/drivers/staging/unisys/uislib/uisthread.c b/drivers/staging/unisys/uislib/uisthread.c index 20a2a1bb1ba4..d54005d8f50d 100644 --- a/drivers/staging/unisys/uislib/uisthread.c +++ b/drivers/staging/unisys/uislib/uisthread.c @@ -24,8 +24,6 @@ #include "uisutils.h" #include "uisthread.h" -#define KILL(a, b, c) kill_pid(find_vpid(a), b, c) - /* this is shorter than using __FILE__ (full path name) in * debug/info/error messages */ -- cgit v1.2.3 From 59ce8d558c0e2d0217d2aab938c8334a896c02ee Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 21 Feb 2015 13:16:34 +0100 Subject: staging: unisys: Rework Kconfig dependencies I find the Kconfig dependencies of the various Unisys drivers rather confusing. Due to the dependencies, you must select the drivers one by one to see the following ones. So if you are looking for a specific driver, it is not visible by default. And if you don't know exactly what you need, it's even worse as you don't know what is available. In a case like this with several helper drivers and many dependencies, I think it makes more sense to list all the drivers at first, and use select statements to fulfill the dependencies for the user. As a nice side effect, it avoids the weird indentation, which was technically correct but still somewhat confusing. I also dropped the dependencies on HAS_IOMEM, as the whole driver set is for X86_64 only anyway which always has HAS_IOMEM set. And I dropped the redundant dependencies on UNISYSSPAR as all drivers are already inside an "if UNISYSSPAR" block. Signed-off-by: Jean Delvare Cc: Benjamin Romer Cc: David Kershner Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/uislib/Kconfig | 2 +- drivers/staging/unisys/virthba/Kconfig | 5 ++++- drivers/staging/unisys/virtpci/Kconfig | 2 +- drivers/staging/unisys/visorchannel/Kconfig | 2 +- drivers/staging/unisys/visorchipset/Kconfig | 3 ++- drivers/staging/unisys/visorutil/Kconfig | 1 - 6 files changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/uislib/Kconfig b/drivers/staging/unisys/uislib/Kconfig index a712eb82224a..c39a0a21ae5f 100644 --- a/drivers/staging/unisys/uislib/Kconfig +++ b/drivers/staging/unisys/uislib/Kconfig @@ -4,7 +4,7 @@ config UNISYS_UISLIB tristate "Unisys uislib driver" - depends on UNISYSSPAR && UNISYS_VISORCHIPSET && HAS_IOMEM + select UNISYS_VISORCHIPSET ---help--- If you say Y here, you will enable the Unisys uislib driver. diff --git a/drivers/staging/unisys/virthba/Kconfig b/drivers/staging/unisys/virthba/Kconfig index 9af98fc7acbc..dfadfc49114a 100644 --- a/drivers/staging/unisys/virthba/Kconfig +++ b/drivers/staging/unisys/virthba/Kconfig @@ -4,7 +4,10 @@ config UNISYS_VIRTHBA tristate "Unisys virthba driver" - depends on UNISYSSPAR && UNISYS_VISORCHIPSET && UNISYS_UISLIB && UNISYS_VIRTPCI && SCSI + depends on SCSI + select UNISYS_VISORCHIPSET + select UNISYS_UISLIB + select UNISYS_VIRTPCI ---help--- If you say Y here, you will enable the Unisys virthba driver. diff --git a/drivers/staging/unisys/virtpci/Kconfig b/drivers/staging/unisys/virtpci/Kconfig index e59efcbc4d3b..6d19482ce11b 100644 --- a/drivers/staging/unisys/virtpci/Kconfig +++ b/drivers/staging/unisys/virtpci/Kconfig @@ -4,7 +4,7 @@ config UNISYS_VIRTPCI tristate "Unisys virtpci driver" - depends on UNISYSSPAR && UNISYS_UISLIB + select UNISYS_UISLIB ---help--- If you say Y here, you will enable the Unisys virtpci driver. diff --git a/drivers/staging/unisys/visorchannel/Kconfig b/drivers/staging/unisys/visorchannel/Kconfig index 41c3b4b997eb..8d31bebf039a 100644 --- a/drivers/staging/unisys/visorchannel/Kconfig +++ b/drivers/staging/unisys/visorchannel/Kconfig @@ -4,7 +4,7 @@ config UNISYS_VISORCHANNEL tristate "Unisys visorchannel driver" - depends on UNISYSSPAR && UNISYS_VISORUTIL + select UNISYS_VISORUTIL ---help--- If you say Y here, you will enable the Unisys visorchannel driver. diff --git a/drivers/staging/unisys/visorchipset/Kconfig b/drivers/staging/unisys/visorchipset/Kconfig index e86836f84243..b03bfc5c3043 100644 --- a/drivers/staging/unisys/visorchipset/Kconfig +++ b/drivers/staging/unisys/visorchipset/Kconfig @@ -4,7 +4,8 @@ config UNISYS_VISORCHIPSET tristate "Unisys visorchipset driver" - depends on UNISYSSPAR && UNISYS_VISORUTIL && UNISYS_VISORCHANNEL && HAS_IOMEM + select UNISYS_VISORUTIL + select UNISYS_VISORCHANNEL ---help--- If you say Y here, you will enable the Unisys visorchipset driver. diff --git a/drivers/staging/unisys/visorutil/Kconfig b/drivers/staging/unisys/visorutil/Kconfig index 74b474eac252..be9c2cf890cc 100644 --- a/drivers/staging/unisys/visorutil/Kconfig +++ b/drivers/staging/unisys/visorutil/Kconfig @@ -4,7 +4,6 @@ config UNISYS_VISORUTIL tristate "Unisys visorutil driver" - depends on UNISYSSPAR && HAS_IOMEM ---help--- If you say Y here, you will enable the Unisys visorutil driver. -- cgit v1.2.3 From 7e4f1e777814c6916b513b5dc90e030ee4e25f04 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 13:22:44 -0700 Subject: staging: comedi: comedi_isadma: fix "stalled" detect in comedi_isadma_disable_on_sample() The "stalled" variable this function is used to detect if the DMA operation is stalled while trying to disable DMA on a full comedi sample. The reset of this variable should only occur when the remaining bytes of the DMA transfer does not equal the remaining bytes from the last check. Reported-by: coverity (CID 1271132) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_isadma.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/comedi_isadma.c b/drivers/staging/comedi/drivers/comedi_isadma.c index dbdea71d6b95..e856f01ca077 100644 --- a/drivers/staging/comedi/drivers/comedi_isadma.c +++ b/drivers/staging/comedi/drivers/comedi_isadma.c @@ -91,9 +91,10 @@ unsigned int comedi_isadma_disable_on_sample(unsigned int dma_chan, stalled++; if (stalled > 10) break; + } else { + residue = new_residue; + stalled = 0; } - residue = new_residue; - stalled = 0; } return residue; } -- cgit v1.2.3 From 981c1fe9ae20e5fb7c1ee7038efa03933e637925 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 15:13:49 -0700 Subject: staging: comedi: vmk80xx: remove "firmware version" kernel messages During the attach of this driver a couple commands are sent to the hardware with usb_bulk_msg() to read the firmware version information. This information is then dumped as dev_info() kernel messages. Thee messages are just added noise and don't effect the operation of the driver. For simplicity, remove the messages as well as the then unused functions vmk80xx_read_eeprom() and vmk80xx_check_data_link(). This also fixes an issue reported by coverity about an out-of-bounds write in vmk80xx_read_eeprom(). Reported-by: coverity (CID 711413) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/vmk80xx.c | 71 -------------------------------- 1 file changed, 71 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index e37118321a27..a0906685e27f 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -103,11 +103,6 @@ enum vmk80xx_model { VMK8061_MODEL }; -struct firmware_version { - unsigned char ic3_vers[32]; /* USB-Controller */ - unsigned char ic6_vers[32]; /* CPU */ -}; - static const struct comedi_lrange vmk8061_range = { 2, { UNI_RANGE(5), @@ -156,68 +151,12 @@ static const struct vmk80xx_board vmk80xx_boardinfo[] = { struct vmk80xx_private { struct usb_endpoint_descriptor *ep_rx; struct usb_endpoint_descriptor *ep_tx; - struct firmware_version fw; struct semaphore limit_sem; unsigned char *usb_rx_buf; unsigned char *usb_tx_buf; enum vmk80xx_model model; }; -static int vmk80xx_check_data_link(struct comedi_device *dev) -{ - struct vmk80xx_private *devpriv = dev->private; - struct usb_device *usb = comedi_to_usb_dev(dev); - unsigned int tx_pipe; - unsigned int rx_pipe; - unsigned char tx[1]; - unsigned char rx[2]; - - tx_pipe = usb_sndbulkpipe(usb, 0x01); - rx_pipe = usb_rcvbulkpipe(usb, 0x81); - - tx[0] = VMK8061_CMD_RD_PWR_STAT; - - /* - * Check that IC6 (PIC16F871) is powered and - * running and the data link between IC3 and - * IC6 is working properly - */ - usb_bulk_msg(usb, tx_pipe, tx, 1, NULL, devpriv->ep_tx->bInterval); - usb_bulk_msg(usb, rx_pipe, rx, 2, NULL, HZ * 10); - - return (int)rx[1]; -} - -static void vmk80xx_read_eeprom(struct comedi_device *dev, int flag) -{ - struct vmk80xx_private *devpriv = dev->private; - struct usb_device *usb = comedi_to_usb_dev(dev); - unsigned int tx_pipe; - unsigned int rx_pipe; - unsigned char tx[1]; - unsigned char rx[64]; - int cnt; - - tx_pipe = usb_sndbulkpipe(usb, 0x01); - rx_pipe = usb_rcvbulkpipe(usb, 0x81); - - tx[0] = VMK8061_CMD_RD_VERSION; - - /* - * Read the firmware version info of IC3 and - * IC6 from the internal EEPROM of the IC - */ - usb_bulk_msg(usb, tx_pipe, tx, 1, NULL, devpriv->ep_tx->bInterval); - usb_bulk_msg(usb, rx_pipe, rx, 64, &cnt, HZ * 10); - - rx[cnt] = '\0'; - - if (flag & IC3_VERSION) - strncpy(devpriv->fw.ic3_vers, rx + 1, 24); - else /* IC6_VERSION */ - strncpy(devpriv->fw.ic6_vers, rx + 25, 24); -} - static void vmk80xx_do_bulk_msg(struct comedi_device *dev) { struct vmk80xx_private *devpriv = dev->private; @@ -878,16 +817,6 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, usb_set_intfdata(intf, devpriv); - if (devpriv->model == VMK8061_MODEL) { - vmk80xx_read_eeprom(dev, IC3_VERSION); - dev_info(&intf->dev, "%s\n", devpriv->fw.ic3_vers); - - if (vmk80xx_check_data_link(dev)) { - vmk80xx_read_eeprom(dev, IC6_VERSION); - dev_info(&intf->dev, "%s\n", devpriv->fw.ic6_vers); - } - } - if (devpriv->model == VMK8055_MODEL) vmk80xx_reset_device(dev); -- cgit v1.2.3 From 13d932f79cea6b59b9a18a54c2e776d88799654d Mon Sep 17 00:00:00 2001 From: Katie Dunne Date: Thu, 26 Feb 2015 18:42:36 -0800 Subject: Staging: speakup: Remove 'extern' keywords from .h prototypes Addresses checkpatch.pl check: CHECK: Extern prototypes should be avoided in .h files Removes the 'extern' keyword from function prototypes Signed-off-by: Katie Dunne Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_priv.h | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h index 637ba6760ec0..1ef3795b865d 100644 --- a/drivers/staging/speakup/spk_priv.h +++ b/drivers/staging/speakup/spk_priv.h @@ -44,34 +44,34 @@ #define KT_SPKUP 15 -extern const struct old_serial_port *spk_serial_init(int index); -extern void spk_stop_serial_interrupt(void); -extern int spk_wait_for_xmitr(void); -extern unsigned char spk_serial_in(void); -extern unsigned char spk_serial_in_nowait(void); -extern int spk_serial_out(const char ch); -extern void spk_serial_release(void); +const struct old_serial_port *spk_serial_init(int index); +void spk_stop_serial_interrupt(void); +int spk_wait_for_xmitr(void); +unsigned char spk_serial_in(void); +unsigned char spk_serial_in_nowait(void); +int spk_serial_out(const char ch); +void spk_serial_release(void); -extern char synth_buffer_getc(void); -extern char synth_buffer_peek(void); -extern int synth_buffer_empty(void); -extern struct var_t *spk_get_var(enum var_id_t var_id); -extern ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr, - char *buf); -extern ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, - const char *buf, size_t count); +char synth_buffer_getc(void); +char synth_buffer_peek(void); +int synth_buffer_empty(void); +struct var_t *spk_get_var(enum var_id_t var_id); +ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr, + char *buf); +ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count); -extern int spk_serial_synth_probe(struct spk_synth *synth); -extern const char *spk_synth_immediate(struct spk_synth *synth, const char *buff); -extern void spk_do_catch_up(struct spk_synth *synth); -extern void spk_synth_flush(struct spk_synth *synth); -extern int spk_synth_is_alive_nop(struct spk_synth *synth); -extern int spk_synth_is_alive_restart(struct spk_synth *synth); -extern void synth_printf(const char *buf, ...); -extern int synth_request_region(u_long, u_long); -extern int synth_release_region(u_long, u_long); -extern int synth_add(struct spk_synth *in_synth); -extern void synth_remove(struct spk_synth *in_synth); +int spk_serial_synth_probe(struct spk_synth *synth); +const char *spk_synth_immediate(struct spk_synth *synth, const char *buff); +void spk_do_catch_up(struct spk_synth *synth); +void spk_synth_flush(struct spk_synth *synth); +int spk_synth_is_alive_nop(struct spk_synth *synth); +int spk_synth_is_alive_restart(struct spk_synth *synth); +void synth_printf(const char *buf, ...); +int synth_request_region(u_long, u_long); +int synth_release_region(u_long, u_long); +int synth_add(struct spk_synth *in_synth); +void synth_remove(struct spk_synth *in_synth); extern struct speakup_info_t speakup_info; -- cgit v1.2.3 From 2e3b1b0e09bacbb8f86be0b08b5d50617b57274e Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Fri, 27 Feb 2015 13:21:57 +0200 Subject: Staging: i2o: Fix quoted string split across lines This patch fixes "quoted string split across lines warning" warning in exec-osm.c Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/exec-osm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/exec-osm.c b/drivers/staging/i2o/exec-osm.c index 16d857d5e655..dce16e425a6e 100644 --- a/drivers/staging/i2o/exec-osm.c +++ b/drivers/staging/i2o/exec-osm.c @@ -507,8 +507,8 @@ static int i2o_exec_reply(struct i2o_controller *c, u32 m, * to aid in debugging. * */ - printk(KERN_WARNING "%s: Unsolicited message reply sent to core!" - "Message dumped to syslog\n", c->name); + printk(KERN_WARNING "%s: Unsolicited message reply sent to core! Message dumped to syslog\n", + c->name); i2o_dump_message(msg); return -EFAULT; -- cgit v1.2.3 From 0a19b14cc5c6553c29e861a3516c5720c940b8a3 Mon Sep 17 00:00:00 2001 From: Yeliz Taneroglu Date: Fri, 27 Feb 2015 12:00:49 +0200 Subject: Staging: vt6655: Fix do not use C99 // comments Fix checkpatch.pl issues with do not use C99 // comments in key.h Signed-off-by: Yeliz Taneroglu Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/key.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/key.h b/drivers/staging/vt6655/key.h index c01d4afb6ab8..261f8181d410 100644 --- a/drivers/staging/vt6655/key.h +++ b/drivers/staging/vt6655/key.h @@ -66,4 +66,4 @@ int vnt_key_init_table(struct vnt_private *); int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct ieee80211_vif *vif, struct ieee80211_key_conf *key); -#endif // __KEY_H__ +#endif /* __KEY_H__ */ -- cgit v1.2.3 From 0c596a31ec3c3db2fe5ee78e9f46ae2e0bcb9aa0 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:51:29 +0200 Subject: staging: vt6655: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rxtx.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 07ce3fd88e70..ac8c8b5a1450 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -1505,8 +1505,6 @@ int vnt_beacon_make(struct vnt_private *priv, struct ieee80211_vif *vif) int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif, struct ieee80211_bss_conf *conf) { - int ret; - VNSvOutPortB(priv->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST); VNSvOutPortB(priv->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN); @@ -1515,7 +1513,5 @@ int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif, CARDbSetBeaconPeriod(priv, conf->beacon_int); - ret = vnt_beacon_make(priv, vif); - - return ret; + return vnt_beacon_make(priv, vif); } -- cgit v1.2.3 From c28645e3caff03a9d28f1597152348db2a7c0b59 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 27 Feb 2015 14:10:36 +0200 Subject: Staging: dgnc: Replace printk with dev_err This patch fixes the following checkpatch.pl warning: WARNING: Prefer [subsystem eg: netdev]_err over printk(KERN_ERR, ...). Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c index 2fd34ca70c59..a72e35326da4 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ b/drivers/staging/dgnc/dgnc_sysfs.c @@ -360,7 +360,7 @@ void dgnc_create_ports_sysfiles(struct dgnc_board *bd) rc |= device_create_file(&(bd->pdev->dev), &dev_attr_vpd); rc |= device_create_file(&(bd->pdev->dev), &dev_attr_serial_number); if (rc) - printk(KERN_ERR "DGNC: sysfs device_create_file failed!\n"); + dev_err(&bd->pdev->dev, "dgnc: sysfs device_create_file failed!\n"); } -- cgit v1.2.3 From f40e06f0b7fe1f7244349b753cc22e67f69cded4 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sat, 28 Feb 2015 23:11:47 +0200 Subject: Staging: dgnc: Replace printk() with dev_dbg() This patch replaces printk() with dev_dbg() in order to avoid the suggestion of using a more specific function while printing debug information. Warning found by checkpatch.pl. Signed-off-by: Cristina Opriceana Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index a2543cf05f88..c1d1a97e0c94 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -362,7 +362,7 @@ static void dgnc_cleanup_board(struct dgnc_board *brd) spin_lock_irqsave(&dgnc_global_lock, flags); brd->msgbuf = NULL; - printk("%s", brd->msgbuf_head); + dev_dbg(&brd->pdev->dev, "%s\n", brd->msgbuf_head); kfree(brd->msgbuf_head); brd->msgbuf_head = NULL; spin_unlock_irqrestore(&dgnc_global_lock, flags); @@ -610,7 +610,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) spin_lock_irqsave(&dgnc_global_lock, flags); brd->msgbuf = NULL; - printk("%s", brd->msgbuf_head); + dev_dbg(&brd->pdev->dev, "%s\n", brd->msgbuf_head); kfree(brd->msgbuf_head); brd->msgbuf_head = NULL; spin_unlock_irqrestore(&dgnc_global_lock, flags); -- cgit v1.2.3 From 95745e9b1de24fc682a47080124819e1808c3a17 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Sun, 1 Mar 2015 13:08:00 +0530 Subject: staging: lustre: Use kasprintf. This patch uses kasprintf as it combines kmalloc and sprintf, and takes care of the size calculation itself. The semantic patch that makes this change is as follows: // @@ expression a,flag; expression list args; statement S; @@ a = - \(kmalloc\|kzalloc\)(...,flag) + kasprintf(flag,args) <... when != a if (a == NULL || ...) S ...> - sprintf(a,args); Signed-off-by: Navya Sri Nizamkari Acked-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_lib.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 59f8387b4487..8f8c81d8a47f 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -977,19 +977,17 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt) CDEBUG(D_CONFIG, "Found profile %s: mdc=%s osc=%s\n", profilenm, lprof->lp_md, lprof->lp_dt); - dt = kzalloc(strlen(lprof->lp_dt) + instlen + 2, GFP_NOFS); + dt = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_dt, cfg->cfg_instance); if (!dt) { err = -ENOMEM; goto out_free; } - sprintf(dt, "%s-%p", lprof->lp_dt, cfg->cfg_instance); - md = kzalloc(strlen(lprof->lp_md) + instlen + 2, GFP_NOFS); + md = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_dt, cfg->cfg_instance); if (!md) { err = -ENOMEM; goto out_free; } - sprintf(md, "%s-%p", lprof->lp_md, cfg->cfg_instance); /* connections, registrations, sb setup */ err = client_common_fill_super(sb, md, dt, mnt); -- cgit v1.2.3 From 17fc7f9b9658a7846d0d920dd3b8124890f06bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 27 Feb 2015 13:50:11 +0200 Subject: Staging: lustre: lustre: mgc: Delete the excess white space This patch fixes these error messages found by checkpatch.pl: ERROR: "foo* bar" should be "foo *bar" Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 60d2b0f12693..8d3dbdce04ff 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -160,7 +160,7 @@ struct config_llog_data *config_log_find(char *logname, { struct config_llog_data *cld; struct config_llog_data *found = NULL; - void * instance; + void *instance; LASSERT(logname != NULL); -- cgit v1.2.3 From 7cf1054b8c5bce39fa2c8adedb3ff40ddb0fa1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 27 Feb 2015 14:45:41 +0200 Subject: Staging: lustre: lustre: osc: Insert missing space before '|' Insert missing space before '|' to improve readability. This Error found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 0adfa707a763..5e27e0a9b0a1 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1165,8 +1165,8 @@ static int check_write_rcs(struct ptlrpc_request *req, static inline int can_merge_pages(struct brw_page *p1, struct brw_page *p2) { if (p1->flag != p2->flag) { - unsigned mask = ~(OBD_BRW_FROM_GRANT| OBD_BRW_NOCACHE| - OBD_BRW_SYNC|OBD_BRW_ASYNC|OBD_BRW_NOQUOTA); + unsigned mask = ~(OBD_BRW_FROM_GRANT | OBD_BRW_NOCACHE | + OBD_BRW_SYNC | OBD_BRW_ASYNC|OBD_BRW_NOQUOTA); /* warn if we try to combine flags that we don't know to be * safe to combine */ -- cgit v1.2.3 From 79709afac6275be75935ee95ff8094a7586db82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 27 Feb 2015 14:15:36 +0200 Subject: Staging: lustre: lustre: osc: Insert missing space before '=' Insert missing space before '=' to improve readability. This Error found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 445655724904..350ad49550ab 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -1010,7 +1010,7 @@ static int osc_lock_enqueue_wait(const struct lu_env *env, struct cl_lock_descr *descr = &lock->cll_descr; struct cl_object_header *hdr = cl_object_header(descr->cld_obj); struct cl_lock *scan; - struct cl_lock *conflict= NULL; + struct cl_lock *conflict = NULL; int lockless = osc_lock_is_lockless(olck); int rc = 0; -- cgit v1.2.3 From dacd2eced57b0df5676d189ee572d6ee40bd006e Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Fri, 27 Feb 2015 11:25:38 +0530 Subject: Staging: rtl8188eu: Remove braces from single statement block Remove braces from single statement if condition to follow kernel coding convention. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 3b2875481fc5..a71c54295508 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -154,9 +154,8 @@ static int _rtl88e_fw_free_to_go(struct adapter *adapt) break; } while (counter++ < POLLING_READY_TIMEOUT_COUNT); - if (counter >= POLLING_READY_TIMEOUT_COUNT) { + if (counter >= POLLING_READY_TIMEOUT_COUNT) goto exit; - } value32 = usb_read32(adapt, REG_MCUFWDL); value32 |= MCUFWDL_RDY; -- cgit v1.2.3 From 179e7dcde410d820f38ad80b28e9efe26030bb8d Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Fri, 27 Feb 2015 15:18:02 +0530 Subject: Staging: rtl8188eu: Move variable assignment Variable path_on is assigned explicitly in the if branch and so its assignment outside can be moved to the else branch. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 2af3013f1d0f..3ac62656fb75 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -941,11 +941,11 @@ static void path_adda_on(struct adapter *adapt, u32 *adda_reg, u32 path_on; u32 i; - path_on = is_path_a_on ? 0x04db25a4 : 0x0b1b25a4; if (!is2t) { path_on = 0x0bdb25a0; phy_set_bb_reg(adapt, adda_reg[0], bMaskDWord, 0x0b1b25a0); } else { + path_on = is_path_a_on ? 0x04db25a4 : 0x0b1b25a4; phy_set_bb_reg(adapt, adda_reg[0], bMaskDWord, path_on); } -- cgit v1.2.3 From 5f70306ba0972a13be49c97ade1324b22f6ca1c9 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:54:23 +0200 Subject: staging: rtl8188eu: os_dep: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index 24a8f5ac96e5..58998f2f2b09 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -1796,11 +1796,9 @@ static int rtw_wx_set_gen_ie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - ret = rtw_set_wpa_ie(padapter, extra, wrqu->data.length); - return ret; + return rtw_set_wpa_ie(padapter, extra, wrqu->data.length); } static int rtw_wx_set_auth(struct net_device *dev, -- cgit v1.2.3 From 3fe90658016577b1aee33dd183cd1098792cebd9 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Fri, 27 Feb 2015 23:23:57 +0530 Subject: Staging: rtl8188eu: Remove unused variable Remove unused variable assignment for is2t and assign sim_bitmap at declaration to make the code more compact. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/phy.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 3ac62656fb75..f3b195e69057 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -985,27 +985,19 @@ static void pi_mode_switch(struct adapter *adapt, bool pi_mode) static bool simularity_compare(struct adapter *adapt, s32 resulta[][8], u8 c1, u8 c2) { - u32 i, j, diff, sim_bitmap, bound = 0; + u32 i, j, diff, sim_bitmap = 0, bound; struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); struct odm_dm_struct *dm_odm = &hal_data->odmpriv; u8 final_candidate[2] = {0xFF, 0xFF}; /* for path A and path B */ bool result = true; - bool is2t; s32 tmp1 = 0, tmp2 = 0; if ((dm_odm->RFType == ODM_2T2R) || (dm_odm->RFType == ODM_2T3R) || (dm_odm->RFType == ODM_2T4R)) - is2t = true; - else - is2t = false; - - if (is2t) bound = 8; else bound = 4; - sim_bitmap = 0; - for (i = 0; i < bound; i++) { if ((i == 1) || (i == 3) || (i == 5) || (i == 7)) { if ((resulta[c1][i] & 0x00000200) != 0) -- cgit v1.2.3 From 25034ff83c25c8d1a114e3219fbf6c7b5a006622 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Sat, 28 Feb 2015 02:06:44 +0530 Subject: staging: rtl8188eu: Compress two statements into one. This patch removes the use of a variable used only for returning a value. The following coccinelle script was used to discover it: @@ expression ret; identifier f; @@ -ret = +return f(...); -return ret; It also fixes the checkpatch.pl warning about line being over 80 characters, in the lines where changes were made. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c index 80e7ef96d807..b9e1a61f67ca 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c @@ -552,7 +552,6 @@ int usb_write8(struct adapter *adapter, u32 addr, u8 val) u16 index; u16 len; u8 data; - int ret; request = 0x05; requesttype = 0x00;/* write_out */ @@ -560,8 +559,8 @@ int usb_write8(struct adapter *adapter, u32 addr, u8 val) wvalue = (u16)(addr&0x0000ffff); len = 1; data = val; - ret = usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype); - return ret; + return usbctrl_vendorreq(adapter, request, wvalue, + index, &data, len, requesttype); } int usb_write16(struct adapter *adapter, u32 addr, u16 val) @@ -572,7 +571,6 @@ int usb_write16(struct adapter *adapter, u32 addr, u16 val) u16 index; u16 len; __le32 data; - int ret; request = 0x05; @@ -584,10 +582,10 @@ int usb_write16(struct adapter *adapter, u32 addr, u16 val) data = cpu_to_le32(val & 0x0000ffff); - ret = usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype); + return usbctrl_vendorreq(adapter, request, wvalue, + index, &data, len, requesttype); - return ret; } int usb_write32(struct adapter *adapter, u32 addr, u32 val) @@ -598,7 +596,6 @@ int usb_write32(struct adapter *adapter, u32 addr, u32 val) u16 index; u16 len; __le32 data; - int ret; request = 0x05; @@ -609,10 +606,10 @@ int usb_write32(struct adapter *adapter, u32 addr, u32 val) len = 4; data = cpu_to_le32(val); - ret = usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype); + return usbctrl_vendorreq(adapter, request, wvalue, + index, &data, len, requesttype); - return ret; } static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) -- cgit v1.2.3 From 131c359e8ef34f0cedf8e1eb7faf8eb649360a4f Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Sat, 28 Feb 2015 02:07:50 +0530 Subject: staging: rtl8188eu: Add blank line after declarations This patch removes the following checkpatch.pl warning: WARNING: Missing a blank line after declarations Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c index b9e1a61f67ca..7e599bc5b2d3 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c @@ -530,6 +530,7 @@ void usb_read_port_cancel(struct adapter *padapter) { int i; struct recv_buf *precvbuf; + precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf; DBG_88E("%s\n", __func__); -- cgit v1.2.3 From ea18c05882b6eb45455e45af38237612d22f9238 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Sun, 1 Mar 2015 23:30:58 +0530 Subject: staging: rtl8188eu: Remove memset. The memory area set by the call to memset is immediately overwritten by the subsequent call to memcpy. Hence, remove that redundant memset. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/mlme_linux.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c index 1b892c424cb8..eebb7d751777 100644 --- a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c @@ -60,7 +60,6 @@ void rtw_reset_securitypriv(struct adapter *adapter) /* We have to backup the PMK information for WiFi PMK Caching test item. */ /* Backup the btkip_countermeasure information. */ /* When the countermeasure is trigger, the driver have to disconnect with AP for 60 seconds. */ - memset(&backup_pmkid[0], 0x00, sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE); memcpy(&backup_pmkid[0], &adapter->securitypriv.PMKIDList[0], sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE); backup_index = adapter->securitypriv.PMKIDIndex; backup_counter = adapter->securitypriv.btkip_countermeasure; -- cgit v1.2.3 From 25d5546c3bb00ee263b459b663197651c09d4a80 Mon Sep 17 00:00:00 2001 From: Yeliz Taneroglu Date: Fri, 27 Feb 2015 12:58:09 +0200 Subject: Staging: rtl8723au: Remove white space before semicolon drivers/staging/rtl8723au/core/rtw_cmd.c warning: space prohibited before semicolon Signed-off-by: Yeliz Taneroglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c b/drivers/staging/rtl8723au/core/rtw_cmd.c index 2447a56df838..f6b99d8e1878 100644 --- a/drivers/staging/rtl8723au/core/rtw_cmd.c +++ b/drivers/staging/rtl8723au/core/rtw_cmd.c @@ -1368,7 +1368,7 @@ void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nCan't alloc sta_info when " "createbss_cmd_callback\n")); - goto createbss_cmd_fail ; + goto createbss_cmd_fail; } } -- cgit v1.2.3 From 9110e0ad3884575b641975cd1e58aedfadbb78b5 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:49:27 +0200 Subject: staging: wlan-ng: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2sta.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index 10ad24a89ddd..77e0f896bd49 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -243,7 +243,6 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, struct p80211_metawep *p80211_wep) { hfa384x_t *hw = (hfa384x_t *) wlandev->priv; - int result; /* If necessary, set the 802.11 WEP bit */ if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == @@ -251,9 +250,7 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1)); } - result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep); - - return result; + return hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep); } /*---------------------------------------------------------------- -- cgit v1.2.3 From c732041b72506f4f6622debe057bd8f35ce2009f Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:50:34 +0200 Subject: staging: wlan-ng: remove unused variable This patch removes variables that were simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2mib.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c index 0163e062b650..b4a15ef3a405 100644 --- a/drivers/staging/wlan-ng/prism2mib.c +++ b/drivers/staging/wlan-ng/prism2mib.c @@ -582,8 +582,6 @@ static int prism2mib_privacyinvoked(struct mibrec *mib, struct p80211msg_dot11req_mibset *msg, void *data) { - int result; - if (wlandev->hostwep & HOSTWEP_DECRYPT) { if (wlandev->hostwep & HOSTWEP_DECRYPT) mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_RXCRYPT; @@ -591,9 +589,7 @@ static int prism2mib_privacyinvoked(struct mibrec *mib, mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_TXCRYPT; } - result = prism2mib_flag(mib, isget, wlandev, hw, msg, data); - - return result; + return prism2mib_flag(mib, isget, wlandev, hw, msg, data); } /*---------------------------------------------------------------- @@ -628,11 +624,8 @@ static int prism2mib_excludeunencrypted(struct mibrec *mib, struct p80211msg_dot11req_mibset *msg, void *data) { - int result; - - result = prism2mib_flag(mib, isget, wlandev, hw, msg, data); - return result; + return prism2mib_flag(mib, isget, wlandev, hw, msg, data); } /*---------------------------------------------------------------- -- cgit v1.2.3 From 838ec194a9d631a0e1b5e96c5440b563a5438144 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 15:08:38 +0200 Subject: staging: iio: meter: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7759.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c index b0c7dbc8a428..694e0ce1f277 100644 --- a/drivers/staging/iio/meter/ade7759.c +++ b/drivers/staging/iio/meter/ade7759.c @@ -215,18 +215,15 @@ error_ret: static int ade7759_reset(struct device *dev) { - int ret; u16 val; ade7759_spi_read_reg_16(dev, ADE7759_MODE, &val); val |= 1 << 6; /* Software Chip Reset */ - ret = ade7759_spi_write_reg_16(dev, + return ade7759_spi_write_reg_16(dev, ADE7759_MODE, val); - - return ret; } static IIO_DEV_ATTR_AENERGY(ade7759_read_40bit, ADE7759_AENERGY); -- cgit v1.2.3 From d8f6fa2b73894f52f5fc415138a00403ada57891 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 15:09:53 +0200 Subject: staging: iio: light: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/light/tsl2583.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c index 8afae8e33d56..b5e1b8b0a6f0 100644 --- a/drivers/staging/iio/light/tsl2583.c +++ b/drivers/staging/iio/light/tsl2583.c @@ -471,14 +471,12 @@ static int taos_chip_on(struct iio_dev *indio_dev) static int taos_chip_off(struct iio_dev *indio_dev) { struct tsl2583_chip *chip = iio_priv(indio_dev); - int ret; /* turn device off */ chip->taos_chip_status = TSL258X_CHIP_SUSPENDED; - ret = i2c_smbus_write_byte_data(chip->client, + return i2c_smbus_write_byte_data(chip->client, TSL258X_CMD_REG | TSL258X_CNTRL, 0x00); - return ret; } /* Sysfs Interface Functions */ -- cgit v1.2.3 From e867919757d716bfbff93556f45a1d779b6b5f36 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:55:16 +0200 Subject: staging: lustre: ptlrpc: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index d5fd7215c72f..371af9c7ba89 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -912,7 +912,6 @@ static int nrs_register_policies_locked(struct ptlrpc_nrs *nrs) static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs, struct ptlrpc_service_part *svcpt) { - int rc; enum ptlrpc_nrs_queue_type queue; LASSERT(mutex_is_locked(&nrs_core.nrs_mutex)); @@ -930,9 +929,7 @@ static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs, INIT_LIST_HEAD(&nrs->nrs_policy_list); INIT_LIST_HEAD(&nrs->nrs_policy_queued); - rc = nrs_register_policies_locked(nrs); - - return rc; + return nrs_register_policies_locked(nrs); } /** -- cgit v1.2.3 From cf9cac2286b61f1b5ed0da01daa4e574e491ad92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 27 Feb 2015 21:54:22 +0200 Subject: Staging: lustre: lustre: ptlrpc: Add space ERROR: "(foo*)" should be "(foo *)".That's why add space together. That Error found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/layout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index bbef666b1d16..44ae2f13ea90 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -811,8 +811,8 @@ struct req_capsule; .rmf_name = (name), \ .rmf_flags = (flags), \ .rmf_size = (size), \ - .rmf_swabber = (void (*)(void*))(swabber), \ - .rmf_dumper = (void (*)(void*))(dumper) \ + .rmf_swabber = (void (*)(void *))(swabber), \ + .rmf_dumper = (void (*)(void *))(dumper) \ } struct req_msg_field RMF_GENERIC_DATA = -- cgit v1.2.3 From 5a091a1ff82eee5aae584e812831a9d671d94382 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 15:07:58 +0200 Subject: staging: lustre: llite: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/dcache.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index ddf1fa9f67f8..3078dd93dc28 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -339,13 +339,10 @@ static int ll_revalidate_dentry(struct dentry *dentry, */ static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags) { - int rc; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, flags=%u\n", dentry, flags); - rc = ll_revalidate_dentry(dentry, flags); - return rc; + return ll_revalidate_dentry(dentry, flags); } -- cgit v1.2.3 From 107d22095d72a93b6063f2298a0abc0231a15497 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 15:06:53 +0200 Subject: staging: lustre: llite: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/lproc_llite.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index aaa13bd3e8de..35e0b39c2772 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -789,11 +789,8 @@ static int ll_xattr_cache_seq_show(struct seq_file *m, void *v) { struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); - int rc; - - rc = seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled); - return rc; + return seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled); } static ssize_t ll_xattr_cache_seq_write(struct file *file, -- cgit v1.2.3 From e78fd57966afb96dece2cb3578410587cd496a66 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 15:01:05 +0200 Subject: staging: lustre: mdc: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index ef2744700d8b..c04eec5c603e 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2707,14 +2707,12 @@ static struct md_ops mdc_md_ops = { static int __init mdc_init(void) { - int rc; struct lprocfs_static_vars lvars = { NULL }; lprocfs_mdc_init_vars(&lvars); - rc = class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars, + return class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars, LUSTRE_MDC_NAME, NULL); - return rc; } static void /*__exit*/ mdc_exit(void) -- cgit v1.2.3 From aba5c1396a0838a394694ae26c0eaf86e8238f6c Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:59:42 +0200 Subject: staging: lustre: mgc: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 8d3dbdce04ff..b24457554798 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -690,8 +690,6 @@ static int mgc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) static int mgc_cleanup(struct obd_device *obd) { - int rc; - /* COMPAT_146 - old config logs may have added profiles we don't know about */ if (obd->obd_type->typ_refcnt <= 1) @@ -701,8 +699,7 @@ static int mgc_cleanup(struct obd_device *obd) lprocfs_obd_cleanup(obd); ptlrpcd_decref(); - rc = client_obd_cleanup(obd); - return rc; + return client_obd_cleanup(obd); } static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) -- cgit v1.2.3 From 5cf00deef38f1be51ca8df30472dfd1db9df5693 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:57:56 +0200 Subject: staging: lustre: obdclass: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/dt_object.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdclass/dt_object.c b/drivers/staging/lustre/lustre/obdclass/dt_object.c index e7be26ec7521..b1eee0a6dc9a 100644 --- a/drivers/staging/lustre/lustre/obdclass/dt_object.c +++ b/drivers/staging/lustre/lustre/obdclass/dt_object.c @@ -424,11 +424,8 @@ EXPORT_SYMBOL(dt_find_or_create); /* dt class init function. */ int dt_global_init(void) { - int result; - LU_CONTEXT_KEY_INIT(&dt_key); - result = lu_context_key_register(&dt_key); - return result; + return lu_context_key_register(&dt_key); } void dt_global_fini(void) -- cgit v1.2.3 From 5d311af062eea4505da611bd7369ee6bd2ffafff Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:57:10 +0200 Subject: staging: lustre: obdclass: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 83bf168c2939..e104662e2180 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -1769,8 +1769,6 @@ EXPORT_SYMBOL(lu_env_refill); int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, __u32 stags) { - int result; - if ((env->le_ctx.lc_tags & ctags) != ctags) { env->le_ctx.lc_version = 0; env->le_ctx.lc_tags |= ctags; @@ -1781,9 +1779,7 @@ int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, env->le_ses->lc_tags |= stags; } - result = lu_env_refill(env); - - return result; + return lu_env_refill(env); } EXPORT_SYMBOL(lu_env_refill_by_tags); -- cgit v1.2.3 From d9518b7657f9501c604615d0f54cf0fba681c5c2 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:56:28 +0200 Subject: staging: lustre: obdecho: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdecho/echo_client.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 5f6d9441bc44..7f578b43e66d 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -2158,7 +2158,6 @@ void echo_client_exit(void) static int __init obdecho_init(void) { struct lprocfs_static_vars lvars; - int rc; LCONSOLE_INFO("Echo OBD driver; http://www.lustre.org/\n"); @@ -2167,9 +2166,7 @@ static int __init obdecho_init(void) lprocfs_echo_init_vars(&lvars); - rc = echo_client_init(); - - return rc; + return echo_client_init(); } static void /*__exit*/ obdecho_exit(void) -- cgit v1.2.3 From e6eae365ad2273571c19aa2a8b5460874cd507d6 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 14:55:54 +0200 Subject: staging: lustre: osc: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/lproc_osc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index 1795d3a7a029..3ef2b554b65c 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -164,16 +164,13 @@ static int osc_cached_mb_seq_show(struct seq_file *m, void *v) struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; int shift = 20 - PAGE_CACHE_SHIFT; - int rc; - rc = seq_printf(m, + return seq_printf(m, "used_mb: %d\n" "busy_cnt: %d\n", (atomic_read(&cli->cl_lru_in_list) + atomic_read(&cli->cl_lru_busy)) >> shift, atomic_read(&cli->cl_lru_busy)); - - return rc; } /* shrink the number of caching pages to a specific number */ -- cgit v1.2.3 From 382e095525513c2500363cafe6043da1533aae1d Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Fri, 27 Feb 2015 15:05:45 +0200 Subject: Staging: lustre: Added #include instead of #include The following patch fixes the checkpatch.pl warning: WARNING: Use #include instead of #include Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/lproc_osc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index 3ef2b554b65c..f16089a1245a 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -35,7 +35,7 @@ */ #define DEBUG_SUBSYSTEM S_CLASS -#include +#include #include "../include/obd_cksum.h" #include "../include/obd_class.h" #include "../include/lprocfs_status.h" -- cgit v1.2.3 From 75f0cef5c4de1a3d6e96cd8e789f3f20356e478c Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 27 Feb 2015 21:56:24 +0300 Subject: Staging: lustre: lustre: ldlm: Fix do not add new typedefs This patch fixes "do not add new typedefs" warning generated by checkpatch.pl. Update related files. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 6 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index 20e64cddb1f4..17271b0965bc 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -131,12 +131,12 @@ struct ldlm_cb_set_arg { union ldlm_gl_desc *gl_desc; /* glimpse AST descriptor */ }; -typedef enum { +enum ldlm_desc_ast_t { LDLM_WORK_BL_AST, LDLM_WORK_CP_AST, LDLM_WORK_REVOKE_AST, LDLM_WORK_GL_AST -} ldlm_desc_ast_t; +}; void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list); int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill, @@ -155,7 +155,7 @@ void ldlm_lock_decref_internal_nolock(struct ldlm_lock *, __u32 mode); void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, struct list_head *work_list); int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list, - ldlm_desc_ast_t ast_type); + enum ldlm_desc_ast_t ast_type); int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq); int ldlm_lock_remove_from_lru(struct ldlm_lock *lock); int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 8191005464b1..d7fa934549bf 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1805,7 +1805,7 @@ int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) * one. */ int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list, - ldlm_desc_ast_t ast_type) + enum ldlm_desc_ast_t ast_type) { struct ldlm_cb_set_arg *arg; set_producer_func work_ast_lock; -- cgit v1.2.3 From ded9f908dac718834e7c9a2c4ffc85df817c6031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 27 Feb 2015 21:34:25 +0200 Subject: Staging: lustre: lustre: obdecho: Add blank line after declarations The following patch fixes the checkpatch.pl warning: drivers/staging/lustre/lustre/obdecho/echo_client.c WARNING: Missing a blank line after declarations Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdecho/echo_client.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 7f578b43e66d..a38032965f7f 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -146,6 +146,7 @@ static struct lu_context_key echo_thread_key; static inline struct echo_thread_info *echo_env_info(const struct lu_env *env) { struct echo_thread_info *info; + info = lu_context_key_get(&env->le_ctx, &echo_thread_key); LASSERT(info != NULL); return info; @@ -637,6 +638,7 @@ static void echo_thread_key_fini(const struct lu_context *ctx, struct lu_context_key *key, void *data) { struct echo_thread_info *info = data; + OBD_SLAB_FREE_PTR(info, echo_thread_kmem); } @@ -667,6 +669,7 @@ static void echo_session_key_fini(const struct lu_context *ctx, struct lu_context_key *key, void *data) { struct echo_session_info *session = data; + OBD_SLAB_FREE_PTR(session, echo_session_kmem); } @@ -783,6 +786,7 @@ out: switch (cleanup) { case 4: { int rc2; + rc2 = echo_client_cleanup(obd); if (rc2) CERROR("Cleanup obd device %s error(%d)\n", @@ -958,11 +962,13 @@ static struct echo_object *cl_echo_object_find(struct echo_device *d, if (d->ed_next) { if (!d->ed_next_islov) { struct lov_oinfo *oinfo = lsm->lsm_oinfo[0]; + LASSERT(oinfo != NULL); oinfo->loi_oi = lsm->lsm_oi; conf->eoc_cl.u.coc_oinfo = oinfo; } else { struct lustre_md *md; + md = &info->eti_md; memset(md, 0, sizeof(*md)); md->lsm = lsm; @@ -1011,6 +1017,7 @@ static int cl_echo_object_put(struct echo_object *eco) /* an external function to kill an object? */ if (eco->eo_deleted) { struct lu_object_header *loh = obj->co_lu.lo_header; + LASSERT(&eco->eo_hdr == luh2coh(loh)); set_bit(LU_OBJECT_HEARD_BANSHEE, &loh->loh_flags); } @@ -1152,6 +1159,7 @@ static int cl_echo_async_brw(const struct lu_env *env, struct cl_io *io, cl_page_list_for_each_safe(clp, temp, &queue->c2_qin) { int rc; + rc = cl_page_cache_add(env, io, clp, CRT_WRITE); if (rc == 0) continue; @@ -1615,6 +1623,7 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, if (verify) { int vrc; + vrc = echo_client_page_debug_check(lsm, pgp->pg, ostid_id(&oa->o_oi), pgp->off, pgp->count); @@ -1911,6 +1920,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len, rc = echo_get_object(&eco, ed, oa); if (rc == 0) { struct obd_info oinfo = { { { 0 } } }; + oinfo.oi_md = eco->eo_lsm; oinfo.oi_oa = oa; rc = obd_getattr(env, ec->ec_exp, &oinfo); @@ -1927,6 +1937,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len, rc = echo_get_object(&eco, ed, oa); if (rc == 0) { struct obd_info oinfo = { { { 0 } } }; + oinfo.oi_oa = oa; oinfo.oi_md = eco->eo_lsm; -- cgit v1.2.3 From e8df67dad536a3b7eed8ee8e49fa8f2cca2bebed Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 27 Feb 2015 21:23:35 +0200 Subject: Staging: lustre: Add blank line after declarations WARNING: "Missing a blank line after declarations" Add blank line after declarations. That was found by running checkpatch Signed-off-by: Melike Yurtoglu Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/connection.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/connection.c b/drivers/staging/lustre/lustre/ptlrpc/connection.c index 2a875ab57911..7e27397ce384 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/connection.c +++ b/drivers/staging/lustre/lustre/ptlrpc/connection.c @@ -184,6 +184,7 @@ static void * conn_key(struct hlist_node *hnode) { struct ptlrpc_connection *conn; + conn = hlist_entry(hnode, struct ptlrpc_connection, c_hash); return &conn->c_peer; } -- cgit v1.2.3 From d7a5b788a92391311d0cc0b714039544379b1e91 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 27 Feb 2015 21:51:02 +0200 Subject: Staging: lustre: Remove return in void function WARNING: void function return statements are not generally useful Remove return in void function. That was found by running checkpatch. Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 4882dd0a4483..0f83492ecacc 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -468,7 +468,6 @@ void ptlrpc_add_rqs_to_pool(struct ptlrpc_request_pool *pool, int num_rq) list_add_tail(&req->rq_list, &pool->prp_req_list); } spin_unlock(&pool->prp_lock); - return; } EXPORT_SYMBOL(ptlrpc_add_rqs_to_pool); -- cgit v1.2.3 From 5b9359f120dba3637338c4d63aeda976a8d15587 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 27 Feb 2015 21:51:03 +0200 Subject: Staging: lustre: Remove unnecessary else after return WARNING: else is not generally useful after a break or return Remove unnecessary else after return. That was found by running checkpatch Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 0f83492ecacc..2ccb72a47a25 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1438,12 +1438,11 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) if (req->rq_err) { req->rq_status = rc; return 1; - } else { - spin_lock(&req->rq_lock); - req->rq_wait_ctx = 1; - spin_unlock(&req->rq_lock); - return 0; } + spin_lock(&req->rq_lock); + req->rq_wait_ctx = 1; + spin_unlock(&req->rq_lock); + return 0; } CDEBUG(D_RPCTRACE, "Sending RPC pname:cluuid:pid:xid:nid:opc %s:%s:%d:%llu:%s:%d\n", -- cgit v1.2.3 From 295ce74f950368749af1580903077fa340df3ffa Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 27 Feb 2015 21:51:04 +0200 Subject: Staging: lustre: Deleted space prohibited between function name and open parenthesis WARNING: space prohibited between function name and open parenthesis '(' Remove unnecessary space between function name and opening parenthesis. That was found by running checkpatch Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 2ccb72a47a25..0fe6a641092b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -2190,7 +2190,7 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set) if (set->set_interpret != NULL) { int (*interpreter)(struct ptlrpc_request_set *set, void *, int) = set->set_interpret; - rc = interpreter (set, set->set_arg, rc); + rc = interpreter(set, set->set_arg, rc); } else { struct ptlrpc_set_cbdata *cbdata, *n; int err; -- cgit v1.2.3 From 5dd70706cf54b597bf764ecb019e44168ab67bae Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 27 Feb 2015 22:15:12 +0200 Subject: Staging: lustre: Removed space prohibited WARNING: space prohibited before that '--' Removed space prohibited. That was found by running checkpatch. Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 44ae2f13ea90..a42335e26de9 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -1839,7 +1839,7 @@ static int __req_capsule_offset(const struct req_capsule *pill, LASSERTF(offset > 0, "%s:%s, off=%d, loc=%d\n", pill->rc_fmt->rf_name, field->rmf_name, offset, loc); - offset --; + offset--; LASSERT(0 <= offset && offset < REQ_MAX_FIELD_NR); return offset; -- cgit v1.2.3 From 7c30daaa382566f70666b8297c1f5271050e39f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 27 Feb 2015 22:21:50 +0200 Subject: Staging: lustre: lnet: selftest: Remove space after the name of that function Fix checkpatch.pl issues with "space prohibited between function name and open parenthesis" in console.c Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/console.c | 80 +++++++++++++------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 1e0afc286847..2b5f53c7a730 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -64,7 +64,7 @@ lstcon_session_t console_session; static void lstcon_node_get(lstcon_node_t *nd) { - LASSERT (nd->nd_ref >= 1); + LASSERT(nd->nd_ref >= 1); nd->nd_ref++; } @@ -75,7 +75,7 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create) lstcon_ndlink_t *ndl; unsigned int idx = LNET_NIDADDR(id.nid) % LST_GLOBAL_HASHSIZE; - LASSERT (id.nid != LNET_NID_ANY); + LASSERT(id.nid != LNET_NID_ANY); list_for_each_entry(ndl, &console_session.ses_ndl_hash[idx], ndl_hlink) { if (ndl->ndl_node->nd_id.nid != id.nid || @@ -119,15 +119,15 @@ lstcon_node_put(lstcon_node_t *nd) { lstcon_ndlink_t *ndl; - LASSERT (nd->nd_ref > 0); + LASSERT(nd->nd_ref > 0); if (--nd->nd_ref > 0) return; ndl = (lstcon_ndlink_t *)(nd + 1); - LASSERT (!list_empty(&ndl->ndl_link)); - LASSERT (!list_empty(&ndl->ndl_hlink)); + LASSERT(!list_empty(&ndl->ndl_link)); + LASSERT(!list_empty(&ndl->ndl_hlink)); /* remove from session */ list_del(&ndl->ndl_link); @@ -184,8 +184,8 @@ lstcon_ndlink_find(struct list_head *hash, static void lstcon_ndlink_release(lstcon_ndlink_t *ndl) { - LASSERT (list_empty(&ndl->ndl_link)); - LASSERT (!list_empty(&ndl->ndl_hlink)); + LASSERT(list_empty(&ndl->ndl_link)); + LASSERT(!list_empty(&ndl->ndl_hlink)); list_del(&ndl->ndl_hlink); /* delete from hash */ lstcon_node_put(ndl->ndl_node); @@ -254,7 +254,7 @@ lstcon_group_decref(lstcon_group_t *grp) lstcon_group_drain(grp, 0); for (i = 0; i < LST_NODE_HASHSIZE; i++) { - LASSERT (list_empty(&grp->grp_ndl_hash[i])); + LASSERT(list_empty(&grp->grp_ndl_hash[i])); } LIBCFS_FREE(grp, offsetof(lstcon_group_t, @@ -552,8 +552,8 @@ lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up, lstcon_group_t *grp; int rc; - LASSERT (count > 0); - LASSERT (ids_up != NULL); + LASSERT(count > 0); + LASSERT(ids_up != NULL); rc = lstcon_group_find(name, &grp); if (rc != 0) { @@ -726,8 +726,8 @@ lstcon_group_list(int index, int len, char *name_up) { lstcon_group_t *grp; - LASSERT (index >= 0); - LASSERT (name_up != NULL); + LASSERT(index >= 0); + LASSERT(name_up != NULL); list_for_each_entry(grp, &console_session.ses_grp_list, grp_link) { if (index-- == 0) { @@ -748,10 +748,10 @@ lstcon_nodes_getent(struct list_head *head, int *index_p, int count = 0; int index = 0; - LASSERT (index_p != NULL && count_p != NULL); - LASSERT (dents_up != NULL); - LASSERT (*index_p >= 0); - LASSERT (*count_p > 0); + LASSERT(index_p != NULL && count_p != NULL); + LASSERT(dents_up != NULL); + LASSERT(*index_p >= 0); + LASSERT(*count_p > 0); list_for_each_entry(ndl, head, ndl_link) { if (index++ < *index_p) @@ -905,8 +905,8 @@ lstcon_batch_list(int index, int len, char *name_up) { lstcon_batch_t *bat; - LASSERT (name_up != NULL); - LASSERT (index >= 0); + LASSERT(name_up != NULL); + LASSERT(index >= 0); list_for_each_entry(bat, &console_session.ses_bat_list, bat_link) { if (index-- == 0) { @@ -1093,7 +1093,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat) while (!list_empty(&bat->bat_test_list)) { test = list_entry(bat->bat_test_list.next, lstcon_test_t, tes_link); - LASSERT (list_empty(&test->tes_trans_list)); + LASSERT(list_empty(&test->tes_trans_list)); list_del(&test->tes_link); @@ -1104,7 +1104,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat) tes_param[test->tes_paramlen])); } - LASSERT (list_empty(&bat->bat_trans_list)); + LASSERT(list_empty(&bat->bat_trans_list)); while (!list_empty(&bat->bat_cli_list)) { ndl = list_entry(bat->bat_cli_list.next, @@ -1123,8 +1123,8 @@ lstcon_batch_destroy(lstcon_batch_t *bat) } for (i = 0; i < LST_NODE_HASHSIZE; i++) { - LASSERT (list_empty(&bat->bat_cli_hash[i])); - LASSERT (list_empty(&bat->bat_srv_hash[i])); + LASSERT(list_empty(&bat->bat_cli_hash[i])); + LASSERT(list_empty(&bat->bat_srv_hash[i])); } LIBCFS_FREE(bat->bat_cli_hash, @@ -1144,10 +1144,10 @@ lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg) struct list_head *head; test = (lstcon_test_t *)arg; - LASSERT (test != NULL); + LASSERT(test != NULL); batch = test->tes_batch; - LASSERT (batch != NULL); + LASSERT(batch != NULL); if (test->tes_oneside && transop == LST_TRANS_TSBSRVADD) @@ -1161,13 +1161,13 @@ lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg) head = &batch->bat_cli_list; } else { - LASSERT (transop == LST_TRANS_TSBSRVADD); + LASSERT(transop == LST_TRANS_TSBSRVADD); hash = batch->bat_srv_hash; head = &batch->bat_srv_list; } - LASSERT (nd->nd_id.nid != LNET_NID_ANY); + LASSERT(nd->nd_id.nid != LNET_NID_ANY); if (lstcon_ndlink_find(hash, nd->nd_id, &ndl, 1) != 0) return -ENOMEM; @@ -1186,8 +1186,8 @@ lstcon_test_nodes_add(lstcon_test_t *test, struct list_head *result_up) int transop; int rc; - LASSERT (test->tes_src_grp != NULL); - LASSERT (test->tes_dst_grp != NULL); + LASSERT(test->tes_src_grp != NULL); + LASSERT(test->tes_dst_grp != NULL); transop = LST_TRANS_TSBSRVADD; grp = test->tes_dst_grp; @@ -1382,7 +1382,7 @@ lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg, { srpc_batch_reply_t *rep = &msg->msg_body.bat_reply; - LASSERT (transop == LST_TRANS_TSBCLIQRY || + LASSERT(transop == LST_TRANS_TSBCLIQRY || transop == LST_TRANS_TSBSRVQRY); /* positive errno, framework error code */ @@ -1691,7 +1691,7 @@ lstcon_new_session_id(lst_sid_t *sid) { lnet_process_id_t id; - LASSERT (console_session.ses_state == LST_SESSION_NONE); + LASSERT(console_session.ses_state == LST_SESSION_NONE); LNetGetId(1, &id); sid->ses_nid = id.nid; @@ -1806,7 +1806,7 @@ lstcon_session_end(void) lstcon_batch_t *bat; int rc = 0; - LASSERT (console_session.ses_state == LST_SESSION_ACTIVE); + LASSERT(console_session.ses_state == LST_SESSION_ACTIVE); rc = lstcon_rpc_trans_ndlist(&console_session.ses_ndl_list, NULL, LST_TRANS_SESEND, NULL, @@ -1846,13 +1846,13 @@ lstcon_session_end(void) while (!list_empty(&console_session.ses_grp_list)) { grp = list_entry(console_session.ses_grp_list.next, lstcon_group_t, grp_link); - LASSERT (grp->grp_ref == 1); + LASSERT(grp->grp_ref == 1); lstcon_group_put(grp); } /* all nodes should be released */ - LASSERT (list_empty(&console_session.ses_ndl_list)); + LASSERT(list_empty(&console_session.ses_ndl_list)); console_session.ses_shutdown = 0; console_session.ses_expired = 0; @@ -1892,7 +1892,7 @@ lstcon_session_feats_check(unsigned feats) } static int -lstcon_acceptor_handle (srpc_server_rpc_t *rpc) +lstcon_acceptor_handle(srpc_server_rpc_t *rpc) { srpc_msg_t *rep = &rpc->srpc_replymsg; srpc_msg_t *req = &rpc->srpc_reqstbuf->buf_msg; @@ -2026,7 +2026,7 @@ lstcon_console_init(void) lstcon_init_acceptor_service(); rc = srpc_add_service(&lstcon_acceptor_service); - LASSERT (rc != -EBUSY); + LASSERT(rc != -EBUSY); if (rc != 0) { LIBCFS_FREE(console_session.ses_ndl_hash, sizeof(struct list_head) * LST_GLOBAL_HASHSIZE); @@ -2078,13 +2078,13 @@ lstcon_console_fini(void) mutex_unlock(&console_session.ses_mutex); - LASSERT (list_empty(&console_session.ses_ndl_list)); - LASSERT (list_empty(&console_session.ses_grp_list)); - LASSERT (list_empty(&console_session.ses_bat_list)); - LASSERT (list_empty(&console_session.ses_trans_list)); + LASSERT(list_empty(&console_session.ses_ndl_list)); + LASSERT(list_empty(&console_session.ses_grp_list)); + LASSERT(list_empty(&console_session.ses_bat_list)); + LASSERT(list_empty(&console_session.ses_trans_list)); for (i = 0; i < LST_NODE_HASHSIZE; i++) { - LASSERT (list_empty(&console_session.ses_ndl_hash[i])); + LASSERT(list_empty(&console_session.ses_ndl_hash[i])); } LIBCFS_FREE(console_session.ses_ndl_hash, -- cgit v1.2.3 From dddf4c23bbf7fde17e949381aa72956a4e518891 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 27 Feb 2015 22:42:09 +0200 Subject: Staging: lustre: Added const WARNING: struct file_operations should normally be const. That was found by running checkpatch. Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 0e2071b8a36e..bc0e8e4fc651 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -1083,7 +1083,7 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry, .data = svc}, {NULL} }; - static struct file_operations req_history_fops = { + static const struct file_operations req_history_fops = { .owner = THIS_MODULE, .open = ptlrpc_lprocfs_svc_req_history_open, .read = seq_read, -- cgit v1.2.3 From b2ca1d8b50431eb7e4233cc34dbbdac669bc878c Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 27 Feb 2015 22:42:11 +0200 Subject: Staging: lustre: Deleted space prohibited between function name and open parenthesis WARNING: space prohibited between function name and open parenthesis '(' Remove unnecessary space between function name and opening parenthesis. That was found by running checkpatch Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index bc0e8e4fc651..6ca7601bedab 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -181,7 +181,7 @@ static const char *ll_eopcode2str(__u32 opcode) return ll_eopcode_table[opcode].opname; } -#if defined (CONFIG_PROC_FS) +#if defined(CONFIG_PROC_FS) static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir, char *name, struct proc_dir_entry **procroot_ret, -- cgit v1.2.3 From a659df625bc1958fe3c1b67fe4132e39507bed07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 27 Feb 2015 22:49:04 +0200 Subject: Staging: lustre: lnet: selftest: Remove space after the name of that function Fix checkpatch.pl issues with "space prohibited between function name and open parenthesis" in rpc.c Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/rpc.c | 136 ++++++++++++++--------------- 1 file changed, 68 insertions(+), 68 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 1f7d9a6248db..10a7027a8c09 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -71,16 +71,16 @@ srpc_serv_portal(int svc_id) } /* forward ref's */ -int srpc_handle_rpc (swi_workitem_t *wi); +int srpc_handle_rpc(swi_workitem_t *wi); -void srpc_get_counters (srpc_counters_t *cnt) +void srpc_get_counters(srpc_counters_t *cnt) { spin_lock(&srpc_data.rpc_glock); *cnt = srpc_data.rpc_counters; spin_unlock(&srpc_data.rpc_glock); } -void srpc_set_counters (const srpc_counters_t *cnt) +void srpc_set_counters(const srpc_counters_t *cnt) { spin_lock(&srpc_data.rpc_glock); srpc_data.rpc_counters = *cnt; @@ -102,12 +102,12 @@ srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, int nob) } void -srpc_free_bulk (srpc_bulk_t *bk) +srpc_free_bulk(srpc_bulk_t *bk) { int i; struct page *pg; - LASSERT (bk != NULL); + LASSERT(bk != NULL); for (i = 0; i < bk->bk_niov; i++) { pg = bk->bk_iovs[i].kiov_page; @@ -160,7 +160,7 @@ srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink) } static inline __u64 -srpc_next_id (void) +srpc_next_id(void) { __u64 id; @@ -335,7 +335,7 @@ srpc_add_service(struct srpc_service *sv) } int -srpc_remove_service (srpc_service_t *sv) +srpc_remove_service(srpc_service_t *sv) { int id = sv->sv_id; @@ -363,8 +363,8 @@ srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf, rc = LNetMEAttach(portal, peer, matchbits, 0, LNET_UNLINK, local ? LNET_INS_LOCAL : LNET_INS_AFTER, &meh); if (rc != 0) { - CERROR ("LNetMEAttach failed: %d\n", rc); - LASSERT (rc == -ENOMEM); + CERROR("LNetMEAttach failed: %d\n", rc); + LASSERT(rc == -ENOMEM); return -ENOMEM; } @@ -377,15 +377,15 @@ srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf, rc = LNetMDAttach(meh, md, LNET_UNLINK, mdh); if (rc != 0) { - CERROR ("LNetMDAttach failed: %d\n", rc); - LASSERT (rc == -ENOMEM); + CERROR("LNetMDAttach failed: %d\n", rc); + LASSERT(rc == -ENOMEM); rc = LNetMEUnlink(meh); - LASSERT (rc == 0); + LASSERT(rc == 0); return -ENOMEM; } - CDEBUG (D_NET, + CDEBUG(D_NET, "Posted passive RDMA: peer %s, portal %d, matchbits %#llx\n", libcfs_id2str(peer), portal, matchbits); return 0; @@ -408,8 +408,8 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, rc = LNetMDBind(md, LNET_UNLINK, mdh); if (rc != 0) { - CERROR ("LNetMDBind failed: %d\n", rc); - LASSERT (rc == -ENOMEM); + CERROR("LNetMDBind failed: %d\n", rc); + LASSERT(rc == -ENOMEM); return -ENOMEM; } @@ -420,13 +420,13 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, rc = LNetPut(self, *mdh, LNET_NOACK_REQ, peer, portal, matchbits, 0, 0); } else { - LASSERT ((options & LNET_MD_OP_GET) != 0); + LASSERT((options & LNET_MD_OP_GET) != 0); rc = LNetGet(self, *mdh, peer, portal, matchbits, 0); } if (rc != 0) { - CERROR ("LNet%s(%s, %d, %lld) failed: %d\n", + CERROR("LNet%s(%s, %d, %lld) failed: %d\n", ((options & LNET_MD_OP_PUT) != 0) ? "Put" : "Get", libcfs_id2str(peer), portal, matchbits, rc); @@ -434,9 +434,9 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, * with failure, so fall through and return success here. */ rc = LNetMDUnlink(*mdh); - LASSERT (rc == 0); + LASSERT(rc == 0); } else { - CDEBUG (D_NET, + CDEBUG(D_NET, "Posted active RDMA: peer %s, portal %u, matchbits %#llx\n", libcfs_id2str(peer), portal, matchbits); } @@ -788,7 +788,7 @@ srpc_shutdown_service(srpc_service_t *sv) } static int -srpc_send_request (srpc_client_rpc_t *rpc) +srpc_send_request(srpc_client_rpc_t *rpc) { srpc_event_t *ev = &rpc->crpc_reqstev; int rc; @@ -801,14 +801,14 @@ srpc_send_request (srpc_client_rpc_t *rpc) &rpc->crpc_reqstmsg, sizeof(srpc_msg_t), &rpc->crpc_reqstmdh, ev); if (rc != 0) { - LASSERT (rc == -ENOMEM); + LASSERT(rc == -ENOMEM); ev->ev_fired = 1; /* no more event expected */ } return rc; } static int -srpc_prepare_reply (srpc_client_rpc_t *rpc) +srpc_prepare_reply(srpc_client_rpc_t *rpc) { srpc_event_t *ev = &rpc->crpc_replyev; __u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.rpyid; @@ -825,14 +825,14 @@ srpc_prepare_reply (srpc_client_rpc_t *rpc) LNET_MD_OP_PUT, rpc->crpc_dest, &rpc->crpc_replymdh, ev); if (rc != 0) { - LASSERT (rc == -ENOMEM); + LASSERT(rc == -ENOMEM); ev->ev_fired = 1; /* no more event expected */ } return rc; } static int -srpc_prepare_bulk (srpc_client_rpc_t *rpc) +srpc_prepare_bulk(srpc_client_rpc_t *rpc) { srpc_bulk_t *bk = &rpc->crpc_bulk; srpc_event_t *ev = &rpc->crpc_bulkev; @@ -840,7 +840,7 @@ srpc_prepare_bulk (srpc_client_rpc_t *rpc) int rc; int opt; - LASSERT (bk->bk_niov <= LNET_MAX_IOV); + LASSERT(bk->bk_niov <= LNET_MAX_IOV); if (bk->bk_niov == 0) return 0; /* nothing to do */ @@ -857,14 +857,14 @@ srpc_prepare_bulk (srpc_client_rpc_t *rpc) &bk->bk_iovs[0], bk->bk_niov, opt, rpc->crpc_dest, &bk->bk_mdh, ev); if (rc != 0) { - LASSERT (rc == -ENOMEM); + LASSERT(rc == -ENOMEM); ev->ev_fired = 1; /* no more event expected */ } return rc; } static int -srpc_do_bulk (srpc_server_rpc_t *rpc) +srpc_do_bulk(srpc_server_rpc_t *rpc) { srpc_event_t *ev = &rpc->srpc_ev; srpc_bulk_t *bk = rpc->srpc_bulk; @@ -872,7 +872,7 @@ srpc_do_bulk (srpc_server_rpc_t *rpc) int rc; int opt; - LASSERT (bk != NULL); + LASSERT(bk != NULL); opt = bk->bk_sink ? LNET_MD_OP_GET : LNET_MD_OP_PUT; opt |= LNET_MD_KIOV; @@ -898,11 +898,11 @@ srpc_server_rpc_done(srpc_server_rpc_t *rpc, int status) struct srpc_service *sv = scd->scd_svc; srpc_buffer_t *buffer; - LASSERT (status != 0 || rpc->srpc_wi.swi_state == SWI_STATE_DONE); + LASSERT(status != 0 || rpc->srpc_wi.swi_state == SWI_STATE_DONE); rpc->srpc_status = status; - CDEBUG_LIMIT (status == 0 ? D_NET : D_NETERROR, + CDEBUG_LIMIT(status == 0 ? D_NET : D_NETERROR, "Server RPC %p done: service %s, peer %s, status %s:%d\n", rpc, sv->sv_name, libcfs_id2str(rpc->srpc_peer), swi_state2str(rpc->srpc_wi.swi_state), status); @@ -985,7 +985,7 @@ srpc_handle_rpc(swi_workitem_t *wi) switch (wi->swi_state) { default: - LBUG (); + LBUG(); case SWI_STATE_NEWBORN: { srpc_msg_t *msg; srpc_generic_reply_t *reply; @@ -1023,12 +1023,12 @@ srpc_handle_rpc(swi_workitem_t *wi) if (rc == 0) return 0; /* wait for bulk */ - LASSERT (ev->ev_fired); + LASSERT(ev->ev_fired); ev->ev_status = rc; } } case SWI_STATE_BULK_STARTED: - LASSERT (rpc->srpc_bulk == NULL || ev->ev_fired); + LASSERT(rpc->srpc_bulk == NULL || ev->ev_fired); if (rpc->srpc_bulk != NULL) { rc = ev->ev_status; @@ -1055,7 +1055,7 @@ srpc_handle_rpc(swi_workitem_t *wi) rpc, rpc->srpc_bulk, sv->sv_id); CERROR("Event: status %d, type %d, lnet %d\n", ev->ev_status, ev->ev_type, ev->ev_lnet); - LASSERT (ev->ev_fired); + LASSERT(ev->ev_fired); } wi->swi_state = SWI_STATE_DONE; @@ -1067,11 +1067,11 @@ srpc_handle_rpc(swi_workitem_t *wi) } static void -srpc_client_rpc_expired (void *data) +srpc_client_rpc_expired(void *data) { srpc_client_rpc_t *rpc = data; - CWARN ("Client RPC expired: service %d, peer %s, timeout %d.\n", + CWARN("Client RPC expired: service %d, peer %s, timeout %d.\n", rpc->crpc_service, libcfs_id2str(rpc->crpc_dest), rpc->crpc_timeout); @@ -1088,7 +1088,7 @@ srpc_client_rpc_expired (void *data) } inline void -srpc_add_client_rpc_timer (srpc_client_rpc_t *rpc) +srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc) { stt_timer_t *timer = &rpc->crpc_timer; @@ -1109,7 +1109,7 @@ srpc_add_client_rpc_timer (srpc_client_rpc_t *rpc) * Upon exit the RPC expiry timer is not queued and the handler is not * running on any CPU. */ static void -srpc_del_client_rpc_timer (srpc_client_rpc_t *rpc) +srpc_del_client_rpc_timer(srpc_client_rpc_t *rpc) { /* timer not planted or already exploded */ if (rpc->crpc_timeout == 0) @@ -1130,7 +1130,7 @@ srpc_del_client_rpc_timer (srpc_client_rpc_t *rpc) } static void -srpc_client_rpc_done (srpc_client_rpc_t *rpc, int status) +srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status) { swi_workitem_t *wi = &rpc->crpc_wi; @@ -1144,7 +1144,7 @@ srpc_client_rpc_done (srpc_client_rpc_t *rpc, int status) srpc_del_client_rpc_timer(rpc); - CDEBUG_LIMIT ((status == 0) ? D_NET : D_NETERROR, + CDEBUG_LIMIT((status == 0) ? D_NET : D_NETERROR, "Client RPC done: service %d, peer %s, status %s:%d:%d\n", rpc->crpc_service, libcfs_id2str(rpc->crpc_dest), swi_state2str(wi->swi_state), rpc->crpc_aborted, status); @@ -1157,7 +1157,7 @@ srpc_client_rpc_done (srpc_client_rpc_t *rpc, int status) * scheduling me. * Cancel pending schedules and prevent future schedule attempts: */ - LASSERT (!srpc_event_pending(rpc)); + LASSERT(!srpc_event_pending(rpc)); swi_exit_workitem(wi); spin_unlock(&rpc->crpc_lock); @@ -1168,7 +1168,7 @@ srpc_client_rpc_done (srpc_client_rpc_t *rpc, int status) /* sends an outgoing RPC */ int -srpc_send_rpc (swi_workitem_t *wi) +srpc_send_rpc(swi_workitem_t *wi) { int rc = 0; srpc_client_rpc_t *rpc; @@ -1179,8 +1179,8 @@ srpc_send_rpc (swi_workitem_t *wi) rpc = wi->swi_workitem.wi_data; - LASSERT (rpc != NULL); - LASSERT (wi == &rpc->crpc_wi); + LASSERT(rpc != NULL); + LASSERT(wi == &rpc->crpc_wi); reply = &rpc->crpc_replymsg; do_bulk = rpc->crpc_bulk.bk_niov > 0; @@ -1196,9 +1196,9 @@ srpc_send_rpc (swi_workitem_t *wi) switch (wi->swi_state) { default: - LBUG (); + LBUG(); case SWI_STATE_NEWBORN: - LASSERT (!srpc_event_pending(rpc)); + LASSERT(!srpc_event_pending(rpc)); rc = srpc_prepare_reply(rpc); if (rc != 0) { @@ -1292,7 +1292,7 @@ abort: } srpc_client_rpc_t * -srpc_create_client_rpc (lnet_process_id_t peer, int service, +srpc_create_client_rpc(lnet_process_id_t peer, int service, int nbulkiov, int bulklen, void (*rpc_done)(srpc_client_rpc_t *), void (*rpc_fini)(srpc_client_rpc_t *), void *priv) @@ -1311,15 +1311,15 @@ srpc_create_client_rpc (lnet_process_id_t peer, int service, /* called with rpc->crpc_lock held */ void -srpc_abort_rpc (srpc_client_rpc_t *rpc, int why) +srpc_abort_rpc(srpc_client_rpc_t *rpc, int why) { - LASSERT (why != 0); + LASSERT(why != 0); if (rpc->crpc_aborted || /* already aborted */ rpc->crpc_closed) /* callback imminent */ return; - CDEBUG (D_NET, + CDEBUG(D_NET, "Aborting RPC: service %d, peer %s, state %s, why %d\n", rpc->crpc_service, libcfs_id2str(rpc->crpc_dest), swi_state2str(rpc->crpc_wi.swi_state), why); @@ -1332,12 +1332,12 @@ srpc_abort_rpc (srpc_client_rpc_t *rpc, int why) /* called with rpc->crpc_lock held */ void -srpc_post_rpc (srpc_client_rpc_t *rpc) +srpc_post_rpc(srpc_client_rpc_t *rpc) { - LASSERT (!rpc->crpc_aborted); - LASSERT (srpc_data.rpc_state == SRPC_STATE_RUNNING); + LASSERT(!rpc->crpc_aborted); + LASSERT(srpc_data.rpc_state == SRPC_STATE_RUNNING); - CDEBUG (D_NET, "Posting RPC: peer %s, service %d, timeout %d\n", + CDEBUG(D_NET, "Posting RPC: peer %s, service %d, timeout %d\n", libcfs_id2str(rpc->crpc_dest), rpc->crpc_service, rpc->crpc_timeout); @@ -1403,7 +1403,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) srpc_msg_t *msg; srpc_msg_type_t type; - LASSERT (!in_interrupt()); + LASSERT(!in_interrupt()); if (ev->status != 0) { spin_lock(&srpc_data.rpc_glock); @@ -1417,7 +1417,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) default: CERROR("Unknown event: status %d, type %d, lnet %d\n", rpcev->ev_status, rpcev->ev_type, rpcev->ev_lnet); - LBUG (); + LBUG(); case SRPC_REQUEST_SENT: if (ev->status == 0 && ev->type != LNET_EVENT_UNLINK) { spin_lock(&srpc_data.rpc_glock); @@ -1436,7 +1436,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) &crpc->crpc_replyev, &crpc->crpc_bulkev); CERROR("Bad event: status %d, type %d, lnet %d\n", rpcev->ev_status, rpcev->ev_type, rpcev->ev_lnet); - LBUG (); + LBUG(); } spin_lock(&crpc->crpc_lock); @@ -1458,10 +1458,10 @@ srpc_lnet_ev_handler(lnet_event_t *ev) spin_lock(&scd->scd_lock); - LASSERT (ev->unlinked); - LASSERT (ev->type == LNET_EVENT_PUT || + LASSERT(ev->unlinked); + LASSERT(ev->type == LNET_EVENT_PUT || ev->type == LNET_EVENT_UNLINK); - LASSERT (ev->type != LNET_EVENT_UNLINK || + LASSERT(ev->type != LNET_EVENT_UNLINK || sv->sv_shuttingdown); buffer = container_of(ev->md.start, srpc_buffer_t, buf_msg); @@ -1536,7 +1536,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) break; case SRPC_BULK_GET_RPLD: - LASSERT (ev->type == LNET_EVENT_SEND || + LASSERT(ev->type == LNET_EVENT_SEND || ev->type == LNET_EVENT_REPLY || ev->type == LNET_EVENT_UNLINK); @@ -1574,7 +1574,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) int -srpc_startup (void) +srpc_startup(void) { int rc; @@ -1590,7 +1590,7 @@ srpc_startup (void) rc = LNetNIInit(LUSTRE_SRV_LNET_PID); if (rc < 0) { - CERROR ("LNetNIInit() has failed: %d\n", rc); + CERROR("LNetNIInit() has failed: %d\n", rc); return rc; } @@ -1622,7 +1622,7 @@ bail: } void -srpc_shutdown (void) +srpc_shutdown(void) { int i; int rc; @@ -1633,14 +1633,14 @@ srpc_shutdown (void) switch (state) { default: - LBUG (); + LBUG(); case SRPC_STATE_RUNNING: spin_lock(&srpc_data.rpc_glock); for (i = 0; i <= SRPC_SERVICE_MAX_ID; i++) { srpc_service_t *sv = srpc_data.rpc_services[i]; - LASSERTF (sv == NULL, + LASSERTF(sv == NULL, "service not empty: id %d, name %s\n", i, sv->sv_name); } @@ -1652,9 +1652,9 @@ srpc_shutdown (void) case SRPC_STATE_EQ_INIT: rc = LNetClearLazyPortal(SRPC_FRAMEWORK_REQUEST_PORTAL); rc = LNetClearLazyPortal(SRPC_REQUEST_PORTAL); - LASSERT (rc == 0); + LASSERT(rc == 0); rc = LNetEQFree(srpc_data.rpc_lnet_eq); - LASSERT (rc == 0); /* the EQ should have no user by now */ + LASSERT(rc == 0); /* the EQ should have no user by now */ case SRPC_STATE_NI_INIT: LNetNIFini(); -- cgit v1.2.3 From 39c09ce258dc5a4b8def5aad89680339a8888f03 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 27 Feb 2015 22:55:50 +0200 Subject: Staging: lustre: Removed necessary braces {} Deleted {}.Because braces {} are not necessary for single statement blocks Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 371af9c7ba89..81ad7473242e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -155,9 +155,8 @@ static void nrs_policy_stop_primary(struct ptlrpc_nrs *nrs) { struct ptlrpc_nrs_policy *tmp = nrs->nrs_policy_primary; - if (tmp == NULL) { + if (tmp == NULL) return; - } nrs->nrs_policy_primary = NULL; -- cgit v1.2.3 From f64a6f3cfdfb7f87ef739c946ceb6bc8ecaa3e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 27 Feb 2015 23:10:06 +0200 Subject: Staging: lustre: lnet: selftest: Trailing statements Trailing statements should be on next line. This Error found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/rpc.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 10a7027a8c09..080788ab749e 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -111,7 +111,8 @@ srpc_free_bulk(srpc_bulk_t *bk) for (i = 0; i < bk->bk_niov; i++) { pg = bk->bk_iovs[i].kiov_page; - if (pg == NULL) break; + if (pg == NULL) + break; __free_page(pg); } @@ -842,7 +843,8 @@ srpc_prepare_bulk(srpc_client_rpc_t *rpc) LASSERT(bk->bk_niov <= LNET_MAX_IOV); - if (bk->bk_niov == 0) return 0; /* nothing to do */ + if (bk->bk_niov == 0) + return 0; /* nothing to do */ opt = bk->bk_sink ? LNET_MD_OP_PUT : LNET_MD_OP_GET; opt |= LNET_MD_KIOV; @@ -1092,7 +1094,8 @@ srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc) { stt_timer_t *timer = &rpc->crpc_timer; - if (rpc->crpc_timeout == 0) return; + if (rpc->crpc_timeout == 0) + return; INIT_LIST_HEAD(&timer->stt_list); timer->stt_data = rpc; @@ -1207,7 +1210,8 @@ srpc_send_rpc(swi_workitem_t *wi) } rc = srpc_prepare_bulk(rpc); - if (rc != 0) break; + if (rc != 0) + break; wi->swi_state = SWI_STATE_REQUEST_SUBMITTED; rc = srpc_send_request(rpc); @@ -1217,20 +1221,24 @@ srpc_send_rpc(swi_workitem_t *wi) /* CAVEAT EMPTOR: rqtev, rpyev, and bulkev may come in any * order; however, they're processed in a strict order: * rqt, rpy, and bulk. */ - if (!rpc->crpc_reqstev.ev_fired) break; + if (!rpc->crpc_reqstev.ev_fired) + break; rc = rpc->crpc_reqstev.ev_status; - if (rc != 0) break; + if (rc != 0) + break; wi->swi_state = SWI_STATE_REQUEST_SENT; /* perhaps more events, fall thru */ case SWI_STATE_REQUEST_SENT: { srpc_msg_type_t type = srpc_service2reply(rpc->crpc_service); - if (!rpc->crpc_replyev.ev_fired) break; + if (!rpc->crpc_replyev.ev_fired) + break; rc = rpc->crpc_replyev.ev_status; - if (rc != 0) break; + if (rc != 0) + break; srpc_unpack_msg_hdr(reply); if (reply->msg_type != type || @@ -1254,7 +1262,8 @@ srpc_send_rpc(swi_workitem_t *wi) wi->swi_state = SWI_STATE_REPLY_RECEIVED; } case SWI_STATE_REPLY_RECEIVED: - if (do_bulk && !rpc->crpc_bulkev.ev_fired) break; + if (do_bulk && !rpc->crpc_bulkev.ev_fired) + break; rc = do_bulk ? rpc->crpc_bulkev.ev_status : 0; -- cgit v1.2.3 From a71fe4fbac8a96034be9694e7268271a5614a509 Mon Sep 17 00:00:00 2001 From: Melike Yurtoglu Date: Fri, 27 Feb 2015 23:25:55 +0200 Subject: Staging: lustre: Deleted space prohibited between function name and open parenthesis WARNING: space prohibited between function name and open parenthesis '(' Remove unnecessary space between function name and opening parenthesis. That was found by running checkpatch Signed-off-by: Melike Yurtoglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 7fe2e584ffd7..a66dc3c6da41 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -76,7 +76,7 @@ void ptlrpc_initiate_recovery(struct obd_import *imp); int lustre_unpack_req_ptlrpc_body(struct ptlrpc_request *req, int offset); int lustre_unpack_rep_ptlrpc_body(struct ptlrpc_request *req, int offset); -#if defined (CONFIG_PROC_FS) +#if defined(CONFIG_PROC_FS) void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry, struct ptlrpc_service *svc); void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc); @@ -263,7 +263,7 @@ void sptlrpc_enc_pool_fini(void); int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v); /* sec_lproc.c */ -#if defined (CONFIG_PROC_FS) +#if defined(CONFIG_PROC_FS) int sptlrpc_lproc_init(void); void sptlrpc_lproc_fini(void); #else -- cgit v1.2.3 From 939af333863ce12e9fcea2312ecc79f94af20f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 27 Feb 2015 23:32:45 +0200 Subject: Staging: lustre: lnet: lnet: Remove space after the name of that function Fix checkpatch.pl issues with "space prohibited between function name and open parenthesis" in router.c Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/router.c | 74 +++++++++++++++---------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 52ec0ab7e3c3..c0a6aebea351 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -225,7 +225,7 @@ lnet_rtr_decref_locked(lnet_peer_t *lp) } lnet_remotenet_t * -lnet_find_net_locked (__u32 net) +lnet_find_net_locked(__u32 net) { lnet_remotenet_t *rnet; struct list_head *tmp; @@ -274,7 +274,7 @@ static void lnet_shuffle_seed(void) /* NB expects LNET_LOCK held */ static void -lnet_add_route_to_rnet (lnet_remotenet_t *rnet, lnet_route_t *route) +lnet_add_route_to_rnet(lnet_remotenet_t *rnet, lnet_route_t *route) { unsigned int len = 0; unsigned int offset = 0; @@ -282,13 +282,13 @@ lnet_add_route_to_rnet (lnet_remotenet_t *rnet, lnet_route_t *route) lnet_shuffle_seed(); - list_for_each (e, &rnet->lrn_routes) { + list_for_each(e, &rnet->lrn_routes) { len++; } /* len+1 positions to add a new entry, also prevents division by 0 */ offset = cfs_rand() % (len + 1); - list_for_each (e, &rnet->lrn_routes) { + list_for_each(e, &rnet->lrn_routes) { if (offset == 0) break; offset--; @@ -364,7 +364,7 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway, return rc; } - LASSERT (!the_lnet.ln_shutdown); + LASSERT(!the_lnet.ln_shutdown); rnet2 = lnet_find_net_locked(net); if (rnet2 == NULL) { @@ -375,7 +375,7 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway, /* Search for a duplicate route (it's a NOOP if it is) */ add_route = 1; - list_for_each (e, &rnet2->lrn_routes) { + list_for_each(e, &rnet2->lrn_routes) { lnet_route_t *route2 = list_entry(e, lnet_route_t, lr_list); if (route2->lr_gateway == route->lr_gateway) { @@ -384,7 +384,7 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway, } /* our lookups must be true */ - LASSERT (route2->lr_gateway->lp_nid != gateway); + LASSERT(route2->lr_gateway->lp_nid != gateway); } if (add_route) { @@ -546,7 +546,7 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid) } void -lnet_destroy_routes (void) +lnet_destroy_routes(void) { lnet_del_route(LNET_NIDNET(LNET_NID_ANY), LNET_NID_ANY); } @@ -758,13 +758,13 @@ lnet_wait_known_routerstate(void) struct list_head *entry; int all_known; - LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); + LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); for (;;) { int cpt = lnet_net_lock_current(); all_known = 1; - list_for_each (entry, &the_lnet.ln_routers) { + list_for_each(entry, &the_lnet.ln_routers) { rtr = list_entry(entry, lnet_peer_t, lp_rtr_list); if (rtr->lp_alive_count == 0) { @@ -886,7 +886,7 @@ lnet_create_rc_data_locked(lnet_peer_t *gateway) } rcd->rcd_pinginfo = pi; - LASSERT (!LNetHandleIsInvalid(the_lnet.ln_rc_eqh)); + LASSERT(!LNetHandleIsInvalid(the_lnet.ln_rc_eqh)); rc = LNetMDBind((lnet_md_t){.start = pi, .user_ptr = rcd, .length = LNET_PINGINFO_SIZE, @@ -929,7 +929,7 @@ lnet_create_rc_data_locked(lnet_peer_t *gateway) } static int -lnet_router_check_interval (lnet_peer_t *rtr) +lnet_router_check_interval(lnet_peer_t *rtr) { int secs; @@ -942,7 +942,7 @@ lnet_router_check_interval (lnet_peer_t *rtr) } static void -lnet_ping_router_locked (lnet_peer_t *rtr) +lnet_ping_router_locked(lnet_peer_t *rtr) { lnet_rc_data_t *rcd = NULL; unsigned long now = cfs_time_current(); @@ -1019,7 +1019,7 @@ lnet_router_checker_start(void) int rc; int eqsz; - LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_SHUTDOWN); + LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_SHUTDOWN); if (check_routers_before_use && dead_router_check_interval <= 0) { @@ -1067,14 +1067,14 @@ lnet_router_checker_start(void) } void -lnet_router_checker_stop (void) +lnet_router_checker_stop(void) { int rc; if (the_lnet.ln_rc_state == LNET_RC_STATE_SHUTDOWN) return; - LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); + LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); the_lnet.ln_rc_state = LNET_RC_STATE_STOPPING; /* block until event callback signals exit */ @@ -1082,7 +1082,7 @@ lnet_router_checker_stop (void) LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_SHUTDOWN); rc = LNetEQFree(the_lnet.ln_rc_eqh); - LASSERT (rc == 0); + LASSERT(rc == 0); return; } @@ -1178,7 +1178,7 @@ lnet_router_checker(void *arg) cfs_block_allsigs(); - LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); + LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); while (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING) { __u64 version; @@ -1291,11 +1291,11 @@ lnet_rtrpool_free_bufs(lnet_rtrbufpool_t *rbp) if (rbp->rbp_nbuffers == 0) /* not initialized or already freed */ return; - LASSERT (list_empty(&rbp->rbp_msgs)); - LASSERT (rbp->rbp_credits == rbp->rbp_nbuffers); + LASSERT(list_empty(&rbp->rbp_msgs)); + LASSERT(rbp->rbp_credits == rbp->rbp_nbuffers); while (!list_empty(&rbp->rbp_bufs)) { - LASSERT (rbp->rbp_credits > 0); + LASSERT(rbp->rbp_credits > 0); rb = list_entry(rbp->rbp_bufs.next, lnet_rtrbuf_t, rb_list); @@ -1304,8 +1304,8 @@ lnet_rtrpool_free_bufs(lnet_rtrbufpool_t *rbp) nbuffers++; } - LASSERT (rbp->rbp_nbuffers == nbuffers); - LASSERT (rbp->rbp_credits == nbuffers); + LASSERT(rbp->rbp_nbuffers == nbuffers); + LASSERT(rbp->rbp_credits == nbuffers); rbp->rbp_nbuffers = rbp->rbp_credits = 0; } @@ -1317,7 +1317,7 @@ lnet_rtrpool_alloc_bufs(lnet_rtrbufpool_t *rbp, int nbufs, int cpt) int i; if (rbp->rbp_nbuffers != 0) { - LASSERT (rbp->rbp_nbuffers == nbufs); + LASSERT(rbp->rbp_nbuffers == nbufs); return 0; } @@ -1337,10 +1337,10 @@ lnet_rtrpool_alloc_bufs(lnet_rtrbufpool_t *rbp, int nbufs, int cpt) /* No allocation "under fire" */ /* Otherwise we'd need code to schedule blocked msgs etc */ - LASSERT (!the_lnet.ln_routing); + LASSERT(!the_lnet.ln_routing); } - LASSERT (rbp->rbp_credits == nbufs); + LASSERT(rbp->rbp_credits == nbufs); return 0; } @@ -1513,16 +1513,16 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when) unsigned long now = cfs_time_current(); int cpt = lnet_cpt_of_nid(nid); - LASSERT (!in_interrupt ()); + LASSERT(!in_interrupt ()); - CDEBUG (D_NET, "%s notifying %s: %s\n", + CDEBUG(D_NET, "%s notifying %s: %s\n", (ni == NULL) ? "userspace" : libcfs_nid2str(ni->ni_nid), libcfs_nid2str(nid), alive ? "up" : "down"); if (ni != NULL && LNET_NIDNET(ni->ni_nid) != LNET_NIDNET(nid)) { - CWARN ("Ignoring notification of %s %s by %s (different net)\n", + CWARN("Ignoring notification of %s %s by %s (different net)\n", libcfs_nid2str(nid), alive ? "birth" : "death", libcfs_nid2str(ni->ni_nid)); return -EINVAL; @@ -1577,7 +1577,7 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when) EXPORT_SYMBOL(lnet_notify); void -lnet_get_tunables (void) +lnet_get_tunables(void) { return; } @@ -1585,13 +1585,13 @@ lnet_get_tunables (void) #else int -lnet_notify (lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when) +lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when) { return -EOPNOTSUPP; } void -lnet_router_checker (void) +lnet_router_checker(void) { static time_t last; static int running; @@ -1643,7 +1643,7 @@ lnet_router_checker (void) abort(); } - LASSERT (rc == 1); + LASSERT(rc == 1); lnet_router_checker_event(&ev); } @@ -1655,14 +1655,14 @@ lnet_router_checker (void) return; } - LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); + LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); lnet_net_lock(0); version = the_lnet.ln_routers_version; - list_for_each_entry (rtr, &the_lnet.ln_routers, lp_rtr_list) { + list_for_each_entry(rtr, &the_lnet.ln_routers, lp_rtr_list) { lnet_ping_router_locked(rtr); - LASSERT (version == the_lnet.ln_routers_version); + LASSERT(version == the_lnet.ln_routers_version); } lnet_net_unlock(0); @@ -1674,7 +1674,7 @@ lnet_router_checker (void) /* NB lnet_peers_start_down depends on me, * so must be called before any peer creation */ void -lnet_get_tunables (void) +lnet_get_tunables(void) { char *s; -- cgit v1.2.3 From d4de2ab88a0beba603ce222740d369d167881514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Sat, 28 Feb 2015 00:23:32 +0200 Subject: Staging: lustre: lnet: klnds: socklnd: Remove space after the name of that function Fix checkpatch.pl issues with "space prohibited between function name and open parenthesis" in socklnd Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 448 ++++++++++----------- 1 file changed, 224 insertions(+), 224 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 5956dbac5d04..f815bb81fb5e 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -65,15 +65,15 @@ ksocknal_ip2iface(lnet_ni_t *ni, __u32 ip) } static ksock_route_t * -ksocknal_create_route (__u32 ipaddr, int port) +ksocknal_create_route(__u32 ipaddr, int port) { ksock_route_t *route; - LIBCFS_ALLOC (route, sizeof (*route)); + LIBCFS_ALLOC(route, sizeof(*route)); if (route == NULL) return NULL; - atomic_set (&route->ksnr_refcount, 1); + atomic_set(&route->ksnr_refcount, 1); route->ksnr_peer = NULL; route->ksnr_retry_interval = 0; /* OK to connect at any time */ route->ksnr_ipaddr = ipaddr; @@ -89,43 +89,43 @@ ksocknal_create_route (__u32 ipaddr, int port) } void -ksocknal_destroy_route (ksock_route_t *route) +ksocknal_destroy_route(ksock_route_t *route) { - LASSERT (atomic_read(&route->ksnr_refcount) == 0); + LASSERT(atomic_read(&route->ksnr_refcount) == 0); if (route->ksnr_peer != NULL) ksocknal_peer_decref(route->ksnr_peer); - LIBCFS_FREE (route, sizeof (*route)); + LIBCFS_FREE(route, sizeof(*route)); } static int -ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id) +ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id) { ksock_net_t *net = ni->ni_data; ksock_peer_t *peer; - LASSERT (id.nid != LNET_NID_ANY); - LASSERT (id.pid != LNET_PID_ANY); - LASSERT (!in_interrupt()); + LASSERT(id.nid != LNET_NID_ANY); + LASSERT(id.pid != LNET_PID_ANY); + LASSERT(!in_interrupt()); - LIBCFS_ALLOC (peer, sizeof (*peer)); + LIBCFS_ALLOC(peer, sizeof(*peer)); if (peer == NULL) return -ENOMEM; peer->ksnp_ni = ni; peer->ksnp_id = id; - atomic_set (&peer->ksnp_refcount, 1); /* 1 ref for caller */ + atomic_set(&peer->ksnp_refcount, 1); /* 1 ref for caller */ peer->ksnp_closing = 0; peer->ksnp_accepting = 0; peer->ksnp_proto = NULL; peer->ksnp_last_alive = 0; peer->ksnp_zc_next_cookie = SOCKNAL_KEEPALIVE_PING + 1; - INIT_LIST_HEAD (&peer->ksnp_conns); - INIT_LIST_HEAD (&peer->ksnp_routes); - INIT_LIST_HEAD (&peer->ksnp_tx_queue); - INIT_LIST_HEAD (&peer->ksnp_zc_req_list); + INIT_LIST_HEAD(&peer->ksnp_conns); + INIT_LIST_HEAD(&peer->ksnp_routes); + INIT_LIST_HEAD(&peer->ksnp_tx_queue); + INIT_LIST_HEAD(&peer->ksnp_zc_req_list); spin_lock_init(&peer->ksnp_lock); spin_lock_bh(&net->ksnn_lock); @@ -147,21 +147,21 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id) } void -ksocknal_destroy_peer (ksock_peer_t *peer) +ksocknal_destroy_peer(ksock_peer_t *peer) { ksock_net_t *net = peer->ksnp_ni->ni_data; - CDEBUG (D_NET, "peer %s %p deleted\n", + CDEBUG(D_NET, "peer %s %p deleted\n", libcfs_id2str(peer->ksnp_id), peer); - LASSERT (atomic_read (&peer->ksnp_refcount) == 0); - LASSERT (peer->ksnp_accepting == 0); - LASSERT (list_empty (&peer->ksnp_conns)); - LASSERT (list_empty (&peer->ksnp_routes)); - LASSERT (list_empty (&peer->ksnp_tx_queue)); - LASSERT (list_empty (&peer->ksnp_zc_req_list)); + LASSERT(atomic_read(&peer->ksnp_refcount) == 0); + LASSERT(peer->ksnp_accepting == 0); + LASSERT(list_empty(&peer->ksnp_conns)); + LASSERT(list_empty(&peer->ksnp_routes)); + LASSERT(list_empty(&peer->ksnp_tx_queue)); + LASSERT(list_empty(&peer->ksnp_zc_req_list)); - LIBCFS_FREE (peer, sizeof (*peer)); + LIBCFS_FREE(peer, sizeof(*peer)); /* NB a peer's connections and routes keep a reference on their peer * until they are destroyed, so we can be assured that _all_ state to @@ -173,17 +173,17 @@ ksocknal_destroy_peer (ksock_peer_t *peer) } ksock_peer_t * -ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t id) +ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id) { struct list_head *peer_list = ksocknal_nid2peerlist(id.nid); struct list_head *tmp; ksock_peer_t *peer; - list_for_each (tmp, peer_list) { + list_for_each(tmp, peer_list) { - peer = list_entry (tmp, ksock_peer_t, ksnp_list); + peer = list_entry(tmp, ksock_peer_t, ksnp_list); - LASSERT (!peer->ksnp_closing); + LASSERT(!peer->ksnp_closing); if (peer->ksnp_ni != ni) continue; @@ -201,7 +201,7 @@ ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t id) } ksock_peer_t * -ksocknal_find_peer (lnet_ni_t *ni, lnet_process_id_t id) +ksocknal_find_peer(lnet_ni_t *ni, lnet_process_id_t id) { ksock_peer_t *peer; @@ -215,37 +215,37 @@ ksocknal_find_peer (lnet_ni_t *ni, lnet_process_id_t id) } static void -ksocknal_unlink_peer_locked (ksock_peer_t *peer) +ksocknal_unlink_peer_locked(ksock_peer_t *peer) { int i; __u32 ip; ksock_interface_t *iface; for (i = 0; i < peer->ksnp_n_passive_ips; i++) { - LASSERT (i < LNET_MAX_INTERFACES); + LASSERT(i < LNET_MAX_INTERFACES); ip = peer->ksnp_passive_ips[i]; iface = ksocknal_ip2iface(peer->ksnp_ni, ip); /* All IPs in peer->ksnp_passive_ips[] come from the * interface list, therefore the call must succeed. */ - LASSERT (iface != NULL); + LASSERT(iface != NULL); CDEBUG(D_NET, "peer=%p iface=%p ksni_nroutes=%d\n", peer, iface, iface->ksni_nroutes); iface->ksni_npeers--; } - LASSERT (list_empty(&peer->ksnp_conns)); - LASSERT (list_empty(&peer->ksnp_routes)); - LASSERT (!peer->ksnp_closing); + LASSERT(list_empty(&peer->ksnp_conns)); + LASSERT(list_empty(&peer->ksnp_routes)); + LASSERT(!peer->ksnp_closing); peer->ksnp_closing = 1; - list_del (&peer->ksnp_list); + list_del(&peer->ksnp_list); /* lose peerlist's ref */ ksocknal_peer_decref(peer); } static int -ksocknal_get_peer_info (lnet_ni_t *ni, int index, +ksocknal_get_peer_info(lnet_ni_t *ni, int index, lnet_process_id_t *id, __u32 *myip, __u32 *peer_ip, int *port, int *conn_count, int *share_count) { @@ -261,8 +261,8 @@ ksocknal_get_peer_info (lnet_ni_t *ni, int index, for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) { - list_for_each (ptmp, &ksocknal_data.ksnd_peers[i]) { - peer = list_entry (ptmp, ksock_peer_t, ksnp_list); + list_for_each(ptmp, &ksocknal_data.ksnd_peers[i]) { + peer = list_entry(ptmp, ksock_peer_t, ksnp_list); if (peer->ksnp_ni != ni) continue; @@ -296,7 +296,7 @@ ksocknal_get_peer_info (lnet_ni_t *ni, int index, goto out; } - list_for_each (rtmp, &peer->ksnp_routes) { + list_for_each(rtmp, &peer->ksnp_routes) { if (index-- > 0) continue; @@ -364,17 +364,17 @@ ksocknal_associate_route_conn_locked(ksock_route_t *route, ksock_conn_t *conn) } static void -ksocknal_add_route_locked (ksock_peer_t *peer, ksock_route_t *route) +ksocknal_add_route_locked(ksock_peer_t *peer, ksock_route_t *route) { struct list_head *tmp; ksock_conn_t *conn; ksock_route_t *route2; - LASSERT (!peer->ksnp_closing); - LASSERT (route->ksnr_peer == NULL); - LASSERT (!route->ksnr_scheduled); - LASSERT (!route->ksnr_connecting); - LASSERT (route->ksnr_connected == 0); + LASSERT(!peer->ksnp_closing); + LASSERT(route->ksnr_peer == NULL); + LASSERT(!route->ksnr_scheduled); + LASSERT(!route->ksnr_connecting); + LASSERT(route->ksnr_connected == 0); /* LASSERT(unique) */ list_for_each(tmp, &peer->ksnp_routes) { @@ -405,7 +405,7 @@ ksocknal_add_route_locked (ksock_peer_t *peer, ksock_route_t *route) } static void -ksocknal_del_route_locked (ksock_route_t *route) +ksocknal_del_route_locked(ksock_route_t *route) { ksock_peer_t *peer = route->ksnr_peer; ksock_interface_t *iface; @@ -413,16 +413,16 @@ ksocknal_del_route_locked (ksock_route_t *route) struct list_head *ctmp; struct list_head *cnxt; - LASSERT (!route->ksnr_deleted); + LASSERT(!route->ksnr_deleted); /* Close associated conns */ - list_for_each_safe (ctmp, cnxt, &peer->ksnp_conns) { + list_for_each_safe(ctmp, cnxt, &peer->ksnp_conns) { conn = list_entry(ctmp, ksock_conn_t, ksnc_list); if (conn->ksnc_route != route) continue; - ksocknal_close_conn_locked (conn, 0); + ksocknal_close_conn_locked(conn, 0); } if (route->ksnr_myipaddr != 0) { @@ -433,19 +433,19 @@ ksocknal_del_route_locked (ksock_route_t *route) } route->ksnr_deleted = 1; - list_del (&route->ksnr_list); + list_del(&route->ksnr_list); ksocknal_route_decref(route); /* drop peer's ref */ - if (list_empty (&peer->ksnp_routes) && - list_empty (&peer->ksnp_conns)) { + if (list_empty(&peer->ksnp_routes) && + list_empty(&peer->ksnp_conns)) { /* I've just removed the last route to a peer with no active * connections */ - ksocknal_unlink_peer_locked (peer); + ksocknal_unlink_peer_locked(peer); } } int -ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, __u32 ipaddr, int port) +ksocknal_add_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ipaddr, int port) { struct list_head *tmp; ksock_peer_t *peer; @@ -463,7 +463,7 @@ ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, __u32 ipaddr, int port) if (rc != 0) return rc; - route = ksocknal_create_route (ipaddr, port); + route = ksocknal_create_route(ipaddr, port); if (route == NULL) { ksocknal_peer_decref(peer); return -ENOMEM; @@ -472,20 +472,20 @@ ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, __u32 ipaddr, int port) write_lock_bh(&ksocknal_data.ksnd_global_lock); /* always called with a ref on ni, so shutdown can't have started */ - LASSERT (((ksock_net_t *) ni->ni_data)->ksnn_shutdown == 0); + LASSERT(((ksock_net_t *) ni->ni_data)->ksnn_shutdown == 0); - peer2 = ksocknal_find_peer_locked (ni, id); + peer2 = ksocknal_find_peer_locked(ni, id); if (peer2 != NULL) { ksocknal_peer_decref(peer); peer = peer2; } else { /* peer table takes my ref on peer */ - list_add_tail (&peer->ksnp_list, - ksocknal_nid2peerlist (id.nid)); + list_add_tail(&peer->ksnp_list, + ksocknal_nid2peerlist(id.nid)); } route2 = NULL; - list_for_each (tmp, &peer->ksnp_routes) { + list_for_each(tmp, &peer->ksnp_routes) { route2 = list_entry(tmp, ksock_route_t, ksnr_list); if (route2->ksnr_ipaddr == ipaddr) @@ -507,7 +507,7 @@ ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, __u32 ipaddr, int port) } static void -ksocknal_del_peer_locked (ksock_peer_t *peer, __u32 ip) +ksocknal_del_peer_locked(ksock_peer_t *peer, __u32 ip) { ksock_conn_t *conn; ksock_route_t *route; @@ -515,12 +515,12 @@ ksocknal_del_peer_locked (ksock_peer_t *peer, __u32 ip) struct list_head *nxt; int nshared; - LASSERT (!peer->ksnp_closing); + LASSERT(!peer->ksnp_closing); /* Extra ref prevents peer disappearing until I'm done with it */ ksocknal_peer_addref(peer); - list_for_each_safe (tmp, nxt, &peer->ksnp_routes) { + list_for_each_safe(tmp, nxt, &peer->ksnp_routes) { route = list_entry(tmp, ksock_route_t, ksnr_list); /* no match */ @@ -529,11 +529,11 @@ ksocknal_del_peer_locked (ksock_peer_t *peer, __u32 ip) route->ksnr_share_count = 0; /* This deletes associated conns too */ - ksocknal_del_route_locked (route); + ksocknal_del_route_locked(route); } nshared = 0; - list_for_each_safe (tmp, nxt, &peer->ksnp_routes) { + list_for_each_safe(tmp, nxt, &peer->ksnp_routes) { route = list_entry(tmp, ksock_route_t, ksnr_list); nshared += route->ksnr_share_count; } @@ -542,15 +542,15 @@ ksocknal_del_peer_locked (ksock_peer_t *peer, __u32 ip) /* remove everything else if there are no explicit entries * left */ - list_for_each_safe (tmp, nxt, &peer->ksnp_routes) { + list_for_each_safe(tmp, nxt, &peer->ksnp_routes) { route = list_entry(tmp, ksock_route_t, ksnr_list); /* we should only be removing auto-entries */ LASSERT(route->ksnr_share_count == 0); - ksocknal_del_route_locked (route); + ksocknal_del_route_locked(route); } - list_for_each_safe (tmp, nxt, &peer->ksnp_conns) { + list_for_each_safe(tmp, nxt, &peer->ksnp_conns) { conn = list_entry(tmp, ksock_conn_t, ksnc_list); ksocknal_close_conn_locked(conn, 0); @@ -562,9 +562,9 @@ ksocknal_del_peer_locked (ksock_peer_t *peer, __u32 ip) } static int -ksocknal_del_peer (lnet_ni_t *ni, lnet_process_id_t id, __u32 ip) +ksocknal_del_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); struct list_head *ptmp; struct list_head *pnxt; ksock_peer_t *peer; @@ -583,9 +583,9 @@ ksocknal_del_peer (lnet_ni_t *ni, lnet_process_id_t id, __u32 ip) } for (i = lo; i <= hi; i++) { - list_for_each_safe (ptmp, pnxt, + list_for_each_safe(ptmp, pnxt, &ksocknal_data.ksnd_peers[i]) { - peer = list_entry (ptmp, ksock_peer_t, ksnp_list); + peer = list_entry(ptmp, ksock_peer_t, ksnp_list); if (peer->ksnp_ni != ni) continue; @@ -596,12 +596,12 @@ ksocknal_del_peer (lnet_ni_t *ni, lnet_process_id_t id, __u32 ip) ksocknal_peer_addref(peer); /* a ref for me... */ - ksocknal_del_peer_locked (peer, ip); + ksocknal_del_peer_locked(peer, ip); if (peer->ksnp_closing && !list_empty(&peer->ksnp_tx_queue)) { - LASSERT (list_empty(&peer->ksnp_conns)); - LASSERT (list_empty(&peer->ksnp_routes)); + LASSERT(list_empty(&peer->ksnp_conns)); + LASSERT(list_empty(&peer->ksnp_routes)); list_splice_init(&peer->ksnp_tx_queue, &zombies); @@ -621,7 +621,7 @@ ksocknal_del_peer (lnet_ni_t *ni, lnet_process_id_t id, __u32 ip) } static ksock_conn_t * -ksocknal_get_conn_by_idx (lnet_ni_t *ni, int index) +ksocknal_get_conn_by_idx(lnet_ni_t *ni, int index) { ksock_peer_t *peer; struct list_head *ptmp; @@ -632,19 +632,19 @@ ksocknal_get_conn_by_idx (lnet_ni_t *ni, int index) read_lock(&ksocknal_data.ksnd_global_lock); for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) { - list_for_each (ptmp, &ksocknal_data.ksnd_peers[i]) { - peer = list_entry (ptmp, ksock_peer_t, ksnp_list); + list_for_each(ptmp, &ksocknal_data.ksnd_peers[i]) { + peer = list_entry(ptmp, ksock_peer_t, ksnp_list); - LASSERT (!peer->ksnp_closing); + LASSERT(!peer->ksnp_closing); if (peer->ksnp_ni != ni) continue; - list_for_each (ctmp, &peer->ksnp_conns) { + list_for_each(ctmp, &peer->ksnp_conns) { if (index-- > 0) continue; - conn = list_entry (ctmp, ksock_conn_t, + conn = list_entry(ctmp, ksock_conn_t, ksnc_list); ksocknal_conn_addref(conn); read_unlock(&ksocknal_data.ksnd_global_lock); @@ -681,7 +681,7 @@ ksocknal_choose_scheduler_locked(unsigned int cpt) } static int -ksocknal_local_ipvec (lnet_ni_t *ni, __u32 *ipaddrs) +ksocknal_local_ipvec(lnet_ni_t *ni, __u32 *ipaddrs) { ksock_net_t *net = ni->ni_data; int i; @@ -690,7 +690,7 @@ ksocknal_local_ipvec (lnet_ni_t *ni, __u32 *ipaddrs) read_lock(&ksocknal_data.ksnd_global_lock); nip = net->ksnn_ninterfaces; - LASSERT (nip <= LNET_MAX_INTERFACES); + LASSERT(nip <= LNET_MAX_INTERFACES); /* Only offer interfaces for additional connections if I have * more than one. */ @@ -701,7 +701,7 @@ ksocknal_local_ipvec (lnet_ni_t *ni, __u32 *ipaddrs) for (i = 0; i < nip; i++) { ipaddrs[i] = net->ksnn_interfaces[i].ksni_ipaddr; - LASSERT (ipaddrs[i] != 0); + LASSERT(ipaddrs[i] != 0); } read_unlock(&ksocknal_data.ksnd_global_lock); @@ -709,7 +709,7 @@ ksocknal_local_ipvec (lnet_ni_t *ni, __u32 *ipaddrs) } static int -ksocknal_match_peerip (ksock_interface_t *iface, __u32 *ips, int nips) +ksocknal_match_peerip(ksock_interface_t *iface, __u32 *ips, int nips) { int best_netmatch = 0; int best_xor = 0; @@ -736,7 +736,7 @@ ksocknal_match_peerip (ksock_interface_t *iface, __u32 *ips, int nips) best_xor = this_xor; } - LASSERT (best >= 0); + LASSERT(best >= 0); return best; } @@ -767,8 +767,8 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips) write_lock_bh(global_lock); - LASSERT (n_peerips <= LNET_MAX_INTERFACES); - LASSERT (net->ksnn_ninterfaces <= LNET_MAX_INTERFACES); + LASSERT(n_peerips <= LNET_MAX_INTERFACES); + LASSERT(net->ksnn_ninterfaces <= LNET_MAX_INTERFACES); /* Only match interfaces for additional connections * if I have > 1 interface */ @@ -791,7 +791,7 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips) } else { /* choose a new interface */ - LASSERT (i == peer->ksnp_n_passive_ips); + LASSERT(i == peer->ksnp_n_passive_ips); best_iface = NULL; best_netmatch = 0; @@ -874,7 +874,7 @@ ksocknal_create_routes(ksock_peer_t *peer, int port, return; } - LASSERT (npeer_ipaddrs <= LNET_MAX_INTERFACES); + LASSERT(npeer_ipaddrs <= LNET_MAX_INTERFACES); for (i = 0; i < npeer_ipaddrs; i++) { if (newroute != NULL) { @@ -911,7 +911,7 @@ ksocknal_create_routes(ksock_peer_t *peer, int port, best_nroutes = 0; best_netmatch = 0; - LASSERT (net->ksnn_ninterfaces <= LNET_MAX_INTERFACES); + LASSERT(net->ksnn_ninterfaces <= LNET_MAX_INTERFACES); /* Select interface to connect from */ for (j = 0; j < net->ksnn_ninterfaces; j++) { @@ -961,7 +961,7 @@ ksocknal_create_routes(ksock_peer_t *peer, int port, } int -ksocknal_accept (lnet_ni_t *ni, struct socket *sock) +ksocknal_accept(lnet_ni_t *ni, struct socket *sock) { ksock_connreq_t *cr; int rc; @@ -969,7 +969,7 @@ ksocknal_accept (lnet_ni_t *ni, struct socket *sock) int peer_port; rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); - LASSERT (rc == 0); /* we succeeded before */ + LASSERT(rc == 0); /* we succeeded before */ LIBCFS_ALLOC(cr, sizeof(*cr)); if (cr == NULL) { @@ -992,11 +992,11 @@ ksocknal_accept (lnet_ni_t *ni, struct socket *sock) } static int -ksocknal_connecting (ksock_peer_t *peer, __u32 ipaddr) +ksocknal_connecting(ksock_peer_t *peer, __u32 ipaddr) { ksock_route_t *route; - list_for_each_entry (route, &peer->ksnp_routes, ksnr_list) { + list_for_each_entry(route, &peer->ksnp_routes, ksnr_list) { if (route->ksnr_ipaddr == ipaddr) return route->ksnr_connecting; @@ -1005,11 +1005,11 @@ ksocknal_connecting (ksock_peer_t *peer, __u32 ipaddr) } int -ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, +ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, struct socket *sock, int type) { rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; - LIST_HEAD (zombies); + LIST_HEAD(zombies); lnet_process_id_t peerid; struct list_head *tmp; __u64 incarnation; @@ -1028,7 +1028,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, active = (route != NULL); - LASSERT (active == (type != SOCKLND_CONN_NONE)); + LASSERT(active == (type != SOCKLND_CONN_NONE)); LIBCFS_ALLOC(conn, sizeof(*conn)); if (conn == NULL) { @@ -1041,19 +1041,19 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, conn->ksnc_sock = sock; /* 2 ref, 1 for conn, another extra ref prevents socket * being closed before establishment of connection */ - atomic_set (&conn->ksnc_sock_refcount, 2); + atomic_set(&conn->ksnc_sock_refcount, 2); conn->ksnc_type = type; ksocknal_lib_save_callback(sock, conn); - atomic_set (&conn->ksnc_conn_refcount, 1); /* 1 ref for me */ + atomic_set(&conn->ksnc_conn_refcount, 1); /* 1 ref for me */ conn->ksnc_rx_ready = 0; conn->ksnc_rx_scheduled = 0; - INIT_LIST_HEAD (&conn->ksnc_tx_queue); + INIT_LIST_HEAD(&conn->ksnc_tx_queue); conn->ksnc_tx_ready = 0; conn->ksnc_tx_scheduled = 0; conn->ksnc_tx_carrier = NULL; - atomic_set (&conn->ksnc_tx_nob, 0); + atomic_set(&conn->ksnc_tx_nob, 0); LIBCFS_ALLOC(hello, offsetof(ksock_hello_msg_t, kshm_ips[LNET_MAX_INTERFACES])); @@ -1063,7 +1063,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, } /* stash conn's local and remote addrs */ - rc = ksocknal_lib_get_conn_addrs (conn); + rc = ksocknal_lib_get_conn_addrs(conn); if (rc != 0) goto failed_1; @@ -1094,7 +1094,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, #endif } - rc = ksocknal_send_hello (ni, conn, peerid.nid, hello); + rc = ksocknal_send_hello(ni, conn, peerid.nid, hello); if (rc != 0) goto failed_1; } else { @@ -1105,13 +1105,13 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, conn->ksnc_proto = NULL; } - rc = ksocknal_recv_hello (ni, conn, hello, &peerid, &incarnation); + rc = ksocknal_recv_hello(ni, conn, hello, &peerid, &incarnation); if (rc < 0) goto failed_1; - LASSERT (rc == 0 || active); - LASSERT (conn->ksnc_proto != NULL); - LASSERT (peerid.nid != LNET_NID_ANY); + LASSERT(rc == 0 || active); + LASSERT(conn->ksnc_proto != NULL); + LASSERT(peerid.nid != LNET_NID_ANY); cpt = lnet_cpt_of_nid(peerid.nid); @@ -1126,7 +1126,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, write_lock_bh(global_lock); /* called with a ref on ni, so shutdown can't have started */ - LASSERT (((ksock_net_t *) ni->ni_data)->ksnn_shutdown == 0); + LASSERT(((ksock_net_t *) ni->ni_data)->ksnn_shutdown == 0); peer2 = ksocknal_find_peer_locked(ni, peerid); if (peer2 == NULL) { @@ -1166,7 +1166,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, * NB recv_hello may have returned EPROTO to signal my peer * wants a different protocol than the one I asked for. */ - LASSERT (list_empty(&peer->ksnp_conns)); + LASSERT(list_empty(&peer->ksnp_conns)); peer->ksnp_proto = conn->ksnc_proto; peer->ksnp_incarnation = incarnation; @@ -1211,7 +1211,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, /* Reply on a passive connection attempt so the peer * realises we're connected. */ - LASSERT (rc == 0); + LASSERT(rc == 0); if (!active) rc = EALREADY; @@ -1235,7 +1235,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, * create an association. This allows incoming connections created * by routes in my peer to match my own route entries so I don't * continually create duplicate routes. */ - list_for_each (tmp, &peer->ksnp_routes) { + list_for_each(tmp, &peer->ksnp_routes) { route = list_entry(tmp, ksock_route_t, ksnr_list); if (route->ksnr_ipaddr != conn->ksnc_ipaddr) @@ -1260,7 +1260,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, conn->ksnc_tx_deadline = cfs_time_shift(*ksocknal_tunables.ksnd_timeout); mb(); /* order with adding to peer's conn list */ - list_add (&conn->ksnc_list, &peer->ksnp_conns); + list_add(&conn->ksnc_list, &peer->ksnp_conns); ksocknal_conn_addref(conn); ksocknal_new_packet(conn, 0); @@ -1272,8 +1272,8 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, if (conn->ksnc_proto->pro_match_tx(conn, tx, tx->tx_nonblk) == SOCKNAL_MATCH_NO) continue; - list_del (&tx->tx_list); - ksocknal_queue_tx_locked (tx, conn); + list_del(&tx->tx_list); + ksocknal_queue_tx_locked(tx, conn); } write_unlock_bh(global_lock); @@ -1343,8 +1343,8 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, failed_2: if (!peer->ksnp_closing && - list_empty (&peer->ksnp_conns) && - list_empty (&peer->ksnp_routes)) { + list_empty(&peer->ksnp_conns) && + list_empty(&peer->ksnp_routes)) { list_add(&zombies, &peer->ksnp_tx_queue); list_del_init(&peer->ksnp_tx_queue); ksocknal_unlink_peer_locked(peer); @@ -1383,7 +1383,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t, kshm_ips[LNET_MAX_INTERFACES])); - LIBCFS_FREE (conn, sizeof(*conn)); + LIBCFS_FREE(conn, sizeof(*conn)); failed_0: libcfs_sock_release(sock); @@ -1391,7 +1391,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, } void -ksocknal_close_conn_locked (ksock_conn_t *conn, int error) +ksocknal_close_conn_locked(ksock_conn_t *conn, int error) { /* This just does the immmediate housekeeping, and queues the * connection for the reaper to terminate. @@ -1401,18 +1401,18 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int error) ksock_conn_t *conn2; struct list_head *tmp; - LASSERT (peer->ksnp_error == 0); - LASSERT (!conn->ksnc_closing); + LASSERT(peer->ksnp_error == 0); + LASSERT(!conn->ksnc_closing); conn->ksnc_closing = 1; /* ksnd_deathrow_conns takes over peer's ref */ - list_del (&conn->ksnc_list); + list_del(&conn->ksnc_list); route = conn->ksnc_route; if (route != NULL) { /* dissociate conn from route... */ - LASSERT (!route->ksnr_deleted); - LASSERT ((route->ksnr_connected & (1 << conn->ksnc_type)) != 0); + LASSERT(!route->ksnr_deleted); + LASSERT((route->ksnr_connected & (1 << conn->ksnc_type)) != 0); conn2 = NULL; list_for_each(tmp, &peer->ksnp_conns) { @@ -1431,19 +1431,19 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int error) #if 0 /* irrelevant with only eager routes */ /* make route least favourite */ - list_del (&route->ksnr_list); - list_add_tail (&route->ksnr_list, &peer->ksnp_routes); + list_del(&route->ksnr_list); + list_add_tail(&route->ksnr_list, &peer->ksnp_routes); #endif ksocknal_route_decref(route); /* drop conn's ref on route */ } - if (list_empty (&peer->ksnp_conns)) { + if (list_empty(&peer->ksnp_conns)) { /* No more connections to this peer */ if (!list_empty(&peer->ksnp_tx_queue)) { ksock_tx_t *tx; - LASSERT (conn->ksnc_proto == &ksocknal_protocol_v3x); + LASSERT(conn->ksnc_proto == &ksocknal_protocol_v3x); /* throw them to the last connection..., * these TXs will be send to /dev/null by scheduler */ @@ -1460,10 +1460,10 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int error) peer->ksnp_proto = NULL; /* renegotiate protocol version */ peer->ksnp_error = error; /* stash last conn close reason */ - if (list_empty (&peer->ksnp_routes)) { + if (list_empty(&peer->ksnp_routes)) { /* I've just closed last conn belonging to a * peer with no routes to it */ - ksocknal_unlink_peer_locked (peer); + ksocknal_unlink_peer_locked(peer); } } @@ -1477,7 +1477,7 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int error) } void -ksocknal_peer_failed (ksock_peer_t *peer) +ksocknal_peer_failed(ksock_peer_t *peer) { int notify = 0; unsigned long last_alive = 0; @@ -1499,7 +1499,7 @@ ksocknal_peer_failed (ksock_peer_t *peer) read_unlock(&ksocknal_data.ksnd_global_lock); if (notify) - lnet_notify (peer->ksnp_ni, peer->ksnp_id.nid, 0, + lnet_notify(peer->ksnp_ni, peer->ksnp_id.nid, 0, last_alive); } @@ -1509,11 +1509,11 @@ ksocknal_finalize_zcreq(ksock_conn_t *conn) ksock_peer_t *peer = conn->ksnc_peer; ksock_tx_t *tx; ksock_tx_t *tmp; - LIST_HEAD (zlist); + LIST_HEAD(zlist); /* NB safe to finalize TXs because closing of socket will * abort all buffered data */ - LASSERT (conn->ksnc_sock == NULL); + LASSERT(conn->ksnc_sock == NULL); spin_lock(&peer->ksnp_lock); @@ -1521,7 +1521,7 @@ ksocknal_finalize_zcreq(ksock_conn_t *conn) if (tx->tx_conn != conn) continue; - LASSERT (tx->tx_msg.ksm_zc_cookies[0] != 0); + LASSERT(tx->tx_msg.ksm_zc_cookies[0] != 0); tx->tx_msg.ksm_zc_cookies[0] = 0; tx->tx_zc_aborted = 1; /* mark it as not-acked */ @@ -1540,7 +1540,7 @@ ksocknal_finalize_zcreq(ksock_conn_t *conn) } void -ksocknal_terminate_conn (ksock_conn_t *conn) +ksocknal_terminate_conn(ksock_conn_t *conn) { /* This gets called by the reaper (guaranteed thread context) to * disengage the socket from its callbacks and close it. @@ -1560,13 +1560,13 @@ ksocknal_terminate_conn (ksock_conn_t *conn) if (!conn->ksnc_tx_scheduled && !list_empty(&conn->ksnc_tx_queue)) { - list_add_tail (&conn->ksnc_tx_list, + list_add_tail(&conn->ksnc_tx_list, &sched->kss_tx_conns); conn->ksnc_tx_scheduled = 1; /* extra ref for scheduler */ ksocknal_conn_addref(conn); - wake_up (&sched->kss_waitq); + wake_up(&sched->kss_waitq); } spin_unlock_bh(&sched->kss_lock); @@ -1582,7 +1582,7 @@ ksocknal_terminate_conn (ksock_conn_t *conn) if (peer->ksnp_error != 0) { /* peer's last conn closed in error */ - LASSERT (list_empty (&peer->ksnp_conns)); + LASSERT(list_empty(&peer->ksnp_conns)); failed = 1; peer->ksnp_error = 0; /* avoid multiple notifications */ } @@ -1601,7 +1601,7 @@ ksocknal_terminate_conn (ksock_conn_t *conn) } void -ksocknal_queue_zombie_conn (ksock_conn_t *conn) +ksocknal_queue_zombie_conn(ksock_conn_t *conn) { /* Queue the conn for the reaper to destroy */ @@ -1615,20 +1615,20 @@ ksocknal_queue_zombie_conn (ksock_conn_t *conn) } void -ksocknal_destroy_conn (ksock_conn_t *conn) +ksocknal_destroy_conn(ksock_conn_t *conn) { unsigned long last_rcv; /* Final coup-de-grace of the reaper */ - CDEBUG (D_NET, "connection %p\n", conn); + CDEBUG(D_NET, "connection %p\n", conn); - LASSERT (atomic_read (&conn->ksnc_conn_refcount) == 0); - LASSERT (atomic_read (&conn->ksnc_sock_refcount) == 0); - LASSERT (conn->ksnc_sock == NULL); - LASSERT (conn->ksnc_route == NULL); - LASSERT (!conn->ksnc_tx_scheduled); - LASSERT (!conn->ksnc_rx_scheduled); - LASSERT (list_empty(&conn->ksnc_tx_queue)); + LASSERT(atomic_read(&conn->ksnc_conn_refcount) == 0); + LASSERT(atomic_read(&conn->ksnc_sock_refcount) == 0); + LASSERT(conn->ksnc_sock == NULL); + LASSERT(conn->ksnc_route == NULL); + LASSERT(!conn->ksnc_tx_scheduled); + LASSERT(!conn->ksnc_rx_scheduled); + LASSERT(list_empty(&conn->ksnc_tx_queue)); /* complete current receive if any */ switch (conn->ksnc_rx_state) { @@ -1641,7 +1641,7 @@ ksocknal_destroy_conn (ksock_conn_t *conn) conn->ksnc_rx_nob_wanted, conn->ksnc_rx_nob_left, cfs_duration_sec(cfs_time_sub(cfs_time_current(), last_rcv))); - lnet_finalize (conn->ksnc_peer->ksnp_ni, + lnet_finalize(conn->ksnc_peer->ksnp_ni, conn->ksnc_cookie, -EIO); break; case SOCKNAL_RX_LNET_HEADER: @@ -1665,30 +1665,30 @@ ksocknal_destroy_conn (ksock_conn_t *conn) &conn->ksnc_ipaddr, conn->ksnc_port); break; default: - LBUG (); + LBUG(); break; } ksocknal_peer_decref(conn->ksnc_peer); - LIBCFS_FREE (conn, sizeof (*conn)); + LIBCFS_FREE(conn, sizeof(*conn)); } int -ksocknal_close_peer_conns_locked (ksock_peer_t *peer, __u32 ipaddr, int why) +ksocknal_close_peer_conns_locked(ksock_peer_t *peer, __u32 ipaddr, int why) { ksock_conn_t *conn; struct list_head *ctmp; struct list_head *cnxt; int count = 0; - list_for_each_safe (ctmp, cnxt, &peer->ksnp_conns) { - conn = list_entry (ctmp, ksock_conn_t, ksnc_list); + list_for_each_safe(ctmp, cnxt, &peer->ksnp_conns) { + conn = list_entry(ctmp, ksock_conn_t, ksnc_list); if (ipaddr == 0 || conn->ksnc_ipaddr == ipaddr) { count++; - ksocknal_close_conn_locked (conn, why); + ksocknal_close_conn_locked(conn, why); } } @@ -1696,7 +1696,7 @@ ksocknal_close_peer_conns_locked (ksock_peer_t *peer, __u32 ipaddr, int why) } int -ksocknal_close_conn_and_siblings (ksock_conn_t *conn, int why) +ksocknal_close_conn_and_siblings(ksock_conn_t *conn, int why) { ksock_peer_t *peer = conn->ksnc_peer; __u32 ipaddr = conn->ksnc_ipaddr; @@ -1704,7 +1704,7 @@ ksocknal_close_conn_and_siblings (ksock_conn_t *conn, int why) write_lock_bh(&ksocknal_data.ksnd_global_lock); - count = ksocknal_close_peer_conns_locked (peer, ipaddr, why); + count = ksocknal_close_peer_conns_locked(peer, ipaddr, why); write_unlock_bh(&ksocknal_data.ksnd_global_lock); @@ -1712,7 +1712,7 @@ ksocknal_close_conn_and_siblings (ksock_conn_t *conn, int why) } int -ksocknal_close_matching_conns (lnet_process_id_t id, __u32 ipaddr) +ksocknal_close_matching_conns(lnet_process_id_t id, __u32 ipaddr) { ksock_peer_t *peer; struct list_head *ptmp; @@ -1732,16 +1732,16 @@ ksocknal_close_matching_conns (lnet_process_id_t id, __u32 ipaddr) } for (i = lo; i <= hi; i++) { - list_for_each_safe (ptmp, pnxt, + list_for_each_safe(ptmp, pnxt, &ksocknal_data.ksnd_peers[i]) { - peer = list_entry (ptmp, ksock_peer_t, ksnp_list); + peer = list_entry(ptmp, ksock_peer_t, ksnp_list); if (!((id.nid == LNET_NID_ANY || id.nid == peer->ksnp_id.nid) && (id.pid == LNET_PID_ANY || id.pid == peer->ksnp_id.pid))) continue; - count += ksocknal_close_peer_conns_locked (peer, ipaddr, 0); + count += ksocknal_close_peer_conns_locked(peer, ipaddr, 0); } } @@ -1758,7 +1758,7 @@ ksocknal_close_matching_conns (lnet_process_id_t id, __u32 ipaddr) } void -ksocknal_notify (lnet_ni_t *ni, lnet_nid_t gw_nid, int alive) +ksocknal_notify(lnet_ni_t *ni, lnet_nid_t gw_nid, int alive) { /* The router is telling me she's been notified of a change in * gateway state.... */ @@ -1767,12 +1767,12 @@ ksocknal_notify (lnet_ni_t *ni, lnet_nid_t gw_nid, int alive) id.nid = gw_nid; id.pid = LNET_PID_ANY; - CDEBUG (D_NET, "gw %s %s\n", libcfs_nid2str(gw_nid), + CDEBUG(D_NET, "gw %s %s\n", libcfs_nid2str(gw_nid), alive ? "up" : "down"); if (!alive) { /* If the gateway crashed, close all open connections... */ - ksocknal_close_matching_conns (id, 0); + ksocknal_close_matching_conns(id, 0); return; } @@ -1781,7 +1781,7 @@ ksocknal_notify (lnet_ni_t *ni, lnet_nid_t gw_nid, int alive) } void -ksocknal_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) +ksocknal_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) { int connect = 1; unsigned long last_alive = 0; @@ -1798,7 +1798,7 @@ ksocknal_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) ksock_conn_t *conn; int bufnob; - list_for_each (tmp, &peer->ksnp_conns) { + list_for_each(tmp, &peer->ksnp_conns) { conn = list_entry(tmp, ksock_conn_t, ksnc_list); bufnob = conn->ksnc_sock->sk->sk_wmem_queued; @@ -1842,7 +1842,7 @@ ksocknal_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) } static void -ksocknal_push_peer (ksock_peer_t *peer) +ksocknal_push_peer(ksock_peer_t *peer) { int index; int i; @@ -1855,9 +1855,9 @@ ksocknal_push_peer (ksock_peer_t *peer) i = 0; conn = NULL; - list_for_each (tmp, &peer->ksnp_conns) { + list_for_each(tmp, &peer->ksnp_conns) { if (i++ == index) { - conn = list_entry (tmp, ksock_conn_t, + conn = list_entry(tmp, ksock_conn_t, ksnc_list); ksocknal_conn_addref(conn); break; @@ -1869,13 +1869,13 @@ ksocknal_push_peer (ksock_peer_t *peer) if (conn == NULL) break; - ksocknal_lib_push_conn (conn); + ksocknal_lib_push_conn(conn); ksocknal_conn_decref(conn); } } static int -ksocknal_push (lnet_ni_t *ni, lnet_process_id_t id) +ksocknal_push(lnet_ni_t *ni, lnet_process_id_t id) { ksock_peer_t *peer; struct list_head *tmp; @@ -1891,7 +1891,7 @@ ksocknal_push (lnet_ni_t *ni, lnet_process_id_t id) index = 0; peer = NULL; - list_for_each (tmp, &ksocknal_data.ksnd_peers[i]) { + list_for_each(tmp, &ksocknal_data.ksnd_peers[i]) { peer = list_entry(tmp, ksock_peer_t, ksnp_list); @@ -1913,7 +1913,7 @@ ksocknal_push (lnet_ni_t *ni, lnet_process_id_t id) if (peer != NULL) { rc = 0; - ksocknal_push_peer (peer); + ksocknal_push_peer(peer); ksocknal_peer_decref(peer); } } @@ -2005,7 +2005,7 @@ ksocknal_peer_del_interface_locked(ksock_peer_t *peer, __u32 ipaddr) } list_for_each_safe(tmp, nxt, &peer->ksnp_routes) { - route = list_entry (tmp, ksock_route_t, ksnr_list); + route = list_entry(tmp, ksock_route_t, ksnr_list); if (route->ksnr_myipaddr != ipaddr) continue; @@ -2022,7 +2022,7 @@ ksocknal_peer_del_interface_locked(ksock_peer_t *peer, __u32 ipaddr) conn = list_entry(tmp, ksock_conn_t, ksnc_list); if (conn->ksnc_myipaddr == ipaddr) - ksocknal_close_conn_locked (conn, 0); + ksocknal_close_conn_locked(conn, 0); } } @@ -2139,21 +2139,21 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) case IOC_LIBCFS_ADD_PEER: id.nid = data->ioc_nid; id.pid = LUSTRE_SRV_LNET_PID; - return ksocknal_add_peer (ni, id, + return ksocknal_add_peer(ni, id, data->ioc_u32[0], /* IP */ data->ioc_u32[1]); /* port */ case IOC_LIBCFS_DEL_PEER: id.nid = data->ioc_nid; id.pid = LNET_PID_ANY; - return ksocknal_del_peer (ni, id, + return ksocknal_del_peer(ni, id, data->ioc_u32[0]); /* IP */ case IOC_LIBCFS_GET_CONN: { int txmem; int rxmem; int nagle; - ksock_conn_t *conn = ksocknal_get_conn_by_idx (ni, data->ioc_count); + ksock_conn_t *conn = ksocknal_get_conn_by_idx(ni, data->ioc_count); if (conn == NULL) return -ENOENT; @@ -2177,7 +2177,7 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) case IOC_LIBCFS_CLOSE_CONNECTION: id.nid = data->ioc_nid; id.pid = LNET_PID_ANY; - return ksocknal_close_matching_conns (id, + return ksocknal_close_matching_conns(id, data->ioc_u32[0]); case IOC_LIBCFS_REGISTER_MYNID: @@ -2202,9 +2202,9 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) } static void -ksocknal_free_buffers (void) +ksocknal_free_buffers(void) { - LASSERT (atomic_read(&ksocknal_data.ksnd_nactive_txs) == 0); + LASSERT(atomic_read(&ksocknal_data.ksnd_nactive_txs) == 0); if (ksocknal_data.ksnd_sched_info != NULL) { struct ksock_sched_info *info; @@ -2220,8 +2220,8 @@ ksocknal_free_buffers (void) cfs_percpt_free(ksocknal_data.ksnd_sched_info); } - LIBCFS_FREE (ksocknal_data.ksnd_peers, - sizeof (struct list_head) * + LIBCFS_FREE(ksocknal_data.ksnd_peers, + sizeof(struct list_head) * ksocknal_data.ksnd_peer_hash_size); spin_lock(&ksocknal_data.ksnd_tx_lock); @@ -2253,25 +2253,25 @@ ksocknal_base_shutdown(void) int j; CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n", - atomic_read (&libcfs_kmemory)); - LASSERT (ksocknal_data.ksnd_nnets == 0); + atomic_read(&libcfs_kmemory)); + LASSERT(ksocknal_data.ksnd_nnets == 0); switch (ksocknal_data.ksnd_init) { default: - LASSERT (0); + LASSERT(0); case SOCKNAL_INIT_ALL: case SOCKNAL_INIT_DATA: - LASSERT (ksocknal_data.ksnd_peers != NULL); + LASSERT(ksocknal_data.ksnd_peers != NULL); for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) { - LASSERT (list_empty (&ksocknal_data.ksnd_peers[i])); + LASSERT(list_empty(&ksocknal_data.ksnd_peers[i])); } LASSERT(list_empty(&ksocknal_data.ksnd_nets)); - LASSERT (list_empty (&ksocknal_data.ksnd_enomem_conns)); - LASSERT (list_empty (&ksocknal_data.ksnd_zombie_conns)); - LASSERT (list_empty (&ksocknal_data.ksnd_connd_connreqs)); - LASSERT (list_empty (&ksocknal_data.ksnd_connd_routes)); + LASSERT(list_empty(&ksocknal_data.ksnd_enomem_conns)); + LASSERT(list_empty(&ksocknal_data.ksnd_zombie_conns)); + LASSERT(list_empty(&ksocknal_data.ksnd_connd_connreqs)); + LASSERT(list_empty(&ksocknal_data.ksnd_connd_routes)); if (ksocknal_data.ksnd_sched_info != NULL) { cfs_percpt_for_each(info, i, @@ -2332,13 +2332,13 @@ ksocknal_base_shutdown(void) } CDEBUG(D_MALLOC, "after NAL cleanup: kmem %d\n", - atomic_read (&libcfs_kmemory)); + atomic_read(&libcfs_kmemory)); module_put(THIS_MODULE); } static __u64 -ksocknal_new_incarnation (void) +ksocknal_new_incarnation(void) { /* The incarnation number is the time this module loaded and it @@ -2354,14 +2354,14 @@ ksocknal_base_startup(void) int rc; int i; - LASSERT (ksocknal_data.ksnd_init == SOCKNAL_INIT_NOTHING); - LASSERT (ksocknal_data.ksnd_nnets == 0); + LASSERT(ksocknal_data.ksnd_init == SOCKNAL_INIT_NOTHING); + LASSERT(ksocknal_data.ksnd_nnets == 0); - memset (&ksocknal_data, 0, sizeof (ksocknal_data)); /* zero pointers */ + memset(&ksocknal_data, 0, sizeof(ksocknal_data)); /* zero pointers */ ksocknal_data.ksnd_peer_hash_size = SOCKNAL_PEER_HASH_SIZE; - LIBCFS_ALLOC (ksocknal_data.ksnd_peers, - sizeof (struct list_head) * + LIBCFS_ALLOC(ksocknal_data.ksnd_peers, + sizeof(struct list_head) * ksocknal_data.ksnd_peer_hash_size); if (ksocknal_data.ksnd_peers == NULL) return -ENOMEM; @@ -2373,18 +2373,18 @@ ksocknal_base_startup(void) INIT_LIST_HEAD(&ksocknal_data.ksnd_nets); spin_lock_init(&ksocknal_data.ksnd_reaper_lock); - INIT_LIST_HEAD (&ksocknal_data.ksnd_enomem_conns); - INIT_LIST_HEAD (&ksocknal_data.ksnd_zombie_conns); - INIT_LIST_HEAD (&ksocknal_data.ksnd_deathrow_conns); + INIT_LIST_HEAD(&ksocknal_data.ksnd_enomem_conns); + INIT_LIST_HEAD(&ksocknal_data.ksnd_zombie_conns); + INIT_LIST_HEAD(&ksocknal_data.ksnd_deathrow_conns); init_waitqueue_head(&ksocknal_data.ksnd_reaper_waitq); spin_lock_init(&ksocknal_data.ksnd_connd_lock); - INIT_LIST_HEAD (&ksocknal_data.ksnd_connd_connreqs); - INIT_LIST_HEAD (&ksocknal_data.ksnd_connd_routes); + INIT_LIST_HEAD(&ksocknal_data.ksnd_connd_connreqs); + INIT_LIST_HEAD(&ksocknal_data.ksnd_connd_routes); init_waitqueue_head(&ksocknal_data.ksnd_connd_waitq); spin_lock_init(&ksocknal_data.ksnd_tx_lock); - INIT_LIST_HEAD (&ksocknal_data.ksnd_idle_noop_txs); + INIT_LIST_HEAD(&ksocknal_data.ksnd_idle_noop_txs); /* NB memset above zeros whole of ksocknal_data */ @@ -2465,7 +2465,7 @@ ksocknal_base_startup(void) rc = ksocknal_thread_start(ksocknal_reaper, NULL, "socknal_reaper"); if (rc != 0) { - CERROR ("Can't spawn socknal reaper: %d\n", rc); + CERROR("Can't spawn socknal reaper: %d\n", rc); goto failed; } @@ -2480,7 +2480,7 @@ ksocknal_base_startup(void) } static void -ksocknal_debug_peerhash (lnet_ni_t *ni) +ksocknal_debug_peerhash(lnet_ni_t *ni) { ksock_peer_t *peer = NULL; struct list_head *tmp; @@ -2489,8 +2489,8 @@ ksocknal_debug_peerhash (lnet_ni_t *ni) read_lock(&ksocknal_data.ksnd_global_lock); for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) { - list_for_each (tmp, &ksocknal_data.ksnd_peers[i]) { - peer = list_entry (tmp, ksock_peer_t, ksnp_list); + list_for_each(tmp, &ksocknal_data.ksnd_peers[i]) { + peer = list_entry(tmp, ksock_peer_t, ksnp_list); if (peer->ksnp_ni == ni) break; @@ -2512,7 +2512,7 @@ ksocknal_debug_peerhash (lnet_ni_t *ni) !list_empty(&peer->ksnp_tx_queue), !list_empty(&peer->ksnp_zc_req_list)); - list_for_each (tmp, &peer->ksnp_routes) { + list_for_each(tmp, &peer->ksnp_routes) { route = list_entry(tmp, ksock_route_t, ksnr_list); CWARN("Route: ref %d, schd %d, conn %d, cnted %d, del %d\n", atomic_read(&route->ksnr_refcount), @@ -2520,9 +2520,9 @@ ksocknal_debug_peerhash (lnet_ni_t *ni) route->ksnr_connected, route->ksnr_deleted); } - list_for_each (tmp, &peer->ksnp_conns) { + list_for_each(tmp, &peer->ksnp_conns) { conn = list_entry(tmp, ksock_conn_t, ksnc_list); - CWARN ("Conn: ref %d, sref %d, t %d, c %d\n", + CWARN("Conn: ref %d, sref %d, t %d, c %d\n", atomic_read(&conn->ksnc_conn_refcount), atomic_read(&conn->ksnc_sock_refcount), conn->ksnc_type, conn->ksnc_closing); @@ -2534,7 +2534,7 @@ ksocknal_debug_peerhash (lnet_ni_t *ni) } void -ksocknal_shutdown (lnet_ni_t *ni) +ksocknal_shutdown(lnet_ni_t *ni) { ksock_net_t *net = ni->ni_data; int i; @@ -2573,8 +2573,8 @@ ksocknal_shutdown (lnet_ni_t *ni) spin_unlock_bh(&net->ksnn_lock); for (i = 0; i < net->ksnn_ninterfaces; i++) { - LASSERT (net->ksnn_interfaces[i].ksni_npeers == 0); - LASSERT (net->ksnn_interfaces[i].ksni_nroutes == 0); + LASSERT(net->ksnn_interfaces[i].ksni_npeers == 0); + LASSERT(net->ksnn_interfaces[i].ksni_nroutes == 0); } list_del(&net->ksnn_list); @@ -2757,13 +2757,13 @@ ksocknal_net_start_threads(ksock_net_t *net, __u32 *cpts, int ncpts) } int -ksocknal_startup (lnet_ni_t *ni) +ksocknal_startup(lnet_ni_t *ni) { ksock_net_t *net; int rc; int i; - LASSERT (ni->ni_lnd == &the_ksocklnd); + LASSERT(ni->ni_lnd == &the_ksocklnd); if (ksocknal_data.ksnd_init == SOCKNAL_INIT_NOTHING) { rc = ksocknal_base_startup(); @@ -2843,19 +2843,19 @@ ksocknal_startup (lnet_ni_t *ni) static void __exit -ksocknal_module_fini (void) +ksocknal_module_fini(void) { lnet_unregister_lnd(&the_ksocklnd); } static int __init -ksocknal_module_init (void) +ksocknal_module_init(void) { int rc; /* check ksnr_connected/connecting field large enough */ - CLASSERT (SOCKLND_CONN_NTYPES <= 4); - CLASSERT (SOCKLND_CONN_ACK == SOCKLND_CONN_BULK_IN); + CLASSERT(SOCKLND_CONN_NTYPES <= 4); + CLASSERT(SOCKLND_CONN_ACK == SOCKLND_CONN_BULK_IN); /* initialize the_ksocklnd */ the_ksocklnd.lnd_type = SOCKLND; -- cgit v1.2.3 From cb7e9f7b820630d4c5e269aa74436e83331c333d Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sat, 28 Feb 2015 00:54:17 +0200 Subject: Staging: lustre: Deleted space prohibited between function name and open parenthesis WARNING: space prohibited between function name and open parenthesis '(' Remove unnecessary space between function name and opening parenthesis. That was found by running checkpatch.pl Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/obdecho/echo_client.c | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index a38032965f7f..566e6466f49c 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -196,22 +196,22 @@ static struct lu_kmem_descr echo_caches[] = { { .ckd_cache = &echo_lock_kmem, .ckd_name = "echo_lock_kmem", - .ckd_size = sizeof (struct echo_lock) + .ckd_size = sizeof(struct echo_lock) }, { .ckd_cache = &echo_object_kmem, .ckd_name = "echo_object_kmem", - .ckd_size = sizeof (struct echo_object) + .ckd_size = sizeof(struct echo_object) }, { .ckd_cache = &echo_thread_kmem, .ckd_name = "echo_thread_kmem", - .ckd_size = sizeof (struct echo_thread_info) + .ckd_size = sizeof(struct echo_thread_info) }, { .ckd_cache = &echo_session_kmem, .ckd_name = "echo_session_kmem", - .ckd_size = sizeof (struct echo_session_info) + .ckd_size = sizeof(struct echo_session_info) }, { .ckd_cache = NULL @@ -1113,8 +1113,8 @@ static int cl_echo_cancel0(struct lu_env *env, struct echo_device *ed, LASSERT(ec != NULL); spin_lock(&ec->ec_lock); - list_for_each (el, &ec->ec_locks) { - ecl = list_entry (el, struct echo_lock, el_chain); + list_for_each(el, &ec->ec_locks) { + ecl = list_entry(el, struct echo_lock, el_chain); CDEBUG(D_INFO, "ecl: %p, cookie: %#llx\n", ecl, ecl->el_cookie); found = (ecl->el_cookie == cookie); if (found) { @@ -1265,20 +1265,20 @@ out: static u64 last_object_id; static int -echo_copyout_lsm (struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob) +echo_copyout_lsm(struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob) { struct lov_stripe_md *ulsm = _ulsm; int nob, i; - nob = offsetof (struct lov_stripe_md, lsm_oinfo[lsm->lsm_stripe_count]); + nob = offsetof(struct lov_stripe_md, lsm_oinfo[lsm->lsm_stripe_count]); if (nob > ulsm_nob) return -EINVAL; - if (copy_to_user (ulsm, lsm, sizeof(*ulsm))) + if(copy_to_user (ulsm, lsm, sizeof(*ulsm))) return -EFAULT; for (i = 0; i < lsm->lsm_stripe_count; i++) { - if (copy_to_user (ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i], + if(copy_to_user (ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i], sizeof(lsm->lsm_oinfo[0]))) return -EFAULT; } @@ -1286,16 +1286,16 @@ echo_copyout_lsm (struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob) } static int -echo_copyin_lsm (struct echo_device *ed, struct lov_stripe_md *lsm, +echo_copyin_lsm(struct echo_device *ed, struct lov_stripe_md *lsm, void *ulsm, int ulsm_nob) { struct echo_client_obd *ec = ed->ed_ec; int i; - if (ulsm_nob < sizeof (*lsm)) + if(ulsm_nob < sizeof (*lsm)) return -EINVAL; - if (copy_from_user (lsm, ulsm, sizeof (*lsm))) + if(copy_from_user (lsm, ulsm, sizeof (*lsm))) return -EFAULT; if (lsm->lsm_stripe_count > ec->ec_nstripes || -- cgit v1.2.3 From 978b9b35a61e8920cd9dbc1fe426b9deb3da7d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Sat, 28 Feb 2015 15:33:12 +0200 Subject: Staging: lustre: lnet: klnds: socklnd: Remove space after the name of that function Function names must be adjacent to the parenthesis opened after.That's why remove space after the name of that function. This Warning found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 104 ++++++++++----------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c index 66cc509295e5..f5e8ab06070c 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c @@ -37,24 +37,24 @@ #include "socklnd.h" int -ksocknal_lib_get_conn_addrs (ksock_conn_t *conn) +ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) { int rc = libcfs_sock_getaddr(conn->ksnc_sock, 1, &conn->ksnc_ipaddr, &conn->ksnc_port); /* Didn't need the {get,put}connsock dance to deref ksnc_sock... */ - LASSERT (!conn->ksnc_closing); + LASSERT(!conn->ksnc_closing); if (rc != 0) { - CERROR ("Error %d getting sock peer IP\n", rc); + CERROR("Error %d getting sock peer IP\n", rc); return rc; } rc = libcfs_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL); if (rc != 0) { - CERROR ("Error %d getting sock local IP\n", rc); + CERROR("Error %d getting sock local IP\n", rc); return rc; } @@ -75,7 +75,7 @@ ksocknal_lib_zc_capable(ksock_conn_t *conn) } int -ksocknal_lib_send_iov (ksock_conn_t *conn, ksock_tx_t *tx) +ksocknal_lib_send_iov(ksock_conn_t *conn, ksock_tx_t *tx) { struct socket *sock = conn->ksnc_sock; int nob; @@ -117,7 +117,7 @@ ksocknal_lib_send_iov (ksock_conn_t *conn, ksock_tx_t *tx) } int -ksocknal_lib_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx) +ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx) { struct socket *sock = conn->ksnc_sock; lnet_kiov_t *kiov = tx->tx_kiov; @@ -125,7 +125,7 @@ ksocknal_lib_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx) int nob; /* Not NOOP message */ - LASSERT (tx->tx_lnetmsg != NULL); + LASSERT(tx->tx_lnetmsg != NULL); /* NB we can't trust socket ops to either consume our iovs * or leave them alone. */ @@ -185,7 +185,7 @@ ksocknal_lib_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx) } void -ksocknal_lib_eager_ack (ksock_conn_t *conn) +ksocknal_lib_eager_ack(ksock_conn_t *conn) { int opt = 1; struct socket *sock = conn->ksnc_sock; @@ -196,11 +196,11 @@ ksocknal_lib_eager_ack (ksock_conn_t *conn) * peer. */ kernel_setsockopt(sock, SOL_TCP, TCP_QUICKACK, - (char *)&opt, sizeof (opt)); + (char *)&opt, sizeof(opt)); } int -ksocknal_lib_recv_iov (ksock_conn_t *conn) +ksocknal_lib_recv_iov(ksock_conn_t *conn) { #if SOCKNAL_SINGLE_FRAG_RX struct kvec scratch; @@ -223,13 +223,13 @@ ksocknal_lib_recv_iov (ksock_conn_t *conn) /* NB we can't trust socket ops to either consume our iovs * or leave them alone. */ - LASSERT (niov > 0); + LASSERT(niov > 0); for (nob = i = 0; i < niov; i++) { scratchiov[i] = iov[i]; nob += scratchiov[i].iov_len; } - LASSERT (nob <= conn->ksnc_rx_nob_wanted); + LASSERT(nob <= conn->ksnc_rx_nob_wanted); rc = kernel_recvmsg(conn->ksnc_sock, &msg, scratchiov, niov, nob, MSG_DONTWAIT); @@ -243,7 +243,7 @@ ksocknal_lib_recv_iov (ksock_conn_t *conn) if (saved_csum != 0) { /* accumulate checksum */ for (i = 0, sum = rc; sum > 0; i++, sum -= fragnob) { - LASSERT (i < niov); + LASSERT(i < niov); fragnob = iov[i].iov_len; if (fragnob > sum) @@ -278,7 +278,7 @@ ksocknal_lib_kiov_vmap(lnet_kiov_t *kiov, int niov, if (!*ksocknal_tunables.ksnd_zc_recv || pages == NULL) return NULL; - LASSERT (niov <= LNET_MAX_IOV); + LASSERT(niov <= LNET_MAX_IOV); if (niov < 2 || niov < *ksocknal_tunables.ksnd_zc_recv_min_nfrags) @@ -304,7 +304,7 @@ ksocknal_lib_kiov_vmap(lnet_kiov_t *kiov, int niov, } int -ksocknal_lib_recv_kiov (ksock_conn_t *conn) +ksocknal_lib_recv_kiov(ksock_conn_t *conn) { #if SOCKNAL_SINGLE_FRAG_RX || !SOCKNAL_RISK_KMAP_DEADLOCK struct kvec scratch; @@ -348,14 +348,14 @@ ksocknal_lib_recv_kiov (ksock_conn_t *conn) n = niov; } - LASSERT (nob <= conn->ksnc_rx_nob_wanted); + LASSERT(nob <= conn->ksnc_rx_nob_wanted); rc = kernel_recvmsg(conn->ksnc_sock, &msg, (struct kvec *)scratchiov, n, nob, MSG_DONTWAIT); if (conn->ksnc_msg.ksm_csum != 0) { for (i = 0, sum = rc; sum > 0; i++, sum -= fragnob) { - LASSERT (i < niov); + LASSERT(i < niov); /* Dang! have to kmap again because I have nowhere to stash the * mapped address. But by doing it while the page is still @@ -423,7 +423,7 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx) } int -ksocknal_lib_get_conn_tunables (ksock_conn_t *conn, int *txmem, int *rxmem, int *nagle) +ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *nagle) { struct socket *sock = conn->ksnc_sock; int len; @@ -431,7 +431,7 @@ ksocknal_lib_get_conn_tunables (ksock_conn_t *conn, int *txmem, int *rxmem, int rc = ksocknal_connsock_addref(conn); if (rc != 0) { - LASSERT (conn->ksnc_closing); + LASSERT(conn->ksnc_closing); *txmem = *rxmem = *nagle = 0; return -ESHUTDOWN; } @@ -454,7 +454,7 @@ ksocknal_lib_get_conn_tunables (ksock_conn_t *conn, int *txmem, int *rxmem, int } int -ksocknal_lib_setup_sock (struct socket *sock) +ksocknal_lib_setup_sock(struct socket *sock) { int rc; int option; @@ -473,17 +473,17 @@ ksocknal_lib_setup_sock (struct socket *sock) linger.l_linger = 0; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_LINGER, - (char *)&linger, sizeof (linger)); + (char *)&linger, sizeof(linger)); if (rc != 0) { - CERROR ("Can't set SO_LINGER: %d\n", rc); + CERROR("Can't set SO_LINGER: %d\n", rc); return rc; } option = -1; rc = kernel_setsockopt(sock, SOL_TCP, TCP_LINGER2, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { - CERROR ("Can't set SO_LINGER2: %d\n", rc); + CERROR("Can't set SO_LINGER2: %d\n", rc); return rc; } @@ -491,9 +491,9 @@ ksocknal_lib_setup_sock (struct socket *sock) option = 1; rc = kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { - CERROR ("Can't disable nagle: %d\n", rc); + CERROR("Can't disable nagle: %d\n", rc); return rc; } } @@ -502,7 +502,7 @@ ksocknal_lib_setup_sock (struct socket *sock) *ksocknal_tunables.ksnd_tx_buffer_size, *ksocknal_tunables.ksnd_rx_buffer_size); if (rc != 0) { - CERROR ("Can't set buffer tx %d, rx %d buffers: %d\n", + CERROR("Can't set buffer tx %d, rx %d buffers: %d\n", *ksocknal_tunables.ksnd_tx_buffer_size, *ksocknal_tunables.ksnd_rx_buffer_size, rc); return rc; @@ -519,9 +519,9 @@ ksocknal_lib_setup_sock (struct socket *sock) option = (do_keepalive ? 1 : 0); rc = kernel_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { - CERROR ("Can't set SO_KEEPALIVE: %d\n", rc); + CERROR("Can't set SO_KEEPALIVE: %d\n", rc); return rc; } @@ -529,23 +529,23 @@ ksocknal_lib_setup_sock (struct socket *sock) return 0; rc = kernel_setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, - (char *)&keep_idle, sizeof (keep_idle)); + (char *)&keep_idle, sizeof(keep_idle)); if (rc != 0) { - CERROR ("Can't set TCP_KEEPIDLE: %d\n", rc); + CERROR("Can't set TCP_KEEPIDLE: %d\n", rc); return rc; } rc = kernel_setsockopt(sock, SOL_TCP, TCP_KEEPINTVL, - (char *)&keep_intvl, sizeof (keep_intvl)); + (char *)&keep_intvl, sizeof(keep_intvl)); if (rc != 0) { - CERROR ("Can't set TCP_KEEPINTVL: %d\n", rc); + CERROR("Can't set TCP_KEEPINTVL: %d\n", rc); return rc; } rc = kernel_setsockopt(sock, SOL_TCP, TCP_KEEPCNT, - (char *)&keep_count, sizeof (keep_count)); + (char *)&keep_count, sizeof(keep_count)); if (rc != 0) { - CERROR ("Can't set TCP_KEEPCNT: %d\n", rc); + CERROR("Can't set TCP_KEEPCNT: %d\n", rc); return rc; } @@ -553,7 +553,7 @@ ksocknal_lib_setup_sock (struct socket *sock) } void -ksocknal_lib_push_conn (ksock_conn_t *conn) +ksocknal_lib_push_conn(ksock_conn_t *conn) { struct sock *sk; struct tcp_sock *tp; @@ -568,29 +568,29 @@ ksocknal_lib_push_conn (ksock_conn_t *conn) sk = conn->ksnc_sock->sk; tp = tcp_sk(sk); - lock_sock (sk); + lock_sock(sk); nonagle = tp->nonagle; tp->nonagle = 1; - release_sock (sk); + release_sock(sk); rc = kernel_setsockopt(conn->ksnc_sock, SOL_TCP, TCP_NODELAY, - (char *)&val, sizeof (val)); - LASSERT (rc == 0); + (char *)&val, sizeof(val)); + LASSERT(rc == 0); - lock_sock (sk); + lock_sock(sk); tp->nonagle = nonagle; - release_sock (sk); + release_sock(sk); ksocknal_connsock_decref(conn); } -extern void ksocknal_read_callback (ksock_conn_t *conn); -extern void ksocknal_write_callback (ksock_conn_t *conn); +extern void ksocknal_read_callback(ksock_conn_t *conn); +extern void ksocknal_write_callback(ksock_conn_t *conn); /* * socket call back in Linux */ static void -ksocknal_data_ready (struct sock *sk) +ksocknal_data_ready(struct sock *sk) { ksock_conn_t *conn; @@ -600,8 +600,8 @@ ksocknal_data_ready (struct sock *sk) conn = sk->sk_user_data; if (conn == NULL) { /* raced with ksocknal_terminate_conn */ - LASSERT (sk->sk_data_ready != &ksocknal_data_ready); - sk->sk_data_ready (sk); + LASSERT(sk->sk_data_ready != &ksocknal_data_ready); + sk->sk_data_ready(sk); } else ksocknal_read_callback(conn); @@ -609,7 +609,7 @@ ksocknal_data_ready (struct sock *sk) } static void -ksocknal_write_space (struct sock *sk) +ksocknal_write_space(struct sock *sk) { ksock_conn_t *conn; int wspace; @@ -629,12 +629,12 @@ ksocknal_write_space (struct sock *sk) " ready" : " blocked"), (conn == NULL) ? "" : (conn->ksnc_tx_scheduled ? " scheduled" : " idle"), - (conn == NULL) ? "" : (list_empty (&conn->ksnc_tx_queue) ? + (conn == NULL) ? "" : (list_empty(&conn->ksnc_tx_queue) ? " empty" : " queued")); if (conn == NULL) { /* raced with ksocknal_terminate_conn */ - LASSERT (sk->sk_write_space != &ksocknal_write_space); - sk->sk_write_space (sk); + LASSERT(sk->sk_write_space != &ksocknal_write_space); + sk->sk_write_space(sk); read_unlock(&ksocknal_data.ksnd_global_lock); return; @@ -647,7 +647,7 @@ ksocknal_write_space (struct sock *sk) * ENOMEM check in ksocknal_transmit is race-free (think about * it). */ - clear_bit (SOCK_NOSPACE, &sk->sk_socket->flags); + clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags); } read_unlock(&ksocknal_data.ksnd_global_lock); -- cgit v1.2.3 From 7cde9afb1860f86fc0596f3ae45b5c154e0c3421 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sat, 28 Feb 2015 16:28:01 +0200 Subject: Staging: lustre: __aligned(size) is preferred over __attribute__((aligned(size))) This patch fixes the checkpatch.pl warning in the drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index f19a121a37cd..46887700f276 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -58,7 +58,7 @@ struct kuc_hdr { __u8 kuc_flags; __u16 kuc_msgtype; /* Message type or opcode, transport-specific */ __u16 kuc_msglen; /* Including header */ -} __attribute__((aligned(sizeof(__u64)))); +} __aligned(sizeof(__u64)); #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE) -- cgit v1.2.3 From d428284244dfcd158c0d49c41f4dce33fc12e627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Sat, 28 Feb 2015 20:15:10 +0200 Subject: Staging: lustre: lnet: klnds: o2iblnd: Remove space after the name of that function Function names must be adjacent to the parenthesis opened after.That's why remove space after the name of that function. This Warning found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 382 ++++++++++----------- 1 file changed, 191 insertions(+), 191 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 48d885dc51d9..c762dbe10693 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -41,19 +41,19 @@ #include "o2iblnd.h" static void -kiblnd_tx_done (lnet_ni_t *ni, kib_tx_t *tx) +kiblnd_tx_done(lnet_ni_t *ni, kib_tx_t *tx) { lnet_msg_t *lntmsg[2]; kib_net_t *net = ni->ni_data; int rc; int i; - LASSERT (net != NULL); - LASSERT (!in_interrupt()); - LASSERT (!tx->tx_queued); /* mustn't be queued for sending */ - LASSERT (tx->tx_sending == 0); /* mustn't be awaiting sent callback */ - LASSERT (!tx->tx_waiting); /* mustn't be awaiting peer response */ - LASSERT (tx->tx_pool != NULL); + LASSERT(net != NULL); + LASSERT(!in_interrupt()); + LASSERT(!tx->tx_queued); /* mustn't be queued for sending */ + LASSERT(tx->tx_sending == 0); /* mustn't be awaiting sent callback */ + LASSERT(!tx->tx_waiting); /* mustn't be awaiting peer response */ + LASSERT(tx->tx_pool != NULL); kiblnd_unmap_tx(ni, tx); @@ -63,7 +63,7 @@ kiblnd_tx_done (lnet_ni_t *ni, kib_tx_t *tx) rc = tx->tx_status; if (tx->tx_conn != NULL) { - LASSERT (ni == tx->tx_conn->ibc_peer->ibp_ni); + LASSERT(ni == tx->tx_conn->ibc_peer->ibp_ni); kiblnd_conn_decref(tx->tx_conn); tx->tx_conn = NULL; @@ -84,12 +84,12 @@ kiblnd_tx_done (lnet_ni_t *ni, kib_tx_t *tx) } void -kiblnd_txlist_done (lnet_ni_t *ni, struct list_head *txlist, int status) +kiblnd_txlist_done(lnet_ni_t *ni, struct list_head *txlist, int status) { kib_tx_t *tx; - while (!list_empty (txlist)) { - tx = list_entry (txlist->next, kib_tx_t, tx_list); + while (!list_empty(txlist)) { + tx = list_entry(txlist->next, kib_tx_t, tx_list); list_del(&tx->tx_list); /* complete now */ @@ -113,16 +113,16 @@ kiblnd_get_idle_tx(lnet_ni_t *ni, lnet_nid_t target) return NULL; tx = container_of(node, kib_tx_t, tx_list); - LASSERT (tx->tx_nwrq == 0); - LASSERT (!tx->tx_queued); - LASSERT (tx->tx_sending == 0); - LASSERT (!tx->tx_waiting); - LASSERT (tx->tx_status == 0); - LASSERT (tx->tx_conn == NULL); - LASSERT (tx->tx_lntmsg[0] == NULL); - LASSERT (tx->tx_lntmsg[1] == NULL); - LASSERT (tx->tx_u.pmr == NULL); - LASSERT (tx->tx_nfrags == 0); + LASSERT(tx->tx_nwrq == 0); + LASSERT(!tx->tx_queued); + LASSERT(tx->tx_sending == 0); + LASSERT(!tx->tx_waiting); + LASSERT(tx->tx_status == 0); + LASSERT(tx->tx_conn == NULL); + LASSERT(tx->tx_lntmsg[0] == NULL); + LASSERT(tx->tx_lntmsg[1] == NULL); + LASSERT(tx->tx_u.pmr == NULL); + LASSERT(tx->tx_nfrags == 0); return tx; } @@ -143,7 +143,7 @@ kiblnd_drop_rx(kib_rx_t *rx) } int -kiblnd_post_rx (kib_rx_t *rx, int credit) +kiblnd_post_rx(kib_rx_t *rx, int credit) { kib_conn_t *conn = rx->rx_conn; kib_net_t *net = conn->ibc_peer->ibp_ni->ni_data; @@ -151,14 +151,14 @@ kiblnd_post_rx (kib_rx_t *rx, int credit) struct ib_mr *mr; int rc; - LASSERT (net != NULL); - LASSERT (!in_interrupt()); - LASSERT (credit == IBLND_POSTRX_NO_CREDIT || + LASSERT(net != NULL); + LASSERT(!in_interrupt()); + LASSERT(credit == IBLND_POSTRX_NO_CREDIT || credit == IBLND_POSTRX_PEER_CREDIT || credit == IBLND_POSTRX_RSRVD_CREDIT); mr = kiblnd_find_dma_mr(conn->ibc_hdev, rx->rx_msgaddr, IBLND_MSG_SIZE); - LASSERT (mr != NULL); + LASSERT(mr != NULL); rx->rx_sge.lkey = mr->lkey; rx->rx_sge.addr = rx->rx_msgaddr; @@ -169,8 +169,8 @@ kiblnd_post_rx (kib_rx_t *rx, int credit) rx->rx_wrq.num_sge = 1; rx->rx_wrq.wr_id = kiblnd_ptr2wreqid(rx, IBLND_WID_RX); - LASSERT (conn->ibc_state >= IBLND_CONN_INIT); - LASSERT (rx->rx_nob >= 0); /* not posted */ + LASSERT(conn->ibc_state >= IBLND_CONN_INIT); + LASSERT(rx->rx_nob >= 0); /* not posted */ if (conn->ibc_state > IBLND_CONN_ESTABLISHED) { kiblnd_drop_rx(rx); /* No more posts for this rx */ @@ -217,8 +217,8 @@ kiblnd_find_waiting_tx_locked(kib_conn_t *conn, int txtype, __u64 cookie) list_for_each(tmp, &conn->ibc_active_txs) { kib_tx_t *tx = list_entry(tmp, kib_tx_t, tx_list); - LASSERT (!tx->tx_queued); - LASSERT (tx->tx_sending != 0 || tx->tx_waiting); + LASSERT(!tx->tx_queued); + LASSERT(tx->tx_sending != 0 || tx->tx_waiting); if (tx->tx_cookie != cookie) continue; @@ -293,7 +293,7 @@ kiblnd_send_completion(kib_conn_t *conn, int type, int status, __u64 cookie) } static void -kiblnd_handle_rx (kib_rx_t *rx) +kiblnd_handle_rx(kib_rx_t *rx) { kib_msg_t *msg = rx->rx_msg; kib_conn_t *conn = rx->rx_conn; @@ -304,9 +304,9 @@ kiblnd_handle_rx (kib_rx_t *rx) int rc2; int post_credit; - LASSERT (conn->ibc_state >= IBLND_CONN_ESTABLISHED); + LASSERT(conn->ibc_state >= IBLND_CONN_ESTABLISHED); - CDEBUG (D_NET, "Received %x[%d] from %s\n", + CDEBUG(D_NET, "Received %x[%d] from %s\n", msg->ibm_type, credits, libcfs_nid2str(conn->ibc_peer->ibp_nid)); @@ -377,7 +377,7 @@ kiblnd_handle_rx (kib_rx_t *rx) break; case IBLND_MSG_PUT_NAK: - CWARN ("PUT_NACK from %s\n", + CWARN("PUT_NACK from %s\n", libcfs_nid2str(conn->ibc_peer->ibp_nid)); post_credit = IBLND_POSTRX_RSRVD_CREDIT; kiblnd_handle_completion(conn, IBLND_MSG_PUT_REQ, @@ -402,7 +402,7 @@ kiblnd_handle_rx (kib_rx_t *rx) break; } - LASSERT (tx->tx_waiting); + LASSERT(tx->tx_waiting); /* CAVEAT EMPTOR: I could be racing with tx_complete, but... * (a) I can overwrite tx_msg since my peer has received it! * (b) tx_waiting set tells tx_complete() it's not done. */ @@ -454,7 +454,7 @@ kiblnd_handle_rx (kib_rx_t *rx) } static void -kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) +kiblnd_rx_complete(kib_rx_t *rx, int status, int nob) { kib_msg_t *msg = rx->rx_msg; kib_conn_t *conn = rx->rx_conn; @@ -463,8 +463,8 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) int rc; int err = -EIO; - LASSERT (net != NULL); - LASSERT (rx->rx_nob < 0); /* was posted */ + LASSERT(net != NULL); + LASSERT(rx->rx_nob < 0); /* was posted */ rx->rx_nob = 0; /* isn't now */ if (conn->ibc_state > IBLND_CONN_ESTABLISHED) @@ -476,12 +476,12 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) goto failed; } - LASSERT (nob >= 0); + LASSERT(nob >= 0); rx->rx_nob = nob; rc = kiblnd_unpack_msg(msg, rx->rx_nob); if (rc != 0) { - CERROR ("Error %d unpacking rx from %s\n", + CERROR("Error %d unpacking rx from %s\n", rc, libcfs_nid2str(conn->ibc_peer->ibp_nid)); goto failed; } @@ -490,7 +490,7 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) msg->ibm_dstnid != ni->ni_nid || msg->ibm_srcstamp != conn->ibc_incarnation || msg->ibm_dststamp != net->ibn_incarnation) { - CERROR ("Stale rx from %s\n", + CERROR("Stale rx from %s\n", libcfs_nid2str(conn->ibc_peer->ibp_nid)); err = -ESTALE; goto failed; @@ -525,13 +525,13 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) } static struct page * -kiblnd_kvaddr_to_page (unsigned long vaddr) +kiblnd_kvaddr_to_page(unsigned long vaddr) { struct page *page; if (is_vmalloc_addr((void *)vaddr)) { - page = vmalloc_to_page ((void *)vaddr); - LASSERT (page != NULL); + page = vmalloc_to_page((void *)vaddr); + LASSERT(page != NULL); return page; } #ifdef CONFIG_HIGHMEM @@ -542,8 +542,8 @@ kiblnd_kvaddr_to_page (unsigned long vaddr) LBUG(); } #endif - page = virt_to_page (vaddr); - LASSERT (page != NULL); + page = virt_to_page(vaddr); + LASSERT(page != NULL); return page; } @@ -577,7 +577,7 @@ kiblnd_fmr_map_tx(kib_net_t *net, kib_tx_t *tx, kib_rdma_desc_t *rd, int nob) fps = net->ibn_fmr_ps[cpt]; rc = kiblnd_fmr_pool_map(fps, pages, npages, 0, &tx->tx_u.fmr); if (rc != 0) { - CERROR ("Can't map %d pages: %d\n", npages, rc); + CERROR("Can't map %d pages: %d\n", npages, rc); return rc; } @@ -706,26 +706,26 @@ kiblnd_setup_rd_iov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, int fragnob; int page_offset; - LASSERT (nob > 0); - LASSERT (niov > 0); - LASSERT (net != NULL); + LASSERT(nob > 0); + LASSERT(niov > 0); + LASSERT(net != NULL); while (offset >= iov->iov_len) { offset -= iov->iov_len; niov--; iov++; - LASSERT (niov > 0); + LASSERT(niov > 0); } sg = tx->tx_frags; do { - LASSERT (niov > 0); + LASSERT(niov > 0); vaddr = ((unsigned long)iov->iov_base) + offset; page_offset = vaddr & (PAGE_SIZE - 1); page = kiblnd_kvaddr_to_page(vaddr); if (page == NULL) { - CERROR ("Can't find page\n"); + CERROR("Can't find page\n"); return -EFAULT; } @@ -749,7 +749,7 @@ kiblnd_setup_rd_iov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, } static int -kiblnd_setup_rd_kiov (lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, +kiblnd_setup_rd_kiov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, int nkiov, lnet_kiov_t *kiov, int offset, int nob) { kib_net_t *net = ni->ni_data; @@ -758,20 +758,20 @@ kiblnd_setup_rd_kiov (lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, CDEBUG(D_NET, "niov %d offset %d nob %d\n", nkiov, offset, nob); - LASSERT (nob > 0); - LASSERT (nkiov > 0); - LASSERT (net != NULL); + LASSERT(nob > 0); + LASSERT(nkiov > 0); + LASSERT(net != NULL); while (offset >= kiov->kiov_len) { offset -= kiov->kiov_len; nkiov--; kiov++; - LASSERT (nkiov > 0); + LASSERT(nkiov > 0); } sg = tx->tx_frags; do { - LASSERT (nkiov > 0); + LASSERT(nkiov > 0); fragnob = min((int)(kiov->kiov_len - offset), nob); @@ -789,7 +789,7 @@ kiblnd_setup_rd_kiov (lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, } static int -kiblnd_post_tx_locked (kib_conn_t *conn, kib_tx_t *tx, int credit) +kiblnd_post_tx_locked(kib_conn_t *conn, kib_tx_t *tx, int credit) __releases(conn->ibc_lock) __acquires(conn->ibc_lock) { @@ -800,16 +800,16 @@ kiblnd_post_tx_locked (kib_conn_t *conn, kib_tx_t *tx, int credit) int done; struct ib_send_wr *bad_wrq; - LASSERT (tx->tx_queued); + LASSERT(tx->tx_queued); /* We rely on this for QP sizing */ - LASSERT (tx->tx_nwrq > 0); - LASSERT (tx->tx_nwrq <= 1 + IBLND_RDMA_FRAGS(ver)); + LASSERT(tx->tx_nwrq > 0); + LASSERT(tx->tx_nwrq <= 1 + IBLND_RDMA_FRAGS(ver)); - LASSERT (credit == 0 || credit == 1); - LASSERT (conn->ibc_outstanding_credits >= 0); - LASSERT (conn->ibc_outstanding_credits <= IBLND_MSG_QUEUE_SIZE(ver)); - LASSERT (conn->ibc_credits >= 0); - LASSERT (conn->ibc_credits <= IBLND_MSG_QUEUE_SIZE(ver)); + LASSERT(credit == 0 || credit == 1); + LASSERT(conn->ibc_outstanding_credits >= 0); + LASSERT(conn->ibc_outstanding_credits <= IBLND_MSG_QUEUE_SIZE(ver)); + LASSERT(conn->ibc_credits >= 0); + LASSERT(conn->ibc_credits <= IBLND_MSG_QUEUE_SIZE(ver)); if (conn->ibc_nsends_posted == IBLND_CONCURRENT_SENDS(ver)) { /* tx completions outstanding... */ @@ -923,7 +923,7 @@ kiblnd_post_tx_locked (kib_conn_t *conn, kib_tx_t *tx, int credit) } void -kiblnd_check_sends (kib_conn_t *conn) +kiblnd_check_sends(kib_conn_t *conn) { int ver = conn->ibc_version; lnet_ni_t *ni = conn->ibc_peer->ibp_ni; @@ -938,10 +938,10 @@ kiblnd_check_sends (kib_conn_t *conn) spin_lock(&conn->ibc_lock); - LASSERT (conn->ibc_nsends_posted <= IBLND_CONCURRENT_SENDS(ver)); - LASSERT (!IBLND_OOB_CAPABLE(ver) || + LASSERT(conn->ibc_nsends_posted <= IBLND_CONCURRENT_SENDS(ver)); + LASSERT(!IBLND_OOB_CAPABLE(ver) || conn->ibc_noops_posted <= IBLND_OOB_MSGS(ver)); - LASSERT (conn->ibc_reserved_credits >= 0); + LASSERT(conn->ibc_reserved_credits >= 0); while (conn->ibc_reserved_credits > 0 && !list_empty(&conn->ibc_tx_queue_rsrvd)) { @@ -974,7 +974,7 @@ kiblnd_check_sends (kib_conn_t *conn) tx = list_entry(conn->ibc_tx_queue_nocred.next, kib_tx_t, tx_list); } else if (!list_empty(&conn->ibc_tx_noops)) { - LASSERT (!IBLND_OOB_CAPABLE(ver)); + LASSERT(!IBLND_OOB_CAPABLE(ver)); credit = 1; tx = list_entry(conn->ibc_tx_noops.next, kib_tx_t, tx_list); @@ -995,13 +995,13 @@ kiblnd_check_sends (kib_conn_t *conn) } static void -kiblnd_tx_complete (kib_tx_t *tx, int status) +kiblnd_tx_complete(kib_tx_t *tx, int status) { int failed = (status != IB_WC_SUCCESS); kib_conn_t *conn = tx->tx_conn; int idle; - LASSERT (tx->tx_sending > 0); + LASSERT(tx->tx_sending > 0); if (failed) { if (conn->ibc_state == IBLND_CONN_ESTABLISHED) @@ -1049,22 +1049,22 @@ kiblnd_tx_complete (kib_tx_t *tx, int status) } void -kiblnd_init_tx_msg (lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob) +kiblnd_init_tx_msg(lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob) { kib_hca_dev_t *hdev = tx->tx_pool->tpo_hdev; struct ib_sge *sge = &tx->tx_sge[tx->tx_nwrq]; struct ib_send_wr *wrq = &tx->tx_wrq[tx->tx_nwrq]; - int nob = offsetof (kib_msg_t, ibm_u) + body_nob; + int nob = offsetof(kib_msg_t, ibm_u) + body_nob; struct ib_mr *mr; - LASSERT (tx->tx_nwrq >= 0); - LASSERT (tx->tx_nwrq < IBLND_MAX_RDMA_FRAGS + 1); - LASSERT (nob <= IBLND_MSG_SIZE); + LASSERT(tx->tx_nwrq >= 0); + LASSERT(tx->tx_nwrq < IBLND_MAX_RDMA_FRAGS + 1); + LASSERT(nob <= IBLND_MSG_SIZE); kiblnd_init_msg(tx->tx_msg, type, body_nob); mr = kiblnd_find_dma_mr(hdev, tx->tx_msgaddr, nob); - LASSERT (mr != NULL); + LASSERT(mr != NULL); sge->lkey = mr->lkey; sge->addr = tx->tx_msgaddr; @@ -1083,7 +1083,7 @@ kiblnd_init_tx_msg (lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob) } int -kiblnd_init_rdma (kib_conn_t *conn, kib_tx_t *tx, int type, +kiblnd_init_rdma(kib_conn_t *conn, kib_tx_t *tx, int type, int resid, kib_rdma_desc_t *dstrd, __u64 dstcookie) { kib_msg_t *ibmsg = tx->tx_msg; @@ -1095,9 +1095,9 @@ kiblnd_init_rdma (kib_conn_t *conn, kib_tx_t *tx, int type, int dstidx; int wrknob; - LASSERT (!in_interrupt()); - LASSERT (tx->tx_nwrq == 0); - LASSERT (type == IBLND_MSG_GET_DONE || + LASSERT(!in_interrupt()); + LASSERT(tx->tx_nwrq == 0); + LASSERT(type == IBLND_MSG_GET_DONE || type == IBLND_MSG_PUT_DONE); srcidx = dstidx = 0; @@ -1162,19 +1162,19 @@ kiblnd_init_rdma (kib_conn_t *conn, kib_tx_t *tx, int type, ibmsg->ibm_u.completion.ibcm_status = rc; ibmsg->ibm_u.completion.ibcm_cookie = dstcookie; kiblnd_init_tx_msg(conn->ibc_peer->ibp_ni, tx, - type, sizeof (kib_completion_msg_t)); + type, sizeof(kib_completion_msg_t)); return rc; } void -kiblnd_queue_tx_locked (kib_tx_t *tx, kib_conn_t *conn) +kiblnd_queue_tx_locked(kib_tx_t *tx, kib_conn_t *conn) { struct list_head *q; - LASSERT (tx->tx_nwrq > 0); /* work items set up */ - LASSERT (!tx->tx_queued); /* not queued for sending already */ - LASSERT (conn->ibc_state >= IBLND_CONN_ESTABLISHED); + LASSERT(tx->tx_nwrq > 0); /* work items set up */ + LASSERT(!tx->tx_queued); /* not queued for sending already */ + LASSERT(conn->ibc_state >= IBLND_CONN_ESTABLISHED); tx->tx_queued = 1; tx->tx_deadline = jiffies + (*kiblnd_tunables.kib_timeout * HZ); @@ -1182,11 +1182,11 @@ kiblnd_queue_tx_locked (kib_tx_t *tx, kib_conn_t *conn) if (tx->tx_conn == NULL) { kiblnd_conn_addref(conn); tx->tx_conn = conn; - LASSERT (tx->tx_msg->ibm_type != IBLND_MSG_PUT_DONE); + LASSERT(tx->tx_msg->ibm_type != IBLND_MSG_PUT_DONE); } else { /* PUT_DONE first attached to conn as a PUT_REQ */ - LASSERT (tx->tx_conn == conn); - LASSERT (tx->tx_msg->ibm_type == IBLND_MSG_PUT_DONE); + LASSERT(tx->tx_conn == conn); + LASSERT(tx->tx_msg->ibm_type == IBLND_MSG_PUT_DONE); } switch (tx->tx_msg->ibm_type) { @@ -1221,7 +1221,7 @@ kiblnd_queue_tx_locked (kib_tx_t *tx, kib_conn_t *conn) } void -kiblnd_queue_tx (kib_tx_t *tx, kib_conn_t *conn) +kiblnd_queue_tx(kib_tx_t *tx, kib_conn_t *conn) { spin_lock(&conn->ibc_lock); kiblnd_queue_tx_locked(tx, conn); @@ -1268,7 +1268,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, } static void -kiblnd_connect_peer (kib_peer_t *peer) +kiblnd_connect_peer(kib_peer_t *peer) { struct rdma_cm_id *cmid; kib_dev_t *dev; @@ -1277,8 +1277,8 @@ kiblnd_connect_peer (kib_peer_t *peer) struct sockaddr_in dstaddr; int rc; - LASSERT (net != NULL); - LASSERT (peer->ibp_connecting > 0); + LASSERT(net != NULL); + LASSERT(peer->ibp_connecting > 0); cmid = kiblnd_rdma_create_id(kiblnd_cm_callback, peer, RDMA_PS_TCP, IB_QPT_RC); @@ -1318,7 +1318,7 @@ kiblnd_connect_peer (kib_peer_t *peer) goto failed2; } - LASSERT (cmid->device != NULL); + LASSERT(cmid->device != NULL); CDEBUG(D_NET, "%s: connection bound to %s:%pI4h:%s\n", libcfs_nid2str(peer->ibp_nid), dev->ibd_ifname, &dev->ibd_ifip, cmid->device->name); @@ -1333,7 +1333,7 @@ kiblnd_connect_peer (kib_peer_t *peer) } void -kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) +kiblnd_launch_tx(lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) { kib_peer_t *peer; kib_peer_t *peer2; @@ -1345,8 +1345,8 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) /* If I get here, I've committed to send, so I complete the tx with * failure on any problems */ - LASSERT (tx == NULL || tx->tx_conn == NULL); /* only set when assigned a conn */ - LASSERT (tx == NULL || tx->tx_nwrq > 0); /* work items have been set up */ + LASSERT(tx == NULL || tx->tx_conn == NULL); /* only set when assigned a conn */ + LASSERT(tx == NULL || tx->tx_nwrq > 0); /* work items have been set up */ /* First time, just use a read lock since I expect to find my peer * connected */ @@ -1374,7 +1374,7 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) if (peer != NULL) { if (list_empty(&peer->ibp_conns)) { /* found a peer, but it's still connecting... */ - LASSERT (peer->ibp_connecting != 0 || + LASSERT(peer->ibp_connecting != 0 || peer->ibp_accepting != 0); if (tx != NULL) list_add_tail(&tx->tx_list, @@ -1413,7 +1413,7 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) if (peer2 != NULL) { if (list_empty(&peer2->ibp_conns)) { /* found a peer, but it's still connecting... */ - LASSERT (peer2->ibp_connecting != 0 || + LASSERT(peer2->ibp_connecting != 0 || peer2->ibp_accepting != 0); if (tx != NULL) list_add_tail(&tx->tx_list, @@ -1435,11 +1435,11 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) } /* Brand new peer */ - LASSERT (peer->ibp_connecting == 0); + LASSERT(peer->ibp_connecting == 0); peer->ibp_connecting = 1; /* always called with a ref on ni, which prevents ni being shutdown */ - LASSERT (((kib_net_t *)ni->ni_data)->ibn_shutdown == 0); + LASSERT(((kib_net_t *)ni->ni_data)->ibn_shutdown == 0); if (tx != NULL) list_add_tail(&tx->tx_list, &peer->ibp_tx_queue); @@ -1454,7 +1454,7 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) } int -kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) +kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) { lnet_hdr_t *hdr = &lntmsg->msg_hdr; int type = lntmsg->msg_type; @@ -1476,13 +1476,13 @@ kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) CDEBUG(D_NET, "sending %d bytes in %d frags to %s\n", payload_nob, payload_niov, libcfs_id2str(target)); - LASSERT (payload_nob == 0 || payload_niov > 0); - LASSERT (payload_niov <= LNET_MAX_IOV); + LASSERT(payload_nob == 0 || payload_niov > 0); + LASSERT(payload_niov <= LNET_MAX_IOV); /* Thread context */ - LASSERT (!in_interrupt()); + LASSERT(!in_interrupt()); /* payload is either all vaddrs or all pages */ - LASSERT (!(payload_kiov != NULL && payload_iov != NULL)); + LASSERT(!(payload_kiov != NULL && payload_iov != NULL)); switch (type) { default: @@ -1490,7 +1490,7 @@ kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) return -EIO; case LNET_MSG_ACK: - LASSERT (payload_nob == 0); + LASSERT(payload_nob == 0); break; case LNET_MSG_GET: @@ -1592,12 +1592,12 @@ kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) /* send IMMEDIATE */ - LASSERT (offsetof(kib_msg_t, ibm_u.immediate.ibim_payload[payload_nob]) + LASSERT(offsetof(kib_msg_t, ibm_u.immediate.ibim_payload[payload_nob]) <= IBLND_MSG_SIZE); tx = kiblnd_get_idle_tx(ni, target.nid); if (tx == NULL) { - CERROR ("Can't send %d to %s: tx descs exhausted\n", + CERROR("Can't send %d to %s: tx descs exhausted\n", type, libcfs_nid2str(target.nid)); return -ENOMEM; } @@ -1625,7 +1625,7 @@ kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) } static void -kiblnd_reply (lnet_ni_t *ni, kib_rx_t *rx, lnet_msg_t *lntmsg) +kiblnd_reply(lnet_ni_t *ni, kib_rx_t *rx, lnet_msg_t *lntmsg) { lnet_process_id_t target = lntmsg->msg_target; unsigned int niov = lntmsg->msg_niov; @@ -1687,7 +1687,7 @@ kiblnd_reply (lnet_ni_t *ni, kib_rx_t *rx, lnet_msg_t *lntmsg) } int -kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, +kiblnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen) { @@ -1700,10 +1700,10 @@ kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, int post_credit = IBLND_POSTRX_PEER_CREDIT; int rc = 0; - LASSERT (mlen <= rlen); - LASSERT (!in_interrupt()); + LASSERT(mlen <= rlen); + LASSERT(!in_interrupt()); /* Either all pages or all vaddrs */ - LASSERT (!(kiov != NULL && iov != NULL)); + LASSERT(!(kiov != NULL && iov != NULL)); switch (rxmsg->ibm_type) { default: @@ -1712,7 +1712,7 @@ kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, case IBLND_MSG_IMMEDIATE: nob = offsetof(kib_msg_t, ibm_u.immediate.ibim_payload[rlen]); if (nob > rx->rx_nob) { - CERROR ("Immediate message from %s too big: %d(%d)\n", + CERROR("Immediate message from %s too big: %d(%d)\n", libcfs_nid2str(rxmsg->ibm_u.immediate.ibim_hdr.src_nid), nob, rx->rx_nob); rc = -EPROTO; @@ -1729,7 +1729,7 @@ kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, IBLND_MSG_SIZE, rxmsg, offsetof(kib_msg_t, ibm_u.immediate.ibim_payload), mlen); - lnet_finalize (ni, lntmsg, 0); + lnet_finalize(ni, lntmsg, 0); break; case IBLND_MSG_PUT_REQ: @@ -1812,13 +1812,13 @@ kiblnd_thread_start(int (*fn)(void *arg), void *arg, char *name) } static void -kiblnd_thread_fini (void) +kiblnd_thread_fini(void) { - atomic_dec (&kiblnd_data.kib_nthreads); + atomic_dec(&kiblnd_data.kib_nthreads); } void -kiblnd_peer_alive (kib_peer_t *peer) +kiblnd_peer_alive(kib_peer_t *peer) { /* This is racy, but everyone's only writing cfs_time_current() */ peer->ibp_last_alive = cfs_time_current(); @@ -1826,7 +1826,7 @@ kiblnd_peer_alive (kib_peer_t *peer) } static void -kiblnd_peer_notify (kib_peer_t *peer) +kiblnd_peer_notify(kib_peer_t *peer) { int error = 0; unsigned long last_alive = 0; @@ -1852,7 +1852,7 @@ kiblnd_peer_notify (kib_peer_t *peer) } void -kiblnd_close_conn_locked (kib_conn_t *conn, int error) +kiblnd_close_conn_locked(kib_conn_t *conn, int error) { /* This just does the immediate housekeeping. 'error' is zero for a * normal shutdown which can happen only after the connection has been @@ -1864,7 +1864,7 @@ kiblnd_close_conn_locked (kib_conn_t *conn, int error) kib_dev_t *dev; unsigned long flags; - LASSERT (error != 0 || conn->ibc_state >= IBLND_CONN_ESTABLISHED); + LASSERT(error != 0 || conn->ibc_state >= IBLND_CONN_ESTABLISHED); if (error != 0 && conn->ibc_comms_error == 0) conn->ibc_comms_error = error; @@ -1894,7 +1894,7 @@ kiblnd_close_conn_locked (kib_conn_t *conn, int error) list_del(&conn->ibc_list); /* connd (see below) takes over ibc_list's ref */ - if (list_empty (&peer->ibp_conns) && /* no more conns */ + if (list_empty(&peer->ibp_conns) && /* no more conns */ kiblnd_peer_active(peer)) { /* still in peer table */ kiblnd_unlink_peer_locked(peer); @@ -1957,22 +1957,22 @@ kiblnd_handle_early_rxs(kib_conn_t *conn) static void kiblnd_abort_txs(kib_conn_t *conn, struct list_head *txs) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); struct list_head *tmp; struct list_head *nxt; kib_tx_t *tx; spin_lock(&conn->ibc_lock); - list_for_each_safe (tmp, nxt, txs) { - tx = list_entry (tmp, kib_tx_t, tx_list); + list_for_each_safe(tmp, nxt, txs) { + tx = list_entry(tmp, kib_tx_t, tx_list); if (txs == &conn->ibc_active_txs) { - LASSERT (!tx->tx_queued); - LASSERT (tx->tx_waiting || + LASSERT(!tx->tx_queued); + LASSERT(tx->tx_waiting || tx->tx_sending != 0); } else { - LASSERT (tx->tx_queued); + LASSERT(tx->tx_queued); } tx->tx_status = -ECONNABORTED; @@ -1980,8 +1980,8 @@ kiblnd_abort_txs(kib_conn_t *conn, struct list_head *txs) if (tx->tx_sending == 0) { tx->tx_queued = 0; - list_del (&tx->tx_list); - list_add (&tx->tx_list, &zombies); + list_del(&tx->tx_list); + list_add(&tx->tx_list, &zombies); } } @@ -1991,10 +1991,10 @@ kiblnd_abort_txs(kib_conn_t *conn, struct list_head *txs) } static void -kiblnd_finalise_conn (kib_conn_t *conn) +kiblnd_finalise_conn(kib_conn_t *conn) { - LASSERT (!in_interrupt()); - LASSERT (conn->ibc_state > IBLND_CONN_INIT); + LASSERT(!in_interrupt()); + LASSERT(conn->ibc_state > IBLND_CONN_INIT); kiblnd_set_conn_state(conn, IBLND_CONN_DISCONNECTED); @@ -2016,21 +2016,21 @@ kiblnd_finalise_conn (kib_conn_t *conn) } void -kiblnd_peer_connect_failed (kib_peer_t *peer, int active, int error) +kiblnd_peer_connect_failed(kib_peer_t *peer, int active, int error) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); unsigned long flags; - LASSERT (error != 0); - LASSERT (!in_interrupt()); + LASSERT(error != 0); + LASSERT(!in_interrupt()); write_lock_irqsave(&kiblnd_data.kib_global_lock, flags); if (active) { - LASSERT (peer->ibp_connecting > 0); + LASSERT(peer->ibp_connecting > 0); peer->ibp_connecting--; } else { - LASSERT (peer->ibp_accepting > 0); + LASSERT(peer->ibp_accepting > 0); peer->ibp_accepting--; } @@ -2053,14 +2053,14 @@ kiblnd_peer_connect_failed (kib_peer_t *peer, int active, int error) peer->ibp_error = error; } else { /* Can't have blocked transmits if there are connections */ - LASSERT (list_empty(&peer->ibp_tx_queue)); + LASSERT(list_empty(&peer->ibp_tx_queue)); } write_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags); kiblnd_peer_notify(peer); - if (list_empty (&zombies)) + if (list_empty(&zombies)) return; CNETERR("Deleting messages for %s: connection failed\n", @@ -2084,8 +2084,8 @@ kiblnd_connreq_done(kib_conn_t *conn, int status) libcfs_nid2str(peer->ibp_nid), active, conn->ibc_version, status); - LASSERT (!in_interrupt()); - LASSERT ((conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT && + LASSERT(!in_interrupt()); + LASSERT((conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT && peer->ibp_connecting > 0) || (conn->ibc_state == IBLND_CONN_PASSIVE_WAIT && peer->ibp_accepting > 0)); @@ -2176,7 +2176,7 @@ kiblnd_reject(struct rdma_cm_id *cmid, kib_rej_t *rej) } static int -kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) +kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob) { rwlock_t *g_lock = &kiblnd_data.kib_global_lock; kib_msg_t *reqmsg = priv; @@ -2194,11 +2194,11 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) unsigned long flags; int rc; struct sockaddr_in *peer_addr; - LASSERT (!in_interrupt()); + LASSERT(!in_interrupt()); /* cmid inherits 'context' from the corresponding listener id */ ibdev = (kib_dev_t *)cmid->context; - LASSERT (ibdev != NULL); + LASSERT(ibdev != NULL); memset(&rej, 0, sizeof(rej)); rej.ibr_magic = IBLND_MSG_MAGIC; @@ -2366,8 +2366,8 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) peer = peer2; } else { /* Brand new peer */ - LASSERT (peer->ibp_accepting == 0); - LASSERT (peer->ibp_version == 0 && + LASSERT(peer->ibp_accepting == 0); + LASSERT(peer->ibp_version == 0 && peer->ibp_incarnation == 0); peer->ibp_accepting = 1; @@ -2375,7 +2375,7 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) peer->ibp_incarnation = reqmsg->ibm_srcstamp; /* I have a ref on ni that prevents it being shutdown */ - LASSERT (net->ibn_shutdown == 0); + LASSERT(net->ibn_shutdown == 0); kiblnd_peer_addref(peer); list_add_tail(&peer->ibp_list, kiblnd_nid2peerlist(nid)); @@ -2397,7 +2397,7 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) conn->ibc_incarnation = reqmsg->ibm_srcstamp; conn->ibc_credits = IBLND_MSG_QUEUE_SIZE(version); conn->ibc_reserved_credits = IBLND_MSG_QUEUE_SIZE(version); - LASSERT (conn->ibc_credits + conn->ibc_reserved_credits + IBLND_OOB_MSGS(version) + LASSERT(conn->ibc_credits + conn->ibc_reserved_credits + IBLND_OOB_MSGS(version) <= IBLND_RX_MSGS(version)); ackmsg = &conn->ibc_connvars->cv_msg; @@ -2449,7 +2449,7 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) } static void -kiblnd_reconnect (kib_conn_t *conn, int version, +kiblnd_reconnect(kib_conn_t *conn, int version, __u64 incarnation, int why, kib_connparams_t *cp) { kib_peer_t *peer = conn->ibc_peer; @@ -2457,8 +2457,8 @@ kiblnd_reconnect (kib_conn_t *conn, int version, int retry = 0; unsigned long flags; - LASSERT (conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT); - LASSERT (peer->ibp_connecting > 0); /* 'conn' at least */ + LASSERT(conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT); + LASSERT(peer->ibp_connecting > 0); /* 'conn' at least */ write_lock_irqsave(&kiblnd_data.kib_global_lock, flags); @@ -2512,12 +2512,12 @@ kiblnd_reconnect (kib_conn_t *conn, int version, } static void -kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob) +kiblnd_rejected(kib_conn_t *conn, int reason, void *priv, int priv_nob) { kib_peer_t *peer = conn->ibc_peer; - LASSERT (!in_interrupt()); - LASSERT (conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT); + LASSERT(!in_interrupt()); + LASSERT(conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT); switch (reason) { case IB_CM_REJ_STALE_CONN: @@ -2651,7 +2651,7 @@ kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob) } static void -kiblnd_check_connreply (kib_conn_t *conn, void *priv, int priv_nob) +kiblnd_check_connreply(kib_conn_t *conn, void *priv, int priv_nob) { kib_peer_t *peer = conn->ibc_peer; lnet_ni_t *ni = peer->ibp_ni; @@ -2661,7 +2661,7 @@ kiblnd_check_connreply (kib_conn_t *conn, void *priv, int priv_nob) int rc = kiblnd_unpack_msg(msg, priv_nob); unsigned long flags; - LASSERT (net != NULL); + LASSERT(net != NULL); if (rc != 0) { CERROR("Can't unpack connack from %s: %d\n", @@ -2730,7 +2730,7 @@ kiblnd_check_connreply (kib_conn_t *conn, void *priv, int priv_nob) conn->ibc_incarnation = msg->ibm_srcstamp; conn->ibc_credits = conn->ibc_reserved_credits = IBLND_MSG_QUEUE_SIZE(ver); - LASSERT (conn->ibc_credits + conn->ibc_reserved_credits + IBLND_OOB_MSGS(ver) + LASSERT(conn->ibc_credits + conn->ibc_reserved_credits + IBLND_OOB_MSGS(ver) <= IBLND_RX_MSGS(ver)); kiblnd_connreq_done(conn, 0); @@ -2742,13 +2742,13 @@ kiblnd_check_connreply (kib_conn_t *conn, void *priv, int priv_nob) * kiblnd_connreq_done(0) moves the conn state to ESTABLISHED, but then * immediately tears it down. */ - LASSERT (rc != 0); + LASSERT(rc != 0); conn->ibc_comms_error = rc; kiblnd_connreq_done(conn, 0); } static int -kiblnd_active_connect (struct rdma_cm_id *cmid) +kiblnd_active_connect(struct rdma_cm_id *cmid) { kib_peer_t *peer = (kib_peer_t *)cmid->context; kib_conn_t *conn; @@ -2913,7 +2913,7 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) LBUG(); case IBLND_CONN_PASSIVE_WAIT: - CERROR ("%s: REJECTED %d\n", + CERROR("%s: REJECTED %d\n", libcfs_nid2str(conn->ibc_peer->ibp_nid), event->status); kiblnd_connreq_done(conn, -ECONNRESET); @@ -2987,17 +2987,17 @@ kiblnd_check_txs_locked(kib_conn_t *conn, struct list_head *txs) kib_tx_t *tx; struct list_head *ttmp; - list_for_each (ttmp, txs) { - tx = list_entry (ttmp, kib_tx_t, tx_list); + list_for_each(ttmp, txs) { + tx = list_entry(ttmp, kib_tx_t, tx_list); if (txs != &conn->ibc_active_txs) { - LASSERT (tx->tx_queued); + LASSERT(tx->tx_queued); } else { - LASSERT (!tx->tx_queued); - LASSERT (tx->tx_waiting || tx->tx_sending != 0); + LASSERT(!tx->tx_queued); + LASSERT(tx->tx_waiting || tx->tx_sending != 0); } - if (cfs_time_aftereq (jiffies, tx->tx_deadline)) { + if (cfs_time_aftereq(jiffies, tx->tx_deadline)) { CERROR("Timed out tx: %s, %lu seconds\n", kiblnd_queue2str(conn, txs), cfs_duration_sec(jiffies - tx->tx_deadline)); @@ -3019,10 +3019,10 @@ kiblnd_conn_timed_out_locked(kib_conn_t *conn) } static void -kiblnd_check_conns (int idx) +kiblnd_check_conns(int idx) { - LIST_HEAD (closes); - LIST_HEAD (checksends); + LIST_HEAD(closes); + LIST_HEAD(checksends); struct list_head *peers = &kiblnd_data.kib_peers[idx]; struct list_head *ptmp; kib_peer_t *peer; @@ -3035,16 +3035,16 @@ kiblnd_check_conns (int idx) * take a look... */ read_lock_irqsave(&kiblnd_data.kib_global_lock, flags); - list_for_each (ptmp, peers) { - peer = list_entry (ptmp, kib_peer_t, ibp_list); + list_for_each(ptmp, peers) { + peer = list_entry(ptmp, kib_peer_t, ibp_list); - list_for_each (ctmp, &peer->ibp_conns) { + list_for_each(ctmp, &peer->ibp_conns) { int timedout; int sendnoop; conn = list_entry(ctmp, kib_conn_t, ibc_list); - LASSERT (conn->ibc_state == IBLND_CONN_ESTABLISHED); + LASSERT(conn->ibc_state == IBLND_CONN_ESTABLISHED); spin_lock(&conn->ibc_lock); @@ -3101,11 +3101,11 @@ kiblnd_check_conns (int idx) } static void -kiblnd_disconnect_conn (kib_conn_t *conn) +kiblnd_disconnect_conn(kib_conn_t *conn) { - LASSERT (!in_interrupt()); - LASSERT (current == kiblnd_data.kib_connd); - LASSERT (conn->ibc_state == IBLND_CONN_CLOSING); + LASSERT(!in_interrupt()); + LASSERT(current == kiblnd_data.kib_connd); + LASSERT(conn->ibc_state == IBLND_CONN_CLOSING); rdma_disconnect(conn->ibc_cmid); kiblnd_finalise_conn(conn); @@ -3114,7 +3114,7 @@ kiblnd_disconnect_conn (kib_conn_t *conn) } int -kiblnd_connd (void *arg) +kiblnd_connd(void *arg) { wait_queue_t wait; unsigned long flags; @@ -3125,7 +3125,7 @@ kiblnd_connd (void *arg) int peer_index = 0; unsigned long deadline = jiffies; - cfs_block_allsigs (); + cfs_block_allsigs(); init_waitqueue_entry(&wait, current); kiblnd_data.kib_connd = current; @@ -3136,7 +3136,7 @@ kiblnd_connd (void *arg) dropped_lock = 0; - if (!list_empty (&kiblnd_data.kib_connd_zombies)) { + if (!list_empty(&kiblnd_data.kib_connd_zombies)) { conn = list_entry(kiblnd_data. \ kib_connd_zombies.next, kib_conn_t, ibc_list); @@ -3239,7 +3239,7 @@ kiblnd_qp_event(struct ib_event *event, void *arg) } static void -kiblnd_complete (struct ib_wc *wc) +kiblnd_complete(struct ib_wc *wc) { switch (kiblnd_wreqid2type(wc->wr_id)) { default: @@ -3440,9 +3440,9 @@ kiblnd_failover_thread(void *arg) unsigned long flags; int rc; - LASSERT (*kiblnd_tunables.kib_dev_failover != 0); + LASSERT(*kiblnd_tunables.kib_dev_failover != 0); - cfs_block_allsigs (); + cfs_block_allsigs(); init_waitqueue_entry(&wait, current); write_lock_irqsave(glock, flags); @@ -3469,7 +3469,7 @@ kiblnd_failover_thread(void *arg) write_lock_irqsave(glock, flags); - LASSERT (dev->ibd_failover); + LASSERT(dev->ibd_failover); dev->ibd_failover = 0; if (rc >= 0) { /* Device is OK or failover succeed */ dev->ibd_next_failover = cfs_time_shift(3); -- cgit v1.2.3 From 40c6dccfc1dfa48ec98b61a6a6e03199c09a6dc3 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sat, 28 Feb 2015 22:20:14 +0300 Subject: Staging: lustre: lustre: idlm: Move trailing statement to next line This patch Fix both "trailing statement should be on next line" and space before semicolon errors addressed by checkpatch.pl Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index a89eebaedabf..fd9b059361f9 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -151,7 +151,8 @@ static inline int lock_mode_to_index(ldlm_mode_t mode) LASSERT(mode != 0); LASSERT(IS_PO2(mode)); - for (index = -1; mode; index++, mode >>= 1) ; + for (index = -1; mode; index++) + mode >>= 1; LASSERT(index < LCK_MODE_NUM); return index; } -- cgit v1.2.3 From 2c2b7c05ef1ca1b50a6fb557002f1d6ec3dfd601 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sat, 28 Feb 2015 22:33:47 +0300 Subject: Staging: lustre: lustre: ldlm: Concatenate strings into single string This patch concatenate two consecutive strings into one, addressing checkpatch.pl warning: "Consecutive strings are generally better as a single string" Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index d20d277dc2f7..7574502919ca 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -689,8 +689,8 @@ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) " GP: %d\n", grant_step, grant_plan); } - seq_printf(m, " GR: %d\n" " CR: %d\n" " GS: %d\n" - " G: %d\n" " L: %d\n", + seq_printf(m, " GR: %d\n CR: %d\n GS: %d\n" + " G: %d\n L: %d\n", grant_rate, cancel_rate, grant_speed, granted, limit); -- cgit v1.2.3 From d3422d5ef09953bc5bb7468e98d8d12bad0a95c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Sat, 28 Feb 2015 22:14:19 +0200 Subject: Staging: lustre:lnet: klnds: socklnd: Remove space after the name of that function Function names must be adjacent to the parenthesis opened after.That's why remove space after the name of that function. This Warning found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c index b2f88eb47bba..8596581f54ff 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c @@ -55,8 +55,8 @@ ksocknal_next_tx_carrier(ksock_conn_t *conn) ksock_tx_t *tx = conn->ksnc_tx_carrier; /* Called holding BH lock: conn->ksnc_scheduler->kss_lock */ - LASSERT (!list_empty(&conn->ksnc_tx_queue)); - LASSERT (tx != NULL); + LASSERT(!list_empty(&conn->ksnc_tx_queue)); + LASSERT(tx != NULL); /* Next TX that can carry ZC-ACK or LNet message */ if (tx->tx_list.next == &conn->ksnc_tx_queue) { @@ -65,7 +65,7 @@ ksocknal_next_tx_carrier(ksock_conn_t *conn) } else { conn->ksnc_tx_carrier = list_entry(tx->tx_list.next, ksock_tx_t, tx_list); - LASSERT (conn->ksnc_tx_carrier->tx_msg.ksm_type == tx->tx_msg.ksm_type); + LASSERT(conn->ksnc_tx_carrier->tx_msg.ksm_type == tx->tx_msg.ksm_type); } } @@ -75,7 +75,7 @@ ksocknal_queue_tx_zcack_v2(ksock_conn_t *conn, { ksock_tx_t *tx = conn->ksnc_tx_carrier; - LASSERT (tx_ack == NULL || + LASSERT(tx_ack == NULL || tx_ack->tx_msg.ksm_type == KSOCK_MSG_NOOP); /* @@ -139,7 +139,7 @@ ksocknal_queue_tx_msg_v2(ksock_conn_t *conn, ksock_tx_t *tx_msg) return NULL; } - LASSERT (tx->tx_msg.ksm_type == KSOCK_MSG_NOOP); + LASSERT(tx->tx_msg.ksm_type == KSOCK_MSG_NOOP); /* There is a noop zc-ack can be piggybacked */ tx_msg->tx_msg.ksm_zc_cookies[1] = tx->tx_msg.ksm_zc_cookies[1]; @@ -162,7 +162,7 @@ ksocknal_queue_tx_zcack_v3(ksock_conn_t *conn, return ksocknal_queue_tx_zcack_v2(conn, tx_ack, cookie); /* non-blocking ZC-ACK (to router) */ - LASSERT (tx_ack == NULL || + LASSERT(tx_ack == NULL || tx_ack->tx_msg.ksm_type == KSOCK_MSG_NOOP); tx = conn->ksnc_tx_carrier; @@ -185,7 +185,7 @@ ksocknal_queue_tx_zcack_v3(ksock_conn_t *conn, if (tx->tx_msg.ksm_zc_cookies[1] == SOCKNAL_KEEPALIVE_PING) { /* replace the keepalive PING with a real ACK */ - LASSERT (tx->tx_msg.ksm_zc_cookies[0] == 0); + LASSERT(tx->tx_msg.ksm_zc_cookies[0] == 0); tx->tx_msg.ksm_zc_cookies[1] = cookie; return 1; } @@ -220,7 +220,7 @@ ksocknal_queue_tx_zcack_v3(ksock_conn_t *conn, __u64 tmp = 0; /* two separated cookies: (a+2, a) or (a+1, a) */ - LASSERT (tx->tx_msg.ksm_zc_cookies[0] - + LASSERT(tx->tx_msg.ksm_zc_cookies[0] - tx->tx_msg.ksm_zc_cookies[1] <= 2); if (tx->tx_msg.ksm_zc_cookies[0] - @@ -408,7 +408,7 @@ ksocknal_handle_zcack(ksock_conn_t *conn, __u64 cookie1, __u64 cookie2) ksock_peer_t *peer = conn->ksnc_peer; ksock_tx_t *tx; ksock_tx_t *tmp; - LIST_HEAD (zlist); + LIST_HEAD(zlist); int count; if (cookie1 == 0) @@ -450,7 +450,7 @@ ksocknal_handle_zcack(ksock_conn_t *conn, __u64 cookie1, __u64 cookie2) } static int -ksocknal_send_hello_v1 (ksock_conn_t *conn, ksock_hello_msg_t *hello) +ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) { struct socket *sock = conn->ksnc_sock; lnet_hdr_t *hdr; @@ -526,7 +526,7 @@ out: } static int -ksocknal_send_hello_v2 (ksock_conn_t *conn, ksock_hello_msg_t *hello) +ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) { struct socket *sock = conn->ksnc_sock; int rc; @@ -584,12 +584,12 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, } rc = libcfs_sock_read(sock, &hdr->src_nid, - sizeof (*hdr) - offsetof (lnet_hdr_t, src_nid), + sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), timeout); if (rc != 0) { CERROR("Error %d reading rest of HELLO hdr from %pI4h\n", rc, &conn->ksnc_ipaddr); - LASSERT (rc < 0 && rc != -EALREADY); + LASSERT(rc < 0 && rc != -EALREADY); goto out; } @@ -602,12 +602,12 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, goto out; } - hello->kshm_src_nid = le64_to_cpu (hdr->src_nid); - hello->kshm_src_pid = le32_to_cpu (hdr->src_pid); - hello->kshm_src_incarnation = le64_to_cpu (hdr->msg.hello.incarnation); - hello->kshm_ctype = le32_to_cpu (hdr->msg.hello.type); - hello->kshm_nips = le32_to_cpu (hdr->payload_length) / - sizeof (__u32); + hello->kshm_src_nid = le64_to_cpu(hdr->src_nid); + hello->kshm_src_pid = le32_to_cpu(hdr->src_pid); + hello->kshm_src_incarnation = le64_to_cpu(hdr->msg.hello.incarnation); + hello->kshm_ctype = le32_to_cpu(hdr->msg.hello.type); + hello->kshm_nips = le32_to_cpu(hdr->payload_length) / + sizeof(__u32); if (hello->kshm_nips > LNET_MAX_INTERFACES) { CERROR("Bad nips %d from ip %pI4h\n", @@ -645,7 +645,7 @@ out: } static int -ksocknal_recv_hello_v2 (ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout) +ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout) { struct socket *sock = conn->ksnc_sock; int rc; -- cgit v1.2.3 From fe0eb1729e908229c472fd339f8dac44f203ec54 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sun, 1 Mar 2015 03:34:11 +0300 Subject: Staging: lustre: Fix externs should be avoided in .c This patch moves extern declaration to ldlm_internal.h. Remove prototype from ldlm_lockd.c and ldlm_lock.c. Issue addressed by checkpatch.pl. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 4 ++++ drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 -- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index 17271b0965bc..5bf948810594 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -177,6 +177,10 @@ int ldlm_bl_to_thread_list(struct ldlm_namespace *ns, void ldlm_handle_bl_callback(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld, struct ldlm_lock *lock); +extern struct kmem_cache *ldlm_resource_slab; + +/* ldlm_lockd.c & ldlm_lock.c */ +extern struct kmem_cache *ldlm_lock_slab; /* ldlm_extent.c */ void ldlm_extent_add_lock(struct ldlm_resource *res, struct ldlm_lock *lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index d7fa934549bf..84b111eb48fa 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -151,8 +151,6 @@ char *ldlm_it2str(int it) } EXPORT_SYMBOL(ldlm_it2str); -extern struct kmem_cache *ldlm_lock_slab; - void ldlm_register_intent(struct ldlm_namespace *ns, ldlm_res_policy arg) { diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index 98fbd3f7e751..e0a8157b4e84 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -55,8 +55,6 @@ static char *ldlm_cpts; module_param(ldlm_cpts, charp, 0444); MODULE_PARM_DESC(ldlm_cpts, "CPU partitions ldlm threads should run on"); -extern struct kmem_cache *ldlm_resource_slab; -extern struct kmem_cache *ldlm_lock_slab; static struct mutex ldlm_ref_mutex; static int ldlm_refcount; -- cgit v1.2.3 From 629ecb5b3a0489a43959b68bbc610176807ef821 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Sun, 1 Mar 2015 14:39:06 +0530 Subject: staging: lustre: Remove space in function call. This patch fixes the following checkpatch.pl warning: WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 8f8c81d8a47f..7c8577761701 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1605,7 +1605,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) struct lov_stripe_md *lsm = md->lsm; struct ll_sb_info *sbi = ll_i2sbi(inode); - LASSERT ((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0)); + LASSERT((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0)); if (lsm != NULL) { if (!lli->lli_has_smd && !(sbi->ll_flags & LL_SBI_LAYOUT_LOCK)) -- cgit v1.2.3 From 22e08f6384a83037dfcbe208d5f69d6f7ddf3e60 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sun, 1 Mar 2015 20:21:52 +0200 Subject: Staging: lustre: Remove space after function name Fix checkpatch.pl issues with "space prohibited between function name and open parenthesis" in lporc_echo.c Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdecho/lproc_echo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdecho/lproc_echo.c b/drivers/staging/lustre/lustre/obdecho/lproc_echo.c index 1d3bf6c93129..0beb97db7c7d 100644 --- a/drivers/staging/lustre/lustre/obdecho/lproc_echo.c +++ b/drivers/staging/lustre/lustre/obdecho/lproc_echo.c @@ -36,7 +36,7 @@ #include "../include/lprocfs_status.h" #include "../include/obd_class.h" -#if defined (CONFIG_PROC_FS) +#if defined(CONFIG_PROC_FS) LPROC_SEQ_FOPS_RO_TYPE(echo, uuid); static struct lprocfs_vars lprocfs_echo_obd_vars[] = { { "uuid", &echo_uuid_fops, NULL, 0 }, -- cgit v1.2.3 From 30211d0d9df78c8135d9f5cadc77a8baa9f83793 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sun, 1 Mar 2015 22:04:30 +0200 Subject: Staging: lustre: Fix __packed is preferred over __attribute__((packed)) in libcfs_kernelcomm.h Fix checkpatch.pl issues with __packed is preferred over __attribute__((packed)) in libcfs_kernelcomm.h Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index 46887700f276..a989d2666230 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -107,7 +107,7 @@ typedef struct lustre_kernelcomm { __u32 lk_group; __u32 lk_data; __u32 lk_flags; -} __attribute__((packed)) lustre_kernelcomm; +} __packed lustre_kernelcomm; /* Userspace methods */ int libcfs_ukuc_start(lustre_kernelcomm *l, int groups); -- cgit v1.2.3 From 11107ffe2cd1c1dc5948713fc08a1372185be0d5 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 15:10:30 +0200 Subject: staging: fbtft: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index ac4287f9d6b8..8ca45110cfbe 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -1046,7 +1046,6 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info) { struct fbtft_par *par = fb_info->par; struct spi_device *spi = par->spi; - int ret; if (spi) spi_set_drvdata(spi, NULL); @@ -1055,8 +1054,7 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info) if (par->fbtftops.unregister_backlight) par->fbtftops.unregister_backlight(par); fbtft_sysfs_exit(par); - ret = unregister_framebuffer(fb_info); - return ret; + return unregister_framebuffer(fb_info); } EXPORT_SYMBOL(fbtft_unregister_framebuffer); -- cgit v1.2.3 From e20af8acf1b538496827cd1e3b7b29631443528a Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Fri, 27 Feb 2015 15:11:02 +0200 Subject: staging: dgap: remove unused variable This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgap/dgap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 7184747e0652..914e332e13a1 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -3979,7 +3979,6 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value) int result; u8 mstat; ulong lock_flags; - int rc; spin_lock_irqsave(&ch->ch_lock, lock_flags); @@ -4004,9 +4003,7 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value) if (mstat & D_CD(ch)) result |= TIOCM_CD; - rc = put_user(result, value); - - return rc; + return put_user(result, value); } /* -- cgit v1.2.3 From 1862eec4fe45e2d33fb166af3f8e601fc2233d76 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Fri, 27 Feb 2015 21:28:29 +0530 Subject: staging: gdm72xx: Condense two statements into one to improve code readability. This patch removes a variable assignmnet to a value, used only for returning that value. The following coccinelle script was used to discover it: @@ expression ret; identifier f; @@ -ret = +return f(...); -return ret; Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_qos.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index af24c57b8232..96bf2bf87ff4 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -54,8 +54,7 @@ static void *alloc_qos_entry(void) } spin_unlock_irqrestore(&qos_free_list.lock, flags); - entry = kmalloc(sizeof(*entry), GFP_ATOMIC); - return entry; + return kmalloc(sizeof(*entry), GFP_ATOMIC); } static void free_qos_entry(void *entry) -- cgit v1.2.3 From c703c750cc247c5b06aef5cc054e62543c79e6b5 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 27 Feb 2015 23:25:48 +0530 Subject: Staging: rtl8712: Eliminate use of _set_timer This patch introduces the use of API function mod_timer instead of driver specific function _set_timer as it is a more efficient and standard way to update the expire field of an active timer. Also, definition of function _set_timer is removed as it is no longer needed after this change. Here, these cases are handled using Coccinelle and semantic patch used for this is as follows: @@ expression x; expression y;@@ - _set_timer (&x, y); + mod_timer (&x, jiffies + msecs_to_jiffies (y)); Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/mlme_linux.c | 7 +- drivers/staging/rtl8712/os_intfs.c | 7 +- drivers/staging/rtl8712/osdep_service.h | 5 - drivers/staging/rtl8712/rtl8712_led.c | 324 +++++++++++++++------------- drivers/staging/rtl8712/rtl8712_recv.c | 4 +- drivers/staging/rtl8712/rtl871x_cmd.c | 9 +- drivers/staging/rtl8712/rtl871x_ioctl_set.c | 3 +- drivers/staging/rtl8712/rtl871x_mlme.c | 14 +- 8 files changed, 199 insertions(+), 174 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/mlme_linux.c b/drivers/staging/rtl8712/mlme_linux.c index 354bd03e700f..53999e8aa1c1 100644 --- a/drivers/staging/rtl8712/mlme_linux.c +++ b/drivers/staging/rtl8712/mlme_linux.c @@ -37,8 +37,8 @@ static void sitesurvey_ctrl_handler(void *FunctionContext) struct _adapter *adapter = (struct _adapter *)FunctionContext; _r8712_sitesurvey_ctrl_handler(adapter); - _set_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer, - 3000); + mod_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer, + jiffies + msecs_to_jiffies(3000)); } static void join_timeout_handler (void *FunctionContext) @@ -68,7 +68,8 @@ static void wdg_timeout_handler (void *FunctionContext) _r8712_wdg_timeout_handler(adapter); - _set_timer(&adapter->mlmepriv.wdg_timer, 2000); + mod_timer(&adapter->mlmepriv.wdg_timer, + jiffies + msecs_to_jiffies(2000)); } void r8712_init_mlme_timer(struct _adapter *padapter) diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index 13debb59ad97..64cdceead13b 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -255,9 +255,10 @@ void r8712_stop_drv_threads(struct _adapter *padapter) static void start_drv_timers(struct _adapter *padapter) { - _set_timer(&padapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer, - 5000); - _set_timer(&padapter->mlmepriv.wdg_timer, 2000); + mod_timer(&padapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer, + jiffies + msecs_to_jiffies(5000)); + mod_timer(&padapter->mlmepriv.wdg_timer, + jiffies + msecs_to_jiffies(2000)); } void r8712_stop_drv_timers(struct _adapter *padapter) diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h index 36348d900d34..54c4c470cd8e 100644 --- a/drivers/staging/rtl8712/osdep_service.h +++ b/drivers/staging/rtl8712/osdep_service.h @@ -69,11 +69,6 @@ static inline void _init_timer(struct timer_list *ptimer, init_timer(ptimer); } -static inline void _set_timer(struct timer_list *ptimer, u32 delay_time) -{ - mod_timer(ptimer, (jiffies+msecs_to_jiffies(delay_time))); -} - static inline void _cancel_timer(struct timer_list *ptimer, u8 *bcancelled) { del_timer(ptimer); diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c index 56e8add30a20..0c7dfeebc62e 100644 --- a/drivers/staging/rtl8712/rtl8712_led.c +++ b/drivers/staging/rtl8712/rtl8712_led.c @@ -258,21 +258,21 @@ static void SwLedBlink(struct LED_871x *pLed) /* Schedule a timer to toggle LED state. */ switch (pLed->CurrLedState) { case LED_BLINK_NORMAL: - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NORMAL_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); break; case LED_BLINK_SLOWLY: case LED_BLINK_StartToBlink: - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SLOWLY_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); break; case LED_BLINK_WPS: - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_LONG_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LONG_INTERVAL)); break; default: - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SLOWLY_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); break; } } @@ -315,16 +315,16 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); break; case LED_BLINK_NORMAL: if (pLed->bLedOn) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); break; case LED_SCAN_BLINK: pLed->BlinkTimes--; @@ -338,8 +338,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; @@ -347,8 +347,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); } pLed->bLedScanBlinkInProgress = false; } else { @@ -356,8 +356,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_TXRX_BLINK: @@ -372,8 +372,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; @@ -381,8 +381,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); } pLed->BlinkTimes = 0; pLed->bLedBlinkInProgress = false; @@ -391,8 +391,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_BLINK_WPS: @@ -400,14 +400,14 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); break; case LED_BLINK_WPS_STOP: /* WPS success */ if (pLed->BlinkingLedState == LED_ON) { pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA)); bStopBlinking = false; } else bStopBlinking = true; @@ -418,8 +418,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); } pLed->bLedWPSBlinkInProgress = false; break; @@ -460,8 +460,8 @@ static void SwLedBlink2(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_TXRX_BLINK: @@ -484,8 +484,8 @@ static void SwLedBlink2(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; default: @@ -528,8 +528,8 @@ static void SwLedBlink3(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_TXRX_BLINK: @@ -554,8 +554,8 @@ static void SwLedBlink3(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_BLINK_WPS: @@ -563,14 +563,14 @@ static void SwLedBlink3(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); break; case LED_BLINK_WPS_STOP: /*WPS success*/ if (pLed->BlinkingLedState == LED_ON) { pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA)); bStopBlinking = false; } else bStopBlinking = true; @@ -610,18 +610,18 @@ static void SwLedBlink4(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); break; case LED_BLINK_StartToBlink: if (pLed->bLedOn) { pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SLOWLY_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); } else { pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NORMAL_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); } break; case LED_SCAN_BLINK: @@ -635,16 +635,16 @@ static void SwLedBlink4(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); pLed->bLedScanBlinkInProgress = false; } else { if (pLed->bLedOn) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_TXRX_BLINK: @@ -658,27 +658,27 @@ static void SwLedBlink4(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); pLed->bLedBlinkInProgress = false; } else { if (pLed->bLedOn) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_BLINK_WPS: if (pLed->bLedOn) { pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SLOWLY_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); } else { pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NORMAL_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); } break; case LED_BLINK_WPS_STOP: /*WPS authentication fail*/ @@ -686,7 +686,8 @@ static void SwLedBlink4(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); break; case LED_BLINK_WPS_STOP_OVERLAP: /*WPS session overlap */ pLed->BlinkTimes--; @@ -699,15 +700,15 @@ static void SwLedBlink4(struct LED_871x *pLed) if (bStopBlinking) { pLed->BlinkTimes = 10; pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); } else { if (pLed->bLedOn) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NORMAL_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); } break; default: @@ -734,16 +735,16 @@ static void SwLedBlink5(struct LED_871x *pLed) pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; if (!pLed->bLedOn) - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); pLed->bLedScanBlinkInProgress = false; } else { if (pLed->bLedOn) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_TXRX_BLINK: @@ -754,16 +755,16 @@ static void SwLedBlink5(struct LED_871x *pLed) pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; if (!pLed->bLedOn) - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); pLed->bLedBlinkInProgress = false; } else { if (pLed->bLedOn) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; default: @@ -797,8 +798,8 @@ static void SwLedBlink6(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_BLINK_WPS: @@ -806,7 +807,8 @@ static void SwLedBlink6(struct LED_871x *pLed) pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); break; default: @@ -908,8 +910,8 @@ static void SwLedControlMode1(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); } break; case LED_CTL_LINK: @@ -931,8 +933,8 @@ static void SwLedControlMode1(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); } break; case LED_CTL_SITE_SURVEY: @@ -961,8 +963,8 @@ static void SwLedControlMode1(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_CTL_TX: @@ -986,8 +988,8 @@ static void SwLedControlMode1(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; @@ -1016,8 +1018,8 @@ static void SwLedControlMode1(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_CTL_STOP_WPS: @@ -1044,11 +1046,12 @@ static void SwLedControlMode1(struct _adapter *padapter, pLed->CurrLedState = LED_BLINK_WPS_STOP; if (pLed->bLedOn) { pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA)); } else { pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); } break; case LED_CTL_STOP_WPS_FAIL: @@ -1062,8 +1065,8 @@ static void SwLedControlMode1(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); break; case LED_CTL_POWER_OFF: pLed->CurrLedState = LED_OFF; @@ -1088,7 +1091,8 @@ static void SwLedControlMode1(struct _adapter *padapter, _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; } - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; default: break; @@ -1121,8 +1125,8 @@ static void SwLedControlMode2(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; @@ -1140,8 +1144,8 @@ static void SwLedControlMode2(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; @@ -1157,7 +1161,8 @@ static void SwLedControlMode2(struct _adapter *padapter, pLed->bLedScanBlinkInProgress = false; } - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; case LED_CTL_START_WPS: /*wait until xinpin finish*/ @@ -1174,7 +1179,8 @@ static void SwLedControlMode2(struct _adapter *padapter, pLed->bLedWPSBlinkInProgress = true; pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); } break; @@ -1182,14 +1188,16 @@ static void SwLedControlMode2(struct _adapter *padapter, pLed->bLedWPSBlinkInProgress = false; pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; case LED_CTL_STOP_WPS_FAIL: pLed->bLedWPSBlinkInProgress = false; pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; case LED_CTL_START_TO_LINK: @@ -1197,7 +1205,8 @@ static void SwLedControlMode2(struct _adapter *padapter, if (!IS_LED_BLINKING(pLed)) { pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); } break; case LED_CTL_POWER_OFF: @@ -1215,7 +1224,8 @@ static void SwLedControlMode2(struct _adapter *padapter, _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; } - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; default: break; @@ -1247,8 +1257,8 @@ static void SwLedControlMode3(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_CTL_TX: @@ -1265,8 +1275,8 @@ static void SwLedControlMode3(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_CTL_LINK: @@ -1282,7 +1292,8 @@ static void SwLedControlMode3(struct _adapter *padapter, _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; } - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; case LED_CTL_START_WPS: /* wait until xinpin finish */ case LED_CTL_START_WPS_BOTTON: @@ -1301,8 +1312,8 @@ static void SwLedControlMode3(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_CTL_STOP_WPS: @@ -1314,11 +1325,12 @@ static void SwLedControlMode3(struct _adapter *padapter, pLed->CurrLedState = LED_BLINK_WPS_STOP; if (pLed->bLedOn) { pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA)); } else { pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); } break; case LED_CTL_STOP_WPS_FAIL: @@ -1328,14 +1340,16 @@ static void SwLedControlMode3(struct _adapter *padapter, } pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; case LED_CTL_START_TO_LINK: case LED_CTL_NO_LINK: if (!IS_LED_BLINKING(pLed)) { pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); } break; case LED_CTL_POWER_OFF: @@ -1353,7 +1367,8 @@ static void SwLedControlMode3(struct _adapter *padapter, _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; } - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; default: break; @@ -1376,7 +1391,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed1->BlinkingLedState = LED_OFF; pLed1->CurrLedState = LED_OFF; if (pLed1->bLedOn) - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); } if (pLed->bLedStartToLinkBlinkInProgress == false) { if (pLed->CurrLedState == LED_SCAN_BLINK || @@ -1394,12 +1410,12 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed->CurrLedState = LED_BLINK_StartToBlink; if (pLed->bLedOn) { pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SLOWLY_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); } else { pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NORMAL_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); } } break; @@ -1413,7 +1429,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed1->BlinkingLedState = LED_OFF; pLed1->CurrLedState = LED_OFF; if (pLed1->bLedOn) - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); } } if (pLed->bLedNoLinkBlinkInProgress == false) { @@ -1430,8 +1447,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); } break; case LED_CTL_SITE_SURVEY: @@ -1456,8 +1473,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_CTL_TX: @@ -1477,8 +1494,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_CTL_START_WPS: /*wait until xinpin finish*/ @@ -1489,7 +1506,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed1->BlinkingLedState = LED_OFF; pLed1->CurrLedState = LED_OFF; if (pLed1->bLedOn) - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); } if (pLed->bLedWPSBlinkInProgress == false) { if (pLed->bLedNoLinkBlinkInProgress == true) { @@ -1508,12 +1526,12 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed->CurrLedState = LED_BLINK_WPS; if (pLed->bLedOn) { pLed->BlinkingLedState = LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SLOWLY_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); } else { pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NORMAL_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); } } break; @@ -1528,8 +1546,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); break; case LED_CTL_STOP_WPS_FAIL: /*WPS authentication fail*/ if (pLed->bLedWPSBlinkInProgress) { @@ -1542,8 +1560,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); /*LED1 settings*/ if (pLed1->bLedWPSBlinkInProgress) _cancel_timer_ex(&(pLed1->BlinkTimer)); @@ -1554,7 +1572,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed1->BlinkingLedState = LED_OFF; else pLed1->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); break; case LED_CTL_STOP_WPS_FAIL_OVERLAP: /*WPS session overlap*/ if (pLed->bLedWPSBlinkInProgress) { @@ -1567,8 +1586,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); /*LED1 settings*/ if (pLed1->bLedWPSBlinkInProgress) _cancel_timer_ex(&(pLed1->BlinkTimer)); @@ -1580,7 +1599,8 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed1->BlinkingLedState = LED_OFF; else pLed1->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); break; case LED_CTL_POWER_OFF: pLed->CurrLedState = LED_OFF; @@ -1641,7 +1661,8 @@ static void SwLedControlMode5(struct _adapter *padapter, pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; pLed->bLedBlinkInProgress = false; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; case LED_CTL_SITE_SURVEY: if ((pmlmepriv->sitesurveyctrl.traffic_busy) && @@ -1659,8 +1680,8 @@ static void SwLedControlMode5(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_CTL_TX: @@ -1675,8 +1696,8 @@ static void SwLedControlMode5(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_CTL_POWER_OFF: @@ -1711,7 +1732,7 @@ static void SwLedControlMode6(struct _adapter *padapter, pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; pLed->bLedBlinkInProgress = false; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&(pLed->BlinkTimer), jiffies + msecs_to_jiffies(0)); break; case LED_CTL_TX: case LED_CTL_RX: @@ -1726,8 +1747,8 @@ static void SwLedControlMode6(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_CTL_START_WPS: /*wait until xinpin finish*/ @@ -1743,8 +1764,8 @@ static void SwLedControlMode6(struct _adapter *padapter, pLed->BlinkingLedState = LED_OFF; else pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_CTL_STOP_WPS_FAIL: @@ -1755,7 +1776,8 @@ static void SwLedControlMode6(struct _adapter *padapter, } pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); break; case LED_CTL_POWER_OFF: pLed->CurrLedState = LED_OFF; diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index e4fc9e0dedb0..546414d37962 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -604,8 +604,8 @@ static int recv_indicatepkt_reorder(struct _adapter *padapter, */ if (r8712_recv_indicatepkts_in_order(padapter, preorder_ctrl, false) == true) { - _set_timer(&preorder_ctrl->reordering_ctrl_timer, - REORDER_WAIT_TIME); + mod_timer(&preorder_ctrl->reordering_ctrl_timer, + jiffies + msecs_to_jiffies(REORDER_WAIT_TIME)); spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); } else { spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 939a2ec54796..d105ade43f67 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -247,7 +247,8 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter, } set_fwstate(pmlmepriv, _FW_UNDER_SURVEY); r8712_enqueue_cmd(pcmdpriv, ph2c); - _set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT); + mod_timer(&pmlmepriv->scan_to_timer, + jiffies + msecs_to_jiffies(SCANNING_TIMEOUT)); padapter->ledpriv.LedControlHandler(padapter, LED_CTL_SITE_SURVEY); padapter->blnEnableRxFF0Filter = 0; return _SUCCESS; @@ -890,7 +891,8 @@ void r8712_joinbss_cmd_callback(struct _adapter *padapter, struct cmd_obj *pcmd) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; if (pcmd->res != H2C_SUCCESS) - _set_timer(&pmlmepriv->assoc_timer, 1); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(1)); r8712_free_cmd_obj(pcmd); } @@ -907,7 +909,8 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter, struct wlan_network *tgt_network = &(pmlmepriv->cur_network); if (pcmd->res != H2C_SUCCESS) - _set_timer(&pmlmepriv->assoc_timer, 1); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(1)); _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); #ifdef __BIG_ENDIAN /* endian_convert */ diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c index 6318a0e65e6e..bd1d1b773c48 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c @@ -85,7 +85,8 @@ static u8 do_join(struct _adapter *padapter) ret = r8712_select_and_join_from_scan(pmlmepriv); if (ret == _SUCCESS) - _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); else { if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { /* submit r8712_createbss_cmd to change to an diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 977a83358056..bb784844d26f 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -596,8 +596,8 @@ void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf) if (r8712_select_and_join_from_scan(pmlmepriv) == _SUCCESS) - _set_timer(&pmlmepriv->assoc_timer, - MAX_JOIN_TIMEOUT); + mod_timer(&pmlmepriv->assoc_timer, jiffies + + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); else { struct wlan_bssid_ex *pdev_network = &(adapter->registrypriv.dev_network); @@ -622,8 +622,8 @@ void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf) set_fwstate(pmlmepriv, _FW_UNDER_LINKING); if (r8712_select_and_join_from_scan(pmlmepriv) == _SUCCESS) - _set_timer(&pmlmepriv->assoc_timer, - MAX_JOIN_TIMEOUT); + mod_timer(&pmlmepriv->assoc_timer, jiffies + + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); else _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); } @@ -679,7 +679,8 @@ void r8712_indicate_connect(struct _adapter *padapter) padapter->ledpriv.LedControlHandler(padapter, LED_CTL_LINK); r8712_os_indicate_connect(padapter); if (padapter->registrypriv.power_mgnt > PS_MODE_ACTIVE) - _set_timer(&pmlmepriv->dhcp_timer, 60000); + mod_timer(&pmlmepriv->dhcp_timer, + jiffies + msecs_to_jiffies(60000)); } @@ -916,7 +917,8 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) goto ignore_joinbss_callback; } else { if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) { - _set_timer(&pmlmepriv->assoc_timer, 1); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(1)); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); } } -- cgit v1.2.3 From 4b2faf80228a9e5c9b6df0315dd3e021293717db Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 28 Feb 2015 00:14:34 +0100 Subject: Staging: rtl8192u: Replace TRUE and FALSE macros Replace all occurrences of TRUE and FALSE by true and false respectively. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 22 +++++++------- drivers/staging/rtl8192u/r8192U_dm.c | 46 +++++++++++++++--------------- drivers/staging/rtl8192u/r819xU_firmware.c | 12 ++++---- drivers/staging/rtl8192u/r819xU_phy.c | 4 +-- 4 files changed, 42 insertions(+), 42 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 8d2714083e78..9de4412da3b3 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2767,7 +2767,7 @@ static bool rtl8192_adapter_start(struct net_device *dev) // #ifdef TO_DO_LIST if (Adapter->ResetProgress == RESET_TYPE_NORESET) { - if (pMgntInfo->RegRfOff == TRUE) { /* User disable RF via registry. */ + if (pMgntInfo->RegRfOff == true) { /* User disable RF via registry. */ RT_TRACE((COMP_INIT|COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): Turn off RF for RegRfOff ----------\n")); MgntActSet_RF_State(Adapter, eRfOff, RF_CHANGE_BY_SW); // Those actions will be discard in MgntActSet_RF_State because of the same state @@ -2814,15 +2814,15 @@ static bool rtl8192_adapter_start(struct net_device *dev) u8 tmpvalue; read_nic_byte(dev, 0x301, &tmpvalue); if (tmpvalue == 0x03) { - priv->bDcut = TRUE; + priv->bDcut = true; RT_TRACE(COMP_POWER_TRACKING, "D-cut\n"); } else { - priv->bDcut = FALSE; + priv->bDcut = false; RT_TRACE(COMP_POWER_TRACKING, "C-cut\n"); } dm_initialize_txpower_tracking(dev); - if (priv->bDcut == TRUE) { + if (priv->bDcut == true) { u32 i, TempCCk; u32 tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord); for (i = 0; i < TxBBGainTableLength; i++) { @@ -2874,11 +2874,11 @@ static bool HalTxCheckStuck819xUsb(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); u16 RegTxCounter; - bool bStuck = FALSE; + bool bStuck = false; read_nic_word(dev, 0x128, &RegTxCounter); RT_TRACE(COMP_RESET, "%s():RegTxCounter is %d,TxCounter is %d\n", __func__, RegTxCounter, priv->TxCounter); if (priv->TxCounter == RegTxCounter) - bStuck = TRUE; + bStuck = true; priv->TxCounter = RegTxCounter; @@ -2920,7 +2920,7 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev) { u16 RegRxCounter; struct r8192_priv *priv = ieee80211_priv(dev); - bool bStuck = FALSE; + bool bStuck = false; static u8 rx_chk_cnt; read_nic_word(dev, 0x130, &RegRxCounter); RT_TRACE(COMP_RESET, "%s(): RegRxCounter is %d,RxCounter is %d\n", __func__, RegRxCounter, priv->RxCounter); @@ -2951,7 +2951,7 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev) } if (priv->RxCounter == RegRxCounter) - bStuck = TRUE; + bStuck = true; priv->RxCounter = RegRxCounter; @@ -2961,10 +2961,10 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev) static RESET_TYPE RxCheckStuck(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - bool bRxCheck = FALSE; + bool bRxCheck = false; if (priv->IrpPendingCount > 1) - bRxCheck = TRUE; + bRxCheck = true; if (bRxCheck) { if (HalRxCheckStuck819xUsb(dev)) { @@ -4208,7 +4208,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, struct net_device *dev = info->dev; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); bool bpacket_match_bssid, bpacket_toself; - bool bPacketBeacon = FALSE, bToSelfBA = FALSE; + bool bPacketBeacon = false, bToSelfBA = false; static struct ieee80211_rx_stats previous_stats; struct ieee80211_hdr_3addr *hdr;//by amy u16 fc, type; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index ee6b936efef2..719961643ded 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -502,7 +502,7 @@ static u8 CCKSwingTable_Ch14[CCK_Table_length][8] = { static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - bool bHighpowerstate, viviflag = FALSE; + bool bHighpowerstate, viviflag = false; DCMD_TXCMD_T tx_cmd; u8 powerlevelOFDM24G; int i = 0, j = 0, k = 0; @@ -558,13 +558,13 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) /* check if the report value is right */ for (k = 0; k < 5; k++) { if (tmp_report[k] <= 20) { - viviflag = TRUE; + viviflag = true; break; } } - if (viviflag == TRUE) { + if (viviflag == true) { write_nic_byte(dev, 0x1ba, 0); - viviflag = FALSE; + viviflag = false; RT_TRACE(COMP_POWER_TRACKING, "we filtered the data\n"); for (k = 0; k < 5; k++) tmp_report[k] = 0; @@ -587,7 +587,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) delta = TSSI_13dBm - Avg_TSSI_Meas_from_driver; if (delta <= E_FOR_TX_POWER_TRACK) { - priv->ieee80211->bdynamic_txpower_enable = TRUE; + priv->ieee80211->bdynamic_txpower_enable = true; write_nic_byte(dev, 0x1ba, 0); RT_TRACE(COMP_POWER_TRACKING, "tx power track is done\n"); RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex = %d\n", priv->rfa_txpowertrackingindex); @@ -624,10 +624,10 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) if (priv->cck_present_attentuation > -1 && priv->cck_present_attentuation < 23) { if (priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) { - priv->bcck_in_ch14 = TRUE; + priv->bcck_in_ch14 = true; dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else if (priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) { - priv->bcck_in_ch14 = FALSE; + priv->bcck_in_ch14 = false; dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); @@ -638,7 +638,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation = %d\n", priv->cck_present_attentuation); if (priv->cck_present_attentuation_difference <= -12 || priv->cck_present_attentuation_difference >= 24) { - priv->ieee80211->bdynamic_txpower_enable = TRUE; + priv->ieee80211->bdynamic_txpower_enable = true; write_nic_byte(dev, 0x1ba, 0); RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); return; @@ -651,7 +651,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) break; } } - priv->ieee80211->bdynamic_txpower_enable = TRUE; + priv->ieee80211->bdynamic_txpower_enable = true; write_nic_byte(dev, 0x1ba, 0); } @@ -684,7 +684,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) break; } } - priv->btxpower_trackingInit = TRUE; + priv->btxpower_trackingInit = true; /*pHalData->TXPowercount = 0;*/ return; } @@ -734,10 +734,10 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) tmpCCKindex = tmpCCK20Mindex; if (priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) { - priv->bcck_in_ch14 = TRUE; + priv->bcck_in_ch14 = true; CCKSwingNeedUpdate = 1; } else if (priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) { - priv->bcck_in_ch14 = FALSE; + priv->bcck_in_ch14 = false; CCKSwingNeedUpdate = 1; } @@ -765,7 +765,7 @@ void dm_txpower_trackingcallback(struct work_struct *work) struct r8192_priv *priv = container_of(dwork, struct r8192_priv, txpower_tracking_wq); struct net_device *dev = priv->ieee80211->dev; - if (priv->bDcut == TRUE) + if (priv->bDcut == true) dm_TXPowerTrackingCallback_TSSI(dev); else dm_TXPowerTrackingCallback_ThermalMeter(dev); @@ -1273,9 +1273,9 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev) priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[6] = 0x00; priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[7] = 0x00; - priv->btxpower_tracking = TRUE; + priv->btxpower_tracking = true; priv->txpower_count = 0; - priv->btxpower_trackingInit = FALSE; + priv->btxpower_trackingInit = false; } @@ -1289,18 +1289,18 @@ static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev) * 3-wire by driver causes RF to go into a wrong state. */ if (priv->ieee80211->FwRWRF) - priv->btxpower_tracking = TRUE; + priv->btxpower_tracking = true; else - priv->btxpower_tracking = FALSE; + priv->btxpower_tracking = false; priv->txpower_count = 0; - priv->btxpower_trackingInit = FALSE; + priv->btxpower_trackingInit = false; } void dm_initialize_txpower_tracking(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - if (priv->bDcut == TRUE) + if (priv->bDcut == true) dm_InitializeTXPowerTracking_TSSI(dev); else dm_InitializeTXPowerTracking_ThermalMeter(dev); @@ -1356,7 +1356,7 @@ static void dm_check_txpower_tracking(struct net_device *dev) #ifdef RTL8190P dm_CheckTXPowerTracking_TSSI(dev); #else - if (priv->bDcut == TRUE) + if (priv->bDcut == true) dm_CheckTXPowerTracking_TSSI(dev); else dm_CheckTXPowerTracking_ThermalMeter(dev); @@ -1466,7 +1466,7 @@ void dm_cck_txpower_adjust(struct net_device *dev, bool binch14) { /* dm_CCKTxPowerAdjust */ struct r8192_priv *priv = ieee80211_priv(dev); - if (priv->bDcut == TRUE) + if (priv->bDcut == true) dm_CCKTxPowerAdjust_TSSI(dev, binch14); else dm_CCKTxPowerAdjust_ThermalMeter(dev, binch14); @@ -2314,7 +2314,7 @@ static void dm_init_ctstoself(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); - priv->ieee80211->bCTSToSelfEnable = TRUE; + priv->ieee80211->bCTSToSelfEnable = true; priv->ieee80211->CTSToSelfTH = CTSToSelfTHVal; } @@ -2327,7 +2327,7 @@ static void dm_ctstoself(struct net_device *dev) unsigned long curTxOkCnt = 0; unsigned long curRxOkCnt = 0; - if (priv->ieee80211->bCTSToSelfEnable != TRUE) { + if (priv->ieee80211->bCTSToSelfEnable != true) { pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF; return; } diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index c230be290ab6..1a3a09f81895 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -164,7 +164,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) CPUCheckMainCodeOKAndTurnOnCPU_Fail: RT_TRACE(COMP_ERR, "ERR in %s()\n", __func__); - rt_status = FALSE; + rt_status = false; return rt_status; } @@ -201,7 +201,7 @@ CPUCheckFirmwareReady_Fail: bool init_firmware(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - bool rt_status = TRUE; + bool rt_status = true; u32 file_length = 0; u8 *mapped_file = NULL; @@ -281,7 +281,7 @@ bool init_firmware(struct net_device *dev) if (rst_opt == OPT_SYSTEM_RESET) release_firmware(fw_entry); - if (rt_status != TRUE) + if (rt_status != true) goto download_firmware_fail; switch (init_step) { @@ -304,7 +304,7 @@ bool init_firmware(struct net_device *dev) /* Check Put Code OK and Turn On CPU */ rt_status = CPUcheck_maincodeok_turnonCPU(dev); - if (rt_status != TRUE) { + if (rt_status != true) { RT_TRACE(COMP_ERR, "CPUcheck_maincodeok_turnonCPU fail!\n"); goto download_firmware_fail; } @@ -318,7 +318,7 @@ bool init_firmware(struct net_device *dev) mdelay(1); rt_status = CPUcheck_firmware_ready(dev); - if (rt_status != TRUE) { + if (rt_status != true) { RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n",rt_status); goto download_firmware_fail; } @@ -336,7 +336,7 @@ bool init_firmware(struct net_device *dev) download_firmware_fail: RT_TRACE(COMP_ERR, "ERR in %s()\n", __func__); - rt_status = FALSE; + rt_status = false; return rt_status; } diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 3d4f57d97d51..084e04fd15f8 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1575,10 +1575,10 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) priv->cck_present_attentuation); if (priv->chan == 14 && !priv->bcck_in_ch14) { - priv->bcck_in_ch14 = TRUE; + priv->bcck_in_ch14 = true; dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else if (priv->chan != 14 && priv->bcck_in_ch14) { - priv->bcck_in_ch14 = FALSE; + priv->bcck_in_ch14 = false; dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else { dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); -- cgit v1.2.3 From 3d0e486eef578097a7cfed7c4c913e31814e8c4c Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 28 Feb 2015 00:15:56 +0100 Subject: Staging: rtl8192u: Remove TRUE and FALSE macros Remove TRUE and FALSE boolean macros, since Linux kernel has already a boolean type, bool, defined in linux/stddef.h Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index c9d8c102cca3..6c2e438c9af4 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -40,8 +40,6 @@ #define RTL8192U #define RTL819xU_MODULE_NAME "rtl819xU" /* HW security */ -#define FALSE 0 -#define TRUE 1 #define MAX_KEY_LEN 61 #define KEY_BUF_SIZE 5 -- cgit v1.2.3 From 4eef520d2499e0c5cfed65f4a91fb0f4663a26ec Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Sat, 28 Feb 2015 08:13:54 +0530 Subject: Staging: rtl8712: Use del_timer Use timer API function del_timer instead of driver specific function _cancel_timer_ex as it is a standard way for deactivating a timer. This is done using Coccinelle and semantic patch used for this is as follows: @@ expression x; @@ - _cancel_timer_ex (&x); + del_timer (&x); Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl8712_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index 546414d37962..0ec0bda45d50 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -609,7 +609,7 @@ static int recv_indicatepkt_reorder(struct _adapter *padapter, spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); } else { spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); - _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); + del_timer(&preorder_ctrl->reordering_ctrl_timer); } return _SUCCESS; _err_exit: -- cgit v1.2.3 From 5d5f5732774719547e55a3730902f72cddf27d5a Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 28 Feb 2015 12:45:53 +0100 Subject: Staging: rtl8192u: Fix comments This patch fixes comments to fit kernel coding style rules, and also removes commented header file linux/wireless.h. Issue found by checkpatch.pl. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_wx.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_wx.h b/drivers/staging/rtl8192u/r8192U_wx.h index ae7a617740a3..d6a2d9756531 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.h +++ b/drivers/staging/rtl8192u/r8192U_wx.h @@ -1,20 +1,21 @@ /* - This is part of rtl8180 OpenSource driver - v 0.3 - Copyright (C) Andrea Merello 2004 - Released under the terms of GPL (General Public Licence) + * This is part of rtl8180 OpenSource driver - v 0.3 + * Copyright (C) Andrea Merello 2004 + * Released under the terms of GPL (General Public Licence) + * + * Parts of this driver are based on the GPL part of the official realtek driver + * Parts of this driver are based on the rtl8180 driver skeleton from Patric + * Schenke & Andres Salomon + * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver + * + * We want to thank the Authors of such projects and the Ndiswrapper project + * Authors. + */ - Parts of this driver are based on the GPL part of the official realtek driver - Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver - - We want to thank the Authors of such projects and the Ndiswrapper project Authors. -*/ - -/* this file (will) contains wireless extension handlers*/ +/* this file (will) contains wireless extension handlers */ #ifndef R8180_WX_H #define R8180_WX_H -//#include extern struct iw_handler_def r8192_wx_handlers_def; /* Enable the rtl819x_core.c to share this function, david 2008.9.22 */ -- cgit v1.2.3 From eef638a1973976c450d4cb56ed7a35f59a035714 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 28 Feb 2015 12:46:41 +0100 Subject: Staging: rtl8192u: Fix line over 80 characters This patch splits the line so that doesn't exceeds 80 character mark. Issue found by checkpatch.pl Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8190_rtl8256.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index 7a5a38854681..6e5662f7951c 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -14,7 +14,8 @@ #define RTL8225H #define RTL819X_TOTAL_RF_PATH 2 /* for 8192U */ -extern void PHY_SetRF8256Bandwidth(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth); +extern void PHY_SetRF8256Bandwidth(struct net_device *dev, + HT_CHANNEL_WIDTH Bandwidth); extern void PHY_RF8256_Config(struct net_device *dev); extern void phy_RF8256_Config_ParaFile(struct net_device *dev); extern void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); -- cgit v1.2.3 From 54160729c58408fedd762cde4579691731c2ae97 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 28 Feb 2015 12:48:27 +0100 Subject: Staging: rtl8192u: Replace printk() with netdev_dbg() For dynamic debugging netdev_dbg (if there is a ponterto a device net structure) is preferred over printk(), which is the raw way to print something. Issue found by checkpatch.pl. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 361d2d0c3df1..b5a26f34b864 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -139,7 +139,7 @@ static int r8192_wx_force_reset(struct net_device *dev, down(&priv->wx_sem); - printk("%s(): force reset ! extra is %d\n", __func__, *extra); + netdev_dbg(dev, "%s(): force reset ! extra is %d\n", __func__, *extra); priv->force_reset = *extra; up(&priv->wx_sem); return 0; -- cgit v1.2.3 From c60cfc8e3b43a7477d519f91ef8f7f5edf0adff4 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 28 Feb 2015 19:20:36 +0100 Subject: Staging: rtl8192e: Replace printk with netdev_dbg, netdev_info, or netdev_warn For network systems netdev_dbg, netdev_info or netdev_warn is preferred over printk. Issue found by checkpatch.pl Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_wx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 9e0f975c152f..02faaf3980e7 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -390,7 +390,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, kfree(new_crypt); new_crypt = NULL; - printk(KERN_WARNING "%s: could not initialize WEP: " + netdev_warn(dev, "%s: could not initialize WEP: " "load module rtllib_crypt_wep\n", dev->name); return -EOPNOTSUPP; @@ -423,7 +423,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, NULL, (*crypt)->priv); if (len == 0) { /* Set a default key of all 0 */ - printk(KERN_INFO "Setting key %d to all zero.\n", + netdev_info(ieee->dev, "Setting key %d to all zero.\n", key); RTLLIB_DEBUG_WX("Setting key %d to all zero.\n", @@ -469,7 +469,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, if (ieee->reset_on_keychange && ieee->iw_mode != IW_MODE_INFRA && ieee->reset_port && ieee->reset_port(dev)) { - printk(KERN_DEBUG "%s: reset_port failed\n", dev->name); + netdev_dbg(dev, "%s: reset_port failed\n", dev->name); return -EINVAL; } return 0; @@ -596,7 +596,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, ret = -EINVAL; goto done; } - printk(KERN_INFO "alg name:%s\n", alg); + netdev_info(dev, "alg name:%s\n", alg); ops = lib80211_get_crypto_ops(alg); if (ops == NULL) { @@ -610,7 +610,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, if (ops == NULL) { RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n", dev->name, ext->alg); - printk(KERN_INFO "========>unknown crypto alg %d\n", ext->alg); + netdev_info(dev, "========>unknown crypto alg %d\n", ext->alg); ret = -EINVAL; goto done; } @@ -642,7 +642,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, (*crypt)->priv) < 0) { RTLLIB_DEBUG_WX("%s: key setting failed\n", dev->name); - printk(KERN_INFO "key setting failed\n"); + netdev_info(dev, "key setting failed\n"); ret = -EINVAL; goto done; } @@ -759,9 +759,9 @@ int rtllib_wx_set_mlme(struct rtllib_device *ieee, case IW_MLME_DISASSOC: if (deauth) - printk(KERN_INFO "disauth packet !\n"); + netdev_info(ieee->dev, "disauth packet !\n"); else - printk(KERN_INFO "dis associate packet!\n"); + netdev_info(ieee->dev, "dis associate packet!\n"); ieee->cannot_notify = true; -- cgit v1.2.3 From c63eee546079859e9b6ede13f32457b8bf2fb1ff Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 28 Feb 2015 19:46:57 +0100 Subject: Staging: rtl8192e: Use ether_addr_copy() instead of memcpy() This patch replaces memcpy with ether_addr_copy. Also pathole was used to make sure that arguments passed to ether_addr_copy are aligned to u16. First argument is iwe.u.ap_addr.sa_data i output of pahole is: struct iw_event { __u16 len; /* 0 2 */ __u16 cmd; /* 2 2 */ /* XXX 4 bytes hole, try to pack */ union iwreq_data u; /* 8 16 */ /* size: 24, cachelines: 1, members: 3 */ /* sum members: 20, holes: 1, sum holes: 4 */ /* last cacheline: 24 bytes */ }; and inside union iwreq_data u is sa_data: struct sockaddr { /* typedef sa_family_t -> __kernel_sa_family_t */ short unsigned int sa_family; /* 8 2 */ char sa_data[14]; /* 10 14 */ } ap_addr; /* 16 */ sa_data is a char array of size 14, and the number of bytes copied using ether_addr_copy() is 6. Second argument is network->bssid and output of pahole is: struct rtllib_network { u8 bssid[6]; /* 0 6 */ u8 channel; /* 6 1 */ u8 ssid[33]; /* 7 33 */ u8 ssid_len; /* 40 1 */ u8 hidden_ssid[33]; /* 41 33 */ /* --- cacheline 1 boundary (64 bytes) was 10 bytes ago --- */ u8 hidden_ssid_len; /* 74 1 */ /* XXX 1 byte hole, try to pack */ struct rtllib_qos_data qos_data; /* 76 48 */ bool bWithAironetIE; /* 124 1 */ bool bCkipSupported; /* 125 1 */ bool bCcxRmEnable; /* 126 1 */ /* XXX 1 byte hole, try to pack */ /* --- cacheline 2 boundary (128 bytes) --- */ u16 CcxRmState[2]; /* 128 4 */ bool bMBssidValid; /* 132 1 */ u8 MBssidMask; /* 133 1 */ u8 MBssid[6]; /* 134 6 */ bool bWithCcxVerNum; /* 140 1 */ u8 BssCcxVerNumber; /* 141 1 */ /* XXX 2 bytes hole, try to pack */ struct rtllib_rx_stats stats; /* 144 120 */ /* --- cacheline 4 boundary (256 bytes) was 8 bytes ago --- */ u16 capability; /* 264 2 */ u8 rates[12]; /* 266 12 */ u8 rates_len; /* 278 1 */ u8 rates_ex[16]; /* 279 16 */ u8 rates_ex_len; /* 295 1 */ long unsigned int last_scanned; /* 296 8 */ u8 mode; /* 304 1 */ /* XXX 3 bytes hole, try to pack */ u32 flags; /* 308 4 */ u32 last_associate; /* 312 4 */ u32 time_stamp[2]; /* 316 8 */ /* --- cacheline 5 boundary (320 bytes) was 4 bytes ago --- */ u16 beacon_interval; /* 324 2 */ u16 listen_interval; /* 326 2 */ u16 atim_window; /* 328 2 */ u8 erp_value; /* 330 1 */ u8 wpa_ie[64]; /* 331 64 */ /* XXX 5 bytes hole, try to pack */ /* --- cacheline 6 boundary (384 bytes) was 16 bytes ago --- */ size_t wpa_ie_len; /* 400 8 */ u8 rsn_ie[64]; /* 408 64 */ /* --- cacheline 7 boundary (448 bytes) was 24 bytes ago --- */ size_t rsn_ie_len; /* 472 8 */ u8 wzc_ie[256]; /* 480 256 */ /* --- cacheline 11 boundary (704 bytes) was 32 bytes ago --- */ size_t wzc_ie_len; /* 736 8 */ struct rtllib_tim_parameters tim; /* 744 2 */ u8 dtim_period; /* 746 1 */ u8 dtim_data; /* 747 1 */ /* XXX 4 bytes hole, try to pack */ u64 last_dtim_sta_time; /* 752 8 */ u8 wmm_info; /* 760 1 */ /* XXX 1 byte hole, try to pack */ struct rtllib_wmm_ac_param wmm_param[4]; /* 762 16 */ /* --- cacheline 12 boundary (768 bytes) was 10 bytes ago --- */ u8 Turbo_Enable; /* 778 1 */ /* XXX 1 byte hole, try to pack */ u16 CountryIeLen; /* 780 2 */ u8 CountryIeBuf[255]; /* 782 255 */ /* XXX 3 bytes hole, try to pack */ /* --- cacheline 16 boundary (1024 bytes) was 16 bytes ago --- */ struct bss_ht bssht; /* 1040 84 */ /* --- cacheline 17 boundary (1088 bytes) was 36 bytes ago --- */ bool broadcom_cap_exist; /* 1124 1 */ bool realtek_cap_exit; /* 1125 1 */ bool marvell_cap_exist; /* 1126 1 */ bool ralink_cap_exist; /* 1127 1 */ bool atheros_cap_exist; /* 1128 1 */ bool cisco_cap_exist; /* 1129 1 */ bool airgo_cap_exist; /* 1130 1 */ bool unknown_cap_exist; /* 1131 1 */ bool berp_info_valid; /* 1132 1 */ bool buseprotection; /* 1133 1 */ bool bIsNetgear854T; /* 1134 1 */ u8 SignalStrength; /* 1135 1 */ u8 RSSI; /* 1136 1 */ /* XXX 7 bytes hole, try to pack */ struct list_head list; /* 1144 16 */ /* --- cacheline 18 boundary (1152 bytes) was 8 bytes ago --- */ /* size: 1160, cachelines: 19, members: 61 */ /* sum members: 1132, holes: 10, sum holes: 28 */ /* last cacheline: 8 bytes */ }; network->bssid is char array of size 6. Issue found by checkpatch.pl Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_wx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 02faaf3980e7..d5f4bcb738ce 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -32,7 +32,7 @@ #include #include #include - +#include #include "rtllib.h" struct modes_unit { char *mode_string; @@ -65,7 +65,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, /* First entry *MUST* be the AP MAC address */ iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); + ether_addr_copy(iwe.u.ap_addr.sa_data, network->bssid); start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN); /* Remaining entries will be displayed in the order we provide them */ -- cgit v1.2.3 From a3ed22eabde3d7db5dbb1eced9f83ad0079d257b Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 28 Feb 2015 19:47:53 +0100 Subject: Staging: rtl8192e: Fix line over 80 characters This patch fixes line to fit 80 characters. Issue found by checkpatch.pl Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index d5f4bcb738ce..309cda0c0e67 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -344,7 +344,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, if (key_provided) break; lib80211_crypt_delayed_deinit(&ieee->crypt_info, - &ieee->crypt_info.crypt[i]); + &ieee->crypt_info.crypt[i]); } } -- cgit v1.2.3 From 9f491da91f0081132d00d8d5297ccde112e30a8f Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Sun, 1 Mar 2015 21:28:19 +0530 Subject: Staging: rtl8192e: Remove unneeded brackets. These were detected with this Coccinelle script: @@ identifier f1, f2, f3; constant c; @@ f1 = ( - (f2 << f3) + f2 << f3 | - (f2 >> f3) + f2 >> f3 | - (f2 << c) + f2 << c | - (f2 >> c) + f2 >> c ) Signed-off-by: Vatika Harlalka Acked-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 2fbb96485dac..7dda904bb477 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -131,7 +131,7 @@ static bool PlatformIOCheckPageLegalAndGetRegMask(u32 u4bPage, u8 *pu1bPageMask) void write_nic_io_byte(struct net_device *dev, int x, u8 y) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; @@ -154,7 +154,7 @@ void write_nic_io_byte(struct net_device *dev, int x, u8 y) void write_nic_io_word(struct net_device *dev, int x, u16 y) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; @@ -177,7 +177,7 @@ void write_nic_io_word(struct net_device *dev, int x, u16 y) void write_nic_io_dword(struct net_device *dev, int x, u32 y) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; @@ -199,7 +199,7 @@ void write_nic_io_dword(struct net_device *dev, int x, u32 y) u8 read_nic_io_byte(struct net_device *dev, int x) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; u8 Data = 0; @@ -224,7 +224,7 @@ u8 read_nic_io_byte(struct net_device *dev, int x) u16 read_nic_io_word(struct net_device *dev, int x) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; u16 Data = 0; @@ -250,7 +250,7 @@ u16 read_nic_io_word(struct net_device *dev, int x) u32 read_nic_io_dword(struct net_device *dev, int x) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; u32 Data = 0; -- cgit v1.2.3 From 09948995980396e90a3957d87a78cc45a29f5b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Sun, 1 Mar 2015 19:02:11 +0200 Subject: Staging: rtl8192e: rtl8192e: fix space prohibited before that ',' This patch fixes the following checkpatch.pl error: space prohibited before that ',' Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 89ea70b0d3aa..05696428e8a3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -192,7 +192,7 @@ void CamRestoreAllEntry(struct net_device *dev) for (EntryId = 0; EntryId < 4; EntryId++) { MacAddr = CAM_CONST_ADDR[EntryId]; if (priv->rtllib->swcamtable[EntryId].bused) { - setKey(dev, EntryId , EntryId, + setKey(dev, EntryId, EntryId, priv->rtllib->pairwise_key_type, MacAddr, 0, (u32 *)(&priv->rtllib->swcamtable [EntryId].key_buf[0])); @@ -254,7 +254,7 @@ void CamRestoreAllEntry(struct net_device *dev) MacAddr = CAM_CONST_BROAD; for (EntryId = 1; EntryId < 4; EntryId++) { if (priv->rtllib->swcamtable[EntryId].bused) { - setKey(dev, EntryId , EntryId, + setKey(dev, EntryId, EntryId, priv->rtllib->group_key_type, MacAddr, 0, (u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0])); @@ -263,7 +263,7 @@ void CamRestoreAllEntry(struct net_device *dev) if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { if (priv->rtllib->swcamtable[0].bused) { - setKey(dev, 0 , 0, + setKey(dev, 0, 0, priv->rtllib->group_key_type, CAM_CONST_ADDR[0], 0, (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])); -- cgit v1.2.3 From 4d2c47a9223519aaaf1f00d964b8edcc2483dcf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Sun, 1 Mar 2015 19:19:23 +0200 Subject: Staging: rtl8192u: ieee80211: Convert comment from C99 style to C89 style This patch fixes the checkpatch.pl error: ERROR: "Do not use C99 // comments" Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 95f5fc7834a0..f470cb601c89 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -129,7 +129,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x08)); */ - // fixed by David :2006.9.6 + /* fixed by David :2006.9.6 */ qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x80)); aad_len = 22; @@ -208,7 +208,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) pos = skb_push(skb, CCMP_HDR_LEN); memmove(pos, pos + CCMP_HDR_LEN, hdr_len); pos += hdr_len; -// mic = skb_put(skb, CCMP_MIC_LEN); + /* mic = skb_put(skb, CCMP_MIC_LEN); */ i = CCMP_PN_LEN - 1; while (i >= 0) { @@ -238,7 +238,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 *e = key->tx_e; u8 *s0 = key->tx_s0; - //mic is moved to here by john + /* mic is moved to here by john */ mic = skb_put(skb, CCMP_MIC_LEN); ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); @@ -443,7 +443,7 @@ static char *ieee80211_ccmp_print_stats(char *p, void *priv) void ieee80211_ccmp_null(void) { -// printk("============>%s()\n", __func__); + /* printk("============>%s()\n", __func__); */ return; } -- cgit v1.2.3 From 94b1726fa63e898b76b8ab6a1edf37a9fe6abd13 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Sun, 1 Mar 2015 23:33:04 +0530 Subject: staging: media: Remove memset. The memory area set by the call to memset is immediately overwritten by the subsequent call to memcpy. Hence, remove that redundant memset. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/davinci_vpfe/dm365_resizer.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c index 75e70e14b724..7cc8d1b4d737 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c +++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c @@ -907,7 +907,6 @@ resizer_set_defualt_configuration(struct vpfe_resizer_device *resizer) .out_chr_pos = VPFE_IPIPE_YUV422_CHR_POS_COSITE, }, }; - memset(&resizer->config, 0, sizeof(struct resizer_params)); memcpy(&resizer->config, &rsz_default_config, sizeof(struct resizer_params)); } -- cgit v1.2.3 From e2602b2eae6dcd3215eceaeeef0d368310b7cc15 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Sun, 1 Mar 2015 23:33:45 +0530 Subject: staging: media: Remove redundant memset. The memory area set by the call to memset is immediately overwritten by the subsequent call to memcpy. Hence, remove that redundant memset. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c index 878abddf99dc..ceeef18630cc 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c @@ -747,7 +747,6 @@ static void ipipeif_set_default_config(struct vpfe_ipipeif_device *ipipeif) .clip = 4095, }, }; - memset(&ipipeif->config, 0, sizeof(struct ipipeif_params)); memcpy(&ipipeif->config, &ipipeif_defaults, sizeof(struct ipipeif_params)); } -- cgit v1.2.3 From 0b5c85e0f4f5687a6868e743cb51de3897ab96c0 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Mon, 2 Mar 2015 00:40:18 +0530 Subject: staging: Remove header. This patch drops #include in all the staging driver files that also include #include as module.h includes moduleparam.h already. The following semantic patch is used to make these changes: @ includesmodule @ @@ @ depends on includesmodule @ @@ - #include Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 1 - drivers/staging/iio/iio_simple_dummy.c | 1 - drivers/staging/media/cxd2099/cxd2099.c | 1 - drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 1 - drivers/staging/slicoss/slicoss.c | 1 - drivers/staging/vme/devices/vme_pio2_core.c | 1 - drivers/staging/vme/devices/vme_pio2_gpio.c | 1 - drivers/staging/wlan-ng/prism2sta.c | 1 - 8 files changed, 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c index 6da72858d28c..a3a10f9a2a2b 100644 --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c +++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c index e4520213f627..8341dce82f10 100644 --- a/drivers/staging/iio/iio_simple_dummy.c +++ b/drivers/staging/iio/iio_simple_dummy.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/drivers/staging/media/cxd2099/cxd2099.c b/drivers/staging/media/cxd2099/cxd2099.c index 657ea480c6e7..692ba3e63e14 100644 --- a/drivers/staging/media/cxd2099/cxd2099.c +++ b/drivers/staging/media/cxd2099/cxd2099.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index a35ba01247ef..014922565588 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -303,7 +303,6 @@ void __exit ieee80211_debug_exit(void) } } -#include module_param(debug, int, 0444); MODULE_PARM_DESC(debug, "debug output mask"); #endif diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 5bf5300e2d8b..45f6a5fce963 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -84,7 +84,6 @@ #include #include #include -#include #include #include diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 84c5a07e8f6a..eabbcc710a20 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -13,7 +13,6 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include -#include #include #include #include diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c b/drivers/staging/vme/devices/vme_pio2_gpio.c index da34d5529f51..77901b345a71 100644 --- a/drivers/staging/vme/devices/vme_pio2_gpio.c +++ b/drivers/staging/vme/devices/vme_pio2_gpio.c @@ -11,7 +11,6 @@ */ #include -#include #include #include #include diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index 77e0f896bd49..854571fcfee0 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -51,7 +51,6 @@ */ #include -#include #include #include #include -- cgit v1.2.3 From babcf83806cfd6cb7efe33d833146bd125938899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Sun, 1 Mar 2015 23:51:54 +0200 Subject: Staging: rtl8192u: ieee80211: Add blank line after declarations The following patch fixes the checkpatch.pl warning: drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c WARNING: Missing a blank line after declarations Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 8962de7668ed..f651a187d6db 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -109,6 +109,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) u32 crc; u8 *icv; struct scatterlist sg; + if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || skb->len < hdr_len) return -1; @@ -127,6 +128,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) * can be used to speedup attacks, so avoid using them. */ if ((wep->iv & 0xff00) == 0xff00) { u8 B = (wep->iv >> 16) & 0xff; + if (B >= 3 && B < klen) wep->iv += 0x0100; } @@ -179,6 +181,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u32 crc; u8 icv[4]; struct scatterlist sg; + if (skb->len < hdr_len + 8) return -1; @@ -255,6 +258,7 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) static char *prism2_wep_print_stats(char *p, void *priv) { struct prism2_wep_data *wep = priv; + p += sprintf(p, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len); return p; -- cgit v1.2.3 From cc060ed086995922cf36edc46359045092821cf2 Mon Sep 17 00:00:00 2001 From: Frederic Jacob Date: Sat, 7 Feb 2015 21:15:25 -0500 Subject: Staging: fbtft: Fix Sparse warnings This fixes the folowing sparse warnings: fb_hx8340bn.c:111:6: warning: symbol 'set_addr_win' was not declared. Should it be static? fbtft_device.c:32:19: warning: symbol 'spi_device' was not declared. Should it be static? fbtft_device.c:33:24: warning: symbol 'p_device' was not declared. Should it be static? Signed-off-by: Frederic Jacob Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_hx8340bn.c | 2 +- drivers/staging/fbtft/fbtft_device.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_hx8340bn.c b/drivers/staging/fbtft/fb_hx8340bn.c index 3939502f2c81..26a987a68b07 100644 --- a/drivers/staging/fbtft/fb_hx8340bn.c +++ b/drivers/staging/fbtft/fb_hx8340bn.c @@ -108,7 +108,7 @@ static int init_display(struct fbtft_par *par) return 0; } -void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) +static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) { fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 7cc169981c0d..dc48bcc9510e 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -29,8 +29,8 @@ #define MAX_GPIOS 32 -struct spi_device *spi_device; -struct platform_device *p_device; +static struct spi_device *spi_device; +static struct platform_device *p_device; static char *name; module_param(name, charp, 0); -- cgit v1.2.3 From 3fed5bac16a7c3f949d59a0c96b4ffd8f63fbcc1 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Thu, 19 Feb 2015 10:12:11 -0200 Subject: staging: fbtft: fbtft-core: Use '%zu' to print 'size_t' format When building for ARM64 the following build warning is seen: drivers/staging/fbtft/fbtft-core.c:1004:4: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=] Use '%zu' to print 'size_t' format. Signed-off-by: Fabio Estevam Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 8ca45110cfbe..e8d8d07d5f23 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -1000,7 +1000,7 @@ int fbtft_register_framebuffer(struct fb_info *fb_info) fbtft_sysfs_init(par); if (par->txbuf.buf) - sprintf(text1, ", %d KiB %sbuffer memory", + sprintf(text1, ", %zu KiB %sbuffer memory", par->txbuf.len >> 10, par->txbuf.dma ? "DMA " : ""); if (spi) sprintf(text2, ", spi%d.%d at %d MHz", spi->master->bus_num, -- cgit v1.2.3 From 354fd570f067cfb11d62cccb6a686b82e2a8d234 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Thu, 19 Feb 2015 10:12:12 -0200 Subject: staging: fbtft: fbtft-io: Use '%zu' to print 'size_t' format When building for ARM64 the following build warnings are seen: drivers/staging/fbtft/fbtft-io.c: In function 'fbtft_write_spi_emulate_9': drivers/staging/fbtft/fbtft-io.c:63:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=] drivers/staging/fbtft/fbtft-io.c: In function 'fbtft_read_spi': drivers/staging/fbtft/fbtft-io.c:110:5: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=] Use '%zu' to print 'size_t' format. Signed-off-by: Fabio Estevam Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c index 32155a7b2a62..9b2f8cfbb386 100644 --- a/drivers/staging/fbtft/fbtft-io.c +++ b/drivers/staging/fbtft/fbtft-io.c @@ -59,7 +59,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len) } if ((len % 8) != 0) { dev_err(par->info->device, - "%s: error: len=%d must be divisible by 8\n", + "%s: error: len=%zu must be divisible by 8\n", __func__, len); return -EINVAL; } @@ -106,7 +106,7 @@ int fbtft_read_spi(struct fbtft_par *par, void *buf, size_t len) if (par->startbyte) { if (len > 32) { dev_err(par->info->device, - "%s: len=%d can't be larger than 32 when using 'startbyte'\n", + "%s: len=%zu can't be larger than 32 when using 'startbyte'\n", __func__, len); return -EINVAL; } -- cgit v1.2.3 From 4643b70a08442d2aa494eabd6b024a7102aeaa40 Mon Sep 17 00:00:00 2001 From: Matteo Semenzato Date: Sun, 22 Feb 2015 09:50:00 +0100 Subject: Staging: fbtft: fix space errors This patch fixes the following errors: ERROR: space required after that ',' ERROR: trailing whitespace Signed-off-by: Matteo Semenzato Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_upd161704.c | 90 ++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_upd161704.c b/drivers/staging/fbtft/fb_upd161704.c index fff57b330ba2..176c2106d724 100644 --- a/drivers/staging/fbtft/fb_upd161704.c +++ b/drivers/staging/fbtft/fb_upd161704.c @@ -47,84 +47,84 @@ static int init_display(struct fbtft_par *par) /* Initialization sequence from Lib_UTFT */ /* register reset */ - write_reg(par, 0x0003,0x0001); /* Soft reset */ + write_reg(par, 0x0003, 0x0001); /* Soft reset */ /* oscillator start */ - write_reg(par, 0x003A,0x0001); /*Oscillator 0: stop, 1: operation */ + write_reg(par, 0x003A, 0x0001); /*Oscillator 0: stop, 1: operation */ udelay(100); /* y-setting */ - write_reg(par, 0x0024,0x007B); /* amplitude setting */ + write_reg(par, 0x0024, 0x007B); /* amplitude setting */ udelay(10); - write_reg(par, 0x0025,0x003B); /* amplitude setting */ - write_reg(par, 0x0026,0x0034); /* amplitude setting */ + write_reg(par, 0x0025, 0x003B); /* amplitude setting */ + write_reg(par, 0x0026, 0x0034); /* amplitude setting */ udelay(10); - write_reg(par, 0x0027,0x0004); /* amplitude setting */ - write_reg(par, 0x0052,0x0025); /* circuit setting 1 */ + write_reg(par, 0x0027, 0x0004); /* amplitude setting */ + write_reg(par, 0x0052, 0x0025); /* circuit setting 1 */ udelay(10); - write_reg(par, 0x0053,0x0033); /* circuit setting 2 */ - write_reg(par, 0x0061,0x001C); /* adjustment V10 positive polarity */ + write_reg(par, 0x0053, 0x0033); /* circuit setting 2 */ + write_reg(par, 0x0061, 0x001C); /* adjustment V10 positive polarity */ udelay(10); - write_reg(par, 0x0062,0x002C); /* adjustment V9 negative polarity */ - write_reg(par, 0x0063,0x0022); /* adjustment V34 positive polarity */ + write_reg(par, 0x0062, 0x002C); /* adjustment V9 negative polarity */ + write_reg(par, 0x0063, 0x0022); /* adjustment V34 positive polarity */ udelay(10); - write_reg(par, 0x0064,0x0027); /* adjustment V31 negative polarity */ + write_reg(par, 0x0064, 0x0027); /* adjustment V31 negative polarity */ udelay(10); - write_reg(par, 0x0065,0x0014); /* adjustment V61 negative polarity */ + write_reg(par, 0x0065, 0x0014); /* adjustment V61 negative polarity */ udelay(10); - write_reg(par, 0x0066,0x0010); /* adjustment V61 negative polarity */ - + write_reg(par, 0x0066, 0x0010); /* adjustment V61 negative polarity */ + /* Basical clock for 1 line (BASECOUNT[7:0]) number specified */ - write_reg(par, 0x002E,0x002D); - + write_reg(par, 0x002E, 0x002D); + /* Power supply setting */ - write_reg(par, 0x0019,0x0000); /* DC/DC output setting */ + write_reg(par, 0x0019, 0x0000); /* DC/DC output setting */ udelay(200); - write_reg(par, 0x001A,0x1000); /* DC/DC frequency setting */ - write_reg(par, 0x001B,0x0023); /* DC/DC rising setting */ - write_reg(par, 0x001C,0x0C01); /* Regulator voltage setting */ - write_reg(par, 0x001D,0x0000); /* Regulator current setting */ - write_reg(par, 0x001E,0x0009); /* VCOM output setting */ - write_reg(par, 0x001F,0x0035); /* VCOM amplitude setting */ - write_reg(par, 0x0020,0x0015); /* VCOMM cencter setting */ - write_reg(par, 0x0018,0x1E7B); /* DC/DC operation setting */ + write_reg(par, 0x001A, 0x1000); /* DC/DC frequency setting */ + write_reg(par, 0x001B, 0x0023); /* DC/DC rising setting */ + write_reg(par, 0x001C, 0x0C01); /* Regulator voltage setting */ + write_reg(par, 0x001D, 0x0000); /* Regulator current setting */ + write_reg(par, 0x001E, 0x0009); /* VCOM output setting */ + write_reg(par, 0x001F, 0x0035); /* VCOM amplitude setting */ + write_reg(par, 0x0020, 0x0015); /* VCOMM cencter setting */ + write_reg(par, 0x0018, 0x1E7B); /* DC/DC operation setting */ /* windows setting */ - write_reg(par, 0x0008,0x0000); /* Minimum X address */ - write_reg(par, 0x0009,0x00EF); /* Maximum X address */ - write_reg(par, 0x000a,0x0000); /* Minimum Y address */ - write_reg(par, 0x000b,0x013F); /* Maximum Y address */ + write_reg(par, 0x0008, 0x0000); /* Minimum X address */ + write_reg(par, 0x0009, 0x00EF); /* Maximum X address */ + write_reg(par, 0x000a, 0x0000); /* Minimum Y address */ + write_reg(par, 0x000b, 0x013F); /* Maximum Y address */ /* LCD display area setting */ - write_reg(par, 0x0029,0x0000); /* [LCDSIZE] X MIN. size set */ - write_reg(par, 0x002A,0x0000); /* [LCDSIZE] Y MIN. size set */ - write_reg(par, 0x002B,0x00EF); /* [LCDSIZE] X MAX. size set */ - write_reg(par, 0x002C,0x013F); /* [LCDSIZE] Y MAX. size set */ + write_reg(par, 0x0029, 0x0000); /* [LCDSIZE] X MIN. size set */ + write_reg(par, 0x002A, 0x0000); /* [LCDSIZE] Y MIN. size set */ + write_reg(par, 0x002B, 0x00EF); /* [LCDSIZE] X MAX. size set */ + write_reg(par, 0x002C, 0x013F); /* [LCDSIZE] Y MAX. size set */ /* Gate scan setting */ - write_reg(par, 0x0032,0x0002); - + write_reg(par, 0x0032, 0x0002); + /* n line inversion line number */ - write_reg(par, 0x0033,0x0000); + write_reg(par, 0x0033, 0x0000); /* Line inversion/frame inversion/interlace setting */ - write_reg(par, 0x0037,0x0000); - + write_reg(par, 0x0037, 0x0000); + /* Gate scan operation setting register */ - write_reg(par, 0x003B,0x0001); - + write_reg(par, 0x003B, 0x0001); + /* Color mode */ /*GS = 0: 260-k color (64 gray scale), GS = 1: 8 color (2 gray scale) */ - write_reg(par, 0x0004,0x0000); + write_reg(par, 0x0004, 0x0000); /* RAM control register */ - write_reg(par, 0x0005,0x0000); /*Window access 00:Normal, 10:Window */ + write_reg(par, 0x0005, 0x0000); /*Window access 00:Normal, 10:Window */ /* Display setting register 2 */ - write_reg(par, 0x0001,0x0000); + write_reg(par, 0x0001, 0x0000); /* display setting */ - write_reg(par, 0x0000,0x0000); /* display on */ + write_reg(par, 0x0000, 0x0000); /* display on */ return 0; } -- cgit v1.2.3 From 8faeebdf1535e61baab53daeca12f2e8a0071db7 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sat, 21 Feb 2015 18:53:28 -0800 Subject: staging: lustre: Convert "return seq_printf(...)" uses The seq_printf return value, because it's frequently misused, will eventually be converted to void. See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to seq_has_overflowed() and make public") Convert these "return seq_printf(...)" uses to: seq_printf(seq, ...); return 0; Done via cocci script: @@ struct seq_file *seq; @@ - return \(seq_printf\|seq_puts\|seq_putc\)(seq, ...); + return 0; With some additional reformatting and typing post conversion. Miscellanea: o convert an rc++ use to a bool o use seq_puts with fixed strings where appropriate Signed-off-by: Joe Perches Cc: Oleg Drokin Cc: Andreas Dilger Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/hash.c | 11 +-- drivers/staging/lustre/lustre/llite/lproc_llite.c | 88 ++++++++++++---------- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 18 +++-- drivers/staging/lustre/lustre/lov/lproc_lov.c | 30 +++++--- .../lustre/lustre/obdclass/linux/linux-module.c | 38 ++++++---- .../lustre/lustre/obdclass/lprocfs_status.c | 26 ++++--- drivers/staging/lustre/lustre/obdclass/lu_object.c | 25 +++--- drivers/staging/lustre/lustre/osc/lproc_osc.c | 22 +++--- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 20 +++-- 9 files changed, 163 insertions(+), 115 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index ec3a2a8b8b2c..7c74073a5308 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -2010,11 +2010,12 @@ EXPORT_SYMBOL(cfs_hash_rehash_key); int cfs_hash_debug_header(struct seq_file *m) { - return seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n", - CFS_HASH_BIGNAME_LEN, - "name", "cur", "min", "max", "theta", "t-min", "t-max", - "flags", "rehash", "count", "maxdep", "maxdepb", - " distribution"); + seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n", + CFS_HASH_BIGNAME_LEN, + "name", "cur", "min", "max", "theta", "t-min", "t-max", + "flags", "rehash", "count", "maxdep", "maxdepb", + " distribution"); + return 0; } EXPORT_SYMBOL(cfs_hash_debug_header); diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 35e0b39c2772..675bd5a56173 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -187,7 +187,8 @@ static int ll_fstype_seq_show(struct seq_file *m, void *v) struct super_block *sb = (struct super_block *)m->private; LASSERT(sb != NULL); - return seq_printf(m, "%s\n", sb->s_type->name); + seq_printf(m, "%s\n", sb->s_type->name); + return 0; } LPROC_SEQ_FOPS_RO(ll_fstype); @@ -196,7 +197,8 @@ static int ll_sb_uuid_seq_show(struct seq_file *m, void *v) struct super_block *sb = (struct super_block *)m->private; LASSERT(sb != NULL); - return seq_printf(m, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid); + seq_printf(m, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid); + return 0; } LPROC_SEQ_FOPS_RO(ll_sb_uuid); @@ -353,17 +355,18 @@ static int ll_max_cached_mb_seq_show(struct seq_file *m, void *v) max_cached_mb = cache->ccc_lru_max >> shift; unused_mb = atomic_read(&cache->ccc_lru_left) >> shift; - return seq_printf(m, - "users: %d\n" - "max_cached_mb: %d\n" - "used_mb: %d\n" - "unused_mb: %d\n" - "reclaim_count: %u\n", - atomic_read(&cache->ccc_users), - max_cached_mb, - max_cached_mb - unused_mb, - unused_mb, - cache->ccc_lru_shrinkers); + seq_printf(m, + "users: %d\n" + "max_cached_mb: %d\n" + "used_mb: %d\n" + "unused_mb: %d\n" + "reclaim_count: %u\n", + atomic_read(&cache->ccc_users), + max_cached_mb, + max_cached_mb - unused_mb, + unused_mb, + cache->ccc_lru_shrinkers); + return 0; } static ssize_t ll_max_cached_mb_seq_write(struct file *file, @@ -467,7 +470,8 @@ static int ll_checksum_seq_show(struct seq_file *m, void *v) struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); - return seq_printf(m, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0); + seq_printf(m, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0); + return 0; } static ssize_t ll_checksum_seq_write(struct file *file, @@ -503,7 +507,8 @@ static int ll_max_rw_chunk_seq_show(struct seq_file *m, void *v) { struct super_block *sb = m->private; - return seq_printf(m, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk); + seq_printf(m, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk); + return 0; } static ssize_t ll_max_rw_chunk_seq_write(struct file *file, @@ -525,15 +530,14 @@ static int ll_rd_track_id(struct seq_file *m, enum stats_track_type type) { struct super_block *sb = m->private; - if (ll_s2sbi(sb)->ll_stats_track_type == type) { - return seq_printf(m, "%d\n", - ll_s2sbi(sb)->ll_stats_track_id); + if (ll_s2sbi(sb)->ll_stats_track_type == type) + seq_printf(m, "%d\n", ll_s2sbi(sb)->ll_stats_track_id); + else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) + seq_puts(m, "0 (all)\n"); + else + seq_puts(m, "untracked\n"); - } else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) { - return seq_printf(m, "0 (all)\n"); - } else { - return seq_printf(m, "untracked\n"); - } + return 0; } static int ll_wr_track_id(const char __user *buffer, unsigned long count, @@ -601,7 +605,8 @@ static int ll_statahead_max_seq_show(struct seq_file *m, void *v) struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); - return seq_printf(m, "%u\n", sbi->ll_sa_max); + seq_printf(m, "%u\n", sbi->ll_sa_max); + return 0; } static ssize_t ll_statahead_max_seq_write(struct file *file, @@ -631,8 +636,8 @@ static int ll_statahead_agl_seq_show(struct seq_file *m, void *v) struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); - return seq_printf(m, "%u\n", - sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0); + seq_printf(m, "%u\n", sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0); + return 0; } static ssize_t ll_statahead_agl_seq_write(struct file *file, @@ -661,13 +666,14 @@ static int ll_statahead_stats_seq_show(struct seq_file *m, void *v) struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); - return seq_printf(m, - "statahead total: %u\n" - "statahead wrong: %u\n" - "agl total: %u\n", - atomic_read(&sbi->ll_sa_total), - atomic_read(&sbi->ll_sa_wrong), - atomic_read(&sbi->ll_agl_total)); + seq_printf(m, + "statahead total: %u\n" + "statahead wrong: %u\n" + "agl total: %u\n", + atomic_read(&sbi->ll_sa_total), + atomic_read(&sbi->ll_sa_wrong), + atomic_read(&sbi->ll_agl_total)); + return 0; } LPROC_SEQ_FOPS_RO(ll_statahead_stats); @@ -676,8 +682,8 @@ static int ll_lazystatfs_seq_show(struct seq_file *m, void *v) struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); - return seq_printf(m, "%u\n", - (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0); + seq_printf(m, "%u\n", sbi->ll_flags & LL_SBI_LAZYSTATFS ? 1 : 0); + return 0; } static ssize_t ll_lazystatfs_seq_write(struct file *file, @@ -712,7 +718,8 @@ static int ll_max_easize_seq_show(struct seq_file *m, void *v) if (rc) return rc; - return seq_printf(m, "%u\n", ealen); + seq_printf(m, "%u\n", ealen); + return 0; } LPROC_SEQ_FOPS_RO(ll_max_easize); @@ -727,7 +734,8 @@ static int ll_defult_easize_seq_show(struct seq_file *m, void *v) if (rc) return rc; - return seq_printf(m, "%u\n", ealen); + seq_printf(m, "%u\n", ealen); + return 0; } LPROC_SEQ_FOPS_RO(ll_defult_easize); @@ -742,7 +750,8 @@ static int ll_max_cookiesize_seq_show(struct seq_file *m, void *v) if (rc) return rc; - return seq_printf(m, "%u\n", cookielen); + seq_printf(m, "%u\n", cookielen); + return 0; } LPROC_SEQ_FOPS_RO(ll_max_cookiesize); @@ -757,7 +766,8 @@ static int ll_defult_cookiesize_seq_show(struct seq_file *m, void *v) if (rc) return rc; - return seq_printf(m, "%u\n", cookielen); + seq_printf(m, "%u\n", cookielen); + return 0; } LPROC_SEQ_FOPS_RO(ll_defult_cookiesize); diff --git a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c index 5be4176829d3..d5bc0fbdf790 100644 --- a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c +++ b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c @@ -48,7 +48,8 @@ static int lmv_numobd_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); desc = &dev->u.lmv.desc; - return seq_printf(m, "%u\n", desc->ld_tgt_count); + seq_printf(m, "%u\n", desc->ld_tgt_count); + return 0; } LPROC_SEQ_FOPS_RO(lmv_numobd); @@ -82,7 +83,8 @@ static int lmv_placement_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); lmv = &dev->u.lmv; - return seq_printf(m, "%s\n", placement_policy2name(lmv->lmv_placement)); + seq_printf(m, "%s\n", placement_policy2name(lmv->lmv_placement)); + return 0; } #define MAX_POLICY_STRING_SIZE 64 @@ -130,7 +132,8 @@ static int lmv_activeobd_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); desc = &dev->u.lmv.desc; - return seq_printf(m, "%u\n", desc->ld_active_tgt_count); + seq_printf(m, "%u\n", desc->ld_active_tgt_count); + return 0; } LPROC_SEQ_FOPS_RO(lmv_activeobd); @@ -141,7 +144,8 @@ static int lmv_desc_uuid_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); lmv = &dev->u.lmv; - return seq_printf(m, "%s\n", lmv->desc.ld_uuid.uuid); + seq_printf(m, "%s\n", lmv->desc.ld_uuid.uuid); + return 0; } LPROC_SEQ_FOPS_RO(lmv_desc_uuid); @@ -171,8 +175,10 @@ static int lmv_tgt_seq_show(struct seq_file *p, void *v) if (tgt == NULL) return 0; - return seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_idx, - tgt->ltd_uuid.uuid, tgt->ltd_active ? "" : "IN"); + seq_printf(p, "%d: %s %sACTIVE\n", + tgt->ltd_idx, tgt->ltd_uuid.uuid, + tgt->ltd_active ? "" : "IN"); + return 0; } static struct seq_operations lmv_tgt_sops = { diff --git a/drivers/staging/lustre/lustre/lov/lproc_lov.c b/drivers/staging/lustre/lustre/lov/lproc_lov.c index c99f2f44ec62..8842031bc8d1 100644 --- a/drivers/staging/lustre/lustre/lov/lproc_lov.c +++ b/drivers/staging/lustre/lustre/lov/lproc_lov.c @@ -48,7 +48,8 @@ static int lov_stripesize_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); desc = &dev->u.lov.desc; - return seq_printf(m, "%llu\n", desc->ld_default_stripe_size); + seq_printf(m, "%llu\n", desc->ld_default_stripe_size); + return 0; } static ssize_t lov_stripesize_seq_write(struct file *file, @@ -79,7 +80,8 @@ static int lov_stripeoffset_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); desc = &dev->u.lov.desc; - return seq_printf(m, "%llu\n", desc->ld_default_stripe_offset); + seq_printf(m, "%llu\n", desc->ld_default_stripe_offset); + return 0; } static ssize_t lov_stripeoffset_seq_write(struct file *file, @@ -109,7 +111,8 @@ static int lov_stripetype_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); desc = &dev->u.lov.desc; - return seq_printf(m, "%u\n", desc->ld_pattern); + seq_printf(m, "%u\n", desc->ld_pattern); + return 0; } static ssize_t lov_stripetype_seq_write(struct file *file, @@ -139,8 +142,8 @@ static int lov_stripecount_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); desc = &dev->u.lov.desc; - return seq_printf(m, "%d\n", - (__s16)(desc->ld_default_stripe_count + 1) - 1); + seq_printf(m, "%d\n", (__s16)(desc->ld_default_stripe_count + 1) - 1); + return 0; } static ssize_t lov_stripecount_seq_write(struct file *file, @@ -170,7 +173,8 @@ static int lov_numobd_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); desc = &dev->u.lov.desc; - return seq_printf(m, "%u\n", desc->ld_tgt_count); + seq_printf(m, "%u\n", desc->ld_tgt_count); + return 0; } LPROC_SEQ_FOPS_RO(lov_numobd); @@ -181,7 +185,8 @@ static int lov_activeobd_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); desc = &dev->u.lov.desc; - return seq_printf(m, "%u\n", desc->ld_active_tgt_count); + seq_printf(m, "%u\n", desc->ld_active_tgt_count); + return 0; } LPROC_SEQ_FOPS_RO(lov_activeobd); @@ -192,7 +197,8 @@ static int lov_desc_uuid_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); lov = &dev->u.lov; - return seq_printf(m, "%s\n", lov->desc.ld_uuid.uuid); + seq_printf(m, "%s\n", lov->desc.ld_uuid.uuid); + return 0; } LPROC_SEQ_FOPS_RO(lov_desc_uuid); @@ -228,9 +234,11 @@ static void *lov_tgt_seq_next(struct seq_file *p, void *v, loff_t *pos) static int lov_tgt_seq_show(struct seq_file *p, void *v) { struct lov_tgt_desc *tgt = v; - return seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_index, - obd_uuid2str(&tgt->ltd_uuid), - tgt->ltd_active ? "" : "IN"); + + seq_printf(p, "%d: %s %sACTIVE\n", + tgt->ltd_index, obd_uuid2str(&tgt->ltd_uuid), + tgt->ltd_active ? "" : "IN"); + return 0; } struct seq_operations lov_tgt_sops = { diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c index b94aeac18a37..75e704dc8944 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c @@ -219,21 +219,23 @@ struct miscdevice obd_psdev = { #if defined (CONFIG_PROC_FS) int obd_proc_version_seq_show(struct seq_file *m, void *v) { - return seq_printf(m, "lustre: %s\nkernel: %s\nbuild: %s\n", - LUSTRE_VERSION_STRING, "patchless_client", - BUILD_VERSION); + seq_printf(m, "lustre: %s\nkernel: %s\nbuild: %s\n", + LUSTRE_VERSION_STRING, "patchless_client", BUILD_VERSION); + return 0; } LPROC_SEQ_FOPS_RO(obd_proc_version); int obd_proc_pinger_seq_show(struct seq_file *m, void *v) { - return seq_printf(m, "%s\n", "on"); + seq_printf(m, "%s\n", "on"); + return 0; } LPROC_SEQ_FOPS_RO(obd_proc_pinger); static int obd_proc_health_seq_show(struct seq_file *m, void *v) { - int rc = 0, i; + bool healthy = true; + int i; if (libcfs_catastrophe) seq_printf(m, "LBUG\n"); @@ -255,25 +257,27 @@ static int obd_proc_health_seq_show(struct seq_file *m, void *v) if (obd_health_check(NULL, obd)) { seq_printf(m, "device %s reported unhealthy\n", - obd->obd_name); - rc++; + obd->obd_name); + healthy = false; } class_decref(obd, __func__, current); read_lock(&obd_dev_lock); } read_unlock(&obd_dev_lock); - if (rc == 0) - return seq_printf(m, "healthy\n"); + if (healthy) + seq_puts(m, "healthy\n"); + else + seq_puts(m, "NOT HEALTHY\n"); - seq_printf(m, "NOT HEALTHY\n"); return 0; } LPROC_SEQ_FOPS_RO(obd_proc_health); static int obd_proc_jobid_var_seq_show(struct seq_file *m, void *v) { - return seq_printf(m, "%s\n", obd_jobid_var); + seq_printf(m, "%s\n", obd_jobid_var); + return 0; } static ssize_t obd_proc_jobid_var_seq_write(struct file *file, @@ -299,7 +303,8 @@ LPROC_SEQ_FOPS(obd_proc_jobid_var); static int obd_proc_jobid_name_seq_show(struct seq_file *m, void *v) { - return seq_printf(m, "%s\n", obd_jobid_var); + seq_printf(m, "%s\n", obd_jobid_var); + return 0; } static ssize_t obd_proc_jobid_name_seq_write(struct file *file, @@ -378,10 +383,11 @@ static int obd_device_list_seq_show(struct seq_file *p, void *v) else status = "--"; - return seq_printf(p, "%3d %s %s %s %s %d\n", - (int)index, status, obd->obd_type->typ_name, - obd->obd_name, obd->obd_uuid.uuid, - atomic_read(&obd->obd_refcount)); + seq_printf(p, "%3d %s %s %s %s %d\n", + (int)index, status, obd->obd_type->typ_name, + obd->obd_name, obd->obd_uuid.uuid, + atomic_read(&obd->obd_refcount)); + return 0; } struct seq_operations obd_device_list_sops = { diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index ddab94d7ee82..25f01cb23f22 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -377,7 +377,8 @@ EXPORT_SYMBOL(lprocfs_register); /* Generic callbacks */ int lprocfs_rd_uint(struct seq_file *m, void *data) { - return seq_printf(m, "%u\n", *(unsigned int *)data); + seq_printf(m, "%u\n", *(unsigned int *)data); + return 0; } EXPORT_SYMBOL(lprocfs_rd_uint); @@ -403,7 +404,8 @@ EXPORT_SYMBOL(lprocfs_wr_uint); int lprocfs_rd_u64(struct seq_file *m, void *data) { - return seq_printf(m, "%llu\n", *(__u64 *)data); + seq_printf(m, "%llu\n", *(__u64 *)data); + return 0; } EXPORT_SYMBOL(lprocfs_rd_u64); @@ -411,7 +413,8 @@ int lprocfs_rd_atomic(struct seq_file *m, void *data) { atomic_t *atom = data; LASSERT(atom != NULL); - return seq_printf(m, "%d\n", atomic_read(atom)); + seq_printf(m, "%d\n", atomic_read(atom)); + return 0; } EXPORT_SYMBOL(lprocfs_rd_atomic); @@ -439,7 +442,8 @@ int lprocfs_rd_uuid(struct seq_file *m, void *data) struct obd_device *obd = data; LASSERT(obd != NULL); - return seq_printf(m, "%s\n", obd->obd_uuid.uuid); + seq_printf(m, "%s\n", obd->obd_uuid.uuid); + return 0; } EXPORT_SYMBOL(lprocfs_rd_uuid); @@ -448,7 +452,8 @@ int lprocfs_rd_name(struct seq_file *m, void *data) struct obd_device *dev = data; LASSERT(dev != NULL); - return seq_printf(m, "%s\n", dev->obd_name); + seq_printf(m, "%s\n", dev->obd_name); + return 0; } EXPORT_SYMBOL(lprocfs_rd_name); @@ -924,7 +929,8 @@ int lprocfs_rd_num_exports(struct seq_file *m, void *data) struct obd_device *obd = data; LASSERT(obd != NULL); - return seq_printf(m, "%u\n", obd->obd_num_exports); + seq_printf(m, "%u\n", obd->obd_num_exports); + return 0; } EXPORT_SYMBOL(lprocfs_rd_num_exports); @@ -933,7 +939,8 @@ int lprocfs_rd_numrefs(struct seq_file *m, void *data) struct obd_type *class = (struct obd_type *) data; LASSERT(class != NULL); - return seq_printf(m, "%d\n", class->typ_refcnt); + seq_printf(m, "%d\n", class->typ_refcnt); + return 0; } EXPORT_SYMBOL(lprocfs_rd_numrefs); @@ -1606,8 +1613,9 @@ LPROC_SEQ_FOPS_RO(lproc_exp_hash); int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data) { - return seq_printf(m, "%s\n", - "Write into this file to clear all nid stats and stale nid entries"); + seq_printf(m, "%s\n", + "Write into this file to clear all nid stats and stale nid entries"); + return 0; } EXPORT_SYMBOL(lprocfs_nid_stats_clear_read); diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index e104662e2180..d2311f246c4a 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -2010,18 +2010,19 @@ int lu_site_stats_print(const struct lu_site *s, struct seq_file *m) memset(&stats, 0, sizeof(stats)); lu_site_stats_get(s->ls_obj_hash, &stats, 1); - return seq_printf(m, "%d/%d %d/%d %d %d %d %d %d %d %d\n", - stats.lss_busy, - stats.lss_total, - stats.lss_populated, - CFS_HASH_NHLIST(s->ls_obj_hash), - stats.lss_max_search, - ls_stats_read(s->ls_stats, LU_SS_CREATED), - ls_stats_read(s->ls_stats, LU_SS_CACHE_HIT), - ls_stats_read(s->ls_stats, LU_SS_CACHE_MISS), - ls_stats_read(s->ls_stats, LU_SS_CACHE_RACE), - ls_stats_read(s->ls_stats, LU_SS_CACHE_DEATH_RACE), - ls_stats_read(s->ls_stats, LU_SS_LRU_PURGED)); + seq_printf(m, "%d/%d %d/%d %d %d %d %d %d %d %d\n", + stats.lss_busy, + stats.lss_total, + stats.lss_populated, + CFS_HASH_NHLIST(s->ls_obj_hash), + stats.lss_max_search, + ls_stats_read(s->ls_stats, LU_SS_CREATED), + ls_stats_read(s->ls_stats, LU_SS_CACHE_HIT), + ls_stats_read(s->ls_stats, LU_SS_CACHE_MISS), + ls_stats_read(s->ls_stats, LU_SS_CACHE_RACE), + ls_stats_read(s->ls_stats, LU_SS_CACHE_DEATH_RACE), + ls_stats_read(s->ls_stats, LU_SS_LRU_PURGED)); + return 0; } EXPORT_SYMBOL(lu_site_stats_print); diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index f16089a1245a..e0eaafd93521 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -286,8 +286,8 @@ static int osc_grant_shrink_interval_seq_show(struct seq_file *m, void *v) if (obd == NULL) return 0; - return seq_printf(m, "%d\n", - obd->u.cli.cl_grant_shrink_interval); + seq_printf(m, "%d\n", obd->u.cli.cl_grant_shrink_interval); + return 0; } static ssize_t osc_grant_shrink_interval_seq_write(struct file *file, @@ -320,8 +320,8 @@ static int osc_checksum_seq_show(struct seq_file *m, void *v) if (obd == NULL) return 0; - return seq_printf(m, "%d\n", - obd->u.cli.cl_checksum ? 1 : 0); + seq_printf(m, "%d\n", obd->u.cli.cl_checksum ? 1 : 0); + return 0; } static ssize_t osc_checksum_seq_write(struct file *file, @@ -402,7 +402,8 @@ static int osc_resend_count_seq_show(struct seq_file *m, void *v) { struct obd_device *obd = m->private; - return seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends)); + seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends)); + return 0; } static ssize_t osc_resend_count_seq_write(struct file *file, @@ -430,7 +431,8 @@ static int osc_contention_seconds_seq_show(struct seq_file *m, void *v) struct obd_device *obd = m->private; struct osc_device *od = obd2osc_dev(obd); - return seq_printf(m, "%u\n", od->od_contention_time); + seq_printf(m, "%u\n", od->od_contention_time); + return 0; } static ssize_t osc_contention_seconds_seq_write(struct file *file, @@ -450,7 +452,8 @@ static int osc_lockless_truncate_seq_show(struct seq_file *m, void *v) struct obd_device *obd = m->private; struct osc_device *od = obd2osc_dev(obd); - return seq_printf(m, "%u\n", od->od_lockless_truncate); + seq_printf(m, "%u\n", od->od_lockless_truncate); + return 0; } static ssize_t osc_lockless_truncate_seq_write(struct file *file, @@ -468,8 +471,9 @@ LPROC_SEQ_FOPS(osc_lockless_truncate); static int osc_destroys_in_flight_seq_show(struct seq_file *m, void *v) { struct obd_device *obd = m->private; - return seq_printf(m, "%u\n", - atomic_read(&obd->u.cli.cl_destroy_in_flight)); + + seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_destroy_in_flight)); + return 0; } LPROC_SEQ_FOPS_RO(osc_destroys_in_flight); diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 6ca7601bedab..efd214339999 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -267,7 +267,8 @@ ptlrpc_lprocfs_req_history_len_seq_show(struct seq_file *m, void *v) ptlrpc_service_for_each_part(svcpt, i, svc) total += svcpt->scp_hist_nrqbds; - return seq_printf(m, "%d\n", total); + seq_printf(m, "%d\n", total); + return 0; } LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_req_history_len); @@ -282,7 +283,8 @@ ptlrpc_lprocfs_req_history_max_seq_show(struct seq_file *m, void *n) ptlrpc_service_for_each_part(svcpt, i, svc) total += svc->srv_hist_nrqbds_cpt_max; - return seq_printf(m, "%d\n", total); + seq_printf(m, "%d\n", total); + return 0; } static ssize_t @@ -327,8 +329,8 @@ ptlrpc_lprocfs_threads_min_seq_show(struct seq_file *m, void *n) { struct ptlrpc_service *svc = m->private; - return seq_printf(m, "%d\n", - svc->srv_nthrs_cpt_init * svc->srv_ncpts); + seq_printf(m, "%d\n", svc->srv_nthrs_cpt_init * svc->srv_ncpts); + return 0; } static ssize_t @@ -371,7 +373,8 @@ ptlrpc_lprocfs_threads_started_seq_show(struct seq_file *m, void *n) ptlrpc_service_for_each_part(svcpt, i, svc) total += svcpt->scp_nthrs_running; - return seq_printf(m, "%d\n", total); + seq_printf(m, "%d\n", total); + return 0; } LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_threads_started); @@ -380,8 +383,8 @@ ptlrpc_lprocfs_threads_max_seq_show(struct seq_file *m, void *n) { struct ptlrpc_service *svc = m->private; - return seq_printf(m, "%d\n", - svc->srv_nthrs_cpt_limit * svc->srv_ncpts); + seq_printf(m, "%d\n", svc->srv_nthrs_cpt_limit * svc->srv_ncpts); + return 0; } static ssize_t @@ -1026,7 +1029,8 @@ LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_timeouts); static int ptlrpc_lprocfs_hp_ratio_seq_show(struct seq_file *m, void *v) { struct ptlrpc_service *svc = m->private; - return seq_printf(m, "%d", svc->srv_hpreq_ratio); + seq_printf(m, "%d", svc->srv_hpreq_ratio); + return 0; } static ssize_t ptlrpc_lprocfs_hp_ratio_seq_write(struct file *file, -- cgit v1.2.3 From c0e134afc35a6f12ceba8db729ae46afe810cb50 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sat, 21 Feb 2015 18:53:29 -0800 Subject: staging: lustre: Convert seq_ hash functions to return void These functions don't need to return anything. No caller uses the return value. Miscellanea: Integrate the individual strings to reduce object size ~100 bytes. Signed-off-by: Joe Perches Cc: Oleg Drokin Cc: Andreas Dilger Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h | 4 ++-- drivers/staging/lustre/lustre/libcfs/hash.c | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 4dcae612946f..c40814591189 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -785,8 +785,8 @@ static inline void __cfs_hash_set_theta(struct cfs_hash *hs, int min, int max) /* Generic debug formatting routines mainly for proc handler */ struct seq_file; -int cfs_hash_debug_header(struct seq_file *m); -int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m); +void cfs_hash_debug_header(struct seq_file *m); +void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m); /* * Generic djb2 hash algorithm for character arrays. diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 7c74073a5308..a55567e0de9e 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -2008,14 +2008,10 @@ void cfs_hash_rehash_key(struct cfs_hash *hs, const void *old_key, } EXPORT_SYMBOL(cfs_hash_rehash_key); -int cfs_hash_debug_header(struct seq_file *m) +void cfs_hash_debug_header(struct seq_file *m) { - seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n", - CFS_HASH_BIGNAME_LEN, - "name", "cur", "min", "max", "theta", "t-min", "t-max", - "flags", "rehash", "count", "maxdep", "maxdepb", - " distribution"); - return 0; + seq_printf(m, "%-*s cur min max theta t-min t-max flags rehash count maxdep maxdepb distribution\n", + CFS_HASH_BIGNAME_LEN, "name"); } EXPORT_SYMBOL(cfs_hash_debug_header); @@ -2043,7 +2039,7 @@ cfs_hash_full_nbkt(struct cfs_hash *hs) CFS_HASH_RH_NBKT(hs) : CFS_HASH_NBKT(hs); } -int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) +void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) { int dist[8] = { 0, }; int maxdep = -1; @@ -2098,7 +2094,5 @@ int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) seq_printf(m, "%d%c", dist[i], (i == 7) ? '\n' : '/'); cfs_hash_unlock(hs, 0); - - return 0; } EXPORT_SYMBOL(cfs_hash_debug_str); -- cgit v1.2.3 From ab75fb2de197d8bf8257546a4c8726b58ae7ac42 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sat, 21 Feb 2015 18:53:31 -0800 Subject: staging: lustre: Convert remaining uses of "= seq_printf(...)" The seq_printf return value, because it's frequently misused, will eventually be converted to void. See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to seq_has_overflowed() and make public") Convert the remaining uses by hand. Miscellanea: o Convert fixed string output to seq_puts Signed-off-by: Joe Perches Cc: Oleg Drokin Cc: Andreas Dilger Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/lproc_llite.c | 24 ++++--- .../lustre/lustre/obdclass/lprocfs_status.c | 82 +++++++++++----------- 2 files changed, 54 insertions(+), 52 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 675bd5a56173..d04522050437 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -59,7 +59,7 @@ static int ll_blksize_seq_show(struct seq_file *m, void *v) cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) - rc = seq_printf(m, "%u\n", osfs.os_bsize); + seq_printf(m, "%u\n", osfs.os_bsize); return rc; } @@ -82,8 +82,9 @@ static int ll_kbytestotal_seq_show(struct seq_file *m, void *v) while (blk_size >>= 1) result <<= 1; - rc = seq_printf(m, "%llu\n", result); + seq_printf(m, "%llu\n", result); } + return rc; } LPROC_SEQ_FOPS_RO(ll_kbytestotal); @@ -105,8 +106,9 @@ static int ll_kbytesfree_seq_show(struct seq_file *m, void *v) while (blk_size >>= 1) result <<= 1; - rc = seq_printf(m, "%llu\n", result); + seq_printf(m, "%llu\n", result); } + return rc; } LPROC_SEQ_FOPS_RO(ll_kbytesfree); @@ -128,8 +130,9 @@ static int ll_kbytesavail_seq_show(struct seq_file *m, void *v) while (blk_size >>= 1) result <<= 1; - rc = seq_printf(m, "%llu\n", result); + seq_printf(m, "%llu\n", result); } + return rc; } LPROC_SEQ_FOPS_RO(ll_kbytesavail); @@ -145,7 +148,8 @@ static int ll_filestotal_seq_show(struct seq_file *m, void *v) cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) - rc = seq_printf(m, "%llu\n", osfs.os_files); + seq_printf(m, "%llu\n", osfs.os_files); + return rc; } LPROC_SEQ_FOPS_RO(ll_filestotal); @@ -161,7 +165,8 @@ static int ll_filesfree_seq_show(struct seq_file *m, void *v) cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) - rc = seq_printf(m, "%llu\n", osfs.os_ffree); + seq_printf(m, "%llu\n", osfs.os_ffree); + return rc; } LPROC_SEQ_FOPS_RO(ll_filesfree); @@ -169,16 +174,15 @@ LPROC_SEQ_FOPS_RO(ll_filesfree); static int ll_client_type_seq_show(struct seq_file *m, void *v) { struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private); - int rc; LASSERT(sbi != NULL); if (sbi->ll_flags & LL_SBI_RMT_CLIENT) - rc = seq_printf(m, "remote client\n"); + seq_puts(m, "remote client\n"); else - rc = seq_printf(m, "local client\n"); + seq_puts(m, "local client\n"); - return rc; + return 0; } LPROC_SEQ_FOPS_RO(ll_client_type); diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 25f01cb23f22..55e80818bd5d 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -465,7 +465,8 @@ int lprocfs_rd_blksize(struct seq_file *m, void *data) cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) - rc = seq_printf(m, "%u\n", osfs.os_bsize); + seq_printf(m, "%u\n", osfs.os_bsize); + return rc; } EXPORT_SYMBOL(lprocfs_rd_blksize); @@ -484,8 +485,9 @@ int lprocfs_rd_kbytestotal(struct seq_file *m, void *data) while (blk_size >>= 1) result <<= 1; - rc = seq_printf(m, "%llu\n", result); + seq_printf(m, "%llu\n", result); } + return rc; } EXPORT_SYMBOL(lprocfs_rd_kbytestotal); @@ -504,8 +506,9 @@ int lprocfs_rd_kbytesfree(struct seq_file *m, void *data) while (blk_size >>= 1) result <<= 1; - rc = seq_printf(m, "%llu\n", result); + seq_printf(m, "%llu\n", result); } + return rc; } EXPORT_SYMBOL(lprocfs_rd_kbytesfree); @@ -524,8 +527,9 @@ int lprocfs_rd_kbytesavail(struct seq_file *m, void *data) while (blk_size >>= 1) result <<= 1; - rc = seq_printf(m, "%llu\n", result); + seq_printf(m, "%llu\n", result); } + return rc; } EXPORT_SYMBOL(lprocfs_rd_kbytesavail); @@ -538,7 +542,7 @@ int lprocfs_rd_filestotal(struct seq_file *m, void *data) cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) - rc = seq_printf(m, "%llu\n", osfs.os_files); + seq_printf(m, "%llu\n", osfs.os_files); return rc; } @@ -552,7 +556,8 @@ int lprocfs_rd_filesfree(struct seq_file *m, void *data) cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) - rc = seq_printf(m, "%llu\n", osfs.os_ffree); + seq_printf(m, "%llu\n", osfs.os_ffree); + return rc; } EXPORT_SYMBOL(lprocfs_rd_filesfree); @@ -562,17 +567,18 @@ int lprocfs_rd_server_uuid(struct seq_file *m, void *data) struct obd_device *obd = data; struct obd_import *imp; char *imp_state_name = NULL; - int rc = 0; LASSERT(obd != NULL); LPROCFS_CLIMP_CHECK(obd); imp = obd->u.cli.cl_import; imp_state_name = ptlrpc_import_state_name(imp->imp_state); - rc = seq_printf(m, "%s\t%s%s\n", obd2cli_tgt(obd), imp_state_name, - imp->imp_deactive ? "\tDEACTIVATED" : ""); + seq_printf(m, "%s\t%s%s\n", + obd2cli_tgt(obd), imp_state_name, + imp->imp_deactive ? "\tDEACTIVATED" : ""); LPROCFS_CLIMP_EXIT(obd); - return rc; + + return 0; } EXPORT_SYMBOL(lprocfs_rd_server_uuid); @@ -580,19 +586,19 @@ int lprocfs_rd_conn_uuid(struct seq_file *m, void *data) { struct obd_device *obd = data; struct ptlrpc_connection *conn; - int rc = 0; LASSERT(obd != NULL); LPROCFS_CLIMP_CHECK(obd); conn = obd->u.cli.cl_import->imp_connection; if (conn && obd->u.cli.cl_import) - rc = seq_printf(m, "%s\n", conn->c_remote_uuid.uuid); + seq_printf(m, "%s\n", conn->c_remote_uuid.uuid); else - rc = seq_printf(m, "%s\n", ""); + seq_puts(m, "\n"); LPROCFS_CLIMP_EXIT(obd); - return rc; + + return 0; } EXPORT_SYMBOL(lprocfs_rd_conn_uuid); @@ -1207,41 +1213,33 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v) struct lprocfs_counter_header *hdr; struct lprocfs_counter ctr; int idx = *(loff_t *)v; - int rc = 0; if (idx == 0) { struct timeval now; do_gettimeofday(&now); - rc = seq_printf(p, "%-25s %lu.%lu secs.usecs\n", - "snapshot_time", now.tv_sec, (unsigned long)now.tv_usec); - if (rc < 0) - return rc; + seq_printf(p, "%-25s %lu.%lu secs.usecs\n", + "snapshot_time", + now.tv_sec, (unsigned long)now.tv_usec); } + hdr = &stats->ls_cnt_header[idx]; lprocfs_stats_collect(stats, idx, &ctr); - if (ctr.lc_count == 0) - goto out; - - rc = seq_printf(p, "%-25s %lld samples [%s]", hdr->lc_name, - ctr.lc_count, hdr->lc_units); + if (ctr.lc_count != 0) { + seq_printf(p, "%-25s %lld samples [%s]", + hdr->lc_name, ctr.lc_count, hdr->lc_units); - if (rc < 0) - goto out; - - if ((hdr->lc_config & LPROCFS_CNTR_AVGMINMAX) && (ctr.lc_count > 0)) { - rc = seq_printf(p, " %lld %lld %lld", - ctr.lc_min, ctr.lc_max, ctr.lc_sum); - if (rc < 0) - goto out; - if (hdr->lc_config & LPROCFS_CNTR_STDDEV) - rc = seq_printf(p, " %lld", ctr.lc_sumsquare); - if (rc < 0) - goto out; + if ((hdr->lc_config & LPROCFS_CNTR_AVGMINMAX) && + (ctr.lc_count > 0)) { + seq_printf(p, " %lld %lld %lld", + ctr.lc_min, ctr.lc_max, ctr.lc_sum); + if (hdr->lc_config & LPROCFS_CNTR_STDDEV) + seq_printf(p, " %lld", ctr.lc_sumsquare); + } + seq_putc(p, '\n'); } - rc = seq_printf(p, "\n"); -out: - return (rc < 0) ? rc : 0; + + return 0; } static const struct seq_operations lprocfs_stats_seq_sops = { @@ -2049,12 +2047,12 @@ int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file *m, void *data) { struct obd_device *dev = data; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc); + seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } EXPORT_SYMBOL(lprocfs_obd_rd_max_pages_per_rpc); -- cgit v1.2.3 From e8fd99fd97b331c7c60f20f508a482da3c4e8b6a Mon Sep 17 00:00:00 2001 From: Asaf Vertz Date: Mon, 9 Feb 2015 12:00:50 +0200 Subject: staging: lustre: use linux headers WARNING: Use #include instead of WARNING: Use #include instead of WARNING: Use #include instead of Signed-off-by: Asaf Vertz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 2 +- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h | 2 +- drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c | 2 +- drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c | 2 +- drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c | 2 +- drivers/staging/lustre/lustre/llite/llite_mmap.c | 2 +- drivers/staging/lustre/lustre/llite/lloop.c | 3 +-- drivers/staging/lustre/lustre/llite/rw.c | 2 +- drivers/staging/lustre/lustre/llite/rw26.c | 2 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- drivers/staging/lustre/lustre/lov/lproc_lov.c | 2 +- 11 files changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index ab128dee9483..cd664d025f41 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -46,8 +46,8 @@ #include #include #include +#include -#include #include #include diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h index 7a793d2d3582..f5563881b25c 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h @@ -50,8 +50,8 @@ #include #include #include +#include -#include #include #include diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c index 12005a71aa73..4545d54f71c6 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include # define DEBUG_SUBSYSTEM S_LNET diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c index 19f405e64e68..fde2819ff586 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c @@ -43,7 +43,7 @@ #include "../../../include/linux/libcfs/libcfs.h" #if defined(CONFIG_KGDB) -#include +#include #endif /** diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c index c539e3741583..0f65929a8524 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c @@ -50,7 +50,7 @@ #include #include -#include +#include #include #include diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index 479bf428780c..ab07959d3912 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index 031248840642..cec9254e52fa 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -100,8 +100,7 @@ #include #include #include - -#include +#include #include "../include/lustre_lib.h" #include "../include/lustre_lite.h" diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 10a0421366d0..8884a439c351 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 2f21304046aa..91442fab5725 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 6e446ac8d9e7..b9459faf8645 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include "../include/lustre/lustre_idl.h" #include "../include/obd_support.h" diff --git a/drivers/staging/lustre/lustre/lov/lproc_lov.c b/drivers/staging/lustre/lustre/lov/lproc_lov.c index 8842031bc8d1..2d0706222001 100644 --- a/drivers/staging/lustre/lustre/lov/lproc_lov.c +++ b/drivers/staging/lustre/lustre/lov/lproc_lov.c @@ -35,7 +35,7 @@ */ #define DEBUG_SUBSYSTEM S_CLASS -#include +#include #include "../include/lprocfs_status.h" #include "../include/obd_class.h" #include -- cgit v1.2.3 From 89026cbc79682da84f35f7539967c02ee45b9861 Mon Sep 17 00:00:00 2001 From: Arjun AK Date: Sun, 8 Feb 2015 15:59:10 +0530 Subject: staging: lustre: Make the function 'llog_cat_process_cb' static This patch defines the function 'llog_cat_process_cb' as static Signed-off-by: Arjun AK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index 4b850fc5f5d9..08afdf332531 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -526,8 +526,9 @@ int llog_cat_cancel_records(const struct lu_env *env, } EXPORT_SYMBOL(llog_cat_cancel_records); -int llog_cat_process_cb(const struct lu_env *env, struct llog_handle *cat_llh, - struct llog_rec_hdr *rec, void *data) +static int llog_cat_process_cb(const struct lu_env *env, + struct llog_handle *cat_llh, + struct llog_rec_hdr *rec, void *data) { struct llog_process_data *d = data; struct llog_logid_rec *lir = (struct llog_logid_rec *)rec; -- cgit v1.2.3 From 43a9a85aa1ca14f5c477eb1ecadd54ebe1f4b6da Mon Sep 17 00:00:00 2001 From: Mohammad Jamal Date: Tue, 10 Feb 2015 22:48:58 +0530 Subject: staging: lustre: lustre: lov: lov_dev: fix sparse warning of static declaration This patch adds a static keyword to cl_lov_device_mutex_class variable to suppress the warning of static declaration Signed-off-by: Mohammad Jamal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lov/lov_dev.c b/drivers/staging/lustre/lustre/lov/lov_dev.c index 796a015d070c..711b837ddba2 100644 --- a/drivers/staging/lustre/lustre/lov/lov_dev.c +++ b/drivers/staging/lustre/lustre/lov/lov_dev.c @@ -60,7 +60,7 @@ struct kmem_cache *lovsub_req_kmem; struct kmem_cache *lov_lock_link_kmem; /** Lock class of lov_device::ld_mutex. */ -struct lock_class_key cl_lov_device_mutex_class; +static struct lock_class_key cl_lov_device_mutex_class; struct lu_kmem_descr lov_caches[] = { { -- cgit v1.2.3 From 12e397cdfba7e1a2dead072dba3e7bb21905f6c7 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 11 Feb 2015 12:13:14 +0800 Subject: staging: lustre: resolves sparse warnings using static declaration This patch resolves sparse warnings about non-declared symbol in staging/lustre/lustre/lov by adding static declaration. These warnings are like this: warning: symbol 'fiemap_calc_fm_end_offset' was not declared. Should it be static? Signed-off-by: Le Tan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_ea.c | 8 ++++---- drivers/staging/lustre/lustre/lov/lov_obd.c | 24 ++++++++++++------------ drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 2 +- drivers/staging/lustre/lustre/lov/lproc_lov.c | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index e9ec39c5a6c2..d1b0417d5058 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -209,8 +209,8 @@ static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes, return lsm_lmm_verify_common(lmm, lmm_bytes, *stripe_count); } -int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, - struct lov_mds_md_v1 *lmm) +static int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, + struct lov_mds_md_v1 *lmm) { struct lov_oinfo *loi; int i; @@ -287,8 +287,8 @@ static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes, *stripe_count); } -int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, - struct lov_mds_md *lmmv1) +static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, + struct lov_mds_md *lmmv1) { struct lov_mds_md_v3 *lmm; struct lov_oinfo *loi; diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 2c6c55837c7a..219852a14cc6 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -1601,9 +1601,9 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, * \param fm_end logical end of mapping * \param start_stripe starting stripe will be returned in this */ -u64 fiemap_calc_fm_end_offset(struct ll_user_fiemap *fiemap, - struct lov_stripe_md *lsm, u64 fm_start, - u64 fm_end, int *start_stripe) +static u64 fiemap_calc_fm_end_offset(struct ll_user_fiemap *fiemap, + struct lov_stripe_md *lsm, u64 fm_start, + u64 fm_end, int *start_stripe) { u64 local_end = fiemap->fm_extents[0].fe_logical; u64 lun_start, lun_end; @@ -1658,9 +1658,9 @@ u64 fiemap_calc_fm_end_offset(struct ll_user_fiemap *fiemap, * * \retval last_stripe return the last stripe of the mapping */ -int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, u64 fm_start, - u64 fm_end, int start_stripe, - int *stripe_count) +static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, u64 fm_start, + u64 fm_end, int start_stripe, + int *stripe_count) { int last_stripe; u64 obd_start, obd_end; @@ -1694,10 +1694,10 @@ int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, u64 fm_start, * \param ext_count number of extents to be copied * \param current_extent where to start copying in main extent array */ -void fiemap_prepare_and_copy_exts(struct ll_user_fiemap *fiemap, - struct ll_fiemap_extent *lcl_fm_ext, - int ost_index, unsigned int ext_count, - int current_extent) +static void fiemap_prepare_and_copy_exts(struct ll_user_fiemap *fiemap, + struct ll_fiemap_extent *lcl_fm_ext, + int ost_index, unsigned int ext_count, + int current_extent) { char *to; int ext; @@ -2290,7 +2290,7 @@ out: return rc; } -struct obd_ops lov_obd_ops = { +static struct obd_ops lov_obd_ops = { .o_owner = THIS_MODULE, .o_setup = lov_setup, .o_precleanup = lov_precleanup, @@ -2324,7 +2324,7 @@ struct obd_ops lov_obd_ops = { struct kmem_cache *lov_oinfo_slab; -int __init lov_init(void) +static int __init lov_init(void) { struct lprocfs_static_vars lvars = { NULL }; int rc; diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 4cab730ab429..d69a0354baf5 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -563,7 +563,7 @@ static const struct lov_layout_operations lov_dispatch[] = { /** * Return lov_layout_type associated with a given lsm */ -enum lov_layout_type lov_type(struct lov_stripe_md *lsm) +static enum lov_layout_type lov_type(struct lov_stripe_md *lsm) { if (lsm == NULL) return LLT_EMPTY; diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index 0e0ea60de4c8..d96163de773f 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -71,7 +71,7 @@ void lov_pool_putref(struct pool_desc *pool) } } -void lov_pool_putref_locked(struct pool_desc *pool) +static void lov_pool_putref_locked(struct pool_desc *pool) { CDEBUG(D_INFO, "pool %p\n", pool); LASSERT(atomic_read(&pool->pool_refcount) > 1); diff --git a/drivers/staging/lustre/lustre/lov/lproc_lov.c b/drivers/staging/lustre/lustre/lov/lproc_lov.c index 2d0706222001..174cbf5c138f 100644 --- a/drivers/staging/lustre/lustre/lov/lproc_lov.c +++ b/drivers/staging/lustre/lustre/lov/lproc_lov.c @@ -241,7 +241,7 @@ static int lov_tgt_seq_show(struct seq_file *p, void *v) return 0; } -struct seq_operations lov_tgt_sops = { +static const struct seq_operations lov_tgt_sops = { .start = lov_tgt_seq_start, .stop = lov_tgt_seq_stop, .next = lov_tgt_seq_next, @@ -270,7 +270,7 @@ LPROC_SEQ_FOPS_RO_TYPE(lov, kbytestotal); LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree); LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail); -struct lprocfs_vars lprocfs_lov_obd_vars[] = { +static struct lprocfs_vars lprocfs_lov_obd_vars[] = { { "uuid", &lov_uuid_fops, NULL, 0 }, { "stripesize", &lov_stripesize_fops, NULL }, { "stripeoffset", &lov_stripeoffset_fops, NULL }, -- cgit v1.2.3 From b475d037f9118603cd15e0a6c1b0c8363b6d345c Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 12 Feb 2015 15:34:02 +0100 Subject: staging: lustre: Move proc_*() functions inside #ifdef CONFIG_SYSCTL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If CONFIG_SYSCTL=n: drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c:84: warning: ‘proc_set_timeout’ defined but not used drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c:95: warning: ‘proc_memory_alloc’ defined but not used drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c:119: warning: ‘proc_pages_alloc’ defined but not used drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c:143: warning: ‘proc_mem_max’ defined but not used drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c:167: warning: ‘proc_pages_max’ defined but not used drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c:191: warning: ‘proc_max_dirty_pages_in_mb’ defined but not used drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c:232: warning: ‘proc_alloc_fail_rate’ defined but not used Make the existing #ifdef CONFIG_SYSCTL cover all sysctl-related functions to fix this. Signed-off-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index dd46e7358160..c86598d52d53 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -79,6 +79,7 @@ enum { }; +#ifdef CONFIG_SYSCTL static int proc_set_timeout(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { @@ -258,7 +259,6 @@ static int proc_alloc_fail_rate(struct ctl_table *table, int write, return rc; } -#ifdef CONFIG_SYSCTL static struct ctl_table obd_table[] = { { .procname = "timeout", -- cgit v1.2.3 From 695a06667e99134a0639fd62e679a069f814ee40 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Thu, 12 Feb 2015 15:56:07 +0100 Subject: staging: lustre: llite: Remove unnecessary OOM message This patch reduces the kernel size by removing error messages that duplicate the normal OOM message. Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_close.c | 4 +--- drivers/staging/lustre/lustre/llite/xattr_cache.c | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/llite_close.c b/drivers/staging/lustre/lustre/llite/llite_close.c index 21b4a5026776..a94ba02ccf02 100644 --- a/drivers/staging/lustre/lustre/llite/llite_close.c +++ b/drivers/staging/lustre/lustre/llite/llite_close.c @@ -284,10 +284,8 @@ static void ll_done_writing(struct inode *inode) LASSERT(exp_connect_som(ll_i2mdexp(inode))); op_data = kzalloc(sizeof(*op_data), GFP_NOFS); - if (!op_data) { - CERROR("can't allocate op_data\n"); + if (!op_data) return; - } ll_prepare_done_writing(inode, op_data, &och); /* If there is no @och, we do not do D_W yet. */ diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index e2badf17d95e..7e2fcfeacfa5 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -133,11 +133,8 @@ static int ll_xattr_cache_add(struct list_head *cache, goto err_name; } xattr->xe_value = kzalloc(xattr_val_len, GFP_NOFS); - if (!xattr->xe_value) { - CDEBUG(D_CACHE, "failed to alloc xattr value %d\n", - xattr_val_len); + if (!xattr->xe_value) goto err_value; - } memcpy(xattr->xe_value, xattr_val, xattr_val_len); xattr->xe_vallen = xattr_val_len; -- cgit v1.2.3 From 499217c9b61bf783ce66c12de1533f4de0d0c2a0 Mon Sep 17 00:00:00 2001 From: Edward Lipinsky Date: Sat, 21 Feb 2015 11:29:34 -0800 Subject: staging: lustre: lnet: lnet: Remove unneeded braces in lib-eq.c This patch fixes the checkpatch.pl warning: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Edward Lipinsky Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/lib-eq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/lib-eq.c b/drivers/staging/lustre/lnet/lnet/lib-eq.c index 863cc3735edf..5470148f5b64 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-eq.c +++ b/drivers/staging/lustre/lnet/lnet/lib-eq.c @@ -81,9 +81,8 @@ LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, count = cfs_power2_roundup(count); - if (callback != LNET_EQ_HANDLER_NONE && count != 0) { + if (callback != LNET_EQ_HANDLER_NONE && count != 0) CWARN("EQ callback is guaranteed to get every event, do you still want to set eqcount %d for polling event which will have locking overhead? Please contact with developer to confirm\n", count); - } /* count can be 0 if only need callback, we can eliminate * overhead of enqueue event */ -- cgit v1.2.3 From 53bd4a004ee5ff0f71a858de78faac98924b4a87 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 25 Feb 2015 16:20:36 +0300 Subject: Staging: lustre: missing curly braces in ll_setattr_raw() >From the indenting, it looks like curly braces were intended here. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 7c8577761701..ee4bd89c0a18 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1429,7 +1429,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) if (attr->ia_valid & (ATTR_SIZE | ATTR_ATIME | ATTR_ATIME_SET | - ATTR_MTIME | ATTR_MTIME_SET)) + ATTR_MTIME | ATTR_MTIME_SET)) { /* For truncate and utimes sending attributes to OSTs, setting * mtime/atime to the past will be performed under PW [0:EOF] * extent lock (new_size:EOF for truncate). It may seem @@ -1441,6 +1441,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) rc = ll_setattr_ost(inode, attr); if (attr->ia_valid & ATTR_SIZE) up_write(&lli->lli_trunc_sem); + } out: if (op_data) { if (op_data->op_ioepoch) { -- cgit v1.2.3 From d9dfb48f23df4d7b9ec082f6657ab5add7f1682a Mon Sep 17 00:00:00 2001 From: Adrien Descamps Date: Wed, 25 Feb 2015 00:59:25 +0100 Subject: drivers: staging: lustre: Fix "space prohibited between function name and open parenthesis" errors Fix checkpatch.ph errors "space prohibited between function name and open parenthesis" in socklnd.h Signed-off-by: Adrien Descamps Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 130 ++++++++++----------- 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index 03488d289c74..c54c9955164e 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -406,7 +406,7 @@ ksocknal_route_mask(void) } static inline struct list_head * -ksocknal_nid2peerlist (lnet_nid_t nid) +ksocknal_nid2peerlist(lnet_nid_t nid) { unsigned int hash = ((unsigned int)nid) % ksocknal_data.ksnd_peer_hash_size; @@ -414,25 +414,25 @@ ksocknal_nid2peerlist (lnet_nid_t nid) } static inline void -ksocknal_conn_addref (ksock_conn_t *conn) +ksocknal_conn_addref(ksock_conn_t *conn) { - LASSERT (atomic_read(&conn->ksnc_conn_refcount) > 0); + LASSERT(atomic_read(&conn->ksnc_conn_refcount) > 0); atomic_inc(&conn->ksnc_conn_refcount); } -extern void ksocknal_queue_zombie_conn (ksock_conn_t *conn); +extern void ksocknal_queue_zombie_conn(ksock_conn_t *conn); extern void ksocknal_finalize_zcreq(ksock_conn_t *conn); static inline void -ksocknal_conn_decref (ksock_conn_t *conn) +ksocknal_conn_decref(ksock_conn_t *conn) { - LASSERT (atomic_read(&conn->ksnc_conn_refcount) > 0); + LASSERT(atomic_read(&conn->ksnc_conn_refcount) > 0); if (atomic_dec_and_test(&conn->ksnc_conn_refcount)) ksocknal_queue_zombie_conn(conn); } static inline int -ksocknal_connsock_addref (ksock_conn_t *conn) +ksocknal_connsock_addref(ksock_conn_t *conn) { int rc = -ESHUTDOWN; @@ -448,11 +448,11 @@ ksocknal_connsock_addref (ksock_conn_t *conn) } static inline void -ksocknal_connsock_decref (ksock_conn_t *conn) +ksocknal_connsock_decref(ksock_conn_t *conn) { - LASSERT (atomic_read(&conn->ksnc_sock_refcount) > 0); + LASSERT(atomic_read(&conn->ksnc_sock_refcount) > 0); if (atomic_dec_and_test(&conn->ksnc_sock_refcount)) { - LASSERT (conn->ksnc_closing); + LASSERT(conn->ksnc_closing); libcfs_sock_release(conn->ksnc_sock); conn->ksnc_sock = NULL; ksocknal_finalize_zcreq(conn); @@ -460,61 +460,61 @@ ksocknal_connsock_decref (ksock_conn_t *conn) } static inline void -ksocknal_tx_addref (ksock_tx_t *tx) +ksocknal_tx_addref(ksock_tx_t *tx) { - LASSERT (atomic_read(&tx->tx_refcount) > 0); + LASSERT(atomic_read(&tx->tx_refcount) > 0); atomic_inc(&tx->tx_refcount); } -extern void ksocknal_tx_prep (ksock_conn_t *, ksock_tx_t *tx); -extern void ksocknal_tx_done (lnet_ni_t *ni, ksock_tx_t *tx); +extern void ksocknal_tx_prep(ksock_conn_t *, ksock_tx_t *tx); +extern void ksocknal_tx_done(lnet_ni_t *ni, ksock_tx_t *tx); static inline void -ksocknal_tx_decref (ksock_tx_t *tx) +ksocknal_tx_decref(ksock_tx_t *tx) { - LASSERT (atomic_read(&tx->tx_refcount) > 0); + LASSERT(atomic_read(&tx->tx_refcount) > 0); if (atomic_dec_and_test(&tx->tx_refcount)) ksocknal_tx_done(NULL, tx); } static inline void -ksocknal_route_addref (ksock_route_t *route) +ksocknal_route_addref(ksock_route_t *route) { - LASSERT (atomic_read(&route->ksnr_refcount) > 0); + LASSERT(atomic_read(&route->ksnr_refcount) > 0); atomic_inc(&route->ksnr_refcount); } -extern void ksocknal_destroy_route (ksock_route_t *route); +extern void ksocknal_destroy_route(ksock_route_t *route); static inline void -ksocknal_route_decref (ksock_route_t *route) +ksocknal_route_decref(ksock_route_t *route) { - LASSERT (atomic_read (&route->ksnr_refcount) > 0); + LASSERT(atomic_read(&route->ksnr_refcount) > 0); if (atomic_dec_and_test(&route->ksnr_refcount)) - ksocknal_destroy_route (route); + ksocknal_destroy_route(route); } static inline void -ksocknal_peer_addref (ksock_peer_t *peer) +ksocknal_peer_addref(ksock_peer_t *peer) { - LASSERT (atomic_read (&peer->ksnp_refcount) > 0); + LASSERT(atomic_read(&peer->ksnp_refcount) > 0); atomic_inc(&peer->ksnp_refcount); } -extern void ksocknal_destroy_peer (ksock_peer_t *peer); +extern void ksocknal_destroy_peer(ksock_peer_t *peer); static inline void -ksocknal_peer_decref (ksock_peer_t *peer) +ksocknal_peer_decref(ksock_peer_t *peer) { - LASSERT (atomic_read (&peer->ksnp_refcount) > 0); + LASSERT(atomic_read(&peer->ksnp_refcount) > 0); if (atomic_dec_and_test(&peer->ksnp_refcount)) - ksocknal_destroy_peer (peer); + ksocknal_destroy_peer(peer); } -int ksocknal_startup (lnet_ni_t *ni); -void ksocknal_shutdown (lnet_ni_t *ni); +int ksocknal_startup(lnet_ni_t *ni); +void ksocknal_shutdown(lnet_ni_t *ni); int ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg); -int ksocknal_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg); +int ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg); int ksocknal_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, @@ -522,44 +522,44 @@ int ksocknal_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int ksocknal_accept(lnet_ni_t *ni, struct socket *sock); extern int ksocknal_add_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip, int port); -extern ksock_peer_t *ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t id); -extern ksock_peer_t *ksocknal_find_peer (lnet_ni_t *ni, lnet_process_id_t id); -extern void ksocknal_peer_failed (ksock_peer_t *peer); -extern int ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, +extern ksock_peer_t *ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id); +extern ksock_peer_t *ksocknal_find_peer(lnet_ni_t *ni, lnet_process_id_t id); +extern void ksocknal_peer_failed(ksock_peer_t *peer); +extern int ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, struct socket *sock, int type); -extern void ksocknal_close_conn_locked (ksock_conn_t *conn, int why); -extern void ksocknal_terminate_conn (ksock_conn_t *conn); -extern void ksocknal_destroy_conn (ksock_conn_t *conn); -extern int ksocknal_close_peer_conns_locked (ksock_peer_t *peer, +extern void ksocknal_close_conn_locked(ksock_conn_t *conn, int why); +extern void ksocknal_terminate_conn(ksock_conn_t *conn); +extern void ksocknal_destroy_conn(ksock_conn_t *conn); +extern int ksocknal_close_peer_conns_locked(ksock_peer_t *peer, __u32 ipaddr, int why); -extern int ksocknal_close_conn_and_siblings (ksock_conn_t *conn, int why); -extern int ksocknal_close_matching_conns (lnet_process_id_t id, __u32 ipaddr); +extern int ksocknal_close_conn_and_siblings(ksock_conn_t *conn, int why); +extern int ksocknal_close_matching_conns(lnet_process_id_t id, __u32 ipaddr); extern ksock_conn_t *ksocknal_find_conn_locked(ksock_peer_t *peer, ksock_tx_t *tx, int nonblk); extern int ksocknal_launch_packet(lnet_ni_t *ni, ksock_tx_t *tx, lnet_process_id_t id); extern ksock_tx_t *ksocknal_alloc_tx(int type, int size); -extern void ksocknal_free_tx (ksock_tx_t *tx); +extern void ksocknal_free_tx(ksock_tx_t *tx); extern ksock_tx_t *ksocknal_alloc_tx_noop(__u64 cookie, int nonblk); extern void ksocknal_next_tx_carrier(ksock_conn_t *conn); -extern void ksocknal_queue_tx_locked (ksock_tx_t *tx, ksock_conn_t *conn); -extern void ksocknal_txlist_done (lnet_ni_t *ni, struct list_head *txlist, +extern void ksocknal_queue_tx_locked(ksock_tx_t *tx, ksock_conn_t *conn); +extern void ksocknal_txlist_done(lnet_ni_t *ni, struct list_head *txlist, int error); -extern void ksocknal_notify (lnet_ni_t *ni, lnet_nid_t gw_nid, int alive); -extern void ksocknal_query (struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when); +extern void ksocknal_notify(lnet_ni_t *ni, lnet_nid_t gw_nid, int alive); +extern void ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when); extern int ksocknal_thread_start(int (*fn)(void *arg), void *arg, char *name); -extern void ksocknal_thread_fini (void); -extern void ksocknal_launch_all_connections_locked (ksock_peer_t *peer); -extern ksock_route_t *ksocknal_find_connectable_route_locked (ksock_peer_t *peer); -extern ksock_route_t *ksocknal_find_connecting_route_locked (ksock_peer_t *peer); -extern int ksocknal_new_packet (ksock_conn_t *conn, int skip); -extern int ksocknal_scheduler (void *arg); -extern int ksocknal_connd (void *arg); -extern int ksocknal_reaper (void *arg); -extern int ksocknal_send_hello (lnet_ni_t *ni, ksock_conn_t *conn, +extern void ksocknal_thread_fini(void); +extern void ksocknal_launch_all_connections_locked(ksock_peer_t *peer); +extern ksock_route_t *ksocknal_find_connectable_route_locked(ksock_peer_t *peer); +extern ksock_route_t *ksocknal_find_connecting_route_locked(ksock_peer_t *peer); +extern int ksocknal_new_packet(ksock_conn_t *conn, int skip); +extern int ksocknal_scheduler(void *arg); +extern int ksocknal_connd(void *arg); +extern int ksocknal_reaper(void *arg); +extern int ksocknal_send_hello(lnet_ni_t *ni, ksock_conn_t *conn, lnet_nid_t peer_nid, ksock_hello_msg_t *hello); -extern int ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, +extern int ksocknal_recv_hello(lnet_ni_t *ni, ksock_conn_t *conn, ksock_hello_msg_t *hello, lnet_process_id_t *id, __u64 *incarnation); extern void ksocknal_read_callback(ksock_conn_t *conn); @@ -569,15 +569,15 @@ extern int ksocknal_lib_zc_capable(ksock_conn_t *conn); extern void ksocknal_lib_save_callback(struct socket *sock, ksock_conn_t *conn); extern void ksocknal_lib_set_callback(struct socket *sock, ksock_conn_t *conn); extern void ksocknal_lib_reset_callback(struct socket *sock, ksock_conn_t *conn); -extern void ksocknal_lib_push_conn (ksock_conn_t *conn); -extern int ksocknal_lib_get_conn_addrs (ksock_conn_t *conn); -extern int ksocknal_lib_setup_sock (struct socket *so); -extern int ksocknal_lib_send_iov (ksock_conn_t *conn, ksock_tx_t *tx); -extern int ksocknal_lib_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx); -extern void ksocknal_lib_eager_ack (ksock_conn_t *conn); -extern int ksocknal_lib_recv_iov (ksock_conn_t *conn); -extern int ksocknal_lib_recv_kiov (ksock_conn_t *conn); -extern int ksocknal_lib_get_conn_tunables (ksock_conn_t *conn, int *txmem, +extern void ksocknal_lib_push_conn(ksock_conn_t *conn); +extern int ksocknal_lib_get_conn_addrs(ksock_conn_t *conn); +extern int ksocknal_lib_setup_sock(struct socket *so); +extern int ksocknal_lib_send_iov(ksock_conn_t *conn, ksock_tx_t *tx); +extern int ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx); +extern void ksocknal_lib_eager_ack(ksock_conn_t *conn); +extern int ksocknal_lib_recv_iov(ksock_conn_t *conn); +extern int ksocknal_lib_recv_kiov(ksock_conn_t *conn); +extern int ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *nagle); extern int ksocknal_tunables_init(void); -- cgit v1.2.3 From b5693964eaa2a9bb6a6e1b277c9321b4fc511825 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 20 Feb 2015 14:13:19 +0100 Subject: staging: android: ion: fix some format strings C99 says that a precision which is simply '.' with no following digits or * should be interpreted as 0, which means that these format strings actually mean 'print 16 spaces'. However, the kernel's printf implementation treats this case as if the precision was omitted. Don't rely on that quirk. Signed-off-by: Rasmus Villemoes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index b8f1c491553e..65361ca33fc9 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1395,7 +1395,7 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused) size_t total_size = 0; size_t total_orphaned_size = 0; - seq_printf(s, "%16.s %16.s %16.s\n", "client", "pid", "size"); + seq_printf(s, "%16s %16s %16s\n", "client", "pid", "size"); seq_puts(s, "----------------------------------------------------\n"); for (n = rb_first(&dev->clients); n; n = rb_next(n)) { @@ -1409,10 +1409,10 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused) char task_comm[TASK_COMM_LEN]; get_task_comm(task_comm, client->task); - seq_printf(s, "%16.s %16u %16zu\n", task_comm, + seq_printf(s, "%16s %16u %16zu\n", task_comm, client->pid, size); } else { - seq_printf(s, "%16.s %16u %16zu\n", client->name, + seq_printf(s, "%16s %16u %16zu\n", client->name, client->pid, size); } } @@ -1426,7 +1426,7 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused) continue; total_size += buffer->size; if (!buffer->handle_count) { - seq_printf(s, "%16.s %16u %16zu %d %d\n", + seq_printf(s, "%16s %16u %16zu %d %d\n", buffer->task_comm, buffer->pid, buffer->size, buffer->kmap_cnt, atomic_read(&buffer->ref.refcount)); @@ -1435,11 +1435,11 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused) } mutex_unlock(&dev->buffer_lock); seq_puts(s, "----------------------------------------------------\n"); - seq_printf(s, "%16.s %16zu\n", "total orphaned", + seq_printf(s, "%16s %16zu\n", "total orphaned", total_orphaned_size); - seq_printf(s, "%16.s %16zu\n", "total ", total_size); + seq_printf(s, "%16s %16zu\n", "total ", total_size); if (heap->flags & ION_HEAP_FLAG_DEFER_FREE) - seq_printf(s, "%16.s %16zu\n", "deferred free", + seq_printf(s, "%16s %16zu\n", "deferred free", heap->free_list_size); seq_puts(s, "----------------------------------------------------\n"); -- cgit v1.2.3 From cb6ec7f6f5f7506dddc6bba9c204e2dab6dc07c0 Mon Sep 17 00:00:00 2001 From: Alberto Pires de Oliveira Neto Date: Sun, 1 Mar 2015 22:44:04 -0300 Subject: staging: lustre: fld_request.c: Remove else after return. This patch fixes checkpatch.pl warning. WARNING: else is not generally useful after a break or return Signed-off-by: Alberto Pires de Oliveira Neto Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_request.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index b8d17e109a96..f3e9154afdc2 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -217,10 +217,9 @@ int fld_client_add_target(struct lu_client_fld *fld, CERROR("%s: Attempt to add target %s (idx %llu) on fly - skip it\n", fld->lcf_name, name, tar->ft_idx); return 0; - } else { - CDEBUG(D_INFO, "%s: Adding target %s (idx %llu)\n", - fld->lcf_name, name, tar->ft_idx); } + CDEBUG(D_INFO, "%s: Adding target %s (idx %llu)\n", + fld->lcf_name, name, tar->ft_idx); OBD_ALLOC_PTR(target); if (target == NULL) -- cgit v1.2.3 From 4f456c8034ad993eb6908b8a53216bca7afe9f1f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 20 Feb 2015 12:52:26 -0700 Subject: staging: comedi: ni_labpc_common: fix logically dead code issue The quick exit check of (mode == MODE_SINGLE_CHAN) results in coverity reporting a logically dead code issue in the switch code in labpc_ai_check_chanlist(). Remove the quick exit check and allow the function to handle the MODE_SINGLE_CHAN normally (the for loop will only happen 1 time and the function will return 0). Reported-by: coverity (CID 1222108) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_common.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_labpc_common.c b/drivers/staging/comedi/drivers/ni_labpc_common.c index b88ee2614bfe..084c89c36c37 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_common.c +++ b/drivers/staging/comedi/drivers/ni_labpc_common.c @@ -482,9 +482,6 @@ static int labpc_ai_check_chanlist(struct comedi_device *dev, unsigned int aref0 = CR_AREF(cmd->chanlist[0]); int i; - if (mode == MODE_SINGLE_CHAN) - return 0; - for (i = 0; i < cmd->chanlist_len; i++) { unsigned int chan = CR_CHAN(cmd->chanlist[i]); unsigned int range = CR_RANGE(cmd->chanlist[i]); -- cgit v1.2.3 From 1f5fc964866dabec6db6e7eaf8865838b1436a8e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 20 Feb 2015 12:52:27 -0700 Subject: staging: comedi: cb_pcidas64: fix possible integer overflow The {min,max}_scan_divisor values could overflow due to the unsigned int * insigned int calculation. Change the type of the local variable 'convert_divisor' to unsigned long long to avoid the possible overflow. Reported-by: coverity (CID 200653) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 5b43e4e6d037..9836c877c910 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -2001,7 +2001,8 @@ static unsigned int get_divisor(unsigned int ns, unsigned int flags) static void check_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd) { const struct pcidas64_board *thisboard = dev->board_ptr; - unsigned int convert_divisor = 0, scan_divisor; + unsigned long long convert_divisor = 0; + unsigned int scan_divisor; static const int min_convert_divisor = 3; static const int max_convert_divisor = max_counter_value + min_convert_divisor; @@ -2027,7 +2028,6 @@ static void check_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd) if (cmd->scan_begin_src == TRIG_TIMER) { scan_divisor = get_divisor(cmd->scan_begin_arg, cmd->flags); if (cmd->convert_src == TRIG_TIMER) { - /* XXX check for integer overflows */ min_scan_divisor = convert_divisor * cmd->chanlist_len; max_scan_divisor = (convert_divisor * cmd->chanlist_len - 1) + -- cgit v1.2.3 From b7d6b43b4d20cd5b8aa0e56fc1f9185837cd608a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 20 Feb 2015 12:52:28 -0700 Subject: staging: comedi: rtd520: remove unnecessary interrupt disable The read/write of the PLX_INTRCS_REG during the driver detach is not necessary. The rtd_reset() function writes 0 to this register which will disable all interrupts. This also fixes a dereference after null check reported by coverity. Reported-by: coverity (CID 751066) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/rtd520.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index a7255d13775a..2688af7f3405 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1299,12 +1299,8 @@ static void rtd_detach(struct comedi_device *dev) /* Shut down any board ops by resetting it */ if (dev->mmio && devpriv->lcfg) rtd_reset(dev); - if (dev->irq) { - writel(readl(devpriv->lcfg + PLX_INTRCS_REG) & - ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E), - devpriv->lcfg + PLX_INTRCS_REG); + if (dev->irq) free_irq(dev->irq, dev); - } if (dev->mmio) iounmap(dev->mmio); if (devpriv->las1) -- cgit v1.2.3 From d42b5211d861f1077869e9133efa19297a6f152b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:28 -0700 Subject: staging: comedi: comedi_8254: introduce module for 8254 timer support A 8254 timer/counter is commonly used on data acquisition boards to provide the internal pacer clock used to acquire analog input samples. Some boards also to allow the timers to be used externally. Currently the 8254 timers are supported by comedi using the 8253.h header and a number of inline functions. This works for the internal pacer clock but requires the drivers to implement subdevice code necessary to use the timers externally. Introduce a new module to support both the internal pacer clock and the external counter subdevice. This will allow removing a bunch of duplicated code in the drivers and standardizes the comedi 8254 timer support. This implementation is based on the 8253.h inline functions and the various subdevice functionality in the comedi drivers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 3 + drivers/staging/comedi/drivers/Makefile | 1 + drivers/staging/comedi/drivers/comedi_8254.c | 664 +++++++++++++++++++++++++++ drivers/staging/comedi/drivers/comedi_8254.h | 129 ++++++ 4 files changed, 797 insertions(+) create mode 100644 drivers/staging/comedi/drivers/comedi_8254.c create mode 100644 drivers/staging/comedi/drivers/comedi_8254.h (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 593fcb1783b4..a2577ba5dcbd 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1222,6 +1222,9 @@ config COMEDI_VMK80XX endif # COMEDI_USB_DRIVERS +config COMEDI_8254 + tristate + config COMEDI_8255 tristate "Generic 8255 support" ---help--- diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index 7d1fbd53a8ab..d6d834006015 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -3,6 +3,7 @@ ccflags-$(CONFIG_COMEDI_DEBUG) := -DDEBUG # Comedi "helper" modules +obj-$(CONFIG_COMEDI_8254) += comedi_8254.o obj-$(CONFIG_COMEDI_ISADMA) += comedi_isadma.o # Comedi misc drivers diff --git a/drivers/staging/comedi/drivers/comedi_8254.c b/drivers/staging/comedi/drivers/comedi_8254.c new file mode 100644 index 000000000000..0d5d56b61f60 --- /dev/null +++ b/drivers/staging/comedi/drivers/comedi_8254.c @@ -0,0 +1,664 @@ +/* + * comedi_8254.c + * Generic 8254 timer/counter support + * Copyright (C) 2014 H Hartley Sweeten + * + * Based on 8253.h and various subdevice implementations in comedi drivers. + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/* + * Module: comedi_8254 + * Description: Generic 8254 timer/counter support + * Author: H Hartley Sweeten + * Updated: Thu Jan 8 16:45:45 MST 2015 + * Status: works + * + * This module is not used directly by end-users. Rather, it is used by other + * drivers to provide support for an 8254 Programmable Interval Timer. These + * counters are typically used to generate the pacer clock used for data + * acquisition. Some drivers also expose the counters for general purpose use. + * + * This module provides the following basic functions: + * + * comedi_8254_init() / comedi_8254_mm_init() + * Initializes this module to access the 8254 registers. The _mm version + * sets up the module for MMIO register access the other for PIO access. + * The pointer returned from these functions is normally stored in the + * comedi_device dev->pacer and will be freed by the comedi core during + * the driver (*detach). If a driver has multiple 8254 devices, they need + * to be stored in the drivers private data and freed when the driver is + * detached. + * + * NOTE: The counters are reset by setting them to I8254_MODE0 as part of + * this initialization. + * + * comedi_8254_set_mode() + * Sets a counters operation mode: + * I8254_MODE0 Interrupt on terminal count + * I8254_MODE1 Hardware retriggerable one-shot + * I8254_MODE2 Rate generator + * I8254_MODE3 Square wave mode + * I8254_MODE4 Software triggered strobe + * I8254_MODE5 Hardware triggered strobe (retriggerable) + * + * In addition I8254_BCD and I8254_BINARY specify the counting mode: + * I8254_BCD BCD counting + * I8254_BINARY Binary counting + * + * comedi_8254_write() + * Writes an initial value to a counter. + * + * The largest possible initial count is 0; this is equivalent to 2^16 + * for binary counting and 10^4 for BCD counting. + * + * NOTE: The counter does not stop when it reaches zero. In Mode 0, 1, 4, + * and 5 the counter "wraps around" to the highest count, either 0xffff + * for binary counting or 9999 for BCD counting, and continues counting. + * Modes 2 and 3 are periodic; the counter reloads itself with the initial + * count and continues counting from there. + * + * comedi_8254_read() + * Reads the current value from a counter. + * + * comedi_8254_status() + * Reads the status of a counter. + * + * comedi_8254_load() + * Sets a counters operation mode and writes the initial value. + * + * Typically the pacer clock is created by cascading two of the 16-bit counters + * to create a 32-bit rate generator (I8254_MODE2). These functions are + * provided to handle the cascaded counters: + * + * comedi_8254_ns_to_timer() + * Calculates the divisor value needed for a single counter to generate + * ns timing. + * + * comedi_8254_cascade_ns_to_timer() + * Calculates the two divisor values needed to the generate the pacer + * clock (in ns). + * + * comedi_8254_update_divisors() + * Transfers the intermediate divisor values to the current divisors. + * + * comedi_8254_pacer_enable() + * Programs the mode of the cascaded counters and writes the current + * divisor values. + * + * To expose the counters as a subdevice for general purpose use the following + * functions a provided: + * + * comedi_8254_subdevice_init() + * Initializes a comedi_subdevice to use the 8254 timer. + * + * comedi_8254_set_busy() + * Internally flags a counter as "busy". This is done to protect the + * counters that are used for the cascaded 32-bit pacer. + * + * The subdevice provides (*insn_read) and (*insn_write) operations to read + * the current value and write an initial value to a counter. A (*insn_config) + * operation is also provided to handle the following comedi instructions: + * + * INSN_CONFIG_SET_COUNTER_MODE calls comedi_8254_set_mode() + * INSN_CONFIG_8254_READ_STATUS calls comedi_8254_status() + * + * The (*insn_config) member of comedi_8254 can be initialized by the external + * driver to handle any additional instructions. + * + * NOTE: Gate control, clock routing, and any interrupt handling for the + * counters is not handled by this module. These features are driver dependent. + */ + +#include +#include +#include + +#include "../comedidev.h" + +#include "comedi_8254.h" + +static unsigned int __i8254_read(struct comedi_8254 *i8254, unsigned int reg) +{ + unsigned int reg_offset = (reg * i8254->iosize) << i8254->regshift; + unsigned int val; + + switch (i8254->iosize) { + default: + case I8254_IO8: + if (i8254->mmio) + val = readb(i8254->mmio + reg_offset); + else + val = inb(i8254->iobase + reg_offset); + break; + case I8254_IO16: + if (i8254->mmio) + val = readw(i8254->mmio + reg_offset); + else + val = inw(i8254->iobase + reg_offset); + break; + case I8254_IO32: + if (i8254->mmio) + val = readl(i8254->mmio + reg_offset); + else + val = inl(i8254->iobase + reg_offset); + break; + } + return val & 0xff; +} + +static void __i8254_write(struct comedi_8254 *i8254, + unsigned int val, unsigned int reg) +{ + unsigned int reg_offset = (reg * i8254->iosize) << i8254->regshift; + + switch (i8254->iosize) { + default: + case I8254_IO8: + if (i8254->mmio) + writeb(val, i8254->mmio + reg_offset); + else + outb(val, i8254->iobase + reg_offset); + break; + case I8254_IO16: + if (i8254->mmio) + writew(val, i8254->mmio + reg_offset); + else + outw(val, i8254->iobase + reg_offset); + break; + case I8254_IO32: + if (i8254->mmio) + writel(val, i8254->mmio + reg_offset); + else + outl(val, i8254->iobase + reg_offset); + break; + } +} + +/** + * comedi_8254_status - return the status of a counter + * @i8254: comedi_8254 struct for the timer + * @counter: the counter number + */ +unsigned int comedi_8254_status(struct comedi_8254 *i8254, unsigned int counter) +{ + unsigned int cmd; + + if (counter > 2) + return 0; + + cmd = I8254_CTRL_READBACK_STATUS | I8254_CTRL_READBACK_SEL_CTR(counter); + __i8254_write(i8254, cmd, I8254_CTRL_REG); + + return __i8254_read(i8254, counter); +} +EXPORT_SYMBOL_GPL(comedi_8254_status); + +/** + * comedi_8254_read - read the current counter value + * @i8254: comedi_8254 struct for the timer + * @counter: the counter number + */ +unsigned int comedi_8254_read(struct comedi_8254 *i8254, unsigned int counter) +{ + unsigned int val; + + if (counter > 2) + return 0; + + /* latch counter */ + __i8254_write(i8254, I8254_CTRL_SEL_CTR(counter) | I8254_CTRL_LATCH, + I8254_CTRL_REG); + + /* read LSB then MSB */ + val = __i8254_read(i8254, counter); + val |= (__i8254_read(i8254, counter) << 8); + + return val; +} +EXPORT_SYMBOL_GPL(comedi_8254_read); + +/** + * comedi_8254_write - load a 16-bit initial counter value + * @i8254: comedi_8254 struct for the timer + * @counter: the counter number + * @val: the initial value + */ +void comedi_8254_write(struct comedi_8254 *i8254, + unsigned int counter, unsigned int val) +{ + unsigned int byte; + + if (counter > 2) + return; + if (val > 0xffff) + return; + + /* load LSB then MSB */ + byte = val & 0xff; + __i8254_write(i8254, byte, counter); + byte = (val >> 8) & 0xff; + __i8254_write(i8254, byte, counter); +} +EXPORT_SYMBOL_GPL(comedi_8254_write); + +/** + * comedi_8254_set_mode - set the mode of a counter + * @i8254: comedi_8254 struct for the timer + * @counter: the counter number + * @mode: the I8254_MODEx and I8254_BCD|I8254_BINARY + */ +int comedi_8254_set_mode(struct comedi_8254 *i8254, unsigned int counter, + unsigned int mode) +{ + unsigned int byte; + + if (counter > 2) + return -EINVAL; + if (mode > (I8254_MODE5 | I8254_BCD)) + return -EINVAL; + + byte = I8254_CTRL_SEL_CTR(counter) | /* select counter */ + I8254_CTRL_LSB_MSB | /* load LSB then MSB */ + mode; /* mode and BCD|binary */ + __i8254_write(i8254, byte, I8254_CTRL_REG); + + return 0; +} +EXPORT_SYMBOL_GPL(comedi_8254_set_mode); + +/** + * comedi_8254_load - program the mode and initial count of a counter + * @i8254: comedi_8254 struct for the timer + * @counter: the counter number + * @mode: the I8254_MODEx and I8254_BCD|I8254_BINARY + * @val: the initial value + */ +int comedi_8254_load(struct comedi_8254 *i8254, unsigned int counter, + unsigned int val, unsigned int mode) +{ + if (counter > 2) + return -EINVAL; + if (val > 0xffff) + return -EINVAL; + if (mode > (I8254_MODE5 | I8254_BCD)) + return -EINVAL; + + comedi_8254_set_mode(i8254, counter, mode); + comedi_8254_write(i8254, counter, val); + + return 0; +} +EXPORT_SYMBOL_GPL(comedi_8254_load); + +/** + * comedi_8254_pacer_enable - set the mode and load the cascaded counters + * @i8254: comedi_8254 struct for the timer + * @counter1: the counter number for the first divisor + * @counter2: the counter number for the second divisor + * @enable: flag to enable (load) the counters + */ +void comedi_8254_pacer_enable(struct comedi_8254 *i8254, + unsigned int counter1, + unsigned int counter2, + bool enable) +{ + unsigned int mode; + + if (counter1 > 2 || counter2 > 2 || counter1 == counter2) + return; + + if (enable) + mode = I8254_MODE2 | I8254_BINARY; + else + mode = I8254_MODE0 | I8254_BINARY; + + comedi_8254_set_mode(i8254, counter1, mode); + comedi_8254_set_mode(i8254, counter2, mode); + + if (enable) { + /* + * Divisors are loaded second counter then first counter to + * avoid possible issues with the first counter expiring + * before the second counter is loaded. + */ + comedi_8254_write(i8254, counter2, i8254->divisor2); + comedi_8254_write(i8254, counter1, i8254->divisor1); + } +} +EXPORT_SYMBOL_GPL(comedi_8254_pacer_enable); + +/** + * comedi_8254_update_divisors - update the divisors for the cascaded counters + * @i8254: comedi_8254 struct for the timer + */ +void comedi_8254_update_divisors(struct comedi_8254 *i8254) +{ + /* masking is done since counter maps zero to 0x10000 */ + i8254->divisor = i8254->next_div & 0xffff; + i8254->divisor1 = i8254->next_div1 & 0xffff; + i8254->divisor2 = i8254->next_div2 & 0xffff; +} +EXPORT_SYMBOL_GPL(comedi_8254_update_divisors); + +/** + * comedi_8254_cascade_ns_to_timer - calculate the cascaded divisor values + * @i8254: comedi_8254 struct for the timer + * @nanosec: the desired ns time + * @flags: comedi_cmd flags + */ +void comedi_8254_cascade_ns_to_timer(struct comedi_8254 *i8254, + unsigned int *nanosec, + unsigned int flags) +{ + unsigned int d1 = i8254->next_div1 ? i8254->next_div1 : I8254_MAX_COUNT; + unsigned int d2 = i8254->next_div2 ? i8254->next_div2 : I8254_MAX_COUNT; + unsigned int div = d1 * d2; + unsigned int ns_lub = 0xffffffff; + unsigned int ns_glb = 0; + unsigned int d1_lub = 0; + unsigned int d1_glb = 0; + unsigned int d2_lub = 0; + unsigned int d2_glb = 0; + unsigned int start; + unsigned int ns; + unsigned int ns_low; + unsigned int ns_high; + + /* exit early if everything is already correct */ + if (div * i8254->osc_base == *nanosec && + d1 > 1 && d1 <= I8254_MAX_COUNT && + d2 > 1 && d2 <= I8254_MAX_COUNT && + /* check for overflow */ + div > d1 && div > d2 && + div * i8254->osc_base > div && + div * i8254->osc_base > i8254->osc_base) + return; + + div = *nanosec / i8254->osc_base; + d2 = I8254_MAX_COUNT; + start = div / d2; + if (start < 2) + start = 2; + for (d1 = start; d1 <= div / d1 + 1 && d1 <= I8254_MAX_COUNT; d1++) { + for (d2 = div / d1; + d1 * d2 <= div + d1 + 1 && d2 <= I8254_MAX_COUNT; d2++) { + ns = i8254->osc_base * d1 * d2; + if (ns <= *nanosec && ns > ns_glb) { + ns_glb = ns; + d1_glb = d1; + d2_glb = d2; + } + if (ns >= *nanosec && ns < ns_lub) { + ns_lub = ns; + d1_lub = d1; + d2_lub = d2; + } + } + } + + switch (flags & CMDF_ROUND_MASK) { + case CMDF_ROUND_NEAREST: + default: + ns_high = d1_lub * d2_lub * i8254->osc_base; + ns_low = d1_glb * d2_glb * i8254->osc_base; + if (ns_high - *nanosec < *nanosec - ns_low) { + d1 = d1_lub; + d2 = d2_lub; + } else { + d1 = d1_glb; + d2 = d2_glb; + } + break; + case CMDF_ROUND_UP: + d1 = d1_lub; + d2 = d2_lub; + break; + case CMDF_ROUND_DOWN: + d1 = d1_glb; + d2 = d2_glb; + break; + } + + *nanosec = d1 * d2 * i8254->osc_base; + i8254->next_div1 = d1; + i8254->next_div2 = d2; +} +EXPORT_SYMBOL_GPL(comedi_8254_cascade_ns_to_timer); + +/** + * comedi_8254_ns_to_timer - calculate the divisor value for nanosec timing + * @i8254: comedi_8254 struct for the timer + * @nanosec: the desired ns time + * @flags: comedi_cmd flags + */ +void comedi_8254_ns_to_timer(struct comedi_8254 *i8254, + unsigned int *nanosec, unsigned int flags) +{ + unsigned int divisor; + + switch (flags & CMDF_ROUND_MASK) { + default: + case CMDF_ROUND_NEAREST: + divisor = DIV_ROUND_CLOSEST(*nanosec, i8254->osc_base); + break; + case CMDF_ROUND_UP: + divisor = DIV_ROUND_UP(*nanosec, i8254->osc_base); + break; + case CMDF_ROUND_DOWN: + divisor = *nanosec / i8254->osc_base; + break; + } + if (divisor < 2) + divisor = 2; + if (divisor > I8254_MAX_COUNT) + divisor = I8254_MAX_COUNT; + + *nanosec = divisor * i8254->osc_base; + i8254->next_div = divisor; +} +EXPORT_SYMBOL_GPL(comedi_8254_ns_to_timer); + +/** + * comedi_8254_set_busy - set/clear the "busy" flag for a given counter + * @i8254: comedi_8254 struct for the timer + * @counter: the counter number + * @busy: set/clear flag + */ +void comedi_8254_set_busy(struct comedi_8254 *i8254, + unsigned int counter, bool busy) +{ + if (counter < 3) + i8254->busy[counter] = busy; +} +EXPORT_SYMBOL_GPL(comedi_8254_set_busy); + +static int comedi_8254_insn_read(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct comedi_8254 *i8254 = s->private; + unsigned int chan = CR_CHAN(insn->chanspec); + int i; + + if (i8254->busy[chan]) + return -EBUSY; + + for (i = 0; i < insn->n; i++) + data[i] = comedi_8254_read(i8254, chan); + + return insn->n; +} + +static int comedi_8254_insn_write(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct comedi_8254 *i8254 = s->private; + unsigned int chan = CR_CHAN(insn->chanspec); + + if (i8254->busy[chan]) + return -EBUSY; + + if (insn->n) + comedi_8254_write(i8254, chan, data[insn->n - 1]); + + return insn->n; +} + +static int comedi_8254_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct comedi_8254 *i8254 = s->private; + unsigned int chan = CR_CHAN(insn->chanspec); + int ret; + + if (i8254->busy[chan]) + return -EBUSY; + + switch (data[0]) { + case INSN_CONFIG_RESET: + ret = comedi_8254_set_mode(i8254, chan, + I8254_MODE0 | I8254_BINARY); + if (ret) + return ret; + break; + case INSN_CONFIG_SET_COUNTER_MODE: + ret = comedi_8254_set_mode(i8254, chan, data[1]); + if (ret) + return ret; + break; + case INSN_CONFIG_8254_READ_STATUS: + data[1] = comedi_8254_status(i8254, chan); + break; + default: + /* + * If available, call the driver provided (*insn_config) + * to handle any driver implemented instructions. + */ + if (i8254->insn_config) + return i8254->insn_config(dev, s, insn, data); + + return -EINVAL; + } + + return insn->n; +} + +/** + * comedi_8254_subdevice_init - initialize a comedi_subdevice for the 8254 timer + * @s: comedi_subdevice struct + */ +void comedi_8254_subdevice_init(struct comedi_subdevice *s, + struct comedi_8254 *i8254) +{ + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 3; + s->maxdata = 0xffff; + s->range_table = &range_unknown; + s->insn_read = comedi_8254_insn_read; + s->insn_write = comedi_8254_insn_write; + s->insn_config = comedi_8254_insn_config; + + s->private = i8254; +} +EXPORT_SYMBOL_GPL(comedi_8254_subdevice_init); + +static struct comedi_8254 *__i8254_init(unsigned long iobase, + void __iomem *mmio, + unsigned int osc_base, + unsigned int iosize, + unsigned int regshift) +{ + struct comedi_8254 *i8254; + int i; + + /* sanity check that the iosize is valid */ + if (!(iosize == I8254_IO8 || iosize == I8254_IO16 || + iosize == I8254_IO32)) + return NULL; + + i8254 = kzalloc(sizeof(*i8254), GFP_KERNEL); + if (!i8254) + return NULL; + + i8254->iobase = iobase; + i8254->mmio = mmio; + i8254->iosize = iosize; + i8254->regshift = regshift; + + /* default osc_base to the max speed of a generic 8254 timer */ + i8254->osc_base = osc_base ? osc_base : I8254_OSC_BASE_10MHZ; + + /* reset all the counters by setting them to I8254_MODE0 */ + for (i = 0; i < 3; i++) + comedi_8254_set_mode(i8254, i, I8254_MODE0 | I8254_BINARY); + + return i8254; +} + +/** + * comedi_8254_init - allocate and initialize the 8254 device for pio access + * @mmio: port I/O base address + * @osc_base: base time of the counter in ns + * OPTIONAL - only used by comedi_8254_cascade_ns_to_timer() + * @iosize: I/O register size + * @regshift: register gap shift + */ +struct comedi_8254 *comedi_8254_init(unsigned long iobase, + unsigned int osc_base, + unsigned int iosize, + unsigned int regshift) +{ + return __i8254_init(iobase, NULL, osc_base, iosize, regshift); +} +EXPORT_SYMBOL_GPL(comedi_8254_init); + +/** + * comedi_8254_mm_init - allocate and initialize the 8254 device for mmio access + * @mmio: memory mapped I/O base address + * @osc_base: base time of the counter in ns + * OPTIONAL - only used by comedi_8254_cascade_ns_to_timer() + * @iosize: I/O register size + * @regshift: register gap shift + */ +struct comedi_8254 *comedi_8254_mm_init(void __iomem *mmio, + unsigned int osc_base, + unsigned int iosize, + unsigned int regshift) +{ + return __i8254_init(0, mmio, osc_base, iosize, regshift); +} +EXPORT_SYMBOL_GPL(comedi_8254_mm_init); + +static int __init comedi_8254_module_init(void) +{ + return 0; +} +module_init(comedi_8254_module_init); + +static void __exit comedi_8254_module_exit(void) +{ +} +module_exit(comedi_8254_module_exit); + +MODULE_AUTHOR("H Hartley Sweeten "); +MODULE_DESCRIPTION("Comedi: Generic 8254 timer/counter support"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/comedi/drivers/comedi_8254.h b/drivers/staging/comedi/drivers/comedi_8254.h new file mode 100644 index 000000000000..54f2bf8d5bf6 --- /dev/null +++ b/drivers/staging/comedi/drivers/comedi_8254.h @@ -0,0 +1,129 @@ +/* + * comedi_8254.h + * Generic 8254 timer/counter support + * Copyright (C) 2014 H Hartley Sweeten + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _COMEDI_8254_H +#define _COMEDI_8254_H + +/* + * Common oscillator base values in nanoseconds + */ +#define I8254_OSC_BASE_10MHZ 100 +#define I8254_OSC_BASE_5MHZ 200 +#define I8254_OSC_BASE_4MHZ 250 +#define I8254_OSC_BASE_2MHZ 500 +#define I8254_OSC_BASE_1MHZ 1000 +#define I8254_OSC_BASE_100KHZ 10000 +#define I8254_OSC_BASE_10KHZ 100000 +#define I8254_OSC_BASE_1KHZ 1000000 + +/* + * I/O access size used to read/write registers + */ +#define I8254_IO8 1 +#define I8254_IO16 2 +#define I8254_IO32 4 + +/* + * Register map for generic 8254 timer (I8254_IO8 with 0 regshift) + */ +#define I8254_COUNTER0_REG 0x00 +#define I8254_COUNTER1_REG 0x01 +#define I8254_COUNTER2_REG 0x02 +#define I8254_CTRL_REG 0x03 +#define I8254_CTRL_SEL_CTR(x) ((x) << 6) +#define I8254_CTRL_READBACK_COUNT ((3 << 6) | (1 << 4)) +#define I8254_CTRL_READBACK_STATUS ((3 << 6) | (1 << 5)) +#define I8254_CTRL_READBACK_SEL_CTR(x) (2 << (x)) +#define I8254_CTRL_LATCH (0 << 4) +#define I8254_CTRL_LSB_ONLY (1 << 4) +#define I8254_CTRL_MSB_ONLY (2 << 4) +#define I8254_CTRL_LSB_MSB (3 << 4) + +/* counter maps zero to 0x10000 */ +#define I8254_MAX_COUNT 0x10000 + +/** + * struct comedi_8254 - private data used by this module + * @iobase: PIO base address of the registers (in/out) + * @mmio: MMIO base address of the registers (read/write) + * @iosize: I/O size used to access the registers (b/w/l) + * @regshift: register gap shift + * @osc_base: cascaded oscillator speed in ns + * @divisor: divisor for single counter + * @divisor1: divisor loaded into first cascaded counter + * @divisor2: divisor loaded into second cascaded counter + * #next_div: next divisor for single counter + * @next_div1: next divisor to use for first cascaded counter + * @next_div2: next divisor to use for second cascaded counter + * @busy: flags used to indicate that a counter is "busy" + * @insn_config: driver specific (*insn_config) callback + */ +struct comedi_8254 { + unsigned long iobase; + void __iomem *mmio; + unsigned int iosize; + unsigned int regshift; + unsigned int osc_base; + unsigned int divisor; + unsigned int divisor1; + unsigned int divisor2; + unsigned int next_div; + unsigned int next_div1; + unsigned int next_div2; + bool busy[3]; + + int (*insn_config)(struct comedi_device *, struct comedi_subdevice *s, + struct comedi_insn *, unsigned int *data); +}; + +unsigned int comedi_8254_status(struct comedi_8254 *, unsigned int counter); +unsigned int comedi_8254_read(struct comedi_8254 *, unsigned int counter); +void comedi_8254_write(struct comedi_8254 *, + unsigned int counter, unsigned int val); + +int comedi_8254_set_mode(struct comedi_8254 *, + unsigned int counter, unsigned int mode); +int comedi_8254_load(struct comedi_8254 *, + unsigned int counter, unsigned int val, unsigned int mode); + +void comedi_8254_pacer_enable(struct comedi_8254 *, + unsigned int counter1, unsigned int counter2, + bool enable); +void comedi_8254_update_divisors(struct comedi_8254 *); +void comedi_8254_cascade_ns_to_timer(struct comedi_8254 *, + unsigned int *nanosec, unsigned int flags); +void comedi_8254_ns_to_timer(struct comedi_8254 *, + unsigned int *nanosec, unsigned int flags); + +void comedi_8254_set_busy(struct comedi_8254 *, + unsigned int counter, bool busy); + +void comedi_8254_subdevice_init(struct comedi_subdevice *, + struct comedi_8254 *); + +struct comedi_8254 *comedi_8254_init(unsigned long iobase, + unsigned int osc_base, + unsigned int iosize, + unsigned int regshift); +struct comedi_8254 *comedi_8254_mm_init(void __iomem *mmio, + unsigned int osc_base, + unsigned int iosize, + unsigned int regshift); + +#endif /* _COMEDI_8254_H */ -- cgit v1.2.3 From 43db062afe993fbfed184d78293527679fef9784 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:29 -0700 Subject: staging: comedi: add 'pacer' member to struct comedi_device Add a new member to the comedi_device struct for a comedi_8254 'pacer'. This provides a convient place to store the data allocated by the comedi_8254 module for boards that use an 8254 device to create the data acquisition pacer clock. Automatically free this pointer in comedi_device_detach_cleanup() so that the drivers don't need to do it when then are detached. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedidev.h | 1 + drivers/staging/comedi/drivers.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index e138eb0dc374..30595c0cd5b0 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -256,6 +256,7 @@ struct comedi_driver { struct comedi_device { int use_count; struct comedi_driver *driver; + struct comedi_8254 *pacer; void *private; struct device *class_dev; diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index f32e71438948..e87c68cf11d4 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -139,7 +139,9 @@ static void comedi_device_detach_cleanup(struct comedi_device *dev) dev->n_subdevices = 0; } kfree(dev->private); + kfree(dev->pacer); dev->private = NULL; + dev->pacer = NULL; dev->driver = NULL; dev->board_name = NULL; dev->board_ptr = NULL; -- cgit v1.2.3 From fb5678aff3d469d41d7d7d85e5a12c56b0e1aa94 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:30 -0700 Subject: staging: comedi: pcl812: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data acquisition. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Note that the pacer does not have to be stopped when starting a new async command in pcl812_ai_cmd() or when the card is initialy reset by pcl812_reset(). The counters are all reset when the driver is initially attached and the counters used by the pacer are stopped when a command is canceled. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/pcl812.c | 57 ++++++++++++--------------------- 2 files changed, 21 insertions(+), 37 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index a2577ba5dcbd..4691355f1a7e 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -169,6 +169,7 @@ config COMEDI_PCL730 config COMEDI_PCL812 tristate "Advantech PCL-812/813 and ADlink ACL-8112/8113/8113/8216" select COMEDI_ISADMA if ISA_DMA_API + select COMEDI_8254 ---help--- Enable support for Advantech PCL-812/PG, PCL-813/B, ADLink ACL-8112DG/HG/PG, ACL-8113, ACL-8216, ICP DAS A-821PGH/PGL/PGL-NDA, diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 3ffb1ea2ecc8..1bb67aadff59 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -118,7 +118,7 @@ #include "comedi_isadma.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" /* hardware types of the cards */ #define boardPCL812PG 0 /* and ACL-8112PG */ @@ -513,8 +513,6 @@ struct pcl812_private { unsigned char mode_reg_int; /* there is stored INT number for some card */ unsigned int ai_poll_ptr; /* how many sampes transfer poll */ unsigned int max_812_ai_mode0_rangewait; /* setling time for gain */ - unsigned int divisor1; - unsigned int divisor2; unsigned int use_diff:1; unsigned int use_mpc508:1; unsigned int use_ext_trg:1; @@ -522,21 +520,6 @@ struct pcl812_private { unsigned int ai_eos:1; }; -static void pcl812_start_pacer(struct comedi_device *dev, bool load_timers) -{ - struct pcl812_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + PCL812_TIMER_BASE; - - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - udelay(1); - - if (load_timers) { - i8254_write(timer_base, 0, 2, devpriv->divisor2); - i8254_write(timer_base, 0, 1, devpriv->divisor1); - } -} - static void pcl812_ai_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int unread_samples) @@ -650,7 +633,6 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, struct pcl812_private *devpriv = dev->private; int err = 0; unsigned int flags; - unsigned int arg; /* Step 1 : check if triggers are trivially valid */ @@ -703,11 +685,9 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { - arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_2MHZ, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + unsigned int arg = cmd->convert_arg; + + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } @@ -725,8 +705,6 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned int ctrl = 0; unsigned int i; - pcl812_start_pacer(dev, false); - pcl812_ai_set_chan_range(dev, cmd->chanlist[0], 1); if (dma) { /* check if we can use DMA transfer */ @@ -760,7 +738,8 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) switch (cmd->convert_src) { case TRIG_TIMER: - pcl812_start_pacer(dev, true); + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); break; } @@ -918,7 +897,7 @@ static int pcl812_ai_cancel(struct comedi_device *dev, outb(devpriv->mode_reg_int | PCL812_CTRL_DISABLE_TRIG, dev->iobase + PCL812_CTRL_REG); - pcl812_start_pacer(dev, false); + comedi_8254_pacer_enable(dev->pacer, 1, 2, false); pcl812_ai_clear_eoc(dev); return 0; } @@ -1010,10 +989,6 @@ static void pcl812_reset(struct comedi_device *dev) dev->iobase + PCL812_CTRL_REG); pcl812_ai_clear_eoc(dev); - /* stop pacer */ - if (board->IRQbits) - pcl812_start_pacer(dev, false); - /* * Invalidate last_ai_chanspec then set analog input to * known channel/range. @@ -1162,11 +1137,19 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret) return ret; - if ((1 << it->options[1]) & board->IRQbits) { - ret = request_irq(it->options[1], pcl812_interrupt, 0, - dev->board_name, dev); - if (ret == 0) - dev->irq = it->options[1]; + if (board->IRQbits) { + dev->pacer = comedi_8254_init(dev->iobase + PCL812_TIMER_BASE, + I8254_OSC_BASE_2MHZ, + I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + + if ((1 << it->options[1]) & board->IRQbits) { + ret = request_irq(it->options[1], pcl812_interrupt, 0, + dev->board_name, dev); + if (ret == 0) + dev->irq = it->options[1]; + } } /* we need an IRQ to do DMA on channel 3 or 1 */ -- cgit v1.2.3 From f48c21fc62addff97c5dbf765a93ba604031dd2d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:31 -0700 Subject: staging: comedi: pcl816: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/pcl816.c | 59 +++++++++------------------------ 2 files changed, 16 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 4691355f1a7e..ff8cb3a46ab1 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -181,6 +181,7 @@ config COMEDI_PCL812 config COMEDI_PCL816 tristate "Advantech PCL-814 and PCL-816 ISA card support" select COMEDI_ISADMA if ISA_DMA_API + select COMEDI_8254 ---help--- Enable support for Advantech PCL-814 and PCL-816 ISA cards diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index da35edfccbc3..9cc6933d47da 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -42,7 +42,7 @@ Configuration Options: #include "comedi_isadma.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" /* * Register I/O map @@ -116,31 +116,10 @@ static const struct pcl816_board boardtypes[] = { struct pcl816_private { struct comedi_isadma *dma; unsigned int ai_poll_ptr; /* how many sampes transfer poll */ - unsigned int divisor1; - unsigned int divisor2; unsigned int ai_cmd_running:1; unsigned int ai_cmd_canceled:1; }; -static void pcl816_start_pacer(struct comedi_device *dev, bool load_counters) -{ - struct pcl816_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + PCL816_TIMER_BASE; - - i8254_set_mode(timer_base, 0, 0, I8254_MODE1 | I8254_BINARY); - i8254_write(timer_base, 0, 0, 0x00ff); - udelay(1); - - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - udelay(1); - - if (load_counters) { - i8254_write(timer_base, 0, 2, devpriv->divisor2); - i8254_write(timer_base, 0, 1, devpriv->divisor1); - } -} - static void pcl816_ai_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int unread_samples) @@ -367,9 +346,7 @@ static int check_channel_list(struct comedi_device *dev, static int pcl816_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - struct pcl816_private *devpriv = dev->private; int err = 0; - unsigned int arg; /* Step 1 : check if triggers are trivially valid */ @@ -416,11 +393,9 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { - arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + unsigned int arg = cmd->convert_arg; + + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } @@ -450,8 +425,6 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->ai_cmd_running) return -EBUSY; - pcl816_start_pacer(dev, false); - seglen = check_channel_list(dev, s, cmd->chanlist, cmd->chanlist_len); if (seglen < 1) return -EINVAL; @@ -466,7 +439,11 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) dma->cur_dma = 0; pcl816_ai_setup_dma(dev, s, 0); - pcl816_start_pacer(dev, true); + comedi_8254_set_mode(dev->pacer, 0, I8254_MODE1 | I8254_BINARY); + comedi_8254_write(dev->pacer, 0, 0x0ff); + udelay(1); + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); ctrl = PCL816_CTRL_INTEN | PCL816_CTRL_DMAEN | PCL816_CTRL_DMASRC_SLOT0; if (cmd->convert_src == TRIG_TIMER) @@ -525,11 +502,7 @@ static int pcl816_ai_cancel(struct comedi_device *dev, outb(PCL816_CTRL_DISABLE_TRIG, dev->iobase + PCL816_CTRL_REG); pcl816_ai_clear_eoc(dev); - /* Stop pacer */ - i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0, - 2, I8254_MODE0 | I8254_BINARY); - i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0, - 1, I8254_MODE0 | I8254_BINARY); + comedi_8254_pacer_enable(dev->pacer, 1, 2, false); devpriv->ai_cmd_running = 0; devpriv->ai_cmd_canceled = 1; @@ -596,17 +569,10 @@ static int pcl816_do_insn_bits(struct comedi_device *dev, static void pcl816_reset(struct comedi_device *dev) { - unsigned long timer_base = dev->iobase + PCL816_TIMER_BASE; - outb(PCL816_CTRL_DISABLE_TRIG, dev->iobase + PCL816_CTRL_REG); pcl816_ai_set_chan_range(dev, 0, 0); pcl816_ai_clear_eoc(dev); - /* Stop pacer */ - i8254_set_mode(timer_base, 0, 2, I8254_MODE0 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 1, I8254_MODE0 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 0, I8254_MODE0 | I8254_BINARY); - /* set all digital outputs low */ outb(0, dev->iobase + PCL816_DO_DI_LSB_REG); outb(0, dev->iobase + PCL816_DO_DI_MSB_REG); @@ -662,6 +628,11 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* an IRQ and DMA are required to support async commands */ pcl816_alloc_irq_and_dma(dev, it); + dev->pacer = comedi_8254_init(dev->iobase + PCL816_TIMER_BASE, + I8254_OSC_BASE_10MHZ, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; -- cgit v1.2.3 From 18c284c68b8a52335c9d1ae53b2236ea350310d7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:32 -0700 Subject: staging: comedi: pcl818: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data acquisition. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Note that the pacer does not have to be stopped when starting a new async command in pcl818_ai_cmd() or when the card is initialy reset by pcl818_reset(). The counters are all reset when the driver is initially attached and the counters used by the pacer are stopped when a command is canceled. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/pcl818.c | 80 ++++++++++++--------------------- 2 files changed, 30 insertions(+), 51 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index ff8cb3a46ab1..3698f6897491 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -191,6 +191,7 @@ config COMEDI_PCL816 config COMEDI_PCL818 tristate "Advantech PCL-718 and PCL-818 ISA card support" select COMEDI_ISADMA if ISA_DMA_API + select COMEDI_8254 ---help--- Enable support for Advantech PCL-818 ISA cards PCL-818L, PCL-818H, PCL-818HD, PCL-818HG, PCL-818 and PCL-718 diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 7e4cdea5fe59..8d933dcad533 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -101,7 +101,7 @@ #include "comedi_isadma.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" /* boards constants */ @@ -299,33 +299,15 @@ struct pcl818_private { struct comedi_isadma *dma; /* manimal allowed delay between samples (in us) for actual card */ unsigned int ns_min; - int i8253_osc_base; /* 1/frequency of on board oscilator in ns */ /* MUX setting for actual AI operations */ unsigned int act_chanlist[16]; unsigned int act_chanlist_len; /* how long is actual MUX list */ unsigned int act_chanlist_pos; /* actual position in MUX list */ - unsigned int divisor1; - unsigned int divisor2; unsigned int usefifo:1; unsigned int ai_cmd_running:1; unsigned int ai_cmd_canceled:1; }; -static void pcl818_start_pacer(struct comedi_device *dev, bool load_counters) -{ - struct pcl818_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + PCL818_TIMER_BASE; - - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - udelay(1); - - if (load_counters) { - i8254_write(timer_base, 0, 2, devpriv->divisor2); - i8254_write(timer_base, 0, 1, devpriv->divisor1); - } -} - static void pcl818_ai_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int unread_samples) @@ -663,9 +645,7 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { const struct pcl818_board *board = dev->board_ptr; - struct pcl818_private *devpriv = dev->private; int err = 0; - unsigned int arg; /* Step 1 : check if triggers are trivially valid */ @@ -712,11 +692,9 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { - arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(devpriv->i8253_osc_base, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + unsigned int arg = cmd->convert_arg; + + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } @@ -746,8 +724,6 @@ static int pcl818_ai_cmd(struct comedi_device *dev, if (devpriv->ai_cmd_running) return -EBUSY; - pcl818_start_pacer(dev, false); - seglen = check_channel_list(dev, s, cmd->chanlist, cmd->chanlist_len); if (seglen < 1) return -EINVAL; @@ -779,8 +755,10 @@ static int pcl818_ai_cmd(struct comedi_device *dev, } outb(ctrl, dev->iobase + PCL818_CTRL_REG); - if (cmd->convert_src == TRIG_TIMER) - pcl818_start_pacer(dev, true); + if (cmd->convert_src == TRIG_TIMER) { + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); + } return 0; } @@ -812,7 +790,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev, } outb(PCL818_CTRL_DISABLE_TRIG, dev->iobase + PCL818_CTRL_REG); - pcl818_start_pacer(dev, false); + comedi_8254_pacer_enable(dev->pacer, 1, 2, false); pcl818_ai_clear_eoc(dev); if (devpriv->usefifo) { /* FIFO shutdown */ @@ -906,7 +884,6 @@ static int pcl818_do_insn_bits(struct comedi_device *dev, static void pcl818_reset(struct comedi_device *dev) { const struct pcl818_board *board = dev->board_ptr; - unsigned long timer_base = dev->iobase + PCL818_TIMER_BASE; unsigned int chan; /* flush and disable the FIFO */ @@ -924,9 +901,6 @@ static void pcl818_reset(struct comedi_device *dev) /* stop pacer */ outb(PCL818_CNTENABLE_PACER_ENA, dev->iobase + PCL818_CNTENABLE_REG); - i8254_set_mode(timer_base, 0, 2, I8254_MODE0 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 1, I8254_MODE0 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 0, I8254_MODE0 | I8254_BINARY); /* set analog output channels to 0V */ for (chan = 0; chan < board->n_aochan; chan++) { @@ -1016,6 +990,7 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) const struct pcl818_board *board = dev->board_ptr; struct pcl818_private *devpriv; struct comedi_subdevice *s; + unsigned int osc_base; int ret; devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); @@ -1043,6 +1018,25 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (dev->irq && board->has_dma) pcl818_alloc_dma(dev, it->options[2]); + /* use 1MHz or 10MHz oscilator */ + if ((it->options[3] == 0) || (it->options[3] == 10)) + osc_base = I8254_OSC_BASE_10MHZ; + else + osc_base = I8254_OSC_BASE_1MHZ; + + dev->pacer = comedi_8254_init(dev->iobase + PCL818_TIMER_BASE, + osc_base, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + + /* max sampling speed */ + devpriv->ns_min = board->ns_min; + if (!board->is_818) { + /* extended PCL718 to 100kHz DAC */ + if ((it->options[6] == 1) || (it->options[6] == 100)) + devpriv->ns_min = 10000; + } + ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; @@ -1117,22 +1111,6 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->range_table = &range_digital; s->insn_bits = pcl818_do_insn_bits; - /* select 1/10MHz oscilator */ - if ((it->options[3] == 0) || (it->options[3] == 10)) - devpriv->i8253_osc_base = I8254_OSC_BASE_10MHZ; - else - devpriv->i8253_osc_base = I8254_OSC_BASE_1MHZ; - - /* max sampling speed */ - devpriv->ns_min = board->ns_min; - - if (!board->is_818) { - if ((it->options[6] == 1) || (it->options[6] == 100)) { - /* extended PCL718 to 100kHz DAC */ - devpriv->ns_min = 10000; - } - } - pcl818_reset(dev); return 0; -- cgit v1.2.3 From 9ef02dea590bcce86967edf4da75b4b70db5fee3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:33 -0700 Subject: staging: comedi: pcl711: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data acquisition. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/pcl711.c | 42 +++++++++------------------------ 2 files changed, 12 insertions(+), 31 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 3698f6897491..b92fa05732d6 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -108,6 +108,7 @@ if COMEDI_ISA_DRIVERS config COMEDI_PCL711 tristate "Advantech PCL-711/711b and ADlink ACL-8112 ISA card support" + select COMEDI_8254 ---help--- Enable support for Advantech PCL-711 and 711b, ADlink ACL-8112 diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index cb7e4c37b8b9..ef7db1261739 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -42,7 +42,7 @@ #include "../comedidev.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" /* * I/O port register map @@ -153,11 +153,6 @@ static const struct pcl711_board boardtypes[] = { }, }; -struct pcl711_private { - unsigned int divisor1; - unsigned int divisor2; -}; - static void pcl711_ai_set_mode(struct comedi_device *dev, unsigned int mode) { /* @@ -287,9 +282,7 @@ static int pcl711_ai_insn_read(struct comedi_device *dev, static int pcl711_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - struct pcl711_private *devpriv = dev->private; int err = 0; - unsigned int arg; /* Step 1 : check if triggers are trivially valid */ @@ -339,11 +332,9 @@ static int pcl711_ai_cmdtest(struct comedi_device *dev, /* step 4 */ if (cmd->scan_begin_src == TRIG_TIMER) { - arg = cmd->scan_begin_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_2MHZ, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + unsigned int arg = cmd->scan_begin_arg; + + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } @@ -353,18 +344,6 @@ static int pcl711_ai_cmdtest(struct comedi_device *dev, return 0; } -static void pcl711_ai_load_counters(struct comedi_device *dev) -{ - struct pcl711_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + PCL711_TIMER_BASE; - - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - - i8254_write(timer_base, 0, 1, devpriv->divisor1); - i8254_write(timer_base, 0, 2, devpriv->divisor2); -} - static int pcl711_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct comedi_cmd *cmd = &s->async->cmd; @@ -372,7 +351,8 @@ static int pcl711_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) pcl711_set_changain(dev, s, cmd->chanlist[0]); if (cmd->scan_begin_src == TRIG_TIMER) { - pcl711_ai_load_counters(dev); + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); outb(PCL711_INT_STAT_CLR, dev->iobase + PCL711_INT_STAT_REG); pcl711_ai_set_mode(dev, PCL711_MODE_PACER_IRQ); } else { @@ -445,14 +425,9 @@ static int pcl711_do_insn_bits(struct comedi_device *dev, static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct pcl711_board *board = dev->board_ptr; - struct pcl711_private *devpriv; struct comedi_subdevice *s; int ret; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) - return -ENOMEM; - ret = comedi_request_region(dev, it->options[0], 0x10); if (ret) return ret; @@ -464,6 +439,11 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->irq = it->options[1]; } + dev->pacer = comedi_8254_init(dev->iobase + PCL711_TIMER_BASE, + I8254_OSC_BASE_2MHZ, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; -- cgit v1.2.3 From 0880acf846a273ff12ab0b963521c5d668a27466 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:34 -0700 Subject: staging: comedi: adl_pci9111: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data acquisition. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/adl_pci9111.c | 39 +++++++--------------------- 2 files changed, 10 insertions(+), 30 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index b92fa05732d6..de1d7ada90dc 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -719,6 +719,7 @@ config COMEDI_ADL_PCI8164 config COMEDI_ADL_PCI9111 tristate "ADLink PCI-9111HR support" + select COMEDI_8254 ---help--- Enable support for ADlink PCI9111 cards diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index f68dc99f8e27..3f82fa002e0d 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -71,9 +71,9 @@ TODO: #include "../comedidev.h" -#include "8253.h" #include "plx9052.h" #include "comedi_fc.h" +#include "comedi_8254.h" #define PCI9111_FIFO_HALF_SIZE 512 @@ -137,9 +137,6 @@ struct pci9111_private_data { unsigned int chunk_counter; unsigned int chunk_num_samples; - unsigned int div1; - unsigned int div2; - unsigned short ai_bounce_buffer[2 * PCI9111_FIFO_HALF_SIZE]; }; @@ -167,21 +164,6 @@ static void plx9050_interrupt_control(unsigned long io_base, outb(flags, io_base + PLX9052_INTCSR); } -static void pci9111_timer_set(struct comedi_device *dev) -{ - struct pci9111_private_data *dev_private = dev->private; - unsigned long timer_base = dev->iobase + PCI9111_8254_BASE_REG; - - i8254_set_mode(timer_base, 1, 0, I8254_MODE0 | I8254_BINARY); - i8254_set_mode(timer_base, 1, 1, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 1, 2, I8254_MODE2 | I8254_BINARY); - - udelay(1); - - i8254_write(timer_base, 1, 2, dev_private->div2); - i8254_write(timer_base, 1, 1, dev_private->div1); -} - enum pci9111_ISC0_sources { irq_on_eoc, irq_on_fifo_half_full @@ -281,7 +263,6 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - struct pci9111_private_data *dev_private = dev->private; int err = 0; unsigned int arg; @@ -345,10 +326,7 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_2MHZ, - &dev_private->div1, - &dev_private->div2, - &arg, cmd->flags); + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } @@ -406,7 +384,8 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev, dev_private->scan_delay = 0; if (cmd->convert_src == TRIG_TIMER) { trig |= PCI9111_AI_TRIG_CTRL_TPST; - pci9111_timer_set(dev); + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); pci9111_fifo_reset(dev); pci9111_interrupt_source_set(dev, irq_on_fifo_half_full, irq_on_timer_tick); @@ -667,11 +646,6 @@ static int pci9111_reset(struct comedi_device *dev) /* disable A/D triggers (software trigger mode) and auto scan off */ outb(0, dev->iobase + PCI9111_AI_TRIG_CTRL_REG); - /* Reset 8254 chip */ - dev_private->div1 = 0; - dev_private->div2 = 0; - pci9111_timer_set(dev); - return 0; } @@ -702,6 +676,11 @@ static int pci9111_auto_attach(struct comedi_device *dev, dev->irq = pcidev->irq; } + dev->pacer = comedi_8254_init(dev->iobase + PCI9111_8254_BASE_REG, + I8254_OSC_BASE_2MHZ, I8254_IO16, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; -- cgit v1.2.3 From 6aa37d79169b10816edeaa2d4a690f35665f3091 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:35 -0700 Subject: staging: comedi: amplc_pci224: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog output data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/amplc_pci224.c | 34 ++++++++++----------------- 2 files changed, 14 insertions(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index de1d7ada90dc..98a62e34b7b6 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -804,6 +804,7 @@ config COMEDI_AMPLC_PC263_PCI config COMEDI_AMPLC_PCI224 tristate "Amplicon PCI224 and PCI234 support" + select COMEDI_8254 ---help--- Enable support for Amplicon PCI224 and PCI234 AO boards diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 924c8298c7a0..88b8c0101c25 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -110,15 +110,12 @@ #include "../comedidev.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" /* * PCI224/234 i/o space 1 (PCIBAR2) registers. */ -#define PCI224_Z2_CT0 0x14 /* 82C54 counter/timer 0 */ -#define PCI224_Z2_CT1 0x15 /* 82C54 counter/timer 1 */ -#define PCI224_Z2_CT2 0x16 /* 82C54 counter/timer 2 */ -#define PCI224_Z2_CTC 0x17 /* 82C54 counter/timer control word */ +#define PCI224_Z2_BASE 0x14 /* 82C54 counter/timer */ #define PCI224_ZCLK_SCE 0x1A /* Group Z Clock Configuration Register */ #define PCI224_ZGAT_SCE 0x1D /* Group Z Gate Configuration Register */ #define PCI224_INT_SCE 0x1E /* ISR Interrupt source mask register */ @@ -379,8 +376,6 @@ struct pci224_private { int intr_cpuid; short intr_running; unsigned short daccon; - unsigned int cached_div1; - unsigned int cached_div2; unsigned short ao_enab; /* max 16 channels so 'short' will do */ unsigned char intsce; }; @@ -668,7 +663,6 @@ static int pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - struct pci224_private *devpriv = dev->private; int err = 0; unsigned int arg; @@ -793,10 +787,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; /* Use two timers. */ - i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ, - &devpriv->cached_div1, - &devpriv->cached_div2, - &arg, cmd->flags); + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } @@ -817,7 +808,6 @@ static void pci224_ao_start_pacer(struct comedi_device *dev, struct comedi_subdevice *s) { struct pci224_private *devpriv = dev->private; - unsigned long timer_base = devpriv->iobase1 + PCI224_Z2_CT0; /* * The output of timer Z2-0 will be used as the scan trigger @@ -830,14 +820,10 @@ static void pci224_ao_start_pacer(struct comedi_device *dev, outb(GAT_CONFIG(2, GAT_VCC), devpriv->iobase1 + PCI224_ZGAT_SCE); /* Z2-2 needs 10 MHz clock. */ outb(CLK_CONFIG(2, CLK_10MHZ), devpriv->iobase1 + PCI224_ZCLK_SCE); - /* Load Z2-2 mode (2) and counter (div1). */ - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - i8254_write(timer_base, 0, 2, devpriv->cached_div1); /* Z2-0 is clocked from Z2-2's output. */ outb(CLK_CONFIG(0, CLK_OUTNM1), devpriv->iobase1 + PCI224_ZCLK_SCE); - /* Load Z2-0 mode (2) and counter (div2). */ - i8254_set_mode(timer_base, 0, 0, I8254_MODE2 | I8254_BINARY); - i8254_write(timer_base, 0, 0, devpriv->cached_div2); + + comedi_8254_pacer_enable(dev->pacer, 2, 0, false); } static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) @@ -855,7 +841,6 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->chanlist == NULL || cmd->chanlist_len == 0) return -EINVAL; - /* Determine which channels are enabled and their load order. */ devpriv->ao_enab = 0; @@ -893,8 +878,10 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outw(devpriv->daccon | PCI224_DACCON_FIFORESET, dev->iobase + PCI224_DACCON); - if (cmd->scan_begin_src == TRIG_TIMER) + if (cmd->scan_begin_src == TRIG_TIMER) { + comedi_8254_update_divisors(dev->pacer); pci224_ao_start_pacer(dev, s); + } spin_lock_irqsave(&devpriv->ao_spinlock, flags); if (cmd->start_src == TRIG_INT) { @@ -1063,6 +1050,11 @@ pci224_auto_attach(struct comedi_device *dev, unsigned long context_model) outw(devpriv->daccon | PCI224_DACCON_FIFORESET, dev->iobase + PCI224_DACCON); + dev->pacer = comedi_8254_init(devpriv->iobase1 + PCI224_Z2_BASE, + I8254_OSC_BASE_10MHZ, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); if (ret) return ret; -- cgit v1.2.3 From 96e5624411f99c532175df37c1d8ad8cd908e68a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:36 -0700 Subject: staging: comedi: cb_pcidas: convert driver to use the comedi_8254 module This driver uses two 8254 timers to generate the pacer clocks. One for analog input acquisition and one for analog output data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timers. Use the comedi_device 'pacer' member for the 8254 timer used for analog input. This data is freed automatically by the core during the detach of the driver. Store the data for the 8254 timer used for analog output in the private data. This data needs to be freed by the driver when it is detached. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/cb_pcidas.c | 86 ++++++++++++------------------ 2 files changed, 34 insertions(+), 53 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 98a62e34b7b6..c15cce4859fe 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -918,6 +918,7 @@ config COMEDI_CB_PCIDAS64 config COMEDI_CB_PCIDAS tristate "MeasurementComputing PCI-DAS support" + select COMEDI_8254 select COMEDI_8255 ---help--- Enable support for ComputerBoards/MeasurementComputing PCI-DAS with diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index dd0c65a5b5a0..b6ef4b47c673 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -68,7 +68,7 @@ analog triggering on 1602 series #include "../comedidev.h" -#include "8253.h" +#include "comedi_8254.h" #include "8255.h" #include "amcc_s5933.h" #include "comedi_fc.h" @@ -338,14 +338,12 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }; struct cb_pcidas_private { + struct comedi_8254 *ao_pacer; /* base addresses */ unsigned long s5933_config; unsigned long control_status; unsigned long adc_fifo; unsigned long ao_registers; - /* divisors of master clock for analog input pacing */ - unsigned int divisor1; - unsigned int divisor2; /* bits to write to registers */ unsigned int adc_fifo_bits; unsigned int s5933_intcsr_bits; @@ -353,9 +351,6 @@ struct cb_pcidas_private { /* fifo buffers */ unsigned short ai_buffer[AI_BUFFER_SIZE]; unsigned short ao_buffer[AO_BUFFER_SIZE]; - /* divisors of master clock for analog output pacing */ - unsigned int ao_divisor1; - unsigned int ao_divisor2; unsigned int calibration_source; }; @@ -778,7 +773,6 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { const struct cb_pcidas_board *thisboard = dev->board_ptr; - struct cb_pcidas_private *devpriv = dev->private; int err = 0; unsigned int arg; @@ -858,18 +852,12 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } @@ -886,18 +874,6 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, return 0; } -static void cb_pcidas_ai_load_counters(struct comedi_device *dev) -{ - struct cb_pcidas_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + ADC8254; - - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - - i8254_write(timer_base, 0, 1, devpriv->divisor1); - i8254_write(timer_base, 0, 2, devpriv->divisor2); -} - static int cb_pcidas_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -933,8 +909,11 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, outw(bits, devpriv->control_status + ADCMUX_CONT); /* load counters */ - if (cmd->scan_begin_src == TRIG_TIMER || cmd->convert_src == TRIG_TIMER) - cb_pcidas_ai_load_counters(dev); + if (cmd->scan_begin_src == TRIG_TIMER || + cmd->convert_src == TRIG_TIMER) { + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); + } /* enable interrupts */ spin_lock_irqsave(&dev->spinlock, flags); @@ -1004,7 +983,6 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, const struct cb_pcidas_board *thisboard = dev->board_ptr; struct cb_pcidas_private *devpriv = dev->private; int err = 0; - unsigned int arg; /* Step 1 : check if triggers are trivially valid */ @@ -1049,11 +1027,10 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ if (cmd->scan_begin_src == TRIG_TIMER) { - arg = cmd->scan_begin_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ, - &devpriv->ao_divisor1, - &devpriv->ao_divisor2, - &arg, cmd->flags); + unsigned int arg = cmd->scan_begin_arg; + + comedi_8254_cascade_ns_to_timer(devpriv->ao_pacer, + &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } @@ -1139,18 +1116,6 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, return 0; } -static void cb_pcidas_ao_load_counters(struct comedi_device *dev) -{ - struct cb_pcidas_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + DAC8254; - - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - - i8254_write(timer_base, 0, 1, devpriv->ao_divisor1); - i8254_write(timer_base, 0, 2, devpriv->ao_divisor2); -} - static int cb_pcidas_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -1180,8 +1145,10 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, outw(0, devpriv->ao_registers + DACFIFOCLR); /* load counters */ - if (cmd->scan_begin_src == TRIG_TIMER) - cb_pcidas_ao_load_counters(dev); + if (cmd->scan_begin_src == TRIG_TIMER) { + comedi_8254_update_divisors(devpriv->ao_pacer); + comedi_8254_pacer_enable(devpriv->ao_pacer, 1, 2, true); + } /* set pacer source */ spin_lock_irqsave(&dev->spinlock, flags); @@ -1408,6 +1375,17 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, } dev->irq = pcidev->irq; + dev->pacer = comedi_8254_init(dev->iobase + ADC8254, + I8254_OSC_BASE_10MHZ, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + + devpriv->ao_pacer = comedi_8254_init(dev->iobase + DAC8254, + I8254_OSC_BASE_10MHZ, + I8254_IO8, 0); + if (!devpriv->ao_pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 7); if (ret) return ret; @@ -1550,9 +1528,11 @@ static void cb_pcidas_detach(struct comedi_device *dev) { struct cb_pcidas_private *devpriv = dev->private; - if (devpriv && devpriv->s5933_config) { - outl(INTCSR_INBOX_INTR_STATUS, - devpriv->s5933_config + AMCC_OP_REG_INTCSR); + if (devpriv) { + if (devpriv->s5933_config) + outl(INTCSR_INBOX_INTR_STATUS, + devpriv->s5933_config + AMCC_OP_REG_INTCSR); + kfree(devpriv->ao_pacer); } comedi_pci_detach(dev); } -- cgit v1.2.3 From e4690dec50ebb886b33a62858d13266ee020e035 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:37 -0700 Subject: staging: comedi: das800: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data acquisition. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/das800.c | 38 +++++++++++---------------------- 2 files changed, 14 insertions(+), 25 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index c15cce4859fe..8de03c81d2a4 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -302,6 +302,7 @@ config COMEDI_DAS16 config COMEDI_DAS800 tristate "DAS800 and compatible ISA card support" + select COMEDI_8254 ---help--- Enable support for Keithley Metrabyte DAS800 and compatible ISA cards Keithley Metrabyte DAS-800, DAS-801, DAS-802 diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index ff7f4be3f314..50ca03bd6459 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -58,12 +58,12 @@ cmd triggers supported: #include #include -#include "../comedidev.h" - #include -#include "8253.h" +#include "../comedidev.h" + #include "comedi_fc.h" +#include "comedi_8254.h" #define N_CHAN_AI 8 /* number of analog input channels */ @@ -219,8 +219,6 @@ static const struct das800_board das800_boards[] = { }; struct das800_private { - unsigned int divisor1; /* counter 1 value for timed conversions */ - unsigned int divisor2; /* counter 2 value for timed conversions */ unsigned int do_bits; /* digital output bits */ }; @@ -272,17 +270,6 @@ static void das800_disable(struct comedi_device *dev) spin_unlock_irqrestore(&dev->spinlock, irq_flags); } -static void das800_set_frequency(struct comedi_device *dev) -{ - struct das800_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + DAS800_8254; - - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - i8254_write(timer_base, 0, 1, devpriv->divisor1); - i8254_write(timer_base, 0, 2, devpriv->divisor2); -} - static int das800_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { das800_disable(dev); @@ -322,9 +309,7 @@ static int das800_ai_do_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { const struct das800_board *thisboard = dev->board_ptr; - struct das800_private *devpriv = dev->private; int err = 0; - unsigned int arg; /* Step 1 : check if triggers are trivially valid */ @@ -370,11 +355,9 @@ static int das800_ai_do_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { - arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_1MHZ, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + unsigned int arg = cmd->convert_arg; + + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } @@ -426,8 +409,8 @@ static int das800_ai_do_cmd(struct comedi_device *dev, conv_bits |= DTEN; if (cmd->convert_src == TRIG_TIMER) { conv_bits |= CASC | ITE; - /* set conversion frequency */ - das800_set_frequency(dev); + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); } spin_lock_irqsave(&dev->spinlock, irq_flags); @@ -697,6 +680,11 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->irq = irq; } + dev->pacer = comedi_8254_init(dev->iobase + DAS800_8254, + I8254_OSC_BASE_1MHZ, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); if (ret) return ret; -- cgit v1.2.3 From eb9bb1f5a84a1fcbfa213687d2d4bd4843e3be9f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:38 -0700 Subject: staging: comedi: das16m1: convert driver to use the comedi_8254 module This driver uses two 8254 timers. One to generate the analog input pacer clock and one to count the number of samples. Convert it to use the comedi_8254 module to provide support for the 8254 timers. Use the comedi_device 'pacer' member for the 8254 timer used for analog input. This data is freed automatically by the core during the detach of the driver. Store the data for the 8254 timer used to count samples in the private data. This data needs to be freed by the driver when it is detached. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/das16m1.c | 79 ++++++++++++++++---------------- 2 files changed, 40 insertions(+), 40 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 8de03c81d2a4..9b7a0d7b6bd7 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -263,6 +263,7 @@ config COMEDI_DAC02 config COMEDI_DAS16M1 tristate "MeasurementComputing CIO-DAS16/M1DAS-16 ISA card support" + select COMEDI_8254 select COMEDI_8255 ---help--- Enable support for Measurement Computing CIO-DAS16/M1 ISA cards. diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index 3666a68979fb..219746bc7641 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -53,11 +53,12 @@ irq can be omitted, although the cmd interface will not work without it. */ #include +#include #include #include "../comedidev.h" #include "8255.h" -#include "8253.h" +#include "comedi_8254.h" #include "comedi_fc.h" #define DAS16M1_SIZE2 8 @@ -103,8 +104,6 @@ irq can be omitted, although the cmd interface will not work without it. #define Q_RANGE(x) (((x) & 0xf) << 4) #define UNIPOLAR 0x40 #define DAS16M1_8254_FIRST 0x8 -#define DAS16M1_8254_FIRST_CNTRL 0xb -#define TOTAL_CLEAR 0x30 #define DAS16M1_8254_SECOND 0xc #define DAS16M1_82C55 0x400 #define DAS16M1_8254_THIRD 0x404 @@ -124,6 +123,7 @@ static const struct comedi_lrange range_das16m1 = { }; struct das16m1_private_struct { + struct comedi_8254 *counter; unsigned int control_state; unsigned int adc_count; /* number of samples completed */ /* initial value in lower half of hardware conversion counter, @@ -131,8 +131,6 @@ struct das16m1_private_struct { * counter yet (loaded by first sample conversion) */ u16 initial_hw_count; unsigned short ai_buffer[FIFO_SIZE]; - unsigned int divisor1; /* divides master clock to obtain conversion speed */ - unsigned int divisor2; /* divides master clock to obtain conversion speed */ unsigned long extra_iobase; }; @@ -180,9 +178,7 @@ static int das16m1_ai_check_chanlist(struct comedi_device *dev, static int das16m1_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - struct das16m1_private_struct *devpriv = dev->private; int err = 0; - unsigned int arg; /* Step 1 : check if triggers are trivially valid */ @@ -229,11 +225,9 @@ static int das16m1_cmd_test(struct comedi_device *dev, /* step 4: fix up arguments */ if (cmd->convert_src == TRIG_TIMER) { - arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + unsigned int arg = cmd->convert_arg; + + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } @@ -250,25 +244,12 @@ static int das16m1_cmd_test(struct comedi_device *dev, return 0; } -static void das16m1_set_pacer(struct comedi_device *dev) -{ - struct das16m1_private_struct *devpriv = dev->private; - unsigned long timer_base = dev->iobase + DAS16M1_8254_SECOND; - - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - - i8254_write(timer_base, 0, 1, devpriv->divisor1); - i8254_write(timer_base, 0, 2, devpriv->divisor2); -} - static int das16m1_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) { struct das16m1_private_struct *devpriv = dev->private; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; - unsigned long timer_base = dev->iobase + DAS16M1_8254_FIRST; unsigned int byte, i; /* disable interrupts and internal pacer */ @@ -277,14 +258,21 @@ static int das16m1_cmd_exec(struct comedi_device *dev, /* set software count */ devpriv->adc_count = 0; - /* Initialize lower half of hardware counter, used to determine how + + /* + * Initialize lower half of hardware counter, used to determine how * many samples are in fifo. Value doesn't actually load into counter - * until counter's next clock (the next a/d conversion) */ - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - i8254_write(timer_base, 0, 1, 0); - /* remember current reading of counter so we know when counter has - * actually been loaded */ - devpriv->initial_hw_count = i8254_read(timer_base, 0, 1); + * until counter's next clock (the next a/d conversion). + */ + comedi_8254_set_mode(devpriv->counter, 1, I8254_MODE2 | I8254_BINARY); + comedi_8254_write(devpriv->counter, 1, 0); + + /* + * Remember current reading of counter so we know when counter has + * actually been loaded. + */ + devpriv->initial_hw_count = comedi_8254_read(devpriv->counter, 1); + /* setup channel/gain queue */ for (i = 0; i < cmd->chanlist_len; i++) { outb(i, dev->iobase + DAS16M1_QUEUE_ADDR); @@ -297,7 +285,8 @@ static int das16m1_cmd_exec(struct comedi_device *dev, /* enable interrupts and set internal pacer counter mode and counts */ devpriv->control_state &= ~PACER_MASK; if (cmd->convert_src == TRIG_TIMER) { - das16m1_set_pacer(dev); + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); devpriv->control_state |= INT_PACER; } else { /* TRIG_EXT */ devpriv->control_state |= EXT_PACER; @@ -417,8 +406,8 @@ static void das16m1_handler(struct comedi_device *dev, unsigned int status) async = s->async; cmd = &async->cmd; - /* figure out how many samples are in fifo */ - hw_counter = i8254_read(dev->iobase + DAS16M1_8254_FIRST, 0, 1); + /* figure out how many samples are in fifo */ + hw_counter = comedi_8254_read(devpriv->counter, 1); /* make sure hardware counter reading is not bogus due to initial value * not having been loaded yet */ if (devpriv->adc_count == 0 && hw_counter == devpriv->initial_hw_count) { @@ -563,6 +552,16 @@ static int das16m1_attach(struct comedi_device *dev, dev->irq = it->options[1]; } + dev->pacer = comedi_8254_init(dev->iobase + DAS16M1_8254_SECOND, + I8254_OSC_BASE_10MHZ, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + + devpriv->counter = comedi_8254_init(dev->iobase + DAS16M1_8254_FIRST, + 0, I8254_IO8, 0); + if (!devpriv->counter) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; @@ -609,9 +608,6 @@ static int das16m1_attach(struct comedi_device *dev, if (ret) return ret; - /* disable upper half of hardware conversion counter so it doesn't mess with us */ - outb(TOTAL_CLEAR, dev->iobase + DAS16M1_8254_FIRST_CNTRL); - /* initialize digital output lines */ outb(0, dev->iobase + DAS16M1_DIO); @@ -626,8 +622,11 @@ static void das16m1_detach(struct comedi_device *dev) { struct das16m1_private_struct *devpriv = dev->private; - if (devpriv && devpriv->extra_iobase) - release_region(devpriv->extra_iobase, DAS16M1_SIZE2); + if (devpriv) { + if (devpriv->extra_iobase) + release_region(devpriv->extra_iobase, DAS16M1_SIZE2); + kfree(devpriv->counter); + } comedi_legacy_detach(dev); } -- cgit v1.2.3 From a90feb7fd095863780fe550da71afaa7f03adc65 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:39 -0700 Subject: staging: comedi: cb_das16_cs: convert driver to use the comedi_8254 module The hardware supported by this drive has an 8254 timer. Currently this driver does not use the timer functions. For aesthetics, use the comedi_8254 module to provide support for the 8254 timer. This will ensure that the counters are all reset and make it easier to add functionality later. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/cb_das16_cs.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 9b7a0d7b6bd7..85c5c876e65d 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1100,6 +1100,7 @@ if COMEDI_PCMCIA_DRIVERS config COMEDI_CB_DAS16_CS tristate "CB DAS16 series PCMCIA support" + select COMEDI_8254 ---help--- Enable support for the ComputerBoards/MeasurementComputing PCMCIA cards DAS16/16, PCM-DAS16D/12 and PCM-DAS16s/16 diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 1079b6c72b15..9c7242d81963 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -41,16 +41,13 @@ Status: experimental #include "../comedi_pcmcia.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" #define DAS16CS_ADC_DATA 0 #define DAS16CS_DIO_MUX 2 #define DAS16CS_MISC1 4 #define DAS16CS_MISC2 6 -#define DAS16CS_CTR0 8 -#define DAS16CS_CTR1 10 -#define DAS16CS_CTR2 12 -#define DAS16CS_CTR_CONTROL 14 +#define DAS16CS_TIMER_BASE 8 #define DAS16CS_DIO 16 struct das16cs_board { @@ -279,6 +276,11 @@ static int das16cs_auto_attach(struct comedi_device *dev, if (!devpriv) return -ENOMEM; + dev->pacer = comedi_8254_init(dev->iobase + DAS16CS_TIMER_BASE, + I8254_OSC_BASE_10MHZ, I8254_IO16, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 3); if (ret) return ret; -- cgit v1.2.3 From 48a4f2226699e1df76efa732e6903ca6b2fa2aaf Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:40 -0700 Subject: staging: comedi: adv_pci1710: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data acquisition. It also provides a comedi_subdevice to allow the user to use channel 0 of the 8254 timer. Currently the subdevice support does not work correctly due to and (*insn_config) that does not follow the comedi API. Convert it to use the comedi_8254 module to provide support for the 8254 timer and proper support for the subdevice. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/adv_pci1710.c | 206 ++++++++------------------- 2 files changed, 61 insertions(+), 146 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 85c5c876e65d..6d469e0d7095 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -739,6 +739,7 @@ config COMEDI_ADL_PCI9118 config COMEDI_ADV_PCI1710 tristate "Advantech PCI-171x, PCI-1720 and PCI-1731 support" + select COMEDI_8254 ---help--- Enable support for Advantech PCI-1710, PCI-1710HG, PCI-1711, PCI-1713, PCI-1720 and PCI-1731 diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 9800c01e6fb9..9c881ff01297 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -48,7 +48,7 @@ Configuration options: #include "../comedidev.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" #include "amcc_s5933.h" #define PCI171x_AD_DATA 0 /* R: A/D data */ @@ -67,11 +67,6 @@ Configuration options: #define PCI171X_TIMER_BASE 0x18 -#define PCI171x_CNT0 24 /* R/W: 8254 counter 0 */ -#define PCI171x_CNT1 26 /* R/W: 8254 counter 1 */ -#define PCI171x_CNT2 28 /* R/W: 8254 counter 2 */ -#define PCI171x_CNTCTRL 30 /* W: 8254 counter control */ - /* upper bits from status register (PCI171x_STATUS) (lower is same with control * reg) */ #define Status_FE 0x0100 /* 1=FIFO is empty */ @@ -87,16 +82,6 @@ Configuration options: #define Control_EXT 0x0004 /* 1=external trigger source */ #define Control_PACER 0x0002 /* 1=enable internal 8254 trigger source */ #define Control_SW 0x0001 /* 1=enable software trigger source */ -/* bits from counter control register (PCI171x_CNTCTRL) */ -#define Counter_BCD 0x0001 /* 0 = binary counter, 1 = BCD counter */ -#define Counter_M0 0x0002 /* M0-M2 select modes 0-5 */ -#define Counter_M1 0x0004 /* 000 = mode 0, 010 = mode 2 ... */ -#define Counter_M2 0x0008 -#define Counter_RW0 0x0010 /* RW0/RW1 select read/write mode */ -#define Counter_RW1 0x0020 -#define Counter_SC0 0x0040 /* Select Counter. Only 00 or 11 may */ -#define Counter_SC1 0x0080 /* be used, 00 for CNT0, - * 11 for read-back command */ #define PCI1720_DA0 0 /* W: D/A register 0 */ #define PCI1720_DA1 2 /* W: D/A register 1 */ @@ -265,15 +250,9 @@ struct pci1710_private { unsigned char ai_et; unsigned int ai_et_CntrlReg; unsigned int ai_et_MuxVal; - unsigned int next_divisor1; - unsigned int next_divisor2; - unsigned int divisor1; - unsigned int divisor2; unsigned int act_chanlist[32]; /* list of scanned channel */ unsigned char saved_seglen; /* len of the non-repeating chanlist */ unsigned char da_ranges; /* copy of D/A outpit range register */ - unsigned int cnt0_write_wait; /* after a write, wait for update of the - * internal state */ }; static int pci171x_ai_check_chanlist(struct comedi_device *dev, @@ -509,105 +488,6 @@ static int pci171x_do_insn_bits(struct comedi_device *dev, return insn->n; } -static void pci171x_start_pacer(struct comedi_device *dev, - bool load_counters) -{ - struct pci1710_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + PCI171X_TIMER_BASE; - - i8254_set_mode(timer_base, 1, 2, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 1, 1, I8254_MODE2 | I8254_BINARY); - - if (load_counters) { - i8254_write(timer_base, 1, 2, devpriv->divisor2); - i8254_write(timer_base, 1, 1, devpriv->divisor1); - } -} - -static int pci171x_counter_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - unsigned int msb, lsb, ccntrl; - int i; - - ccntrl = 0xD2; /* count only */ - for (i = 0; i < insn->n; i++) { - outw(ccntrl, dev->iobase + PCI171x_CNTCTRL); - - lsb = inw(dev->iobase + PCI171x_CNT0) & 0xFF; - msb = inw(dev->iobase + PCI171x_CNT0) & 0xFF; - - data[0] = lsb | (msb << 8); - } - - return insn->n; -} - -static int pci171x_counter_insn_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - struct pci1710_private *devpriv = dev->private; - uint msb, lsb, ccntrl, status; - - lsb = data[0] & 0x00FF; - msb = (data[0] & 0xFF00) >> 8; - - /* write lsb, then msb */ - outw(lsb, dev->iobase + PCI171x_CNT0); - outw(msb, dev->iobase + PCI171x_CNT0); - - if (devpriv->cnt0_write_wait) { - /* wait for the new count to be loaded */ - ccntrl = 0xE2; - do { - outw(ccntrl, dev->iobase + PCI171x_CNTCTRL); - status = inw(dev->iobase + PCI171x_CNT0) & 0xFF; - } while (status & 0x40); - } - - return insn->n; -} - -static int pci171x_counter_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ -#ifdef unused - /* This doesn't work like a normal Comedi counter config */ - struct pci1710_private *devpriv = dev->private; - uint ccntrl = 0; - - devpriv->cnt0_write_wait = data[0] & 0x20; - - /* internal or external clock? */ - if (!(data[0] & 0x10)) { /* internal */ - devpriv->CntrlReg &= ~Control_CNT0; - } else { - devpriv->CntrlReg |= Control_CNT0; - } - outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); - - if (data[0] & 0x01) - ccntrl |= Counter_M0; - if (data[0] & 0x02) - ccntrl |= Counter_M1; - if (data[0] & 0x04) - ccntrl |= Counter_M2; - if (data[0] & 0x08) - ccntrl |= Counter_BCD; - ccntrl |= Counter_RW0; /* set read/write mode */ - ccntrl |= Counter_RW1; - outw(ccntrl, dev->iobase + PCI171x_CNTCTRL); -#endif - - return 1; -} - static int pci1720_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -647,7 +527,7 @@ static int pci171x_ai_cancel(struct comedi_device *dev, devpriv->CntrlReg |= Control_SW; /* reset any operations */ outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); - pci171x_start_pacer(dev, false); + comedi_8254_pacer_enable(dev->pacer, 1, 2, false); outb(0, dev->iobase + PCI171x_CLRFIFO); outb(0, dev->iobase + PCI171x_CLRINT); @@ -768,7 +648,7 @@ static irqreturn_t interrupt_service_pci1710(int irq, void *d) outb(0, dev->iobase + PCI171x_CLRINT); outw(devpriv->ai_et_MuxVal, dev->iobase + PCI171x_MUX); outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); - pci171x_start_pacer(dev, true); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); return IRQ_HANDLED; } @@ -787,8 +667,6 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) struct pci1710_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; - pci171x_start_pacer(dev, false); - pci171x_ai_setup_chanlist(dev, s, cmd->chanlist, cmd->chanlist_len, devpriv->saved_seglen); @@ -799,10 +677,9 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if ((cmd->flags & CMDF_WAKE_EOS) == 0) devpriv->CntrlReg |= Control_ONEFH; - devpriv->divisor1 = devpriv->next_divisor1; - devpriv->divisor2 = devpriv->next_divisor2; - if (cmd->convert_src == TRIG_TIMER) { + comedi_8254_update_divisors(dev->pacer); + devpriv->CntrlReg |= Control_PACER | Control_IRQEN; if (cmd->start_src == TRIG_EXT) { devpriv->ai_et_CntrlReg = devpriv->CntrlReg; @@ -816,7 +693,7 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); if (cmd->start_src == TRIG_NOW) - pci171x_start_pacer(dev, true); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); } else { /* TRIG_EXT */ devpriv->CntrlReg |= Control_EXT | Control_IRQEN; outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); @@ -829,9 +706,7 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - struct pci1710_private *devpriv = dev->private; int err = 0; - unsigned int arg; /* Step 1 : check if triggers are trivially valid */ @@ -878,11 +753,9 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { - arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ, - &devpriv->next_divisor1, - &devpriv->next_divisor2, - &arg, cmd->flags); + unsigned int arg = cmd->convert_arg; + + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } @@ -899,19 +772,54 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, return 0; } +static int pci171x_insn_counter_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct pci1710_private *devpriv = dev->private; + + switch (data[0]) { + case INSN_CONFIG_SET_CLOCK_SRC: + switch (data[1]) { + case 0: /* internal */ + devpriv->ai_et_CntrlReg &= ~Control_CNT0; + break; + case 1: /* external */ + devpriv->ai_et_CntrlReg |= Control_CNT0; + break; + default: + return -EINVAL; + } + outw(devpriv->ai_et_CntrlReg, dev->iobase + PCI171x_CONTROL); + break; + case INSN_CONFIG_GET_CLOCK_SRC: + if (devpriv->ai_et_CntrlReg & Control_CNT0) { + data[1] = 1; + data[2] = 0; + } else { + data[1] = 0; + data[2] = I8254_OSC_BASE_10MHZ; + } + break; + default: + return -EINVAL; + } + + return insn->n; +} + static int pci171x_reset(struct comedi_device *dev) { const struct boardtype *board = dev->board_ptr; struct pci1710_private *devpriv = dev->private; - outw(0x30, dev->iobase + PCI171x_CNTCTRL); /* Software trigger, CNT0=external */ devpriv->CntrlReg = Control_SW | Control_CNT0; /* reset any operations */ outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); outb(0, dev->iobase + PCI171x_CLRFIFO); /* clear FIFO */ outb(0, dev->iobase + PCI171x_CLRINT); /* clear INT request */ - pci171x_start_pacer(dev, false); devpriv->da_ranges = 0; if (board->has_ao) { /* set DACs to 0..5V */ @@ -978,6 +886,11 @@ static int pci1710_auto_attach(struct comedi_device *dev, return ret; dev->iobase = pci_resource_start(pcidev, 2); + dev->pacer = comedi_8254_init(dev->iobase + PCI171X_TIMER_BASE, + I8254_OSC_BASE_10MHZ, I8254_IO16, 0); + if (!dev->pacer) + return -ENOMEM; + n_subdevices = 0; if (board->n_aichan) n_subdevices++; @@ -1074,16 +987,17 @@ static int pci1710_auto_attach(struct comedi_device *dev, subdev++; } + /* Counter subdevice (8254) */ if (board->has_counter) { s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 1; - s->maxdata = 0xffff; - s->range_table = &range_unknown; - s->insn_read = pci171x_counter_insn_read; - s->insn_write = pci171x_counter_insn_write; - s->insn_config = pci171x_counter_insn_config; + comedi_8254_subdevice_init(s, dev->pacer); + + dev->pacer->insn_config = pci171x_insn_counter_config; + + /* counters 1 and 2 are used internally for the pacer */ + comedi_8254_set_busy(dev->pacer, 1, true); + comedi_8254_set_busy(dev->pacer, 2, true); + subdev++; } -- cgit v1.2.3 From 25182d27513d541bfd32163982e80457b3ee1cd0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:41 -0700 Subject: staging: comedi: amplc_pci230: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/amplc_pci230.c | 47 ++++++++++++--------------- 2 files changed, 21 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 6d469e0d7095..f63626fd4c19 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -816,6 +816,7 @@ config COMEDI_AMPLC_PCI224 config COMEDI_AMPLC_PCI230 tristate "Amplicon PCI230 and PCI260 support" + select COMEDI_8254 select COMEDI_8255 ---help--- Enable support for Amplicon PCI230 and PCI260 Multifunction I/O diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 49806a5e514c..a977156ca468 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -188,7 +188,7 @@ #include "../comedidev.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" #include "8255.h" /* @@ -206,10 +206,6 @@ #define PCI230_PPI_X_C 0x02 /* User PPI (82C55) port C */ #define PCI230_PPI_X_CMD 0x03 /* User PPI (82C55) control word */ #define PCI230_Z2_CT_BASE 0x14 /* 82C54 counter/timer base */ -#define PCI230_Z2_CT0 0x14 /* 82C54 counter/timer 0 */ -#define PCI230_Z2_CT1 0x15 /* 82C54 counter/timer 1 */ -#define PCI230_Z2_CT2 0x16 /* 82C54 counter/timer 2 */ -#define PCI230_Z2_CTC 0x17 /* 82C54 counter/timer control word */ #define PCI230_ZCLK_SCE 0x1A /* Group Z Clock Configuration */ #define PCI230_ZGAT_SCE 0x1D /* Group Z Gate Configuration */ #define PCI230_INT_SCE 0x1E /* Interrupt source mask (w) */ @@ -377,12 +373,6 @@ #define CLK_EXT 7 /* external clock */ /* Macro to construct clock input configuration register value. */ #define CLK_CONFIG(chan, src) ((((chan) & 3) << 3) | ((src) & 7)) -/* Timebases in ns. */ -#define TIMEBASE_10MHZ 100 -#define TIMEBASE_1MHZ 1000 -#define TIMEBASE_100KHZ 10000 -#define TIMEBASE_10KHZ 100000 -#define TIMEBASE_1KHZ 1000000 /* * Counter/timer gate input configuration sources. @@ -507,11 +497,11 @@ struct pci230_private { /* PCI230 clock source periods in ns */ static const unsigned int pci230_timebase[8] = { - [CLK_10MHZ] = TIMEBASE_10MHZ, - [CLK_1MHZ] = TIMEBASE_1MHZ, - [CLK_100KHZ] = TIMEBASE_100KHZ, - [CLK_10KHZ] = TIMEBASE_10KHZ, - [CLK_1KHZ] = TIMEBASE_1KHZ, + [CLK_10MHZ] = I8254_OSC_BASE_10MHZ, + [CLK_1MHZ] = I8254_OSC_BASE_1MHZ, + [CLK_100KHZ] = I8254_OSC_BASE_100KHZ, + [CLK_10KHZ] = I8254_OSC_BASE_10KHZ, + [CLK_1KHZ] = I8254_OSC_BASE_1KHZ, }; /* PCI230 analogue input range table */ @@ -695,7 +685,7 @@ static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, unsigned int count; /* Set mode. */ - i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, ct, mode); + comedi_8254_set_mode(dev->pacer, ct, mode); /* Determine clock source and count. */ clk_src = pci230_choose_clk_count(ns, &count, flags); /* Program clock source. */ @@ -704,13 +694,13 @@ static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, if (count >= 65536) count = 0; - i8254_write(dev->iobase + PCI230_Z2_CT_BASE, 0, ct, count); + comedi_8254_write(dev->pacer, ct, count); } static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct) { - i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, ct, I8254_MODE1); /* Counter ct, 8254 mode 1, initial count not written. */ + comedi_8254_set_mode(dev->pacer, ct, I8254_MODE1); } static int pci230_ai_eoc(struct comedi_device *dev, @@ -760,7 +750,7 @@ static int pci230_ai_insn_read(struct comedi_device *dev, */ adccon = PCI230_ADC_TRIG_Z2CT2 | PCI230_ADC_FIFO_EN; /* Set Z2-CT2 output low to avoid any false triggers. */ - i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, 2, I8254_MODE0); + comedi_8254_set_mode(dev->pacer, 2, I8254_MODE0); devpriv->ai_bipolar = comedi_range_is_bipolar(s, range); if (aref == AREF_DIFF) { /* Differential. */ @@ -811,10 +801,8 @@ static int pci230_ai_insn_read(struct comedi_device *dev, * Trigger conversion by toggling Z2-CT2 output * (finish with output high). */ - i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, - 2, I8254_MODE0); - i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, - 2, I8254_MODE1); + comedi_8254_set_mode(dev->pacer, 2, I8254_MODE0); + comedi_8254_set_mode(dev->pacer, 2, I8254_MODE1); /* wait for conversion to end */ ret = comedi_timeout(dev, s, insn, pci230_ai_eoc, 0); @@ -1767,8 +1755,8 @@ static int pci230_ai_inttrig_convert(struct comedi_device *dev, * Trigger conversion by toggling Z2-CT2 output. * Finish with output high. */ - i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, 2, I8254_MODE0); - i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, 2, I8254_MODE1); + comedi_8254_set_mode(dev->pacer, 2, I8254_MODE0); + comedi_8254_set_mode(dev->pacer, 2, I8254_MODE1); /* * Delay. Should driver be responsible for this? An * alternative would be to wait until conversion is complete, @@ -2189,7 +2177,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) * Set counter/timer 2 output high for use as the initial start * conversion source. */ - i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, 2, I8254_MODE1); + comedi_8254_set_mode(dev->pacer, 2, I8254_MODE1); /* * Temporarily use CT2 output as conversion trigger source and @@ -2481,6 +2469,11 @@ static int pci230_auto_attach(struct comedi_device *dev, dev->irq = pci_dev->irq; } + dev->pacer = comedi_8254_init(dev->iobase + PCI230_Z2_CT_BASE, + 0, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + rc = comedi_alloc_subdevices(dev, 3); if (rc) return rc; -- cgit v1.2.3 From 9a16a017e1392663c3dfe0336b1477cd6cbc768c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:42 -0700 Subject: staging: comedi: das08: convert driver to use the comedi_8254 module Some of the hardware supported by this driver include an 8254 timer that is exposed to the user as a comedi_subdevice. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/das08.c | 77 +++++----------------------------- 2 files changed, 11 insertions(+), 67 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index f63626fd4c19..8d636ec11c14 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1275,6 +1275,7 @@ config COMEDI_AMPLC_PC236 config COMEDI_DAS08 tristate + select COMEDI_8254 select COMEDI_8255 config COMEDI_ISADMA diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index c78c0df9bbe3..ecd363901922 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -23,7 +23,7 @@ #include "../comedidev.h" #include "8255.h" -#include "8253.h" +#include "comedi_8254.h" #include "das08.h" /* @@ -359,62 +359,6 @@ static int das08_ao_insn_write(struct comedi_device *dev, return insn->n; } -static void i8254_initialize(struct comedi_device *dev) -{ - const struct das08_board_struct *thisboard = dev->board_ptr; - unsigned long i8254_iobase = dev->iobase + thisboard->i8254_offset; - unsigned int mode = I8254_MODE0 | I8254_BINARY; - int i; - - for (i = 0; i < 3; ++i) - i8254_set_mode(i8254_iobase, 0, i, mode); -} - -static int das08_counter_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - const struct das08_board_struct *thisboard = dev->board_ptr; - unsigned long i8254_iobase = dev->iobase + thisboard->i8254_offset; - int chan = insn->chanspec; - - data[0] = i8254_read(i8254_iobase, 0, chan); - return 1; -} - -static int das08_counter_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - const struct das08_board_struct *thisboard = dev->board_ptr; - unsigned long i8254_iobase = dev->iobase + thisboard->i8254_offset; - int chan = insn->chanspec; - - i8254_write(i8254_iobase, 0, chan, data[0]); - return 1; -} - -static int das08_counter_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - const struct das08_board_struct *thisboard = dev->board_ptr; - unsigned long i8254_iobase = dev->iobase + thisboard->i8254_offset; - int chan = insn->chanspec; - - switch (data[0]) { - case INSN_CONFIG_SET_COUNTER_MODE: - i8254_set_mode(i8254_iobase, 0, chan, data[1]); - break; - case INSN_CONFIG_8254_READ_STATUS: - data[1] = i8254_status(i8254_iobase, 0, chan); - break; - default: - return -EINVAL; - } - return 2; -} - int das08_common_attach(struct comedi_device *dev, unsigned long iobase) { const struct das08_board_struct *thisboard = dev->board_ptr; @@ -511,17 +455,16 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) s->type = COMEDI_SUBD_UNUSED; } + /* Counter subdevice (8254) */ s = &dev->subdevices[5]; - /* 8254 */ - if (thisboard->i8254_offset != 0) { - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 3; - s->maxdata = 0xFFFF; - s->insn_read = das08_counter_read; - s->insn_write = das08_counter_write; - s->insn_config = das08_counter_config; - i8254_initialize(dev); + if (thisboard->i8254_offset) { + dev->pacer = comedi_8254_init(dev->iobase + + thisboard->i8254_offset, + 0, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + + comedi_8254_subdevice_init(s, dev->pacer); } else { s->type = COMEDI_SUBD_UNUSED; } -- cgit v1.2.3 From af5a97344f2bfecf8421a56129d799ce5cb06754 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:43 -0700 Subject: staging: comedi: ni_at_ao: convert driver to use the comedi_8254 module The hardware supported by this driver includes an 8254 timer. This timer is not currently used, other than setting counters 1 and 2 to MODE4 to ensure that the outputs are high. For aesthetics, convert it to use the comedi_8254 module to provide support for the 8254 timer. This will make it easier to add features later. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/ni_at_ao.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 8d636ec11c14..20a906d49c42 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -477,6 +477,7 @@ config COMEDI_NI_AT_A2150 config COMEDI_NI_AT_AO tristate "NI AT-AO-6/10 EISA card support" + select COMEDI_8254 ---help--- Enable support for National Instruments AT-AO-6/10 cards diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index 9eeaf3c5a858..f27aa0e82234 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -37,7 +37,7 @@ #include "../comedidev.h" -#include "8253.h" +#include "comedi_8254.h" /* * Register map @@ -274,7 +274,6 @@ static int atao_calib_insn_write(struct comedi_device *dev, static void atao_reset(struct comedi_device *dev) { struct atao_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + ATAO_82C53_BASE; /* This is the reset sequence described in the manual */ @@ -282,9 +281,9 @@ static void atao_reset(struct comedi_device *dev) outw(devpriv->cfg1, dev->iobase + ATAO_CFG1_REG); /* Put outputs of counter 1 and counter 2 in a high state */ - i8254_set_mode(timer_base, 0, 0, I8254_MODE4 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 1, I8254_MODE4 | I8254_BINARY); - i8254_write(timer_base, 0, 0, 0x0003); + comedi_8254_set_mode(dev->pacer, 0, I8254_MODE4 | I8254_BINARY); + comedi_8254_set_mode(dev->pacer, 1, I8254_MODE4 | I8254_BINARY); + comedi_8254_write(dev->pacer, 0, 0x0003); outw(ATAO_CFG2_CALLD_NOP, dev->iobase + ATAO_CFG2_REG); @@ -315,6 +314,11 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!devpriv) return -ENOMEM; + dev->pacer = comedi_8254_init(dev->iobase + ATAO_82C53_BASE, + 0, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; -- cgit v1.2.3 From e875132a3a6d5dce0211f69ac5ad5ba6356b5180 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:44 -0700 Subject: staging: comedi: ni_at_a2150: convert driver to use the comedi_8254 module The hardware supported by this driver includes an 8254 timer. For aesthetics, convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/ni_at_a2150.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 20a906d49c42..b90b8a88273d 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -469,6 +469,7 @@ config COMEDI_ADQ12B config COMEDI_NI_AT_A2150 tristate "NI AT-A2150 ISA card support" select COMEDI_ISADMA if ISA_DMA_API + select COMEDI_8254 ---help--- Enable support for National Instruments AT-A2150 cards diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c index a1ce0b0b8c41..66c0e65a953a 100644 --- a/drivers/staging/comedi/drivers/ni_at_a2150.c +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c @@ -68,7 +68,7 @@ TRIG_WAKE_EOS #include "comedi_isadma.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" #define A2150_DMA_BUFFER_SIZE 0xff00 /* size in bytes of dma buffer */ @@ -110,8 +110,6 @@ TRIG_WAKE_EOS #define DMA_INTR_EN_BIT 0x800 /* enable interrupt on dma terminal count */ #define DMA_DEM_EN_BIT 0x1000 /* enables demand mode dma */ #define I8253_BASE_REG 0x14 -#define I8253_MODE_REG 0x17 -#define HW_COUNT_DISABLE 0x30 /* disable hardware counting of conversions */ struct a2150_board { const char *name; @@ -488,7 +486,6 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) struct comedi_isadma_desc *desc = &dma->desc[0]; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; - unsigned long timer_base = dev->iobase + I8253_BASE_REG; unsigned int old_config_bits = devpriv->config_bits; unsigned int trigger_bits; @@ -547,8 +544,7 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG); /* may need to wait 72 sampling periods if timing was changed */ - i8254_set_mode(timer_base, 0, 2, I8254_MODE0 | I8254_BINARY); - i8254_write(timer_base, 0, 2, 72); + comedi_8254_load(dev->pacer, 2, 72, I8254_MODE0 | I8254_BINARY); /* setup start triggering */ trigger_bits = 0; @@ -726,6 +722,11 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* an IRQ and DMA are required to support async commands */ a2150_alloc_irq_and_dma(dev, it); + dev->pacer = comedi_8254_init(dev->iobase + I8253_BASE_REG, + 0, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); if (ret) return ret; @@ -747,10 +748,6 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->cancel = a2150_cancel; } - /* need to do this for software counting of completed conversions, to - * prevent hardware count from stopping acquisition */ - outw(HW_COUNT_DISABLE, dev->iobase + I8253_MODE_REG); - /* set card's irq and dma levels */ outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG); -- cgit v1.2.3 From ad4808b690d1e0c0283ab6ce04d25e2a788c5f57 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:45 -0700 Subject: staging: comedi: das6402: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Remove the unnecessary programming of timer 0. The private data 'count' value is never set by the driver and the timer is reset to MODE0 when the timers are initialized during the attach of the driver. Remove the unnecessart convert_src check in the (*do_cmdtest). The only valid convert_src is TRIG_TIMER. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/das6402.c | 51 ++++++++------------------------ 2 files changed, 13 insertions(+), 39 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index b90b8a88273d..fbff2fa31778 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -329,6 +329,7 @@ config COMEDI_DAS1800 config COMEDI_DAS6402 tristate "DAS6402 and compatible ISA card support" + select COMEDI_8254 ---help--- Enable support for DAS6402 and compatible ISA cards Computerboards, Keithley Metrabyte DAS6402 and compatibles diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c index b8755b50a11e..3aa6b13894bf 100644 --- a/drivers/staging/comedi/drivers/das6402.c +++ b/drivers/staging/comedi/drivers/das6402.c @@ -35,8 +35,9 @@ #include #include "../comedidev.h" + #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" /* * Register I/O map @@ -138,11 +139,6 @@ static struct das6402_boardinfo das6402_boards[] = { struct das6402_private { unsigned int irq; - - unsigned int count; - unsigned int divider1; - unsigned int divider2; - unsigned int ao_range; }; @@ -172,27 +168,6 @@ static void das6402_ai_clear_eoc(struct comedi_device *dev) outb(DAS6402_STATUS_W_CLRINT, dev->iobase + DAS6402_STATUS_REG); } -static void das6402_enable_counter(struct comedi_device *dev, bool load) -{ - struct das6402_private *devpriv = dev->private; - unsigned long timer_iobase = dev->iobase + DAS6402_TIMER_BASE; - - if (load) { - i8254_set_mode(timer_iobase, 0, 0, I8254_MODE0 | I8254_BINARY); - i8254_set_mode(timer_iobase, 0, 1, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_iobase, 0, 2, I8254_MODE2 | I8254_BINARY); - - i8254_write(timer_iobase, 0, 0, devpriv->count); - i8254_write(timer_iobase, 0, 1, devpriv->divider1); - i8254_write(timer_iobase, 0, 2, devpriv->divider2); - - } else { - i8254_set_mode(timer_iobase, 0, 0, I8254_MODE0 | I8254_BINARY); - i8254_set_mode(timer_iobase, 0, 1, I8254_MODE0 | I8254_BINARY); - i8254_set_mode(timer_iobase, 0, 2, I8254_MODE0 | I8254_BINARY); - } -} - static unsigned int das6402_ai_read_sample(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -267,7 +242,8 @@ static int das6402_ai_cmd(struct comedi_device *dev, outw(DAS6402_AI_MUX_HI(chan_hi) | DAS6402_AI_MUX_LO(chan_lo), dev->iobase + DAS6402_AI_MUX_REG); - das6402_enable_counter(dev, true); + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); /* enable interrupt and pacer trigger */ outb(DAS6402_CTRL_INTE | @@ -322,7 +298,6 @@ static int das6402_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - struct das6402_private *devpriv = dev->private; int err = 0; unsigned int arg; @@ -364,14 +339,9 @@ static int das6402_ai_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ - if (cmd->convert_src == TRIG_TIMER) { - arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ, - &devpriv->divider1, - &devpriv->divider2, - &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); - } + arg = cmd->convert_arg; + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); + err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); if (err) return 4; @@ -581,8 +551,6 @@ static void das6402_reset(struct comedi_device *dev) outw(0, dev->iobase + DAS6402_AO_DATA_REG(0)); inw(dev->iobase + DAS6402_AO_LSB_REG(0)); - das6402_enable_counter(dev, false); - /* set all digital outputs low */ outb(0, dev->iobase + DAS6402_DI_DO_REG); @@ -631,6 +599,11 @@ static int das6402_attach(struct comedi_device *dev, } } + dev->pacer = comedi_8254_init(dev->iobase + DAS6402_TIMER_BASE, + I8254_OSC_BASE_10MHZ, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; -- cgit v1.2.3 From a6c6c9b143d3abd854678b8ccfeb431f3db02f86 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:46 -0700 Subject: staging: comedi: das1800: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Tidy up the (*do_cmdtest) validation of the timer arguments. Absorb the converted das1800_setup_counters() code into the (*do_cmd). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/das1800.c | 81 ++++++++++++-------------------- 2 files changed, 30 insertions(+), 52 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index fbff2fa31778..f088685b4287 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -316,6 +316,7 @@ config COMEDI_DAS800 config COMEDI_DAS1800 tristate "DAS1800 and compatible ISA card support" select COMEDI_ISADMA if ISA_DMA_API + select COMEDI_8254 ---help--- Enable support for DAS1800 and compatible ISA cards Keithley Metrabyte DAS-1701ST, DAS-1701ST-DA, DAS-1701/AO, diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 0790a28828de..3eb02e8d6103 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -103,7 +103,7 @@ TODO: #include "comedi_isadma.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" /* misc. defines */ #define DAS1800_SIZE 16 /* uses 16 io addresses */ @@ -422,8 +422,6 @@ static const struct das1800_board das1800_boards[] = { struct das1800_private { struct comedi_isadma *dma; - unsigned int divisor1; /* value to load into board's counter 1 for timed conversions */ - unsigned int divisor2; /* value to load into board's counter 2 for timed conversions */ int irq_dma_bits; /* bits for control register b */ /* dma bits for control register b, stored so that dma can be * turned on and off */ @@ -731,7 +729,6 @@ static int das1800_ai_do_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { const struct das1800_board *thisboard = dev->board_ptr; - struct das1800_private *devpriv = dev->private; int err = 0; unsigned int arg; @@ -795,35 +792,23 @@ static int das1800_ai_do_cmdtest(struct comedi_device *dev, cmd->convert_src == TRIG_TIMER) { /* we are not in burst mode */ arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_5MHZ, - &devpriv->divisor1, - &devpriv->divisor2, - &cmd->convert_arg, cmd->flags); - if (arg != cmd->convert_arg) - err++; + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); + err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } else if (cmd->convert_src == TRIG_TIMER) { /* we are in burst mode */ - arg = cmd->convert_arg; - cmd->convert_arg = burst_convert_arg(cmd->convert_arg, - cmd->flags); - if (arg != cmd->convert_arg) - err++; + arg = burst_convert_arg(cmd->convert_arg, cmd->flags); + err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->convert_arg * cmd->chanlist_len; - if (arg > cmd->scan_begin_arg) { - cmd->scan_begin_arg = arg; - err++; - } + err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, + arg); arg = cmd->scan_begin_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_5MHZ, - &devpriv->divisor1, - &devpriv->divisor2, - &cmd->scan_begin_arg, - cmd->flags); - if (arg != cmd->scan_begin_arg) - err++; + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, + cmd->flags); + err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, + arg); } } @@ -910,31 +895,6 @@ static int control_c_bits(const struct comedi_cmd *cmd) return control_c; } -static void das1800_setup_counters(struct comedi_device *dev, - const struct comedi_cmd *cmd) -{ - struct das1800_private *devpriv = dev->private; - unsigned long timer_base = dev->iobase + DAS1800_COUNTER; - - /* setup cascaded counters for conversion/scan frequency */ - if ((cmd->scan_begin_src == TRIG_FOLLOW || - cmd->scan_begin_src == TRIG_TIMER) && - cmd->convert_src == TRIG_TIMER) { - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - - i8254_write(timer_base, 0, 1, devpriv->divisor1); - i8254_write(timer_base, 0, 2, devpriv->divisor2); - } - - /* setup counter 0 for 'about triggering' */ - if (cmd->stop_src == TRIG_EXT) { - i8254_set_mode(timer_base, 0, 0, I8254_MODE0 | I8254_BINARY); - - i8254_write(timer_base, 0, 0, 1); - } -} - static unsigned int das1800_ai_transfer_size(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int maxbytes, @@ -1053,7 +1013,19 @@ static int das1800_ai_do_cmd(struct comedi_device *dev, /* setup card and start */ program_chanlist(dev, cmd); - das1800_setup_counters(dev, cmd); + + /* setup cascaded counters for conversion/scan frequency */ + if ((cmd->scan_begin_src == TRIG_FOLLOW || + cmd->scan_begin_src == TRIG_TIMER) && + cmd->convert_src == TRIG_TIMER) { + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); + } + + /* setup counter 0 for 'about triggering' */ + if (cmd->stop_src == TRIG_EXT) + comedi_8254_load(dev->pacer, 0, 1, I8254_MODE0 | I8254_BINARY); + das1800_ai_setup_dma(dev, s); outb(control_c, dev->iobase + DAS1800_CONTROL_C); /* set conversion rate and length for burst mode */ @@ -1378,6 +1350,11 @@ static int das1800_attach(struct comedi_device *dev, if (!devpriv->fifo_buf) return -ENOMEM; + dev->pacer = comedi_8254_init(dev->iobase + DAS1800_COUNTER, + I8254_OSC_BASE_5MHZ, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; -- cgit v1.2.3 From 50e338b96c1ad0a6e77f559c0dcba5944d0095c1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:47 -0700 Subject: staging: comedi: adv_pci_dio: simplify counter subdevice I/O Only two of the boards supported by this driver have an 8254 counter/timer. Both of these boards have a single 8254 device. Currently the counter subdevice functions are coded to support multiple 8254 devices. This is unnecessary and just complicates the code. Simplfy the subdevice functions to work for a single 8254 counter/timer and refactor the driver (*attach) accordingly. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 47 +++++++++------------------- 1 file changed, 14 insertions(+), 33 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 09609d6d02da..88244509beb7 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -60,12 +60,6 @@ enum hw_io_access { #define MAX_DO_SUBDEVS 2 /* max number of DO subdevices per card */ #define MAX_DIO_SUBDEVG 2 /* max number of DIO subdevices group per * card */ -#define MAX_8254_SUBDEVS 1 /* max number of 8254 counter subdevs per - * card */ - /* (could be more than one 8254 per - * subdevice) */ - -#define SIZE_8254 4 /* 8254 IO space length */ #define PCIDIO_MAINREG 2 /* main I/O region for all Advantech cards? */ @@ -243,7 +237,7 @@ struct dio_boardtype { struct diosubd_data sdo[MAX_DO_SUBDEVS]; /* DO chans */ struct diosubd_data sdio[MAX_DIO_SUBDEVG]; /* DIO 8255 chans */ struct diosubd_data boardid; /* card supports board ID switch */ - struct diosubd_data s8254[MAX_8254_SUBDEVS]; /* 8254 subdevices */ + struct diosubd_data s8254[1]; /* 8254 subdevices */ enum hw_io_access io_access; }; @@ -492,15 +486,11 @@ static int pci_8254_insn_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { const struct diosubd_data *d = (const struct diosubd_data *)s->private; - unsigned int chan, chip, chipchan; + unsigned int chan = CR_CHAN(insn->chanspec); unsigned long flags; - chan = CR_CHAN(insn->chanspec); /* channel on subdevice */ - chip = chan / 3; /* chip on subdevice */ - chipchan = chan - (3 * chip); /* channel on chip on subdevice */ spin_lock_irqsave(&s->spin_lock, flags); - data[0] = i8254_read(dev->iobase + d->addr + (SIZE_8254 * chip), - 0, chipchan); + data[0] = i8254_read(dev->iobase + d->addr, 0, chan); spin_unlock_irqrestore(&s->spin_lock, flags); return 1; } @@ -513,15 +503,11 @@ static int pci_8254_insn_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { const struct diosubd_data *d = (const struct diosubd_data *)s->private; - unsigned int chan, chip, chipchan; + unsigned int chan = CR_CHAN(insn->chanspec); unsigned long flags; - chan = CR_CHAN(insn->chanspec); /* channel on subdevice */ - chip = chan / 3; /* chip on subdevice */ - chipchan = chan - (3 * chip); /* channel on chip on subdevice */ spin_lock_irqsave(&s->spin_lock, flags); - i8254_write(dev->iobase + d->addr + (SIZE_8254 * chip), - 0, chipchan, data[0]); + i8254_write(dev->iobase + d->addr, 0, chan, data[0]); spin_unlock_irqrestore(&s->spin_lock, flags); return 1; } @@ -534,24 +520,20 @@ static int pci_8254_insn_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { const struct diosubd_data *d = (const struct diosubd_data *)s->private; - unsigned int chan, chip, chipchan; - unsigned long iobase; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned long iobase = dev->iobase + d->addr; int ret = 0; unsigned long flags; - chan = CR_CHAN(insn->chanspec); /* channel on subdevice */ - chip = chan / 3; /* chip on subdevice */ - chipchan = chan - (3 * chip); /* channel on chip on subdevice */ - iobase = dev->iobase + d->addr + (SIZE_8254 * chip); spin_lock_irqsave(&s->spin_lock, flags); switch (data[0]) { case INSN_CONFIG_SET_COUNTER_MODE: - ret = i8254_set_mode(iobase, 0, chipchan, data[1]); + ret = i8254_set_mode(iobase, 0, chan, data[1]); if (ret < 0) ret = -EINVAL; break; case INSN_CONFIG_8254_READ_STATUS: - data[1] = i8254_status(iobase, 0, chipchan); + data[1] = i8254_status(iobase, 0, chan); break; default: ret = -EINVAL; @@ -1144,12 +1126,11 @@ static int pci_dio_auto_attach(struct comedi_device *dev, subdev++; } - for (i = 0; i < MAX_8254_SUBDEVS; i++) - if (this_board->s8254[i].chans) { - s = &dev->subdevices[subdev]; - pci_dio_add_8254(dev, s, &this_board->s8254[i]); - subdev++; - } + if (this_board->s8254[0].chans) { + s = &dev->subdevices[subdev]; + pci_dio_add_8254(dev, s, &this_board->s8254[0]); + subdev++; + } if (this_board->cardtype == TYPE_PCI1760) pci1760_attach(dev); -- cgit v1.2.3 From 0275299f26ecde814c7e03f3fb5a6fa73c60acd9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:48 -0700 Subject: staging: comedi: adv_pci_dio: refactor 's8254' boardinfo The boardinfo for the 8254 timer is overly complex. The 8254 timer always has 3 channels and the 'regs' and 'specflags' members of diosubd_data are not used. The only necessary information is the base 'addr' offset to the 8254 registers. Replace the 's8254' member with an unsigned long 'timer_regbase'. Use that to determine if the board has an 8254 timer during the attach of the driver. Save the 'timer_regbase' in the subdevice 'private' pointer to use in the subdevice functions. For aesthetics, absorb pci_dio_add_8254() into the driver attach function. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 51 +++++++++++----------------- 1 file changed, 19 insertions(+), 32 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 88244509beb7..fb9de3a33c52 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -224,7 +224,7 @@ struct diosubd_data { int chans; /* num of chans */ int addr; /* PCI address ofset */ int regs; /* number of registers to read or 8255 - subdevices or 8254 chips */ + subdevices */ unsigned int specflags; /* addon subdevice flags */ }; @@ -237,7 +237,7 @@ struct dio_boardtype { struct diosubd_data sdo[MAX_DO_SUBDEVS]; /* DO chans */ struct diosubd_data sdio[MAX_DIO_SUBDEVG]; /* DIO 8255 chans */ struct diosubd_data boardid; /* card supports board ID switch */ - struct diosubd_data s8254[1]; /* 8254 subdevices */ + unsigned long timer_regbase; enum hw_io_access io_access; }; @@ -280,7 +280,7 @@ static const struct dio_boardtype boardtypes[] = { .sdi[0] = { 32, PCI1735_DI, 4, 0, }, .sdo[0] = { 32, PCI1735_DO, 4, 0, }, .boardid = { 4, PCI1735_BOARDID, 1, SDF_INTERNAL, }, - .s8254[0] = { 3, PCI1735_C8254, 1, 0, }, + .timer_regbase = PCI1735_C8254, .io_access = IO_8b, }, [TYPE_PCI1736] = { @@ -316,7 +316,7 @@ static const struct dio_boardtype boardtypes[] = { .cardtype = TYPE_PCI1751, .nsubdevs = 3, .sdio[0] = { 48, PCI1751_DIO, 2, 0, }, - .s8254[0] = { 3, PCI1751_CNT, 1, 0, }, + .timer_regbase = PCI1751_CNT, .io_access = IO_8b, }, [TYPE_PCI1752] = { @@ -485,12 +485,12 @@ static int pci_8254_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - const struct diosubd_data *d = (const struct diosubd_data *)s->private; + unsigned long timer_regbase = (unsigned long)s->private; unsigned int chan = CR_CHAN(insn->chanspec); unsigned long flags; spin_lock_irqsave(&s->spin_lock, flags); - data[0] = i8254_read(dev->iobase + d->addr, 0, chan); + data[0] = i8254_read(dev->iobase + timer_regbase, 0, chan); spin_unlock_irqrestore(&s->spin_lock, flags); return 1; } @@ -502,12 +502,12 @@ static int pci_8254_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - const struct diosubd_data *d = (const struct diosubd_data *)s->private; + unsigned long timer_regbase = (unsigned long)s->private; unsigned int chan = CR_CHAN(insn->chanspec); unsigned long flags; spin_lock_irqsave(&s->spin_lock, flags); - i8254_write(dev->iobase + d->addr, 0, chan, data[0]); + i8254_write(dev->iobase + timer_regbase, 0, chan, data[0]); spin_unlock_irqrestore(&s->spin_lock, flags); return 1; } @@ -519,9 +519,9 @@ static int pci_8254_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - const struct diosubd_data *d = (const struct diosubd_data *)s->private; + unsigned long timer_regbase = (unsigned long)s->private; + unsigned long iobase = dev->iobase + timer_regbase; unsigned int chan = CR_CHAN(insn->chanspec); - unsigned long iobase = dev->iobase + d->addr; int ret = 0; unsigned long flags; @@ -1011,26 +1011,6 @@ static int pci_dio_add_do(struct comedi_device *dev, return 0; } -/* -============================================================================== -*/ -static int pci_dio_add_8254(struct comedi_device *dev, - struct comedi_subdevice *s, - const struct diosubd_data *d) -{ - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = d->chans; - s->maxdata = 65535; - s->len_chanlist = d->chans; - s->insn_read = pci_8254_insn_read; - s->insn_write = pci_8254_insn_write; - s->insn_config = pci_8254_insn_config; - s->private = (void *)d; - - return 0; -} - static unsigned long pci_dio_override_cardtype(struct pci_dev *pcidev, unsigned long cardtype) { @@ -1126,9 +1106,16 @@ static int pci_dio_auto_attach(struct comedi_device *dev, subdev++; } - if (this_board->s8254[0].chans) { + if (this_board->timer_regbase) { s = &dev->subdevices[subdev]; - pci_dio_add_8254(dev, s, &this_board->s8254[0]); + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 3; + s->maxdata = 65535; + s->insn_read = pci_8254_insn_read; + s->insn_write = pci_8254_insn_write; + s->insn_config = pci_8254_insn_config; + s->private = (void *)this_board->timer_regbase; subdev++; } -- cgit v1.2.3 From 1e1fe085f510645ec9d0330e2a53aab376e54a29 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:49 -0700 Subject: staging: comedi: adv_pci_dio: convert driver to use the comedi_8254 module Some of the hardware supported by this driver includes an 8254 timer. For aesthetics, convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/adv_pci_dio.c | 87 ++++------------------------ 2 files changed, 11 insertions(+), 77 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index f088685b4287..e4ef12b21d39 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -771,6 +771,7 @@ config COMEDI_ADV_PCI1724 config COMEDI_ADV_PCI_DIO tristate "Advantech PCI DIO card support" + select COMEDI_8254 select COMEDI_8255 ---help--- Enable support for Advantech PCI DIO cards diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index fb9de3a33c52..a46cffe5f9b8 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -36,7 +36,7 @@ Configuration options: #include "../comedidev.h" #include "8255.h" -#include "8253.h" +#include "comedi_8254.h" /* hardware types of the cards */ enum hw_cards_id { @@ -478,71 +478,6 @@ static int pci_dio_insn_bits_do_w(struct comedi_device *dev, return insn->n; } -/* -============================================================================== -*/ -static int pci_8254_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - unsigned long timer_regbase = (unsigned long)s->private; - unsigned int chan = CR_CHAN(insn->chanspec); - unsigned long flags; - - spin_lock_irqsave(&s->spin_lock, flags); - data[0] = i8254_read(dev->iobase + timer_regbase, 0, chan); - spin_unlock_irqrestore(&s->spin_lock, flags); - return 1; -} - -/* -============================================================================== -*/ -static int pci_8254_insn_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - unsigned long timer_regbase = (unsigned long)s->private; - unsigned int chan = CR_CHAN(insn->chanspec); - unsigned long flags; - - spin_lock_irqsave(&s->spin_lock, flags); - i8254_write(dev->iobase + timer_regbase, 0, chan, data[0]); - spin_unlock_irqrestore(&s->spin_lock, flags); - return 1; -} - -/* -============================================================================== -*/ -static int pci_8254_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - unsigned long timer_regbase = (unsigned long)s->private; - unsigned long iobase = dev->iobase + timer_regbase; - unsigned int chan = CR_CHAN(insn->chanspec); - int ret = 0; - unsigned long flags; - - spin_lock_irqsave(&s->spin_lock, flags); - switch (data[0]) { - case INSN_CONFIG_SET_COUNTER_MODE: - ret = i8254_set_mode(iobase, 0, chan, data[1]); - if (ret < 0) - ret = -EINVAL; - break; - case INSN_CONFIG_8254_READ_STATUS: - data[1] = i8254_status(iobase, 0, chan); - break; - default: - ret = -EINVAL; - break; - } - spin_unlock_irqrestore(&s->spin_lock, flags); - return ret < 0 ? ret : insn->n; -} - /* ============================================================================== */ @@ -827,9 +762,6 @@ static int pci_dio_reset(struct comedi_device *dev) outb(0, dev->iobase + PCI1735_DO + 1); outb(0, dev->iobase + PCI1735_DO + 2); outb(0, dev->iobase + PCI1735_DO + 3); - i8254_set_mode(dev->iobase + PCI1735_C8254, 0, 0, I8254_MODE0); - i8254_set_mode(dev->iobase + PCI1735_C8254, 0, 1, I8254_MODE0); - i8254_set_mode(dev->iobase + PCI1735_C8254, 0, 2, I8254_MODE0); break; case TYPE_PCI1736: @@ -1108,14 +1040,15 @@ static int pci_dio_auto_attach(struct comedi_device *dev, if (this_board->timer_regbase) { s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 3; - s->maxdata = 65535; - s->insn_read = pci_8254_insn_read; - s->insn_write = pci_8254_insn_write; - s->insn_config = pci_8254_insn_config; - s->private = (void *)this_board->timer_regbase; + + dev->pacer = comedi_8254_init(dev->iobase + + this_board->timer_regbase, + 0, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + + comedi_8254_subdevice_init(s, dev->pacer); + subdev++; } -- cgit v1.2.3 From d92d39d9bde805e7d237de534d8a7a3cc4b10ef1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:50 -0700 Subject: staging: comedi: me4000: convert driver to use the comedi_8254 module Some of the hardware supported by this driver include an 8254 timer. For aesthetics, convert it to use the comedi_8254 module to provide support for the 8254 timer. This also fixes the (*insn_read) and (*insn_write) to work like the comedi API expects. Currently they only read or write a single value. It also fixes the (*insn_config). Currently the driver is attempting to handle the configuration instructions GPCT_RESET and GPCT_SET_OPERATION. These are just arbitrary valuse and are not real comedi configuration_ids. They actually coorespond to: GPCT_RESET -> INSN_CONFIG_DIO_OUTPUT GPCT_SET_OPERATION -> INSN_CONFIG_ANALOG_TRIG The number of parameters for the instructions is validated by the comedi core in check_insn_config_length(). GPCT_RESET happens to work (insn->n == 1) but GPCT_SET_OPERATION would fail. The INSN_CONFIG_ANALOG_TRIG expects insn->n == 5 but GPCT_SET_OPERATION in this driver expects insn->n == 2. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/me4000.c | 108 ++++---------------------------- 2 files changed, 14 insertions(+), 95 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index e4ef12b21d39..77c1c99b1116 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -970,6 +970,7 @@ config COMEDI_CB_PCIMDDA config COMEDI_ME4000 tristate "Meilhaus ME-4000 support" + select COMEDI_8254 ---help--- Enable support for Meilhaus PCI data acquisition cards ME-4650, ME-4670i, ME-4680, ME-4680i and ME-4680is diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index d120aa244cf9..2d0e60d84a32 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -48,7 +48,7 @@ broken. #include "../comedidev.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" #include "plx9052.h" #define ME4000_FIRMWARE "me4000_firmware.bin" @@ -170,7 +170,6 @@ broken. struct me4000_info { unsigned long plx_regbase; - unsigned long timer_regbase; }; enum me4000_boardid { @@ -1259,85 +1258,6 @@ static int me4000_dio_insn_config(struct comedi_device *dev, return insn->n; } -/*============================================================================= - Counter section - ===========================================================================*/ - -static int me4000_cnt_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - struct me4000_info *info = dev->private; - unsigned int chan = CR_CHAN(insn->chanspec); - int err; - - switch (data[0]) { - case GPCT_RESET: - if (insn->n != 1) - return -EINVAL; - - err = i8254_set_mode(info->timer_regbase, 0, chan, - I8254_MODE0 | I8254_BINARY); - if (err) - return err; - i8254_write(info->timer_regbase, 0, chan, 0); - break; - case GPCT_SET_OPERATION: - if (insn->n != 2) - return -EINVAL; - - err = i8254_set_mode(info->timer_regbase, 0, chan, - (data[1] << 1) | I8254_BINARY); - if (err) - return err; - break; - default: - return -EINVAL; - } - - return insn->n; -} - -static int me4000_cnt_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - struct me4000_info *info = dev->private; - - if (insn->n == 0) - return 0; - - if (insn->n > 1) { - dev_err(dev->class_dev, "Invalid instruction length %d\n", - insn->n); - return -EINVAL; - } - - data[0] = i8254_read(info->timer_regbase, 0, insn->chanspec); - - return 1; -} - -static int me4000_cnt_insn_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - struct me4000_info *info = dev->private; - - if (insn->n == 0) { - return 0; - } else if (insn->n > 1) { - dev_err(dev->class_dev, "Invalid instruction length %d\n", - insn->n); - return -EINVAL; - } - - i8254_write(info->timer_regbase, 0, insn->chanspec, data[0]); - - return 1; -} - static int me4000_auto_attach(struct comedi_device *dev, unsigned long context) { @@ -1364,8 +1284,7 @@ static int me4000_auto_attach(struct comedi_device *dev, info->plx_regbase = pci_resource_start(pcidev, 1); dev->iobase = pci_resource_start(pcidev, 2); - info->timer_regbase = pci_resource_start(pcidev, 3); - if (!info->plx_regbase || !dev->iobase || !info->timer_regbase) + if (!info->plx_regbase || !dev->iobase) return -ENODEV; result = comedi_load_firmware(dev, &pcidev->dev, ME4000_FIRMWARE, @@ -1462,20 +1381,19 @@ static int me4000_auto_attach(struct comedi_device *dev, dev->iobase + ME4000_DIO_DIR_REG); } - /*========================================================================= - Counter subdevice - ========================================================================*/ - + /* Counter subdevice (8254) */ s = &dev->subdevices[3]; - if (thisboard->has_counter) { - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 3; - s->maxdata = 0xFFFF; /* 16 bit counters */ - s->insn_read = me4000_cnt_insn_read; - s->insn_write = me4000_cnt_insn_write; - s->insn_config = me4000_cnt_insn_config; + unsigned long timer_base = pci_resource_start(pcidev, 3); + + if (!timer_base) + return -ENODEV; + + dev->pacer = comedi_8254_init(timer_base, 0, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + + comedi_8254_subdevice_init(s, dev->pacer); } else { s->type = COMEDI_SUBD_UNUSED; } -- cgit v1.2.3 From bf9e4d5c1a9e931a86c3086d41e63b8873efaf37 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:51 -0700 Subject: staging: comedi: cb_pcidas64: remove unnecessary include The hardware supported by this driver does not have an 8254 timer. Remove the unnecessary include of "8253.h". Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 9836c877c910..551e9d92e918 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -87,7 +87,6 @@ TODO: #include "../comedidev.h" -#include "8253.h" #include "8255.h" #include "plx9080.h" #include "comedi_fc.h" -- cgit v1.2.3 From 4ffe2b25732be9cd68ec305f4c727da75462fcd4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:52 -0700 Subject: staging: comedi: das16: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/das16.c | 44 ++++++++++++---------------------- 2 files changed, 16 insertions(+), 29 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 77c1c99b1116..30951a3286f6 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -287,6 +287,7 @@ config COMEDI_DAS08_ISA config COMEDI_DAS16 tristate "DAS-16 compatible ISA and PC/104 card support" select COMEDI_ISADMA if ISA_DMA_API + select COMEDI_8254 select COMEDI_8255 ---help--- Enable support for Keithley Metrabyte/ComputerBoards DAS16 diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 2c20311120f1..4b3bdade6596 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -77,7 +77,7 @@ #include "comedi_isadma.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" #include "8255.h" #define DAS16_DMA_SIZE 0xff00 /* size in bytes of allocated dma buffer */ @@ -663,18 +663,12 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, /* step 4: fix up arguments */ if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; - i8253_cascade_ns_to_timer(devpriv->clockbase, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(devpriv->clockbase, - &devpriv->divisor1, - &devpriv->divisor2, - &arg, cmd->flags); + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) @@ -693,17 +687,9 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, static unsigned int das16_set_pacer(struct comedi_device *dev, unsigned int ns, unsigned int flags) { - struct das16_private_struct *devpriv = dev->private; - unsigned long timer_base = dev->iobase + DAS16_TIMER_BASE_REG; - - i8253_cascade_ns_to_timer(devpriv->clockbase, - &devpriv->divisor1, &devpriv->divisor2, - &ns, flags); - - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); - i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); - i8254_write(timer_base, 0, 1, devpriv->divisor1); - i8254_write(timer_base, 0, 2, devpriv->divisor2); + comedi_8254_cascade_ns_to_timer(dev->pacer, &ns, flags); + comedi_8254_update_divisors(dev->pacer); + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); return ns; } @@ -935,7 +921,6 @@ static void das16_reset(struct comedi_device *dev) outb(0, dev->iobase + DAS16_STATUS_REG); outb(0, dev->iobase + DAS16_CTRL_REG); outb(0, dev->iobase + DAS16_PACER_REG); - outb(0, dev->iobase + DAS16_TIMER_BASE_REG + i8254_control_reg); } static void das16_alloc_dma(struct comedi_device *dev, unsigned int dma_chan) @@ -1039,6 +1024,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) const struct das16_board *board = dev->board_ptr; struct das16_private_struct *devpriv; struct comedi_subdevice *s; + unsigned int osc_base; unsigned int status; int ret; @@ -1078,21 +1064,21 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -EINVAL; /* get master clock speed */ + osc_base = I8254_OSC_BASE_1MHZ; if (devpriv->can_burst) { status = inb(dev->iobase + DAS1600_STATUS_REG); - if (status & DAS1600_STATUS_CLK_10MHZ) - devpriv->clockbase = I8254_OSC_BASE_10MHZ; - else - devpriv->clockbase = I8254_OSC_BASE_1MHZ; + osc_base = I8254_OSC_BASE_10MHZ; } else { if (it->options[3]) - devpriv->clockbase = I8254_OSC_BASE_1MHZ / - it->options[3]; - else - devpriv->clockbase = I8254_OSC_BASE_1MHZ; + osc_base = I8254_OSC_BASE_1MHZ / it->options[3]; } + dev->pacer = comedi_8254_init(dev->iobase + DAS16_TIMER_BASE_REG, + osc_base, I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + das16_alloc_dma(dev, it->options[2]); ret = comedi_alloc_subdevices(dev, 4 + board->has_8255); -- cgit v1.2.3 From a9da9d20576685b7b3818013d5e1de2367bcff8b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:53 -0700 Subject: staging: comedi: adl_pci9118: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/adl_pci9118.c | 93 +++++++++------------------- 2 files changed, 29 insertions(+), 65 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 30951a3286f6..6ee50b481088 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -736,6 +736,7 @@ config COMEDI_ADL_PCI9111 config COMEDI_ADL_PCI9118 tristate "ADLink PCI-9118DG, PCI-9118HG, PCI-9118HR support" depends on HAS_DMA + select COMEDI_8254 ---help--- Enable support for ADlink PCI-9118DG, PCI-9118HG, PCI-9118HR cards diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index f61e392c2d3e..4b604423635f 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -82,7 +82,7 @@ #include "../comedidev.h" #include "amcc_s5933.h" -#include "8253.h" +#include "comedi_8254.h" #include "comedi_fc.h" #define IORANGE_9118 64 /* I hope */ @@ -94,8 +94,7 @@ /* * PCI BAR2 Register map (dev->iobase) */ -#define PCI9118_TIMER_REG(x) (0x00 + ((x) * 4)) -#define PCI9118_TIMER_CTRL_REG 0x0c +#define PCI9118_TIMER_BASE 0x00 #define PCI9118_AI_FIFO_REG 0x10 #define PCI9118_AO_REG(x) (0x10 + ((x) * 4)) #define PCI9118_AI_STATUS_REG 0x18 @@ -239,10 +238,6 @@ struct pci9118_private { * measure can start/stop * on external trigger */ - unsigned int ai_divisor1, ai_divisor2; /* - * divisors for start of measure - * on external start - */ unsigned int dma_actbuf; /* which buffer is used now */ struct pci9118_dmabuf dmabuf[2]; int softsshdelay; /* @@ -297,24 +292,6 @@ static void pci9118_amcc_int_ena(struct comedi_device *dev, bool enable) outl(intcsr, devpriv->iobase_a + AMCC_OP_REG_INTCSR); } -static void pci9118_timer_write(struct comedi_device *dev, - unsigned int timer, unsigned int val) -{ - outl(val & 0xff, dev->iobase + PCI9118_TIMER_REG(timer)); - outl((val >> 8) & 0xff, dev->iobase + PCI9118_TIMER_REG(timer)); -} - -static void pci9118_timer_set_mode(struct comedi_device *dev, - unsigned int timer, unsigned int mode) -{ - unsigned int val; - - val = timer << 6; /* select timer */ - val |= 0x30; /* load low then high byte */ - val |= mode; /* set timer mode and BCD|binary */ - outl(val, dev->iobase + PCI9118_TIMER_CTRL_REG); -} - static void pci9118_ai_reset_fifo(struct comedi_device *dev) { /* writing any value resets the A/D FIFO */ @@ -440,8 +417,8 @@ static void interrupt_pci9118_ai_mode4_switch(struct comedi_device *dev, devpriv->ai_cfg = PCI9118_AI_CFG_PDTRG | PCI9118_AI_CFG_PETRG | PCI9118_AI_CFG_AM; outl(devpriv->ai_cfg, dev->iobase + PCI9118_AI_CFG_REG); - pci9118_timer_set_mode(dev, 0, I8254_MODE0); - pci9118_timer_write(dev, 0, dmabuf->hw >> 1); + comedi_8254_load(dev->pacer, 0, dmabuf->hw >> 1, + I8254_MODE0 | I8254_BINARY); devpriv->ai_cfg |= PCI9118_AI_CFG_START; outl(devpriv->ai_cfg, dev->iobase + PCI9118_AI_CFG_REG); } @@ -577,15 +554,16 @@ static void pci9118_calc_divisors(struct comedi_device *dev, unsigned int *div1, unsigned int *div2, unsigned int chnsshfront) { + struct comedi_8254 *pacer = dev->pacer; struct comedi_cmd *cmd = &s->async->cmd; - *div1 = *tim2 / I8254_OSC_BASE_4MHZ; /* convert timer (burst) */ - *div2 = *tim1 / I8254_OSC_BASE_4MHZ; /* scan timer */ + *div1 = *tim2 / pacer->osc_base; /* convert timer (burst) */ + *div2 = *tim1 / pacer->osc_base; /* scan timer */ *div2 = *div2 / *div1; /* major timer is c1*c2 */ if (*div2 < chans) *div2 = chans; - *tim2 = *div1 * I8254_OSC_BASE_4MHZ; /* real convert timer */ + *tim2 = *div1 * pacer->osc_base; /* real convert timer */ if (cmd->convert_src == TRIG_NOW && !chnsshfront) { /* use BSSH signal */ @@ -593,21 +571,13 @@ static void pci9118_calc_divisors(struct comedi_device *dev, *div2 = chans + 2; } - *tim1 = *div1 * *div2 * I8254_OSC_BASE_4MHZ; + *tim1 = *div1 * *div2 * pacer->osc_base; } static void pci9118_start_pacer(struct comedi_device *dev, int mode) { - struct pci9118_private *devpriv = dev->private; - - pci9118_timer_set_mode(dev, 1, I8254_MODE2); - pci9118_timer_set_mode(dev, 2, I8254_MODE2); - udelay(1); - - if ((mode == 1) || (mode == 2) || (mode == 4)) { - pci9118_timer_write(dev, 2, devpriv->ai_divisor2); - pci9118_timer_write(dev, 1, devpriv->ai_divisor1); - } + if (mode == 1 || mode == 2 || mode == 4) + comedi_8254_pacer_enable(dev->pacer, 1, 2, true); } static int pci9118_ai_cancel(struct comedi_device *dev, @@ -618,7 +588,7 @@ static int pci9118_ai_cancel(struct comedi_device *dev, if (devpriv->usedma) pci9118_amcc_dma_ena(dev, false); pci9118_exttrg_enable(dev, false); - pci9118_start_pacer(dev, 0); /* stop 8254 counters */ + comedi_8254_pacer_enable(dev->pacer, 1, 2, false); /* set default config (disable burst and triggers) */ devpriv->ai_cfg = PCI9118_AI_CFG_PDTRG | PCI9118_AI_CFG_PETRG; outl(devpriv->ai_cfg, dev->iobase + PCI9118_AI_CFG_REG); @@ -975,6 +945,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev, static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct pci9118_private *devpriv = dev->private; + struct comedi_8254 *pacer = dev->pacer; struct comedi_cmd *cmd = &s->async->cmd; unsigned int addchans = 0; @@ -1093,12 +1064,10 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) else devpriv->ai_do = 1; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_4MHZ, - &devpriv->ai_divisor1, - &devpriv->ai_divisor2, - &cmd->convert_arg, - devpriv->ai_flags & - CMDF_ROUND_NEAREST); + comedi_8254_cascade_ns_to_timer(pacer, &cmd->convert_arg, + devpriv->ai_flags & + CMDF_ROUND_NEAREST); + comedi_8254_update_divisors(pacer); devpriv->ai_ctrl |= PCI9118_AI_CTRL_TMRTR; @@ -1112,8 +1081,8 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_cfg |= PCI9118_AI_CFG_AM; outl(devpriv->ai_cfg, dev->iobase + PCI9118_AI_CFG_REG); - pci9118_timer_set_mode(dev, 0, I8254_MODE0); - pci9118_timer_write(dev, 0, dmabuf->hw >> 1); + comedi_8254_load(pacer, 0, dmabuf->hw >> 1, + I8254_MODE0 | I8254_BINARY); devpriv->ai_cfg |= PCI9118_AI_CFG_START; } } @@ -1133,8 +1102,8 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) &cmd->scan_begin_arg, &cmd->convert_arg, devpriv->ai_flags, devpriv->ai_n_realscanlen, - &devpriv->ai_divisor1, - &devpriv->ai_divisor2, + &pacer->divisor1, + &pacer->divisor2, devpriv->ai_add_front); devpriv->ai_ctrl |= PCI9118_AI_CTRL_TMRTR; @@ -1162,8 +1131,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->usedma) devpriv->ai_ctrl |= PCI9118_AI_CTRL_DMA; - pci9118_start_pacer(dev, -1); /* stop pacer */ - /* set default config (disable burst and triggers) */ devpriv->ai_cfg = PCI9118_AI_CFG_PDTRG | PCI9118_AI_CFG_PETRG; outl(devpriv->ai_cfg, dev->iobase + PCI9118_AI_CFG_REG); @@ -1206,7 +1173,6 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, int err = 0; unsigned int flags; unsigned int arg; - unsigned int divisor1 = 0, divisor2 = 0; /* Step 1 : check if triggers are trivially valid */ @@ -1323,17 +1289,13 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_4MHZ, - &divisor1, &divisor2, - &arg, cmd->flags); + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src & (TRIG_TIMER | TRIG_NOW)) { arg = cmd->convert_arg; - i8253_cascade_ns_to_timer(I8254_OSC_BASE_4MHZ, - &divisor1, &divisor2, - &arg, cmd->flags); + comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); if (cmd->scan_begin_src == TRIG_TIMER && @@ -1482,10 +1444,6 @@ static void pci9118_reset(struct comedi_device *dev) inl(dev->iobase + PCI9118_INT_CTRL_REG); inl(dev->iobase + PCI9118_AI_STATUS_REG); - /* reset and stop counters */ - pci9118_timer_set_mode(dev, 0, I8254_MODE0); - pci9118_start_pacer(dev, 0); - /* reset DMA and scan queue */ outl(0, dev->iobase + PCI9118_AI_BURST_NUM_REG); outl(1, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); @@ -1590,6 +1548,11 @@ static int pci9118_common_attach(struct comedi_device *dev, devpriv->iobase_a = pci_resource_start(pcidev, 0); dev->iobase = pci_resource_start(pcidev, 2); + dev->pacer = comedi_8254_init(dev->iobase + PCI9118_TIMER_BASE, + I8254_OSC_BASE_4MHZ, I8254_IO32, 0); + if (!dev->pacer) + return -ENOMEM; + pci9118_reset(dev); if (pcidev->irq) { -- cgit v1.2.3 From 1ec7271dbc05542c27956bdd79aca6c4e80ae516 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:54 -0700 Subject: staging: comedi: amplc_dio200_common: introduce DIO200_CLK_SEL() macro Replace the DIO200_[XYZ]CLK_SEL defines with a macro that returns the correct register offset. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200_common.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 26aad705aad3..ab87f2e677e6 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -32,9 +32,7 @@ /* 200 series registers */ #define DIO200_IO_SIZE 0x20 #define DIO200_PCIE_IO_SIZE 0x4000 -#define DIO200_XCLK_SCE 0x18 /* Group X clock selection register */ -#define DIO200_YCLK_SCE 0x19 /* Group Y clock selection register */ -#define DIO200_ZCLK_SCE 0x1a /* Group Z clock selection register */ +#define DIO200_CLK_SCE(x) (0x18 + (x)) /* Group X/Y/Z clock sel reg */ #define DIO200_XGAT_SCE 0x1b /* Group X gate selection register */ #define DIO200_YGAT_SCE 0x1c /* Group Y gate selection register */ #define DIO200_ZGAT_SCE 0x1d /* Group Z gate selection register */ @@ -733,7 +731,7 @@ static int dio200_subdev_8254_init(struct comedi_device *dev, if (board->has_clk_gat_sce) { /* Derive CLK_SCE and GAT_SCE register offsets from * 8254 offset. */ - subpriv->clk_sce_ofs = DIO200_XCLK_SCE + (offset >> 3); + subpriv->clk_sce_ofs = DIO200_CLK_SCE(offset >> 3); subpriv->gat_sce_ofs = DIO200_XGAT_SCE + (offset >> 3); subpriv->which = (offset >> 2) & 1; } -- cgit v1.2.3 From 5f907df0302b1d723887926ec7dba39bf1d31da5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:55 -0700 Subject: staging: comedi: amplc_dio200_common: introduce DIO200_GAT_SEL() macro Replace the DIO200_[XYZ]GAT_SEL defines with a macro that returns the correct register offset. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200_common.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index ab87f2e677e6..709fe1a1ee0b 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -33,9 +33,7 @@ #define DIO200_IO_SIZE 0x20 #define DIO200_PCIE_IO_SIZE 0x4000 #define DIO200_CLK_SCE(x) (0x18 + (x)) /* Group X/Y/Z clock sel reg */ -#define DIO200_XGAT_SCE 0x1b /* Group X gate selection register */ -#define DIO200_YGAT_SCE 0x1c /* Group Y gate selection register */ -#define DIO200_ZGAT_SCE 0x1d /* Group Z gate selection register */ +#define DIO200_GAT_SCE(x) (0x1b + (x)) /* Group X/Y/Z gate sel reg */ #define DIO200_INT_SCE 0x1e /* Interrupt enable/status register */ /* Extra registers for new PCIe boards */ #define DIO200_ENHANCE 0x20 /* 1 to enable enhanced features */ @@ -732,7 +730,7 @@ static int dio200_subdev_8254_init(struct comedi_device *dev, /* Derive CLK_SCE and GAT_SCE register offsets from * 8254 offset. */ subpriv->clk_sce_ofs = DIO200_CLK_SCE(offset >> 3); - subpriv->gat_sce_ofs = DIO200_XGAT_SCE + (offset >> 3); + subpriv->gat_sce_ofs = DIO200_GAT_SCE(offset >> 3); subpriv->which = (offset >> 2) & 1; } -- cgit v1.2.3 From 3a4959a3a0bd50bbbc5101abec6420d56582ec98 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:56 -0700 Subject: staging: comedi: amplc_dio200_common: remove 'clk_sce_ofs' from struct dio200_subdev_8254 This member is only used one place in the driver. Remove it and calculate the register offset when needed. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 709fe1a1ee0b..1786ea2c61a3 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -99,7 +99,6 @@ static const unsigned int ts_clock_period[TS_CONFIG_MAX_CLK_SRC + 1] = { struct dio200_subdev_8254 { unsigned int ofs; /* Counter base offset */ - unsigned int clk_sce_ofs; /* CLK_SCE base address */ unsigned int gat_sce_ofs; /* GAT_SCE base address */ int which; /* Bit 5 of CLK_SCE or GAT_SCE */ unsigned int clock_src[3]; /* Current clock sources */ @@ -625,7 +624,7 @@ static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev, subpriv->clock_src[counter_number] = clock_src; byte = clk_sce(subpriv->which, counter_number, clock_src); - dio200_write8(dev, subpriv->clk_sce_ofs, byte); + dio200_write8(dev, DIO200_CLK_SCE(subpriv->ofs >> 3), byte); return 0; } @@ -729,7 +728,6 @@ static int dio200_subdev_8254_init(struct comedi_device *dev, if (board->has_clk_gat_sce) { /* Derive CLK_SCE and GAT_SCE register offsets from * 8254 offset. */ - subpriv->clk_sce_ofs = DIO200_CLK_SCE(offset >> 3); subpriv->gat_sce_ofs = DIO200_GAT_SCE(offset >> 3); subpriv->which = (offset >> 2) & 1; } -- cgit v1.2.3 From 5814504f4d202974694d2cf37683a0138b99a6a0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:57 -0700 Subject: staging: comedi: amplc_dio200_common: remove 'gat_sce_ofs' from struct dio200_subdev_8254 This member is only used one place in the driver. Remove it and calculate the register offset when needed. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200_common.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 1786ea2c61a3..2c9c8dd612d8 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -99,7 +99,6 @@ static const unsigned int ts_clock_period[TS_CONFIG_MAX_CLK_SRC + 1] = { struct dio200_subdev_8254 { unsigned int ofs; /* Counter base offset */ - unsigned int gat_sce_ofs; /* GAT_SCE base address */ int which; /* Bit 5 of CLK_SCE or GAT_SCE */ unsigned int clock_src[3]; /* Current clock sources */ unsigned int gate_src[3]; /* Current gate sources */ @@ -586,7 +585,7 @@ static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev, subpriv->gate_src[counter_number] = gate_src; byte = gat_sce(subpriv->which, counter_number, gate_src); - dio200_write8(dev, subpriv->gat_sce_ofs, byte); + dio200_write8(dev, DIO200_GAT_SCE(subpriv->ofs >> 3), byte); return 0; } @@ -725,12 +724,8 @@ static int dio200_subdev_8254_init(struct comedi_device *dev, spin_lock_init(&subpriv->spinlock); subpriv->ofs = offset; - if (board->has_clk_gat_sce) { - /* Derive CLK_SCE and GAT_SCE register offsets from - * 8254 offset. */ - subpriv->gat_sce_ofs = DIO200_GAT_SCE(offset >> 3); + if (board->has_clk_gat_sce) subpriv->which = (offset >> 2) & 1; - } /* Initialize channels. */ for (chan = 0; chan < 3; chan++) { -- cgit v1.2.3 From fdb7c3ece29fc4d73e5994af6a58b4e3d55d105c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:58 -0700 Subject: staging: comedi: amplc_dio200_common: remove 'which' from struct dio200_subdev_8254 This member is only used in the "set gate" and "set clock" helper functions. Remove it and calculate the value when needed. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200_common.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 2c9c8dd612d8..6ef70a58c7b8 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -99,7 +99,6 @@ static const unsigned int ts_clock_period[TS_CONFIG_MAX_CLK_SRC + 1] = { struct dio200_subdev_8254 { unsigned int ofs; /* Counter base offset */ - int which; /* Bit 5 of CLK_SCE or GAT_SCE */ unsigned int clock_src[3]; /* Current clock sources */ unsigned int gate_src[3]; /* Current gate sources */ spinlock_t spinlock; @@ -584,7 +583,7 @@ static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev, return -1; subpriv->gate_src[counter_number] = gate_src; - byte = gat_sce(subpriv->which, counter_number, gate_src); + byte = gat_sce((subpriv->ofs >> 2) & 1, counter_number, gate_src); dio200_write8(dev, DIO200_GAT_SCE(subpriv->ofs >> 3), byte); return 0; @@ -622,7 +621,7 @@ static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev, return -1; subpriv->clock_src[counter_number] = clock_src; - byte = clk_sce(subpriv->which, counter_number, clock_src); + byte = clk_sce((subpriv->ofs >> 2) & 1, counter_number, clock_src); dio200_write8(dev, DIO200_CLK_SCE(subpriv->ofs >> 3), byte); return 0; @@ -724,8 +723,6 @@ static int dio200_subdev_8254_init(struct comedi_device *dev, spin_lock_init(&subpriv->spinlock); subpriv->ofs = offset; - if (board->has_clk_gat_sce) - subpriv->which = (offset >> 2) & 1; /* Initialize channels. */ for (chan = 0; chan < 3; chan++) { -- cgit v1.2.3 From ed023d529ce44c0e3c41101a344d80259bd96443 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:57:59 -0700 Subject: staging: comedi: amplc_dio200_common: remove unnecessary 'counter_number' checks The 'counter_number' in these functions is the comedi channel number from the chanspec. The comedi core validates the chanspec before calling the driver functions. Remove the unnecessary checks. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200_common.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 6ef70a58c7b8..48cdddc56110 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -577,8 +577,6 @@ static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev, if (!board->has_clk_gat_sce) return -1; - if (counter_number > 2) - return -1; if (gate_src > (board->is_pcie ? 31 : 7)) return -1; @@ -598,8 +596,6 @@ static int dio200_subdev_8254_get_gate_src(struct comedi_device *dev, if (!board->has_clk_gat_sce) return -1; - if (counter_number > 2) - return -1; return subpriv->gate_src[counter_number]; } @@ -615,8 +611,6 @@ static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev, if (!board->has_clk_gat_sce) return -1; - if (counter_number > 2) - return -1; if (clock_src > (board->is_pcie ? 31 : 7)) return -1; @@ -638,8 +632,6 @@ static int dio200_subdev_8254_get_clock_src(struct comedi_device *dev, if (!board->has_clk_gat_sce) return -1; - if (counter_number > 2) - return -1; clock_src = subpriv->clock_src[counter_number]; *period_ns = clock_period[clock_src]; -- cgit v1.2.3 From 99ca4e4613da5cb589de6b4127de75e520b32b43 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:58:00 -0700 Subject: staging: comedi: amplc_dio200_common: remove 'spinlock' from struct dio200_subdev_8254 Currently this driver uses a spinlock in the 8254 subdevice (*insn_read), (*insn_write), and (*insn_config) functions. The comedi core checks if the subdevice is 'busy', in parse_insn(), before any of the subdevice functions are attempted. Remove the unnecessary spinlock. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../staging/comedi/drivers/amplc_dio200_common.c | 23 +++++----------------- 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 48cdddc56110..08dab1fd91f2 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -101,7 +101,6 @@ struct dio200_subdev_8254 { unsigned int ofs; /* Counter base offset */ unsigned int clock_src[3]; /* Current clock sources */ unsigned int gate_src[3]; /* Current gate sources */ - spinlock_t spinlock; }; struct dio200_subdev_8255 { @@ -535,16 +534,12 @@ static int dio200_subdev_8254_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct dio200_subdev_8254 *subpriv = s->private; int chan = CR_CHAN(insn->chanspec); unsigned int n; - unsigned long flags; - for (n = 0; n < insn->n; n++) { - spin_lock_irqsave(&subpriv->spinlock, flags); + for (n = 0; n < insn->n; n++) data[n] = dio200_subdev_8254_read_chan(dev, s, chan); - spin_unlock_irqrestore(&subpriv->spinlock, flags); - } + return insn->n; } @@ -553,16 +548,12 @@ static int dio200_subdev_8254_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct dio200_subdev_8254 *subpriv = s->private; int chan = CR_CHAN(insn->chanspec); unsigned int n; - unsigned long flags; - for (n = 0; n < insn->n; n++) { - spin_lock_irqsave(&subpriv->spinlock, flags); + for (n = 0; n < insn->n; n++) dio200_subdev_8254_write_chan(dev, s, chan, data[n]); - spin_unlock_irqrestore(&subpriv->spinlock, flags); - } + return insn->n; } @@ -643,12 +634,9 @@ static int dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct dio200_subdev_8254 *subpriv = s->private; int ret = 0; int chan = CR_CHAN(insn->chanspec); - unsigned long flags; - spin_lock_irqsave(&subpriv->spinlock, flags); switch (data[0]) { case INSN_CONFIG_SET_COUNTER_MODE: if (data[1] > (I8254_MODE5 | I8254_BCD)) @@ -689,7 +677,7 @@ static int dio200_subdev_8254_config(struct comedi_device *dev, ret = -EINVAL; break; } - spin_unlock_irqrestore(&subpriv->spinlock, flags); + return ret < 0 ? ret : insn->n; } @@ -713,7 +701,6 @@ static int dio200_subdev_8254_init(struct comedi_device *dev, s->insn_write = dio200_subdev_8254_write; s->insn_config = dio200_subdev_8254_config; - spin_lock_init(&subpriv->spinlock); subpriv->ofs = offset; /* Initialize channels. */ -- cgit v1.2.3 From 5a213fa6f7c33219300bdd826d77172bfd5a54e6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 24 Feb 2015 10:38:49 -0700 Subject: staging: comedi: amplc_dio200_common: convert driver to use the comedi_8254 module Convert this driver to use the comedi_8254 module to provide the 8254 timer support. Add 'clock_src' and 'gate_src' members to the comedi_8254 data for convienence. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + .../staging/comedi/drivers/amplc_dio200_common.c | 295 +++++++-------------- drivers/staging/comedi/drivers/comedi_8254.h | 4 + 3 files changed, 99 insertions(+), 201 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 6ee50b481088..ebda03cd308d 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1275,6 +1275,7 @@ config COMEDI_KCOMEDILIB called kcomedilib. config COMEDI_AMPLC_DIO200 + select COMEDI_8254 tristate config COMEDI_AMPLC_PC236 diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 08dab1fd91f2..0101e92667a1 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -26,7 +26,7 @@ #include "amplc_dio200.h" #include "comedi_fc.h" -#include "8253.h" +#include "comedi_8254.h" #include "8255.h" /* only for register defines */ /* 200 series registers */ @@ -97,12 +97,6 @@ static const unsigned int ts_clock_period[TS_CONFIG_MAX_CLK_SRC + 1] = { 1000000, /* 1 millisecond. */ }; -struct dio200_subdev_8254 { - unsigned int ofs; /* Counter base offset */ - unsigned int clock_src[3]; /* Current clock sources */ - unsigned int gate_src[3]; /* Current gate sources */ -}; - struct dio200_subdev_8255 { unsigned int ofs; /* DIO base offset */ }; @@ -169,6 +163,27 @@ static void dio200_write32(struct comedi_device *dev, outl(val, dev->iobase + offset); } +static unsigned int dio200_subdev_8254_offset(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + const struct dio200_board *board = dev->board_ptr; + struct comedi_8254 *i8254 = s->private; + unsigned int offset; + + /* get the offset that was passed to comedi_8254_*_init() */ + if (dev->mmio) + offset = i8254->mmio - dev->mmio; + else + offset = i8254->iobase - dev->iobase; + + /* remove the shift that was added for PCIe boards */ + if (board->is_pcie) + offset >>= 3; + + /* this offset now works for the dio200_{read,write} helpers */ + return offset; +} + static int dio200_subdev_intr_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -474,159 +489,26 @@ static irqreturn_t dio200_interrupt(int irq, void *d) return IRQ_RETVAL(handled); } -static unsigned int dio200_subdev_8254_read_chan(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int chan) -{ - struct dio200_subdev_8254 *subpriv = s->private; - unsigned int val; - - /* latch counter */ - val = chan << 6; - dio200_write8(dev, subpriv->ofs + i8254_control_reg, val); - /* read lsb, msb */ - val = dio200_read8(dev, subpriv->ofs + chan); - val += dio200_read8(dev, subpriv->ofs + chan) << 8; - return val; -} - -static void dio200_subdev_8254_write_chan(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int chan, - unsigned int count) -{ - struct dio200_subdev_8254 *subpriv = s->private; - - /* write lsb, msb */ - dio200_write8(dev, subpriv->ofs + chan, count & 0xff); - dio200_write8(dev, subpriv->ofs + chan, (count >> 8) & 0xff); -} - -static void dio200_subdev_8254_set_mode(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int chan, - unsigned int mode) -{ - struct dio200_subdev_8254 *subpriv = s->private; - unsigned int byte; - - byte = chan << 6; - byte |= 0x30; /* access order: lsb, msb */ - byte |= (mode & 0xf); /* counter mode and BCD|binary */ - dio200_write8(dev, subpriv->ofs + i8254_control_reg, byte); -} - -static unsigned int dio200_subdev_8254_status(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int chan) -{ - struct dio200_subdev_8254 *subpriv = s->private; - - /* latch status */ - dio200_write8(dev, subpriv->ofs + i8254_control_reg, - 0xe0 | (2 << chan)); - /* read status */ - return dio200_read8(dev, subpriv->ofs + chan); -} - -static int dio200_subdev_8254_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - int chan = CR_CHAN(insn->chanspec); - unsigned int n; - - for (n = 0; n < insn->n; n++) - data[n] = dio200_subdev_8254_read_chan(dev, s, chan); - - return insn->n; -} - -static int dio200_subdev_8254_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - int chan = CR_CHAN(insn->chanspec); - unsigned int n; - - for (n = 0; n < insn->n; n++) - dio200_subdev_8254_write_chan(dev, s, chan, data[n]); - - return insn->n; -} - -static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int counter_number, - unsigned int gate_src) -{ - const struct dio200_board *board = dev->board_ptr; - struct dio200_subdev_8254 *subpriv = s->private; - unsigned char byte; - - if (!board->has_clk_gat_sce) - return -1; - if (gate_src > (board->is_pcie ? 31 : 7)) - return -1; - - subpriv->gate_src[counter_number] = gate_src; - byte = gat_sce((subpriv->ofs >> 2) & 1, counter_number, gate_src); - dio200_write8(dev, DIO200_GAT_SCE(subpriv->ofs >> 3), byte); - - return 0; -} - -static int dio200_subdev_8254_get_gate_src(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int counter_number) -{ - const struct dio200_board *board = dev->board_ptr; - struct dio200_subdev_8254 *subpriv = s->private; - - if (!board->has_clk_gat_sce) - return -1; - - return subpriv->gate_src[counter_number]; -} - -static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev, +static void dio200_subdev_8254_set_gate_src(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int counter_number, - unsigned int clock_src) + unsigned int chan, + unsigned int src) { - const struct dio200_board *board = dev->board_ptr; - struct dio200_subdev_8254 *subpriv = s->private; - unsigned char byte; - - if (!board->has_clk_gat_sce) - return -1; - if (clock_src > (board->is_pcie ? 31 : 7)) - return -1; - - subpriv->clock_src[counter_number] = clock_src; - byte = clk_sce((subpriv->ofs >> 2) & 1, counter_number, clock_src); - dio200_write8(dev, DIO200_CLK_SCE(subpriv->ofs >> 3), byte); + unsigned int offset = dio200_subdev_8254_offset(dev, s); - return 0; + dio200_write8(dev, DIO200_GAT_SCE(offset >> 3), + gat_sce((offset >> 2) & 1, chan, src)); } -static int dio200_subdev_8254_get_clock_src(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int counter_number, - unsigned int *period_ns) +static void dio200_subdev_8254_set_clock_src(struct comedi_device *dev, + struct comedi_subdevice *s, + unsigned int chan, + unsigned int src) { - const struct dio200_board *board = dev->board_ptr; - struct dio200_subdev_8254 *subpriv = s->private; - unsigned clock_src; - - if (!board->has_clk_gat_sce) - return -1; + unsigned int offset = dio200_subdev_8254_offset(dev, s); - clock_src = subpriv->clock_src[counter_number]; - *period_ns = clock_period[clock_src]; - return clock_src; + dio200_write8(dev, DIO200_CLK_SCE(offset >> 3), + clk_sce((offset >> 2) & 1, chan, src)); } static int dio200_subdev_8254_config(struct comedi_device *dev, @@ -634,51 +516,44 @@ static int dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - int ret = 0; - int chan = CR_CHAN(insn->chanspec); + const struct dio200_board *board = dev->board_ptr; + struct comedi_8254 *i8254 = s->private; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int max_src = board->is_pcie ? 31 : 7; + unsigned int src; + + if (!board->has_clk_gat_sce) + return -EINVAL; switch (data[0]) { - case INSN_CONFIG_SET_COUNTER_MODE: - if (data[1] > (I8254_MODE5 | I8254_BCD)) - ret = -EINVAL; - else - dio200_subdev_8254_set_mode(dev, s, chan, data[1]); - break; - case INSN_CONFIG_8254_READ_STATUS: - data[1] = dio200_subdev_8254_status(dev, s, chan); - break; case INSN_CONFIG_SET_GATE_SRC: - ret = dio200_subdev_8254_set_gate_src(dev, s, chan, data[2]); - if (ret < 0) - ret = -EINVAL; + src = data[2]; + if (src > max_src) + return -EINVAL; + + dio200_subdev_8254_set_gate_src(dev, s, chan, src); + i8254->gate_src[chan] = src; break; case INSN_CONFIG_GET_GATE_SRC: - ret = dio200_subdev_8254_get_gate_src(dev, s, chan); - if (ret < 0) { - ret = -EINVAL; - break; - } - data[2] = ret; + data[2] = i8254->gate_src[chan]; break; case INSN_CONFIG_SET_CLOCK_SRC: - ret = dio200_subdev_8254_set_clock_src(dev, s, chan, data[1]); - if (ret < 0) - ret = -EINVAL; + src = data[1]; + if (src > max_src) + return -EINVAL; + + dio200_subdev_8254_set_clock_src(dev, s, chan, src); + i8254->clock_src[chan] = src; break; case INSN_CONFIG_GET_CLOCK_SRC: - ret = dio200_subdev_8254_get_clock_src(dev, s, chan, &data[2]); - if (ret < 0) { - ret = -EINVAL; - break; - } - data[1] = ret; + data[1] = i8254->clock_src[chan]; + data[2] = clock_period[i8254->clock_src[chan]]; break; default: - ret = -EINVAL; - break; + return -EINVAL; } - return ret < 0 ? ret : insn->n; + return insn->n; } static int dio200_subdev_8254_init(struct comedi_device *dev, @@ -686,28 +561,46 @@ static int dio200_subdev_8254_init(struct comedi_device *dev, unsigned int offset) { const struct dio200_board *board = dev->board_ptr; - struct dio200_subdev_8254 *subpriv; - unsigned int chan; + struct comedi_8254 *i8254; + unsigned int regshift; + int chan; + + /* + * PCIe boards need the offset shifted in order to get the + * correct base address of the timer. + */ + if (board->is_pcie) { + offset <<= 3; + regshift = 3; + } else { + regshift = 0; + } - subpriv = comedi_alloc_spriv(s, sizeof(*subpriv)); - if (!subpriv) + if (dev->mmio) + i8254 = comedi_8254_mm_init(dev->mmio + offset, + 0, I8254_IO8, regshift); + else + i8254 = comedi_8254_init(dev->iobase + offset, + 0, I8254_IO8, regshift); + if (!i8254) return -ENOMEM; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 3; - s->maxdata = 0xFFFF; - s->insn_read = dio200_subdev_8254_read; - s->insn_write = dio200_subdev_8254_write; - s->insn_config = dio200_subdev_8254_config; + comedi_8254_subdevice_init(s, i8254); - subpriv->ofs = offset; + i8254->insn_config = dio200_subdev_8254_config; + + /* + * There could be multiple timers so this driver does not + * use dev->pacer to save the i8254 pointer. Instead, + * comedi_8254_subdevice_init() saved the i8254 pointer in + * s->private. Set the runflag bit so that the core will + * automatically free it when the driver is detached. + */ + s->runflags |= COMEDI_SRF_FREE_SPRIV; /* Initialize channels. */ - for (chan = 0; chan < 3; chan++) { - dio200_subdev_8254_set_mode(dev, s, chan, - I8254_MODE0 | I8254_BINARY); - if (board->has_clk_gat_sce) { + if (board->has_clk_gat_sce) { + for (chan = 0; chan < 3; chan++) { /* Gate source 0 is VCC (logic 1). */ dio200_subdev_8254_set_gate_src(dev, s, chan, 0); /* Clock source 0 is the dedicated clock input. */ diff --git a/drivers/staging/comedi/drivers/comedi_8254.h b/drivers/staging/comedi/drivers/comedi_8254.h index 54f2bf8d5bf6..d89f6d94f8aa 100644 --- a/drivers/staging/comedi/drivers/comedi_8254.h +++ b/drivers/staging/comedi/drivers/comedi_8254.h @@ -71,6 +71,8 @@ * #next_div: next divisor for single counter * @next_div1: next divisor to use for first cascaded counter * @next_div2: next divisor to use for second cascaded counter + * @clock_src; current clock source for each counter (driver specific) + * @gate_src; current gate source for each counter (driver specific) * @busy: flags used to indicate that a counter is "busy" * @insn_config: driver specific (*insn_config) callback */ @@ -86,6 +88,8 @@ struct comedi_8254 { unsigned int next_div; unsigned int next_div1; unsigned int next_div2; + unsigned int clock_src[3]; + unsigned int gate_src[3]; bool busy[3]; int (*insn_config)(struct comedi_device *, struct comedi_subdevice *s, -- cgit v1.2.3 From c0cfeca1a80efbb7691961d4ac31af30c559f976 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:58:02 -0700 Subject: staging: comedi: ni_labpc_common: convert driver to use the comedi_8254 module This driver uses an 8254 timer to generate the pacer clock used for analog input data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timer. The hardware actually has two 8254 devices. Timer B0 is the master for timed conversions, timer B1 sets the scan pacing, and tmer A0 sets the conversion pacing. For the conversion, dev->pacer is used for the "B" timers and a new private data member, dev->counter, is used for the "A" timers. All the divisor values are stored in the dev->pacer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/ni_labpc.c | 1 + drivers/staging/comedi/drivers/ni_labpc.h | 16 +- drivers/staging/comedi/drivers/ni_labpc_common.c | 182 +++++++++++------------ drivers/staging/comedi/drivers/ni_labpc_cs.c | 14 +- drivers/staging/comedi/drivers/ni_labpc_pci.c | 8 +- 6 files changed, 111 insertions(+), 111 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index ebda03cd308d..737994a82c62 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1292,6 +1292,7 @@ config COMEDI_ISADMA config COMEDI_NI_LABPC tristate + select COMEDI_8254 select COMEDI_8255 config COMEDI_NI_LABPC_ISADMA diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index a916047791b8..51e5e942b442 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -105,6 +105,7 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void labpc_detach(struct comedi_device *dev) { labpc_free_dma_chan(dev); + labpc_common_detach(dev); comedi_legacy_detach(dev); } diff --git a/drivers/staging/comedi/drivers/ni_labpc.h b/drivers/staging/comedi/drivers/ni_labpc.h index be89ae479afc..83f878adbd53 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.h +++ b/drivers/staging/comedi/drivers/ni_labpc.h @@ -36,6 +36,7 @@ struct labpc_boardinfo { struct labpc_private { struct comedi_isadma *dma; + struct comedi_8254 *counter; /* number of data points left to be taken */ unsigned long long count; @@ -49,20 +50,6 @@ struct labpc_private { /* store last read of board status registers */ unsigned int stat1; unsigned int stat2; - /* - * value to load into board's counter a0 (conversion pacing) for timed - * conversions - */ - unsigned int divisor_a0; - /* - * value to load into board's counter b0 (master) for timed conversions - */ - unsigned int divisor_b0; - /* - * value to load into board's counter b1 (scan pacing) for timed - * conversions - */ - unsigned int divisor_b1; /* we are using dma/fifo-half-full/etc. */ enum transfer_type current_transfer; @@ -77,5 +64,6 @@ struct labpc_private { int labpc_common_attach(struct comedi_device *dev, unsigned int irq, unsigned long isr_flags); +void labpc_common_detach(struct comedi_device *dev); #endif /* _NI_LABPC_H */ diff --git a/drivers/staging/comedi/drivers/ni_labpc_common.c b/drivers/staging/comedi/drivers/ni_labpc_common.c index 084c89c36c37..74518c5645af 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_common.c +++ b/drivers/staging/comedi/drivers/ni_labpc_common.c @@ -20,10 +20,11 @@ #include #include #include +#include #include "../comedidev.h" -#include "8253.h" +#include "comedi_8254.h" #include "8255.h" #include "comedi_fc.h" #include "ni_labpc.h" @@ -108,32 +109,6 @@ static void labpc_writeb(struct comedi_device *dev, writeb(byte, dev->mmio + reg); } -static void labpc_counter_load(struct comedi_device *dev, - unsigned long reg, - unsigned int counter_number, - unsigned int count, - unsigned int mode) -{ - if (dev->mmio) { - i8254_mm_set_mode(dev->mmio + reg, 0, counter_number, mode); - i8254_mm_write(dev->mmio + reg, 0, counter_number, count); - } else { - i8254_set_mode(dev->iobase + reg, 0, counter_number, mode); - i8254_write(dev->iobase + reg, 0, counter_number, count); - } -} - -static void labpc_counter_set_mode(struct comedi_device *dev, - unsigned long reg, - unsigned int counter_number, - unsigned int mode) -{ - if (dev->mmio) - i8254_mm_set_mode(dev->mmio + reg, 0, counter_number, mode); - else - i8254_set_mode(dev->iobase + reg, 0, counter_number, mode); -} - static int labpc_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { struct labpc_private *devpriv = dev->private; @@ -284,7 +259,7 @@ static int labpc_ai_insn_read(struct comedi_device *dev, devpriv->write_byte(dev, devpriv->cmd4, CMD4_REG); /* initialize pacer counter to prevent any problems */ - labpc_counter_set_mode(dev, COUNTER_A_BASE_REG, 0, I8254_MODE2); + comedi_8254_set_mode(devpriv->counter, 0, I8254_MODE2 | I8254_BINARY); labpc_clear_adc_fifo(dev); @@ -367,83 +342,79 @@ static void labpc_set_ai_scan_period(struct comedi_cmd *cmd, static void labpc_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd, enum scan_mode mode) { - struct labpc_private *devpriv = dev->private; + struct comedi_8254 *pacer = dev->pacer; + unsigned int convert_period = labpc_ai_convert_period(cmd, mode); + unsigned int scan_period = labpc_ai_scan_period(cmd, mode); unsigned int base_period; - unsigned int scan_period; - unsigned int convert_period; /* - * if both convert and scan triggers are TRIG_TIMER, then they - * both rely on counter b0 + * If both convert and scan triggers are TRIG_TIMER, then they + * both rely on counter b0. If only one TRIG_TIMER is used, we + * can use the generic cascaded timing functions. */ - convert_period = labpc_ai_convert_period(cmd, mode); - scan_period = labpc_ai_scan_period(cmd, mode); if (convert_period && scan_period) { /* - * pick the lowest b0 divisor value we can (for maximum input + * pick the lowest divisor value we can (for maximum input * clock speed on convert and scan counters) */ - devpriv->divisor_b0 = (scan_period - 1) / - (I8254_OSC_BASE_2MHZ * 0x10000) + 1; + pacer->next_div1 = (scan_period - 1) / + (pacer->osc_base * I8254_MAX_COUNT) + 1; - cfc_check_trigger_arg_min(&devpriv->divisor_b0, 2); - cfc_check_trigger_arg_max(&devpriv->divisor_b0, 0x10000); + cfc_check_trigger_arg_min(&pacer->next_div1, 2); + cfc_check_trigger_arg_max(&pacer->next_div1, I8254_MAX_COUNT); - base_period = I8254_OSC_BASE_2MHZ * devpriv->divisor_b0; + base_period = pacer->osc_base * pacer->next_div1; /* set a0 for conversion frequency and b1 for scan frequency */ switch (cmd->flags & CMDF_ROUND_MASK) { default: case CMDF_ROUND_NEAREST: - devpriv->divisor_a0 = DIV_ROUND_CLOSEST(convert_period, - base_period); - devpriv->divisor_b1 = DIV_ROUND_CLOSEST(scan_period, - base_period); + pacer->next_div = DIV_ROUND_CLOSEST(convert_period, + base_period); + pacer->next_div2 = DIV_ROUND_CLOSEST(scan_period, + base_period); break; case CMDF_ROUND_UP: - devpriv->divisor_a0 = DIV_ROUND_UP(convert_period, - base_period); - devpriv->divisor_b1 = DIV_ROUND_UP(scan_period, - base_period); + pacer->next_div = DIV_ROUND_UP(convert_period, + base_period); + pacer->next_div2 = DIV_ROUND_UP(scan_period, + base_period); break; case CMDF_ROUND_DOWN: - devpriv->divisor_a0 = convert_period / base_period; - devpriv->divisor_b1 = scan_period / base_period; + pacer->next_div = convert_period / base_period; + pacer->next_div2 = scan_period / base_period; break; } /* make sure a0 and b1 values are acceptable */ - cfc_check_trigger_arg_min(&devpriv->divisor_a0, 2); - cfc_check_trigger_arg_max(&devpriv->divisor_a0, 0x10000); - cfc_check_trigger_arg_min(&devpriv->divisor_b1, 2); - cfc_check_trigger_arg_max(&devpriv->divisor_b1, 0x10000); + cfc_check_trigger_arg_min(&pacer->next_div, 2); + cfc_check_trigger_arg_max(&pacer->next_div, I8254_MAX_COUNT); + cfc_check_trigger_arg_min(&pacer->next_div2, 2); + cfc_check_trigger_arg_max(&pacer->next_div2, I8254_MAX_COUNT); + /* write corrected timings to command */ labpc_set_ai_convert_period(cmd, mode, - base_period * devpriv->divisor_a0); + base_period * pacer->next_div); labpc_set_ai_scan_period(cmd, mode, - base_period * devpriv->divisor_b1); - /* - * if only one TRIG_TIMER is used, we can employ the generic - * cascaded timing functions - */ + base_period * pacer->next_div2); } else if (scan_period) { /* * calculate cascaded counter values * that give desired scan timing + * (pacer->next_div2 / pacer->next_div1) */ - i8253_cascade_ns_to_timer(I8254_OSC_BASE_2MHZ, - &devpriv->divisor_b1, - &devpriv->divisor_b0, - &scan_period, cmd->flags); + comedi_8254_cascade_ns_to_timer(pacer, &scan_period, + cmd->flags); labpc_set_ai_scan_period(cmd, mode, scan_period); } else if (convert_period) { /* * calculate cascaded counter values * that give desired conversion timing + * (pacer->next_div / pacer->next_div1) */ - i8253_cascade_ns_to_timer(I8254_OSC_BASE_2MHZ, - &devpriv->divisor_a0, - &devpriv->divisor_b0, - &convert_period, cmd->flags); + comedi_8254_cascade_ns_to_timer(pacer, &convert_period, + cmd->flags); + /* transfer div2 value so correct timer gets updated */ + pacer->next_div = pacer->next_div2; labpc_set_ai_convert_period(cmd, mode, convert_period); } } @@ -667,11 +638,12 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) * load counter a1 with count of 3 * (pc+ manual says this is minimum allowed) using mode 0 */ - labpc_counter_load(dev, COUNTER_A_BASE_REG, - 1, 3, I8254_MODE0); + comedi_8254_load(devpriv->counter, 1, + 3, I8254_MODE0 | I8254_BINARY); } else { /* just put counter a1 in mode 0 to set its output low */ - labpc_counter_set_mode(dev, COUNTER_A_BASE_REG, 1, I8254_MODE0); + comedi_8254_set_mode(devpriv->counter, 1, + I8254_MODE0 | I8254_BINARY); } /* figure out what method we will use to transfer data */ @@ -712,27 +684,24 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->convert_src == TRIG_TIMER || cmd->scan_begin_src == TRIG_TIMER) { - /* set up pacing */ - labpc_adc_timing(dev, cmd, mode); - /* load counter b0 in mode 3 */ - labpc_counter_load(dev, COUNTER_B_BASE_REG, - 0, devpriv->divisor_b0, I8254_MODE3); - } - /* set up conversion pacing */ - if (labpc_ai_convert_period(cmd, mode)) { - /* load counter a0 in mode 2 */ - labpc_counter_load(dev, COUNTER_A_BASE_REG, - 0, devpriv->divisor_a0, I8254_MODE2); - } else { - /* initialize pacer counter to prevent any problems */ - labpc_counter_set_mode(dev, COUNTER_A_BASE_REG, 0, I8254_MODE2); - } + struct comedi_8254 *pacer = dev->pacer; + struct comedi_8254 *counter = devpriv->counter; + + comedi_8254_update_divisors(pacer); + + /* set up pacing */ + comedi_8254_load(pacer, 0, pacer->divisor1, + I8254_MODE3 | I8254_BINARY); - /* set up scan pacing */ - if (labpc_ai_scan_period(cmd, mode)) { - /* load counter b1 in mode 2 */ - labpc_counter_load(dev, COUNTER_B_BASE_REG, - 1, devpriv->divisor_b1, I8254_MODE2); + /* set up conversion pacing */ + comedi_8254_set_mode(counter, 0, I8254_MODE2 | I8254_BINARY); + if (labpc_ai_convert_period(cmd, mode)) + comedi_8254_write(counter, 0, pacer->divisor); + + /* set up scan pacing */ + if (labpc_ai_scan_period(cmd, mode)) + comedi_8254_load(pacer, 1, pacer->divisor2, + I8254_MODE2 | I8254_BINARY); } labpc_clear_adc_fifo(dev); @@ -1237,6 +1206,26 @@ int labpc_common_attach(struct comedi_device *dev, dev->irq = irq; } + if (dev->mmio) { + dev->pacer = comedi_8254_mm_init(dev->mmio + COUNTER_B_BASE_REG, + I8254_OSC_BASE_2MHZ, + I8254_IO8, 0); + devpriv->counter = comedi_8254_mm_init(dev->mmio + + COUNTER_A_BASE_REG, + I8254_OSC_BASE_2MHZ, + I8254_IO8, 0); + } else { + dev->pacer = comedi_8254_init(dev->iobase + COUNTER_B_BASE_REG, + I8254_OSC_BASE_2MHZ, + I8254_IO8, 0); + devpriv->counter = comedi_8254_init(dev->iobase + + COUNTER_A_BASE_REG, + I8254_OSC_BASE_2MHZ, + I8254_IO8, 0); + } + if (!dev->pacer || !devpriv->counter) + return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 5); if (ret) return ret; @@ -1333,6 +1322,15 @@ int labpc_common_attach(struct comedi_device *dev, } EXPORT_SYMBOL_GPL(labpc_common_attach); +void labpc_common_detach(struct comedi_device *dev) +{ + struct labpc_private *devpriv = dev->private; + + if (devpriv) + kfree(devpriv->counter); +} +EXPORT_SYMBOL_GPL(labpc_common_detach); + static int __init labpc_common_init(void) { return 0; diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 746c4cd9978d..a1c69ac075d5 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -68,8 +68,8 @@ static const struct labpc_boardinfo labpc_cs_boards[] = { }, }; -static int labpc_auto_attach(struct comedi_device *dev, - unsigned long context) +static int labpc_cs_auto_attach(struct comedi_device *dev, + unsigned long context) { struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); int ret; @@ -90,11 +90,17 @@ static int labpc_auto_attach(struct comedi_device *dev, return labpc_common_attach(dev, link->irq, IRQF_SHARED); } +static void labpc_cs_detach(struct comedi_device *dev) +{ + labpc_common_detach(dev); + comedi_pcmcia_disable(dev); +} + static struct comedi_driver driver_labpc_cs = { .driver_name = "ni_labpc_cs", .module = THIS_MODULE, - .auto_attach = labpc_auto_attach, - .detach = comedi_pcmcia_disable, + .auto_attach = labpc_cs_auto_attach, + .detach = labpc_cs_detach, }; static int labpc_cs_attach(struct pcmcia_device *link) diff --git a/drivers/staging/comedi/drivers/ni_labpc_pci.c b/drivers/staging/comedi/drivers/ni_labpc_pci.c index 0407ff681dfd..245c59bbaef8 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_pci.c +++ b/drivers/staging/comedi/drivers/ni_labpc_pci.c @@ -103,11 +103,17 @@ static int labpc_pci_auto_attach(struct comedi_device *dev, return labpc_common_attach(dev, pcidev->irq, IRQF_SHARED); } +static void labpc_pci_detach(struct comedi_device *dev) +{ + labpc_common_detach(dev); + comedi_pci_detach(dev); +} + static struct comedi_driver labpc_pci_comedi_driver = { .driver_name = "labpc_pci", .module = THIS_MODULE, .auto_attach = labpc_pci_auto_attach, - .detach = comedi_pci_detach, + .detach = labpc_pci_detach, }; static const struct pci_device_id labpc_pci_table[] = { -- cgit v1.2.3 From bca3a6d182b1deae02e5cbc05e727c75427e82ee Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 23 Feb 2015 14:58:03 -0700 Subject: staging: comedi: 8253.h: remove unused header All the comedi drivers have been converted to use the comedi_8254 module to provide support for the 8254 timers. Remove this unused header. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8253.h | 347 ---------------------------------- 1 file changed, 347 deletions(-) delete mode 100644 drivers/staging/comedi/drivers/8253.h (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/8253.h b/drivers/staging/comedi/drivers/8253.h deleted file mode 100644 index 51b9c8d279c0..000000000000 --- a/drivers/staging/comedi/drivers/8253.h +++ /dev/null @@ -1,347 +0,0 @@ -/* - * comedi/drivers/8253.h - * Header file for 8253 - * - * COMEDI - Linux Control and Measurement Device Interface - * Copyright (C) 2000 David A. Schleef - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _8253_H -#define _8253_H - -#include "../comedi.h" - -/* - * Common oscillator base values in nanoseconds - */ -#define I8254_OSC_BASE_10MHZ 100 -#define I8254_OSC_BASE_5MHZ 200 -#define I8254_OSC_BASE_4MHZ 250 -#define I8254_OSC_BASE_2MHZ 500 -#define I8254_OSC_BASE_1MHZ 1000 - -static inline void i8253_cascade_ns_to_timer(int i8253_osc_base, - unsigned int *d1, - unsigned int *d2, - unsigned int *nanosec, - unsigned int flags) -{ - unsigned int divider; - unsigned int div1, div2; - unsigned int div1_glb, div2_glb, ns_glb; - unsigned int div1_lub, div2_lub, ns_lub; - unsigned int ns; - unsigned int start; - unsigned int ns_low, ns_high; - static const unsigned int max_count = 0x10000; - /* - * exit early if everything is already correct (this can save time - * since this function may be called repeatedly during command tests - * and execution) - */ - div1 = *d1 ? *d1 : max_count; - div2 = *d2 ? *d2 : max_count; - divider = div1 * div2; - if (div1 * div2 * i8253_osc_base == *nanosec && - div1 > 1 && div1 <= max_count && div2 > 1 && div2 <= max_count && - /* check for overflow */ - divider > div1 && divider > div2 && - divider * i8253_osc_base > divider && - divider * i8253_osc_base > i8253_osc_base) { - return; - } - - divider = *nanosec / i8253_osc_base; - - div1_lub = div2_lub = 0; - div1_glb = div2_glb = 0; - - ns_glb = 0; - ns_lub = 0xffffffff; - - div2 = max_count; - start = divider / div2; - if (start < 2) - start = 2; - for (div1 = start; div1 <= divider / div1 + 1 && div1 <= max_count; - div1++) { - for (div2 = divider / div1; - div1 * div2 <= divider + div1 + 1 && div2 <= max_count; - div2++) { - ns = i8253_osc_base * div1 * div2; - if (ns <= *nanosec && ns > ns_glb) { - ns_glb = ns; - div1_glb = div1; - div2_glb = div2; - } - if (ns >= *nanosec && ns < ns_lub) { - ns_lub = ns; - div1_lub = div1; - div2_lub = div2; - } - } - } - - switch (flags & CMDF_ROUND_MASK) { - case CMDF_ROUND_NEAREST: - default: - ns_high = div1_lub * div2_lub * i8253_osc_base; - ns_low = div1_glb * div2_glb * i8253_osc_base; - if (ns_high - *nanosec < *nanosec - ns_low) { - div1 = div1_lub; - div2 = div2_lub; - } else { - div1 = div1_glb; - div2 = div2_glb; - } - break; - case CMDF_ROUND_UP: - div1 = div1_lub; - div2 = div2_lub; - break; - case CMDF_ROUND_DOWN: - div1 = div1_glb; - div2 = div2_glb; - break; - } - - *nanosec = div1 * div2 * i8253_osc_base; - /* masking is done since counter maps zero to 0x10000 */ - *d1 = div1 & 0xffff; - *d2 = div2 & 0xffff; -} - -#ifndef CMDTEST -/* - * i8254_load programs 8254 counter chip. It should also work for the 8253. - * base_address is the lowest io address - * for the chip (the address of counter 0). - * counter_number is the counter you want to load (0,1 or 2) - * count is the number to load into the counter. - * - * You probably want to use mode 2. - * - * Use i8254_mm_load() if you board uses memory-mapped io, it is - * the same as i8254_load() except it uses writeb() instead of outb(). - * - * Neither i8254_load() or i8254_read() do their loading/reading - * atomically. The 16 bit read/writes are performed with two successive - * 8 bit read/writes. So if two parts of your driver do a load/read on - * the same counter, it may be necessary to protect these functions - * with a spinlock. - * - * FMH - */ - -#define i8254_control_reg 3 - -static inline int i8254_load(unsigned long base_address, unsigned int regshift, - unsigned int counter_number, unsigned int count, - unsigned int mode) -{ - unsigned int byte; - - if (counter_number > 2) - return -1; - if (count > 0xffff) - return -1; - if (mode > 5) - return -1; - if ((mode == 2 || mode == 3) && count == 1) - return -1; - - byte = counter_number << 6; - byte |= 0x30; /* load low then high byte */ - byte |= (mode << 1); /* set counter mode */ - outb(byte, base_address + (i8254_control_reg << regshift)); - byte = count & 0xff; /* lsb of counter value */ - outb(byte, base_address + (counter_number << regshift)); - byte = (count >> 8) & 0xff; /* msb of counter value */ - outb(byte, base_address + (counter_number << regshift)); - - return 0; -} - -static inline int i8254_mm_load(void __iomem *base_address, - unsigned int regshift, - unsigned int counter_number, - unsigned int count, - unsigned int mode) -{ - unsigned int byte; - - if (counter_number > 2) - return -1; - if (count > 0xffff) - return -1; - if (mode > 5) - return -1; - if ((mode == 2 || mode == 3) && count == 1) - return -1; - - byte = counter_number << 6; - byte |= 0x30; /* load low then high byte */ - byte |= (mode << 1); /* set counter mode */ - writeb(byte, base_address + (i8254_control_reg << regshift)); - byte = count & 0xff; /* lsb of counter value */ - writeb(byte, base_address + (counter_number << regshift)); - byte = (count >> 8) & 0xff; /* msb of counter value */ - writeb(byte, base_address + (counter_number << regshift)); - - return 0; -} - -/* Returns 16 bit counter value, should work for 8253 also. */ -static inline int i8254_read(unsigned long base_address, unsigned int regshift, - unsigned int counter_number) -{ - unsigned int byte; - int ret; - - if (counter_number > 2) - return -1; - - /* latch counter */ - byte = counter_number << 6; - outb(byte, base_address + (i8254_control_reg << regshift)); - - /* read lsb */ - ret = inb(base_address + (counter_number << regshift)); - /* read msb */ - ret += inb(base_address + (counter_number << regshift)) << 8; - - return ret; -} - -static inline int i8254_mm_read(void __iomem *base_address, - unsigned int regshift, - unsigned int counter_number) -{ - unsigned int byte; - int ret; - - if (counter_number > 2) - return -1; - - /* latch counter */ - byte = counter_number << 6; - writeb(byte, base_address + (i8254_control_reg << regshift)); - - /* read lsb */ - ret = readb(base_address + (counter_number << regshift)); - /* read msb */ - ret += readb(base_address + (counter_number << regshift)) << 8; - - return ret; -} - -/* Loads 16 bit initial counter value, should work for 8253 also. */ -static inline void i8254_write(unsigned long base_address, - unsigned int regshift, - unsigned int counter_number, unsigned int count) -{ - unsigned int byte; - - if (counter_number > 2) - return; - - byte = count & 0xff; /* lsb of counter value */ - outb(byte, base_address + (counter_number << regshift)); - byte = (count >> 8) & 0xff; /* msb of counter value */ - outb(byte, base_address + (counter_number << regshift)); -} - -static inline void i8254_mm_write(void __iomem *base_address, - unsigned int regshift, - unsigned int counter_number, - unsigned int count) -{ - unsigned int byte; - - if (counter_number > 2) - return; - - byte = count & 0xff; /* lsb of counter value */ - writeb(byte, base_address + (counter_number << regshift)); - byte = (count >> 8) & 0xff; /* msb of counter value */ - writeb(byte, base_address + (counter_number << regshift)); -} - -/* - * Set counter mode, should work for 8253 also. - * Note: the 'mode' value is different to that for i8254_load() and comes - * from the INSN_CONFIG_8254_SET_MODE command: - * I8254_MODE0, I8254_MODE1, ..., I8254_MODE5 - * OR'ed with: - * I8254_BCD, I8254_BINARY - */ -static inline int i8254_set_mode(unsigned long base_address, - unsigned int regshift, - unsigned int counter_number, unsigned int mode) -{ - unsigned int byte; - - if (counter_number > 2) - return -1; - if (mode > (I8254_MODE5 | I8254_BCD)) - return -1; - - byte = counter_number << 6; - byte |= 0x30; /* load low then high byte */ - byte |= mode; /* set counter mode and BCD|binary */ - outb(byte, base_address + (i8254_control_reg << regshift)); - - return 0; -} - -static inline int i8254_mm_set_mode(void __iomem *base_address, - unsigned int regshift, - unsigned int counter_number, - unsigned int mode) -{ - unsigned int byte; - - if (counter_number > 2) - return -1; - if (mode > (I8254_MODE5 | I8254_BCD)) - return -1; - - byte = counter_number << 6; - byte |= 0x30; /* load low then high byte */ - byte |= mode; /* set counter mode and BCD|binary */ - writeb(byte, base_address + (i8254_control_reg << regshift)); - - return 0; -} - -static inline int i8254_status(unsigned long base_address, - unsigned int regshift, - unsigned int counter_number) -{ - outb(0xE0 | (2 << counter_number), - base_address + (i8254_control_reg << regshift)); - return inb(base_address + (counter_number << regshift)); -} - -static inline int i8254_mm_status(void __iomem *base_address, - unsigned int regshift, - unsigned int counter_number) -{ - writeb(0xE0 | (2 << counter_number), - base_address + (i8254_control_reg << regshift)); - return readb(base_address + (counter_number << regshift)); -} - -#endif - -#endif -- cgit v1.2.3 From 532a411e8b54418c2aed9e20f02b359002bb7e44 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 25 Feb 2015 16:28:38 -0700 Subject: staging: comedi: cb_pcimdas: fix analog input channel configuration The hardware uses a switch on the board to set the number of analog input channels to either 16 single-ended or 8 differential channels. Currently the switch setting is checked for every (*insn_read) operation to validate the channel number. Check the switch setting during the driver attach and initialize the subdevice accordingly. This allows the core to handle the validation. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 34 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 70dd2c9eecdb..ddaa61c1cc31 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -109,20 +109,10 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, unsigned int d; int chan = CR_CHAN(insn->chanspec); unsigned short chanlims; - int maxchans; int ret; /* only support sw initiated reads from a single channel */ - /* check channel number */ - if ((inb(devpriv->BADR3 + 2) & 0x20) == 0) /* differential mode */ - maxchans = s->n_chan / 2; - else - maxchans = s->n_chan; - - if (chan > (maxchans - 1)) - return -ETIMEDOUT; /* *** Wrong error code. Fixme. */ - /* configure for sw initiated read */ d = inb(devpriv->BADR3 + 5); if ((d & 0x03) > 0) { /* only reset if needed. */ @@ -181,6 +171,20 @@ static int cb_pcimdas_ao_insn_write(struct comedi_device *dev, return insn->n; } +static bool cb_pcimdas_is_ai_se(struct comedi_device *dev) +{ + struct cb_pcimdas_private *devpriv = dev->private; + unsigned int status; + + /* + * The number of Analog Input channels is set with the + * Analog Input Mode Switch on the board. The board can + * have 16 single-ended or 8 differential channels. + */ + status = inb(devpriv->BADR3 + 2); + return status & 0x20; +} + static int cb_pcimdas_auto_attach(struct comedi_device *dev, unsigned long context_unused) { @@ -209,8 +213,14 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, /* dev->read_subdev=s; */ /* analog input subdevice */ s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = 16; + s->subdev_flags = SDF_READABLE; + if (cb_pcimdas_is_ai_se(dev)) { + s->subdev_flags |= SDF_GROUND; + s->n_chan = 16; + } else { + s->subdev_flags |= SDF_DIFF; + s->n_chan = 8; + } s->maxdata = 0xffff; s->range_table = &range_unknown; s->len_chanlist = 1; /* This is the maximum chanlist length that */ -- cgit v1.2.3 From c7549d770a27cbdb521ea9ed646c1fc242d77a0a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 25 Feb 2015 16:28:39 -0700 Subject: staging: comedi: cb_pcimdas: support analog input programmable ranges The hardware uses a switch on the board to select if the analog inputs are bipolar or uinipolar. The gain is programmable to allow the following input ranges: Gain Bipolar Unipolar 0 +/-10V 0 to 10V 1 +/-5V 0 to 5V 2 +/-2.5V 0 to 2.5V 3 +/-1.25V 0 to 1.25V Add the necessary code to the driver to allow the user to select the desired range. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 42 ++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index ddaa61c1cc31..5d08ca439bc9 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -74,6 +74,24 @@ #define RESID_COUNT_H 13 #define RESID_COUNT_L 14 +static const struct comedi_lrange cb_pcimdas_ai_bip_range = { + 4, { + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25) + } +}; + +static const struct comedi_lrange cb_pcimdas_ai_uni_range = { + 4, { + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } +}; + /* * this structure is for data unique to this hardware driver. If * several hardware drivers keep similar information in this structure, @@ -105,9 +123,10 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct cb_pcimdas_private *devpriv = dev->private; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); int n; unsigned int d; - int chan = CR_CHAN(insn->chanspec); unsigned short chanlims; int ret; @@ -123,8 +142,8 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, /* set bursting off, conversions on */ outb(0x01, devpriv->BADR3 + 6); - /* set range to 10V. UP/BP is controlled by a switch on the board */ - outb(0x00, devpriv->BADR3 + 7); + /* set range */ + outb(range, devpriv->BADR3 + 7); /* * write channel limits to multiplexer, set Low (bits 0-3) and @@ -185,6 +204,20 @@ static bool cb_pcimdas_is_ai_se(struct comedi_device *dev) return status & 0x20; } +static bool cb_pcimdas_is_ai_uni(struct comedi_device *dev) +{ + struct cb_pcimdas_private *devpriv = dev->private; + unsigned int status; + + /* + * The Analog Input range polarity is set with the + * Analog Input Polarity Switch on the board. The + * inputs can be set to Unipolar or Bipolar ranges. + */ + status = inb(devpriv->BADR3 + 2); + return status & 0x40; +} + static int cb_pcimdas_auto_attach(struct comedi_device *dev, unsigned long context_unused) { @@ -222,7 +255,8 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, s->n_chan = 8; } s->maxdata = 0xffff; - s->range_table = &range_unknown; + s->range_table = cb_pcimdas_is_ai_uni(dev) ? &cb_pcimdas_ai_uni_range + : &cb_pcimdas_ai_bip_range; s->len_chanlist = 1; /* This is the maximum chanlist length that */ /* the board can handle */ s->insn_read = cb_pcimdas_ai_rinsn; -- cgit v1.2.3 From e3bd4c8e0f278dad527c2b5f6b0d895dfba9af31 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 25 Feb 2015 16:28:40 -0700 Subject: staging: comedi: cb_pcimdas: define the register map Add defines for the registers and bits. Use the defines to remove the "magic" numbers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 133 ++++++++++++++++++---------- 1 file changed, 86 insertions(+), 47 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 5d08ca439bc9..b0cc4f59789d 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -50,29 +50,73 @@ #include "plx9052.h" #include "8255.h" -/* Registers for the PCIM-DAS1602/16 and PCIe-DAS1602/16 */ - -/* DAC Offsets */ -#define ADC_TRIG 0 -#define DAC0_OFFSET 2 -#define DAC1_OFFSET 4 - -/* AI and Counter Constants */ -#define MUX_LIMITS 0 -#define MAIN_CONN_DIO 1 -#define ADC_STAT 2 -#define ADC_CONV_STAT 3 -#define ADC_INT 4 -#define ADC_PACER 5 -#define BURST_MODE 6 -#define PROG_GAIN 7 -#define CLK8254_1_DATA 8 -#define CLK8254_2_DATA 9 -#define CLK8254_3_DATA 10 -#define CLK8254_CONTROL 11 -#define USER_COUNTER 12 -#define RESID_COUNT_H 13 -#define RESID_COUNT_L 14 +/* + * PCI Bar 1 Register map + * see plx9052.h for register and bit defines + */ + +/* + * PCI Bar 2 Register map (devpriv->daqio) + */ +#define PCIMDAS_AI_REG 0x00 +#define PCIMDAS_AI_SOFTTRIG_REG 0x00 +#define PCIMDAS_AO_REG(x) (0x02 + ((x) * 2)) + +/* + * PCI Bar 3 Register map (devpriv->BADR3) + */ +#define PCIMDAS_MUX_REG 0x00 +#define PCIMDAS_MUX(_lo, _hi) ((_lo) | ((_hi) << 4)) +#define PCIMDAS_DI_DO_REG 0x01 +#define PCIMDAS_STATUS_REG 0x02 +#define PCIMDAS_STATUS_EOC BIT(7) +#define PCIMDAS_STATUS_UB BIT(6) +#define PCIMDAS_STATUS_MUX BIT(5) +#define PCIMDAS_STATUS_CLK BIT(4) +#define PCIMDAS_STATUS_TO_CURR_MUX(x) ((x) & 0xf) +#define PCIMDAS_CONV_STATUS_REG 0x03 +#define PCIMDAS_CONV_STATUS_EOC BIT(7) +#define PCIMDAS_CONV_STATUS_EOB BIT(6) +#define PCIMDAS_CONV_STATUS_EOA BIT(5) +#define PCIMDAS_CONV_STATUS_FNE BIT(4) +#define PCIMDAS_CONV_STATUS_FHF BIT(3) +#define PCIMDAS_CONV_STATUS_OVERRUN BIT(2) +#define PCIMDAS_IRQ_REG 0x04 +#define PCIMDAS_IRQ_INTE BIT(7) +#define PCIMDAS_IRQ_INT BIT(6) +#define PCIMDAS_IRQ_OVERRUN BIT(4) +#define PCIMDAS_IRQ_EOA BIT(3) +#define PCIMDAS_IRQ_EOA_INT_SEL BIT(2) +#define PCIMDAS_IRQ_INTSEL(x) ((x) << 0) +#define PCIMDAS_IRQ_INTSEL_EOC PCIMDAS_IRQ_INTSEL(0) +#define PCIMDAS_IRQ_INTSEL_FNE PCIMDAS_IRQ_INTSEL(1) +#define PCIMDAS_IRQ_INTSEL_EOB PCIMDAS_IRQ_INTSEL(2) +#define PCIMDAS_IRQ_INTSEL_FHF_EOA PCIMDAS_IRQ_INTSEL(3) +#define PCIMDAS_PACER_REG 0x05 +#define PCIMDAS_PACER_GATE_STATUS BIT(6) +#define PCIMDAS_PACER_GATE_POL BIT(5) +#define PCIMDAS_PACER_GATE_LATCH BIT(4) +#define PCIMDAS_PACER_GATE_EN BIT(3) +#define PCIMDAS_PACER_EXT_PACER_POL BIT(2) +#define PCIMDAS_PACER_SRC(x) ((x) << 0) +#define PCIMDAS_PACER_SRC_POLLED PCIMDAS_PACER_SRC(0) +#define PCIMDAS_PACER_SRC_EXT PCIMDAS_PACER_SRC(2) +#define PCIMDAS_PACER_SRC_INT PCIMDAS_PACER_SRC(3) +#define PCIMDAS_PACER_SRC_MASK (3 << 0) +#define PCIMDAS_BURST_REG 0x06 +#define PCIMDAS_BURST_BME BIT(1) +#define PCIMDAS_BURST_CONV_EN BIT(0) +#define PCIMDAS_GAIN_REG 0x07 +#define PCIMDAS_8254_BASE 0x08 +#define PCIMDAS_USER_CNTR_REG 0x0c +#define PCIMDAS_USER_CNTR_CTR1_CLK_SEL BIT(0) +#define PCIMDAS_RESIDUE_MSB_REG 0x0d +#define PCIMDAS_RESIDUE_LSB_REG 0x0e + +/* + * PCI Bar 4 Register map (dev->iobase) + */ +#define PCIMDAS_8255_BASE 0x00 static const struct comedi_lrange cb_pcimdas_ai_bip_range = { 4, { @@ -112,8 +156,8 @@ static int cb_pcimdas_ai_eoc(struct comedi_device *dev, struct cb_pcimdas_private *devpriv = dev->private; unsigned int status; - status = inb(devpriv->BADR3 + 2); - if ((status & 0x80) == 0) + status = inb(devpriv->BADR3 + PCIMDAS_STATUS_REG); + if ((status & PCIMDAS_STATUS_EOC) == 0) return 0; return -EBUSY; } @@ -127,35 +171,31 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, unsigned int range = CR_RANGE(insn->chanspec); int n; unsigned int d; - unsigned short chanlims; int ret; /* only support sw initiated reads from a single channel */ /* configure for sw initiated read */ - d = inb(devpriv->BADR3 + 5); - if ((d & 0x03) > 0) { /* only reset if needed. */ - d = d & 0xfd; - outb(d, devpriv->BADR3 + 5); + d = inb(devpriv->BADR3 + PCIMDAS_PACER_REG); + if ((d & PCIMDAS_PACER_SRC_MASK) != PCIMDAS_PACER_SRC_POLLED) { + d &= ~PCIMDAS_PACER_SRC_MASK; + d |= PCIMDAS_PACER_SRC_POLLED; + outb(d, devpriv->BADR3 + PCIMDAS_PACER_REG); } /* set bursting off, conversions on */ - outb(0x01, devpriv->BADR3 + 6); + outb(PCIMDAS_BURST_CONV_EN, devpriv->BADR3 + PCIMDAS_BURST_REG); /* set range */ - outb(range, devpriv->BADR3 + 7); + outb(range, devpriv->BADR3 + PCIMDAS_GAIN_REG); - /* - * write channel limits to multiplexer, set Low (bits 0-3) and - * High (bits 4-7) channels to chan. - */ - chanlims = chan | (chan << 4); - outb(chanlims, devpriv->BADR3 + 0); + /* set mux for single channel scan */ + outb(PCIMDAS_MUX(chan, chan), devpriv->BADR3 + PCIMDAS_MUX_REG); /* convert n samples */ for (n = 0; n < insn->n; n++) { /* trigger conversion */ - outw(0, devpriv->daqio + 0); + outw(0, devpriv->daqio + PCIMDAS_AI_SOFTTRIG_REG); /* wait for conversion to end */ ret = comedi_timeout(dev, s, insn, cb_pcimdas_ai_eoc, 0); @@ -163,7 +203,7 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, return ret; /* read data */ - data[n] = inw(devpriv->daqio + 0); + data[n] = inw(devpriv->daqio + PCIMDAS_AI_REG); } /* return the number of samples read/written */ @@ -178,12 +218,11 @@ static int cb_pcimdas_ao_insn_write(struct comedi_device *dev, struct cb_pcimdas_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; - unsigned int reg = (chan) ? DAC1_OFFSET : DAC0_OFFSET; int i; for (i = 0; i < insn->n; i++) { val = data[i]; - outw(val, devpriv->daqio + reg); + outw(val, devpriv->daqio + PCIMDAS_AO_REG(chan)); } s->readback[chan] = val; @@ -200,8 +239,8 @@ static bool cb_pcimdas_is_ai_se(struct comedi_device *dev) * Analog Input Mode Switch on the board. The board can * have 16 single-ended or 8 differential channels. */ - status = inb(devpriv->BADR3 + 2); - return status & 0x20; + status = inb(devpriv->BADR3 + PCIMDAS_STATUS_REG); + return status & PCIMDAS_STATUS_MUX; } static bool cb_pcimdas_is_ai_uni(struct comedi_device *dev) @@ -214,8 +253,8 @@ static bool cb_pcimdas_is_ai_uni(struct comedi_device *dev) * Analog Input Polarity Switch on the board. The * inputs can be set to Unipolar or Bipolar ranges. */ - status = inb(devpriv->BADR3 + 2); - return status & 0x40; + status = inb(devpriv->BADR3 + PCIMDAS_STATUS_REG); + return status & PCIMDAS_STATUS_UB; } static int cb_pcimdas_auto_attach(struct comedi_device *dev, @@ -277,7 +316,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, s = &dev->subdevices[2]; /* digital i/o subdevice */ - ret = subdev_8255_init(dev, s, NULL, 0x00); + ret = subdev_8255_init(dev, s, NULL, PCIMDAS_8255_BASE); if (ret) return ret; -- cgit v1.2.3 From 21314bc6f8f42024dd82b7d1b00d6e53043241bc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 25 Feb 2015 16:28:41 -0700 Subject: staging: comedi: cb_pcimdas: provide analog output range table The analog output range is not programmable. The DAC ranges are jumper-settable on the board. For aesthetics, provide a range table for the user with all possible ranges. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index b0cc4f59789d..94da819f650a 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -136,6 +136,19 @@ static const struct comedi_lrange cb_pcimdas_ai_uni_range = { } }; +/* + * The Analog Output range is not programmable. The DAC ranges are + * jumper-settable on the board. The settings are not software-readable. + */ +static const struct comedi_lrange cb_pcimdas_ao_range = { + 4, { + BIP_RANGE(10), + BIP_RANGE(5), + UNI_RANGE(10), + UNI_RANGE(5) + } +}; + /* * this structure is for data unique to this hardware driver. If * several hardware drivers keep similar information in this structure, @@ -306,8 +319,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, s->subdev_flags = SDF_WRITABLE; s->n_chan = 2; s->maxdata = 0xfff; - /* ranges are hardware settable, but not software readable. */ - s->range_table = &range_unknown; + s->range_table = &cb_pcimdas_ao_range; s->insn_write = cb_pcimdas_ao_insn_write; ret = comedi_alloc_subdev_readback(s); -- cgit v1.2.3 From f51d3c9511a013aba79763a54a6d334dd8ff9829 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 25 Feb 2015 16:28:42 -0700 Subject: staging: comedi: cb_pcimdas: tidy up cb_pcimdas_auto_attach() For aesthetics, add some whitespace to the subdevice init. Remove the unnecessary comments as well as the initialization of the analog input subdevice 'len_chanlist'. That member is only used by subdevices that support async commands. For aesthetics, rename the analog input subdevice (*insn_read) function. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 36 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 94da819f650a..00ba404888ed 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -175,9 +175,10 @@ static int cb_pcimdas_ai_eoc(struct comedi_device *dev, return -EBUSY; } -static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int cb_pcimdas_ai_insn_read(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { struct cb_pcimdas_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -271,7 +272,7 @@ static bool cb_pcimdas_is_ai_uni(struct comedi_device *dev) } static int cb_pcimdas_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct cb_pcimdas_private *devpriv; @@ -294,10 +295,9 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, if (ret) return ret; + /* Analog Input subdevice */ s = &dev->subdevices[0]; - /* dev->read_subdev=s; */ - /* analog input subdevice */ - s->type = COMEDI_SUBD_AI; + s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE; if (cb_pcimdas_is_ai_se(dev)) { s->subdev_flags |= SDF_GROUND; @@ -306,28 +306,26 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, s->subdev_flags |= SDF_DIFF; s->n_chan = 8; } - s->maxdata = 0xffff; + s->maxdata = 0xffff; s->range_table = cb_pcimdas_is_ai_uni(dev) ? &cb_pcimdas_ai_uni_range : &cb_pcimdas_ai_bip_range; - s->len_chanlist = 1; /* This is the maximum chanlist length that */ - /* the board can handle */ - s->insn_read = cb_pcimdas_ai_rinsn; + s->insn_read = cb_pcimdas_ai_insn_read; + /* Analog Output subdevice */ s = &dev->subdevices[1]; - /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0xfff; - s->range_table = &cb_pcimdas_ao_range; - s->insn_write = cb_pcimdas_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0xfff; + s->range_table = &cb_pcimdas_ao_range; + s->insn_write = cb_pcimdas_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; + /* Digital I/O subdevice */ s = &dev->subdevices[2]; - /* digital i/o subdevice */ ret = subdev_8255_init(dev, s, NULL, PCIMDAS_8255_BASE); if (ret) return ret; -- cgit v1.2.3 From e56d03dee14a5ca7915ecfb74decaa635125e93d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 25 Feb 2015 16:28:43 -0700 Subject: staging: comedi: cb_pcimdas: add main connector digital input/output Add subdevices for the 4 digital input and 4 digital output channels on the main connector of the board. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 50 ++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 00ba404888ed..cef6872e98b3 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -243,6 +243,36 @@ static int cb_pcimdas_ao_insn_write(struct comedi_device *dev, return insn->n; } +static int cb_pcimdas_di_insn_read(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct cb_pcimdas_private *devpriv = dev->private; + unsigned int val; + + val = inb(devpriv->BADR3 + PCIMDAS_DI_DO_REG); + + data[1] = val & 0x0f; + + return insn->n; +} + +static int cb_pcimdas_do_insn_write(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct cb_pcimdas_private *devpriv = dev->private; + + if (comedi_dio_update_state(s, data)) + outb(s->state, devpriv->BADR3 + PCIMDAS_DI_DO_REG); + + data[1] = s->state; + + return insn->n; +} + static bool cb_pcimdas_is_ai_se(struct comedi_device *dev) { struct cb_pcimdas_private *devpriv = dev->private; @@ -291,7 +321,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, devpriv->BADR3 = pci_resource_start(pcidev, 3); dev->iobase = pci_resource_start(pcidev, 4); - ret = comedi_alloc_subdevices(dev, 3); + ret = comedi_alloc_subdevices(dev, 5); if (ret) return ret; @@ -330,6 +360,24 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, if (ret) return ret; + /* Digital Input subdevice (main connector) */ + s = &dev->subdevices[3]; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_read = cb_pcimdas_di_insn_read; + + /* Digital Output subdevice (main connector) */ + s = &dev->subdevices[4]; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_write = cb_pcimdas_do_insn_write; + return 0; } -- cgit v1.2.3 From aff0dff965604b22119b0c5fa7751dc78bf5d96a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 26 Feb 2015 15:43:55 -0700 Subject: staging: comedi: cb_pcimdas: add 8254 timer (pacer) support The hardware has an 8254 timer/counter. Channe; 0 is available as a generic counter/timer with the clock, gate, and output signals all availabe on the main 37 pin connector. Channels 1 and 2 are used for the pacer. Add support for the 8254 timer. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/cb_pcimdas.c | 70 ++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 737994a82c62..61c6351f55ac 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -953,6 +953,7 @@ config COMEDI_CB_PCIDDA config COMEDI_CB_PCIMDAS tristate "MeasurementComputing PCIM-DAS1602/16, PCIe-DAS1602/16 support" + select COMEDI_8254 select COMEDI_8255 ---help--- Enable support for ComputerBoards/MeasurementComputing PCI Migration diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index cef6872e98b3..acb77406bce3 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -47,6 +47,7 @@ #include "../comedidev.h" +#include "comedi_8254.h" #include "plx9052.h" #include "8255.h" @@ -273,6 +274,57 @@ static int cb_pcimdas_do_insn_write(struct comedi_device *dev, return insn->n; } +static int cb_pcimdas_counter_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct cb_pcimdas_private *devpriv = dev->private; + unsigned int ctrl; + + switch (data[0]) { + case INSN_CONFIG_SET_CLOCK_SRC: + switch (data[1]) { + case 0: /* internal 100 kHz clock */ + ctrl = PCIMDAS_USER_CNTR_CTR1_CLK_SEL; + break; + case 1: /* external clk on pin 21 */ + ctrl = 0; + break; + default: + return -EINVAL; + } + outb(ctrl, devpriv->BADR3 + PCIMDAS_USER_CNTR_REG); + break; + case INSN_CONFIG_GET_CLOCK_SRC: + ctrl = inb(devpriv->BADR3 + PCIMDAS_USER_CNTR_REG); + if (ctrl & PCIMDAS_USER_CNTR_CTR1_CLK_SEL) { + data[1] = 0; + data[2] = I8254_OSC_BASE_100KHZ; + } else { + data[1] = 1; + data[2] = 0; + } + break; + default: + return -EINVAL; + } + + return insn->n; +} + +static unsigned int cb_pcimdas_pacer_clk(struct comedi_device *dev) +{ + struct cb_pcimdas_private *devpriv = dev->private; + unsigned int status; + + /* The Pacer Clock jumper selects a 10 MHz or 1 MHz clock */ + status = inb(devpriv->BADR3 + PCIMDAS_STATUS_REG); + if (status & PCIMDAS_STATUS_CLK) + return I8254_OSC_BASE_10MHZ; + return I8254_OSC_BASE_1MHZ; +} + static bool cb_pcimdas_is_ai_se(struct comedi_device *dev) { struct cb_pcimdas_private *devpriv = dev->private; @@ -321,7 +373,13 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, devpriv->BADR3 = pci_resource_start(pcidev, 3); dev->iobase = pci_resource_start(pcidev, 4); - ret = comedi_alloc_subdevices(dev, 5); + dev->pacer = comedi_8254_init(devpriv->BADR3 + PCIMDAS_8254_BASE, + cb_pcimdas_pacer_clk(dev), + I8254_IO8, 0); + if (!dev->pacer) + return -ENOMEM; + + ret = comedi_alloc_subdevices(dev, 6); if (ret) return ret; @@ -378,6 +436,16 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, s->range_table = &range_digital; s->insn_write = cb_pcimdas_do_insn_write; + /* Counter subdevice (8254) */ + s = &dev->subdevices[5]; + comedi_8254_subdevice_init(s, dev->pacer); + + dev->pacer->insn_config = cb_pcimdas_counter_insn_config; + + /* counters 1 and 2 are used internally for the pacer */ + comedi_8254_set_busy(dev->pacer, 1, true); + comedi_8254_set_busy(dev->pacer, 2, true); + return 0; } -- cgit v1.2.3 From cd6b76604d1df088409856fade41b26675d5952e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Feb 2015 15:07:35 +0000 Subject: staging: comedi: adl_pci6208: combine PCI-6208 and PCI-6216 support This module's PCI device table has separate PCI device IDs for PCI-6208 and PCI-6216, but in reality, both boards and their cPCI and PCIe variants seem to have the same PCI device ID: 0x6208. The PCI subdevice ID doesn't seem to help either. It shouldn't do any harm to claim 16 AO channels for all devices supported by this driver. The original PCI-6216 is just a PCI-6208 with a daughter board providing the extra DACs. The data is clocked out to the DACs serially with no acknowledgment. I assume this would still happen when the DACs for the upper 8 channels are missing. Therefore, change the driver to support a single board type with 16 AO channels, and remove the suspicious PCI device ID for the PCI-6216. Evidence about lack of a separate PCI device ID for PCI-6216 follows.... 1. Jesus Vasquez reports the following lspci output for a PCIe-6216 on his Ubuntu 12.04 system: lspci -n -vvv 07:00.0 1180: 144a:6208 (rev 02) Subsystem: 144a:6208 Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- SERR- Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci6208.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index a3ea4b7c18dd..6fb41d47f891 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -19,12 +19,16 @@ /* * Driver: adl_pci6208 * Description: ADLink PCI-6208/6216 Series Multi-channel Analog Output Cards - * Devices: [ADLink] PCI-6208 (adl_pci6208), PCI-6216 (adl_pci6216) + * Devices: [ADLink] PCI-6208 (adl_pci6208), PCI-6216 * Author: nsyeow - * Updated: Fri, 30 Jan 2004 14:44:27 +0800 + * Updated: Wed, 11 Feb 2015 11:37:18 +0000 * Status: untested * * Configuration Options: not applicable, uses PCI auto config + * + * All supported devices share the same PCI device ID and are treated as a + * PCI-6216 with 16 analog output channels. On a PCI-6208, the upper 8 + * channels exist in registers, but don't go to DAC chips. */ #include @@ -47,7 +51,6 @@ enum pci6208_boardid { BOARD_PCI6208, - BOARD_PCI6216, }; struct pci6208_board { @@ -58,11 +61,7 @@ struct pci6208_board { static const struct pci6208_board pci6208_boards[] = { [BOARD_PCI6208] = { .name = "adl_pci6208", - .ao_chans = 8, - }, - [BOARD_PCI6216] = { - .name = "adl_pci6216", - .ao_chans = 16, + .ao_chans = 16, /* Only 8 usable on PCI-6208 */ }, }; @@ -218,7 +217,6 @@ static int adl_pci6208_pci_probe(struct pci_dev *dev, static const struct pci_device_id adl_pci6208_pci_table[] = { { PCI_VDEVICE(ADLINK, 0x6208), BOARD_PCI6208 }, - { PCI_VDEVICE(ADLINK, 0x6216), BOARD_PCI6216 }, { 0 } }; MODULE_DEVICE_TABLE(pci, adl_pci6208_pci_table); -- cgit v1.2.3 From 706cb51b591e28ff5bfb1c592c1d2fa496828332 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Feb 2015 15:07:36 +0000 Subject: staging: comedi: adl_pci6208: remove multiple board type support This driver module now only supports a single board type, so remove the infrastructure for describing multiple board types. The comedi "auto_attach" handler, `pci6208_auto_attach()` doesn't need to set the comedi device's `board_name` or `board_ptr` members. The former is automatically pointed to the comedi driver's `driver_name` by the core comedi module, and the latter is not used anywhere else. The AO subdevice's `n_chans` member can be set to 16 without looking it up in the single element of `pci6208_boards[]`. There is no need to pass a board index from the PCI device table to the "auto_attach" handler. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci6208.c | 30 +++------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 6fb41d47f891..11c663aa277c 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -49,22 +49,6 @@ #define PCI6208_DIO_DI_MASK (0xf0) #define PCI6208_DIO_DI_SHIFT (4) -enum pci6208_boardid { - BOARD_PCI6208, -}; - -struct pci6208_board { - const char *name; - int ao_chans; -}; - -static const struct pci6208_board pci6208_boards[] = { - [BOARD_PCI6208] = { - .name = "adl_pci6208", - .ao_chans = 16, /* Only 8 usable on PCI-6208 */ - }, -}; - static int pci6208_ao_eoc(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -135,21 +119,13 @@ static int pci6208_do_insn_bits(struct comedi_device *dev, } static int pci6208_auto_attach(struct comedi_device *dev, - unsigned long context) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - const struct pci6208_board *boardinfo = NULL; struct comedi_subdevice *s; unsigned int val; int ret; - if (context < ARRAY_SIZE(pci6208_boards)) - boardinfo = &pci6208_boards[context]; - if (!boardinfo) - return -ENODEV; - dev->board_ptr = boardinfo; - dev->board_name = boardinfo->name; - ret = comedi_pci_enable(dev); if (ret) return ret; @@ -163,7 +139,7 @@ static int pci6208_auto_attach(struct comedi_device *dev, /* analog output subdevice */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = boardinfo->ao_chans; + s->n_chan = 16; /* Only 8 usable on PCI-6208 */ s->maxdata = 0xffff; s->range_table = &range_bipolar10; s->insn_write = pci6208_ao_insn_write; @@ -216,7 +192,7 @@ static int adl_pci6208_pci_probe(struct pci_dev *dev, } static const struct pci_device_id adl_pci6208_pci_table[] = { - { PCI_VDEVICE(ADLINK, 0x6208), BOARD_PCI6208 }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, 0x6208) }, { 0 } }; MODULE_DEVICE_TABLE(pci, adl_pci6208_pci_table); -- cgit v1.2.3 From 361008f2380201ab182909b30463ff4d9dc573a6 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Feb 2015 15:07:37 +0000 Subject: staging: comedi: adl_pci6208: support old PLX device ID ADLINK's MS Windows drivers for the PCI-6208/6216 boards include the following line in the DDInstall secion of the INF file: %String6208%=DriverInstall6208.NT,PCI\VEN_10B5&DEV_9050&SUBSYS_62089999 That's for a PLX PCI 9050/9052 PCI interface chip with custom subvendor and subdevice ID. The "%String6208%" macro expands to "ADLINK PCI-6208" in the INF file. Add a corresponding entry to this driver module's PCI device table. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci6208.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 11c663aa277c..cc752812f8ee 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -193,6 +193,8 @@ static int adl_pci6208_pci_probe(struct pci_dev *dev, static const struct pci_device_id adl_pci6208_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, 0x6208) }, + { PCI_DEVICE_SUB(PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + 0x9999, 0x6208) }, { 0 } }; MODULE_DEVICE_TABLE(pci, adl_pci6208_pci_table); -- cgit v1.2.3 From abe46b8932dd9a6dfc3698e3eb121809b7b9ed28 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Feb 2015 16:04:42 +0000 Subject: staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel Reading of analog input channels by the `INSN_READ` comedi instruction is broken for all except channel 0. `pci171x_ai_insn_read()` calls `pci171x_ai_read_sample()` with the wrong value for the third parameter. It is supposed to be the current index in a channel list (which is always of length 1 in this case, so the index should be 0), but instead it is passing the actual channel number. `pci171x_ai_read_sample()` checks the channel number encoded in the raw sample value read from the hardware matches the channel number stored in the specified index of the previously set up channel list and returns `-ENODATA` if it doesn't match. Since the index should always be 0 in this case, the match will fail unless the channel number is also 0. Fix it by passing 0 as the channel index. Note that when the bug first appeared, it was `pci171x_ai_dropout()` that was called with the wrong parameter value. `pci171x_ai_dropout()` got replaced with `pci171x_ai_read_sample()` in commit 7fd2dae2500d ("staging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()"). Fixes: 16c7eb6047bb ("staging: comedi: adv_pci1710: always enable PCI171x_PARANOIDCHECK code") Signed-off-by: Ian Abbott Cc: stable # 3.16+ Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 9800c01e6fb9..3f72451d2de0 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -426,7 +426,6 @@ static int pci171x_ai_insn_read(struct comedi_device *dev, unsigned int *data) { struct pci1710_private *devpriv = dev->private; - unsigned int chan = CR_CHAN(insn->chanspec); int ret = 0; int i; @@ -447,7 +446,7 @@ static int pci171x_ai_insn_read(struct comedi_device *dev, if (ret) break; - ret = pci171x_ai_read_sample(dev, s, chan, &val); + ret = pci171x_ai_read_sample(dev, s, 0, &val); if (ret) break; -- cgit v1.2.3 From 08c95f9abf4c7d0f1886ac941fd8195004846386 Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Sat, 14 Feb 2015 20:32:43 -0800 Subject: Staging: iio: meter: ade7854-i2c: code style improvements Code reformatting based on checkpatch.pl with --strict: Alignment should match open paranthesis cases corrected Signed-off-by: Tolga Ceylan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7854-i2c.c | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index 5b33c7f1aa91..85a7e84e0e41 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -16,8 +16,8 @@ #include "ade7854.h" static int ade7854_i2c_write_reg_8(struct device *dev, - u16 reg_address, - u8 value) + u16 reg_address, + u8 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -35,8 +35,8 @@ static int ade7854_i2c_write_reg_8(struct device *dev, } static int ade7854_i2c_write_reg_16(struct device *dev, - u16 reg_address, - u16 value) + u16 reg_address, + u16 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -55,8 +55,8 @@ static int ade7854_i2c_write_reg_16(struct device *dev, } static int ade7854_i2c_write_reg_24(struct device *dev, - u16 reg_address, - u32 value) + u16 reg_address, + u32 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -76,8 +76,8 @@ static int ade7854_i2c_write_reg_24(struct device *dev, } static int ade7854_i2c_write_reg_32(struct device *dev, - u16 reg_address, - u32 value) + u16 reg_address, + u32 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -98,8 +98,8 @@ static int ade7854_i2c_write_reg_32(struct device *dev, } static int ade7854_i2c_read_reg_8(struct device *dev, - u16 reg_address, - u8 *val) + u16 reg_address, + u8 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); @@ -124,8 +124,8 @@ out: } static int ade7854_i2c_read_reg_16(struct device *dev, - u16 reg_address, - u16 *val) + u16 reg_address, + u16 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); @@ -150,8 +150,8 @@ out: } static int ade7854_i2c_read_reg_24(struct device *dev, - u16 reg_address, - u32 *val) + u16 reg_address, + u32 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); @@ -176,8 +176,8 @@ out: } static int ade7854_i2c_read_reg_32(struct device *dev, - u16 reg_address, - u32 *val) + u16 reg_address, + u32 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); @@ -202,7 +202,7 @@ out: } static int ade7854_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { int ret; struct ade7854_state *st; -- cgit v1.2.3 From 7cb8957b894a6c4eae44d9ccbfd3a0034e298aba Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Sat, 14 Feb 2015 20:32:44 -0800 Subject: Staging: iio: meter: ade7854-i2c: code style improvements Code reformatting based on checkpatch.pl with --strict: Lines over 80 characters were fixed Signed-off-by: Tolga Ceylan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7854-i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index 85a7e84e0e41..5e6fbe4c976a 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -195,7 +195,8 @@ static int ade7854_i2c_read_reg_32(struct device *dev, if (ret) goto out; - *val = (st->rx[0] << 24) | (st->rx[1] << 16) | (st->rx[2] << 8) | st->rx[3]; + *val = (st->rx[0] << 24) | (st->rx[1] << 16) | + (st->rx[2] << 8) | st->rx[3]; out: mutex_unlock(&st->buf_lock); return ret; -- cgit v1.2.3 From f9be10850f533895c360e2692a34a5be1d21cd8d Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Sat, 14 Feb 2015 20:32:45 -0800 Subject: Staging: iio: meter: ade7854-i2c: code style improvements Code reformatting based on checkpatch.pl with --strict: Comparison to NULL rewritten as !indio_dev Signed-off-by: Tolga Ceylan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7854-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index 5e6fbe4c976a..4e7a3829ea55 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -210,7 +210,7 @@ static int ade7854_i2c_probe(struct i2c_client *client, struct iio_dev *indio_dev; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st)); - if (indio_dev == NULL) + if (!indio_dev) return -ENOMEM; st = iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); -- cgit v1.2.3 From 91b3a68558ba37c69f1d9e2d23e34c3cba38e356 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sun, 1 Mar 2015 19:58:57 -0800 Subject: staging: lustre: Convert uses of "int rc = seq_printf(...)" The seq_printf return value, because it's frequently misused, will eventually be converted to void. See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to seq_has_overflowed() and make public") Convert these uses to: seq_printf(seq, ...); return 0; Done via cocci script: @@ struct seq_file *seq; int i; @@ - i = seq_printf(seq, + seq_printf(seq, ...); ... - return i; + return 0; @@ struct seq_file *seq; int i; @@ - i = 0; - i += seq_printf(seq, + seq_printf(seq, ...); ... - return i; + return 0; With some additional reformatting and typing post conversion to remove the now unnecessary "int i;" declaration. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fid/lproc_fid.c | 23 +++--- drivers/staging/lustre/lustre/llite/lproc_llite.c | 4 +- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 6 +- drivers/staging/lustre/lustre/osc/lproc_osc.c | 44 ++++++------ .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 82 +++++++++++----------- 6 files changed, 81 insertions(+), 83 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c index 6a21f078fefa..783939dbd4db 100644 --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c @@ -120,15 +120,14 @@ static int lprocfs_fid_space_seq_show(struct seq_file *m, void *unused) { struct lu_client_seq *seq = (struct lu_client_seq *)m->private; - int rc; LASSERT(seq != NULL); mutex_lock(&seq->lcs_mutex); - rc = seq_printf(m, "[%#llx - %#llx]:%x:%s\n", PRANGE(&seq->lcs_space)); + seq_printf(m, "[%#llx - %#llx]:%x:%s\n", PRANGE(&seq->lcs_space)); mutex_unlock(&seq->lcs_mutex); - return rc; + return 0; } static ssize_t lprocfs_fid_width_seq_write(struct file *file, @@ -170,30 +169,28 @@ static int lprocfs_fid_width_seq_show(struct seq_file *m, void *unused) { struct lu_client_seq *seq = (struct lu_client_seq *)m->private; - int rc; LASSERT(seq != NULL); mutex_lock(&seq->lcs_mutex); - rc = seq_printf(m, "%llu\n", seq->lcs_width); + seq_printf(m, "%llu\n", seq->lcs_width); mutex_unlock(&seq->lcs_mutex); - return rc; + return 0; } static int lprocfs_fid_fid_seq_show(struct seq_file *m, void *unused) { struct lu_client_seq *seq = (struct lu_client_seq *)m->private; - int rc; LASSERT(seq != NULL); mutex_lock(&seq->lcs_mutex); - rc = seq_printf(m, DFID"\n", PFID(&seq->lcs_fid)); + seq_printf(m, DFID "\n", PFID(&seq->lcs_fid)); mutex_unlock(&seq->lcs_mutex); - return rc; + return 0; } static int @@ -201,17 +198,17 @@ lprocfs_fid_server_seq_show(struct seq_file *m, void *unused) { struct lu_client_seq *seq = (struct lu_client_seq *)m->private; struct client_obd *cli; - int rc; LASSERT(seq != NULL); if (seq->lcs_exp != NULL) { cli = &seq->lcs_exp->exp_obd->u.cli; - rc = seq_printf(m, "%s\n", cli->cl_target_uuid.uuid); + seq_printf(m, "%s\n", cli->cl_target_uuid.uuid); } else { - rc = seq_printf(m, "%s\n", seq->lcs_srv->lss_name); + seq_printf(m, "%s\n", seq->lcs_srv->lss_name); } - return rc; + + return 0; } LPROC_SEQ_FOPS(lprocfs_fid_space); diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index d04522050437..2b8f147cfcb4 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -804,7 +804,9 @@ static int ll_xattr_cache_seq_show(struct seq_file *m, void *v) struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); - return seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled); + seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled); + + return 0; } static ssize_t ll_xattr_cache_seq_write(struct file *file, diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c index c791941bd810..a4fb29496850 100644 --- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c +++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c @@ -43,12 +43,12 @@ static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight); + seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file, diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index e0eaafd93521..15a66209831c 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -45,12 +45,12 @@ static int osc_active_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; - int rc; LPROCFS_CLIMP_CHECK(dev); - rc = seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive); + seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive); LPROCFS_CLIMP_EXIT(dev); - return rc; + + return 0; } static ssize_t osc_active_seq_write(struct file *file, @@ -80,12 +80,12 @@ static int osc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight); + seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file, @@ -165,12 +165,14 @@ static int osc_cached_mb_seq_show(struct seq_file *m, void *v) struct client_obd *cli = &dev->u.cli; int shift = 20 - PAGE_CACHE_SHIFT; - return seq_printf(m, - "used_mb: %d\n" - "busy_cnt: %d\n", - (atomic_read(&cli->cl_lru_in_list) + - atomic_read(&cli->cl_lru_busy)) >> shift, - atomic_read(&cli->cl_lru_busy)); + seq_printf(m, + "used_mb: %d\n" + "busy_cnt: %d\n", + (atomic_read(&cli->cl_lru_in_list) + + atomic_read(&cli->cl_lru_busy)) >> shift, + atomic_read(&cli->cl_lru_busy)); + + return 0; } /* shrink the number of caching pages to a specific number */ @@ -212,12 +214,12 @@ static int osc_cur_dirty_bytes_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%lu\n", cli->cl_dirty); + seq_printf(m, "%lu\n", cli->cl_dirty); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } LPROC_SEQ_FOPS_RO(osc_cur_dirty_bytes); @@ -225,12 +227,12 @@ static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%lu\n", cli->cl_avail_grant); + seq_printf(m, "%lu\n", cli->cl_avail_grant); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } static ssize_t osc_cur_grant_bytes_seq_write(struct file *file, @@ -271,12 +273,12 @@ static int osc_cur_lost_grant_bytes_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%lu\n", cli->cl_lost_grant); + seq_printf(m, "%lu\n", cli->cl_lost_grant); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } LPROC_SEQ_FOPS_RO(osc_cur_lost_grant_bytes); diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index efd214339999..9533ab976a33 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -1328,13 +1328,12 @@ int lprocfs_rd_pinger_recov(struct seq_file *m, void *n) { struct obd_device *obd = m->private; struct obd_import *imp = obd->u.cli.cl_import; - int rc; LPROCFS_CLIMP_CHECK(obd); - rc = seq_printf(m, "%d\n", !imp->imp_no_pinger_recover); + seq_printf(m, "%d\n", !imp->imp_no_pinger_recover); LPROCFS_CLIMP_EXIT(obd); - return rc; + return 0; } EXPORT_SYMBOL(lprocfs_rd_pinger_recov); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index 0dabd83fd46f..6f0256fded8e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -125,52 +125,50 @@ static struct ptlrpc_enc_page_pool { */ int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v) { - int rc; - spin_lock(&page_pools.epp_lock); - rc = seq_printf(m, - "physical pages: %lu\n" - "pages per pool: %lu\n" - "max pages: %lu\n" - "max pools: %u\n" - "total pages: %lu\n" - "total free: %lu\n" - "idle index: %lu/100\n" - "last shrink: %lds\n" - "last access: %lds\n" - "max pages reached: %lu\n" - "grows: %u\n" - "grows failure: %u\n" - "shrinks: %u\n" - "cache access: %lu\n" - "cache missing: %lu\n" - "low free mark: %lu\n" - "max waitqueue depth: %u\n" - "max wait time: "CFS_TIME_T"/%u\n" - , - totalram_pages, - PAGES_PER_POOL, - page_pools.epp_max_pages, - page_pools.epp_max_pools, - page_pools.epp_total_pages, - page_pools.epp_free_pages, - page_pools.epp_idle_idx, - get_seconds() - page_pools.epp_last_shrink, - get_seconds() - page_pools.epp_last_access, - page_pools.epp_st_max_pages, - page_pools.epp_st_grows, - page_pools.epp_st_grow_fails, - page_pools.epp_st_shrinks, - page_pools.epp_st_access, - page_pools.epp_st_missings, - page_pools.epp_st_lowfree, - page_pools.epp_st_max_wqlen, - page_pools.epp_st_max_wait, HZ - ); + seq_printf(m, + "physical pages: %lu\n" + "pages per pool: %lu\n" + "max pages: %lu\n" + "max pools: %u\n" + "total pages: %lu\n" + "total free: %lu\n" + "idle index: %lu/100\n" + "last shrink: %lds\n" + "last access: %lds\n" + "max pages reached: %lu\n" + "grows: %u\n" + "grows failure: %u\n" + "shrinks: %u\n" + "cache access: %lu\n" + "cache missing: %lu\n" + "low free mark: %lu\n" + "max waitqueue depth: %u\n" + "max wait time: " CFS_TIME_T "/%u\n", + totalram_pages, + PAGES_PER_POOL, + page_pools.epp_max_pages, + page_pools.epp_max_pools, + page_pools.epp_total_pages, + page_pools.epp_free_pages, + page_pools.epp_idle_idx, + get_seconds() - page_pools.epp_last_shrink, + get_seconds() - page_pools.epp_last_access, + page_pools.epp_st_max_pages, + page_pools.epp_st_grows, + page_pools.epp_st_grow_fails, + page_pools.epp_st_shrinks, + page_pools.epp_st_access, + page_pools.epp_st_missings, + page_pools.epp_st_lowfree, + page_pools.epp_st_max_wqlen, + page_pools.epp_st_max_wait, + HZ); spin_unlock(&page_pools.epp_lock); - return rc; + + return 0; } static void enc_pools_release_free_pages(long npages) -- cgit v1.2.3 From ef2e1a4410e3debf159c5b41836a301ac8ffbcdb Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Tue, 3 Mar 2015 02:39:36 -0500 Subject: staging/lustre/llite: Fix obd name after c&p error commit 95745e9b1de2 ("staging: lustre: Use kasprintf.") introduced a copy and paste error causing two different obd types to be assigned same content causing lustre to fail on mount with a warning from procfs followed by a bizzare error about OST not having enough MDS capabilities. This patch unbreaks Lustre client again. Signed-off-by: Oleg Drokin CC: Navya Sri Nizamkari CC: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index ee4bd89c0a18..bf1ec277a1dc 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -983,7 +983,7 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt) goto out_free; } - md = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_dt, cfg->cfg_instance); + md = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_md, cfg->cfg_instance); if (!md) { err = -ENOMEM; goto out_free; -- cgit v1.2.3 From 25094468a195ad02b9d4ebed571c832d8dcce571 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 9 Feb 2015 17:52:16 -0500 Subject: staging: rtl8723au: Use RF_AC instead of hardcoded value for RF register write Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/usb_halinit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index adbf1c2dd383..319170d51def 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -816,9 +816,10 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, mode. This is used to re-write the RX idle mode. */ /* We can only prvide a usual value instead and then HW will modify the value by itself. */ - PHY_SetRFReg(Adapter, RF_PATH_A, 0, bRFRegOffsetMask, 0x32D95); + PHY_SetRFReg(Adapter, RF_PATH_A, RF_AC, + bRFRegOffsetMask, 0x32D95); if (pHalData->rf_type == RF_2T2R) { - PHY_SetRFReg(Adapter, RF_PATH_B, 0, + PHY_SetRFReg(Adapter, RF_PATH_B, RF_AC, bRFRegOffsetMask, 0x32D95); } break; @@ -867,9 +868,9 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, 0x001B25A0); /* 3. issue 3-wire command that RF set to power down.*/ - PHY_SetRFReg(Adapter, RF_PATH_A, 0, bRFRegOffsetMask, 0); + PHY_SetRFReg(Adapter, RF_PATH_A, RF_AC, bRFRegOffsetMask, 0); if (pHalData->rf_type == RF_2T2R) - PHY_SetRFReg(Adapter, RF_PATH_B, 0, + PHY_SetRFReg(Adapter, RF_PATH_B, RF_AC, bRFRegOffsetMask, 0); /* 4. Force PFM , disable SPS18_LDO_Marco_Block */ -- cgit v1.2.3 From b1e4d2f623c41bf89a31f18960d11d4b36ce798e Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 9 Feb 2015 17:52:17 -0500 Subject: staging: rtl8723au: rates are always set via the firmware interface The only case where fw_ractrl = false was when the firmware failed to load, and in that case we are dead in the water anyway. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 3 +-- .../staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 28 +++++++--------------- drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 16 +------------ drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 1 - drivers/staging/rtl8723au/hal/usb_halinit.c | 28 ++++++---------------- drivers/staging/rtl8723au/include/rtl8723a_hal.h | 1 - 6 files changed, 18 insertions(+), 59 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 375f85db2067..82861e716a93 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1289,8 +1289,7 @@ void odm_RSSIMonitorCheck23aCE(struct dm_odm_t *pDM_Odm) for (i = 0; i < sta_cnt; i++) { if (PWDB_rssi[i] != (0)) { - if (pHalData->fw_ractrl) /* Report every sta's RSSI to FW */ - rtl8723a_set_rssi_cmd(Adapter, (u8 *)&PWDB_rssi[i]); + rtl8723a_set_rssi_cmd(Adapter, (u8 *)&PWDB_rssi[i]); } } diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c index 73cfddd6df9a..e46032e0077e 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c @@ -5796,7 +5796,7 @@ static void btdm_1AntUpdateHalRAMask(struct rtw_adapter *padapter, u32 mac_id, u32 filter) { u8 init_rate = 0; - u8 raid; + u8 raid, arg; u32 mask; u8 shortGIrate = false; int supportRateNum = 0; @@ -5860,26 +5860,16 @@ btdm_1AntUpdateHalRAMask(struct rtw_adapter *padapter, u32 mac_id, u32 filter) mask &= ~filter; init_rate = get_highest_rate_idx23a(mask)&0x3f; - if (pHalData->fw_ractrl) { - u8 arg = 0; + arg = mac_id&0x1f;/* MACID */ + arg |= BIT(7); + if (true == shortGIrate) + arg |= BIT(5); - arg = mac_id&0x1f;/* MACID */ - arg |= BIT(7); - if (true == shortGIrate) - arg |= BIT(5); - - RTPRINT(FBT, BT_TRACE, - ("[BTCoex], Update FW RAID entry, MASK = 0x%08x, " - "arg = 0x%02x\n", mask, arg)); - - rtl8723a_set_raid_cmd(padapter, mask, arg); - } else { - if (shortGIrate) - init_rate |= BIT(6); + RTPRINT(FBT, BT_TRACE, + ("[BTCoex], Update FW RAID entry, MASK = 0x%08x, " + "arg = 0x%02x\n", mask, arg)); - rtl8723au_write8(padapter, REG_INIDATA_RATE_SEL + mac_id, - init_rate); - } + rtl8723a_set_raid_cmd(padapter, mask, arg); psta->init_rate = init_rate; pdmpriv->INIDATA_RATE[mac_id] = init_rate; diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c index 7b56411cc3c8..0b77ee1eaddf 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c @@ -153,21 +153,7 @@ void rtl8723a_add_rateatid(struct rtw_adapter *pAdapter, u32 bitmap, u8 arg, u8 bitmap |= ((raid<<28)&0xf0000000); - if (pHalData->fw_ractrl == true) { - rtl8723a_set_raid_cmd(pAdapter, bitmap, arg); - } else { - u8 init_rate, shortGIrate = false; - - init_rate = get_highest_rate_idx23a(bitmap&0x0fffffff)&0x3f; - - shortGIrate = (arg&BIT(5)) ? true:false; - - if (shortGIrate == true) - init_rate |= BIT(6); - - rtl8723au_write8(pAdapter, REG_INIDATA_RATE_SEL + macid, - init_rate); - } + rtl8723a_set_raid_cmd(pAdapter, bitmap, arg); } void rtl8723a_set_FwPwrMode_cmd(struct rtw_adapter *padapter, u8 Mode) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index a5eadd4e2580..eb82c0b880d5 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -1095,7 +1095,6 @@ void rtl8723a_init_default_value(struct rtw_adapter *padapter) pdmpriv = &pHalData->dmpriv; /* init default value */ - pHalData->fw_ractrl = false; pHalData->bIQKInitialized = false; if (!padapter->pwrctrlpriv.bkeepfwalive) pHalData->LastHMEBoxNum = 0; diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index 319170d51def..173893474fd7 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -572,12 +572,10 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) status = rtl8723a_FirmwareDownload(Adapter); if (status != _SUCCESS) { Adapter->bFWReady = false; - pHalData->fw_ractrl = false; DBG_8723A("fw download fail!\n"); goto exit; } else { Adapter->bFWReady = true; - pHalData->fw_ractrl = true; DBG_8723A("fw download ok!\n"); } @@ -1212,7 +1210,7 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter, struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *cur_network = &pmlmeinfo->network; - u8 init_rate, networkType, raid; + u8 init_rate, networkType, raid, arg; u32 mask, rate_bitmap; u8 shortGIrate = false; int supportRateNum; @@ -1284,27 +1282,15 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter, init_rate = get_highest_rate_idx23a(mask) & 0x3f; - if (pHalData->fw_ractrl == true) { - u8 arg = 0; + arg = mac_id & 0x1f;/* MACID */ + arg |= BIT(7); - arg = mac_id & 0x1f;/* MACID */ + if (shortGIrate == true) + arg |= BIT(5); - arg |= BIT(7); + DBG_8723A("update raid entry, mask = 0x%x, arg = 0x%x\n", mask, arg); - if (shortGIrate == true) - arg |= BIT(5); - - DBG_8723A("update raid entry, mask = 0x%x, arg = 0x%x\n", - mask, arg); - - rtl8723a_set_raid_cmd(padapter, mask, arg); - } else { - if (shortGIrate == true) - init_rate |= BIT(6); - - rtl8723au_write8(padapter, (REG_INIDATA_RATE_SEL + mac_id), - init_rate); - } + rtl8723a_set_raid_cmd(padapter, mask, arg); /* set ra_id */ psta->raid = raid; diff --git a/drivers/staging/rtl8723au/include/rtl8723a_hal.h b/drivers/staging/rtl8723au/include/rtl8723a_hal.h index e14633678b52..5841915d34e1 100644 --- a/drivers/staging/rtl8723au/include/rtl8723a_hal.h +++ b/drivers/staging/rtl8723au/include/rtl8723a_hal.h @@ -348,7 +348,6 @@ struct hal_data_8723a { /* for host message to fw */ u8 LastHMEBoxNum; - u8 fw_ractrl; u8 RegTxPause; /* Beacon function related global variable. */ u8 RegFwHwTxQCtrl; -- cgit v1.2.3 From 164b46666d6abdcffbde6590f9f2179cb3c610a5 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 9 Feb 2015 17:52:18 -0500 Subject: staging: rtl8723au: rtl8723a_add_rateatid() simplyfy code No point shifting raid right, just to shift it left again before re-adding it. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c index 0b77ee1eaddf..3304e55108ee 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c @@ -142,16 +142,16 @@ int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg) /* arg[5] = Short GI */ void rtl8723a_add_rateatid(struct rtw_adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi_level) { - struct hal_data_8723a *pHalData = GET_HAL_DATA(pAdapter); - u8 macid = arg&0x1f; - u8 raid = (bitmap>>28) & 0x0f; + struct hal_data_8723a *pHalData = GET_HAL_DATA(pAdapter); + u8 macid = arg & 0x1f; + u32 raid = bitmap & 0xf0000000; bitmap &= 0x0fffffff; if (rssi_level != DM_RATR_STA_INIT) bitmap = ODM_Get_Rate_Bitmap23a(pHalData, macid, bitmap, rssi_level); - bitmap |= ((raid<<28)&0xf0000000); + bitmap |= raid; rtl8723a_set_raid_cmd(pAdapter, bitmap, arg); } -- cgit v1.2.3 From 49361cafe324f58cb6a40a89f3bd45d3900275dc Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 9 Feb 2015 17:52:19 -0500 Subject: staging: rtl8723au: Remove more unused #defines Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/include/ieee80211.h | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/include/ieee80211.h b/drivers/staging/rtl8723au/include/ieee80211.h index cb23cd0349b4..3caf4f502ad8 100644 --- a/drivers/staging/rtl8723au/include/ieee80211.h +++ b/drivers/staging/rtl8723au/include/ieee80211.h @@ -171,20 +171,6 @@ struct ieee80211_snap_hdr { #define WLAN_REASON_JOIN_WRONG_CHANNEL 65534 #define WLAN_REASON_EXPIRATION_CHK 65535 - -#define IEEE80211_STATMASK_SIGNAL (1<<0) -#define IEEE80211_STATMASK_RSSI (1<<1) -#define IEEE80211_STATMASK_NOISE (1<<2) -#define IEEE80211_STATMASK_RATE (1<<3) -#define IEEE80211_STATMASK_WEMASK 0x7 - - -#define IEEE80211_CCK_MODULATION (1<<0) -#define IEEE80211_OFDM_MODULATION (1<<1) - -#define IEEE80211_24GHZ_BAND (1<<0) -#define IEEE80211_52GHZ_BAND (1<<1) - #define IEEE80211_CCK_RATE_LEN 4 #define IEEE80211_NUM_OFDM_RATESLEN 8 -- cgit v1.2.3 From 7ea9039d91f2f4e4a9ae84c178f2ed0d4613c6b8 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 9 Feb 2015 17:52:20 -0500 Subject: staging: rtl8723au: hal_com.h: Remove some unused #defines Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/include/hal_com.h | 30 ----------------------------- 1 file changed, 30 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/include/hal_com.h b/drivers/staging/rtl8723au/include/hal_com.h index 7c31865e9865..e946c4ba9d16 100644 --- a/drivers/staging/rtl8723au/include/hal_com.h +++ b/drivers/staging/rtl8723au/include/hal_com.h @@ -65,36 +65,6 @@ #define RATE_36M BIT(9) #define RATE_48M BIT(10) #define RATE_54M BIT(11) -/* MCS 1 Spatial Stream */ -#define RATE_MCS0 BIT(12) -#define RATE_MCS1 BIT(13) -#define RATE_MCS2 BIT(14) -#define RATE_MCS3 BIT(15) -#define RATE_MCS4 BIT(16) -#define RATE_MCS5 BIT(17) -#define RATE_MCS6 BIT(18) -#define RATE_MCS7 BIT(19) -/* MCS 2 Spatial Stream */ -#define RATE_MCS8 BIT(20) -#define RATE_MCS9 BIT(21) -#define RATE_MCS10 BIT(22) -#define RATE_MCS11 BIT(23) -#define RATE_MCS12 BIT(24) -#define RATE_MCS13 BIT(25) -#define RATE_MCS14 BIT(26) -#define RATE_MCS15 BIT(27) - -/* ALL CCK Rate */ -#define RATE_ALL_CCK (RATR_1M | RATR_2M | RATR_55M | RATR_11M) -#define RATE_ALL_OFDM_AG \ - (RATR_6M | RATR_9M | RATR_12M | RATR_18M | RATR_24M| \ - RATR_36M|RATR_48M|RATR_54M) -#define RATE_ALL_OFDM_1SS \ - (RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | RATR_MCS3 | \ - RATR_MCS4 | RATR_MCS5 | RATR_MCS6 | RATR_MCS7) -#define RATE_ALL_OFDM_2SS \ - (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | RATR_MCS11| \ - RATR_MCS12 | RATR_MCS13 | RATR_MCS14 | RATR_MCS15) /*------------------------------ Tx Desc definition Macro ------------------------*/ /* pragma mark -- Tx Desc related definition. -- */ -- cgit v1.2.3 From 9939cf9427e7e1a4c71c0d9496351eca4e6c3a96 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 9 Feb 2015 17:52:21 -0500 Subject: staging: rtl8723au: Firmware always handles adaptive rates Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 12 ------------ drivers/staging/rtl8723au/include/odm.h | 3 --- 2 files changed, 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 82861e716a93..2a77fb853166 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1010,10 +1010,6 @@ void odm_RateAdaptiveMaskInit23a(struct dm_odm_t *pDM_Odm) struct odm_rate_adapt *pOdmRA = &pDM_Odm->RateAdaptive; pOdmRA->Type = DM_Type_ByDriver; - if (pOdmRA->Type == DM_Type_ByDriver) - pDM_Odm->bUseRAMask = true; - else - pDM_Odm->bUseRAMask = false; pOdmRA->RATRState = DM_RATR_STA_INIT; pOdmRA->HighRSSIThresh = 50; @@ -1139,14 +1135,6 @@ void odm_RefreshRateAdaptiveMask23aCE23a(struct dm_odm_t *pDM_Odm) return; } - if (!pDM_Odm->bUseRAMask) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, - ("<---- odm_RefreshRateAdaptiveMask23a(): driver does not control rate adaptive mask\n")); - return; - } - - /* printk("==> %s \n", __func__); */ - for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) { struct sta_info *pstat = pDM_Odm->pODM_StaInfo[i]; if (pstat) { diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 5a0561e092ac..df0915dc9ef6 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -749,9 +749,6 @@ struct dm_odm_t { u8 RSSI_BT; /* come from BT */ bool bPSDinProcess; - /* for rate adaptive, in fact, 88c/92c fw will handle this */ - u8 bUseRAMask; - struct odm_rate_adapt RateAdaptive; -- cgit v1.2.3 From 162904699ab96b3117976a0e4804028199113dd4 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 27 Feb 2015 15:45:30 -0500 Subject: staging: rtl8723au: No need for two copies of rf_type Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 12 +++--------- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 7 ------- drivers/staging/rtl8723au/include/odm.h | 16 ---------------- 3 files changed, 3 insertions(+), 32 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 2a77fb853166..1b2baae6f0db 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -319,9 +319,6 @@ void ODM_CmnInfoInit23a(struct dm_odm_t *pDM_Odm, case ODM_CMNINFO_FAB_VER: pDM_Odm->FabVersion = (u8)Value; break; - case ODM_CMNINFO_RF_TYPE: - pDM_Odm->RFType = (u8)Value; - break; case ODM_CMNINFO_BOARD_TYPE: pDM_Odm->BoardType = (u8)Value; break; @@ -383,9 +380,6 @@ void ODM_CmnInfoUpdate23a(struct dm_odm_t *pDM_Odm, u32 CmnInfo, u64 Value) { /* This init variable may be changed in run time. */ switch (CmnInfo) { - case ODM_CMNINFO_RF_TYPE: - pDM_Odm->RFType = (u8)Value; - break; case ODM_CMNINFO_WIFI_DIRECT: pDM_Odm->bWIFI_Direct = (bool)Value; break; @@ -460,7 +454,6 @@ void odm_CmnInfoInit_Debug23a(struct dm_odm_t *pDM_Odm) ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportICType = 0x%x\n", pDM_Odm->SupportICType)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("CutVersion =%d\n", pDM_Odm->CutVersion)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("FabVersion =%d\n", pDM_Odm->FabVersion)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("RFType =%d\n", pDM_Odm->RFType)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("BoardType =%d\n", pDM_Odm->BoardType)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("ExtLNA =%d\n", pDM_Odm->ExtLNA)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("ExtPA =%d\n", pDM_Odm->ExtPA)); @@ -1053,7 +1046,8 @@ u32 ODM_Get_Rate_Bitmap23a(struct hal_data_8723a *pHalData, u32 macid, break; case (ODM_WM_B|ODM_WM_G|ODM_WM_N24G): case (ODM_WM_A|ODM_WM_B|ODM_WM_G|ODM_WM_N24G): - if (pDM_Odm->RFType == ODM_1T2R || pDM_Odm->RFType == ODM_1T1R) { + if (pHalData->rf_type == RF_1T2R || + pHalData->rf_type == RF_1T1R) { if (rssi_level == DM_RATR_STA_HIGH) { rate_bitmap = 0x000f0000; } else if (rssi_level == DM_RATR_STA_MIDDLE) { @@ -1082,7 +1076,7 @@ u32 ODM_Get_Rate_Bitmap23a(struct hal_data_8723a *pHalData, u32 macid, default: /* case WIRELESS_11_24N: */ /* case WIRELESS_11_5N: */ - if (pDM_Odm->RFType == RF_1T2R) + if (pHalData->rf_type == RF_1T2R) rate_bitmap = 0x000fffff; else rate_bitmap = 0x0fffffff; diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index fa826b068d11..48edd020c0de 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -121,13 +121,6 @@ void rtl8723a_init_dm_priv(struct rtw_adapter *Adapter) } ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_PATCH_ID, pHalData->CustomerID); ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_BWIFI_TEST, Adapter->registrypriv.wifi_spec); - - if (pHalData->rf_type == RF_1T1R) - ODM_CmnInfoUpdate23a(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T1R); - else if (pHalData->rf_type == RF_2T2R) - ODM_CmnInfoUpdate23a(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T2R); - else if (pHalData->rf_type == RF_1T2R) - ODM_CmnInfoUpdate23a(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T2R); } static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index df0915dc9ef6..1b8189b635fb 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -304,7 +304,6 @@ enum odm_cmninfo { ODM_CMNINFO_IC_TYPE, /* enum odm_ic_type_def */ ODM_CMNINFO_CUT_VER, /* enum odm_cut_version */ ODM_CMNINFO_FAB_VER, /* enum odm_fab_version */ - ODM_CMNINFO_RF_TYPE, /* enum rf_path_def or enum odm_rf_type? */ ODM_CMNINFO_BOARD_TYPE, /* enum odm_board_type */ ODM_CMNINFO_EXT_LNA, /* true */ ODM_CMNINFO_EXT_PA, @@ -409,7 +408,6 @@ enum odm_fab_version { ODM_UMC = 1, }; -/* ODM_CMNINFO_RF_TYPE */ /* For example 1T2R (A+AB = BIT0|BIT4|BIT5) */ enum rf_path_def { ODM_RF_TX_A = BIT(0), @@ -422,18 +420,6 @@ enum rf_path_def { ODM_RF_RX_D = BIT(7), }; - -enum odm_rf_type { - ODM_1T1R = 0, - ODM_1T2R = 1, - ODM_2T2R = 2, - ODM_2T3R = 3, - ODM_2T4R = 4, - ODM_3T3R = 5, - ODM_3T4R = 6, - ODM_4T4R = 7, -}; - /* ODM Dynamic common info value definition */ enum odm_mac_phy_mode { @@ -653,8 +639,6 @@ struct dm_odm_t { u8 CutVersion; /* Fab Version TSMC/UMC = 0/1 */ u8 FabVersion; - /* RF Type 4T4R/3T3R/2T2R/1T2R/1T1R/... */ - u8 RFType; /* Board Type Normal/HighPower/MiniCard/SLIM/Combo/... = 0/1/2/3/4/... */ u8 BoardType; /* with external LNA NO/Yes = 0/1 */ -- cgit v1.2.3 From f1508fe3bb77613162524654db5f9fc138920617 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 27 Feb 2015 15:45:31 -0500 Subject: staging: rtl8723au: Be more consistent in checking for 2 TX paths Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c index 179a1ba03029..00faa6c7264c 100644 --- a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c +++ b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c @@ -23,9 +23,8 @@ #define DPK_DELTA_MAPPING_NUM 13 #define index_mapping_HP_NUM 15 /* 091212 chiyokolin */ -static void -odm_TXPowerTrackingCallback_ThermalMeter_92C( - struct rtw_adapter *Adapter) +static void +odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; @@ -35,7 +34,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C( s8 OFDM_index[2], CCK_index = 0, OFDM_index_old[2] = {0}; s8 CCK_index_old = 0; int i = 0; - bool is2T = IS_92C_SERIAL(pHalData->VersionID); u8 OFDM_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB*/ u8 ThermalValue_HP_count = 0; u32 ThermalValue_HP = 0; @@ -60,7 +58,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C( rtl8723a_phy_ap_calibrate(Adapter, (ThermalValue - pHalData->EEPROMThermalMeter)); - if (is2T) + if (pHalData->rf_type == RF_2T2R) rf = 2; else rf = 1; @@ -78,7 +76,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C( } /* Query OFDM path B default setting */ - if (is2T) { + if (pHalData->rf_type == RF_2T2R) { ele_D = PHY_QueryBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord)&bMaskOFDM_D; for (i = 0; i < OFDM_TABLE_SIZE_92C; i++) { /* find the index */ @@ -290,7 +288,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C( rtl8723au_write8(Adapter, 0xa29, CCKSwingTable_Ch1423A[CCK_index][7]); } - if (is2T) { + if (pHalData->rf_type == RF_2T2R) { ele_D = (OFDMSwingTable23A[(u8)OFDM_index[1]] & 0xFFC00000)>>22; /* new element A = element D x X */ @@ -660,9 +658,9 @@ static bool _PHY_SimularityCompare(struct rtw_adapter *pAdapter, int result[][8] u32 i, j, diff, SimularityBitMap, bound = 0; struct hal_data_8723a *pHalData = GET_HAL_DATA(pAdapter); u8 final_candidate[2] = {0xFF, 0xFF}; /* for path A and path B */ - bool bResult = true, is2T = IS_92C_SERIAL(pHalData->VersionID); + bool bResult = true; - if (is2T) + if (pHalData->rf_type == RF_2T2R) bound = 8; else bound = 4; @@ -699,7 +697,7 @@ static bool _PHY_SimularityCompare(struct rtw_adapter *pAdapter, int result[][8] for (i = 0; i < 4; i++) result[3][i] = result[c1][i]; return false; - } else if (!(SimularityBitMap & 0xF0) && is2T) { + } else if (!(SimularityBitMap & 0xF0) && pHalData->rf_type == RF_2T2R) { /* path B OK */ for (i = 4; i < 8; i++) result[3][i] = result[c1][i]; -- cgit v1.2.3 From 277c722cd6fb71b0d2aafce4887f32d92c3baca3 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 27 Feb 2015 15:45:32 -0500 Subject: staging: rtl8723au: Remove rf type from struct hal_version This gets rid of yet another duplicated copy of the RF type Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c | 19 +++++----- drivers/staging/rtl8723au/hal/hal_com.c | 40 ---------------------- drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 4 +-- drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 10 +----- drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c | 4 +-- drivers/staging/rtl8723au/hal/usb_halinit.c | 15 +------- drivers/staging/rtl8723au/include/HalVerDef.h | 22 ------------ drivers/staging/rtl8723au/include/hal_com.h | 1 - 8 files changed, 13 insertions(+), 102 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c index 00faa6c7264c..2dac6f0cd9c2 100644 --- a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c +++ b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c @@ -978,12 +978,10 @@ void rtl8723a_phy_iq_calibrate(struct rtw_adapter *pAdapter, bool bReCovery) is13simular = false; for (i = 0; i < 3; i++) { - if (IS_92C_SERIAL(pHalData->VersionID)) { - _PHY_IQCalibrate(pAdapter, result, i, true); - } else { - /* For 88C 1T1R */ + if (pHalData->rf_type == RF_2T2R) + _PHY_IQCalibrate(pAdapter, result, i, true); + else /* For 88C 1T1R */ _PHY_IQCalibrate(pAdapter, result, i, false); - } if (i == 1) { is12simular = _PHY_SimularityCompare(pAdapter, result, 0, 1); @@ -1051,9 +1049,10 @@ void rtl8723a_phy_iq_calibrate(struct rtw_adapter *pAdapter, bool bReCovery) if ((RegE94 != 0)/*&&(RegEA4 != 0)*/) _PHY_PathAFillIQKMatrix(pAdapter, bPathAOK, result, final_candidate, (RegEA4 == 0)); - if (IS_92C_SERIAL(pHalData->VersionID)) { + if (pHalData->rf_type == RF_2T2R) { if ((RegEB4 != 0)/*&&(RegEC4 != 0)*/) - _PHY_PathBFillIQKMatrix(pAdapter, bPathBOK, result, final_candidate, (RegEC4 == 0)); + _PHY_PathBFillIQKMatrix(pAdapter, bPathBOK, result, + final_candidate, (RegEC4 == 0)); } _PHY_SaveADDARegisters(pAdapter, IQK_BB_REG_92C, pdmpriv->IQK_BB_backup_recover, 9); @@ -1072,12 +1071,10 @@ void rtl8723a_phy_lc_calibrate(struct rtw_adapter *pAdapter) if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) return; - if (IS_92C_SERIAL(pHalData->VersionID)) { + if (pHalData->rf_type == RF_2T2R) _PHY_LCCalibrate(pAdapter, true); - } else { - /* For 88C 1T1R */ + else /* For 88C 1T1R */ _PHY_LCCalibrate(pAdapter, false); - } } void diff --git a/drivers/staging/rtl8723au/hal/hal_com.c b/drivers/staging/rtl8723au/hal/hal_com.c index c9bb3e1ff0e8..db7d57e28165 100644 --- a/drivers/staging/rtl8723au/hal/hal_com.c +++ b/drivers/staging/rtl8723au/hal/hal_com.c @@ -22,46 +22,6 @@ #define _HAL_INIT_C_ -void dump_chip_info23a(struct hal_version ChipVersion) -{ - int cnt = 0; - u8 buf[128]; - - cnt += sprintf((buf + cnt), "Chip Version Info: CHIP_8723A_"); - - cnt += sprintf((buf + cnt), "%s_", IS_NORMAL_CHIP(ChipVersion) ? - "Normal_Chip" : "Test_Chip"); - cnt += sprintf((buf + cnt), "%s_", - IS_CHIP_VENDOR_TSMC(ChipVersion) ? "TSMC" : "UMC"); - if (IS_A_CUT(ChipVersion)) - cnt += sprintf((buf + cnt), "A_CUT_"); - else if (IS_B_CUT(ChipVersion)) - cnt += sprintf((buf + cnt), "B_CUT_"); - else if (IS_C_CUT(ChipVersion)) - cnt += sprintf((buf + cnt), "C_CUT_"); - else if (IS_D_CUT(ChipVersion)) - cnt += sprintf((buf + cnt), "D_CUT_"); - else if (IS_E_CUT(ChipVersion)) - cnt += sprintf((buf + cnt), "E_CUT_"); - else - cnt += sprintf((buf + cnt), "UNKNOWN_CUT(%d)_", - ChipVersion.CUTVersion); - - if (IS_1T1R(ChipVersion)) - cnt += sprintf((buf + cnt), "1T1R_"); - else if (IS_1T2R(ChipVersion)) - cnt += sprintf((buf + cnt), "1T2R_"); - else if (IS_2T2R(ChipVersion)) - cnt += sprintf((buf + cnt), "2T2R_"); - else - cnt += sprintf((buf + cnt), "UNKNOWN_RFTYPE(%d)_", - ChipVersion.RFType); - - cnt += sprintf((buf + cnt), "RomVer(%d)\n", ChipVersion.ROMVer); - - DBG_8723A("%s", buf); -} - #define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 /* return the final channel plan decision */ diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c index 3304e55108ee..11e1108d0c56 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c @@ -169,10 +169,8 @@ void rtl8723a_set_FwPwrMode_cmd(struct rtw_adapter *padapter, u8 Mode) prevent conficting setting in Fw power */ /* saving sequence. 2010.06.07. Added by tynli. Suggested by SD3 yschang. */ - if ((Mode != PS_MODE_ACTIVE) && - (!IS_92C_SERIAL(pHalData->VersionID))) { + if (Mode != PS_MODE_ACTIVE && pHalData->rf_type != RF_2T2R) ODM_RF_Saving23a(&pHalData->odmpriv, true); - } H2CSetPwrMode.Mode = Mode; H2CSetPwrMode.SmartPS = pwrpriv->smart_ps; diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index eb82c0b880d5..a5729d304c85 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -744,7 +744,7 @@ void rtl8723a_read_chip_version(struct rtw_adapter *padapter) value32 = rtl8723au_read32(padapter, REG_SYS_CFG); ChipVersion.ICType = CHIP_8723A; ChipVersion.ChipType = ((value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP); - ChipVersion.RFType = RF_TYPE_1T1R; + pHalData->rf_type = RF_1T1R; ChipVersion.VendorType = ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : CHIP_VENDOR_TSMC); ChipVersion.CUTVersion = (value32 & CHIP_VER_RTL_MASK) >> CHIP_VER_RTL_SHIFT; /* IC version (CUT) */ @@ -768,16 +768,8 @@ void rtl8723a_read_chip_version(struct rtw_adapter *padapter) pHalData->PolarityCtl = ((value32 & WL_HWPDN_SL) ? RT_POLARITY_HIGH_ACT : RT_POLARITY_LOW_ACT); - dump_chip_info23a(ChipVersion); pHalData->VersionID = ChipVersion; - if (IS_1T2R(ChipVersion)) - pHalData->rf_type = RF_1T2R; - else if (IS_2T2R(ChipVersion)) - pHalData->rf_type = RF_2T2R; - else - pHalData->rf_type = RF_1T1R; - MSG_8723A("RF_Type is %x!!\n", pHalData->rf_type); } diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c index 19dc5e3b2e2e..2cdadc27b3d8 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c @@ -419,7 +419,6 @@ PHY_SetRFReg(struct rtw_adapter *Adapter, enum RF_RADIO_PATH eRFPath, int PHY_MACConfig8723A(struct rtw_adapter *Adapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - bool is92C = IS_92C_SERIAL(pHalData->VersionID); /* */ /* Config MAC */ @@ -429,7 +428,8 @@ int PHY_MACConfig8723A(struct rtw_adapter *Adapter) /* 2010.07.13 AMPDU aggregation number 9 */ /* rtw_write16(Adapter, REG_MAX_AGGR_NUM, MAX_AGGR_NUM); */ rtl8723au_write8(Adapter, REG_MAX_AGGR_NUM, 0x0A); - if (is92C && (BOARD_USB_DONGLE == pHalData->BoardType)) + if (pHalData->rf_type == RF_2T2R && + BOARD_USB_DONGLE == pHalData->BoardType) rtl8723au_write8(Adapter, 0x40, 0x04); return _SUCCESS; diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index 173893474fd7..a5e881b0da24 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -447,22 +447,9 @@ static void _InitRetryFunction(struct rtw_adapter *Adapter) static void _InitRFType(struct rtw_adapter *Adapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - bool is92CU = IS_92C_SERIAL(pHalData->VersionID); pHalData->rf_chip = RF_6052; - - if (!is92CU) { - pHalData->rf_type = RF_1T1R; - DBG_8723A("Set RF Chip ID to RF_6052 and RF type to 1T1R.\n"); - return; - } - - /* TODO: Consider that EEPROM set 92CU to 1T1R later. */ - /* Force to overwrite setting according to chip version. Ignore - EEPROM setting. */ - /* pHalData->RF_Type = is92CU ? RF_2T2R : RF_1T1R; */ - MSG_8723A("Set RF Chip ID to RF_6052 and RF type to %d.\n", - pHalData->rf_type); + pHalData->rf_type = RF_1T1R; } /* Set CCK and OFDM Block "ON" */ diff --git a/drivers/staging/rtl8723au/include/HalVerDef.h b/drivers/staging/rtl8723au/include/HalVerDef.h index 607b71f6e1e4..2a0e4ea7afad 100644 --- a/drivers/staging/rtl8723au/include/HalVerDef.h +++ b/drivers/staging/rtl8723au/include/HalVerDef.h @@ -51,30 +51,17 @@ enum hal_vendor { CHIP_VENDOR_UMC = 1, }; -enum hal_rf_type { - RF_TYPE_1T1R = 0, - RF_TYPE_1T2R = 1, - RF_TYPE_2T2R = 2, - RF_TYPE_2T3R = 3, - RF_TYPE_2T4R = 4, - RF_TYPE_3T3R = 5, - RF_TYPE_3T4R = 6, - RF_TYPE_4T4R = 7, -}; - struct hal_version { enum hal_ic_type ICType; enum hal_chip_type ChipType; enum hal_cut_version CUTVersion; enum hal_vendor VendorType; - enum hal_rf_type RFType; u8 ROMVer; }; /* Get element */ #define GET_CVID_IC_TYPE(version) ((version).ICType) #define GET_CVID_CHIP_TYPE(version) ((version).ChipType) -#define GET_CVID_RF_TYPE(version) ((version).RFType) #define GET_CVID_MANUFACTUER(version) ((version).VendorType) #define GET_CVID_CUT_VERSION(version) ((version).CUTVersion) #define GET_CVID_ROM_VERSION(version) (((version).ROMVer) & ROM_VERSION_MASK) @@ -108,17 +95,8 @@ struct hal_version { #define IS_CHIP_VENDOR_UMC(version) \ ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false) -#define IS_1T1R(version) \ - ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T1R) ? true : false) -#define IS_1T2R(version) \ - ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R) ? true : false) -#define IS_2T2R(version) \ - ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false) - /* Chip version Macro. -- */ -#define IS_92C_SERIAL(version) \ - ((IS_81XXC(version) && IS_2T2R(version)) ? true : false) #define IS_81xxC_VENDOR_UMC_A_CUT(version) \ (IS_81XXC(version)?(IS_CHIP_VENDOR_UMC(version) ? \ (IS_A_CUT(version) ? true : false) : false) : false) diff --git a/drivers/staging/rtl8723au/include/hal_com.h b/drivers/staging/rtl8723au/include/hal_com.h index e946c4ba9d16..9c50320b2100 100644 --- a/drivers/staging/rtl8723au/include/hal_com.h +++ b/drivers/staging/rtl8723au/include/hal_com.h @@ -116,7 +116,6 @@ #define REG_NOA_DESC_COUNT 0x05EC #include "HalVerDef.h" -void dump_chip_info23a(struct hal_version ChipVersion); u8 /* return the final channel plan decision */ -- cgit v1.2.3 From 929e570ae2bf571b7448dd41a3f37a11f077518e Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 27 Feb 2015 15:45:33 -0500 Subject: staging: rtl8723au: The RF on an 8723au is always a 6052 Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c | 34 +--------------------- drivers/staging/rtl8723au/hal/usb_halinit.c | 12 -------- drivers/staging/rtl8723au/include/Hal8723APhyCfg.h | 9 ------ drivers/staging/rtl8723au/include/rtl8723a_hal.h | 1 - 4 files changed, 1 insertion(+), 55 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c index 2cdadc27b3d8..9f0370da6357 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c @@ -920,10 +920,6 @@ _PHY_SetBWMode23a92C(struct rtw_adapter *Adapter) u8 regBwOpMode; u8 regRRSR_RSC; - /* There is no 40MHz mode in RF_8225. */ - if (pHalData->rf_chip == RF_8225) - return; - if (Adapter->bDriverStopped) return; @@ -997,35 +993,7 @@ _PHY_SetBWMode23a92C(struct rtw_adapter *Adapter) /* RT_TRACE(COMP_SCAN, DBG_LOUD, ("SetBWMode23aCallback8190Pci: time of SetBWMode23a = %I64d us!\n", (EndTime - BeginTime))); */ - /* 3<3>Set RF related register */ - switch (pHalData->rf_chip) { - case RF_8225: - /* PHY_SetRF8225Bandwidth(Adapter, - pHalData->CurrentChannelBW); */ - break; - - case RF_8256: - /* Please implement this function in Hal8190PciPhy8256.c */ - /* PHY_SetRF8256Bandwidth(Adapter, - pHalData->CurrentChannelBW); */ - break; - - case RF_8258: - /* Please implement this function in Hal8190PciPhy8258.c */ - /* PHY_SetRF8258Bandwidth(); */ - break; - - case RF_6052: - rtl8723a_phy_rf6052set_bw(Adapter, pHalData->CurrentChannelBW); - break; - - default: - /* RT_ASSERT(false, ("Unknown RFChipID: %d\n", - pHalData->RFChipID)); */ - break; - } - - /* pHalData->SetBWMode23aInProgress = false; */ + rtl8723a_phy_rf6052set_bw(Adapter, pHalData->CurrentChannelBW); /* RT_TRACE(COMP_SCAN, DBG_LOUD, ("<== PHY_SetBWMode23aCallback8192C() \n")); */ diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index a5e881b0da24..57518dc67509 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -448,7 +448,6 @@ static void _InitRFType(struct rtw_adapter *Adapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - pHalData->rf_chip = RF_6052; pHalData->rf_type = RF_1T1R; } @@ -1088,13 +1087,6 @@ static void _ReadPROMContent(struct rtw_adapter *Adapter) readAdapterInfo(Adapter); } -static void _ReadRFType(struct rtw_adapter *Adapter) -{ - struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - - pHalData->rf_chip = RF_6052; -} - /* */ /* Description: */ /* We should set Efuse cell selection to WiFi cell in default. */ @@ -1124,12 +1116,8 @@ void rtl8723a_read_adapter_info(struct rtw_adapter *Adapter) hal_EfuseCellSel(Adapter); - _ReadRFType(Adapter);/* rf_chip -> _InitRFType() */ _ReadPROMContent(Adapter); - /* MSG_8723A("%s()(done), rf_chip = 0x%x, rf_type = 0x%x\n", - __func__, pHalData->rf_chip, pHalData->rf_type); */ - MSG_8723A("<==== _ReadAdapterInfo8723AU in %d ms\n", jiffies_to_msecs(jiffies - start)); } diff --git a/drivers/staging/rtl8723au/include/Hal8723APhyCfg.h b/drivers/staging/rtl8723au/include/Hal8723APhyCfg.h index 2247d9874719..f1b8f2f8cc9b 100644 --- a/drivers/staging/rtl8723au/include/Hal8723APhyCfg.h +++ b/drivers/staging/rtl8723au/include/Hal8723APhyCfg.h @@ -39,15 +39,6 @@ enum WIRELESS_MODE { WIRELESS_MODE_AC = BIT(6) }; -/* BB/RF related */ -enum rf_type_8190p { - RF_TYPE_MIN, /* 0 */ - RF_8225 = 1, /* 1 11b/g RF for verification only */ - RF_8256 = 2, /* 2 11b/g/n */ - RF_8258 = 3, /* 3 11a/b/g/n RF */ - RF_6052 = 4, /* 4 11b/g/n RF */ -}; - struct bb_reg_define { u32 rfintfs; /* set software control: */ /* 0x870~0x877[8 bytes] */ diff --git a/drivers/staging/rtl8723au/include/rtl8723a_hal.h b/drivers/staging/rtl8723au/include/rtl8723a_hal.h index 5841915d34e1..ad3a442bc000 100644 --- a/drivers/staging/rtl8723au/include/rtl8723a_hal.h +++ b/drivers/staging/rtl8723au/include/rtl8723a_hal.h @@ -270,7 +270,6 @@ struct hal_data_8723a { u16 BasicRateSet; /* rf_ctrl */ - u8 rf_chip; u8 rf_type; u8 NumTotalRFPath; -- cgit v1.2.3 From 19c7b64455d7cfe88844f05025ab40861c12b6b8 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 27 Feb 2015 15:45:34 -0500 Subject: staging: rtl8723au: MAX_AGGR_NUM is not used Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c | 1 - drivers/staging/rtl8723au/include/Hal8723APhyCfg.h | 3 --- 2 files changed, 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c index 9f0370da6357..6d597169c11c 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c @@ -426,7 +426,6 @@ int PHY_MACConfig8723A(struct rtw_adapter *Adapter) ODM_ReadAndConfig_MAC_REG_8723A(&pHalData->odmpriv); /* 2010.07.13 AMPDU aggregation number 9 */ - /* rtw_write16(Adapter, REG_MAX_AGGR_NUM, MAX_AGGR_NUM); */ rtl8723au_write8(Adapter, REG_MAX_AGGR_NUM, 0x0A); if (pHalData->rf_type == RF_2T2R && BOARD_USB_DONGLE == pHalData->BoardType) diff --git a/drivers/staging/rtl8723au/include/Hal8723APhyCfg.h b/drivers/staging/rtl8723au/include/Hal8723APhyCfg.h index f1b8f2f8cc9b..bcf36579f43a 100644 --- a/drivers/staging/rtl8723au/include/Hal8723APhyCfg.h +++ b/drivers/staging/rtl8723au/include/Hal8723APhyCfg.h @@ -16,9 +16,6 @@ #ifndef __INC_HAL8723PHYCFG_H__ #define __INC_HAL8723PHYCFG_H__ -/*--------------------------Define Parameters-------------------------------*/ -#define MAX_AGGR_NUM 0x0909 - /*------------------------------Define structure----------------------------*/ enum RF_RADIO_PATH { RF_PATH_A = 0, /* Radio Path A */ -- cgit v1.2.3 From dd03eed307939ffa768ab80488a4968566259d6d Mon Sep 17 00:00:00 2001 From: Daniele Alessandrelli Date: Sun, 22 Feb 2015 20:28:44 +0100 Subject: staging: rtl8723au: rtl8723a_hal_init.c: remove unnecessary braces Fix all checkpatch "braces {} are not necessary" warnings for rtl8723au/hal/rtl8723a_hal_init.c Signed-off-by: Daniele Alessandrelli Acked-by: Larry Finger Acked-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 40 ++++++++--------------- 1 file changed, 14 insertions(+), 26 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index a5729d304c85..7b3fdc841aac 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -424,9 +424,8 @@ hal_ReadEFuse_WiFi(struct rtw_adapter *padapter, offset = GET_HDR_OFFSET_2_0(efuseHeader); ReadEFuseByte23a(padapter, eFuse_Addr++, &efuseExtHdr); - if (ALL_WORDS_DISABLED(efuseExtHdr)) { + if (ALL_WORDS_DISABLED(efuseExtHdr)) continue; - } offset |= ((efuseExtHdr & 0xF0) >> 1); wden = (efuseExtHdr & 0x0F); @@ -524,9 +523,8 @@ hal_ReadEFuse_BT(struct rtw_adapter *padapter, ReadEFuseByte23a(padapter, eFuse_Addr++, &efuseExtHdr); - if (ALL_WORDS_DISABLED(efuseExtHdr)) { + if (ALL_WORDS_DISABLED(efuseExtHdr)) continue; - } offset |= ((efuseExtHdr & 0xF0) >> 1); wden = (efuseExtHdr & 0x0F); @@ -630,9 +628,8 @@ u16 rtl8723a_EfuseGetCurrentSize_WiFi(struct rtw_adapter *padapter) hoffset = GET_HDR_OFFSET_2_0(efuse_data); efuse_addr++; efuse_OneByteRead23a(padapter, efuse_addr, &efuse_data); - if (ALL_WORDS_DISABLED(efuse_data)) { + if (ALL_WORDS_DISABLED(efuse_data)) continue; - } hoffset |= ((efuse_data & 0xF0) >> 1); hworden = efuse_data & 0x0F; @@ -721,9 +718,8 @@ u16 rtl8723a_EfuseGetCurrentSize_BT(struct rtw_adapter *padapter) } /* Check if we need to check next bank efuse */ - if (efuse_addr < retU2) { + if (efuse_addr < retU2) break; /* don't need to check next bank. */ - } } retU2 = ((bank - 1) * EFUSE_BT_REAL_BANK_CONTENT_LEN) + efuse_addr; @@ -1140,9 +1136,8 @@ static int _LLTWrite(struct rtw_adapter *padapter, u32 address, u32 data) /* polling */ do { value = rtl8723au_read32(padapter, LLTReg); - if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) { + if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) break; - } if (count > POLLING_LLT_THRESHOLD) { RT_TRACE(_module_hal_init_c_, _drv_err_, @@ -1165,16 +1160,14 @@ int InitLLTTable23a(struct rtw_adapter *padapter, u32 boundary) for (i = 0; i < (txpktbuf_bndy - 1); i++) { status = _LLTWrite(padapter, i, i + 1); - if (status != _SUCCESS) { + if (status != _SUCCESS) return status; - } } /* end of list */ status = _LLTWrite(padapter, (txpktbuf_bndy - 1), 0xFF); - if (status != _SUCCESS) { + if (status != _SUCCESS) return status; - } /* Make the other pages as ring buffer */ /* This ring buffer is used as beacon buffer if we config this @@ -1182,16 +1175,14 @@ int InitLLTTable23a(struct rtw_adapter *padapter, u32 boundary) /* Otherwise used as local loopback buffer. */ for (i = txpktbuf_bndy; i < Last_Entry_Of_TxPktBuf; i++) { status = _LLTWrite(padapter, i, (i + 1)); - if (_SUCCESS != status) { + if (_SUCCESS != status) return status; - } } /* Let last entry point to the start entry of ring buffer */ status = _LLTWrite(padapter, Last_Entry_Of_TxPktBuf, txpktbuf_bndy); - if (status != _SUCCESS) { + if (status != _SUCCESS) return status; - } return status; } @@ -1426,9 +1417,9 @@ static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM) /* HW Auto state machine */ int CardDisableHWSM(struct rtw_adapter *padapter, u8 resetMCU) { - if (padapter->bSurpriseRemoved) { + if (padapter->bSurpriseRemoved) return _SUCCESS; - } + /* RF Off Sequence ==== */ _DisableRFAFEAndResetBB8192C(padapter); @@ -1450,9 +1441,8 @@ int CardDisableHWSM(struct rtw_adapter *padapter, u8 resetMCU) /* without HW Auto state machine */ int CardDisableWithoutHWSM(struct rtw_adapter *padapter) { - if (padapter->bSurpriseRemoved) { + if (padapter->bSurpriseRemoved) return _SUCCESS; - } /* RF Off Sequence ==== */ _DisableRFAFEAndResetBB8192C(padapter); @@ -1866,9 +1856,8 @@ static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc) /* Clear first */ ptxdesc->txdw7 &= cpu_to_le32(0xffff0000); - for (index = 0; index < count; index++) { + for (index = 0; index < count; index++) checksum ^= le16_to_cpu(*(usPtr + index)); - } ptxdesc->txdw7 |= cpu_to_le32(checksum & 0x0000ffff); } @@ -1916,9 +1905,8 @@ void rtl8723a_fill_fake_txdesc(struct rtw_adapter *padapter, u8 *pDesc, ptxdesc->txdw3 |= cpu_to_le32((8 << 28)); } - if (true == IsBTQosNull) { + if (true == IsBTQosNull) ptxdesc->txdw2 |= cpu_to_le32(BIT(23)); /* BT NULL */ - } /* offset 16 */ ptxdesc->txdw4 |= cpu_to_le32(BIT(8)); /* driver uses rate */ -- cgit v1.2.3 From 6ba67a5a7bca9cb00562127d7410d412d3aa923b Mon Sep 17 00:00:00 2001 From: Yeliz Taneroglu Date: Mon, 2 Mar 2015 17:49:59 +0200 Subject: Staging: fbtft-core: remove unnecessary line continuations This fixes the checkpatch.pl warning: WARNING: Avoid unnecessary line continuations Signed-off-by: Yeliz Taneroglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index e8d8d07d5f23..9ce929d0e5c2 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -379,7 +379,7 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned start_line, int ret = 0; if (unlikely(par->debug & (DEBUG_TIME_FIRST_UPDATE | DEBUG_TIME_EACH_UPDATE))) { - if ((par->debug & DEBUG_TIME_EACH_UPDATE) || \ + if ((par->debug & DEBUG_TIME_EACH_UPDATE) || ((par->debug & DEBUG_TIME_FIRST_UPDATE) && !par->first_update_done)) { getnstimeofday(&ts_start); timeit = true; @@ -1276,7 +1276,7 @@ static int fbtft_verify_gpios(struct fbtft_par *par) fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); pdata = par->info->device->platform_data; - if (pdata->display.buswidth != 9 && par->startbyte == 0 && \ + if (pdata->display.buswidth != 9 && par->startbyte == 0 && par->gpio.dc < 0) { dev_err(par->info->device, "Missing info about 'dc' gpio. Aborting.\n"); -- cgit v1.2.3 From 6cb624ef71fb267026ace1e2aa91b9861e3c2457 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Mon, 2 Mar 2015 22:56:53 +0200 Subject: Staging: fbtft: Remove unnecessary 'out of memory' message. This patch fixes checkpatch.pl warning in file fbtft-core.c WARNING: Possible unnecessary 'out of memory' message Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 9ce929d0e5c2..3c4769aab678 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -302,12 +302,8 @@ void fbtft_register_backlight(struct fbtft_par *par) bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops), GFP_KERNEL); - if (!bl_ops) { - dev_err(par->info->device, - "%s: could not allocate memeory for backlight operations.\n", - __func__); + if (!bl_ops) return; - } bl_ops->get_brightness = fbtft_backlight_get_brightness; bl_ops->update_status = fbtft_backlight_update_status; -- cgit v1.2.3 From fad0d05f7c05d9990e0fe3759511069e9e5e5c9e Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Mon, 2 Mar 2015 23:28:14 +0200 Subject: Staging: fbtft: Remove unnecessary 'out of memory' message. This patch fixes checkpatch.pl warning in file fb_ssd1351.c WARNING: Possible unnecessary 'out of memory' message Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_ssd1351.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c index b59120c0eb70..fd492b4eaad6 100644 --- a/drivers/staging/fbtft/fb_ssd1351.c +++ b/drivers/staging/fbtft/fb_ssd1351.c @@ -218,12 +218,8 @@ static void register_onboard_backlight(struct fbtft_par *par) bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops), GFP_KERNEL); - if (!bl_ops) { - dev_err(par->info->device, - "%s: could not allocate memory for backlight operations.\n", - __func__); + if (!bl_ops) return; - } bl_ops->update_status = update_onboard_backlight; bl_props.type = BACKLIGHT_RAW; -- cgit v1.2.3 From f6ef6c094ebd43e393657f4ae9cc3383dffda303 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Mon, 2 Mar 2015 20:01:42 +0300 Subject: Staging: emxx_udc: Fix do not add new typedefs and remove volatile This patch fixes the following checkpatch.pl warnings:"do not add new typedefs" and "Use of volatile is usually wrong". Remove typedefs keyword and rename identifiers appropriately. Remove volatile from union usb_regs_access Update related files. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 60 ++++++++++++++++++------------------- drivers/staging/emxx_udc/emxx_udc.h | 27 ++++++++--------- 2 files changed, 43 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index ee8f69f69eac..a9bbf8e3d6ea 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -201,7 +201,7 @@ static u32 _nbu2ss_get_begin_ram_address(struct nbu2ss_udc *udc) u32 num, buf_type; u32 data, last_ram_adr, use_ram_size; - PT_EP_REGS p_ep_regs; + struct ep_regs *p_ep_regs; last_ram_adr = (D_RAM_SIZE_CTRL / sizeof(u32)) * 2; use_ram_size = 0; @@ -394,7 +394,7 @@ static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) { u32 num; u32 data; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (udc->vbus_active == 0) return; /* VBUS OFF */ @@ -425,7 +425,7 @@ static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /* Abort DMA */ static void _nbu2ss_ep_dma_abort(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) { - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; _nbu2ss_bitclr(&preg->EP_DCR[ep->epnum-1].EP_DCR1, DCR1_EPn_REQEN); mdelay(DMA_DISABLE_TIME); /* DCR1_EPn_REQEN Clear */ @@ -443,7 +443,7 @@ static void _nbu2ss_ep_in_end( { u32 data; u32 num; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (length >= sizeof(u32)) return; @@ -567,7 +567,7 @@ static int EP0_out_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) u32 i; int nret = 0; u32 iWordLength = 0; - USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; + union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf; /*------------------------------------------------------------*/ /* Read Length */ @@ -592,8 +592,8 @@ static int EP0_out_OverBytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) { u32 i; u32 iReadSize = 0; - USB_REG_ACCESS Temp32; - USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; + union usb_reg_access Temp32; + union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf; if ((0 < length) && (length < sizeof(u32))) { Temp32.dw = _nbu2ss_readl(&udc->p_regs->EP0_READ); @@ -613,7 +613,7 @@ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) u32 iMaxLength = EP0_PACKETSIZE; u32 iWordLength = 0; u32 iWriteLength = 0; - USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; + union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf; /*------------------------------------------------------------*/ /* Transfer Length */ @@ -638,8 +638,8 @@ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) static int EP0_in_OverBytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 iRemainSize) { u32 i; - USB_REG_ACCESS Temp32; - USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; + union usb_reg_access Temp32; + union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf; if ((0 < iRemainSize) && (iRemainSize < sizeof(u32))) { for (i = 0 ; i < iRemainSize ; i++) @@ -840,7 +840,7 @@ static int _nbu2ss_out_dma( u32 burst = 1; u32 data; int result = -EINVAL; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (req->dma_flag) return 1; /* DMA is forwarded */ @@ -900,10 +900,10 @@ static int _nbu2ss_epn_out_pio( u32 i; u32 data; u32 iWordLength; - USB_REG_ACCESS Temp32; - USB_REG_ACCESS *pBuf32; + union usb_reg_access Temp32; + union usb_reg_access *pBuf32; int result = 0; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (req->dma_flag) return 1; /* DMA is forwarded */ @@ -912,7 +912,7 @@ static int _nbu2ss_epn_out_pio( return 0; pBuffer = (u8 *)req->req.buf; - pBuf32 = (USB_REG_ACCESS *)(pBuffer + req->req.actual); + pBuf32 = (union usb_reg_access *)(pBuffer + req->req.actual); iWordLength = length / sizeof(u32); if (iWordLength > 0) { @@ -988,7 +988,7 @@ static int _nbu2ss_epn_out_transfer( u32 num; u32 iRecvLength; int result = 1; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (ep->epnum == 0) return -EINVAL; @@ -1051,7 +1051,7 @@ static int _nbu2ss_in_dma( u32 iWriteLength; u32 data; int result = -EINVAL; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (req->dma_flag) return 1; /* DMA is forwarded */ @@ -1123,17 +1123,17 @@ static int _nbu2ss_epn_in_pio( u32 i; u32 data; u32 iWordLength; - USB_REG_ACCESS Temp32; - USB_REG_ACCESS *pBuf32 = NULL; + union usb_reg_access Temp32; + union usb_reg_access *pBuf32 = NULL; int result = 0; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (req->dma_flag) return 1; /* DMA is forwarded */ if (length > 0) { pBuffer = (u8 *)req->req.buf; - pBuf32 = (USB_REG_ACCESS *)(pBuffer + req->req.actual); + pBuf32 = (union usb_reg_access *)(pBuffer + req->req.actual); iWordLength = length / sizeof(u32); if (iWordLength > 0) { @@ -1347,7 +1347,7 @@ static void _nbu2ss_set_endpoint_stall( u8 num, epnum; u32 data; struct nbu2ss_ep *ep; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if ((ep_adrs == 0) || (ep_adrs == 0x80)) { if (bstall) { @@ -1471,7 +1471,7 @@ static int _nbu2ss_get_ep_stall(struct nbu2ss_udc *udc, u8 ep_adrs) { u8 epnum; u32 data = 0, bit_data; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; epnum = ep_adrs & ~USB_ENDPOINT_DIR_MASK; if (epnum == 0) { @@ -1566,7 +1566,7 @@ static void _nbu2ss_epn_set_stall( u32 regdata; int limit_cnt = 0; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (ep->direct == USB_DIR_IN) { for (limit_cnt = 0 @@ -1994,7 +1994,7 @@ static inline void _nbu2ss_epn_in_int( int result = 0; u32 status; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (req->dma_flag) return; /* DMA is forwarded */ @@ -2090,7 +2090,7 @@ static inline void _nbu2ss_epn_out_dma_int( u32 num; u32 dmacnt, ep_dmacnt; u32 mpkt; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; num = ep->epnum - 1; @@ -2293,7 +2293,7 @@ static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on) /*-------------------------------------------------------------------------*/ static void _nbu2ss_fifo_flush(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) { - PT_FC_REGS p = udc->p_regs; + struct fc_regs *p = udc->p_regs; if (udc->vbus_active == 0) return; @@ -2536,7 +2536,7 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc) u32 epnum, int_bit; struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; - PT_FC_REGS preg = udc->p_regs; + struct fc_regs *preg = udc->p_regs; if (gpio_get_value(VBUS_VALUE) == 0) { _nbu2ss_writel(&preg->USB_INT_STA, ~USB_INT_STA_RW); @@ -2944,7 +2944,7 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) struct nbu2ss_ep *ep; struct nbu2ss_udc *udc; unsigned long flags; - PT_FC_REGS preg; + struct fc_regs *preg; /* INFO("=== %s()\n", __func__); */ @@ -3341,7 +3341,7 @@ static int nbu2ss_drv_probe(struct platform_device *pdev) 0, driver_name, udc); /* IO Memory */ - udc->p_regs = (PT_FC_REGS)mmio_base; + udc->p_regs = (struct fc_regs *)mmio_base; /* USB Function Controller Interrupt */ if (status != 0) { diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h index 6f90d5e3cd25..57727c6ed39d 100644 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ b/drivers/staging/emxx_udc/emxx_udc.h @@ -474,8 +474,8 @@ /*===========================================================================*/ /* Struct */ -/*------- T_EP_REGS */ -typedef struct _T_EP_REGS { +/*------- ep_regs */ +struct ep_regs { u32 EP_CONTROL; /* EP Control */ u32 EP_STATUS; /* EP Status */ u32 EP_INT_ENA; /* EP Interrupt Enable */ @@ -484,18 +484,18 @@ typedef struct _T_EP_REGS { u32 EP_LEN_DCNT; /* EP Length & DMA count */ u32 EP_READ; /* EP Read */ u32 EP_WRITE; /* EP Write */ -} T_EP_REGS, *PT_EP_REGS; +}; -/*------- T_EP_DCR */ -typedef struct _T_EP_DCR { +/*------- ep_dcr */ +struct ep_dcr { u32 EP_DCR1; /* EP_DCR1 */ u32 EP_DCR2; /* EP_DCR2 */ u32 EP_TADR; /* EP_TADR */ u32 Reserved; /* Reserved */ -} T_EP_DCR, *PT_EP_DCR; +}; /*------- Function Registers */ -typedef struct _T_FC_REGS { +struct fc_regs { u32 USB_CONTROL; /* (0x0000) USB Control */ u32 USB_STATUS; /* (0x0004) USB Status */ u32 USB_ADDRESS; /* (0x0008) USB Address */ @@ -513,7 +513,7 @@ typedef struct _T_FC_REGS { u32 EP0_READ; /* (0x0038) EP0 Read */ u32 EP0_WRITE; /* (0x003C) EP0 Write */ - T_EP_REGS EP_REGS[REG_EP_NUM]; /* Endpoint Register */ + struct ep_regs EP_REGS[REG_EP_NUM]; /* Endpoint Register */ u8 Reserved220[0x1000-0x220]; /* (0x0220:0x0FFF) Reserved */ @@ -531,11 +531,10 @@ typedef struct _T_FC_REGS { u8 Reserved1028[0x110-0x28]; /* (0x1028:0x110F) Reserved */ - T_EP_DCR EP_DCR[REG_EP_NUM]; /* */ + struct ep_dcr EP_DCR[REG_EP_NUM]; /* */ u8 Reserved1200[0x1000-0x200]; /* Reserved */ - -} __aligned(32) T_FC_REGS, *PT_FC_REGS; +} __aligned(32); @@ -631,16 +630,16 @@ struct nbu2ss_udc { u32 curr_config; /* Current Configuration Number */ - PT_FC_REGS p_regs; + struct fc_regs *p_regs; }; /* USB register access structure */ -typedef volatile union { +union usb_reg_access { struct { unsigned char DATA[4]; } byte; unsigned int dw; -} USB_REG_ACCESS; +}; /*-------------------------------------------------------------------------*/ #define ERR(stuff...) printk(KERN_ERR "udc: " stuff) -- cgit v1.2.3 From d45c4c654d12fee5122e2eead93e5766dfd2259f Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Mon, 2 Mar 2015 21:33:18 +0300 Subject: Staging: emxx_udc: Remove argument test from function This patch removes the test statement for an argument to _nbu2ss_pullup function, for it can't be null due to previous derefrences. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index a9bbf8e3d6ea..4cc6296ed007 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -2257,11 +2257,6 @@ static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on) { u32 reg_dt; - if (!udc) { - ERR("%s, bad param\n", __func__); - return -EINVAL; - } - if (udc->vbus_active == 0) return -ESHUTDOWN; -- cgit v1.2.3 From 886892798c9d29d3bb32e6a6d24e09565d71659e Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Mon, 2 Mar 2015 21:37:38 +0300 Subject: Staging: emxx_udc: Replace custom printk macro ERR with dev_err or pr_err This patch removes the use of custom printk macros ERR and replace it with dev_err, or pr_err in the following cases: - if no appropriate struct device *dev field where found for dev_err. - or dev could be null eg. "dev_err(udc->dev" not possible inside "if (udc == null)" Issue addressed by checkpatch.pl. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 80 +++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 39 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 4cc6296ed007..35dc1c444340 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -115,7 +115,7 @@ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc) pr_info("=== %s()\n", __func__); if (udc == NULL) { - ERR("%s udc == NULL\n", __func__); + pr_err("%s udc == NULL\n", __func__); return; } @@ -808,7 +808,7 @@ static int _nbu2ss_ep0_out_transfer( return 0; /* Short Packet Transfer End */ if (req->req.actual > req->req.length) { - ERR(" *** Overrun Error\n"); + dev_err(udc->dev, " *** Overrun Error\n"); return -EOVERFLOW; } @@ -1026,8 +1026,8 @@ static int _nbu2ss_epn_out_transfer( } if (req->req.actual > req->req.length) { - ERR(" *** Overrun Error\n"); - ERR(" *** actual = %d, length = %d\n", + dev_err(udc->dev, " Overrun Error\n"); + dev_err(udc->dev, " actual = %d, length = %d\n", req->req.actual, req->req.length); result = -EOVERFLOW; } @@ -1638,7 +1638,7 @@ static int std_req_get_status(struct nbu2ss_udc *udc) _nbu2ss_ep0_in_transfer(udc, &udc->ep[0], &udc->ep0_req); } else { - ERR("*** Error GET_STATUS\n"); + dev_err(udc->dev, " Error GET_STATUS\n"); } return result; @@ -2345,7 +2345,7 @@ static int _nbu2ss_enable_controller(struct nbu2ss_udc *udc) waitcnt++; udelay(1); /* 1us wait */ if (waitcnt == EPC_PLL_LOCK_COUNT) { - ERR("*** Reset Cancel failed\n"); + dev_err(udc->dev, "*** Reset Cancel failed\n"); return -EINVAL; } }; @@ -2607,13 +2607,13 @@ static int nbu2ss_ep_enable( struct nbu2ss_udc *udc; if ((_ep == NULL) || (desc == NULL)) { - ERR(" *** %s, bad param\n", __func__); + pr_err(" *** %s, bad param\n", __func__); return -EINVAL; } ep = container_of(_ep, struct nbu2ss_ep, ep); if ((ep == NULL) || (ep->udc == NULL)) { - ERR(" *** %s, ep == NULL !!\n", __func__); + pr_err(" *** %s, ep == NULL !!\n", __func__); return -EINVAL; } @@ -2621,7 +2621,7 @@ static int nbu2ss_ep_enable( if ((ep_type == USB_ENDPOINT_XFER_CONTROL) || (ep_type == USB_ENDPOINT_XFER_ISOC)) { - ERR(" *** %s, bat bmAttributes\n", __func__); + pr_err(" *** %s, bat bmAttributes\n", __func__); return -EINVAL; } @@ -2632,7 +2632,7 @@ static int nbu2ss_ep_enable( if ((udc->driver == NULL) || (udc->gadget.speed == USB_SPEED_UNKNOWN)) { - ERR(" *** %s, udc !!\n", __func__); + dev_err(ep->udc->dev, " *** %s, udc !!\n", __func__); return -ESHUTDOWN; } @@ -2667,13 +2667,13 @@ static int nbu2ss_ep_disable(struct usb_ep *_ep) unsigned long flags; if (_ep == NULL) { - ERR(" *** %s, bad param\n", __func__); + pr_err(" *** %s, bad param\n", __func__); return -EINVAL; } ep = container_of(_ep, struct nbu2ss_ep, ep); if ((ep == NULL) || (ep->udc == NULL)) { - ERR(" *** %s, ep == NULL !!\n", __func__); + pr_err("udc: *** %s, ep == NULL !!\n", __func__); return -EINVAL; } @@ -2737,10 +2737,10 @@ static int nbu2ss_ep_queue( /* catch various bogus parameters */ if ((_ep == NULL) || (_req == NULL)) { if (_ep == NULL) - ERR("*** %s --- _ep == NULL\n", __func__); + pr_err("udc: %s --- _ep == NULL\n", __func__); if (_req == NULL) - ERR("*** %s --- _req == NULL\n", __func__); + pr_err("udc: %s --- _req == NULL\n", __func__); return -EINVAL; } @@ -2751,13 +2751,13 @@ static int nbu2ss_ep_queue( || !list_empty(&req->queue))) { if (!_req->complete) - ERR("*** %s --- !_req->complete\n", __func__); + pr_err("udc: %s --- !_req->complete\n", __func__); if (!_req->buf) - ERR("*** %s --- !_req->buf\n", __func__); + pr_err("udc:%s --- !_req->buf\n", __func__); if (!list_empty(&req->queue)) - ERR("*** %s --- !list_empty(&req->queue)\n", __func__); + pr_err("%s --- !list_empty(&req->queue)\n", __func__); return -EINVAL; } @@ -2773,7 +2773,8 @@ static int nbu2ss_ep_queue( } if (unlikely(!udc->driver)) { - ERR("%s, bogus device state %p\n", __func__, udc->driver); + dev_err(udc->dev, "%s, bogus device state %p\n", __func__, + udc->driver); return -ESHUTDOWN; } @@ -2812,7 +2813,8 @@ static int nbu2ss_ep_queue( result = _nbu2ss_start_transfer(udc, ep, req, FALSE); if (result < 0) { - ERR(" *** %s, result = %d\n", __func__, result); + dev_err(udc->dev, " *** %s, result = %d\n", __func__, + result); list_del(&req->queue); } else if ((ep->epnum > 0) && (ep->direct == USB_DIR_OUT)) { #ifdef USE_DMA @@ -2844,13 +2846,13 @@ static int nbu2ss_ep_dequeue( /* catch various bogus parameters */ if ((_ep == NULL) || (_req == NULL)) { - /* ERR("%s, bad param(1)\n", __func__); */ + /* pr_err("%s, bad param(1)\n", __func__); */ return -EINVAL; } ep = container_of(_ep, struct nbu2ss_ep, ep); if (!ep) { - ERR("%s, ep == NULL !!\n", __func__); + pr_err("%s, ep == NULL !!\n", __func__); return -EINVAL; } @@ -2890,19 +2892,19 @@ static int nbu2ss_ep_set_halt(struct usb_ep *_ep, int value) /* INFO("=== %s()\n", __func__); */ if (!_ep) { - ERR("%s, bad param\n", __func__); + pr_err("%s, bad param\n", __func__); return -EINVAL; } ep = container_of(_ep, struct nbu2ss_ep, ep); if (!ep) { - ERR("%s, bad ep\n", __func__); + pr_err("%s, bad ep\n", __func__); return -EINVAL; } udc = ep->udc; if (!udc) { - ERR(" *** %s, bad udc\n", __func__); + dev_err(ep->udc->dev, " *** %s, bad udc\n", __func__); return -EINVAL; } @@ -2944,19 +2946,19 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) /* INFO("=== %s()\n", __func__); */ if (!_ep) { - ERR("%s, bad param\n", __func__); + pr_err("%s, bad param\n", __func__); return -EINVAL; } ep = container_of(_ep, struct nbu2ss_ep, ep); if (!ep) { - ERR("%s, bad ep\n", __func__); + pr_err("%s, bad ep\n", __func__); return -EINVAL; } udc = ep->udc; if (!udc) { - ERR("%s, bad udc\n", __func__); + dev_err(ep->udc->dev, "%s, bad udc\n", __func__); return -EINVAL; } @@ -2992,19 +2994,19 @@ static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) /* INFO("=== %s()\n", __func__); */ if (!_ep) { - ERR("%s, bad param\n", __func__); + pr_err("udc: %s, bad param\n", __func__); return; } ep = container_of(_ep, struct nbu2ss_ep, ep); if (!_ep) { - ERR("%s, bad ep\n", __func__); + pr_err("udc: %s, bad ep\n", __func__); return; } udc = ep->udc; if (!udc) { - ERR("%s, bad udc\n", __func__); + dev_err(ep->udc->dev, "%s, bad udc\n", __func__); return; } @@ -3048,13 +3050,13 @@ static int nbu2ss_gad_get_frame(struct usb_gadget *pgadget) /* INFO("=== %s()\n", __func__); */ if (pgadget == NULL) { - ERR("%s, bad param\n", __func__); + pr_err("udc: %s, bad param\n", __func__); return -EINVAL; } udc = container_of(pgadget, struct nbu2ss_udc, gadget); if (udc == NULL) { - ERR("%s, udc == NULL\n", __func__); + dev_err(&pgadget->dev, "%s, udc == NULL\n", __func__); return -EINVAL; } @@ -3078,13 +3080,13 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget) /* INFO("=== %s()\n", __func__); */ if (pgadget == NULL) { - ERR("%s, bad param\n", __func__); + pr_err("%s, bad param\n", __func__); return -EINVAL; } udc = container_of(pgadget, struct nbu2ss_udc, gadget); if (udc == NULL) { - ERR("%s, udc == NULL\n", __func__); + dev_err(&pgadget->dev, "%s, udc == NULL\n", __func__); return -EINVAL; } @@ -3118,7 +3120,7 @@ static int nbu2ss_gad_set_selfpowered(struct usb_gadget *pgadget, /* INFO("=== %s()\n", __func__); */ if (pgadget == NULL) { - ERR("%s, bad param\n", __func__); + pr_err("%s, bad param\n", __func__); return -EINVAL; } @@ -3147,7 +3149,7 @@ static int nbu2ss_gad_vbus_draw(struct usb_gadget *pgadget, unsigned mA) /* INFO("=== %s()\n", __func__); */ if (pgadget == NULL) { - ERR("%s, bad param\n", __func__); + pr_err("%s, bad param\n", __func__); return -EINVAL; } @@ -3169,7 +3171,7 @@ static int nbu2ss_gad_pullup(struct usb_gadget *pgadget, int is_on) /* INFO("=== %s()\n", __func__); */ if (pgadget == NULL) { - ERR("%s, bad param\n", __func__); + pr_err("%s, bad param\n", __func__); return -EINVAL; } @@ -3340,7 +3342,7 @@ static int nbu2ss_drv_probe(struct platform_device *pdev) /* USB Function Controller Interrupt */ if (status != 0) { - ERR("request_irq(USB_UDC_IRQ_1) failed\n"); + dev_err(udc->dev, "request_irq(USB_UDC_IRQ_1) failed\n"); goto cleanup1; } @@ -3360,7 +3362,7 @@ static int nbu2ss_drv_probe(struct platform_device *pdev) udc); if (status != 0) { - ERR("request_irq(INT_VBUS) failed\n"); + dev_err(udc->dev, "request_irq(INT_VBUS) failed\n"); goto cleanup1; } -- cgit v1.2.3 From f737ea50bac2f6a06835a3180bdbeae59dc9d735 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Mon, 2 Mar 2015 21:38:22 +0300 Subject: Staging: emxx_udc: Remove custom printk macro ERR This patch removes custom printk macro ERR. All the calls to this macro were replaced by de_err and pr_err. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h index 57727c6ed39d..c19168f78354 100644 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ b/drivers/staging/emxx_udc/emxx_udc.h @@ -642,6 +642,5 @@ union usb_reg_access { }; /*-------------------------------------------------------------------------*/ -#define ERR(stuff...) printk(KERN_ERR "udc: " stuff) #endif /* _LINUX_EMXX_H */ -- cgit v1.2.3 From daa656b2245d9755f28dfdaf78904088d7b6d3b9 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:36 -0500 Subject: staging: rtl8723au: Variable bbtchange is always false Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 1b2baae6f0db..2c604da4488a 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1360,7 +1360,6 @@ static void odm_EdcaTurboCheck23a(struct dm_odm_t *pDM_Odm) u32 edca_param; u64 cur_tx_bytes = 0; u64 cur_rx_bytes = 0; - u8 bbtchange = false; /* For AP/ADSL use struct rtl8723a_priv * */ /* For CE/NIC use struct rtw_adapter * */ @@ -1382,7 +1381,7 @@ static void odm_EdcaTurboCheck23a(struct dm_odm_t *pDM_Odm) goto dm_CheckEdcaTurbo_EXIT; /* Check if the status needs to be changed. */ - if ((bbtchange) || (!precvpriv->bIsAnyNonBEPkts)) { + if (!precvpriv->bIsAnyNonBEPkts) { cur_tx_bytes = pxmitpriv->tx_bytes - pxmitpriv->last_tx_bytes; cur_rx_bytes = precvpriv->rx_bytes - precvpriv->last_rx_bytes; -- cgit v1.2.3 From 4b4431ce04bc6f35f09237b3933fc6d5d7eefeef Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:37 -0500 Subject: staging: rtl8723au: Avoid zero initializing variables unnecessarily Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 2c604da4488a..a77d151f1f08 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1358,8 +1358,8 @@ static void odm_EdcaTurboCheck23a(struct dm_odm_t *pDM_Odm) struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; u32 trafficIndex; u32 edca_param; - u64 cur_tx_bytes = 0; - u64 cur_rx_bytes = 0; + u64 cur_tx_bytes; + u64 cur_rx_bytes; /* For AP/ADSL use struct rtl8723a_priv * */ /* For CE/NIC use struct rtw_adapter * */ -- cgit v1.2.3 From 6520715ed2ccaeff6b797f358e0e2aa64a472db8 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:38 -0500 Subject: staging: rtl8723au: ODM_MAC_EDCA_TURBO is always set Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 3 --- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 1 - drivers/staging/rtl8723au/include/odm.h | 1 - 3 files changed, 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index a77d151f1f08..8dcb020e1f18 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1368,9 +1368,6 @@ static void odm_EdcaTurboCheck23a(struct dm_odm_t *pDM_Odm) /* at the same time. In the stage2/3, we need to prive universal interface and merge all */ /* HW dynamic mechanism. */ - if (!(pDM_Odm->SupportAbility & ODM_MAC_EDCA_TURBO)) - return; - if ((pregpriv->wifi_spec == 1))/* (pmlmeinfo->HT_enable == 0)) */ goto dm_CheckEdcaTurbo_EXIT; diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 48edd020c0de..85be3e0d7feb 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -136,7 +136,6 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) ODM_BB_RSSI_MONITOR | ODM_BB_CCK_PD | ODM_BB_PWR_SAVE | - ODM_MAC_EDCA_TURBO | ODM_RF_TX_PWR_TRACK | ODM_RF_CALIBRATION; /* Pointer reference */ diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 1b8189b635fb..50459f09dbbb 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -362,7 +362,6 @@ enum { ODM_BB_RXHP = BIT(12), /* MAC DM section BIT 16-23 */ - ODM_MAC_EDCA_TURBO = BIT(16), ODM_MAC_EARLY_MODE = BIT(17), /* RF ODM section BIT 24-31 */ -- cgit v1.2.3 From 79afea1b3003115b2c26bab4041e69b31c2a03c6 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:39 -0500 Subject: staging: rtl8723au: ODM_BB_RA_MASK is always set Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 17 ++--------------- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 1 - drivers/staging/rtl8723au/include/odm.h | 1 - 3 files changed, 2 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 8dcb020e1f18..64dd980a170d 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -189,8 +189,6 @@ void odm_DynamicBBPowerSaving23a(struct dm_odm_t *pDM_Odm); /* END---------BB POWER SAVE----------------------- */ -void odm_RefreshRateAdaptiveMask23aCE23a(struct dm_odm_t *pDM_Odm); - void odm_DynamicTxPower23aInit(struct dm_odm_t *pDM_Odm); void odm_RSSIMonitorCheck23aCE(struct dm_odm_t *pDM_Odm); @@ -1107,25 +1105,14 @@ u32 ODM_Get_Rate_Bitmap23a(struct hal_data_8723a *pHalData, u32 macid, * *---------------------------------------------------------------------------*/ void odm_RefreshRateAdaptiveMask23a(struct dm_odm_t *pDM_Odm) -{ - if (!(pDM_Odm->SupportAbility & ODM_BB_RA_MASK)) - return; - /* */ - /* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */ - /* at the same time. In the stage2/3, we need to prive universal interface and merge all */ - /* HW dynamic mechanism. */ - /* */ - odm_RefreshRateAdaptiveMask23aCE23a(pDM_Odm); -} - -void odm_RefreshRateAdaptiveMask23aCE23a(struct dm_odm_t *pDM_Odm) { u8 i; struct rtw_adapter *pAdapter = pDM_Odm->Adapter; if (pAdapter->bDriverStopped) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, - ("<---- odm_RefreshRateAdaptiveMask23a(): driver is going to unload\n")); + ("<---- %s: driver is going to unload\n", + __func__)); return; } diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 85be3e0d7feb..61ff14aca365 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -130,7 +130,6 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; pdmpriv->InitODMFlag = ODM_BB_DIG | - ODM_BB_RA_MASK | ODM_BB_DYNAMIC_TXPWR | ODM_BB_FA_CNT | ODM_BB_RSSI_MONITOR | diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 50459f09dbbb..4653518f3d7e 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -348,7 +348,6 @@ enum odm_cmninfo { enum { /* BB ODM section BIT 0-15 */ ODM_BB_DIG = BIT(0), - ODM_BB_RA_MASK = BIT(1), ODM_BB_DYNAMIC_TXPWR = BIT(2), ODM_BB_FA_CNT = BIT(3), ODM_BB_RSSI_MONITOR = BIT(4), -- cgit v1.2.3 From 3d51a602dcd4be8989ff459fc0d6f1bb78336d7c Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:40 -0500 Subject: staging: rtl8723au: ODM_BB_DIG is always set Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 5 ++--- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 3 +-- drivers/staging/rtl8723au/include/odm.h | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 64dd980a170d..406c503343ad 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -583,10 +583,9 @@ void odm_DIG23a(struct rtw_adapter *adapter) u8 CurrentIGI = pDM_DigTable->CurIGValue; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG23a() ==>\n")); - /* if (!(pDM_Odm->SupportAbility & (ODM_BB_DIG|ODM_BB_FA_CNT))) */ - if ((!(pDM_Odm->SupportAbility&ODM_BB_DIG)) || (!(pDM_Odm->SupportAbility&ODM_BB_FA_CNT))) { + if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, - ("odm_DIG23a() Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n")); + ("odm_DIG23a() Return: SupportAbility ODM_BB_FA_CNT is disabled\n")); return; } diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 61ff14aca365..16811ffc67f2 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -129,8 +129,7 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_BB_DIG | - ODM_BB_DYNAMIC_TXPWR | + pdmpriv->InitODMFlag = ODM_BB_DYNAMIC_TXPWR | ODM_BB_FA_CNT | ODM_BB_RSSI_MONITOR | ODM_BB_CCK_PD | diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 4653518f3d7e..7ee874aea776 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -347,7 +347,6 @@ enum odm_cmninfo { /* Define ODM support ability. ODM_CMNINFO_ABILITY */ enum { /* BB ODM section BIT 0-15 */ - ODM_BB_DIG = BIT(0), ODM_BB_DYNAMIC_TXPWR = BIT(2), ODM_BB_FA_CNT = BIT(3), ODM_BB_RSSI_MONITOR = BIT(4), -- cgit v1.2.3 From 6920f3b9688f9808f7c11964774321a8e03c492e Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:41 -0500 Subject: staging: rtl8723au: ODM_BB_DYNAMIC_TXPWR isn't used for anything Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 3 +-- drivers/staging/rtl8723au/include/odm.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 16811ffc67f2..65276e2eecc8 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -129,8 +129,7 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_BB_DYNAMIC_TXPWR | - ODM_BB_FA_CNT | + pdmpriv->InitODMFlag = ODM_BB_FA_CNT | ODM_BB_RSSI_MONITOR | ODM_BB_CCK_PD | ODM_BB_PWR_SAVE | diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 7ee874aea776..af860b3c9f59 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -347,7 +347,6 @@ enum odm_cmninfo { /* Define ODM support ability. ODM_CMNINFO_ABILITY */ enum { /* BB ODM section BIT 0-15 */ - ODM_BB_DYNAMIC_TXPWR = BIT(2), ODM_BB_FA_CNT = BIT(3), ODM_BB_RSSI_MONITOR = BIT(4), ODM_BB_CCK_PD = BIT(5), -- cgit v1.2.3 From 399ec83079a2b281a905b9e943ca2f13f82e02cf Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:42 -0500 Subject: staging: rtl8723au: ODM_BB_FA_CNT is always set Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 11 +---------- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 3 +-- drivers/staging/rtl8723au/include/odm.h | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 406c503343ad..8ec113fe71ec 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -583,12 +583,6 @@ void odm_DIG23a(struct rtw_adapter *adapter) u8 CurrentIGI = pDM_DigTable->CurIGValue; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG23a() ==>\n")); - if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, - ("odm_DIG23a() Return: SupportAbility ODM_BB_FA_CNT is disabled\n")); - return; - } - if (adapter->mlmepriv.bScanInProcess) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG23a() Return: In Scan Progress \n")); return; @@ -757,9 +751,6 @@ void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) u32 ret_value; struct false_alarm_stats *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; - if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) - return; - /* hold ofdm counter */ /* hold page C counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT(31), 1); @@ -863,7 +854,7 @@ void odm_CCKPacketDetectionThresh23a(struct dm_odm_t *pDM_Odm) struct false_alarm_stats *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 CurCCK_CCAThres; - if (!(pDM_Odm->SupportAbility & (ODM_BB_CCK_PD|ODM_BB_FA_CNT))) + if (!(pDM_Odm->SupportAbility & ODM_BB_CCK_PD)) return; if (pDM_Odm->ExtLNA) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 65276e2eecc8..3524e71806b9 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -129,8 +129,7 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_BB_FA_CNT | - ODM_BB_RSSI_MONITOR | + pdmpriv->InitODMFlag = ODM_BB_RSSI_MONITOR | ODM_BB_CCK_PD | ODM_BB_PWR_SAVE | ODM_RF_TX_PWR_TRACK | diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index af860b3c9f59..ab9fe31f1ca0 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -347,7 +347,6 @@ enum odm_cmninfo { /* Define ODM support ability. ODM_CMNINFO_ABILITY */ enum { /* BB ODM section BIT 0-15 */ - ODM_BB_FA_CNT = BIT(3), ODM_BB_RSSI_MONITOR = BIT(4), ODM_BB_CCK_PD = BIT(5), ODM_BB_ANT_DIV = BIT(6), -- cgit v1.2.3 From 01c1ec0057b79472434b1ea6bff3bf3d0bd026df Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:43 -0500 Subject: staging: rtl8723au: ODM_BB_RSSI_MONITOR is always set Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 17 +---------------- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 3 +-- drivers/staging/rtl8723au/include/odm.h | 1 - 3 files changed, 2 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 8ec113fe71ec..5d72ec717826 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -191,7 +191,6 @@ void odm_DynamicBBPowerSaving23a(struct dm_odm_t *pDM_Odm); void odm_DynamicTxPower23aInit(struct dm_odm_t *pDM_Odm); -void odm_RSSIMonitorCheck23aCE(struct dm_odm_t *pDM_Odm); void odm_RSSIMonitorCheck23a(struct dm_odm_t *pDM_Odm); void odm_DynamicTxPower23a(struct dm_odm_t *pDM_Odm); @@ -1186,20 +1185,6 @@ void odm_DynamicTxPower23aInit(struct dm_odm_t *pDM_Odm) pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; } -void odm_RSSIMonitorCheck23a(struct dm_odm_t *pDM_Odm) -{ - /* For AP/ADSL use struct rtl8723a_priv * */ - /* For CE/NIC use struct rtw_adapter * */ - - if (!(pDM_Odm->SupportAbility & ODM_BB_RSSI_MONITOR)) - return; - - /* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */ - /* at the same time. In the stage2/3, we need to prive universal interface and merge all */ - /* HW dynamic mechanism. */ - odm_RSSIMonitorCheck23aCE(pDM_Odm); -} /* odm_RSSIMonitorCheck23a */ - static void FindMinimumRSSI( struct rtw_adapter *pAdapter @@ -1218,7 +1203,7 @@ FindMinimumRSSI( pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; } -void odm_RSSIMonitorCheck23aCE(struct dm_odm_t *pDM_Odm) +void odm_RSSIMonitorCheck23a(struct dm_odm_t *pDM_Odm) { struct rtw_adapter *Adapter = pDM_Odm->Adapter; struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 3524e71806b9..93b76bd1785e 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -129,8 +129,7 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_BB_RSSI_MONITOR | - ODM_BB_CCK_PD | + pdmpriv->InitODMFlag = ODM_BB_CCK_PD | ODM_BB_PWR_SAVE | ODM_RF_TX_PWR_TRACK | ODM_RF_CALIBRATION; diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index ab9fe31f1ca0..783b8fed2261 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -347,7 +347,6 @@ enum odm_cmninfo { /* Define ODM support ability. ODM_CMNINFO_ABILITY */ enum { /* BB ODM section BIT 0-15 */ - ODM_BB_RSSI_MONITOR = BIT(4), ODM_BB_CCK_PD = BIT(5), ODM_BB_ANT_DIV = BIT(6), ODM_BB_PWR_SAVE = BIT(7), -- cgit v1.2.3 From 6bdef7a0d402f1a0f4ec26da2170da52d51537dd Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:44 -0500 Subject: staging: rtl8723au: ODM_BB_CCK_PD is always set Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 3 --- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 3 +-- drivers/staging/rtl8723au/include/odm.h | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 5d72ec717826..307773570741 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -853,9 +853,6 @@ void odm_CCKPacketDetectionThresh23a(struct dm_odm_t *pDM_Odm) struct false_alarm_stats *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; u8 CurCCK_CCAThres; - if (!(pDM_Odm->SupportAbility & ODM_BB_CCK_PD)) - return; - if (pDM_Odm->ExtLNA) return; diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 93b76bd1785e..405317193173 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -129,8 +129,7 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_BB_CCK_PD | - ODM_BB_PWR_SAVE | + pdmpriv->InitODMFlag = ODM_BB_PWR_SAVE | ODM_RF_TX_PWR_TRACK | ODM_RF_CALIBRATION; /* Pointer reference */ diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 783b8fed2261..e57472bdc699 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -347,7 +347,6 @@ enum odm_cmninfo { /* Define ODM support ability. ODM_CMNINFO_ABILITY */ enum { /* BB ODM section BIT 0-15 */ - ODM_BB_CCK_PD = BIT(5), ODM_BB_ANT_DIV = BIT(6), ODM_BB_PWR_SAVE = BIT(7), ODM_BB_PWR_TRAIN = BIT(8), -- cgit v1.2.3 From 719d3f6cf025c30506c5d37ed6aca27741a89107 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:45 -0500 Subject: staging: rtl8723au: ODM_BB_PWR_SAVE is unused Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 3 +-- drivers/staging/rtl8723au/include/odm.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 405317193173..266e2274601a 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -129,8 +129,7 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_BB_PWR_SAVE | - ODM_RF_TX_PWR_TRACK | + pdmpriv->InitODMFlag = ODM_RF_TX_PWR_TRACK | ODM_RF_CALIBRATION; /* Pointer reference */ rtl8723a_odm_support_ability_set(Adapter, DYNAMIC_ALL_FUNC_ENABLE); diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index e57472bdc699..f59184414d83 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -348,7 +348,6 @@ enum odm_cmninfo { enum { /* BB ODM section BIT 0-15 */ ODM_BB_ANT_DIV = BIT(6), - ODM_BB_PWR_SAVE = BIT(7), ODM_BB_PWR_TRAIN = BIT(8), ODM_BB_RATE_ADAPTIVE = BIT(9), ODM_BB_PATH_DIV = BIT(10), -- cgit v1.2.3 From 4be419e6d3c5019480e60f2340e59cbd602f8af8 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:46 -0500 Subject: staging: rtl8723au: ODM_RF_TX_PWR_TRACK is always set Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c | 11 +---------- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 3 +-- drivers/staging/rtl8723au/include/odm.h | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c index 2dac6f0cd9c2..163e4d28eef0 100644 --- a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c +++ b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c @@ -359,14 +359,10 @@ static void ODM_TXPowerTracking92CDirectCall(struct rtw_adapter *Adapter) odm_TXPowerTrackingCallback_ThermalMeter_92C(Adapter); } -static void odm_CheckTXPowerTracking_ThermalMeter(struct rtw_adapter *Adapter) +void rtl8723a_odm_check_tx_power_tracking(struct rtw_adapter *Adapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct dm_odm_t *podmpriv = &pHalData->odmpriv; - - if (!(podmpriv->SupportAbility & ODM_RF_TX_PWR_TRACK)) - return; if (!pdmpriv->TM_Trigger) { /* at least delay 1 sec */ PHY_SetRFReg(Adapter, RF_PATH_A, RF_T_METER, bRFRegOffsetMask, 0x60); @@ -379,11 +375,6 @@ static void odm_CheckTXPowerTracking_ThermalMeter(struct rtw_adapter *Adapter) } } -void rtl8723a_odm_check_tx_power_tracking(struct rtw_adapter *Adapter) -{ - odm_CheckTXPowerTracking_ThermalMeter(Adapter); -} - /* IQK */ #define MAX_TOLERANCE 5 #define IQK_DELAY_TIME 1 /* ms */ diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 266e2274601a..5969ee37f26f 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -129,8 +129,7 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_RF_TX_PWR_TRACK | - ODM_RF_CALIBRATION; + pdmpriv->InitODMFlag = ODM_RF_CALIBRATION; /* Pointer reference */ rtl8723a_odm_support_ability_set(Adapter, DYNAMIC_ALL_FUNC_ENABLE); diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index f59184414d83..bf17262bc31a 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -358,7 +358,6 @@ enum { ODM_MAC_EARLY_MODE = BIT(17), /* RF ODM section BIT 24-31 */ - ODM_RF_TX_PWR_TRACK = BIT(24), ODM_RF_RX_GAIN_TRACK = BIT(25), ODM_RF_CALIBRATION = BIT(26), -- cgit v1.2.3 From fec75cd5f1def0652ff56e649f24256fdfd26b8c Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:47 -0500 Subject: staging: rtl8723au: ODM_RF_CALIBRATION is never set Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 2 +- drivers/staging/rtl8723au/include/odm.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 5969ee37f26f..3a904fd4d200 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -129,7 +129,7 @@ static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter) struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_RF_CALIBRATION; + pdmpriv->InitODMFlag = 0; /* Pointer reference */ rtl8723a_odm_support_ability_set(Adapter, DYNAMIC_ALL_FUNC_ENABLE); diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index bf17262bc31a..7d505cf01838 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -359,8 +359,6 @@ enum { /* RF ODM section BIT 24-31 */ ODM_RF_RX_GAIN_TRACK = BIT(25), - ODM_RF_CALIBRATION = BIT(26), - }; /* ODM_CMNINFO_INTERFACE */ -- cgit v1.2.3 From ea89e2f6b7ae55db9275f631327dc5c07f72871e Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:48 -0500 Subject: staging: rtl8723au: Remove unused ODM ability flags Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/include/odm.h | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 7d505cf01838..78c17f396c4d 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -348,17 +348,6 @@ enum odm_cmninfo { enum { /* BB ODM section BIT 0-15 */ ODM_BB_ANT_DIV = BIT(6), - ODM_BB_PWR_TRAIN = BIT(8), - ODM_BB_RATE_ADAPTIVE = BIT(9), - ODM_BB_PATH_DIV = BIT(10), - ODM_BB_PSD = BIT(11), - ODM_BB_RXHP = BIT(12), - - /* MAC DM section BIT 16-23 */ - ODM_MAC_EARLY_MODE = BIT(17), - - /* RF ODM section BIT 24-31 */ - ODM_RF_RX_GAIN_TRACK = BIT(25), }; /* ODM_CMNINFO_INTERFACE */ -- cgit v1.2.3 From 8cba07d71d24c6b098723f152091a4292374aa14 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:49 -0500 Subject: staging: rtl8723au: Make odm_PHY_SaveAFERegisters() readable Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 307773570741..c50b8a59dc93 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1454,16 +1454,11 @@ void ODM_SingleDualAntennaDefaultSetting(struct dm_odm_t *pDM_Odm) /* 2 8723A ANT DETECT */ -static void odm_PHY_SaveAFERegisters( - struct dm_odm_t *pDM_Odm, - u32 *AFEReg, - u32 *AFEBackup, - u32 RegisterNum - ) +static void odm_PHY_SaveAFERegisters(struct dm_odm_t *pDM_Odm, u32 *AFEReg, + u32 *AFEBackup, u32 RegisterNum) { u32 i; - /* RTPRINT(FINIT, INIT_IQK, ("Save ADDA parameters.\n")); */ for (i = 0 ; i < RegisterNum ; i++) AFEBackup[i] = ODM_GetBBReg(pDM_Odm, AFEReg[i], bMaskDWord); } -- cgit v1.2.3 From 8122a8c88ea711fdc72374097aaf7302fc346165 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:50 -0500 Subject: staging: rtl8723au: odm_dtc(): Remove no-op function Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 7 ------- drivers/staging/rtl8723au/include/odm.h | 2 -- 2 files changed, 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index c50b8a59dc93..5a0568be28de 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -280,8 +280,6 @@ void ODM_DMWatchdog23a(struct rtw_adapter *adapter) ODM_TXPowerTrackingCheck23a(pDM_Odm); odm_EdcaTurboCheck23a(pDM_Odm); - - odm_dtc(pDM_Odm); } /* */ @@ -1663,8 +1661,3 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) } return bResult; } - -/* Justin: According to the current RRSI to adjust Response Frame TX power, 2012/11/05 */ -void odm_dtc(struct dm_odm_t *pDM_Odm) -{ -} diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 78c17f396c4d..7be2c074aee8 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -942,6 +942,4 @@ void ODM_SingleDualAntennaDefaultSetting(struct dm_odm_t *pDM_Odm); bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode); -void odm_dtc(struct dm_odm_t *pDM_Odm); - #endif -- cgit v1.2.3 From b9c39d293fd4ae8212ddad3a075af850820ec751 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:51 -0500 Subject: staging: rtl8723au: Remove no-op ODM_CMNINFO_PLATFORM Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 2 -- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 1 - drivers/staging/rtl8723au/include/odm.h | 15 +++++++-------- 3 files changed, 7 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 5a0568be28de..e1a26302e0fd 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -297,8 +297,6 @@ void ODM_CmnInfoInit23a(struct dm_odm_t *pDM_Odm, /* */ switch (CmnInfo) { /* Fixed ODM value. */ - case ODM_CMNINFO_PLATFORM: - break; case ODM_CMNINFO_INTERFACE: pDM_Odm->SupportInterface = (u8)Value; break; diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index 3a904fd4d200..e44d2b478c12 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -94,7 +94,6 @@ void rtl8723a_init_dm_priv(struct rtw_adapter *Adapter) memset(pDM_Odm, 0, sizeof(*pDM_Odm)); pDM_Odm->Adapter = Adapter; - ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_PLATFORM, 0x04); ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_INTERFACE, RTW_USB);/* RTL871X_HCI_TYPE */ ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_IC_TYPE, ODM_RTL8723A); diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 7be2c074aee8..1c1775b8f0a9 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -298,17 +298,16 @@ enum odm_cmninfo { /* Fixed value: */ /* */ - ODM_CMNINFO_PLATFORM = 0, - ODM_CMNINFO_INTERFACE, /* enum odm_interface_def */ + ODM_CMNINFO_INTERFACE = 1, /* enum odm_interface_def */ ODM_CMNINFO_MP_TEST_CHIP, - ODM_CMNINFO_IC_TYPE, /* enum odm_ic_type_def */ - ODM_CMNINFO_CUT_VER, /* enum odm_cut_version */ - ODM_CMNINFO_FAB_VER, /* enum odm_fab_version */ - ODM_CMNINFO_BOARD_TYPE, /* enum odm_board_type */ - ODM_CMNINFO_EXT_LNA, /* true */ + ODM_CMNINFO_IC_TYPE, /* enum odm_ic_type_def */ + ODM_CMNINFO_CUT_VER, /* enum odm_cut_version */ + ODM_CMNINFO_FAB_VER, /* enum odm_fab_version */ + ODM_CMNINFO_BOARD_TYPE, /* enum odm_board_type */ + ODM_CMNINFO_EXT_LNA, /* true */ ODM_CMNINFO_EXT_PA, ODM_CMNINFO_EXT_TRSW, - ODM_CMNINFO_PATCH_ID, /* CUSTOMER ID */ + ODM_CMNINFO_PATCH_ID, /* CUSTOMER ID */ ODM_CMNINFO_BINHCT_TEST, ODM_CMNINFO_BWIFI_TEST, ODM_CMNINFO_SMART_CONCURRENT, -- cgit v1.2.3 From 9d693e3a09fd0b50a39c864e7a260e69efb78896 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:52 -0500 Subject: staging: rtl8723au: SupportInterface is always set to USB Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c | 9 ++---- drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c | 3 +- drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c | 3 +- drivers/staging/rtl8723au/hal/odm.c | 4 --- drivers/staging/rtl8723au/hal/odm_HWConfig.c | 35 +++++++++++------------ drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 1 - drivers/staging/rtl8723au/include/hal_intf.h | 7 ----- drivers/staging/rtl8723au/include/odm.h | 5 +--- 8 files changed, 23 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c b/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c index 67d985c21712..577b9113b212 100644 --- a/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c +++ b/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c @@ -219,13 +219,12 @@ void ODM_ReadAndConfig_AGC_TAB_1T_8723A(struct dm_odm_t *pDM_Odm) u32 hex; u32 i; u8 platform = 0x04; - u8 interfaceValue = pDM_Odm->SupportInterface; u8 board = pDM_Odm->BoardType; u32 ArrayLen = sizeof(Array_AGC_TAB_1T_8723A)/sizeof(u32); u32 *Array = Array_AGC_TAB_1T_8723A; hex = board; - hex += interfaceValue << 8; + hex += ODM_ITRF_USB << 8; hex += platform << 16; hex += 0xFF000000; for (i = 0; i < ArrayLen; i += 2) { @@ -467,13 +466,12 @@ void ODM_ReadAndConfig_PHY_REG_1T_8723A(struct dm_odm_t *pDM_Odm) u32 hex = 0; u32 i = 0; u8 platform = 0x04; - u8 interfaceValue = pDM_Odm->SupportInterface; u8 board = pDM_Odm->BoardType; u32 ArrayLen = sizeof(Array_PHY_REG_1T_8723A)/sizeof(u32); u32 *Array = Array_PHY_REG_1T_8723A; hex += board; - hex += interfaceValue << 8; + hex += ODM_ITRF_USB << 8; hex += platform << 16; hex += 0xFF000000; for (i = 0; i < ArrayLen; i += 2) { @@ -523,13 +521,12 @@ void ODM_ReadAndConfig_PHY_REG_MP_8723A(struct dm_odm_t *pDM_Odm) u32 hex = 0; u32 i = 0; u8 platform = 0x04; - u8 interfaceValue = pDM_Odm->SupportInterface; u8 board = pDM_Odm->BoardType; u32 ArrayLen = sizeof(Array_PHY_REG_MP_8723A)/sizeof(u32); u32 *Array = Array_PHY_REG_MP_8723A; hex += board; - hex += interfaceValue << 8; + hex += ODM_ITRF_USB << 8; hex += platform << 16; hex += 0xFF000000; for (i = 0; i < ArrayLen; i += 2) { diff --git a/drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c b/drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c index 83018301ec27..93b2d183d694 100644 --- a/drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c +++ b/drivers/staging/rtl8723au/hal/HalHWImg8723A_MAC.c @@ -144,13 +144,12 @@ void ODM_ReadAndConfig_MAC_REG_8723A(struct dm_odm_t *pDM_Odm) u32 hex = 0; u32 i = 0; u8 platform = 0x04; - u8 interfaceValue = pDM_Odm->SupportInterface; u8 board = pDM_Odm->BoardType; u32 ArrayLen = sizeof(Array_MAC_REG_8723A)/sizeof(u32); u32 *Array = Array_MAC_REG_8723A; hex += board; - hex += interfaceValue << 8; + hex += ODM_ITRF_USB << 8; hex += platform << 16; hex += 0xFF000000; for (i = 0; i < ArrayLen; i += 2) { diff --git a/drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c b/drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c index d63c852aa857..dbf571e8b908 100644 --- a/drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c +++ b/drivers/staging/rtl8723au/hal/HalHWImg8723A_RF.c @@ -214,13 +214,12 @@ void ODM_ReadAndConfig_RadioA_1T_8723A(struct dm_odm_t *pDM_Odm) u32 hex = 0; u32 i = 0; u8 platform = 0x04; - u8 interfaceValue = pDM_Odm->SupportInterface; u8 board = pDM_Odm->BoardType; u32 ArrayLen = sizeof(Array_RadioA_1T_8723A)/sizeof(u32); u32 *Array = Array_RadioA_1T_8723A; hex += board; - hex += interfaceValue << 8; + hex += ODM_ITRF_USB << 8; hex += platform << 16; hex += 0xFF000000; diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index e1a26302e0fd..11c9a36900e3 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -297,9 +297,6 @@ void ODM_CmnInfoInit23a(struct dm_odm_t *pDM_Odm, /* */ switch (CmnInfo) { /* Fixed ODM value. */ - case ODM_CMNINFO_INTERFACE: - pDM_Odm->SupportInterface = (u8)Value; - break; case ODM_CMNINFO_MP_TEST_CHIP: pDM_Odm->bIsMPChip = (u8)Value; break; @@ -443,7 +440,6 @@ void odm_CmnInfoInit_Debug23a(struct dm_odm_t *pDM_Odm) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoInit_Debug23a ==>\n")); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportAbility = 0x%x\n", pDM_Odm->SupportAbility)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportInterface =%d\n", pDM_Odm->SupportInterface)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportICType = 0x%x\n", pDM_Odm->SupportICType)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("CutVersion =%d\n", pDM_Odm->CutVersion)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("FabVersion =%d\n", pDM_Odm->FabVersion)); diff --git a/drivers/staging/rtl8723au/hal/odm_HWConfig.c b/drivers/staging/rtl8723au/hal/odm_HWConfig.c index 33aafa01f900..7b9799e3dbda 100644 --- a/drivers/staging/rtl8723au/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723au/hal/odm_HWConfig.c @@ -33,24 +33,23 @@ static s32 odm_SignalScaleMapping_92CSeries(struct dm_odm_t *pDM_Odm, s32 CurrSi { s32 RetSig = 0; - if ((pDM_Odm->SupportInterface == ODM_ITRF_USB) || (pDM_Odm->SupportInterface == ODM_ITRF_SDIO)) { - if (CurrSig >= 51 && CurrSig <= 100) - RetSig = 100; - else if (CurrSig >= 41 && CurrSig <= 50) - RetSig = 80 + ((CurrSig - 40)*2); - else if (CurrSig >= 31 && CurrSig <= 40) - RetSig = 66 + (CurrSig - 30); - else if (CurrSig >= 21 && CurrSig <= 30) - RetSig = 54 + (CurrSig - 20); - else if (CurrSig >= 10 && CurrSig <= 20) - RetSig = 42 + (((CurrSig - 10) * 2) / 3); - else if (CurrSig >= 5 && CurrSig <= 9) - RetSig = 22 + (((CurrSig - 5) * 3) / 2); - else if (CurrSig >= 1 && CurrSig <= 4) - RetSig = 6 + (((CurrSig - 1) * 3) / 2); - else - RetSig = CurrSig; - } + if (CurrSig >= 51 && CurrSig <= 100) + RetSig = 100; + else if (CurrSig >= 41 && CurrSig <= 50) + RetSig = 80 + ((CurrSig - 40)*2); + else if (CurrSig >= 31 && CurrSig <= 40) + RetSig = 66 + (CurrSig - 30); + else if (CurrSig >= 21 && CurrSig <= 30) + RetSig = 54 + (CurrSig - 20); + else if (CurrSig >= 10 && CurrSig <= 20) + RetSig = 42 + (((CurrSig - 10) * 2) / 3); + else if (CurrSig >= 5 && CurrSig <= 9) + RetSig = 22 + (((CurrSig - 5) * 3) / 2); + else if (CurrSig >= 1 && CurrSig <= 4) + RetSig = 6 + (((CurrSig - 1) * 3) / 2); + else + RetSig = CurrSig; + return RetSig; } diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index e44d2b478c12..a341b1b4770d 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -94,7 +94,6 @@ void rtl8723a_init_dm_priv(struct rtw_adapter *Adapter) memset(pDM_Odm, 0, sizeof(*pDM_Odm)); pDM_Odm->Adapter = Adapter; - ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_INTERFACE, RTW_USB);/* RTL871X_HCI_TYPE */ ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_IC_TYPE, ODM_RTL8723A); diff --git a/drivers/staging/rtl8723au/include/hal_intf.h b/drivers/staging/rtl8723au/include/hal_intf.h index 404acb52352d..b924d47fcfbc 100644 --- a/drivers/staging/rtl8723au/include/hal_intf.h +++ b/drivers/staging/rtl8723au/include/hal_intf.h @@ -18,13 +18,6 @@ #include #include -enum RTL871X_HCI_TYPE { - RTW_PCIE = BIT(0), - RTW_USB = BIT(1), - RTW_SDIO = BIT(2), - RTW_GSPI = BIT(3), -}; - enum _CHIP_TYPE { NULL_CHIP_TYPE, RTL8712_8188S_8191S_8192S, diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 1c1775b8f0a9..fce9358d090e 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -298,8 +298,7 @@ enum odm_cmninfo { /* Fixed value: */ /* */ - ODM_CMNINFO_INTERFACE = 1, /* enum odm_interface_def */ - ODM_CMNINFO_MP_TEST_CHIP, + ODM_CMNINFO_MP_TEST_CHIP = 2, ODM_CMNINFO_IC_TYPE, /* enum odm_ic_type_def */ ODM_CMNINFO_CUT_VER, /* enum odm_cut_version */ ODM_CMNINFO_FAB_VER, /* enum odm_fab_version */ @@ -608,8 +607,6 @@ struct dm_odm_t { /* HOOK BEFORE REG INIT----------- */ /* ODM Support Ability DIG/RATR/TX_PWR_TRACK/ KK = 1/2/3/K */ u32 SupportAbility; - /* ODM PCIE/USB/SDIO/GSPI = 0/1/2/3 */ - u8 SupportInterface; /* ODM composite or independent. Bit oriented/ 92C+92D+ .... or any other type = 1/2/3/... */ u32 SupportICType; /* Cut Version TestChip/A-cut/B-cut... = 0/1/2/3/... */ -- cgit v1.2.3 From 8d8a61c4b209c26b4e683f9daab1ebb7b97e8e9f Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:53 -0500 Subject: staging: rtl8723au: Remove write-only variable ControlChannel Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 9 --------- drivers/staging/rtl8723au/include/odm.h | 1 - 2 files changed, 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 11c9a36900e3..cb2b7b6d7e45 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -416,15 +416,6 @@ static void odm_CommonInfoSelfUpdate(struct hal_data_8723a *pHalData) u8 EntryCnt = 0; u8 i; - if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) { - if (pHalData->nCur40MhzPrimeSC == 1) - pDM_Odm->ControlChannel = pHalData->CurrentChannel - 2; - else if (pHalData->nCur40MhzPrimeSC == 2) - pDM_Odm->ControlChannel = pHalData->CurrentChannel + 2; - } else { - pDM_Odm->ControlChannel = pHalData->CurrentChannel; - } - for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) { pEntry = pDM_Odm->pODM_StaInfo[i]; if (pEntry) diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index fce9358d090e..586ef005bb88 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -598,7 +598,6 @@ struct dm_odm_t { /* ODM HANDLE, DRIVER NEEDS NOT TO HOOK------ */ bool bCckHighPower; u8 RFPathRxEnable; /* ODM_CMNINFO_RFPATH_ENABLE */ - u8 ControlChannel; /* ODM HANDLE, DRIVER NEEDS NOT TO HOOK------ */ /* 1 COMMON INFORMATION */ -- cgit v1.2.3 From 8bf591e5c17c863dd7b290c31e6330612e899a74 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:54 -0500 Subject: staging: rtl8723au: Remove unused Funai TV hack Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 8 -------- drivers/staging/rtl8723au/hal/rtl8723a_dm.c | 1 - drivers/staging/rtl8723au/include/odm.h | 2 -- 3 files changed, 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index cb2b7b6d7e45..d8f20953cb93 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -321,9 +321,6 @@ void ODM_CmnInfoInit23a(struct dm_odm_t *pDM_Odm, case ODM_CMNINFO_EXT_TRSW: pDM_Odm->ExtTRSW = (u8)Value; break; - case ODM_CMNINFO_PATCH_ID: - pDM_Odm->PatchID = (u8)Value; - break; case ODM_CMNINFO_BINHCT_TEST: pDM_Odm->bInHctTest = (bool)Value; break; @@ -438,7 +435,6 @@ void odm_CmnInfoInit_Debug23a(struct dm_odm_t *pDM_Odm) ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("ExtLNA =%d\n", pDM_Odm->ExtLNA)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("ExtPA =%d\n", pDM_Odm->ExtPA)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("ExtTRSW =%d\n", pDM_Odm->ExtTRSW)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("PatchID =%d\n", pDM_Odm->PatchID)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("bInHctTest =%d\n", pDM_Odm->bInHctTest)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("bWIFITest =%d\n", pDM_Odm->bWIFITest)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("bDualMacSmartConcurrent =%d\n", pDM_Odm->bDualMacSmartConcurrent)); @@ -896,10 +892,6 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) struct dynamic_pwr_sav *pDM_PSTable = &pDM_Odm->DM_PSTable; u8 Rssi_Up_bound = 30; u8 Rssi_Low_bound = 25; - if (pDM_Odm->PatchID == 40) { /* RT_CID_819x_FUNAI_TV */ - Rssi_Up_bound = 50; - Rssi_Low_bound = 45; - } if (pDM_PSTable->initialize == 0) { pDM_PSTable->Reg874 = (ODM_GetBBReg(pDM_Odm, 0x874, bMaskDWord)&0x1CC000)>>14; diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c index a341b1b4770d..1e831f2d1caf 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_dm.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_dm.c @@ -117,7 +117,6 @@ void rtl8723a_init_dm_priv(struct rtw_adapter *Adapter) ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_EXT_LNA, true); ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_EXT_PA, true); } - ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_PATCH_ID, pHalData->CustomerID); ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_BWIFI_TEST, Adapter->registrypriv.wifi_spec); } diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 586ef005bb88..3a65195502d8 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -306,7 +306,6 @@ enum odm_cmninfo { ODM_CMNINFO_EXT_LNA, /* true */ ODM_CMNINFO_EXT_PA, ODM_CMNINFO_EXT_TRSW, - ODM_CMNINFO_PATCH_ID, /* CUSTOMER ID */ ODM_CMNINFO_BINHCT_TEST, ODM_CMNINFO_BWIFI_TEST, ODM_CMNINFO_SMART_CONCURRENT, @@ -620,7 +619,6 @@ struct dm_odm_t { u8 ExtPA; /* with external TRSW NO/Yes = 0/1 */ u8 ExtTRSW; - u8 PatchID; /* Customer ID */ bool bInHctTest; bool bWIFITest; -- cgit v1.2.3 From 761b6031a4d181729a0916fae1c36f4ecd1ac13a Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:55 -0500 Subject: staging: rtl8723au: Remove unused struct odm_fat_t Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/include/odm.h | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 3a65195502d8..3f93b3dee5bd 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -548,33 +548,6 @@ struct odm_rf_cal_t { u8 bDPPathBOK; }; -/* ODM Dynamic common info value definition */ -struct odm_fat_t { - u8 Bssid[6]; - u8 antsel_rx_keep_0; - u8 antsel_rx_keep_1; - u8 antsel_rx_keep_2; - u32 antSumRSSI[7]; - u32 antRSSIcnt[7]; - u32 antAveRSSI[7]; - u8 FAT_State; - u32 TrainIdx; - u8 antsel_a[ODM_ASSOCIATE_ENTRY_NUM]; - u8 antsel_b[ODM_ASSOCIATE_ENTRY_NUM]; - u8 antsel_c[ODM_ASSOCIATE_ENTRY_NUM]; - u32 MainAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM]; - u32 AuxAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM]; - u32 MainAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM]; - u32 AuxAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM]; - u8 RxIdleAnt; - bool bBecomeLinked; -}; - -enum fat_state { - FAT_NORMAL_STATE = 0, - FAT_TRAINING_STATE = 1, -}; - enum ant_dif_type { NO_ANTDIV = 0xFF, CG_TRX_HW_ANTDIV = 0x01, @@ -683,7 +656,6 @@ struct dm_odm_t { /* */ /* ODM Structure */ /* */ - struct odm_fat_t DM_FatTable; struct dig_t DM_DigTable; struct dynamic_pwr_sav DM_PSTable; struct pri_cca DM_PriCCA; -- cgit v1.2.3 From bb1ede84dfff512b5ac4fc8e45b8e5e8ed4d8d12 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:56 -0500 Subject: staging: rtl8723au: Remove unused struct pri_cca Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/include/odm.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 3f93b3dee5bd..3a68774b33b6 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -158,14 +158,6 @@ struct false_alarm_stats { u32 Cnt_BW_LSC; /* Gary */ }; -struct pri_cca { - u8 PriCCA_flag; - u8 intf_flag; - u8 intf_type; - u8 DupRTS_flag; - u8 Monitor_flag; -}; - struct rx_hp { u8 RXHP_flag; u8 PSD_func_trigger; @@ -658,7 +650,6 @@ struct dm_odm_t { /* */ struct dig_t DM_DigTable; struct dynamic_pwr_sav DM_PSTable; - struct pri_cca DM_PriCCA; struct rx_hp DM_RXHP_Table; struct false_alarm_stats FalseAlmCnt; struct false_alarm_stats FlaseAlmCntBuddyAdapter; -- cgit v1.2.3 From dd42f95cf041b99c440382acc18f9312282fc50f Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:57 -0500 Subject: staging: rtl8723au: Remove write only bIsCurRDLState Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 1 - drivers/staging/rtl8723au/include/odm.h | 1 - 2 files changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index d8f20953cb93..d3d4efc6fe07 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1271,7 +1271,6 @@ static void ODM_EdcaTurboInit23a(struct dm_odm_t *pDM_Odm) struct rtw_adapter *Adapter = pDM_Odm->Adapter; pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; - pDM_Odm->DM_EDCA_Table.bIsCurRDLState = false; Adapter->recvpriv.bIsAnyNonBEPkts = false; ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial VO PARAM: 0x%x\n", ODM_Read4Byte(pDM_Odm, ODM_EDCA_VO_PARAM))); diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 3a68774b33b6..0d1285c1bff0 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -219,7 +219,6 @@ struct sw_ant_sw { struct edca_turbo { bool bCurrentTurboEDCA; - bool bIsCurRDLState; u32 prv_traffic_idx; /* edca turbo */ }; -- cgit v1.2.3 From 1a5767e882ae1be5e40ce8dd338761a2f72761dd Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:58 -0500 Subject: staging: rtl8723au: ODM_TXPowerTrackingCheck23a(): Remove no-op function Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index d3d4efc6fe07..b9f09d9183bf 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -196,16 +196,12 @@ void odm_DynamicTxPower23a(struct dm_odm_t *pDM_Odm); void odm_RefreshRateAdaptiveMask23a(struct dm_odm_t *pDM_Odm); -void ODM_TXPowerTrackingCheck23a(struct dm_odm_t *pDM_Odm); - void odm_RateAdaptiveMaskInit23a(struct dm_odm_t *pDM_Odm); void odm_TXPowerTrackingThermalMeterInit23a(struct dm_odm_t *pDM_Odm); void odm_TXPowerTrackingInit23a(struct dm_odm_t *pDM_Odm); -void odm_TXPowerTrackingCheckCE23a(struct dm_odm_t *pDM_Odm); - static void odm_EdcaTurboCheck23a(struct dm_odm_t *pDM_Odm); static void ODM_EdcaTurboInit23a(struct dm_odm_t *pDM_Odm); @@ -278,7 +274,6 @@ void ODM_DMWatchdog23a(struct rtw_adapter *adapter) odm_DynamicBBPowerSaving23a(pDM_Odm); - ODM_TXPowerTrackingCheck23a(pDM_Odm); odm_EdcaTurboCheck23a(pDM_Odm); } @@ -1249,21 +1244,6 @@ void odm_TXPowerTrackingThermalMeterInit23a(struct dm_odm_t *pDM_Odm) pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = true; } -void ODM_TXPowerTrackingCheck23a(struct dm_odm_t *pDM_Odm) -{ - /* For AP/ADSL use struct rtl8723a_priv * */ - /* For CE/NIC use struct rtw_adapter * */ - - /* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */ - /* at the same time. In the stage2/3, we need to prive universal interface and merge all */ - /* HW dynamic mechanism. */ - odm_TXPowerTrackingCheckCE23a(pDM_Odm); -} - -void odm_TXPowerTrackingCheckCE23a(struct dm_odm_t *pDM_Odm) -{ -} - /* EDCA Turbo */ static void ODM_EdcaTurboInit23a(struct dm_odm_t *pDM_Odm) { -- cgit v1.2.3 From 04b7466fa514283438c0adbbca06f799b70c0d5c Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:24:59 -0500 Subject: staging: rtl8723au: Clean up odm_RSSIMonitorCheck() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index b9f09d9183bf..bfbb1a410798 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -191,7 +191,7 @@ void odm_DynamicBBPowerSaving23a(struct dm_odm_t *pDM_Odm); void odm_DynamicTxPower23aInit(struct dm_odm_t *pDM_Odm); -void odm_RSSIMonitorCheck23a(struct dm_odm_t *pDM_Odm); +static void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm); void odm_DynamicTxPower23a(struct dm_odm_t *pDM_Odm); void odm_RefreshRateAdaptiveMask23a(struct dm_odm_t *pDM_Odm); @@ -251,7 +251,7 @@ void ODM_DMWatchdog23a(struct rtw_adapter *adapter) odm_CmnInfoUpdate_Debug23a(pDM_Odm); odm_CommonInfoSelfUpdate(pHalData); odm_FalseAlarmCounterStatistics23a(pDM_Odm); - odm_RSSIMonitorCheck23a(pDM_Odm); + odm_RSSIMonitorCheck(pDM_Odm); /* 8723A or 8189ES platform */ /* NeilChen--2012--08--24-- */ @@ -1170,14 +1170,15 @@ FindMinimumRSSI( pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; } -void odm_RSSIMonitorCheck23a(struct dm_odm_t *pDM_Odm) +static void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm) { struct rtw_adapter *Adapter = pDM_Odm->Adapter; struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - int i; - int tmpEntryMaxPWDB = 0, tmpEntryMinPWDB = 0xff; + int i; + int MaxDB = 0, MinDB = 0xff; u8 sta_cnt = 0; + u32 tmpdb; u32 PWDB_rssi[NUM_STA] = {0};/* 0~15]:MACID, [16~31]:PWDB_rssi */ struct sta_info *psta; @@ -1187,36 +1188,36 @@ void odm_RSSIMonitorCheck23a(struct dm_odm_t *pDM_Odm) for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) { psta = pDM_Odm->pODM_StaInfo[i]; if (psta) { - if (psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) - tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; + if (psta->rssi_stat.UndecoratedSmoothedPWDB < MinDB) + MinDB = psta->rssi_stat.UndecoratedSmoothedPWDB; - if (psta->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) - tmpEntryMaxPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; + if (psta->rssi_stat.UndecoratedSmoothedPWDB > MaxDB) + MaxDB = psta->rssi_stat.UndecoratedSmoothedPWDB; - if (psta->rssi_stat.UndecoratedSmoothedPWDB != (-1)) - PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16)); + if (psta->rssi_stat.UndecoratedSmoothedPWDB != -1) { + tmpdb = psta->rssi_stat.UndecoratedSmoothedPWDB; + PWDB_rssi[sta_cnt++] = psta->mac_id | + (tmpdb << 16); + } } } for (i = 0; i < sta_cnt; i++) { - if (PWDB_rssi[i] != (0)) { + if (PWDB_rssi[i] != (0)) rtl8723a_set_rssi_cmd(Adapter, (u8 *)&PWDB_rssi[i]); - } } - if (tmpEntryMaxPWDB != 0) /* If associated entry is found */ - pdmpriv->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; - else - pdmpriv->EntryMaxUndecoratedSmoothedPWDB = 0; + pdmpriv->EntryMaxUndecoratedSmoothedPWDB = MaxDB; - if (tmpEntryMinPWDB != 0xff) /* If associated entry is found */ - pdmpriv->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; + if (MinDB != 0xff) /* If associated entry is found */ + pdmpriv->EntryMinUndecoratedSmoothedPWDB = MinDB; else pdmpriv->EntryMinUndecoratedSmoothedPWDB = 0; FindMinimumRSSI(Adapter);/* get pdmpriv->MinUndecoratedPWDBForDM */ - ODM_CmnInfoUpdate23a(&pHalData->odmpriv, ODM_CMNINFO_RSSI_MIN, pdmpriv->MinUndecoratedPWDBForDM); + ODM_CmnInfoUpdate23a(&pHalData->odmpriv, ODM_CMNINFO_RSSI_MIN, + pdmpriv->MinUndecoratedPWDBForDM); } /* endif */ -- cgit v1.2.3 From 0305d27d9e0d8f90697d3d8cc2f3aeedeaab44fd Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:25:00 -0500 Subject: staging: rtl8723au: Clean up FindMinimumRSSI() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index bfbb1a410798..5269c39a1f26 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1153,9 +1153,7 @@ void odm_DynamicTxPower23aInit(struct dm_odm_t *pDM_Odm) } static void -FindMinimumRSSI( - struct rtw_adapter *pAdapter - ) +FindMinimumRSSI(struct rtw_adapter *pAdapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(pAdapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; @@ -1163,11 +1161,11 @@ FindMinimumRSSI( /* 1 1.Determine the minimum RSSI */ - if ((!pDM_Odm->bLinked) && - (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) + if (!pDM_Odm->bLinked && !pdmpriv->EntryMinUndecoratedSmoothedPWDB) pdmpriv->MinUndecoratedPWDBForDM = 0; else - pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + pdmpriv->MinUndecoratedPWDBForDM = + pdmpriv->EntryMinUndecoratedSmoothedPWDB; } static void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm) -- cgit v1.2.3 From b58298eee28f055f862d1dc122bf34a1e1ab17ca Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:25:01 -0500 Subject: staging: rtl8723au: Clean up odm_RefreshRateAdaptiveMask() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 5269c39a1f26..e4500e913483 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -194,7 +194,7 @@ void odm_DynamicTxPower23aInit(struct dm_odm_t *pDM_Odm); static void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm); void odm_DynamicTxPower23a(struct dm_odm_t *pDM_Odm); -void odm_RefreshRateAdaptiveMask23a(struct dm_odm_t *pDM_Odm); +static void odm_RefreshRateAdaptiveMask(struct dm_odm_t *pDM_Odm); void odm_RateAdaptiveMaskInit23a(struct dm_odm_t *pDM_Odm); @@ -270,7 +270,7 @@ void ODM_DMWatchdog23a(struct rtw_adapter *adapter) if (pwrctrlpriv->bpower_saving) return; - odm_RefreshRateAdaptiveMask23a(pDM_Odm); + odm_RefreshRateAdaptiveMask(pDM_Odm); odm_DynamicBBPowerSaving23a(pDM_Odm); @@ -1045,7 +1045,7 @@ u32 ODM_Get_Rate_Bitmap23a(struct hal_data_8723a *pHalData, u32 macid, } /*----------------------------------------------------------------------------- - * Function: odm_RefreshRateAdaptiveMask23a() + * Function: odm_RefreshRateAdaptiveMask() * * Overview: Update rate table mask according to rssi * @@ -1060,10 +1060,11 @@ u32 ODM_Get_Rate_Bitmap23a(struct hal_data_8723a *pHalData, u32 macid, *05/27/2009 hpfan Create Version 0. * *---------------------------------------------------------------------------*/ -void odm_RefreshRateAdaptiveMask23a(struct dm_odm_t *pDM_Odm) +static void odm_RefreshRateAdaptiveMask(struct dm_odm_t *pDM_Odm) { + struct rtw_adapter *pAdapter = pDM_Odm->Adapter; + u32 smoothed; u8 i; - struct rtw_adapter *pAdapter = pDM_Odm->Adapter; if (pAdapter->bDriverStopped) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, @@ -1075,17 +1076,19 @@ void odm_RefreshRateAdaptiveMask23a(struct dm_odm_t *pDM_Odm) for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) { struct sta_info *pstat = pDM_Odm->pODM_StaInfo[i]; if (pstat) { - if (ODM_RAStateCheck23a(pDM_Odm, pstat->rssi_stat.UndecoratedSmoothedPWDB, false, &pstat->rssi_level)) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, + smoothed = pstat->rssi_stat.UndecoratedSmoothedPWDB; + if (ODM_RAStateCheck23a(pDM_Odm, smoothed, false, + &pstat->rssi_level)) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, + ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", - pstat->rssi_stat.UndecoratedSmoothedPWDB, - pstat->rssi_level)); - rtw_hal_update_ra_mask23a(pstat, pstat->rssi_level); + smoothed, + pstat->rssi_level)); + rtw_hal_update_ra_mask23a(pstat, + pstat->rssi_level); } - } } - } /* Return Value: bool */ -- cgit v1.2.3 From c335da572652e984ca7f29a1384f7c3c85fb3a5c Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:25:02 -0500 Subject: staging: rtl8723au: ODM_Write_DIG23A(): Cosmetic cleanups Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index e4500e913483..69072c09e09b 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -445,18 +445,19 @@ void odm_CmnInfoUpdate_Debug23a(struct dm_odm_t *pDM_Odm) ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("RSSI_Min =%d\n", pDM_Odm->RSSI_Min)); } -void ODM_Write_DIG23a(struct dm_odm_t *pDM_Odm, - u8 CurrentIGI - ) +void ODM_Write_DIG23a(struct dm_odm_t *pDM_Odm, u8 CurrentIGI) { struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("ODM_REG(IGI_A, pDM_Odm) = 0x%x, ODM_BIT(IGI, pDM_Odm) = 0x%x \n", - ODM_REG(IGI_A, pDM_Odm), ODM_BIT(IGI, pDM_Odm))); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, + ("ODM_REG(IGI_A, pDM_Odm) = 0x%x, ODM_BIT(IGI, pDM_Odm) = 0x%x \n", + ODM_REG(IGI_A, pDM_Odm), ODM_BIT(IGI, pDM_Odm))); if (pDM_DigTable->CurIGValue != CurrentIGI) { - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A, pDM_Odm), ODM_BIT(IGI, pDM_Odm), CurrentIGI); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("CurrentIGI(0x%02x). \n", CurrentIGI)); + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A, pDM_Odm), + ODM_BIT(IGI, pDM_Odm), CurrentIGI); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, + ("CurrentIGI(0x%02x). \n", CurrentIGI)); pDM_DigTable->CurIGValue = CurrentIGI; } ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, -- cgit v1.2.3 From fe6e0197ba7a5820419e68cff3879786388e8971 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 2 Mar 2015 15:25:03 -0500 Subject: staging: rtl8723au: odm.c: Break some lines down to 80 characters Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 184 +++++++++++++++++++++++------------- 1 file changed, 117 insertions(+), 67 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 69072c09e09b..8d4266100ff0 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -480,11 +480,10 @@ void odm_DIG23abyRSSI_LPS(struct dm_odm_t *pDM_Odm) CurrentIGI = CurrentIGI+RSSI_OFFSET_DIG; bFwCurrentInPSMode = pAdapter->pwrctrlpriv.bFwCurrentInPSMode; - /* ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG_LPS, ODM_DBG_LOUD, ("odm_DIG23a() ==>\n")); */ - /* Using FW PS mode to make IGI */ if (bFwCurrentInPSMode) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("---Neil---odm_DIG23a is in LPS mode\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, + ("---Neil---odm_DIG23a is in LPS mode\n")); /* Adjust by FA in LPS MODE */ if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2_LPS) CurrentIGI = CurrentIGI+2; @@ -510,15 +509,16 @@ void odm_DIG23abyRSSI_LPS(struct dm_odm_t *pDM_Odm) else if (CurrentIGI < RSSI_Lower) CurrentIGI = RSSI_Lower; - ODM_Write_DIG23a(pDM_Odm, CurrentIGI);/* ODM_Write_DIG23a(pDM_Odm, pDM_DigTable->CurIGValue); */ - + ODM_Write_DIG23a(pDM_Odm, CurrentIGI); } void odm_DIG23aInit(struct dm_odm_t *pDM_Odm) { struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; - pDM_DigTable->CurIGValue = (u8) ODM_GetBBReg(pDM_Odm, ODM_REG(IGI_A, pDM_Odm), ODM_BIT(IGI, pDM_Odm)); + pDM_DigTable->CurIGValue = (u8) ODM_GetBBReg(pDM_Odm, + ODM_REG(IGI_A, pDM_Odm), + ODM_BIT(IGI, pDM_Odm)); pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW; pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; pDM_DigTable->FALowThresh = DM_FALSEALARM_THRESH_LOW; @@ -556,19 +556,22 @@ void odm_DIG23a(struct rtw_adapter *adapter) u8 dm_dig_max, dm_dig_min; u8 CurrentIGI = pDM_DigTable->CurIGValue; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG23a() ==>\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, + ("odm_DIG23a() ==>\n")); if (adapter->mlmepriv.bScanInProcess) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG23a() Return: In Scan Progress \n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, + ("odm_DIG23a() Return: In Scan Progress \n")); return; } DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; FirstConnect = (pDM_Odm->bLinked) && (!pDM_DigTable->bMediaConnect_0); - FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0); + FirstDisConnect = (!pDM_Odm->bLinked) && + (pDM_DigTable->bMediaConnect_0); /* 1 Boundary Decision */ if ((pDM_Odm->SupportICType & ODM_RTL8723A) && - ((pDM_Odm->BoardType == ODM_BOARD_HIGHPWR) || pDM_Odm->ExtLNA)) { + (pDM_Odm->BoardType == ODM_BOARD_HIGHPWR || pDM_Odm->ExtLNA)) { dm_dig_max = DM_DIG_MAX_NIC_HP; dm_dig_min = DM_DIG_MIN_NIC_HP; DIG_MaxOfMin = DM_DIG_MAX_AP_HP; @@ -814,9 +817,12 @@ void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) ("Cnt_Crc8_fail =%d, Cnt_Mcs_fail =%d\n", FalseAlmCnt->Cnt_Crc8_fail, FalseAlmCnt->Cnt_Mcs_fail)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Cck_fail =%d\n", FalseAlmCnt->Cnt_Cck_fail)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Ofdm_fail =%d\n", FalseAlmCnt->Cnt_Ofdm_fail)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Total False Alarm =%d\n", FalseAlmCnt->Cnt_all)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, + ("Cnt_Cck_fail =%d\n", FalseAlmCnt->Cnt_Cck_fail)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, + ("Cnt_Ofdm_fail =%d\n", FalseAlmCnt->Cnt_Ofdm_fail)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, + ("Total False Alarm =%d\n", FalseAlmCnt->Cnt_all)); } /* 3 ============================================================ */ @@ -834,7 +840,7 @@ void odm_CCKPacketDetectionThresh23a(struct dm_odm_t *pDM_Odm) if (pDM_Odm->bLinked) { if (pDM_Odm->RSSI_Min > 25) { CurCCK_CCAThres = 0xcd; - } else if ((pDM_Odm->RSSI_Min <= 25) && (pDM_Odm->RSSI_Min > 10)) { + } else if (pDM_Odm->RSSI_Min <= 25 && pDM_Odm->RSSI_Min > 10) { CurCCK_CCAThres = 0x83; } else { if (FalseAlmCnt->Cnt_Cck_fail > 1000) @@ -857,10 +863,10 @@ void ODM_Write_CCK_CCA_Thres23a(struct dm_odm_t *pDM_Odm, u8 CurCCK_CCAThres) struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; if (pDM_DigTable->CurCCK_CCAThres != CurCCK_CCAThres) - ODM_Write1Byte(pDM_Odm, ODM_REG(CCK_CCA, pDM_Odm), CurCCK_CCAThres); + ODM_Write1Byte(pDM_Odm, ODM_REG(CCK_CCA, pDM_Odm), + CurCCK_CCAThres); pDM_DigTable->PreCCK_CCAThres = pDM_DigTable->CurCCK_CCAThres; pDM_DigTable->CurCCK_CCAThres = CurCCK_CCAThres; - } /* 3 ============================================================ */ @@ -890,11 +896,14 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) u8 Rssi_Low_bound = 25; if (pDM_PSTable->initialize == 0) { - pDM_PSTable->Reg874 = (ODM_GetBBReg(pDM_Odm, 0x874, bMaskDWord)&0x1CC000)>>14; + pDM_PSTable->Reg874 = (ODM_GetBBReg(pDM_Odm, 0x874, + bMaskDWord)&0x1CC000) >> 14; pDM_PSTable->RegC70 = (ODM_GetBBReg(pDM_Odm, 0xc70, bMaskDWord) & BIT(3)) >>3; - pDM_PSTable->Reg85C = (ODM_GetBBReg(pDM_Odm, 0x85c, bMaskDWord)&0xFF000000)>>24; - pDM_PSTable->RegA74 = (ODM_GetBBReg(pDM_Odm, 0xa74, bMaskDWord)&0xF000)>>12; + pDM_PSTable->Reg85C = (ODM_GetBBReg(pDM_Odm, 0x85c, + bMaskDWord)&0xFF000000)>>24; + pDM_PSTable->RegA74 = (ODM_GetBBReg(pDM_Odm, 0xa74, + bMaskDWord)&0xF000)>>12; /* Reg818 = PHY_QueryBBReg(pAdapter, 0x818, bMaskDWord); */ pDM_PSTable->initialize = 1; } @@ -921,26 +930,40 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) if (pDM_PSTable->PreRFState != pDM_PSTable->CurRFState) { if (pDM_PSTable->CurRFState == RF_Save) { - /* 8723 RSSI report will be wrong. Set 0x874[5]= 1 when enter BB power saving mode. */ + /* 8723 RSSI report will be wrong. + * Set 0x874[5]= 1 when enter BB power saving mode. */ /* Suggested by SD3 Yu-Nan. 2011.01.20. */ + /* Reg874[5]= 1b'1 */ if (pDM_Odm->SupportICType == ODM_RTL8723A) - ODM_SetBBReg(pDM_Odm, 0x874, BIT(5), 0x1); /* Reg874[5]= 1b'1 */ - ODM_SetBBReg(pDM_Odm, 0x874, 0x1C0000, 0x2); /* Reg874[20:18]= 3'b010 */ - ODM_SetBBReg(pDM_Odm, 0xc70, BIT(3), 0); /* RegC70[3]= 1'b0 */ - ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, 0x63); /* Reg85C[31:24]= 0x63 */ - ODM_SetBBReg(pDM_Odm, 0x874, 0xC000, 0x2); /* Reg874[15:14]= 2'b10 */ - ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, 0x3); /* RegA75[7:4]= 0x3 */ - ODM_SetBBReg(pDM_Odm, 0x818, BIT(28), 0x0); /* Reg818[28]= 1'b0 */ - ODM_SetBBReg(pDM_Odm, 0x818, BIT(28), 0x1); /* Reg818[28]= 1'b1 */ + ODM_SetBBReg(pDM_Odm, 0x874, BIT(5), 0x1); + /* Reg874[20:18]= 3'b010 */ + ODM_SetBBReg(pDM_Odm, 0x874, 0x1C0000, 0x2); + /* RegC70[3]= 1'b0 */ + ODM_SetBBReg(pDM_Odm, 0xc70, BIT(3), 0); + /* Reg85C[31:24]= 0x63 */ + ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, 0x63); + /* Reg874[15:14]= 2'b10 */ + ODM_SetBBReg(pDM_Odm, 0x874, 0xC000, 0x2); + /* RegA75[7:4]= 0x3 */ + ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, 0x3); + /* Reg818[28]= 1'b0 */ + ODM_SetBBReg(pDM_Odm, 0x818, BIT(28), 0x0); + /* Reg818[28]= 1'b1 */ + ODM_SetBBReg(pDM_Odm, 0x818, BIT(28), 0x1); } else { - ODM_SetBBReg(pDM_Odm, 0x874, 0x1CC000, pDM_PSTable->Reg874); - ODM_SetBBReg(pDM_Odm, 0xc70, BIT(3), pDM_PSTable->RegC70); - ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, pDM_PSTable->Reg85C); - ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, pDM_PSTable->RegA74); + ODM_SetBBReg(pDM_Odm, 0x874, 0x1CC000, + pDM_PSTable->Reg874); + ODM_SetBBReg(pDM_Odm, 0xc70, BIT(3), + pDM_PSTable->RegC70); + ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, + pDM_PSTable->Reg85C); + ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, + pDM_PSTable->RegA74); ODM_SetBBReg(pDM_Odm, 0x818, BIT(28), 0x0); + /* Reg874[5]= 1b'0 */ if (pDM_Odm->SupportICType == ODM_RTL8723A) - ODM_SetBBReg(pDM_Odm, 0x874, BIT(5), 0x0); /* Reg874[5]= 1b'0 */ + ODM_SetBBReg(pDM_Odm, 0x874, BIT(5), 0x0); } pDM_PSTable->PreRFState = pDM_PSTable->CurRFState; } @@ -1038,11 +1061,11 @@ u32 ODM_Get_Rate_Bitmap23a(struct hal_data_8723a *pHalData, u32 macid, break; } - /* printk("%s ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x \n", __func__, rssi_level, WirelessMode, rate_bitmap); */ - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, (" ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x \n", rssi_level, WirelessMode, rate_bitmap)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, + (" ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x \n", + rssi_level, WirelessMode, rate_bitmap)); return rate_bitmap; - } /*----------------------------------------------------------------------------- @@ -1118,7 +1141,8 @@ bool ODM_RAStateCheck23a(struct dm_odm_t *pDM_Odm, s32 RSSI, bool bForceUpdate, LowRSSIThreshForRA += GoUpGap; break; default: - ODM_RT_ASSERT(pDM_Odm, false, ("wrong rssi level setting %d !", *pRATRState)); + ODM_RT_ASSERT(pDM_Odm, false, ("wrong rssi level setting %d !", + *pRATRState)); break; } @@ -1242,7 +1266,8 @@ void odm_TXPowerTrackingThermalMeterInit23a(struct dm_odm_t *pDM_Odm) pdmpriv->TXPowercount = 0; pdmpriv->bTXPowerTrackingInit = false; pdmpriv->TxPowerTrackControl = true; - MSG_8723A("pdmpriv->TxPowerTrackControl = %d\n", pdmpriv->TxPowerTrackControl); + MSG_8723A("pdmpriv->TxPowerTrackControl = %d\n", + pdmpriv->TxPowerTrackControl); pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = true; } @@ -1256,12 +1281,19 @@ static void ODM_EdcaTurboInit23a(struct dm_odm_t *pDM_Odm) pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; Adapter->recvpriv.bIsAnyNonBEPkts = false; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial VO PARAM: 0x%x\n", ODM_Read4Byte(pDM_Odm, ODM_EDCA_VO_PARAM))); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial VI PARAM: 0x%x\n", ODM_Read4Byte(pDM_Odm, ODM_EDCA_VI_PARAM))); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial BE PARAM: 0x%x\n", ODM_Read4Byte(pDM_Odm, ODM_EDCA_BE_PARAM))); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial BK PARAM: 0x%x\n", ODM_Read4Byte(pDM_Odm, ODM_EDCA_BK_PARAM))); - -} /* ODM_InitEdcaTurbo */ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, + ("Orginial VO PARAM: 0x%x\n", + ODM_Read4Byte(pDM_Odm, ODM_EDCA_VO_PARAM))); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, + ("Orginial VI PARAM: 0x%x\n", + ODM_Read4Byte(pDM_Odm, ODM_EDCA_VI_PARAM))); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, + ("Orginial BE PARAM: 0x%x\n", + ODM_Read4Byte(pDM_Odm, ODM_EDCA_BE_PARAM))); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, + ("Orginial BK PARAM: 0x%x\n", + ODM_Read4Byte(pDM_Odm, ODM_EDCA_BK_PARAM))); +} static void odm_EdcaTurboCheck23a(struct dm_odm_t *pDM_Odm) { @@ -1280,9 +1312,12 @@ static void odm_EdcaTurboCheck23a(struct dm_odm_t *pDM_Odm) /* For AP/ADSL use struct rtl8723a_priv * */ /* For CE/NIC use struct rtw_adapter * */ - /* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */ - /* at the same time. In the stage2/3, we need to prive universal interface and merge all */ - /* HW dynamic mechanism. */ + /* + * 2011/09/29 MH In HW integration first stage, we provide 4 + * different handle to operate at the same time. In the stage2/3, + * we need to prive universal interface and merge all HW dynamic + * mechanism. + */ if ((pregpriv->wifi_spec == 1))/* (pmlmeinfo->HT_enable == 0)) */ goto dm_CheckEdcaTurbo_EXIT; @@ -1362,14 +1397,13 @@ u32 GetPSDData(struct dm_odm_t *pDM_Odm, unsigned int point, u8 initial_gain_psd /* Read PSD report, Reg8B4[15:0] */ psd_report = ODM_GetBBReg(pDM_Odm, 0x8B4, bMaskDWord) & 0x0000FFFF; - psd_report = (u32)(ConvertTo_dB23a(psd_report))+(u32)(initial_gain_psd-0x1c); + psd_report = (u32)(ConvertTo_dB23a(psd_report)) + + (u32)(initial_gain_psd-0x1c); return psd_report; } -u32 -ConvertTo_dB23a( - u32 Value) +u32 ConvertTo_dB23a(u32 Value) { u8 i; u8 j; @@ -1397,7 +1431,8 @@ ConvertTo_dB23a( /* */ /* Description: */ -/*Set Single/Dual Antenna default setting for products that do not do detection in advance. */ +/* Set Single/Dual Antenna default setting for products that do not + * do detection in advance. */ /* */ /* Added by Joseph, 2012.03.22 */ /* */ @@ -1461,9 +1496,11 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) return bResult; /* 1 Backup Current RF/BB Settings */ - CurrentChannel = ODM_GetRFReg(pDM_Odm, RF_PATH_A, ODM_CHANNEL, bRFRegOffsetMask); + CurrentChannel = ODM_GetRFReg(pDM_Odm, RF_PATH_A, ODM_CHANNEL, + bRFRegOffsetMask); RfLoopReg = ODM_GetRFReg(pDM_Odm, RF_PATH_A, 0x00, bRFRegOffsetMask); - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, ODM_DPDT, Antenna_A); /* change to Antenna A */ + /* change to Antenna A */ + ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, ODM_DPDT, Antenna_A); /* Step 1: USE IQK to transmitter single tone */ udelay(10); @@ -1481,7 +1518,7 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) ODM_SetBBReg(pDM_Odm, rFPGA0_PSDFunction, BIT(14) | BIT(15), 0x0); /* To SET CH1 to do */ - ODM_SetRFReg(pDM_Odm, RF_PATH_A, ODM_CHANNEL, bRFRegOffsetMask, 0x01); /* Channel 1 */ + ODM_SetRFReg(pDM_Odm, RF_PATH_A, ODM_CHANNEL, bRFRegOffsetMask, 0x01); /* AFE all on step */ ODM_SetBBReg(pDM_Odm, rRx_Wait_CCA, bMaskDWord, 0x6FDB25A4); @@ -1548,7 +1585,8 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) } /* change to open case */ - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, 0); /* change to Ant A and B all open case */ + /* change to Ant A and B all open case */ + ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, 0); udelay(10); for (n = 0; n < 2; n++) { @@ -1568,15 +1606,19 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, Reg874); ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, 0x7F, 0x40); ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskDWord, Regc50); - ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, CurrentChannel); + ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, + CurrentChannel); ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0x00, bRFRegOffsetMask, RfLoopReg); /* Reload AFE Registers */ odm_PHY_ReloadAFERegisters(pDM_Odm, AFE_REG_8723A, AFE_Backup, 16); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_A[%d]= %d \n", 2416, AntA_report)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_B[%d]= %d \n", 2416, AntB_report)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_O[%d]= %d \n", 2416, AntO_report)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + ("psd_report_A[%d]= %d \n", 2416, AntA_report)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + ("psd_report_B[%d]= %d \n", 2416, AntB_report)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + ("psd_report_O[%d]= %d \n", 2416, AntO_report)); /* 2 Test Ant B based on Ant A is ON */ if (mode == ANTTESTB) { @@ -1598,25 +1640,33 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) if ((AntO_report >= 100) & (AntO_report < 118)) { if (AntA_report > (AntO_report+1)) { pDM_SWAT_Table->ANTA_ON = false; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ant A is OFF")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, + ODM_DBG_LOUD, ("Ant A is OFF")); } else { pDM_SWAT_Table->ANTA_ON = true; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ant A is ON")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, + ODM_DBG_LOUD, ("Ant A is ON")); } if (AntB_report > (AntO_report+2)) { pDM_SWAT_Table->ANTB_ON = false; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ant B is OFF")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, + ODM_DBG_LOUD, ("Ant B is OFF")); } else { pDM_SWAT_Table->ANTB_ON = true; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ant B is ON")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, + ODM_DBG_LOUD, ("Ant B is ON")); } } } else { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Need to check again\n")); - pDM_SWAT_Table->ANTA_ON = true; /* Set Antenna A on as default */ - pDM_SWAT_Table->ANTB_ON = false; /* Set Antenna B off as default */ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, + ("ODM_SingleDualAntennaDetection(): Need to check again\n")); + /* Set Antenna A on as default */ + pDM_SWAT_Table->ANTA_ON = true; + /* Set Antenna B off as default */ + pDM_SWAT_Table->ANTB_ON = false; bResult = false; } + return bResult; } -- cgit v1.2.3 From 85b7a9de00bde29e3c815474f51bfdf0fbcde9d7 Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 2 Mar 2015 23:40:25 +0530 Subject: staging: lustre: lustre: libcfs: Replaced printk() with pr_err() The following checkpatch warning was fixed: Prefer [subsystem eg: netdev]_err([subsystem]dev with the help of Coccinelle. The following semantic patch was used: @a@ expression e; @@ printk(e,...); @script:python b@ e << a.e; y; @@ import re match = re.match('KERN_ERR ', e); if (match == None): cocci.include_match(False) else: m = re.sub('KERN_ERR ', '', e) coccinelle.y = m; @c@ expression a.e; identifier b.y; @@ - printk(e, + pr_err(y, ...); Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/module.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 7dc77dd402b8..e35f5981cb43 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -347,7 +347,7 @@ static int init_libcfs_module(void) rc = libcfs_debug_init(5 * 1024 * 1024); if (rc < 0) { - printk(KERN_ERR "LustreError: libcfs_debug_init: %d\n", rc); + pr_err("LustreError: libcfs_debug_init: %d\n", rc); return rc; } @@ -433,8 +433,7 @@ static void exit_libcfs_module(void) rc = libcfs_debug_cleanup(); if (rc) - printk(KERN_ERR "LustreError: libcfs_debug_cleanup: %d\n", - rc); + pr_err("LustreError: libcfs_debug_cleanup: %d\n", rc); libcfs_arch_cleanup(); } -- cgit v1.2.3 From 324588eccc75a3a3d4beac2a0206122b23b90adc Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 2 Mar 2015 23:40:26 +0530 Subject: staging: lustre: lustre: libcfs: Replaced printk() with pr_err() and pr_cont() The following checkpatch warning was fixed: Prefer [subsystem eg: netdev]_err([subsystem]dev with the help of Coccinelle. pr_cont() was used to replace those printk statements which followed a printk that did not end with a '\n'. The following semantic patch was used to replace printk() with pr_err(): @a@ expression e; @@ printk(e,...); @script:python b@ e << a.e; y; @@ import re match = re.match('KERN_ERR ', e); if (match == None): cocci.include_match(False) else: m = re.sub('KERN_ERR ', '', e) coccinelle.y = m; @c@ expression a.e; identifier b.y; @@ - printk(e, + pr_err(y, ...); Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/tracefile.c | 26 +++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index eb65b50f832d..f8d8a2f70691 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -224,8 +224,7 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd, */ if (len > PAGE_CACHE_SIZE) { - printk(KERN_ERR - "cowardly refusing to write %lu bytes in a page\n", len); + pr_err("cowardly refusing to write %lu bytes in a page\n", len); return NULL; } @@ -688,8 +687,8 @@ int cfs_tracefile_dump_all_pages(char *filename) if (IS_ERR(filp)) { rc = PTR_ERR(filp); filp = NULL; - printk(KERN_ERR "LustreError: can't open %s for dump: rc %d\n", - filename, rc); + pr_err("LustreError: can't open %s for dump: rc %d\n", + filename, rc); goto out; } @@ -726,7 +725,7 @@ int cfs_tracefile_dump_all_pages(char *filename) MMSPACE_CLOSE; rc = vfs_fsync(filp, 1); if (rc) - printk(KERN_ERR "sync returns %d\n", rc); + pr_err("sync returns %d\n", rc); close: filp_close(filp, NULL); out: @@ -1048,22 +1047,21 @@ static int tracefiled(void *arg) int i; printk(KERN_ALERT "Lustre: trace pages aren't empty\n"); - printk(KERN_ERR "total cpus(%d): ", - num_possible_cpus()); + pr_err("total cpus(%d): ", + num_possible_cpus()); for (i = 0; i < num_possible_cpus(); i++) if (cpu_online(i)) - printk(KERN_ERR "%d(on) ", i); + pr_cont("%d(on) ", i); else - printk(KERN_ERR "%d(off) ", i); - printk(KERN_ERR "\n"); + pr_cont("%d(off) ", i); + pr_cont("\n"); i = 0; list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) - printk(KERN_ERR "page %d belongs to cpu %d\n", - ++i, tage->cpu); - printk(KERN_ERR "There are %d pages unwritten\n", - i); + pr_err("page %d belongs to cpu %d\n", + ++i, tage->cpu); + pr_err("There are %d pages unwritten\n", i); } __LASSERT(list_empty(&pc.pc_pages)); end_loop: -- cgit v1.2.3 From 82d28561b7e01eccaa36b06c987045f08a77b4f4 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 3 Mar 2015 17:08:06 +0530 Subject: staging: comedi: Remove if condition. This patch removes a if condition which has a semicolon after it. As the conditional check is redundant, the comment before it is also changed. The following coccinelle script was used to detect the pattern of a semicolon after if. @r1@ position p; @@ if (...);@p @script:python@ p0 << r1.p; @@ // Emacs org-mode output cocci.print_main("", p0) cocci.print_secs("", p0) Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das1800.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 3eb02e8d6103..ca4f322c0d2f 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -489,9 +489,7 @@ static void das1800_handle_fifo_not_empty(struct comedi_device *dev, while (inb(dev->iobase + DAS1800_STATUS) & FNE) { dpnt = inw(dev->iobase + DAS1800_FIFO); - /* convert to unsigned type if we are in a bipolar mode */ - if (!unipolar) - ; + /* convert to unsigned type */ dpnt = munge_bipolar_sample(dev, dpnt); comedi_buf_write_samples(s, &dpnt, 1); -- cgit v1.2.3 From e384b69a35ae96055774dbce9dea813043e21142 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 3 Mar 2015 16:27:37 +0200 Subject: staging: iio: meter: add check on return variables adds checks on variables that are used to return values. If the value is less than zero, this indicates that an error occurred and hence a message is printed through dev_err. Checks are made on negative values only since spi_* functions return negative error codes. The functions were found using the following script but the aforementioned modification was what was carried out in the end: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7758_core.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c index 70e96b20c2eb..7e287dae7b44 100644 --- a/drivers/staging/iio/meter/ade7758_core.c +++ b/drivers/staging/iio/meter/ade7758_core.c @@ -303,14 +303,15 @@ static int ade7758_reset(struct device *dev) int ret; u8 val; - ade7758_spi_read_reg_8(dev, - ADE7758_OPMODE, - &val); + ret = ade7758_spi_read_reg_8(dev, ADE7758_OPMODE, &val); + if (ret < 0) { + dev_err(dev, "Failed to read opmode reg\n"); + return ret; + } val |= 1 << 6; /* Software Chip Reset */ - ret = ade7758_spi_write_reg_8(dev, - ADE7758_OPMODE, - val); - + ret = ade7758_spi_write_reg_8(dev, ADE7758_OPMODE, val); + if (ret < 0) + dev_err(dev, "Failed to write opmode reg\n"); return ret; } @@ -444,14 +445,15 @@ static int ade7758_stop_device(struct device *dev) int ret; u8 val; - ade7758_spi_read_reg_8(dev, - ADE7758_OPMODE, - &val); + ret = ade7758_spi_read_reg_8(dev, ADE7758_OPMODE, &val); + if (ret < 0) { + dev_err(dev, "Failed to read opmode reg\n"); + return ret; + } val |= 7 << 3; /* ADE7758 powered down */ - ret = ade7758_spi_write_reg_8(dev, - ADE7758_OPMODE, - val); - + ret = ade7758_spi_write_reg_8(dev, ADE7758_OPMODE, val); + if (ret < 0) + dev_err(dev, "Failed to write opmode reg\n"); return ret; } -- cgit v1.2.3 From 37e3be9de378d4775c617b0649ff89a6dc6bf07d Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Wed, 4 Mar 2015 02:37:15 +0200 Subject: Staging: iio: Added define guards where needed The following files were added define guards to prevent multiple inclusion. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/Documentation/iio_utils.h | 4 ++++ drivers/staging/iio/accel/sca3000.h | 5 ++++- drivers/staging/iio/frequency/dds.h | 4 ++++ drivers/staging/iio/meter/meter.h | 4 ++++ drivers/staging/iio/resolver/ad2s1210.h | 3 +++ 5 files changed, 19 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 568eff06f803..bd6982c12d0d 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -6,6 +6,8 @@ * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ +#ifndef _IIO_UTILS_H +#define _IIO_UTILS_H #include #include @@ -681,3 +683,5 @@ error_free: free(temp); return ret; } + +#endif /* _IIO_UTILS_H */ diff --git a/drivers/staging/iio/accel/sca3000.h b/drivers/staging/iio/accel/sca3000.h index b284e5a6cac1..9c8a9587df7d 100644 --- a/drivers/staging/iio/accel/sca3000.h +++ b/drivers/staging/iio/accel/sca3000.h @@ -38,6 +38,9 @@ * Can probably alleviate this by reading the interrupt register on start, but * that is really just brushing the problem under the carpet. */ +#ifndef _SCA3000 +#define _SCA3000 + #define SCA3000_WRITE_REG(a) (((a) << 2) | 0x02) #define SCA3000_READ_REG(a) ((a) << 2) @@ -272,4 +275,4 @@ static inline void sca3000_ring_int_process(u8 val, void *ring) } #endif - +#endif /* _SCA3000 */ diff --git a/drivers/staging/iio/frequency/dds.h b/drivers/staging/iio/frequency/dds.h index 611e2b0cfc4c..fe53e7324c94 100644 --- a/drivers/staging/iio/frequency/dds.h +++ b/drivers/staging/iio/frequency/dds.h @@ -5,6 +5,8 @@ * * Licensed under the GPL-2 or later. */ +#ifndef IIO_DDS_H_ +#define IIO_DDS_H_ /** * /sys/bus/iio/devices/.../out_altvoltageX_frequencyY @@ -108,3 +110,5 @@ #define IIO_CONST_ATTR_OUT_WAVETYPES_AVAILABLE(_channel, _output, _modes)\ IIO_CONST_ATTR( \ out_altvoltage##_channel##_out##_output##_wavetype_available, _modes) + +#endif /* IIO_DDS_H_ */ diff --git a/drivers/staging/iio/meter/meter.h b/drivers/staging/iio/meter/meter.h index 8f0de02839b7..dfba510f29be 100644 --- a/drivers/staging/iio/meter/meter.h +++ b/drivers/staging/iio/meter/meter.h @@ -1,3 +1,6 @@ +#ifndef _METER_H +#define _METER_H + #include /* metering ic types of attribute */ @@ -394,3 +397,4 @@ #define IIO_EVENT_ATTR_VPKLVL_EXC(_evlist, _show, _store, _mask) \ IIO_EVENT_ATTR_SH(vpklvl_exc, _evlist, _show, _store, _mask) +#endif /* _METER_H */ diff --git a/drivers/staging/iio/resolver/ad2s1210.h b/drivers/staging/iio/resolver/ad2s1210.h index aec0bdca16a4..c7158f6e61c2 100644 --- a/drivers/staging/iio/resolver/ad2s1210.h +++ b/drivers/staging/iio/resolver/ad2s1210.h @@ -8,6 +8,8 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#ifndef _AD2S1210_H +#define _AD2S1210_H struct ad2s1210_platform_data { unsigned sample; @@ -15,3 +17,4 @@ struct ad2s1210_platform_data { unsigned res[2]; bool gpioin; }; +#endif /* _AD2S1210_H */ -- cgit v1.2.3 From 225f597c60da646a6df1f7ac4152577a0c5fd56c Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Tue, 3 Mar 2015 23:48:21 +0900 Subject: staging: lustre: remove initialization of static ints static ints are initialized to 0 by the compiler. Explicit initialization is not necessary. Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL changes made using coccinelle script: @@ type T; identifier var; @@ -static T var = 0; +static T var; Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c | 2 +- drivers/staging/lustre/lustre/libcfs/tracefile.c | 2 +- drivers/staging/lustre/lustre/llite/statahead.c | 2 +- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c index 0f65929a8524..3100cb138548 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c @@ -165,7 +165,7 @@ static int proc_dobitmasks(struct ctl_table *table, int write, __proc_dobitmasks); } -static int min_watchdog_ratelimit = 0; /* disable ratelimiting */ +static int min_watchdog_ratelimit; /* disable ratelimiting */ static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */ static int __proc_dump_kernel(void *data, int write, diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index f8d8a2f70691..c86394f7f4d9 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -53,7 +53,7 @@ char cfs_tracefile[TRACEFILE_NAME_SIZE]; long long cfs_tracefile_size = CFS_TRACEFILE_SIZE; static struct tracefiled_ctl trace_tctl; struct mutex cfs_trace_thread_mutex; -static int thread_running = 0; +static int thread_running; static atomic_t cfs_tage_allocated = ATOMIC_INIT(0); diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 6ad9dd0fe2b3..fe732fa0d01f 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -84,7 +84,7 @@ struct ll_sa_entry { struct qstr se_qstr; }; -static unsigned int sai_generation = 0; +static unsigned int sai_generation; static DEFINE_SPINLOCK(sai_generation_lock); static inline int ll_sa_entry_unhashed(struct ll_sa_entry *entry) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index b24457554798..0375bfe29a7d 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -479,7 +479,7 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) #define RQ_NOW 0x2 #define RQ_LATER 0x4 #define RQ_STOP 0x8 -static int rq_state = 0; +static int rq_state; static wait_queue_head_t rq_waitq; static DECLARE_COMPLETION(rq_exit); diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 82508210465e..6d440b465860 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -1559,7 +1559,7 @@ void obd_exports_barrier(struct obd_device *obd) EXPORT_SYMBOL(obd_exports_barrier); /* Total amount of zombies to be destroyed */ -static int zombies_count = 0; +static int zombies_count; /** * kill zombie imports and exports diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 55e80818bd5d..c171c6c6c457 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -223,7 +223,7 @@ EXPORT_SYMBOL(lprocfs_write_frac_helper); #if defined (CONFIG_PROC_FS) -static int lprocfs_no_percpu_stats = 0; +static int lprocfs_no_percpu_stats; module_param(lprocfs_no_percpu_stats, int, 0644); MODULE_PARM_DESC(lprocfs_no_percpu_stats, "Do not alloc percpu data for lprocfs stats"); diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index d2311f246c4a..20c0779951fd 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -1308,7 +1308,7 @@ static DEFINE_SPINLOCK(lu_keys_guard); * lu_context_refill(). No locking is provided, as initialization and shutdown * are supposed to be externally serialized. */ -static unsigned key_set_version = 0; +static unsigned key_set_version; /** * Register new key. diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 2f45f7657830..eb6ff902080c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -117,7 +117,7 @@ EXPORT_SYMBOL(lustre_msg_check_version); /* early reply size */ int lustre_msg_early_size(void) { - static int size = 0; + static int size; if (!size) { /* Always reply old ptlrpc_body_v2 to keep interoprability * with the old client (< 2.3) which doesn't have pb_jobid diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 340d98a64137..9dbda9332dd8 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -545,7 +545,7 @@ void ptlrpc_pinger_wake_up(void) #define PET_READY 1 #define PET_TERMINATE 2 -static int pet_refcount = 0; +static int pet_refcount; static int pet_state; static wait_queue_head_t pet_waitq; LIST_HEAD(pet_list); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 4621b71fe0b6..8f7be84aa187 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -85,7 +85,7 @@ MODULE_PARM_DESC(ptlrpcd_bind_policy, "Ptlrpcd threads binding mode."); static struct ptlrpcd *ptlrpcds; struct mutex ptlrpcd_mutex; -static int ptlrpcd_users = 0; +static int ptlrpcd_users; void ptlrpcd_wake(struct ptlrpc_request *req) { -- cgit v1.2.3 From 80c598a6abff3713e4a8c31c34f6aec8b342844d Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Mon, 2 Mar 2015 23:56:54 +0200 Subject: Staging: rtl8192u: Fix quoted string split across lines This patch fixes checkpatch.pl warning in file ieee80211_crypt.c WARNING: "quoted string split across lines warning" Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index f80dd08b0668..3995620b3442 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -65,8 +65,8 @@ void ieee80211_crypt_deinit_handler(unsigned long data) spin_lock_irqsave(&ieee->lock, flags); ieee80211_crypt_deinit_entries(ieee, 0); if (!list_empty(&ieee->crypt_deinit_list)) { - netdev_dbg(ieee->dev, "%s: entries remaining in delayed crypt " - "deletion list\n", ieee->dev->name); + netdev_dbg(ieee->dev, "%s: entries remaining in delayed crypt deletion list\n", + ieee->dev->name); ieee->crypt_deinit_timer.expires = jiffies + HZ; add_timer(&ieee->crypt_deinit_timer); } @@ -145,8 +145,8 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) spin_unlock_irqrestore(&hcrypt->lock, flags); if (del_alg) { - pr_debug("ieee80211_crypt: unregistered algorithm " - "'%s'\n", ops->name); + pr_debug("ieee80211_crypt: unregistered algorithm '%s'\n", + ops->name); kfree(del_alg); } @@ -231,8 +231,8 @@ void __exit ieee80211_crypto_deinit(void) struct ieee80211_crypto_alg *alg = (struct ieee80211_crypto_alg *) ptr; list_del(ptr); - pr_debug("ieee80211_crypt: unregistered algorithm " - "'%s' (deinit)\n", alg->ops->name); + pr_debug("ieee80211_crypt: unregistered algorithm '%s' (deinit)\n", + alg->ops->name); kfree(alg); } -- cgit v1.2.3 From 5dc42962e1669a7ad222103d485e9af30dd1ffde Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Tue, 3 Mar 2015 13:08:24 +0530 Subject: Staging: rtl8192e: Eliminate use of macro IS_NIC_DOWN This patch eliminates use of unnecessory macro IS_NIC_DOWN and replaces it with standard code. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 10 +++++----- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 10 +++++----- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 ++-- 4 files changed, 12 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 8c08ef6a40a4..cd3c662eba2b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -996,7 +996,7 @@ static void rtl8192_phy_FinishSwChnlNow(struct net_device *dev, u8 channel) &priv->SwChnlStep, &delay)) { if (delay > 0) msleep(delay); - if (IS_NIC_DOWN(priv)) + if (!priv->up) break; } } @@ -1020,7 +1020,7 @@ u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel) struct r8192_priv *priv = rtllib_priv(dev); RT_TRACE(COMP_PHY, "=====>%s()\n", __func__); - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_ERR, "%s(): ERR !! driver is not up\n", __func__); return false; } @@ -1060,7 +1060,7 @@ u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel) priv->SwChnlStage = 0; priv->SwChnlStep = 0; - if (!IS_NIC_DOWN(priv)) + if (priv->up) rtl8192_SwChnl_WorkItem(dev); priv->SwChnlInProgress = false; return true; @@ -1186,7 +1186,7 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) priv->SetBWModeInProgress = false; return; } - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_ERR, "%s(): ERR!! driver is not up\n", __func__); return; } @@ -1309,7 +1309,7 @@ void InitialGain819xPci(struct net_device *dev, u8 Operation) u32 BitMask; u8 initial_gain; - if (!IS_NIC_DOWN(priv)) { + if (priv->up) { switch (Operation) { case IG_Backup: RT_TRACE(COMP_SCAN, "IG_Backup, backup the initial" diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 7dda904bb477..a603acc22d92 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1506,7 +1506,7 @@ RESET_START: if (priv->rtllib->state == RTLLIB_LINKED) LeisurePSLeave(dev); - if (IS_NIC_DOWN(priv)) { + if (priv->up) { RT_TRACE(COMP_ERR, "%s():the driver is not up! " "return\n", __func__); up(&priv->wx_sem); @@ -1650,7 +1650,7 @@ void rtl819x_watchdog_wqcallback(void *data) bool bHigherBusyRxTraffic = false; bool bEnterPS = false; - if (IS_NIC_DOWN(priv) || priv->bHwRadioOff) + if (!priv->up || priv->bHwRadioOff) return; if (priv->rtllib->state >= RTLLIB_LINKED) { @@ -1882,7 +1882,7 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index; - if ((priv->rtllib->eRFPowerState == eRfOff) || IS_NIC_DOWN(priv) || + if ((priv->rtllib->eRFPowerState == eRfOff) || !priv->up || priv->bResetInProgress) { kfree_skb(skb); return; @@ -1916,7 +1916,7 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (queue_index != TXCMD_QUEUE) { if ((priv->rtllib->eRFPowerState == eRfOff) || - IS_NIC_DOWN(priv) || priv->bResetInProgress) { + !priv->up || priv->bResetInProgress) { kfree_skb(skb); return 0; } @@ -3032,7 +3032,7 @@ bool NicIFEnableNIC(struct net_device *dev) struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) (&(priv->rtllib->PowerSaveControl)); - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_ERR, "ERR!!! %s(): Driver is already down!\n", __func__); priv->bdisable_nic = false; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index d1438c2f8980..113174b52a57 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -98,8 +98,6 @@ #define BIT(_i) (1<<(_i)) #endif -#define IS_NIC_DOWN(priv) (!(priv)->up) - #define IS_ADAPTER_SENDS_BEACON(dev) 0 #define IS_UNDER_11N_AES_MODE(_rtllib) \ diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index b8891c62af3e..bdb9274486dc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -267,7 +267,7 @@ static void dm_check_rate_adaptive(struct net_device *dev) bool bshort_gi_enabled = false; static u8 ping_rssi_state; - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_RATE, "<---- dm_check_rate_adaptive(): driver is going to unload\n"); return; } @@ -1569,7 +1569,7 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev) u32 reg_ratr = priv->rate_adaptive.last_ratr; u32 ratr_value; - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_RATE, "<---- dm_restore_dynamic_mechanism_state(): driver is going to unload\n"); return; } -- cgit v1.2.3 From c5c15efba8cc3865ff880cbab52ffe6472373921 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Tue, 3 Mar 2015 13:09:23 +0530 Subject: Staging: rtl8192u: Fix duplicate conditional branch Replace duplicate branch with correct value. This branch is supposed to work for low thresh value. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 719961643ded..5a01b7d405b1 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -1628,8 +1628,8 @@ void dm_change_dynamic_initgain_thresh(struct net_device *dev, u32 dm_type, dm_digtable.rssi_low_thresh = dm_value; } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) { dm_digtable.rssi_high_power_highthresh = dm_value; - } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) { - dm_digtable.rssi_high_power_highthresh = dm_value; + } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_LOW) { + dm_digtable.rssi_high_power_lowthresh = dm_value; } else if (dm_type == DIG_TYPE_ENABLE) { dm_digtable.dig_state = DM_STA_DIG_MAX; dm_digtable.dig_enable_flag = true; -- cgit v1.2.3 From cdbaf3f67279e7ee531c1be6da53731461a74237 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 3 Mar 2015 16:03:35 +0200 Subject: staging: rtl8192e: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x) eth_zero_addr() is a wrapper function for memset if 0 is going to be assigned to a mac address. The replacement was done by the following coccinelle script: @header@ @@ #include @eth_zero_addr@ expression e; @@ -memset(e,0,ETH_ALEN); +eth_zero_addr(e); @eth_broadcast_addr@ identifier e; @@ -memset(e,\(0xff\|0xFF\|255\),ETH_ALEN); +eth_broadcast_addr(e); @linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @ @@ + #include + @special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include + @custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index d992a754e72d..16aef7cf23b9 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -3751,7 +3751,7 @@ void notify_wx_assoc_event(struct rtllib_device *ieee) printk(KERN_INFO "%s(): Tell user space disconnected\n", __func__); - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu.ap_addr.sa_data); } wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); } -- cgit v1.2.3 From 76f73693ca36a13aff719c71236c47a4927c14a0 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 3 Mar 2015 16:04:20 +0200 Subject: staging: rtl8192e: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x) eth_zero_addr() is a wrapper function for memset if 0 is going to be assigned to a mac address. The replacement was done by the following coccinelle script: @header@ @@ #include @eth_zero_addr@ expression e; @@ -memset(e,0,ETH_ALEN); +eth_zero_addr(e); @eth_broadcast_addr@ identifier e; @@ -memset(e,\(0xff\|0xFF\|255\),ETH_ALEN); +eth_broadcast_addr(e); @linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @ @@ + #include + @special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include + @custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 835f3d78a16f..283ba8b20128 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -120,7 +120,7 @@ int rtllib_wx_get_wap(struct rtllib_device *ieee, ieee->state != RTLLIB_LINKED_SCANNING && ieee->wap_set == 0) - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu->ap_addr.sa_data); else memcpy(wrqu->ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); -- cgit v1.2.3 From 21f5690ec7f5a5fa278f2b818a7ed722becd6995 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 3 Mar 2015 16:06:19 +0200 Subject: staging: rtl8192u: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x) eth_zero_addr() is a wrapper function for memset if 0 is going to be assigned to a mac address. The replacement was done by the following coccinelle script: @header@ @@ #include @eth_zero_addr@ expression e; @@ -memset(e,0,ETH_ALEN); +eth_zero_addr(e); @eth_broadcast_addr@ identifier e; @@ -memset(e,\(0xff\|0xFF\|255\),ETH_ALEN); +eth_broadcast_addr(e); @linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @ @@ + #include + @special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include + @custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 3a5407158963..3527edc39064 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -3208,7 +3208,7 @@ void notify_wx_assoc_event(struct ieee80211_device *ieee) if (ieee->state == IEEE80211_LINKED) memcpy(wrqu.ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); else - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu.ap_addr.sa_data); wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); } EXPORT_SYMBOL(notify_wx_assoc_event); -- cgit v1.2.3 From 47f0585a20e28bdd3155823afcff209615c902ff Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 3 Mar 2015 16:08:38 +0200 Subject: staging: rtl8192u: ieee80211: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x) eth_zero_addr() is a wrapper function for memset if 0 is going to be assigned to a mac address. The replacement was done by the following coccinelle script: @header@ @@ #include @eth_zero_addr@ expression e; @@ -memset(e,0,ETH_ALEN); +eth_zero_addr(e); @eth_broadcast_addr@ identifier e; @@ -memset(e,\(0xff\|0xFF\|255\),ETH_ALEN); +eth_broadcast_addr(e); @linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @ @@ + #include + @special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include + @custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index 644368df6342..dcfa5abea127 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -121,7 +121,7 @@ int ieee80211_wx_get_wap(struct ieee80211_device *ieee, ieee->state != IEEE80211_LINKED_SCANNING && ieee->wap_set == 0) - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu->ap_addr.sa_data); else memcpy(wrqu->ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); -- cgit v1.2.3 From e922df7d3e946529981860d4bdd707a9cb59fc0d Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Tue, 3 Mar 2015 22:34:22 +0530 Subject: Staging: rtl8712: Eliminate use of _init_timer This patch introduces the use of API function setup_timer instead of driver specific function _init_timer as it is the preferred and standard way to setup and set the timer. To be compatible with the change, argument types of referenced functions are changed. Also, definition of function _init_timer is removed as it is no longer needed after this change. This is done using Coccinelle and semantic patch used for this is as follows: @@ expression x, y; identifier a, b;@@ - _init_timer (&x, y, a, b); + setup_timer (&x, a, (unsigned long)b); Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/mlme_linux.c | 48 +++++++++++++++--------------- drivers/staging/rtl8712/os_intfs.c | 4 +-- drivers/staging/rtl8712/osdep_service.h | 9 ------ drivers/staging/rtl8712/recv_linux.c | 11 ++++--- drivers/staging/rtl8712/rtl8712_led.c | 3 +- drivers/staging/rtl8712/rtl871x_pwrctrl.c | 8 ++--- drivers/staging/rtl8712/rtl871x_security.c | 4 +-- drivers/staging/rtl8712/rtl871x_security.h | 2 +- 8 files changed, 40 insertions(+), 49 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/mlme_linux.c b/drivers/staging/rtl8712/mlme_linux.c index 53999e8aa1c1..8c5a475f05e7 100644 --- a/drivers/staging/rtl8712/mlme_linux.c +++ b/drivers/staging/rtl8712/mlme_linux.c @@ -32,39 +32,39 @@ #include "drv_types.h" #include "mlme_osdep.h" -static void sitesurvey_ctrl_handler(void *FunctionContext) +static void sitesurvey_ctrl_handler(unsigned long data) { - struct _adapter *adapter = (struct _adapter *)FunctionContext; + struct _adapter *adapter = (struct _adapter *)data; _r8712_sitesurvey_ctrl_handler(adapter); mod_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer, jiffies + msecs_to_jiffies(3000)); } -static void join_timeout_handler (void *FunctionContext) +static void join_timeout_handler (unsigned long data) { - struct _adapter *adapter = (struct _adapter *)FunctionContext; + struct _adapter *adapter = (struct _adapter *)data; _r8712_join_timeout_handler(adapter); } -static void _scan_timeout_handler (void *FunctionContext) +static void _scan_timeout_handler (unsigned long data) { - struct _adapter *adapter = (struct _adapter *)FunctionContext; + struct _adapter *adapter = (struct _adapter *)data; r8712_scan_timeout_handler(adapter); } -static void dhcp_timeout_handler (void *FunctionContext) +static void dhcp_timeout_handler (unsigned long data) { - struct _adapter *adapter = (struct _adapter *)FunctionContext; + struct _adapter *adapter = (struct _adapter *)data; _r8712_dhcp_timeout_handler(adapter); } -static void wdg_timeout_handler (void *FunctionContext) +static void wdg_timeout_handler (unsigned long data) { - struct _adapter *adapter = (struct _adapter *)FunctionContext; + struct _adapter *adapter = (struct _adapter *)data; _r8712_wdg_timeout_handler(adapter); @@ -76,17 +76,17 @@ void r8712_init_mlme_timer(struct _adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - _init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, - join_timeout_handler, (pmlmepriv->nic_hdl)); - _init_timer(&(pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer), - padapter->pnetdev, sitesurvey_ctrl_handler, - (u8 *)(pmlmepriv->nic_hdl)); - _init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, - _scan_timeout_handler, (pmlmepriv->nic_hdl)); - _init_timer(&(pmlmepriv->dhcp_timer), padapter->pnetdev, - dhcp_timeout_handler, (u8 *)(pmlmepriv->nic_hdl)); - _init_timer(&(pmlmepriv->wdg_timer), padapter->pnetdev, - wdg_timeout_handler, (u8 *)(pmlmepriv->nic_hdl)); + setup_timer(&pmlmepriv->assoc_timer, join_timeout_handler, + (unsigned long)padapter); + setup_timer(&pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer, + sitesurvey_ctrl_handler, + (unsigned long)padapter); + setup_timer(&pmlmepriv->scan_to_timer, _scan_timeout_handler, + (unsigned long)padapter); + setup_timer(&pmlmepriv->dhcp_timer, dhcp_timeout_handler, + (unsigned long)padapter); + setup_timer(&pmlmepriv->wdg_timer, wdg_timeout_handler, + (unsigned long)padapter); } void r8712_os_indicate_connect(struct _adapter *adapter) @@ -118,9 +118,9 @@ void r8712_os_indicate_disconnect(struct _adapter *adapter) btkip_countermeasure; memset((unsigned char *)&adapter->securitypriv, 0, sizeof(struct security_priv)); - _init_timer(&(adapter->securitypriv.tkip_timer), - adapter->pnetdev, r8712_use_tkipkey_handler, - adapter); + setup_timer(&adapter->securitypriv.tkip_timer, + r8712_use_tkipkey_handler, + (unsigned long)adapter); /* Restore the PMK information to securitypriv structure * for the following connection. */ memcpy(&adapter->securitypriv.PMKIDList[0], diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index 64cdceead13b..ebfb29ed779a 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -323,8 +323,8 @@ u8 r8712_init_drv_sw(struct _adapter *padapter) _r8712_init_recv_priv(&padapter->recvpriv, padapter); memset((unsigned char *)&padapter->securitypriv, 0, sizeof(struct security_priv)); - _init_timer(&(padapter->securitypriv.tkip_timer), padapter->pnetdev, - r8712_use_tkipkey_handler, padapter); + setup_timer(&padapter->securitypriv.tkip_timer, + r8712_use_tkipkey_handler, (unsigned long)padapter); _r8712_init_sta_priv(&padapter->stapriv); padapter->stapriv.padapter = padapter; r8712_init_bcmc_stainfo(padapter); diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h index 54c4c470cd8e..c6dc3629f4d2 100644 --- a/drivers/staging/rtl8712/osdep_service.h +++ b/drivers/staging/rtl8712/osdep_service.h @@ -60,15 +60,6 @@ struct __queue { #define LIST_CONTAINOR(ptr, type, member) \ ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member))) -static inline void _init_timer(struct timer_list *ptimer, - struct net_device *padapter, - void *pfunc, void *cntx) -{ - ptimer->function = pfunc; - ptimer->data = (addr_t)cntx; - init_timer(ptimer); -} - static inline void _cancel_timer(struct timer_list *ptimer, u8 *bcancelled) { del_timer(ptimer); diff --git a/drivers/staging/rtl8712/recv_linux.c b/drivers/staging/rtl8712/recv_linux.c index 3640dd48febe..799a0f9a5b2d 100644 --- a/drivers/staging/rtl8712/recv_linux.c +++ b/drivers/staging/rtl8712/recv_linux.c @@ -137,18 +137,17 @@ _recv_indicatepkt_drop: precvpriv->rx_drop++; } -static void _r8712_reordering_ctrl_timeout_handler (void *FunctionContext) +static void _r8712_reordering_ctrl_timeout_handler (unsigned long data) { struct recv_reorder_ctrl *preorder_ctrl = - (struct recv_reorder_ctrl *)FunctionContext; + (struct recv_reorder_ctrl *)data; r8712_reordering_ctrl_timeout_handler(preorder_ctrl); } void r8712_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl) { - struct _adapter *padapter = preorder_ctrl->padapter; - - _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, - _r8712_reordering_ctrl_timeout_handler, preorder_ctrl); + setup_timer(&preorder_ctrl->reordering_ctrl_timer, + _r8712_reordering_ctrl_timeout_handler, + (unsigned long)preorder_ctrl); } diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c index 0c7dfeebc62e..6085689f0976 100644 --- a/drivers/staging/rtl8712/rtl8712_led.c +++ b/drivers/staging/rtl8712/rtl8712_led.c @@ -97,7 +97,8 @@ static void InitLed871x(struct _adapter *padapter, struct LED_871x *pLed, pLed->bLedBlinkInProgress = false; pLed->BlinkTimes = 0; pLed->BlinkingLedState = LED_UNKNOWN; - _init_timer(&(pLed->BlinkTimer), nic, BlinkTimerCallback, pLed); + setup_timer(&pLed->BlinkTimer, BlinkTimerCallback, + (unsigned long)pLed); INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback); } diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c b/drivers/staging/rtl8712/rtl871x_pwrctrl.c index ed2844d2b02a..ea732ee99bbe 100644 --- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c +++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c @@ -165,9 +165,9 @@ static void rpwm_workitem_callback(struct work_struct *work) } } -static void rpwm_check_handler (void *FunctionContext) +static void rpwm_check_handler (unsigned long data) { - struct _adapter *adapter = (struct _adapter *)FunctionContext; + struct _adapter *adapter = (struct _adapter *)data; _rpwm_check_handler(adapter); } @@ -186,8 +186,8 @@ void r8712_init_pwrctrl_priv(struct _adapter *padapter) r8712_write8(padapter, 0x1025FE58, 0); INIT_WORK(&pwrctrlpriv->SetPSModeWorkItem, SetPSModeWorkItemCallback); INIT_WORK(&pwrctrlpriv->rpwm_workitem, rpwm_workitem_callback); - _init_timer(&(pwrctrlpriv->rpwm_check_timer), - padapter->pnetdev, rpwm_check_handler, (u8 *)padapter); + setup_timer(&pwrctrlpriv->rpwm_check_timer, rpwm_check_handler, + (unsigned long)padapter); } /* diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index 743dd93688b5..4d5a2889b775 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -1392,9 +1392,9 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe) return _SUCCESS; } -void r8712_use_tkipkey_handler(void *FunctionContext) +void r8712_use_tkipkey_handler(unsigned long data) { - struct _adapter *padapter = (struct _adapter *)FunctionContext; + struct _adapter *padapter = (struct _adapter *)data; padapter->securitypriv.busetkipkey = true; } diff --git a/drivers/staging/rtl8712/rtl871x_security.h b/drivers/staging/rtl8712/rtl871x_security.h index c732aeab8d2c..2295f0e64dc2 100644 --- a/drivers/staging/rtl8712/rtl871x_security.h +++ b/drivers/staging/rtl8712/rtl871x_security.h @@ -216,7 +216,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe); u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe); u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe); void r8712_wep_decrypt(struct _adapter *padapter, u8 *precvframe); -void r8712_use_tkipkey_handler(void *FunctionContext); +void r8712_use_tkipkey_handler(unsigned long data); #endif /*__RTL871X_SECURITY_H_ */ -- cgit v1.2.3 From 25ff6f8da004f49c2cab55a51cf8c250d21e9738 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:28:48 +0200 Subject: staging: comedi: drivers: remove extra parentheses around right bit shift operation Removes extra parentheses around bitwise right shift operation. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index b96e60ffad73..7e565fc944c4 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -280,7 +280,7 @@ static int dt2801_writedata2(struct comedi_device *dev, unsigned int data) ret = dt2801_writedata(dev, data & 0xff); if (ret < 0) return ret; - ret = dt2801_writedata(dev, (data >> 8)); + ret = dt2801_writedata(dev, data >> 8); if (ret < 0) return ret; -- cgit v1.2.3 From 159dc4bff27a300d2c70108bf49ae01f6d1b34f2 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:29:28 +0200 Subject: staging: lustre: lclient: remove extra parentheses around right bit shift operation Removes extra parentheses around bitwise right shift operations. The cases handled here are when the resultant value is assigned to a variable. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index 23095bb75226..ab6cb419302f 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -828,7 +828,8 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, * --bug 17336 */ loff_t size = cl_isize_read(inode); loff_t cur_index = start >> PAGE_CACHE_SHIFT; - loff_t size_index = ((size - 1) >> PAGE_CACHE_SHIFT); + loff_t size_index = (size - 1) >> + PAGE_CACHE_SHIFT; if ((size == 0 && cur_index != 0) || size_index < cur_index) @@ -1263,7 +1264,7 @@ __u32 cl_fid_build_gen(const struct lu_fid *fid) return gen; } - gen = (fid_flatten(fid) >> 32); + gen = fid_flatten(fid) >> 32; return gen; } -- cgit v1.2.3 From a354e0d8d2ce4beb61097eeac6069b41c0797ed3 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:30:18 +0200 Subject: staging: lustre: llite: remove extra parentheses around right bit shift operation Removes extra parentheses around bitwise right shift operation. The case handled here is when the resultant value is assigned to a variable. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/vvp_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index 5a1078a4198d..97d94fc738f2 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -286,7 +286,7 @@ static void vvp_pgcache_id_unpack(loff_t pos, struct vvp_pgcache_id *id) id->vpi_index = pos & 0xffffffff; id->vpi_depth = (pos >> PGC_DEPTH_SHIFT) & 0xf; - id->vpi_bucket = ((unsigned long long)pos >> PGC_OBJ_SHIFT); + id->vpi_bucket = (unsigned long long)pos >> PGC_OBJ_SHIFT; } static loff_t vvp_pgcache_id_pack(struct vvp_pgcache_id *id) -- cgit v1.2.3 From 11d6e5c5623a1cdbee1560f4957c070b0ea76b22 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:30:49 +0200 Subject: staging: media: bcm2048: remove extra parentheses around right bit shift operation Removes extra parentheses around bitwise right shift operation. The case handled here is when the resultant value is assigned to a variable. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 538250667918..116251b4e317 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -2245,8 +2245,7 @@ static ssize_t bcm2048_fops_read(struct file *file, char __user *buf, tmpbuf[i] = bdev->rds_info.radio_text[bdev->rd_index+i+2]; tmpbuf[i+1] = bdev->rds_info.radio_text[bdev->rd_index+i+1]; - tmpbuf[i+2] = ((bdev->rds_info.radio_text[bdev->rd_index+i] - & 0xf0) >> 4); + tmpbuf[i+2] = (bdev->rds_info.radio_text[bdev->rd_index + i] & 0xf0) >> 4; if ((bdev->rds_info.radio_text[bdev->rd_index+i] & BCM2048_RDS_CRC_MASK) == BCM2048_RDS_CRC_UNRECOVARABLE) tmpbuf[i+2] |= 0x80; -- cgit v1.2.3 From 6182930bdb207789c3c92051c2c4a03f5da8f6ee Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:31:19 +0200 Subject: staging: media: lirc: remove extra parentheses around right bit shift operation Removes extra parentheses around bitwise right shift operation. The case handled here is when the resultant value is assigned to a variable. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 19628d0104ab..9f55a83d5ab2 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -344,7 +344,7 @@ static int init_timing_params(unsigned int new_duty_cycle, /* How many clocks in a microsecond?, avoiding long long divide */ work = loops_per_sec; work *= 4295; /* 4295 = 2^32 / 1e6 */ - conv_us_to_clocks = (work >> 32); + conv_us_to_clocks = work >> 32; /* * Carrier period in clocks, approach good up to 32GHz clock, -- cgit v1.2.3 From 07add2d38d48ca168b266c0f4f6af923bb9886e3 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:31:56 +0200 Subject: staging: rtl8188eu: remove extra parentheses around right bit shift operations Removes extra parentheses around bitwise right shift operations. The cases handled here are when resultant values are assigned to variables. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_efuse.c | 2 +- drivers/staging/rtl8188eu/hal/odm.c | 8 ++++---- drivers/staging/rtl8188eu/hal/odm_HWConfig.c | 2 +- drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index 8816d116a8b8..defec6b7883d 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c @@ -139,7 +139,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) while ((rtemp8 != 0xFF) && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { /* Check PG header for section num. */ if ((rtemp8 & 0x1F) == 0x0F) { /* extended header */ - u1temp = ((rtemp8 & 0xE0) >> 5); + u1temp = (rtemp8 & 0xE0) >> 5; rtemp8 = *(phymap+eFuse_Addr); if ((rtemp8 & 0x0F) == 0x0F) { eFuse_Addr++; diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c index 06477e834653..28b5e7bd4fc0 100644 --- a/drivers/staging/rtl8188eu/hal/odm.c +++ b/drivers/staging/rtl8188eu/hal/odm.c @@ -741,13 +741,13 @@ void odm_FalseAlarmCounterStatistics(struct odm_dm_struct *pDM_Odm) ret_value = phy_query_bb_reg(adapter, ODM_REG_OFDM_FA_TYPE1_11N, bMaskDWord); FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); - FalseAlmCnt->Cnt_SB_Search_fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_SB_Search_fail = (ret_value & 0xffff0000)>>16; ret_value = phy_query_bb_reg(adapter, ODM_REG_OFDM_FA_TYPE2_11N, bMaskDWord); FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); - FalseAlmCnt->Cnt_Parity_Fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_Parity_Fail = (ret_value & 0xffff0000)>>16; ret_value = phy_query_bb_reg(adapter, ODM_REG_OFDM_FA_TYPE3_11N, bMaskDWord); FalseAlmCnt->Cnt_Rate_Illegal = (ret_value&0xffff); - FalseAlmCnt->Cnt_Crc8_fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_Crc8_fail = (ret_value & 0xffff0000)>>16; ret_value = phy_query_bb_reg(adapter, ODM_REG_OFDM_FA_TYPE4_11N, bMaskDWord); FalseAlmCnt->Cnt_Mcs_fail = (ret_value&0xffff); @@ -757,7 +757,7 @@ void odm_FalseAlarmCounterStatistics(struct odm_dm_struct *pDM_Odm) ret_value = phy_query_bb_reg(adapter, ODM_REG_SC_CNT_11N, bMaskDWord); FalseAlmCnt->Cnt_BW_LSC = (ret_value&0xffff); - FalseAlmCnt->Cnt_BW_USC = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_BW_USC = (ret_value & 0xffff0000)>>16; /* hold cck counter */ phy_set_bb_reg(adapter, ODM_REG_CCK_FA_RST_11N, BIT12, 1); diff --git a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c index 29f87dffbad3..f8fae18341fa 100644 --- a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c @@ -123,7 +123,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm, /* 2011.11.28 LukeLee: 88E use different LNA & VGA gain table */ /* The RSSI formula should be modified according to the gain table */ /* In 88E, cck_highpwr is always set to 1 */ - LNA_idx = ((cck_agc_rpt & 0xE0) >> 5); + LNA_idx = (cck_agc_rpt & 0xE0) >> 5; VGA_idx = (cck_agc_rpt & 0x1F); switch (LNA_idx) { case 7: diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index 3222d8d08b5b..7904d2260f2c 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -596,7 +596,8 @@ void Hal_EfuseParseBoardType88E(struct adapter *pAdapter, u8 *hwinfo, bool AutoL struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter); if (!AutoLoadFail) - pHalData->BoardType = ((hwinfo[EEPROM_RF_BOARD_OPTION_88E]&0xE0)>>5); + pHalData->BoardType = (hwinfo[EEPROM_RF_BOARD_OPTION_88E] + & 0xE0) >> 5; else pHalData->BoardType = 0; DBG_88E("Board Type: 0x%2x\n", pHalData->BoardType); -- cgit v1.2.3 From 0c401c1dc9739580d758dfa88ec568897c2e2dfd Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:32:30 +0200 Subject: staging: rtl8192e: remove extra parentheses around right bit shift operation Removes extra parentheses around bitwise right shift operation. The cases handled are when the resultant value is assigned to a variable or when a shift operation is carried out for a function argument. The issues were detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Some coding style issues were handled manually to avoid checkpatch warnings and errors. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index a85fb7118b7b..08735cb116c0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -334,17 +334,17 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) } if (!priv->AutoloadFailFlag) { - priv->eeprom_vid = eprom_read(dev, (EEPROM_VID >> 1)); - priv->eeprom_did = eprom_read(dev, (EEPROM_DID >> 1)); + priv->eeprom_vid = eprom_read(dev, EEPROM_VID >> 1); + priv->eeprom_did = eprom_read(dev, EEPROM_DID >> 1); usValue = eprom_read(dev, (u16)(EEPROM_Customer_ID>>1)) >> 8; priv->eeprom_CustomerID = (u8)(usValue & 0xff); - usValue = eprom_read(dev, (EEPROM_ICVersion_ChannelPlan>>1)); + usValue = eprom_read(dev, EEPROM_ICVersion_ChannelPlan>>1); priv->eeprom_ChannelPlan = usValue&0xff; - IC_Version = ((usValue&0xff00)>>8); + IC_Version = (usValue & 0xff00)>>8; ICVer8192 = (IC_Version&0xf); - ICVer8256 = ((IC_Version&0xf0)>>4); + ICVer8256 = (IC_Version & 0xf0)>>4; RT_TRACE(COMP_INIT, "\nICVer8192 = 0x%x\n", ICVer8192); RT_TRACE(COMP_INIT, "\nICVer8256 = 0x%x\n", ICVer8256); if (ICVer8192 == 0x2) { @@ -424,7 +424,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (priv->epromtype == EEPROM_93C46) { if (!priv->AutoloadFailFlag) { usValue = eprom_read(dev, - (EEPROM_TxPwDiff_CrystalCap >> 1)); + EEPROM_TxPwDiff_CrystalCap >> 1); priv->EEPROMAntPwDiff = (usValue&0x0fff); priv->EEPROMCrystalCap = (u8)((usValue & 0xf000) >> 12); @@ -483,15 +483,15 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) priv->EEPROMLegacyHTTxPowerDiff; priv->AntennaTxPwDiff[0] = (priv->EEPROMAntPwDiff & 0xf); - priv->AntennaTxPwDiff[1] = ((priv->EEPROMAntPwDiff & - 0xf0)>>4); - priv->AntennaTxPwDiff[2] = ((priv->EEPROMAntPwDiff & - 0xf00)>>8); + priv->AntennaTxPwDiff[1] = (priv->EEPROMAntPwDiff & + 0xf0) >> 4; + priv->AntennaTxPwDiff[2] = (priv->EEPROMAntPwDiff & + 0xf00) >> 8; priv->CrystalCap = priv->EEPROMCrystalCap; priv->ThermalMeter[0] = (priv->EEPROMThermalMeter & 0xf); - priv->ThermalMeter[1] = ((priv->EEPROMThermalMeter & - 0xf0)>>4); + priv->ThermalMeter[1] = (priv->EEPROMThermalMeter & + 0xf0) >> 4; } else if (priv->epromtype == EEPROM_93C56) { for (i = 0; i < 3; i++) { @@ -548,8 +548,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) priv->CrystalCap = priv->EEPROMCrystalCap; priv->ThermalMeter[0] = (priv->EEPROMThermalMeter & 0xf); - priv->ThermalMeter[1] = ((priv->EEPROMThermalMeter & - 0xf0)>>4); + priv->ThermalMeter[1] = (priv->EEPROMThermalMeter & + 0xf0) >> 4; } } -- cgit v1.2.3 From 9eb9e69536ba00d2dbe4f481b20ced67053a6c08 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:33:06 +0200 Subject: staging: rtl8192u: remove extra parentheses around right bit shift operation Removes extra parentheses around bitwise right shift operation. The cases handled are when the resultant value is assigned to a variable or when a shift operation is carried out for a function argument. The issues were detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Some coding style issues were handled manually to avoid checkpatch warnings and errors. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 9de4412da3b3..bab7751a7636 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2310,11 +2310,11 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) } if (bLoad_From_EEPOM) { - tmpValue = eprom_read(dev, (EEPROM_VID>>1)); + tmpValue = eprom_read(dev, EEPROM_VID>>1); priv->eeprom_vid = endian_swap(&tmpValue); - priv->eeprom_pid = eprom_read(dev, (EEPROM_PID>>1)); - tmpValue = eprom_read(dev, (EEPROM_ChannelPlan>>1)); - priv->eeprom_ChannelPlan = ((tmpValue&0xff00)>>8); + priv->eeprom_pid = eprom_read(dev, EEPROM_PID>>1); + tmpValue = eprom_read(dev, EEPROM_ChannelPlan>>1); + priv->eeprom_ChannelPlan = (tmpValue & 0xff00)>>8; priv->btxpowerdata_readfromEEPORM = true; priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID>>1)) >>8; } else { @@ -2397,7 +2397,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) } } else if (priv->EEPROM_Def_Ver == 1) { if (bLoad_From_EEPOM) { - tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_CCK_V1>>1)); + tmpValue = eprom_read(dev, + EEPROM_TxPwIndex_CCK_V1 >> 1); tmpValue = (tmpValue & 0xff00) >> 8; } else { tmpValue = 0x10; @@ -2410,7 +2411,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) tmpValue = 0x1010; *((u16 *)(&priv->EEPROMTxPowerLevelCCK_V1[1])) = tmpValue; if (bLoad_From_EEPOM) - tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_OFDM_24G_V1>>1)); + tmpValue = eprom_read(dev, + EEPROM_TxPwIndex_OFDM_24G_V1 >> 1); else tmpValue = 0x1010; *((u16 *)(&priv->EEPROMTxPowerLevelOFDM24G[0])) = tmpValue; @@ -2453,7 +2455,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) // Antenna B gain offset to antenna A, bit0~3 priv->AntennaTxPwDiff[0] = (priv->EEPROMTxPowerDiff & 0xf); // Antenna C gain offset to antenna A, bit4~7 - priv->AntennaTxPwDiff[1] = ((priv->EEPROMTxPowerDiff & 0xf0)>>4); + priv->AntennaTxPwDiff[1] = (priv->EEPROMTxPowerDiff & 0xf0)>>4; // CrystalCap, bit12~15 priv->CrystalCap = priv->EEPROMCrystalCap; // ThermalMeter, bit0~3 for RFIC1, bit4~7 for RFIC2 -- cgit v1.2.3 From 25978642332b10efcaf67b1a26dbfa04949c2e7b Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:33:39 +0200 Subject: staging: rtl8712: remove extra parentheses around right bit shift operation Removes extra parentheses around bitwise right shift operation. The cases handled are when the resultant value is assigned to a variable or when a shift operation is carried out for a function argument. The issues were detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl8712_recv.c | 4 ++-- drivers/staging/rtl8712/rtl871x_mp.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index 0ec0bda45d50..50227b598e0c 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -166,7 +166,7 @@ static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib, * Offset 0 */ pattrib->bdecrypted = ((le32_to_cpu(prxstat->rxdw0) & BIT(27)) >> 27) ? 0 : 1; - pattrib->crc_err = ((le32_to_cpu(prxstat->rxdw0) & BIT(14)) >> 14); + pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) & BIT(14)) >> 14; /*Offset 4*/ /*Offset 8*/ /*Offset 12*/ @@ -435,7 +435,7 @@ void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf) poffset = (u8 *)prxcmdbuf; voffset = *(uint *)poffset; prxstat = (struct recv_stat *)prxcmdbuf; - drvinfo_sz = ((le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16); + drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16; drvinfo_sz <<= 3; poffset += RXDESC_SIZE + drvinfo_sz; do { diff --git a/drivers/staging/rtl8712/rtl871x_mp.c b/drivers/staging/rtl8712/rtl871x_mp.c index 3d913b9701bb..26201ea3cca6 100644 --- a/drivers/staging/rtl8712/rtl871x_mp.c +++ b/drivers/staging/rtl8712/rtl871x_mp.c @@ -327,8 +327,8 @@ void r8712_SetTxAGCOffset(struct _adapter *pAdapter, u32 ulTxAGCOffset) u32 TxAGCOffset_B, TxAGCOffset_C, TxAGCOffset_D, tmpAGC; TxAGCOffset_B = (ulTxAGCOffset&0x000000ff); - TxAGCOffset_C = ((ulTxAGCOffset&0x0000ff00)>>8); - TxAGCOffset_D = ((ulTxAGCOffset&0x00ff0000)>>16); + TxAGCOffset_C = (ulTxAGCOffset & 0x0000ff00)>>8; + TxAGCOffset_D = (ulTxAGCOffset & 0x00ff0000)>>16; tmpAGC = (TxAGCOffset_D<<8 | TxAGCOffset_C<<4 | TxAGCOffset_B); set_bb_reg(pAdapter, rFPGA0_TxGainStage, (bXBTxAGC|bXCTxAGC|bXDTxAGC), tmpAGC); -- cgit v1.2.3 From e1bc88f1d94f1b34ef0ae27d3c6801a6fdac1f60 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:34:07 +0200 Subject: staging: rtl8723au: remove extra parentheses around right bit shift operations Removes extra parentheses around bitwise right shift operations. The cases handled here are when resultant values are assigned to variables. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 6 +++--- drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 8d4266100ff0..2d3653e784d2 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -736,15 +736,15 @@ void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE1_11N, bMaskDWord); FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); - FalseAlmCnt->Cnt_SB_Search_fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_SB_Search_fail = (ret_value & 0xffff0000)>>16; ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE2_11N, bMaskDWord); FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); - FalseAlmCnt->Cnt_Parity_Fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_Parity_Fail = (ret_value & 0xffff0000)>>16; ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE3_11N, bMaskDWord); FalseAlmCnt->Cnt_Rate_Illegal = (ret_value&0xffff); - FalseAlmCnt->Cnt_Crc8_fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_Crc8_fail = (ret_value & 0xffff0000)>>16; ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE4_11N, bMaskDWord); FalseAlmCnt->Cnt_Mcs_fail = (ret_value&0xffff); diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index 7b3fdc841aac..ebe33392c8d9 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -751,7 +751,7 @@ void rtl8723a_read_chip_version(struct rtw_adapter *padapter) value32 = rtl8723au_read32(padapter, REG_GPIO_OUTSTS); /* ROM code version. */ - ChipVersion.ROMVer = ((value32 & RF_RL_ID) >> 20); + ChipVersion.ROMVer = (value32 & RF_RL_ID) >> 20; /* For multi-function consideration. Added by Roger, 2010.10.06. */ pHalData->MultiFunc = RT_MULTI_FUNC_NONE; @@ -1728,8 +1728,8 @@ Hal_EfuseParseBTCoexistInfo_8723A(struct rtw_adapter *padapter, /* eeprom spec */ tempval = hwinfo[RF_OPTION4_8723A]; pHalData->EEPROMBluetoothAntNum = (tempval & 0x1); - pHalData->EEPROMBluetoothAntIsolation = ((tempval & 0x10) >> 4); - pHalData->EEPROMBluetoothRadioShared = ((tempval & 0x20) >> 5); + pHalData->EEPROMBluetoothAntIsolation = (tempval & 0x10) >> 4; + pHalData->EEPROMBluetoothRadioShared = (tempval & 0x20) >> 5; } else { pHalData->EEPROMBluetoothCoexist = 0; pHalData->EEPROMBluetoothType = BT_RTL8723A; -- cgit v1.2.3 From a659b3e807a9e0a3f4b48ffbd491dbcab8e7d1d6 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:34:52 +0200 Subject: staging: slicoss: remove extra parentheses around right bit shift operations Removes extra parentheses around bitwise right shift operations. The cases handled here are when resultant values are assigned to variables. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Some coding style issues were handled manually to avoid checkpatch warnings and errors. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/slicoss/slicoss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 45f6a5fce963..c84dd6062a03 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -164,7 +164,7 @@ static void slic_mcast_set_bit(struct adapter *adapter, char *address) /* Get the CRC polynomial for the mac address */ /* we use bits 1-8 (lsb), bitwise reversed, * msb (= lsb bit 0 before bitrev) is automatically discarded */ - crcpoly = (ether_crc(ETH_ALEN, address)>>23); + crcpoly = ether_crc(ETH_ALEN, address)>>23; /* We only have space on the SLIC for 64 entries. Lop * off the top two bits. (2^6 = 64) @@ -1862,8 +1862,8 @@ static void slic_xmit_build_request(struct adapter *adapter, hcmd->cmdsize = (u32) ((((u64)&ihcmd->u.slic_buffers.bufs[1] - (u64) hcmd) + 31) >> 5); #else - hcmd->cmdsize = ((((u32) &ihcmd->u.slic_buffers.bufs[1] - - (u32) hcmd) + 31) >> 5); + hcmd->cmdsize = (((u32)&ihcmd->u.slic_buffers.bufs[1] - + (u32)hcmd) + 31) >> 5; #endif } -- cgit v1.2.3 From 6de3f58bc32cc10516b286b26476d5aa65c6d1e5 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:35:28 +0200 Subject: staging: speakup: remove extra parentheses around right bit shift operation Removes extra parentheses around bitwise right shift operation. The case handled is when the resultant value is assigned to a variable. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index e9f0c150d246..1249f910aed1 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -1527,7 +1527,7 @@ static void update_color_buffer(struct vc_data *vc, const char *ic, int len) int i, bi, hi; int vc_num = vc->vc_num; - bi = ((vc->vc_attr & 0x70) >> 4); + bi = (vc->vc_attr & 0x70) >> 4; hi = speakup_console[vc_num]->ht.highsize[bi]; i = 0; -- cgit v1.2.3 From 9ea755f3e8b05445ee6029c6b497a30f1e6a7bf6 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 07:35:48 +0200 Subject: staging: xgifb: remove extra parentheses around right bit shift operations Removes extra parentheses around bitwise right shift operations. The cases handled here are when resultant values are assigned to variables. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 >> -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e >> -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e >> -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/xgifb/XGI_main_26.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 935c714f592a..74e88200726c 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -106,7 +106,7 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, sr_data = XGI_CRT1Table[index].CR[5]; - HDE = (XGI330_RefIndex[RefreshRateTableIndex].XRes >> 3); + HDE = XGI330_RefIndex[RefreshRateTableIndex].XRes >> 3; cr_data = XGI_CRT1Table[index].CR[3]; @@ -1011,8 +1011,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, XGIbios_mode[xgifb_info->mode_idx].mode_no); return -EINVAL; } - info->fix.line_length = ((info->var.xres_virtual - * info->var.bits_per_pixel) >> 6); + info->fix.line_length = (info->var.xres_virtual + * info->var.bits_per_pixel) >> 6; xgifb_reg_set(XGISR, IND_SIS_PASSWORD, SIS_PASSWORD); -- cgit v1.2.3 From e21bf3388b960bce8dd2d7bc17331f3b8020fd9f Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 08:18:19 +0200 Subject: staging: lustre: remove extra parentheses around left bit shift operations Removes extra parentheses around bitwise left shift operations. The cases handled here are when resultant values are assigned to variables. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 << -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e << -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e << -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c index 66d78c9be650..86b88db1cf20 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c @@ -72,7 +72,7 @@ static int typed_conns = 1; module_param(typed_conns, int, 0444); MODULE_PARM_DESC(typed_conns, "use different sockets for bulk"); -static int min_bulk = (1<<10); +static int min_bulk = 1<<10; module_param(min_bulk, int, 0644); MODULE_PARM_DESC(min_bulk, "smallest 'large' message"); @@ -122,7 +122,7 @@ static int nonblk_zcack = 1; module_param(nonblk_zcack, int, 0644); MODULE_PARM_DESC(nonblk_zcack, "always send ZC-ACK on non-blocking connection"); -static unsigned int zc_min_payload = (16 << 10); +static unsigned int zc_min_payload = 16 << 10; module_param(zc_min_payload, int, 0644); MODULE_PARM_DESC(zc_min_payload, "minimum payload size to zero copy"); @@ -182,7 +182,7 @@ int ksocknal_tunables_init(void) #endif if (*ksocknal_tunables.ksnd_zc_min_payload < (2 << 10)) - *ksocknal_tunables.ksnd_zc_min_payload = (2 << 10); + *ksocknal_tunables.ksnd_zc_min_payload = 2 << 10; return 0; }; -- cgit v1.2.3 From dbc9eb5af20578a931efb6fac721e9a977c5171b Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 08:18:47 +0200 Subject: staging: ozwpan: remove extra parentheses around left bit shift operations Removes extra parentheses around bitwise left shift operations. The case handled is when resultant value is assigned to a variable. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 << -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e << -c); +c; Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ozwpan/ozproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c index 3d3a3a890f73..1ba24a2aef83 100644 --- a/drivers/staging/ozwpan/ozproto.c +++ b/drivers/staging/ozwpan/ozproto.c @@ -98,7 +98,7 @@ static void oz_send_conn_rsp(struct oz_pd *pd, u8 status) kfree_skb(skb); return; } - oz_hdr->control = (OZ_PROTOCOL_VERSION<control = OZ_PROTOCOL_VERSION<last_pkt_num = 0; put_unaligned(0, &oz_hdr->pkt_num); elt->type = OZ_ELT_CONNECT_RSP; -- cgit v1.2.3 From 5a80ee6f8871a81afb4fd919133ae5be3b656d44 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 08:19:24 +0200 Subject: staging: rts5208: remove extra parentheses around left bit shift operation Removes extra parentheses around bitwise left shift operations. The case handled is when resultant value is assigned to a variable. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 << -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e << -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e << -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/rtsx_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index dab1995d1a6a..03caa9b3771f 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -642,7 +642,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf, dma_addr_t addr; u8 dir; int err = 0; - u32 val = (1 << 31); + u32 val = 1 << 31; long timeleft; if ((buf == NULL) || (len <= 0)) -- cgit v1.2.3 From 6e28c2a24aedbd64bf9cc1391ca203e9aa95d757 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 08:19:50 +0200 Subject: staging: slicoss: remove extra parentheses around left bit shift operations Removes extra parentheses around bitwise left shift operations. The case handled is when resultant value is assigned to a variable. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 << -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e << -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e << -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/slicoss/slicoss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index c84dd6062a03..a3afb3e4d157 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1850,7 +1850,7 @@ static void slic_xmit_build_request(struct adapter *adapter, ihcmd = &hcmd->cmd64; - ihcmd->flags = (adapter->port << IHFLG_IFSHFT); + ihcmd->flags = adapter->port << IHFLG_IFSHFT; ihcmd->command = IHCMD_XMT_REQ; ihcmd->u.slic_buffers.totlen = skb->len; phys_addr = pci_map_single(adapter->pcidev, skb->data, skb->len, -- cgit v1.2.3 From a06487242467aa9511470f1f92184ae1a9149d37 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 08:20:14 +0200 Subject: staging: unisys: virthba: remove extra parentheses around left bit shift operations Removes extra parentheses around bitwise left shift operations. The case handled is when resultant value is assigned to a variable. The issue was detected and resolved using the following coccinelle script: @@ expression e, e1; constant c; @@ e = -(e1 +e1 << -c); +c; @@ identifier i; constant c; type t; expression e; @@ t i = -(e +e << -c); +c; @@ expression e, e1; identifier f; constant c; @@ e1 = f(..., -(e +e << -c) +c ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/virthba/virthba.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index ca89e76fbf7e..2ad0c1939623 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -1534,7 +1534,7 @@ virthba_serverdown_complete(struct work_struct *work) switch (pendingdel->cmdtype) { case CMD_SCSI_TYPE: scsicmd = (struct scsi_cmnd *)pendingdel->sent; - scsicmd->result = (DID_RESET << 16); + scsicmd->result = DID_RESET << 16; if (scsicmd->scsi_done) scsicmd->scsi_done(scsicmd); break; -- cgit v1.2.3 From 8e5d9433412d34f02a83edd265605bfe6c347a0a Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 08:56:45 +0200 Subject: staging: rtl8188eu: replace memset(x,0,ETH_ALEN) eth_zero_addr() is a wrapper function for memset if 0 is going to be assigned to a mac address. The aforementioned function replaces memset. In addition, linux/etherdevice.h was included as a header since it is the file that define the inline function eth_zero_addr(). The changes were carried out using the following coccinelle script: @header@ @@ #include @eth_zero_addr@ expression e; @@ -memset(e,0,ETH_ALEN); +eth_zero_addr(e); @eth_broadcast_addr@ identifier e; @@ -memset(e,\(0xff\|0xFF\|255\),ETH_ALEN); +eth_broadcast_addr(e); @linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @ @@ + #include + @special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include + @custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index 58998f2f2b09..96c1c2d4a112 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -32,6 +32,8 @@ #include #include +#include + #include "osdep_intf.h" #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30) @@ -92,7 +94,7 @@ void rtw_indicate_wx_disassoc_event(struct adapter *padapter) memset(&wrqu, 0, sizeof(union iwreq_data)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu.ap_addr.sa_data); DBG_88E_LEVEL(_drv_always_, "indicate disassoc\n"); wireless_send_event(padapter->pnetdev, SIOCGIWAP, &wrqu, NULL); @@ -827,7 +829,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev, for (j = 0; j < NUM_PMKID_CACHE; j++) { if (!memcmp(psecuritypriv->PMKIDList[j].Bssid, strIssueBssid, ETH_ALEN)) { /* BSSID is matched, the same AP => Remove this PMKID information and reset it. */ - memset(psecuritypriv->PMKIDList[j].Bssid, 0x00, ETH_ALEN); + eth_zero_addr(psecuritypriv->PMKIDList[j].Bssid); psecuritypriv->PMKIDList[j].bUsed = false; break; } @@ -1028,7 +1030,7 @@ static int rtw_wx_get_wap(struct net_device *dev, wrqu->ap_addr.sa_family = ARPHRD_ETHER; - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu->ap_addr.sa_data); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_wx_get_wap\n")); @@ -1037,7 +1039,7 @@ static int rtw_wx_get_wap(struct net_device *dev, ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) == true)) memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN); else - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu->ap_addr.sa_data); return 0; } -- cgit v1.2.3 From 22905b8594d58a6fceeb4510a57e34571a075b45 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Wed, 4 Mar 2015 09:00:02 +0200 Subject: staging: rtl8712: replace memset(x,0,ETH_ALEN) eth_zero_addr() is a wrapper function for memset if 0 is going to be assigned to a mac address. The aforementioned function replaces memset. In addition, linux/etherdevice.h was included as a header since it is the file that defines the inline function eth_zero_addr(). The changes were carried out using the following coccinelle script: @header@ @@ #include @eth_zero_addr@ expression e; @@ -memset(e,0,ETH_ALEN); +eth_zero_addr(e); @eth_broadcast_addr@ identifier e; @@ -memset(e,\(0xff\|0xFF\|255\),ETH_ALEN); +eth_broadcast_addr(e); @linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @ @@ + #include + @special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include + @custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @ @@ + + #include Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 5d4470a9aeb5..eacba8c37cc1 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -46,6 +46,8 @@ #include #include #include +#include + #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 0x1E) @@ -112,7 +114,7 @@ void r8712_indicate_wx_disassoc_event(struct _adapter *padapter) union iwreq_data wrqu; wrqu.ap_addr.sa_family = ARPHRD_ETHER; - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu.ap_addr.sa_data); wireless_send_event(padapter->pnetdev, SIOCGIWAP, &wrqu, NULL); } @@ -852,8 +854,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev, strIssueBssid, ETH_ALEN)) { /* BSSID is matched, the same AP => Remove * this PMKID information and reset it. */ - memset(psecuritypriv->PMKIDList[j].Bssid, - 0x00, ETH_ALEN); + eth_zero_addr(psecuritypriv->PMKIDList[j].Bssid); psecuritypriv->PMKIDList[j].bUsed = false; break; } @@ -1118,7 +1119,7 @@ static int r8711_wx_get_wap(struct net_device *dev, WIFI_AP_STATE)) memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN); else - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu->ap_addr.sa_data); return 0; } -- cgit v1.2.3 From aea42ee42196ee164b46eda047953c0974536d5b Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Wed, 4 Mar 2015 14:10:44 +0530 Subject: Staging: rtl8188eu: Remove redundant local variable This patch removes a redundant variable "raid" and adds inline return statements. This issue is identified by the following coccinelle script: @@ expression ret; identifier f; @@ -ret = +return f(...); -return ret; Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index a3ffc691be9a..6917abf21ec0 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -88,35 +88,25 @@ int cckratesonly_included(unsigned char *rate, int ratelen) unsigned char networktype_to_raid(unsigned char network_type) { - unsigned char raid; - switch (network_type) { case WIRELESS_11B: - raid = RATR_INX_WIRELESS_B; - break; + return RATR_INX_WIRELESS_B; case WIRELESS_11A: case WIRELESS_11G: - raid = RATR_INX_WIRELESS_G; - break; + return RATR_INX_WIRELESS_G; case WIRELESS_11BG: - raid = RATR_INX_WIRELESS_GB; - break; + return RATR_INX_WIRELESS_GB; case WIRELESS_11_24N: case WIRELESS_11_5N: - raid = RATR_INX_WIRELESS_N; - break; + return RATR_INX_WIRELESS_N; case WIRELESS_11A_5N: case WIRELESS_11G_24N: - raid = RATR_INX_WIRELESS_NG; - break; + return RATR_INX_WIRELESS_NG; case WIRELESS_11BG_24N: - raid = RATR_INX_WIRELESS_NGB; - break; + return RATR_INX_WIRELESS_NGB; default: - raid = RATR_INX_WIRELESS_GB; - break; + return RATR_INX_WIRELESS_GB; } - return raid; } u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen) -- cgit v1.2.3 From 3bd52fb13a56a9dbe7780480d0c66a5b8e450743 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Wed, 4 Mar 2015 14:10:46 +0530 Subject: Staging: rtl8188eu: Remove unnecessary return statements This patch removes unnecessary return statement from a void function. This issue is identified by checkpatch.pl Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 6917abf21ec0..4f2f736598f2 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -649,8 +649,6 @@ void WMMOnAssocRsp(struct adapter *padapter) pxmitpriv->wmm_para_seq[i] = inx[i]; DBG_88E("wmm_para_seq(%d): %d\n", i, pxmitpriv->wmm_para_seq[i]); } - - return; } static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) -- cgit v1.2.3 From a568dc1f3779c9fde5a58bf793574ecd7024090a Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Wed, 4 Mar 2015 14:15:05 +0530 Subject: staging: rtl8192e: Remove if conditions. This patch removes if conditions with no exececutable statements in the bodies of those ifs and also no variable assignments in the if conditional checks. The call to rtllib_act_scanning in the condition doesn't have any side effects as it too performs conditional checks without changing any values. Hence, it's safe to remove the if condition. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index df0323f00f69..c233a1c1bb31 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -572,10 +572,6 @@ static int r8192_wx_set_essid(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); int ret; - if ((rtllib_act_scanning(priv->rtllib, false)) && - !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) { - ; /* TODO - get rid of if */ - } if (priv->bHwRadioOff == true) { printk(KERN_INFO "=========>%s():hw radio off,or Rf state is " "eRfOff, return\n", __func__); @@ -708,11 +704,6 @@ static int r8192_wx_set_wap(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if ((rtllib_act_scanning(priv->rtllib, false)) && - !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) { - ; /* TODO - get rid of if */ - } - if (priv->bHwRadioOff == true) return 0; @@ -763,9 +754,6 @@ static int r8192_wx_set_enc(struct net_device *dev, {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} }; int i; - if ((rtllib_act_scanning(priv->rtllib, false)) && - !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) - ; /* TODO - get rid of if */ if (priv->bHwRadioOff == true) return 0; -- cgit v1.2.3 From 19cd22972fbe419235b380a94f31c826809cafec Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Wed, 4 Mar 2015 12:37:28 +0200 Subject: Staging: drivers: Bool initializations should use true/false This patch replaces bool initializations of 1/0 with true/false in order to increase readability and respect the standards. Warning found by coccinelle. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 4 ++-- drivers/staging/lustre/lustre/llite/llite_mmap.c | 2 +- drivers/staging/rtl8192u/ieee80211/dot11d.c | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++-- drivers/staging/rtl8192u/r8192U_core.c | 2 +- drivers/staging/rtl8192u/r8192U_dm.c | 4 ++-- drivers/staging/vt6655/rxtx.c | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index da34257f0e2b..0f776d0bf0e4 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -544,7 +544,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, if (ft1000dev->fProvComplete == 0) return -EACCES; - ft1000dev->fAppMsgPend = 1; + ft1000dev->fAppMsgPend = true; if (info->CardReady) { @@ -719,7 +719,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, result = -ENOTTY; break; } - ft1000dev->fAppMsgPend = 0; + ft1000dev->fAppMsgPend = false; return result; } diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index ab07959d3912..a90214bb84dd 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -312,7 +312,7 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) vio->u.fault.ft_vmpage = NULL; vio->u.fault.fault.ft_vmf = vmf; vio->u.fault.fault.ft_flags = 0; - vio->u.fault.fault.ft_flags_valid = 0; + vio->u.fault.fault.ft_flags_valid = false; result = cl_io_loop(env, io); diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c index 90ace791f2d7..82d60380bb40 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.c +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c @@ -6,7 +6,7 @@ void Dot11d_Init(struct ieee80211_device *ieee) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); - pDot11dInfo->bEnabled = 0; + pDot11dInfo->bEnabled = false; pDot11dInfo->State = DOT11D_STATE_NONE; pDot11dInfo->CountryIeLen = 0; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 286b71d35212..d2c2fb82f2fc 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -943,7 +943,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, if(net_ratelimit()) printk("find HTCControl\n"); hdrlen += 4; - rx_stats->bContainHTC = 1; + rx_stats->bContainHTC = true; } //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 3527edc39064..878086af9445 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -1371,7 +1371,7 @@ static void ieee80211_associate_complete_wq(struct work_struct *work) else if(ieee->is_silent_reset == 1) { printk("==================>silent reset associate\n"); - ieee->is_silent_reset = 0; + ieee->is_silent_reset = false; } if (ieee->data_hard_resume) @@ -2719,7 +2719,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) ieee->sta_edca_param[2] = 0x005E4342; ieee->sta_edca_param[3] = 0x002F3262; ieee->aggregation = true; - ieee->enable_rx_imm_BA = 1; + ieee->enable_rx_imm_BA = true; ieee->tx_pending.txb = NULL; setup_timer(&ieee->associate_timer, ieee80211_associate_abort_cb, diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index bab7751a7636..0d64d2dfd38c 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2143,7 +2143,7 @@ static void rtl8192_init_priv_variable(struct net_device *dev) //for silent reset priv->IrpPendingCount = 1; priv->ResetProgress = RESET_TYPE_NORESET; - priv->bForcedSilentReset = 0; + priv->bForcedSilentReset = false; priv->bDisableNormalResetCheck = false; priv->force_reset = false; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 5a01b7d405b1..16cafcdb26c6 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2419,9 +2419,9 @@ void dm_rf_pathcheck_workitemcallback(struct work_struct *work) /* Check Bit 0-3, it means if RF A-D is enabled. */ for (i = 0; i < RF90_PATH_MAX; i++) { if (rfpath & (0x01<brfpath_rxenable[i] = 1; + priv->brfpath_rxenable[i] = true; else - priv->brfpath_rxenable[i] = 0; + priv->brfpath_rxenable[i] = false; } if (!DM_RxPathSelTable.Enable) return; diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index ac8c8b5a1450..2b4f005dc7fa 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -248,11 +248,11 @@ s_uGetDataDuration( unsigned char byFBOption ) { - bool bLastFrag = 0; + bool bLastFrag = false; unsigned int uAckTime = 0, uNextPktTime = 0; if (uFragIdx == (uMACfragNum-1)) - bLastFrag = 1; + bLastFrag = true; switch (byDurType) { case DATADUR_B: //DATADUR_B -- cgit v1.2.3 From 708bca5dc480412fc61030806eb0520d4c8590d7 Mon Sep 17 00:00:00 2001 From: Yeliz Taneroglu Date: Wed, 4 Mar 2015 21:32:49 +0200 Subject: Staging: unisys: Remove unnecessary semicolon This fixes the checkpatch.pl warning: WARNING: macros should not use a trailing semicolon. Signed-off-by: Yeliz Taneroglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/common-spar/include/channels/iochannel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/common-spar/include/channels/iochannel.h b/drivers/staging/unisys/common-spar/include/channels/iochannel.h index eb7efe484f6f..3bd7579e1daf 100644 --- a/drivers/staging/unisys/common-spar/include/channels/iochannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/iochannel.h @@ -337,7 +337,7 @@ struct uiscmdrsp_scsi { /* peripheral type of 3 - processor */ /* specifies device capable, but not present */ -#define DEV_HISUPPORT 0x10; /* HiSup = 1; shows support for report luns */ +#define DEV_HISUPPORT 0x10 /* HiSup = 1; shows support for report luns */ /* must be returned for lun 0. */ /* NOTE: Linux code assumes inquiry contains 36 bytes. Without checking length -- cgit v1.2.3 From 67d095a0405adefd019f0abaa291fe9664257f6b Mon Sep 17 00:00:00 2001 From: Yeliz Taneroglu Date: Wed, 4 Mar 2015 23:15:16 +0200 Subject: Staging: rtl8723au: Fixed error 'else should follow close brace '}". This patch fixes error 'else should follow close brace '}" found by checkpatch in driver rtl8723au. Signed-off-by: Yeliz Taneroglu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_efuse.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_efuse.c b/drivers/staging/rtl8723au/core/rtw_efuse.c index a6deddc02291..29fc25b367e5 100644 --- a/drivers/staging/rtl8723au/core/rtw_efuse.c +++ b/drivers/staging/rtl8723au/core/rtw_efuse.c @@ -304,8 +304,7 @@ EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address) } data = rtl8723au_read8(Adapter, EFUSE_CTRL); return data; - } - else + } else return 0xFF; }/* EFUSE_Read1Byte23a */ -- cgit v1.2.3 From 6d67b3a2f3bd82bfa75f34d9e816788d133d63b5 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Thu, 5 Mar 2015 00:51:46 +0100 Subject: Staging: rtl8192u: Replace TRUE with true This patch replaces TRUE by true, since Linux kernel has already a boolean type, bool, defined in linux/stddef.h Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 96ab304d327c..9f68c652fb2b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -553,16 +553,16 @@ static void ieee80211_txrate_selectmode(struct ieee80211_device *ieee, #ifdef TO_DO_LIST if(!IsDataFrame(pFrame)) { - pTcb->bTxDisableRateFallBack = TRUE; - pTcb->bTxUseDriverAssingedRate = TRUE; + pTcb->bTxDisableRateFallBack = true; + pTcb->bTxUseDriverAssingedRate = true; pTcb->RATRIndex = 7; return; } if(pMgntInfo->ForcedDataRate!= 0) { - pTcb->bTxDisableRateFallBack = TRUE; - pTcb->bTxUseDriverAssingedRate = TRUE; + pTcb->bTxDisableRateFallBack = true; + pTcb->bTxUseDriverAssingedRate = true; return; } #endif -- cgit v1.2.3 From cd25503f5a6f0b0d6d66185461a358e8218db745 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Thu, 5 Mar 2015 13:01:49 +0300 Subject: Staging: comedi: Clean dev_err() logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout, so there is no need for __func__. This was done using Coccinelle, with the following semantic patch: @a@ expression E; expression msg; @@ dev_err(E, msg, __func__); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", ""); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", ""); coccinelle.y = m; else: m = e.replace("%s", ""); @c@ expression a.E, a.msg; identifier b.y; @@ - dev_err(E, msg, __func__); + dev_err(E, y); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 6 ++--- drivers/staging/comedi/drivers/ni_mio_common.c | 36 ++++++++++---------------- 2 files changed, 15 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 551e9d92e918..bd2405999906 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1703,8 +1703,7 @@ static void i2c_write(struct comedi_device *dev, unsigned int address, /* get acknowledge */ if (i2c_read_ack(dev) != 0) { - dev_err(dev->class_dev, "%s failed: no acknowledge\n", - __func__); + dev_err(dev->class_dev, "failed: no acknowledge\n"); i2c_stop(dev); return; } @@ -1712,8 +1711,7 @@ static void i2c_write(struct comedi_device *dev, unsigned int address, for (i = 0; i < length; i++) { i2c_write_byte(dev, data[i]); if (i2c_read_ack(dev) != 0) { - dev_err(dev->class_dev, "%s failed: no acknowledge\n", - __func__); + dev_err(dev->class_dev, "failed: no acknowledge\n"); i2c_stop(dev); return; } diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index b6ddc015dedf..176b64a6b567 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -1068,7 +1068,7 @@ static int ni_ai_drain_dma(struct comedi_device *dev) udelay(5); } if (i == timeout) { - dev_err(dev->class_dev, "%s timed out\n", __func__); + dev_err(dev->class_dev, "timed out\n"); dev_err(dev->class_dev, "mite_bytes_in_transit=%i, AI_Status1_Register=0x%x\n", mite_bytes_in_transit(devpriv->ai_mite_chan), @@ -2116,8 +2116,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, } } if (i == NI_TIMEOUT) { - dev_err(dev->class_dev, "%s timeout\n", - __func__); + dev_err(dev->class_dev, "timeout\n"); return -ETIME; } d += signbits; @@ -2140,8 +2139,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, } } if (i == NI_TIMEOUT) { - dev_err(dev->class_dev, "%s timeout\n", - __func__); + dev_err(dev->class_dev, "timeout\n"); return -ETIME; } data[n] = (((dl >> 16) & 0xFFFF) + signbits) & 0xFFFF; @@ -2156,8 +2154,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, break; } if (i == NI_TIMEOUT) { - dev_err(dev->class_dev, "%s timeout\n", - __func__); + dev_err(dev->class_dev, "timeout\n"); return -ETIME; } if (devpriv->is_m_series) { @@ -2808,8 +2805,7 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev, break; default: dev_err(dev->class_dev, - "%s: bug! unhandled ao reference voltage\n", - __func__); + "bug! unhandled ao reference voltage\n"); break; } switch (krange->max + krange->min) { @@ -2821,8 +2817,7 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev, break; default: dev_err(dev->class_dev, - "%s: bug! unhandled ao offset voltage\n", - __func__); + "bug! unhandled ao offset voltage\n"); break; } if (timed) @@ -3694,8 +3689,7 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, udelay((devpriv->serial_interval_ns + 999) / 1000); if (--count < 0) { dev_err(dev->class_dev, - "%s: SPI serial I/O didn't finish in time!\n", - __func__); + "SPI serial I/O didn't finish in time!\n"); err = -ETIME; goto Error; } @@ -3833,8 +3827,7 @@ static int ni_serial_insn_config(struct comedi_device *dev, err = ni_serial_sw_readwrite8(dev, s, byte_out, &byte_in); } else { - dev_err(dev->class_dev, "%s: serial disabled!\n", - __func__); + dev_err(dev->class_dev, "serial disabled!\n"); return -EINVAL; } if (err < 0) @@ -4520,8 +4513,7 @@ static unsigned ni_old_get_pfi_routing(struct comedi_device *dev, case 9: return NI_PFI_OUTPUT_G_GATE0; default: - dev_err(dev->class_dev, - "%s: bug, unhandled case in switch.\n", __func__); + dev_err(dev->class_dev, "bug, unhandled case in switch.\n"); break; } return 0; @@ -4673,7 +4665,7 @@ static int cs5529_wait_for_idle(struct comedi_device *dev) return -EIO; } if (i == timeout) { - dev_err(dev->class_dev, "%s timeout\n", __func__); + dev_err(dev->class_dev, "timeout\n"); return -ETIME; } return 0; @@ -4908,7 +4900,7 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, &devpriv->clock_ns); if (retval < 0) { dev_err(dev->class_dev, - "%s: bug, failed to find pll parameters\n", __func__); + "bug, failed to find pll parameters\n"); return retval; } @@ -4966,8 +4958,7 @@ static int ni_set_master_clock(struct comedi_device *dev, RTSI_Trig_Direction_Register); if (period_ns == 0) { dev_err(dev->class_dev, - "%s: we don't handle an unspecified clock period correctly yet, returning error\n", - __func__); + "we don't handle an unspecified clock period correctly yet, returning error\n"); return -EINVAL; } devpriv->clock_ns = period_ns; @@ -5057,8 +5048,7 @@ static unsigned ni_get_rtsi_routing(struct comedi_device *dev, unsigned chan) } else { if (chan == old_RTSI_clock_channel) return NI_RTSI_OUTPUT_RTSI_OSC; - dev_err(dev->class_dev, "%s: bug! should never get here?\n", - __func__); + dev_err(dev->class_dev, "bug! should never get here?\n"); return 0; } } -- cgit v1.2.3 From 14f63eeecfa3ca092f1c83755303161e53a9c641 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 20:01:07 +0300 Subject: Staging: media: Replace dev_err with pr_err to avoid null pointer derefrence This patch replace dev_err with pr_err, for pointer is derefrenced after comparing it to NULL. This was found using the following coccinelle script: @disable is_null@ identifier f; expression E; identifier fld; statement S; @@ + if(E == NULL) S f(...,E->fld,...); -if(E == NULL) S; @@ identifier f; expression E; identifier fld; statement S; @@ + if(!E) S f(...,E->fld,...); -if(!E) S; Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_zilog.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index e16627ca488e..261e27d6b054 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -1341,8 +1341,7 @@ static int close(struct inode *node, struct file *filep) struct IR *ir = filep->private_data; if (ir == NULL) { - dev_err(ir->l.dev, - "close: no private_data attached to the file!\n"); + pr_err("ir: close: no private_data attached to the file!\n"); return -ENODEV; } -- cgit v1.2.3 From aed1c72e447f0ac0985eecbe1c2403eb7176d606 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 21:59:04 +0300 Subject: Staging: fbtft: clean dev_err() logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_agm1264k-fl.c | 16 ++++++++-------- drivers/staging/fbtft/fb_pcd8544.c | 3 ++- drivers/staging/fbtft/fb_ra8875.c | 8 ++++---- drivers/staging/fbtft/fb_ssd1306.c | 4 ++-- drivers/staging/fbtft/fb_ssd1331.c | 6 ++++-- drivers/staging/fbtft/fb_tls8204.c | 2 +- drivers/staging/fbtft/fb_uc1701.c | 3 ++- drivers/staging/fbtft/fb_watterott.c | 2 +- drivers/staging/fbtft/fbtft-bus.c | 2 +- drivers/staging/fbtft/fbtft-core.c | 5 ++--- drivers/staging/fbtft/fbtft-io.c | 7 +++---- 11 files changed, 30 insertions(+), 28 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c index 9cc7d25cf0e5..7aa9e8c0763d 100644 --- a/drivers/staging/fbtft/fb_agm1264k-fl.c +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c @@ -198,8 +198,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) if (*buf > 1) { va_end(args); - dev_err(par->info->device, "%s: Incorrect chip sellect request (%d)\n", - __func__, *buf); + dev_err(par->info->device, + "Incorrect chip sellect request (%d)\n", *buf); return; } @@ -224,8 +224,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) ret = par->fbtftops.write(par, par->buf, len * (sizeof(u8))); if (ret < 0) { va_end(args); - dev_err(par->info->device, "%s: write() failed and returned %d\n", - __func__, ret); + dev_err(par->info->device, + "write() failed and returned %d\n", ret); return; } } @@ -376,8 +376,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) ret = par->fbtftops.write(par, buf, len); if (ret < 0) dev_err(par->info->device, - "%s: write failed and returned: %d\n", - __func__, ret); + "write failed and returned: %d\n", + ret); } /* right half of display */ if (addr_win.xe >= par->info->var.xres / 2) { @@ -398,8 +398,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) par->fbtftops.write(par, buf, len); if (ret < 0) dev_err(par->info->device, - "%s: write failed and returned: %d\n", - __func__, ret); + "write failed and returned: %d\n", + ret); } } kfree(convert_buf); diff --git a/drivers/staging/fbtft/fb_pcd8544.c b/drivers/staging/fbtft/fb_pcd8544.c index 5e08a70c25b4..b13162c35508 100644 --- a/drivers/staging/fbtft/fb_pcd8544.c +++ b/drivers/staging/fbtft/fb_pcd8544.c @@ -130,7 +130,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) gpio_set_value(par->gpio.dc, 1); ret = par->fbtftops.write(par, par->txbuf.buf, 6*84); if (ret < 0) - dev_err(par->info->device, "%s: write failed and returned: %d\n", __func__, ret); + dev_err(par->info->device, "write failed and returned: %d\n", + ret); return ret; } diff --git a/drivers/staging/fbtft/fb_ra8875.c b/drivers/staging/fbtft/fb_ra8875.c index 8df97373e183..e21af6c5a95f 100644 --- a/drivers/staging/fbtft/fb_ra8875.c +++ b/drivers/staging/fbtft/fb_ra8875.c @@ -238,8 +238,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) ret = par->fbtftops.write(par, par->buf, 2); if (ret < 0) { va_end(args); - dev_err(par->info->device, "%s: write() failed and returned %dn", - __func__, ret); + dev_err(par->info->device, "write() failed and returned %dn", + ret); return; } len--; @@ -256,8 +256,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) ret = par->fbtftops.write(par, par->buf, len + 1); if (ret < 0) { va_end(args); - dev_err(par->info->device, "%s: write() failed and returned %dn", - __func__, ret); + dev_err(par->info->device, + "write() failed and returned %dn", ret); return; } } diff --git a/drivers/staging/fbtft/fb_ssd1306.c b/drivers/staging/fbtft/fb_ssd1306.c index 5ea195b0de1b..15ee44dd130b 100644 --- a/drivers/staging/fbtft/fb_ssd1306.c +++ b/drivers/staging/fbtft/fb_ssd1306.c @@ -193,8 +193,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) ret = par->fbtftops.write(par, par->txbuf.buf, par->info->var.xres*par->info->var.yres/8); if (ret < 0) - dev_err(par->info->device, - "%s: write failed and returned: %d\n", __func__, ret); + dev_err(par->info->device, "write failed and returned: %d\n", + ret); return ret; } diff --git a/drivers/staging/fbtft/fb_ssd1331.c b/drivers/staging/fbtft/fb_ssd1331.c index ba17f0c83ec5..5bb741046c85 100644 --- a/drivers/staging/fbtft/fb_ssd1331.c +++ b/drivers/staging/fbtft/fb_ssd1331.c @@ -83,7 +83,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) ret = par->fbtftops.write(par, par->buf, sizeof(u8)); if (ret < 0) { va_end(args); - dev_err(par->info->device, "%s: write() failed and returned %d\n", __func__, ret); + dev_err(par->info->device, + "write() failed and returned %d\n", ret); return; } len--; @@ -95,7 +96,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) ret = par->fbtftops.write(par, par->buf, len * (sizeof(u8))); if (ret < 0) { va_end(args); - dev_err(par->info->device, "%s: write() failed and returned %d\n", __func__, ret); + dev_err(par->info->device, + "write() failed and returned %d\n", ret); return; } } diff --git a/drivers/staging/fbtft/fb_tls8204.c b/drivers/staging/fbtft/fb_tls8204.c index 8738c7a7bfda..fcd38bf2ed79 100644 --- a/drivers/staging/fbtft/fb_tls8204.c +++ b/drivers/staging/fbtft/fb_tls8204.c @@ -127,7 +127,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) ret = par->fbtftops.write(par, par->txbuf.buf, WIDTH); if (ret < 0) { dev_err(par->info->device, - "%s: write failed and returned: %d\n", __func__, ret); + "write failed and returned: %d\n", ret); break; } } diff --git a/drivers/staging/fbtft/fb_uc1701.c b/drivers/staging/fbtft/fb_uc1701.c index d70ac524278c..26d669b57916 100644 --- a/drivers/staging/fbtft/fb_uc1701.c +++ b/drivers/staging/fbtft/fb_uc1701.c @@ -183,7 +183,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) } if (ret < 0) - dev_err(par->info->device, "%s: write failed and returned: %d\n", __func__, ret); + dev_err(par->info->device, "write failed and returned: %d\n", + ret); return ret; } diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c index 975b579359f3..88fb2c0132d5 100644 --- a/drivers/staging/fbtft/fb_watterott.c +++ b/drivers/staging/fbtft/fb_watterott.c @@ -65,7 +65,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) ret = par->fbtftops.write(par, par->buf, len); if (ret < 0) { dev_err(par->info->device, - "%s: write() failed and returned %d\n", __func__, ret); + "write() failed and returned %d\n", ret); return; } } diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c index b3cddb0b3d69..52af9cbbc2a6 100644 --- a/drivers/staging/fbtft/fbtft-bus.c +++ b/drivers/staging/fbtft/fbtft-bus.c @@ -111,7 +111,7 @@ void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...) ret = par->fbtftops.write(par, par->buf, (len + pad) * sizeof(u16)); if (ret < 0) { dev_err(par->info->device, - "%s: write() failed and returned %d\n", __func__, ret); + "write() failed and returned %d\n", ret); return; } } diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 3c4769aab678..fd9f92e2dba6 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -703,9 +703,8 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, /* sanity check */ if (display->gamma_num * display->gamma_len > FBTFT_GAMMA_MAX_VALUES_TOTAL) { - dev_err(dev, - "%s: FBTFT_GAMMA_MAX_VALUES_TOTAL=%d is exceeded\n", - __func__, FBTFT_GAMMA_MAX_VALUES_TOTAL); + dev_err(dev, "FBTFT_GAMMA_MAX_VALUES_TOTAL=%d is exceeded\n", + FBTFT_GAMMA_MAX_VALUES_TOTAL); return NULL; } diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c index 9b2f8cfbb386..e19b814c3327 100644 --- a/drivers/staging/fbtft/fbtft-io.c +++ b/drivers/staging/fbtft/fbtft-io.c @@ -59,8 +59,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len) } if ((len % 8) != 0) { dev_err(par->info->device, - "%s: error: len=%zu must be divisible by 8\n", - __func__, len); + "error: len=%zu must be divisible by 8\n", len); return -EINVAL; } @@ -106,8 +105,8 @@ int fbtft_read_spi(struct fbtft_par *par, void *buf, size_t len) if (par->startbyte) { if (len > 32) { dev_err(par->info->device, - "%s: len=%zu can't be larger than 32 when using 'startbyte'\n", - __func__, len); + "len=%zu can't be larger than 32 when using 'startbyte'\n", + len); return -EINVAL; } txbuf[0] = par->startbyte | 0x3; -- cgit v1.2.3 From 8c6ccbeb510fe48ed8808067cd7cbf92f7e8ebac Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 22:00:10 +0300 Subject: Staging: media: clean dev_err logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_imon.c | 26 +++++++++++--------------- drivers/staging/media/lirc/lirc_sasem.c | 18 +++++++----------- drivers/staging/media/omap4iss/iss.c | 16 ++++++++-------- drivers/staging/media/omap4iss/iss_video.c | 3 +-- 4 files changed, 27 insertions(+), 36 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 9ce7d9990e3e..2e883e9457db 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -208,8 +208,7 @@ static void deregister_from_lirc(struct imon_context *context) retval = lirc_unregister_driver(minor); if (retval) dev_err(&context->usbdev->dev, - ": %s: unable to deregister from lirc(%d)", - __func__, retval); + "unable to deregister from lirc(%d)", retval); else dev_info(&context->usbdev->dev, "Deregistered iMON driver (minor:%d)\n", minor); @@ -241,9 +240,8 @@ static int display_open(struct inode *inode, struct file *file) context = usb_get_intfdata(interface); if (!context) { - dev_err(&interface->dev, - "%s: no context found for minor %d\n", - __func__, subminor); + dev_err(&interface->dev, "no context found for minor %d\n", + subminor); retval = -ENODEV; goto exit; } @@ -344,8 +342,8 @@ static int send_packet(struct imon_context *context) retval = usb_submit_urb(context->tx_urb, GFP_KERNEL); if (retval) { atomic_set(&(context->tx.busy), 0); - dev_err(&context->usbdev->dev, - "%s: error submitting urb(%d)\n", __func__, retval); + dev_err(&context->usbdev->dev, "error submitting urb(%d)\n", + retval); } else { /* Wait for transmission to complete (or abort) */ mutex_unlock(&context->ctx_lock); @@ -359,8 +357,7 @@ static int send_packet(struct imon_context *context) retval = context->tx.status; if (retval) dev_err(&context->usbdev->dev, - "%s: packet tx failed (%d)\n", - __func__, retval); + "packet tx failed (%d)\n", retval); } return retval; @@ -437,8 +434,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, retval = send_packet(context); if (retval) { dev_err(&context->usbdev->dev, - "%s: send packet failed for packet #%d\n", - __func__, seq/2); + "send packet failed for packet #%d\n", + seq / 2); goto exit; } else { seq += 2; @@ -454,8 +451,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, retval = send_packet(context); if (retval) dev_err(&context->usbdev->dev, - "%s: send packet failed for packet #%d\n", - __func__, seq/2); + "send packet failed for packet #%d\n", + seq / 2); } exit: @@ -877,8 +874,7 @@ static int imon_probe(struct usb_interface *interface, retval = usb_submit_urb(context->rx_urb, GFP_KERNEL); if (retval) { - dev_err(dev, "%s: usb_submit_urb failed for intf0 (%d)\n", - __func__, retval); + dev_err(dev, "usb_submit_urb failed for intf0 (%d)\n", retval); alloc_status = 8; goto unlock; } diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index 4a268200cbf5..9944af1ba4d3 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -214,9 +214,8 @@ static int vfd_open(struct inode *inode, struct file *file) context = usb_get_intfdata(interface); if (!context) { - dev_err(&interface->dev, - "%s: no context found for minor %d\n", - __func__, subminor); + dev_err(&interface->dev, "no context found for minor %d\n", + subminor); retval = -ENODEV; goto exit; } @@ -337,8 +336,8 @@ static int send_packet(struct sasem_context *context) retval = usb_submit_urb(context->tx_urb, GFP_KERNEL); if (retval) { atomic_set(&(context->tx.busy), 0); - dev_err(&context->dev->dev, "%s: error submitting urb (%d)\n", - __func__, retval); + dev_err(&context->dev->dev, "error submitting urb (%d)\n", + retval); } else { /* Wait for transmission to complete (or abort) */ mutex_unlock(&context->ctx_lock); @@ -348,8 +347,7 @@ static int send_packet(struct sasem_context *context) retval = context->tx.status; if (retval) dev_err(&context->dev->dev, - "%s: packet tx failed (%d)\n", - __func__, retval); + "packet tx failed (%d)\n", retval); } return retval; @@ -444,8 +442,7 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, retval = send_packet(context); if (retval) { dev_err(&context->dev->dev, - "%s: send packet failed for packet #%d\n", - __func__, i); + "send packet failed for packet #%d\n", i); goto exit; } } @@ -509,8 +506,7 @@ static int ir_open(void *data) if (retval) dev_err(&context->dev->dev, - "%s: usb_submit_urb failed for ir_open (%d)\n", - __func__, retval); + "usb_submit_urb failed for ir_open (%d)\n", retval); else { context->ir_isopen = 1; dev_info(&context->dev->dev, "IR port opened\n"); diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index 44b81a2c8b6f..e0ad5e520e2d 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -1160,8 +1160,8 @@ iss_register_subdev_group(struct iss_device *iss, subdev = v4l2_i2c_new_subdev_board(&iss->v4l2_dev, adapter, board_info->board_info, NULL); if (subdev == NULL) { - dev_err(iss->dev, "%s: Unable to register subdev %s\n", - __func__, board_info->board_info->type); + dev_err(iss->dev, "Unable to register subdev %s\n", + board_info->board_info->type); continue; } @@ -1185,16 +1185,16 @@ static int iss_register_entities(struct iss_device *iss) iss->media_dev.link_notify = iss_pipeline_link_notify; ret = media_device_register(&iss->media_dev); if (ret < 0) { - dev_err(iss->dev, "%s: Media device registration failed (%d)\n", - __func__, ret); + dev_err(iss->dev, "Media device registration failed (%d)\n", + ret); return ret; } iss->v4l2_dev.mdev = &iss->media_dev; ret = v4l2_device_register(iss->dev, &iss->v4l2_dev); if (ret < 0) { - dev_err(iss->dev, "%s: V4L2 device registration failed (%d)\n", - __func__, ret); + dev_err(iss->dev, "V4L2 device registration failed (%d)\n", + ret); goto done; } @@ -1252,8 +1252,8 @@ static int iss_register_entities(struct iss_device *iss) break; default: - dev_err(iss->dev, "%s: invalid interface type %u\n", - __func__, subdevs->interface); + dev_err(iss->dev, "invalid interface type %u\n", + subdevs->interface); ret = -EINVAL; goto done; } diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index 69550445a341..55938cccde7f 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c @@ -1221,8 +1221,7 @@ int omap4iss_video_register(struct iss_video *video, struct v4l2_device *vdev) ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1); if (ret < 0) dev_err(video->iss->dev, - "%s: could not register video device (%d)\n", - __func__, ret); + "could not register video device (%d)\n", ret); return ret; } -- cgit v1.2.3 From 99beca13675c842b83d83e5d5b24d3a80dde1f58 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 22:00:42 +0300 Subject: Staging: gdm72xx: clean dev_err logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_sdio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c index 7a0a0f221418..a5fd0794842e 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.c +++ b/drivers/staging/gdm72xx/gdm_sdio.c @@ -223,8 +223,7 @@ static void send_sdio_pkt(struct sdio_func *func, u8 *data, int len) if (ret < 0) { if (ret != -ENOMEDIUM) dev_err(&func->dev, - "gdmwms: %s error: ret = %d\n", - __func__, ret); + "gdmwms: error: ret = %d\n", ret); goto end_io; } } @@ -237,8 +236,7 @@ static void send_sdio_pkt(struct sdio_func *func, u8 *data, int len) if (ret < 0) { if (ret != -ENOMEDIUM) dev_err(&func->dev, - "gdmwms: %s error: ret = %d\n", - __func__, ret); + "gdmwms: error: ret = %d\n", ret); goto end_io; } } -- cgit v1.2.3 From ce82410c76374be44a4dbd60b906e896a5e20687 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 22:01:38 +0300 Subject: Staging: comedi: clean dev_err logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 4 ++-- drivers/staging/comedi/drivers/usbduxsigma.c | 26 +++++++++++--------------- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 176b64a6b567..97728d25da53 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -670,8 +670,8 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg, ni_writeb(dev, devpriv->g0_g1_select_reg, G0_G1_Select); break; default: - dev_err(dev->class_dev, - "%s called with invalid register %d\n", __func__, reg); + dev_err(dev->class_dev, "called with invalid register %d\n", + reg); break; } mmiowb(); diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 394969b7458c..f50cf8a8dada 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -243,9 +243,8 @@ static void usbduxsigma_ai_handle_urb(struct comedi_device *dev, urb->dev = comedi_to_usb_dev(dev); ret = usb_submit_urb(urb, GFP_ATOMIC); if (ret < 0) { - dev_err(dev->class_dev, - "%s: urb resubmit failed (%d)\n", - __func__, ret); + dev_err(dev->class_dev, "urb resubmit failed (%d)\n", + ret); if (ret == -EL2NSYNC) dev_err(dev->class_dev, "buggy USB host controller or bug in IRQ handler\n"); @@ -292,8 +291,8 @@ static void usbduxsigma_ai_urb_complete(struct urb *urb) default: /* a real error */ - dev_err(dev->class_dev, "%s: non-zero urb status (%d)\n", - __func__, urb->status); + dev_err(dev->class_dev, "non-zero urb status (%d)\n", + urb->status); async->events |= COMEDI_CB_ERROR; break; } @@ -386,9 +385,8 @@ static void usbduxsigma_ao_handle_urb(struct comedi_device *dev, urb->iso_frame_desc[0].status = 0; ret = usb_submit_urb(urb, GFP_ATOMIC); if (ret < 0) { - dev_err(dev->class_dev, - "%s: urb resubmit failed (%d)\n", - __func__, ret); + dev_err(dev->class_dev, "urb resubmit failed (%d)\n", + ret); if (ret == -EL2NSYNC) dev_err(dev->class_dev, "buggy USB host controller or bug in IRQ handler\n"); @@ -423,8 +421,8 @@ static void usbduxsigma_ao_urb_complete(struct urb *urb) default: /* a real error */ - dev_err(dev->class_dev, "%s: non-zero urb status (%d)\n", - __func__, urb->status); + dev_err(dev->class_dev, "non-zero urb status (%d)\n", + urb->status); async->events |= COMEDI_CB_ERROR; break; } @@ -1071,9 +1069,8 @@ static void usbduxsigma_pwm_urb_complete(struct urb *urb) default: /* a real error */ if (devpriv->pwm_cmd_running) { - dev_err(dev->class_dev, - "%s: non-zero urb status (%d)\n", - __func__, urb->status); + dev_err(dev->class_dev, "non-zero urb status (%d)\n", + urb->status); usbduxsigma_pwm_stop(dev, 0); /* w/o unlink */ } return; @@ -1087,8 +1084,7 @@ static void usbduxsigma_pwm_urb_complete(struct urb *urb) urb->status = 0; ret = usb_submit_urb(urb, GFP_ATOMIC); if (ret < 0) { - dev_err(dev->class_dev, "%s: urb resubmit failed (%d)\n", - __func__, ret); + dev_err(dev->class_dev, "urb resubmit failed (%d)\n", ret); if (ret == -EL2NSYNC) dev_err(dev->class_dev, "buggy USB host controller or bug in IRQ handler\n"); -- cgit v1.2.3 From 651cd163ba038079fd4796f046ba77c216e22a2c Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 22:03:05 +0300 Subject: Staging: rts5208: clean dev_err logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/rtsx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c index c74f1b8108f6..7f2c0c38e840 100644 --- a/drivers/staging/rts5208/rtsx.c +++ b/drivers/staging/rts5208/rtsx.c @@ -137,8 +137,8 @@ static int queuecommand_lck(struct scsi_cmnd *srb, /* check for state-transition errors */ if (chip->srb != NULL) { - dev_err(&dev->pci->dev, "Error in %s: chip->srb = %p\n", - __func__, chip->srb); + dev_err(&dev->pci->dev, "Error: chip->srb = %p\n", + chip->srb); return SCSI_MLQUEUE_HOST_BUSY; } -- cgit v1.2.3 From 3daf9df3bab88a14135b5b83713c64d5a58af60d Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 22:03:53 +0300 Subject: Staging: iio: clean dev_err logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/light/isl29028.c | 8 ++++---- drivers/staging/iio/light/tsl2x7x_core.c | 34 +++++++++++++------------------- 2 files changed, 18 insertions(+), 24 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c index 6440e3b293ca..e5b2fdc2334b 100644 --- a/drivers/staging/iio/light/isl29028.c +++ b/drivers/staging/iio/light/isl29028.c @@ -441,15 +441,15 @@ static int isl29028_chip_init(struct isl29028_chip *chip) ret = isl29028_set_proxim_sampling(chip, chip->prox_sampling); if (ret < 0) { - dev_err(chip->dev, "%s(): setting the proximity, err = %d\n", - __func__, ret); + dev_err(chip->dev, "setting the proximity, err = %d\n", + ret); return ret; } ret = isl29028_set_als_scale(chip, chip->lux_scale); if (ret < 0) - dev_err(chip->dev, "%s(): setting als scale failed, err = %d\n", - __func__, ret); + dev_err(chip->dev, + "setting als scale failed, err = %d\n", ret); return ret; } diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index 4a5dc26fed4c..52f4e65fcdf1 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -301,8 +301,7 @@ tsl2x7x_i2c_read(struct i2c_client *client, u8 reg, u8 *val) /* select register to write */ ret = i2c_smbus_write_byte(client, (TSL2X7X_CMD_REG | reg)); if (ret < 0) { - dev_err(&client->dev, "%s: failed to write register %x\n" - , __func__, reg); + dev_err(&client->dev, "failed to write register %x\n", reg); return ret; } @@ -311,8 +310,7 @@ tsl2x7x_i2c_read(struct i2c_client *client, u8 reg, u8 *val) if (ret >= 0) *val = (u8)ret; else - dev_err(&client->dev, "%s: failed to read register %x\n" - , __func__, reg); + dev_err(&client->dev, "failed to read register %x\n", reg); return ret; } @@ -377,7 +375,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) &buf[i]); if (ret < 0) { dev_err(&chip->client->dev, - "%s: failed to read. err=%x\n", __func__, ret); + "failed to read. err=%x\n", ret); goto out_unlock; } } @@ -389,8 +387,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) TSL2X7X_CMD_ALS_INT_CLR)); if (ret < 0) { dev_err(&chip->client->dev, - "%s: i2c_write_command failed - err = %d\n", - __func__, ret); + "i2c_write_command failed - err = %d\n", ret); goto out_unlock; /* have no data, so return failure */ } @@ -493,8 +490,7 @@ static int tsl2x7x_get_prox(struct iio_dev *indio_dev) ret = tsl2x7x_i2c_read(chip->client, (TSL2X7X_CMD_REG | TSL2X7X_STATUS), &status); if (ret < 0) { - dev_err(&chip->client->dev, - "%s: i2c err=%d\n", __func__, ret); + dev_err(&chip->client->dev, "i2c err=%d\n", ret); goto prox_poll_err; } @@ -583,8 +579,7 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev) (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); if (ret < 0) { dev_err(&chip->client->dev, - "%s: failed to write CNTRL register, ret=%d\n", - __func__, ret); + "failed to write CNTRL register, ret=%d\n", ret); return ret; } @@ -600,8 +595,7 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev) (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); if (ret < 0) { dev_err(&chip->client->dev, - "%s: failed to write ctrl reg: ret=%d\n", - __func__, ret); + "failed to write ctrl reg: ret=%d\n", ret); return ret; } @@ -720,7 +714,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) TSL2X7X_CMD_REG + i, *dev_reg++); if (ret < 0) { dev_err(&chip->client->dev, - "%s: failed on write to reg %d.\n", __func__, i); + "failed on write to reg %d.\n", i); return ret; } } @@ -871,8 +865,8 @@ static void tsl2x7x_prox_cal(struct iio_dev *indio_dev) if (chip->tsl2x7x_settings.prox_max_samples_cal > MAX_SAMPLES_CAL) { dev_err(&chip->client->dev, - "%s: max prox samples cal is too big: %d\n", - __func__, chip->tsl2x7x_settings.prox_max_samples_cal); + "max prox samples cal is too big: %d\n", + chip->tsl2x7x_settings.prox_max_samples_cal); chip->tsl2x7x_settings.prox_max_samples_cal = MAX_SAMPLES_CAL; } @@ -1563,8 +1557,8 @@ static irqreturn_t tsl2x7x_event_handler(int irq, void *private) TSL2X7X_CMD_PROXALS_INT_CLR); if (ret < 0) dev_err(&chip->client->dev, - "%s: Failed to clear irq from event handler. err = %d\n", - __func__, ret); + "Failed to clear irq from event handler. err = %d\n", + ret); return IRQ_HANDLED; } @@ -1893,8 +1887,8 @@ static int tsl2x7x_probe(struct i2c_client *clientp, ret = i2c_smbus_write_byte(clientp, (TSL2X7X_CMD_REG | TSL2X7X_CNTRL)); if (ret < 0) { - dev_err(&clientp->dev, "%s: write to cmd reg failed. err = %d\n", - __func__, ret); + dev_err(&clientp->dev, "write to cmd reg failed. err = %d\n", + ret); return ret; } -- cgit v1.2.3 From eb856202b9f11735237db61c2d4d647825c123e1 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 22:05:05 +0300 Subject: Staging: slicoss: clean dev_err logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/slicoss/slicoss.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index a3afb3e4d157..3104cb0d0589 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2313,9 +2313,8 @@ static int slic_if_init(struct adapter *adapter) } rc = slic_adapter_allocresources(adapter); if (rc) { - dev_err(&dev->dev, - "%s: slic_adapter_allocresources FAILED %x\n", - __func__, rc); + dev_err(&dev->dev, "slic_adapter_allocresources FAILED %x\n", + rc); slic_adapter_freeresources(adapter); goto err; } @@ -2549,8 +2548,8 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) if (copy_from_user(data, rq->ifr_data, 28)) return -EFAULT; intagg = data[0]; - dev_err(&dev->dev, "%s: set interrupt aggregation to %d\n", - __func__, intagg); + dev_err(&dev->dev, "set interrupt aggregation to %d\n", + intagg); slic_intagg_set(adapter, intagg); return 0; -- cgit v1.2.3 From 62af7214d8c3c9c81788e988cf99bfb02da77d0b Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 6 Mar 2015 22:07:13 +0300 Subject: Staging: ste_rmi4: clean dev_err logging This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c index f92ae1d24f9f..6385b336bd0d 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c @@ -209,7 +209,7 @@ static int synaptics_rmi4_set_page(struct synaptics_rmi4_data *pdata, txbuf[1] = page; retval = i2c_master_send(i2c, txbuf, PAGE_LEN); if (retval != PAGE_LEN) - dev_err(&i2c->dev, "%s:failed:%d\n", __func__, retval); + dev_err(&i2c->dev, "failed:%d\n", retval); else pdata->current_page = page; } else @@ -283,7 +283,7 @@ static int synaptics_rmi4_i2c_byte_write(struct synaptics_rmi4_data *pdata, retval = i2c_master_send(pdata->i2c_client, txbuf, 2); /* Add in retry on writes only in certain error return values */ if (retval != 2) { - dev_err(&i2c->dev, "%s:failed:%d\n", __func__, retval); + dev_err(&i2c->dev, "failed:%d\n", retval); retval = -EIO; } else retval = 1; @@ -830,8 +830,8 @@ static int synaptics_rmi4_i2c_query_device(struct synaptics_rmi4_data *pdata) /* Check if this is a Synaptics device - report if not. */ if (pdata->rmi4_mod_info.manufacturer_id != 1) - dev_err(&client->dev, "%s: non-Synaptics mfg id:%d\n", - __func__, pdata->rmi4_mod_info.manufacturer_id); + dev_err(&client->dev, "non-Synaptics mfg id:%d\n", + pdata->rmi4_mod_info.manufacturer_id); list_for_each_entry(rfi, &pdata->rmi4_mod_info.support_fn_list, link) data_sources += rfi->num_of_data_sources; @@ -990,8 +990,8 @@ static int synaptics_rmi4_probe platformdata->irq_type, DRIVER_NAME, rmi4_data); if (retval) { - dev_err(&client->dev, "%s:Unable to get attn irq %d\n", - __func__, client->irq); + dev_err(&client->dev, "Unable to get attn irq %d\n", + client->irq); goto err_query_dev; } -- cgit v1.2.3 From 88cc30cfcfd38d81da3f8b4d9cedb16556c5fdfc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:28 -0700 Subject: staging: comedi: comedi_fops: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 727640e89c73..2f8257cd9824 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -144,7 +144,7 @@ static void comedi_device_cleanup(struct comedi_device *dev) { struct module *driver_module = NULL; - if (dev == NULL) + if (!dev) return; mutex_lock(&dev->mutex); if (dev->attached) @@ -260,7 +260,7 @@ comedi_read_subdevice(const struct comedi_device *dev, unsigned int minor) if (minor >= COMEDI_NUM_BOARD_MINORS) { s = comedi_subdevice_from_minor(dev, minor); - if (s == NULL || (s->subdev_flags & SDF_CMD_READ)) + if (!s || (s->subdev_flags & SDF_CMD_READ)) return s; } return dev->read_subdev; @@ -273,7 +273,7 @@ comedi_write_subdevice(const struct comedi_device *dev, unsigned int minor) if (minor >= COMEDI_NUM_BOARD_MINORS) { s = comedi_subdevice_from_minor(dev, minor); - if (s == NULL || (s->subdev_flags & SDF_CMD_WRITE)) + if (!s || (s->subdev_flags & SDF_CMD_WRITE)) return s; } return dev->write_subdev; @@ -290,9 +290,9 @@ static void comedi_file_reset(struct file *file) write_s = dev->write_subdev; if (minor >= COMEDI_NUM_BOARD_MINORS) { s = comedi_subdevice_from_minor(dev, minor); - if (s == NULL || s->subdev_flags & SDF_CMD_READ) + if (!s || s->subdev_flags & SDF_CMD_READ) read_s = s; - if (s == NULL || s->subdev_flags & SDF_CMD_WRITE) + if (!s || s->subdev_flags & SDF_CMD_WRITE) write_s = s; } cfp->last_attached = dev->attached; @@ -759,7 +759,7 @@ static int do_devconfig_ioctl(struct comedi_device *dev, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (arg == NULL) { + if (!arg) { if (is_device_busy(dev)) return -EBUSY; if (dev->attached) { @@ -1840,7 +1840,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned long arg, if (arg >= dev->n_subdevices) return -EINVAL; s = &dev->subdevices[arg]; - if (s->async == NULL) + if (!s->async) return -EINVAL; if (!s->busy) @@ -2682,7 +2682,7 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device) unsigned i; dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (dev == NULL) + if (!dev) return ERR_PTR(-ENOMEM); comedi_device_init(dev); comedi_set_hw_dev(dev, hardware_device); @@ -2690,7 +2690,7 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device) mutex_lock(&comedi_board_minor_table_lock); for (i = hardware_device ? comedi_num_legacy_minors : 0; i < COMEDI_NUM_BOARD_MINORS; ++i) { - if (comedi_board_minor_table[i] == NULL) { + if (!comedi_board_minor_table[i]) { comedi_board_minor_table[i] = dev; break; } @@ -2746,7 +2746,7 @@ int comedi_alloc_subdevice_minor(struct comedi_subdevice *s) mutex_lock(&comedi_subdevice_minor_table_lock); for (i = 0; i < COMEDI_NUM_SUBDEVICE_MINORS; ++i) { - if (comedi_subdevice_minor_table[i] == NULL) { + if (!comedi_subdevice_minor_table[i]) { comedi_subdevice_minor_table[i] = s; break; } @@ -2771,7 +2771,7 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s) { unsigned int i; - if (s == NULL) + if (!s) return; if (s->minor < 0) return; -- cgit v1.2.3 From e2850160763e716e55fa6328bfab335cac90fc80 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:29 -0700 Subject: staging: comedi: drivers: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index e87c68cf11d4..57dcffe00204 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -46,7 +46,7 @@ int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev) { if (hw_dev == dev->hw_dev) return 0; - if (dev->hw_dev != NULL) + if (dev->hw_dev) return -EEXIST; dev->hw_dev = get_device(hw_dev); return 0; @@ -802,7 +802,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) } module_put(driv->module); } - if (driv == NULL) { + if (!driv) { /* recognize has failed if we get here */ /* report valid board names before returning error */ for (driv = comedi_drivers; driv; driv = driv->next) { @@ -814,7 +814,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = -EIO; goto out; } - if (driv->attach == NULL) { + if (!driv->attach) { /* driver does not support manual configuration */ dev_warn(dev->class_dev, "driver '%s' does not support attach using comedi_config\n", @@ -898,7 +898,7 @@ EXPORT_SYMBOL_GPL(comedi_auto_config); void comedi_auto_unconfig(struct device *hardware_device) { - if (hardware_device == NULL) + if (!hardware_device) return; comedi_release_hardware_device(hardware_device); } -- cgit v1.2.3 From 0048b9923daced04ffcb3b9974019b488ce19e8f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:30 -0700 Subject: staging: comedi: amplc_pci224: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci224.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 88b8c0101c25..8ac35f9fc69f 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -838,7 +838,7 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned long flags; /* Cannot handle null/empty chanlist. */ - if (cmd->chanlist == NULL || cmd->chanlist_len == 0) + if (!cmd->chanlist || cmd->chanlist_len == 0) return -EINVAL; /* Determine which channels are enabled and their load order. */ -- cgit v1.2.3 From 4d719cecc08ecc58040ffd751423810b4c19d772 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:31 -0700 Subject: staging: comedi: amplc_pci230: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci230.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index a977156ca468..2dd794d01354 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -2381,7 +2381,7 @@ static int pci230_auto_attach(struct comedi_device *dev, spin_lock_init(&devpriv->ao_stop_spinlock); dev->board_ptr = pci230_find_pci_board(pci_dev); - if (dev->board_ptr == NULL) { + if (!dev->board_ptr) { dev_err(dev->class_dev, "amplc_pci230: BUG! cannot determine board type!\n"); return -EINVAL; -- cgit v1.2.3 From 854472c27046646f3f258970a9fee9ab1e5d7593 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:32 -0700 Subject: staging: comedi: cb_pcidas64: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index bd2405999906..c8f4a227cc59 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1473,7 +1473,7 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) devpriv->ai_buffer[i] = pci_alloc_consistent(pcidev, DMA_BUFFER_SIZE, &devpriv->ai_buffer_bus_addr[i]); - if (devpriv->ai_buffer[i] == NULL) + if (!devpriv->ai_buffer[i]) return -ENOMEM; } @@ -1483,7 +1483,7 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) pci_alloc_consistent(pcidev, DMA_BUFFER_SIZE, &devpriv-> ao_buffer_bus_addr[i]); - if (devpriv->ao_buffer[i] == NULL) + if (!devpriv->ao_buffer[i]) return -ENOMEM; } @@ -1493,7 +1493,7 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) pci_alloc_consistent(pcidev, sizeof(struct plx_dma_desc) * ai_dma_ring_count(thisboard), &devpriv->ai_dma_desc_bus_addr); - if (devpriv->ai_dma_desc == NULL) + if (!devpriv->ai_dma_desc) return -ENOMEM; if (ao_cmd_is_supported(thisboard)) { @@ -1502,7 +1502,7 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) sizeof(struct plx_dma_desc) * AO_DMA_RING_COUNT, &devpriv->ao_dma_desc_bus_addr); - if (devpriv->ao_dma_desc == NULL) + if (!devpriv->ao_dma_desc) return -ENOMEM; } /* initialize dma descriptors */ @@ -2975,7 +2975,7 @@ static void handle_ao_interrupt(struct comedi_device *dev, unsigned long flags; /* board might not support ao, in which case write_subdev is NULL */ - if (s == NULL) + if (!s) return; async = s->async; cmd = &async->cmd; -- cgit v1.2.3 From 5effdf708100fd5eeeaa8c7bbbed3b90cbb70cf5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:33 -0700 Subject: staging: comedi: mite: (!foo) preferred over (foo == NULL) Also, clarify the 'ring' allocation failure by returning NULL instead of 'ring' (which would be NULL). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mite.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 1e537a5cf862..79b5597db1a1 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -186,10 +186,10 @@ struct mite_dma_descriptor_ring *mite_alloc_ring(struct mite_struct *mite) struct mite_dma_descriptor_ring *ring = kmalloc(sizeof(struct mite_dma_descriptor_ring), GFP_KERNEL); - if (ring == NULL) - return ring; + if (!ring) + return NULL; ring->hw_dev = get_device(&mite->pcidev->dev); - if (ring->hw_dev == NULL) { + if (!ring->hw_dev) { kfree(ring); return NULL; } -- cgit v1.2.3 From 307da4b2e89c388d2e44efdd6899d4d1d8429806 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:34 -0700 Subject: staging: comedi: ni_660x: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 1e4dd82b12ea..9d7567bf1ce3 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -702,7 +702,7 @@ static int ni_660x_request_mite_channel(struct comedi_device *dev, BUG_ON(counter->mite_chan); mite_chan = mite_request_channel(devpriv->mite, mite_ring(devpriv, counter)); - if (mite_chan == NULL) { + if (!mite_chan) { spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); dev_err(dev->class_dev, "failed to reserve mite dma channel for counter\n"); @@ -861,7 +861,7 @@ static int ni_660x_alloc_mite_rings(struct comedi_device *dev) for (j = 0; j < counters_per_chip; ++j) { devpriv->mite_rings[i][j] = mite_alloc_ring(devpriv->mite); - if (devpriv->mite_rings[i][j] == NULL) + if (!devpriv->mite_rings[i][j]) return -ENOMEM; } } @@ -1107,7 +1107,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev, ni_gpct_variant_660x, ni_660x_num_counters (dev)); - if (devpriv->counter_dev == NULL) + if (!devpriv->counter_dev) return -ENOMEM; for (i = 0; i < NI_660X_MAX_NUM_COUNTERS; ++i) { s = &dev->subdevices[NI_660X_GPCT_SUBDEV(i)]; -- cgit v1.2.3 From 77ba71f6485d2b7f923987b173d590b3003bc2a6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:35 -0700 Subject: staging: comedi: ni_atmio: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_atmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c index 301f154be813..9cb9beb53e16 100644 --- a/drivers/staging/comedi/drivers/ni_atmio.c +++ b/drivers/staging/comedi/drivers/ni_atmio.c @@ -250,7 +250,7 @@ static int ni_isapnp_find_board(struct pnp_dev **dev) ISAPNP_FUNCTION(ni_boards[i]. isapnp_id), NULL); - if (isapnp_dev == NULL || isapnp_dev->card == NULL) + if (!isapnp_dev || !isapnp_dev->card) continue; if (pnp_device_attach(isapnp_dev) < 0) -- cgit v1.2.3 From c1bce7fd0d930a60af858039239d824973d147ab Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:36 -0700 Subject: staging: comedi: ni_labpc_common: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_labpc_common.c b/drivers/staging/comedi/drivers/ni_labpc_common.c index 74518c5645af..0dac8cf312b2 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_common.c +++ b/drivers/staging/comedi/drivers/ni_labpc_common.c @@ -428,7 +428,7 @@ static enum scan_mode labpc_ai_scan_mode(const struct comedi_cmd *cmd) return MODE_SINGLE_CHAN; /* chanlist may be NULL during cmdtest */ - if (cmd->chanlist == NULL) + if (!cmd->chanlist) return MODE_MULT_CHAN_UP; chan0 = CR_CHAN(cmd->chanlist[0]); -- cgit v1.2.3 From 4ce82def8da5787d8661fa5f7d5f7c899b5a20d9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:37 -0700 Subject: staging: comedi: ni_pcidio: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcidio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index db399fe8c301..8d91029c7d30 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -304,7 +304,7 @@ static int ni_pcidio_request_di_mite_channel(struct comedi_device *dev) devpriv->di_mite_chan = mite_request_channel_in_range(devpriv->mite, devpriv->di_mite_ring, 1, 2); - if (devpriv->di_mite_chan == NULL) { + if (!devpriv->di_mite_chan) { spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); dev_err(dev->class_dev, "failed to reserve mite dma channel\n"); return -EBUSY; @@ -924,7 +924,7 @@ static int nidio_auto_attach(struct comedi_device *dev, return ret; devpriv->di_mite_ring = mite_alloc_ring(devpriv->mite); - if (devpriv->di_mite_ring == NULL) + if (!devpriv->di_mite_ring) return -ENOMEM; if (board->uses_firmware) { -- cgit v1.2.3 From 9bacea57f445a2bc199401d1149d6f323c531028 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:38 -0700 Subject: staging: comedi: ni_pcimio: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcimio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 3b2bdebbca59..e78739cce175 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -1183,19 +1183,19 @@ static int pcimio_auto_attach(struct comedi_device *dev, return ret; devpriv->ai_mite_ring = mite_alloc_ring(devpriv->mite); - if (devpriv->ai_mite_ring == NULL) + if (!devpriv->ai_mite_ring) return -ENOMEM; devpriv->ao_mite_ring = mite_alloc_ring(devpriv->mite); - if (devpriv->ao_mite_ring == NULL) + if (!devpriv->ao_mite_ring) return -ENOMEM; devpriv->cdo_mite_ring = mite_alloc_ring(devpriv->mite); - if (devpriv->cdo_mite_ring == NULL) + if (!devpriv->cdo_mite_ring) return -ENOMEM; devpriv->gpct_mite_ring[0] = mite_alloc_ring(devpriv->mite); - if (devpriv->gpct_mite_ring[0] == NULL) + if (!devpriv->gpct_mite_ring[0]) return -ENOMEM; devpriv->gpct_mite_ring[1] = mite_alloc_ring(devpriv->mite); - if (devpriv->gpct_mite_ring[1] == NULL) + if (!devpriv->gpct_mite_ring[1]) return -ENOMEM; if (devpriv->is_m_series) -- cgit v1.2.3 From 56e97078602996123d849b7621442a934aa19b77 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:39 -0700 Subject: staging: comedi: ni_tiocmd: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_tiocmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c index d36c3abd3120..41735700e5f9 100644 --- a/drivers/staging/comedi/drivers/ni_tiocmd.c +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c @@ -201,7 +201,7 @@ int ni_tio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned long flags; spin_lock_irqsave(&counter->lock, flags); - if (counter->mite_chan == NULL) { + if (!counter->mite_chan) { dev_err(counter->counter_dev->dev->class_dev, "commands only supported with DMA. "); dev_err(counter->counter_dev->dev->class_dev, @@ -329,7 +329,7 @@ static int should_ack_gate(struct ni_gpct *counter) case ni_gpct_variant_e_series: spin_lock_irqsave(&counter->lock, flags); { - if (counter->mite_chan == NULL || + if (!counter->mite_chan || counter->mite_chan->dir != COMEDI_INPUT || (mite_done(counter->mite_chan))) { retval = 1; @@ -443,7 +443,7 @@ void ni_tio_handle_interrupt(struct ni_gpct *counter, break; } spin_lock_irqsave(&counter->lock, flags); - if (counter->mite_chan == NULL) { + if (!counter->mite_chan) { spin_unlock_irqrestore(&counter->lock, flags); return; } -- cgit v1.2.3 From c6be154812114819873e8254c8d89679a11ac21c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:40 -0700 Subject: staging: comedi: ni_mio_common: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 97728d25da53..5bb2b5e936bc 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -755,7 +755,7 @@ static int ni_request_ai_mite_channel(struct comedi_device *dev) BUG_ON(devpriv->ai_mite_chan); devpriv->ai_mite_chan = mite_request_channel(devpriv->mite, devpriv->ai_mite_ring); - if (devpriv->ai_mite_chan == NULL) { + if (!devpriv->ai_mite_chan) { spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); dev_err(dev->class_dev, "failed to reserve mite dma channel for analog input\n"); @@ -776,7 +776,7 @@ static int ni_request_ao_mite_channel(struct comedi_device *dev) BUG_ON(devpriv->ao_mite_chan); devpriv->ao_mite_chan = mite_request_channel(devpriv->mite, devpriv->ao_mite_ring); - if (devpriv->ao_mite_chan == NULL) { + if (!devpriv->ao_mite_chan) { spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); dev_err(dev->class_dev, "failed to reserve mite dma channel for analog outut\n"); @@ -802,7 +802,7 @@ static int ni_request_gpct_mite_channel(struct comedi_device *dev, mite_chan = mite_request_channel(devpriv->mite, devpriv->gpct_mite_ring[gpct_index]); - if (mite_chan == NULL) { + if (!mite_chan) { spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); dev_err(dev->class_dev, "failed to reserve mite dma channel for counter\n"); @@ -828,7 +828,7 @@ static int ni_request_cdo_mite_channel(struct comedi_device *dev) BUG_ON(devpriv->cdo_mite_chan); devpriv->cdo_mite_chan = mite_request_channel(devpriv->mite, devpriv->cdo_mite_ring); - if (devpriv->cdo_mite_chan == NULL) { + if (!devpriv->cdo_mite_chan) { spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); dev_err(dev->class_dev, "failed to reserve mite dma channel for correlated digital output\n"); @@ -1657,7 +1657,7 @@ static int ni_ai_setup_MITE_dma(struct comedi_device *dev) comedi_buf_write_alloc(s, s->async->prealloc_bufsz); spin_lock_irqsave(&devpriv->mite_channel_lock, flags); - if (devpriv->ai_mite_chan == NULL) { + if (!devpriv->ai_mite_chan) { spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); return -EIO; } @@ -3699,7 +3699,7 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, DIO_Serial_IO_In_Progress_St goes high one bit too early. */ udelay((devpriv->serial_interval_ns + 999) / 1000); - if (data_in != NULL) + if (data_in) *data_in = ni_stc_readw(dev, DIO_Serial_Input_Register); Error: -- cgit v1.2.3 From 4c36fdde64f858ce167ad69859c89b1a8c9b6fb0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:41 -0700 Subject: staging: comedi: kcomedilib_main: (!foo) preferred over (foo == NULL) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/kcomedilib/kcomedilib_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c index 973f544e85e1..76bf5619fdd5 100644 --- a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c +++ b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c @@ -58,7 +58,7 @@ struct comedi_device *comedi_open(const char *filename) retval = NULL; up_read(&dev->attach_lock); - if (retval == NULL) + if (!retval) comedi_dev_put(dev); return retval; -- cgit v1.2.3 From 857ced45a548c3f8196d6e45079678ab3c9f3581 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 4 Mar 2015 12:15:42 -0700 Subject: staging: comedi: s626: remove unnecessary 'cmd' pointer checks The local variable 'cmd' is a pointer to the address of a member variable of a struct. It will always be valid. Remove the unnecessary checks. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/s626.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index fc497dd92021..422ea9c73706 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -1576,7 +1576,7 @@ static void s626_reset_adc(struct comedi_device *dev, uint8_t *ppl) dev->mmio + S626_P_RPSADDR1); /* Construct RPS program in rps_buf DMA buffer */ - if (cmd != NULL && cmd->scan_begin_src != TRIG_FOLLOW) { + if (cmd->scan_begin_src != TRIG_FOLLOW) { /* Wait for Start trigger. */ *rps++ = S626_RPS_PAUSE | S626_RPS_SIGADC; *rps++ = S626_RPS_CLRSIGNAL | S626_RPS_SIGADC; @@ -1665,7 +1665,7 @@ static void s626_reset_adc(struct comedi_device *dev, uint8_t *ppl) *rps++ = jmp_adrs; } - if (cmd != NULL && cmd->convert_src != TRIG_NOW) { + if (cmd->convert_src != TRIG_NOW) { /* Wait for Start trigger. */ *rps++ = S626_RPS_PAUSE | S626_RPS_SIGADC; *rps++ = S626_RPS_CLRSIGNAL | S626_RPS_SIGADC; @@ -2034,10 +2034,6 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* reset ai_cmd_running flag */ devpriv->ai_cmd_running = 0; - /* test if cmd is valid */ - if (cmd == NULL) - return -EINVAL; - s626_ai_load_polllist(ppl, cmd); devpriv->ai_cmd_running = 1; devpriv->ai_convert_count = 0; -- cgit v1.2.3 From 9949595c0da61ff2aecc90c3a8e924848e6ac03b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 5 Mar 2015 13:21:15 -0700 Subject: staging: comedi: drivers/*.c: fix common misspellings Fix these common misspellings: s/dependancy/dependency s/occured/occurred s/informations/information s/intialize/initialize s/serveral/several s/interrups/interrupts s/acknowledgement/acknowledgment s/suppport/support s/writting/writing Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255_pci.c | 2 +- drivers/staging/comedi/drivers/addi_apci_1500.c | 4 ++-- drivers/staging/comedi/drivers/adv_pci1710.c | 2 +- drivers/staging/comedi/drivers/das08.c | 2 +- drivers/staging/comedi/drivers/dmm32at.c | 4 ++-- drivers/staging/comedi/drivers/ni_65xx.c | 2 +- drivers/staging/comedi/drivers/ni_670x.c | 2 +- drivers/staging/comedi/drivers/ni_labpc_pci.c | 2 +- drivers/staging/comedi/drivers/ni_tiocmd.c | 2 +- drivers/staging/comedi/drivers/pcmuio.c | 2 +- drivers/staging/comedi/drivers/unioxx5.c | 4 ++-- 11 files changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c index 984764211a2d..291aed14f7e3 100644 --- a/drivers/staging/comedi/drivers/8255_pci.c +++ b/drivers/staging/comedi/drivers/8255_pci.c @@ -178,7 +178,7 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = { }, }; -/* ripped from mite.h and mite_setup2() to avoid mite dependancy */ +/* ripped from mite.h and mite_setup2() to avoid mite dependency */ #define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ #define WENAB (1 << 7) /* window enable */ diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index f15aa1f6b476..3dd017940aaf 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -249,8 +249,8 @@ static irqreturn_t apci1500_interrupt(int irq, void *d) * * Mask Meaning * ---------- ------------------------------------------ - * 0x00000001 Event 1 has occured - * 0x00000010 Event 2 has occured + * 0x00000001 Event 1 has occurred + * 0x00000010 Event 2 has occurred * 0x00000100 Counter/timer 1 has run down (not implemented) * 0x00001000 Counter/timer 2 has run down (not implemented) * 0x00010000 Counter 3 has run down (not implemented) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 9c881ff01297..812f4dde63a4 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -4,7 +4,7 @@ * Author: Michal Dobes * * Thanks to ZhenGang Shang - * for testing and informations. + * for testing and information. * * hardware driver for Advantech cards: * card: PCI-1710, PCI-1710HG, PCI-1711, PCI-1713, PCI-1720, PCI-1731 diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index ecd363901922..73f4c8dbbde3 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -408,7 +408,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) if (ret) return ret; - /* intialize all channels to 0V */ + /* initialize all channels to 0V */ for (i = 0; i < s->n_chan; i++) { s->readback[i] = s->maxdata / 2; das08_ao_set_data(dev, i, s->readback[i]); diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 1af006609fc1..74830f4b95f5 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -30,7 +30,7 @@ * This driver is for the Diamond Systems MM-32-AT board * http://www.diamondsystems.com/products/diamondmm32at * - * It is being used on serveral projects inside NASA, without + * It is being used on several projects inside NASA, without * problems so far. For analog input commands, TRIG_EXT is not * yet supported. */ @@ -391,7 +391,7 @@ static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* start the clock and enable the interrupts */ dmm32at_setaitimer(dev, cmd->scan_begin_arg); } else { - /* start the interrups and initiate a single scan */ + /* start the interrupts and initiate a single scan */ outb(DMM32AT_INTCLK_ADINT, dev->iobase + DMM32AT_INTCLK_REG); outb(0xff, dev->iobase + DMM32AT_AI_START_CONV_REG); } diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 67cb758eb0cd..9d0714b802b1 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -613,7 +613,7 @@ static int ni_65xx_intr_insn_config(struct comedi_device *dev, return insn->n; } -/* ripped from mite.h and mite_setup2() to avoid mite dependancy */ +/* ripped from mite.h and mite_setup2() to avoid mite dependency */ #define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ #define WENAB (1 << 7) /* window enable */ diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index c42a81c0bfa1..90b4dfa6261b 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -146,7 +146,7 @@ static int ni_670x_dio_insn_config(struct comedi_device *dev, return insn->n; } -/* ripped from mite.h and mite_setup2() to avoid mite dependancy */ +/* ripped from mite.h and mite_setup2() to avoid mite dependency */ #define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ #define WENAB (1 << 7) /* window enable */ diff --git a/drivers/staging/comedi/drivers/ni_labpc_pci.c b/drivers/staging/comedi/drivers/ni_labpc_pci.c index 245c59bbaef8..f50a5a2ee079 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_pci.c +++ b/drivers/staging/comedi/drivers/ni_labpc_pci.c @@ -51,7 +51,7 @@ static const struct labpc_boardinfo labpc_pci_boards[] = { }, }; -/* ripped from mite.h and mite_setup2() to avoid mite dependancy */ +/* ripped from mite.h and mite_setup2() to avoid mite dependency */ #define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ #define WENAB (1 << 7) /* window enable */ diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c index 41735700e5f9..2a1f8b26c407 100644 --- a/drivers/staging/comedi/drivers/ni_tiocmd.c +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c @@ -366,7 +366,7 @@ static void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, if (gxx_status & GI_GATE_ERROR(cidx)) { ack |= GI_GATE_ERROR_CONFIRM(cidx); if (gate_error) { - /*660x don't support automatic acknowledgement + /*660x don't support automatic acknowledgment of gate interrupt via dma read/write and report bogus gate errors */ if (counter->counter_dev->variant != diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index a1641d981812..1a4a1f589a56 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -588,7 +588,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->insn_bits = pcmuio_dio_insn_bits; s->insn_config = pcmuio_dio_insn_config; - /* subdevices 0 and 2 can suppport interrupts */ + /* subdevices 0 and 2 can support interrupts */ if ((i == 0 && dev->irq) || (i == 2 && devpriv->irq2)) { /* setup the interrupt subdevice */ dev->read_subdev = s; diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c index 7c2276a086ac..12d828063c06 100644 --- a/drivers/staging/comedi/drivers/unioxx5.c +++ b/drivers/staging/comedi/drivers/unioxx5.c @@ -266,7 +266,7 @@ static int __unioxx5_analog_write(struct comedi_subdevice *s, /* sending for bytes to module(one byte per cycle iteration) */ for (i = 0; i < 4; i++) { while (!((inb(usp->usp_iobase + 0)) & TxBE)) - ; /* waits while writting will be allowed */ + ; /* waits while writing will be allowed */ outb(usp->usp_extra_data[module][i], usp->usp_iobase + 6); } @@ -399,7 +399,7 @@ static int __unioxx5_subdev_init(struct comedi_device *dev, outb(i + 1, iobase + 5); outb('H', iobase + 6); /* requests EEPROM world */ while (!(inb(iobase + 0) & TxBE)) - ; /* waits while writting will be allowed */ + ; /* waits while writing will be allowed */ outb(0, iobase + 6); /* waits while reading of two bytes will be allowed */ -- cgit v1.2.3 From 6c7d2c8b5230272b394d51462c8cae46df09f126 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 5 Mar 2015 13:21:16 -0700 Subject: staging: comedi: drivers/*.c: alignment should match open parenthesis Fix the alignment issues in all the comedi drivers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1032.c | 4 ++-- drivers/staging/comedi/drivers/addi_apci_1564.c | 4 ++-- drivers/staging/comedi/drivers/addi_apci_3501.c | 2 +- drivers/staging/comedi/drivers/addi_watchdog.c | 2 +- drivers/staging/comedi/drivers/adl_pci8164.c | 2 +- drivers/staging/comedi/drivers/adl_pci9111.c | 6 +++--- drivers/staging/comedi/drivers/adl_pci9118.c | 2 +- drivers/staging/comedi/drivers/cb_pcidas.c | 2 +- drivers/staging/comedi/drivers/cb_pcimdda.c | 2 +- drivers/staging/comedi/drivers/comedi_bond.c | 6 +++--- drivers/staging/comedi/drivers/comedi_isadma.c | 3 ++- drivers/staging/comedi/drivers/contec_pci_dio.c | 2 +- drivers/staging/comedi/drivers/daqboard2000.c | 2 +- drivers/staging/comedi/drivers/das16.c | 2 +- drivers/staging/comedi/drivers/das16m1.c | 2 +- drivers/staging/comedi/drivers/dt282x.c | 2 +- drivers/staging/comedi/drivers/dyna_pci10xx.c | 17 ++++++++++------- drivers/staging/comedi/drivers/icp_multi.c | 2 +- drivers/staging/comedi/drivers/me4000.c | 22 +++++++++++----------- drivers/staging/comedi/drivers/ni_65xx.c | 2 +- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- drivers/staging/comedi/drivers/pcmuio.c | 2 +- drivers/staging/comedi/drivers/rtd520.c | 4 ++-- drivers/staging/comedi/drivers/s626.c | 20 ++++++++++---------- drivers/staging/comedi/drivers/usbdux.c | 4 ++-- 25 files changed, 62 insertions(+), 58 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c b/drivers/staging/comedi/drivers/addi_apci_1032.c index 4911b627203b..993ecc639430 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1032.c +++ b/drivers/staging/comedi/drivers/addi_apci_1032.c @@ -238,7 +238,7 @@ static int apci1032_cos_cmd(struct comedi_device *dev, if (!devpriv->ctrl) { dev_warn(dev->class_dev, - "Interrupts disabled due to mode configuration!\n"); + "Interrupts disabled due to mode configuration!\n"); return -EINVAL; } @@ -296,7 +296,7 @@ static int apci1032_di_insn_bits(struct comedi_device *dev, } static int apci1032_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct apci1032_private *devpriv; diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index 6872b69da5db..2de5e8320957 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -407,7 +407,7 @@ static int apci1564_cos_cmd(struct comedi_device *dev, if (!devpriv->ctrl) { dev_warn(dev->class_dev, - "Interrupts disabled due to mode configuration!\n"); + "Interrupts disabled due to mode configuration!\n"); return -EINVAL; } @@ -430,7 +430,7 @@ static int apci1564_cos_cancel(struct comedi_device *dev, } static int apci1564_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct apci1564_private *devpriv; diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index 5961f195ba0b..b8f336681788 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -203,7 +203,7 @@ static unsigned short apci3501_eeprom_readw(unsigned long iobase, outb(NVCMD_LOAD_HIGH, iobase + AMCC_OP_REG_MCSR_NVCMD); apci3501_eeprom_wait(iobase); outb(((addr + i) >> 8) & 0xff, - iobase + AMCC_OP_REG_MCSR_NVDATA); + iobase + AMCC_OP_REG_MCSR_NVDATA); apci3501_eeprom_wait(iobase); /* Read the eeprom data byte */ diff --git a/drivers/staging/comedi/drivers/addi_watchdog.c b/drivers/staging/comedi/drivers/addi_watchdog.c index c5b082d4e51e..9d9853fe54a0 100644 --- a/drivers/staging/comedi/drivers/addi_watchdog.c +++ b/drivers/staging/comedi/drivers/addi_watchdog.c @@ -54,7 +54,7 @@ static int addi_watchdog_insn_config(struct comedi_device *dev, /* Time base is 20ms, let the user know the timeout */ dev_info(dev->class_dev, "watchdog enabled, timeout:%dms\n", - 20 * reload + 20); + 20 * reload + 20); break; case INSN_CONFIG_DISARM: spriv->wdog_ctrl = 0; diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index cc6c53b800a7..4a9d63ab10bc 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -69,7 +69,7 @@ static int adl_pci8164_insn_write(struct comedi_device *dev, } static int adl_pci8164_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct comedi_subdevice *s; diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index 3f82fa002e0d..144e9c2dbaf9 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -378,7 +378,7 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev, /* This is the same gain on every channel */ outb(CR_RANGE(cmd->chanlist[0]) & PCI9111_AI_RANGE_MASK, - dev->iobase + PCI9111_AI_RANGE_STAT_REG); + dev->iobase + PCI9111_AI_RANGE_STAT_REG); /* Set timer pacer */ dev_private->scan_delay = 0; @@ -572,7 +572,7 @@ static int pci9111_ai_insn_read(struct comedi_device *dev, status = inb(dev->iobase + PCI9111_AI_RANGE_STAT_REG); if ((status & PCI9111_AI_RANGE_MASK) != range) { outb(range & PCI9111_AI_RANGE_MASK, - dev->iobase + PCI9111_AI_RANGE_STAT_REG); + dev->iobase + PCI9111_AI_RANGE_STAT_REG); } pci9111_fifo_reset(dev); @@ -650,7 +650,7 @@ static int pci9111_reset(struct comedi_device *dev) } static int pci9111_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct pci9111_private_data *dev_private; diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 4b604423635f..1cd54556a2dd 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -936,7 +936,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev, /* outl(0x02000000|AINT_WRITE_COMPL, devpriv->iobase_a+AMCC_OP_REG_INTCSR); */ pci9118_amcc_dma_ena(dev, true); outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, - devpriv->iobase_a + AMCC_OP_REG_INTCSR); + devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow bus mastering */ return 0; diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index b6ef4b47c673..112627d24d41 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -525,7 +525,7 @@ static int wait_for_nvram_ready(unsigned long s5933_base_addr) } static int nvram_read(struct comedi_device *dev, unsigned int address, - uint8_t *data) + uint8_t *data) { struct cb_pcidas_private *devpriv = dev->private; unsigned long iobase = devpriv->s5933_config; diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index 03043e7b9b58..e834be9b0567 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -134,7 +134,7 @@ static int cb_pcimdda_ao_insn_read(struct comedi_device *dev, } static int cb_pcimdda_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct comedi_subdevice *s; diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index 221d3819c967..7a68727cc880 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -313,9 +313,9 @@ static int bonding_attach(struct comedi_device *dev, s->insn_config = bonding_dio_insn_config; dev_info(dev->class_dev, - "%s: %s attached, %u channels from %u devices\n", - dev->driver->driver_name, dev->board_name, - devpriv->nchans, devpriv->ndevs); + "%s: %s attached, %u channels from %u devices\n", + dev->driver->driver_name, dev->board_name, + devpriv->nchans, devpriv->ndevs); return 0; } diff --git a/drivers/staging/comedi/drivers/comedi_isadma.c b/drivers/staging/comedi/drivers/comedi_isadma.c index dbdea71d6b95..9b2a2997134f 100644 --- a/drivers/staging/comedi/drivers/comedi_isadma.c +++ b/drivers/staging/comedi/drivers/comedi_isadma.c @@ -234,7 +234,8 @@ void comedi_isadma_free(struct comedi_isadma *dma) desc = &dma->desc[i]; if (desc->virt_addr) dma_free_coherent(NULL, desc->maxsize, - desc->virt_addr, desc->hw_addr); + desc->virt_addr, + desc->hw_addr); } kfree(dma->desc); } diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index 205f9df345a2..ba26c134a46d 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -59,7 +59,7 @@ static int contec_di_insn_bits(struct comedi_device *dev, } static int contec_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct comedi_subdevice *s; diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 96697fbb5239..d625afd633d3 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -649,7 +649,7 @@ static const void *daqboard2000_find_boardinfo(struct comedi_device *dev, } static int daqboard2000_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct daq200_boardtype *board; diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 4b3bdade6596..be6277ae4abc 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -708,7 +708,7 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->flags & CMDF_PRIORITY) { dev_err(dev->class_dev, - "isa dma transfers cannot be performed with CMDF_PRIORITY, aborting\n"); + "isa dma transfers cannot be performed with CMDF_PRIORITY, aborting\n"); return -1; } diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index 219746bc7641..cdef03d09738 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -167,7 +167,7 @@ static int das16m1_ai_check_chanlist(struct comedi_device *dev, if ((i % 2) != (chan % 2)) { dev_dbg(dev->class_dev, - "even/odd channels must go have even/odd chanlist indices\n"); + "even/odd channels must go have even/odd chanlist indices\n"); return -EINVAL; } } diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index db21d2135856..2cdd8bf44b4d 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -764,7 +764,7 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->scan_begin_src == TRIG_FOLLOW) { outw(devpriv->supcsr | DT2821_SUPCSR_STRIG, - dev->iobase + DT2821_SUPCSR_REG); + dev->iobase + DT2821_SUPCSR_REG); } else { devpriv->supcsr |= DT2821_SUPCSR_XTRIG; outw(devpriv->supcsr, dev->iobase + DT2821_SUPCSR_REG); diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index 6c1e442f6c81..c241d92e7cc2 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -70,8 +70,9 @@ static int dyna_pci10xx_ai_eoc(struct comedi_device *dev, } static int dyna_pci10xx_insn_read_ai(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { struct dyna_pci10xx_private *devpriv = dev->private; int n; @@ -109,8 +110,9 @@ static int dyna_pci10xx_insn_read_ai(struct comedi_device *dev, /* analog output callback */ static int dyna_pci10xx_insn_write_ao(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { struct dyna_pci10xx_private *devpriv = dev->private; int n; @@ -132,8 +134,9 @@ static int dyna_pci10xx_insn_write_ao(struct comedi_device *dev, /* digital input bit interface */ static int dyna_pci10xx_di_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { struct dyna_pci10xx_private *devpriv = dev->private; u16 d = 0; @@ -171,7 +174,7 @@ static int dyna_pci10xx_do_insn_bits(struct comedi_device *dev, } static int dyna_pci10xx_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct dyna_pci10xx_private *devpriv; diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index 1ea168620103..ba5b7a538492 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -445,7 +445,7 @@ static int icp_multi_reset(struct comedi_device *dev) } static int icp_multi_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct icp_multi_private *devpriv; diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 2d0e60d84a32..d473e03e34f7 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -423,7 +423,7 @@ static void me4000_reset(struct comedi_device *dev) /* Set both stop bits in the analog input control register */ outl(ME4000_AI_CTRL_BIT_IMMEDIATE_STOP | ME4000_AI_CTRL_BIT_STOP, - dev->iobase + ME4000_AI_CTRL_REG); + dev->iobase + ME4000_AI_CTRL_REG); /* Set both stop bits in the analog output control register */ val = ME4000_AO_CTRL_BIT_IMMEDIATE_STOP | ME4000_AO_CTRL_BIT_STOP; @@ -437,7 +437,7 @@ static void me4000_reset(struct comedi_device *dev) /* Set the adustment register for AO demux */ outl(ME4000_AO_DEMUX_ADJUST_VALUE, - dev->iobase + ME4000_AO_DEMUX_ADJUST_REG); + dev->iobase + ME4000_AO_DEMUX_ADJUST_REG); /* * Set digital I/O direction for port 0 @@ -608,7 +608,7 @@ static int me4000_ai_check_chanlist(struct comedi_device *dev, if (!comedi_range_is_bipolar(s, range)) { dev_dbg(dev->class_dev, - "Bipolar is not selected in differential mode\n"); + "Bipolar is not selected in differential mode\n"); return -EINVAL; } } @@ -771,12 +771,12 @@ static int ai_prepare(struct comedi_device *dev, /* Stop triggers */ if (cmd->stop_src == TRIG_COUNT) { outl(cmd->chanlist_len * cmd->stop_arg, - dev->iobase + ME4000_AI_SAMPLE_COUNTER_REG); + dev->iobase + ME4000_AI_SAMPLE_COUNTER_REG); tmp |= ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ; } else if (cmd->stop_src == TRIG_NONE && cmd->scan_end_src == TRIG_COUNT) { outl(cmd->scan_end_arg, - dev->iobase + ME4000_AI_SAMPLE_COUNTER_REG); + dev->iobase + ME4000_AI_SAMPLE_COUNTER_REG); tmp |= ME4000_AI_CTRL_BIT_HF_IRQ | ME4000_AI_CTRL_BIT_SC_IRQ; } else { tmp |= ME4000_AI_CTRL_BIT_HF_IRQ; @@ -1186,13 +1186,13 @@ static int me4000_dio_insn_bits(struct comedi_device *dev, { if (comedi_dio_update_state(s, data)) { outl((s->state >> 0) & 0xFF, - dev->iobase + ME4000_DIO_PORT_0_REG); + dev->iobase + ME4000_DIO_PORT_0_REG); outl((s->state >> 8) & 0xFF, - dev->iobase + ME4000_DIO_PORT_1_REG); + dev->iobase + ME4000_DIO_PORT_1_REG); outl((s->state >> 16) & 0xFF, - dev->iobase + ME4000_DIO_PORT_2_REG); + dev->iobase + ME4000_DIO_PORT_2_REG); outl((s->state >> 24) & 0xFF, - dev->iobase + ME4000_DIO_PORT_3_REG); + dev->iobase + ME4000_DIO_PORT_3_REG); } data[1] = ((inl(dev->iobase + ME4000_DIO_PORT_0_REG) & 0xFF) << 0) | @@ -1296,7 +1296,7 @@ static int me4000_auto_attach(struct comedi_device *dev, if (pcidev->irq > 0) { result = request_irq(pcidev->irq, me4000_ai_isr, IRQF_SHARED, - dev->board_name, dev); + dev->board_name, dev); if (result == 0) dev->irq = pcidev->irq; } @@ -1378,7 +1378,7 @@ static int me4000_auto_attach(struct comedi_device *dev, if (!inl(dev->iobase + ME4000_DIO_DIR_REG)) { s->io_bits |= 0xFF; outl(ME4000_DIO_CTRL_BIT_MODE_0, - dev->iobase + ME4000_DIO_DIR_REG); + dev->iobase + ME4000_DIO_DIR_REG); } /* Counter subdevice (8254) */ diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 9d0714b802b1..1ff231f91f3b 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -676,7 +676,7 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, } dev_info(dev->class_dev, "board: %s, ID=0x%02x", dev->board_name, - readb(dev->mmio + NI_65XX_ID_REG)); + readb(dev->mmio + NI_65XX_ID_REG)); ret = comedi_alloc_subdevices(dev, 4); if (ret) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 5bb2b5e936bc..b6f8cd85c3aa 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2526,7 +2526,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) start_stop_select |= AI_START_Select(1 + CR_CHAN(cmd->scan_begin_arg)); ni_stc_writew(dev, start_stop_select, - AI_START_STOP_Select_Register); + AI_START_STOP_Select_Register); break; } diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 1a4a1f589a56..213457286031 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -568,7 +568,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) } else if (it->options[2]) { /* request the irq for the 2nd asic */ ret = request_irq(it->options[2], pcmuio_interrupt, 0, - dev->board_name, dev); + dev->board_name, dev); if (ret == 0) devpriv->irq2 = it->options[2]; } diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 2688af7f3405..20cce96d3d88 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1181,8 +1181,8 @@ static void rtd_pci_latency_quirk(struct comedi_device *dev, pci_read_config_byte(pcidev, PCI_LATENCY_TIMER, &pci_latency); if (pci_latency < 32) { dev_info(dev->class_dev, - "PCI latency changed from %d to %d\n", - pci_latency, 32); + "PCI latency changed from %d to %d\n", + pci_latency, 32); pci_write_config_byte(pcidev, PCI_LATENCY_TIMER, 32); } } diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 422ea9c73706..3b9ef9a6918b 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -231,9 +231,9 @@ static void s626_debi_replace(struct comedi_device *dev, unsigned int addr, /* ************** EEPROM ACCESS FUNCTIONS ************** */ static int s626_i2c_handshake_eoc(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned long context) { bool status; @@ -294,7 +294,7 @@ static uint8_t s626_i2c_read(struct comedi_device *dev, uint8_t addr) * Byte0 = Not sent. */ if (s626_i2c_handshake(dev, S626_I2C_B2(S626_I2C_ATTRSTART, - (devpriv->i2c_adrs | 1)) | + (devpriv->i2c_adrs | 1)) | S626_I2C_B1(S626_I2C_ATTRSTOP, 0) | S626_I2C_B0(S626_I2C_ATTRNOP, 0))) /* Abort function and declare error if handshake failed. */ @@ -517,8 +517,8 @@ static int s626_send_dac(struct comedi_device *dev, uint32_t val) /* * Private helper function: Write setpoint to an application DAC channel. */ -static int s626_set_dac(struct comedi_device *dev, uint16_t chan, - int16_t dacdata) +static int s626_set_dac(struct comedi_device *dev, + uint16_t chan, int16_t dacdata) { struct s626_private *devpriv = dev->private; uint16_t signmask; @@ -583,8 +583,8 @@ static int s626_set_dac(struct comedi_device *dev, uint16_t chan, return s626_send_dac(dev, val); } -static int s626_write_trim_dac(struct comedi_device *dev, uint8_t logical_chan, - uint8_t dac_data) +static int s626_write_trim_dac(struct comedi_device *dev, + uint8_t logical_chan, uint8_t dac_data) { struct s626_private *devpriv = dev->private; uint32_t chan; @@ -641,7 +641,7 @@ static int s626_load_trim_dacs(struct comedi_device *dev) /* Copy TrimDac setpoint values from EEPROM to TrimDacs. */ for (i = 0; i < ARRAY_SIZE(s626_trimchan); i++) { ret = s626_write_trim_dac(dev, i, - s626_i2c_read(dev, s626_trimadrs[i])); + s626_i2c_read(dev, s626_trimadrs[i])); if (ret) return ret; } @@ -2729,7 +2729,7 @@ static int s626_initialize(struct comedi_device *dev) } static int s626_auto_attach(struct comedi_device *dev, - unsigned long context_unused) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct s626_private *devpriv; diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 1cd7403a4e9c..feaa5ae53fcb 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -633,8 +633,8 @@ static int receive_dux_commands(struct comedi_device *dev, unsigned int command) for (i = 0; i < RETRIES; i++) { ret = usb_bulk_msg(usb, usb_rcvbulkpipe(usb, 8), - devpriv->insn_buf, SIZEINSNBUF, - &nrec, BULK_TIMEOUT); + devpriv->insn_buf, SIZEINSNBUF, + &nrec, BULK_TIMEOUT); if (ret < 0) return ret; if (le16_to_cpu(devpriv->insn_buf[0]) == command) -- cgit v1.2.3 From c8f4b98f47e498a823d1b82b8f3848d81183ea22 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 5 Mar 2015 13:21:17 -0700 Subject: staging: comedi: drivers/*.c: remove unnecessary blank lines Blank lines are not needed before a close brace '}' or after an open brace '{'. Also remove any multiple blank lines. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9111.c | 1 - drivers/staging/comedi/drivers/adl_pci9118.c | 1 - drivers/staging/comedi/drivers/adq12b.c | 3 --- drivers/staging/comedi/drivers/adv_pci_dio.c | 1 - drivers/staging/comedi/drivers/amplc_pc236_common.c | 1 - drivers/staging/comedi/drivers/amplc_pci224.c | 3 --- drivers/staging/comedi/drivers/cb_das16_cs.c | 2 -- drivers/staging/comedi/drivers/cb_pcidas64.c | 4 ---- drivers/staging/comedi/drivers/comedi_bond.c | 1 - drivers/staging/comedi/drivers/das1800.c | 1 - drivers/staging/comedi/drivers/das800.c | 4 ---- drivers/staging/comedi/drivers/dmm32at.c | 1 - drivers/staging/comedi/drivers/dt2801.c | 1 - drivers/staging/comedi/drivers/dt2811.c | 1 - drivers/staging/comedi/drivers/dt2814.c | 2 -- drivers/staging/comedi/drivers/dt2815.c | 1 - drivers/staging/comedi/drivers/dt282x.c | 1 - drivers/staging/comedi/drivers/gsc_hpdi.c | 1 - drivers/staging/comedi/drivers/icp_multi.c | 1 - drivers/staging/comedi/drivers/me4000.c | 9 --------- drivers/staging/comedi/drivers/mf6x4.c | 1 - drivers/staging/comedi/drivers/mpc624.c | 1 - drivers/staging/comedi/drivers/ni_660x.c | 1 - drivers/staging/comedi/drivers/ni_atmio.c | 2 -- drivers/staging/comedi/drivers/ni_atmio16d.c | 1 - drivers/staging/comedi/drivers/ni_mio_common.c | 2 -- drivers/staging/comedi/drivers/ni_pcimio.c | 1 - drivers/staging/comedi/drivers/pcl816.c | 3 --- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 1 - drivers/staging/comedi/drivers/rtd520.c | 1 - drivers/staging/comedi/drivers/serial2002.c | 3 --- drivers/staging/comedi/drivers/ssv_dnp.c | 1 - drivers/staging/comedi/drivers/unioxx5.c | 2 -- drivers/staging/comedi/drivers/usbdux.c | 1 - drivers/staging/comedi/drivers/usbduxfast.c | 1 - 35 files changed, 62 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index 144e9c2dbaf9..bf563ed08bc2 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -354,7 +354,6 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, return 5; return 0; - } static int pci9111_ai_do_cmd(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 1cd54556a2dd..65b702cc04c1 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -633,7 +633,6 @@ static void pci9118_ai_munge(struct comedi_device *dev, array[i] ^= 0x8000; else array[i] = (array[i] >> 4) & 0x0fff; - } } diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index 8b15cbec9891..bc5f97f50f9a 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -69,8 +69,6 @@ If you do not specify any options, they will default to 13-oct-2007 + first try - - */ #include @@ -170,7 +168,6 @@ static int adq12b_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - /* only bits 0-4 have information about digital inputs */ data[1] = (inb(dev->iobase + ADQ12B_STINR) & ADQ12B_STINR_IN_MASK); diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index a46cffe5f9b8..11168f9e135b 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -419,7 +419,6 @@ static int pci_dio_insn_bits_di_b(struct comedi_device *dev, for (i = 0; i < d->regs; i++) data[1] |= inb(dev->iobase + d->addr + i) << (8 * i); - return insn->n; } diff --git a/drivers/staging/comedi/drivers/amplc_pc236_common.c b/drivers/staging/comedi/drivers/amplc_pc236_common.c index be87172d1f3f..cc26b9d04d66 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236_common.c +++ b/drivers/staging/comedi/drivers/amplc_pc236_common.c @@ -195,7 +195,6 @@ static void __exit amplc_pc236_common_exit(void) } module_exit(amplc_pc236_common_exit); - MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi helper for amplc_pc236 and amplc_pci236"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 8ac35f9fc69f..cf5f646e514e 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -446,7 +446,6 @@ static void pci224_ao_stop(struct comedi_device *dev, if (!test_and_clear_bit(AO_CMD_STARTED, &devpriv->state)) return; - spin_lock_irqsave(&devpriv->ao_spinlock, flags); /* Kill the interrupts. */ devpriv->intsce = 0; @@ -1029,14 +1028,12 @@ pci224_auto_attach(struct comedi_device *dev, unsigned long context_model) if (!devpriv->ao_scan_vals) return -ENOMEM; - /* Allocate buffer to hold AO channel scan order. */ devpriv->ao_scan_order = kmalloc(sizeof(devpriv->ao_scan_order[0]) * thisboard->ao_chans, GFP_KERNEL); if (!devpriv->ao_scan_order) return -ENOMEM; - /* Disable interrupt sources. */ devpriv->intsce = 0; outb(0, devpriv->iobase1 + PCI224_INT_SCE); diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 9c7242d81963..9abc2c795479 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -30,8 +30,6 @@ Devices: [ComputerBoards] PC-CARD DAS16/16 (cb_das16_cs), PC-CARD DAS16/16-AO Author: ds Updated: Mon, 04 Nov 2002 20:04:21 -0800 Status: experimental - - */ #include diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index c8f4a227cc59..5033c7cddda2 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1475,7 +1475,6 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) &devpriv->ai_buffer_bus_addr[i]); if (!devpriv->ai_buffer[i]) return -ENOMEM; - } for (i = 0; i < AO_DMA_RING_COUNT; i++) { if (ao_cmd_is_supported(thisboard)) { @@ -1485,7 +1484,6 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) ao_buffer_bus_addr[i]); if (!devpriv->ao_buffer[i]) return -ENOMEM; - } } /* allocate dma descriptors */ @@ -1838,7 +1836,6 @@ static int ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, } for (n = 0; n < insn->n; n++) { - /* clear adc buffer (inside loop for 4020 sake) */ writew(0, devpriv->main_iobase + ADC_BUFFER_CLEAR_REG); @@ -1900,7 +1897,6 @@ static int ai_config_block_size(struct comedi_device *dev, unsigned int *data) retval = set_ai_fifo_size(dev, fifo_size); if (retval < 0) return retval; - } block_size = ai_fifo_size(dev) / fifo->num_segments * bytes_in_sample; diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index 7a68727cc880..96db0c2686a1 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -267,7 +267,6 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it) strlcat(devpriv->name, buf, sizeof(devpriv->name)); } - } } diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index ca4f322c0d2f..0a93ae93da93 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -1141,7 +1141,6 @@ static int das1800_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - data[1] = inb(dev->iobase + DAS1800_DIGITAL) & 0xf; data[0] = 0; diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 50ca03bd6459..ece3e56a72bb 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -43,8 +43,6 @@ Notes: The cio-das802/16 does not have a fifo-empty status bit! Therefore only fifo-half-full transfers are possible with this card. -*/ -/* cmd triggers supported: start_src: TRIG_NOW | TRIG_EXT @@ -52,8 +50,6 @@ cmd triggers supported: scan_end_src: TRIG_COUNT convert_src: TRIG_TIMER | TRIG_EXT stop_src: TRIG_NONE | TRIG_COUNT - - */ #include diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 74830f4b95f5..094422f81d4c 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -397,7 +397,6 @@ static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } return 0; - } static int dmm32at_ai_cancel(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index 7e565fc944c4..80e38dedd359 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -126,7 +126,6 @@ static const struct comedi_lrange range_dt2801_ai_pgl_unipolar = { }; struct dt2801_board { - const char *name; int boardcode; int ad_diff; diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index d660f277487e..a80773291fdc 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -194,7 +194,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { #define DT2811_ADMODE 0x03 struct dt2811_board { - const char *name; const struct comedi_lrange *bip_5; const struct comedi_lrange *bip_2_5; diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index 9805be13005a..5a20be569011 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -56,7 +56,6 @@ addition, the clock does not seem to be very accurate. #define DT2814_CHANMASK 0x0f struct dt2814_private { - int ntrig; int curadchan; }; @@ -193,7 +192,6 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outb(chan | DT2814_ENB | (trigvar << 5), dev->iobase + DT2814_CSR); return 0; - } static irqreturn_t dt2814_interrupt(int irq, void *d) diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c index a98fb66fdd53..fb08569c1ac1 100644 --- a/drivers/staging/comedi/drivers/dt2815.c +++ b/drivers/staging/comedi/drivers/dt2815.c @@ -60,7 +60,6 @@ Configuration options: #define DT2815_STATUS 1 struct dt2815_private { - const struct comedi_lrange *range_type_list[8]; unsigned int ao_readback[8]; }; diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 2cdd8bf44b4d..52a50bc3343a 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -874,7 +874,6 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, return 4; return 0; - } static int dt282x_ao_inttrig(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index deada9784b69..be9988d37338 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -433,7 +433,6 @@ static int gsc_hpdi_cmd_test(struct comedi_device *dev, return 5; return 0; - } /* setup dma descriptors so a link completes every 'len' bytes */ diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index ba5b7a538492..ddcb25df9c51 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -370,7 +370,6 @@ static irqreturn_t interrupt_service_icp_multi(int irq, void *d) break; default: break; - } return IRQ_HANDLED; diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index d473e03e34f7..ec99254b3a64 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -623,7 +623,6 @@ static int ai_round_cmd_args(struct comedi_device *dev, unsigned int *init_ticks, unsigned int *scan_ticks, unsigned int *chan_ticks) { - int rest; *init_ticks = 0; @@ -730,7 +729,6 @@ static int ai_prepare(struct comedi_device *dev, unsigned int init_ticks, unsigned int scan_ticks, unsigned int chan_ticks) { - unsigned int tmp = 0; /* Write timer arguments */ @@ -826,7 +824,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - unsigned int init_ticks; unsigned int chan_ticks; unsigned int scan_ticks; @@ -918,7 +915,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, if (cmd->start_src == TRIG_NOW && cmd->scan_begin_src == TRIG_TIMER && cmd->convert_src == TRIG_TIMER) { - /* Check timer arguments */ if (init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); @@ -940,7 +936,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, } else if (cmd->start_src == TRIG_NOW && cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_TIMER) { - /* Check timer arguments */ if (init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); @@ -955,7 +950,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_TIMER && cmd->convert_src == TRIG_TIMER) { - /* Check timer arguments */ if (init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); @@ -977,7 +971,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_TIMER) { - /* Check timer arguments */ if (init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); @@ -992,7 +985,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_EXT && cmd->convert_src == TRIG_TIMER) { - /* Check timer arguments */ if (init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); @@ -1007,7 +999,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, } else if (cmd->start_src == TRIG_EXT && cmd->scan_begin_src == TRIG_EXT && cmd->convert_src == TRIG_EXT) { - /* Check timer arguments */ if (init_ticks < ME4000_AI_MIN_TICKS) { dev_err(dev->class_dev, "Invalid start arg\n"); diff --git a/drivers/staging/comedi/drivers/mf6x4.c b/drivers/staging/comedi/drivers/mf6x4.c index db972bce2b5b..e9a74ca8f7e9 100644 --- a/drivers/staging/comedi/drivers/mf6x4.c +++ b/drivers/staging/comedi/drivers/mf6x4.c @@ -237,7 +237,6 @@ static int mf6x4_auto_attach(struct comedi_device *dev, unsigned long context) else devpriv->gpioc_R = devpriv->bar0_mem + MF624_GPIOC_R; - ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; diff --git a/drivers/staging/comedi/drivers/mpc624.c b/drivers/staging/comedi/drivers/mpc624.c index 1241f9987cab..0207b8edfcb4 100644 --- a/drivers/staging/comedi/drivers/mpc624.c +++ b/drivers/staging/comedi/drivers/mpc624.c @@ -115,7 +115,6 @@ Configuration Options: (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) /* -------------------------------------------------------------------------- */ struct mpc624_private { - /* set by mpc624_attach() from driver's parameters */ unsigned long int ulConvertionRate; }; diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 9d7567bf1ce3..660dc6fc777e 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -195,7 +195,6 @@ static inline unsigned NI_660X_GPCT_SUBDEV(unsigned index) } struct NI_660xRegisterData { - const char *name; /* Register Name */ int offset; /* Offset from base address from GPCT chip */ enum ni_660x_register_direction direction; diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c index 9cb9beb53e16..1304b06980a6 100644 --- a/drivers/staging/comedi/drivers/ni_atmio.c +++ b/drivers/staging/comedi/drivers/ni_atmio.c @@ -282,7 +282,6 @@ static int ni_getboardtype(struct comedi_device *dev) for (i = 0; i < ARRAY_SIZE(ni_boards); i++) { if (ni_boards[i].device_id == device_id) return i; - } if (device_id == 255) dev_err(dev->class_dev, "can't find board\n"); @@ -355,7 +354,6 @@ static int ni_atmio_attach(struct comedi_device *dev, if (ret < 0) return ret; - return 0; } diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index c484c89c94b5..73e580243795 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -96,7 +96,6 @@ Devices: [National Instruments] AT-MIO-16 (atmio16), AT-MIO-16D (atmio16d) #define CLOCK_100_HZ 0x8F25 struct atmio16_board_t { - const char *name; int has_8255; }; diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index b6f8cd85c3aa..4aa8a2cef4d1 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2569,7 +2569,6 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } if (dev->irq) { - /* interrupt on FIFO, errors, SC_TC */ interrupt_a_enable |= AI_Error_Interrupt_Enable | AI_SC_TC_Interrupt_Enable; @@ -3839,7 +3838,6 @@ static int ni_serial_insn_config(struct comedi_device *dev, default: return -EINVAL; } - } static void init_ao_67xx(struct comedi_device *dev, struct comedi_subdevice *s) diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index e78739cce175..409090d78cc4 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -1041,7 +1041,6 @@ static int pcimio_dio_change(struct comedi_device *dev, return 0; } - static void m_series_init_eeprom_buffer(struct comedi_device *dev) { struct ni_private *devpriv = dev->private; diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 9cc6933d47da..992a38c81d0f 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -369,7 +369,6 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, if (err) return 2; - /* Step 3: check if arguments are trivially valid */ err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); @@ -390,7 +389,6 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, if (err) return 3; - /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { unsigned int arg = cmd->convert_arg; @@ -402,7 +400,6 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, if (err) return 4; - /* step 5: complain about special chanlist considerations */ if (cmd->chanlist) { diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 8387fd0e4b7e..aa8653465771 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -315,7 +315,6 @@ static int daqp_ai_insn_read(struct comedi_device *dev, devpriv->interrupt_mode = semaphore; for (i = 0; i < insn->n; i++) { - /* Start conversion */ outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA, dev->iobase + DAQP_COMMAND); diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 20cce96d3d88..f05b187c33aa 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -839,7 +839,6 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, if (err) return 3; - /* step 4: fix up any arguments */ if (cmd->scan_begin_src == TRIG_TIMER) { diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index 71226ee9064e..482a2a8a4a57 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -39,14 +39,12 @@ Status: in development #include struct serial2002_range_table_t { - /* HACK... */ int length; struct comedi_krange range; }; struct serial2002_private { - int port; /* /dev/ttyS */ int speed; /* baudrate */ struct file *tty; @@ -300,7 +298,6 @@ static struct serial_data serial2002_read(struct file *f, int timeout) } } return result; - } static void serial2002_write(struct file *f, struct serial_data data) diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 848c30801580..acc7f3445c58 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -127,7 +127,6 @@ static int dnp_dio_insn_config(struct comedi_device *dev, outb(val, CSCDR); return insn->n; - } static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c index 12d828063c06..f5606b26a501 100644 --- a/drivers/staging/comedi/drivers/unioxx5.c +++ b/drivers/staging/comedi/drivers/unioxx5.c @@ -38,7 +38,6 @@ Devices: [Fastwel] UNIOxx-5 (unioxx5), */ - #include #include #include "../comedidev.h" @@ -81,7 +80,6 @@ struct unioxx5_subd_priv { static int __unioxx5_define_chan_offset(int chan_num) { - if (chan_num < 0 || chan_num > 23) return -1; diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index feaa5ae53fcb..a6403d2d2c08 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -1041,7 +1041,6 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct usbdux_private *devpriv = dev->private; int ret; diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 7ce27c16c2f9..50c47af5f0ac 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -419,7 +419,6 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ return 0; - } static int usbduxfast_ai_inttrig(struct comedi_device *dev, -- cgit v1.2.3 From 6ac986d098ee81b75973a0c2f46a9a4edef2a8c6 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 5 Mar 2015 13:21:18 -0700 Subject: staging: comedi: drivers/*.c: add missing braces {} to if/else branches According to the CodingStyle, braces should be used on all branches if thet are used on any branch, Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas.c | 3 ++- drivers/staging/comedi/drivers/cb_pcidas64.c | 21 ++++++++++++++------- drivers/staging/comedi/drivers/ni_mio_common.c | 6 ++++-- drivers/staging/comedi/drivers/ni_pcidio.c | 3 ++- drivers/staging/comedi/drivers/unioxx5.c | 3 ++- 5 files changed, 24 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 112627d24d41..6fdf975daa19 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -1508,8 +1508,9 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, dac08_write(dev, s->maxdata / 2); s->readback[i] = s->maxdata / 2; } - } else + } else { s->type = COMEDI_SUBD_UNUSED; + } /* make sure mailbox 4 is empty */ inl(devpriv->s5933_config + AMCC_OP_REG_IMB4); diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 5033c7cddda2..2b7c50aa1e39 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -2630,8 +2630,9 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) bits |= ADC_START_TRIG_EXT_BITS; if (cmd->start_arg & CR_INVERT) bits |= ADC_START_TRIG_FALLING_BIT; - } else if (cmd->start_src == TRIG_NOW) + } else if (cmd->start_src == TRIG_NOW) { bits |= ADC_START_TRIG_SOFT_BITS; + } if (use_hw_sample_counter(cmd)) bits |= ADC_SAMPLE_COUNTER_EN_BIT; writew(bits, devpriv->main_iobase + ADC_CONTROL0_REG); @@ -2820,8 +2821,9 @@ static void handle_ai_interrupt(struct comedi_device *dev, if (devpriv->ai_cmd_running) { spin_unlock_irqrestore(&dev->spinlock, flags); pio_drain_ai_fifo(dev); - } else + } else { spin_unlock_irqrestore(&dev->spinlock, flags); + } } /* if we are have all the data, then quit */ if ((cmd->stop_src == TRIG_COUNT && @@ -3810,8 +3812,9 @@ static int setup_subdevices(struct comedi_device *dev) s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = di_rbits; - } else + } else { s->type = COMEDI_SUBD_UNUSED; + } /* digital output */ if (thisboard->layout == LAYOUT_64XX) { @@ -3822,8 +3825,9 @@ static int setup_subdevices(struct comedi_device *dev) s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = do_wbits; - } else + } else { s->type = COMEDI_SUBD_UNUSED; + } /* 8255 */ s = &dev->subdevices[4]; @@ -3851,8 +3855,9 @@ static int setup_subdevices(struct comedi_device *dev) s->range_table = &range_digital; s->insn_config = dio_60xx_config_insn; s->insn_bits = dio_60xx_wbits; - } else + } else { s->type = COMEDI_SUBD_UNUSED; + } /* caldac */ s = &dev->subdevices[6]; @@ -3891,8 +3896,9 @@ static int setup_subdevices(struct comedi_device *dev) ad8402_write(dev, i, s->maxdata / 2); s->readback[i] = s->maxdata / 2; } - } else + } else { s->type = COMEDI_SUBD_UNUSED; + } /* serial EEPROM, if present */ s = &dev->subdevices[8]; @@ -3902,8 +3908,9 @@ static int setup_subdevices(struct comedi_device *dev) s->n_chan = 128; s->maxdata = 0xffff; s->insn_read = eeprom_read_insn; - } else + } else { s->type = COMEDI_SUBD_UNUSED; + } /* user counter subd XXX */ s = &dev->subdevices[9]; diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 4aa8a2cef4d1..42fdedd6943c 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -1700,8 +1700,9 @@ static int ni_ao_setup_MITE_dma(struct comedi_device *dev) mite_prep_dma(devpriv->ao_mite_chan, 16, 32); } mite_dma_arm(devpriv->ao_mite_chan); - } else + } else { retval = -EIO; + } spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); return retval; @@ -4961,8 +4962,9 @@ static int ni_set_master_clock(struct comedi_device *dev, } devpriv->clock_ns = period_ns; devpriv->clock_source = source; - } else + } else { return -EINVAL; + } } } return 3; diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 8d91029c7d30..28523199f7de 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -354,8 +354,9 @@ static int setup_mite_dma(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->di_mite_chan) { mite_prep_dma(devpriv->di_mite_chan, 32, 32); mite_dma_arm(devpriv->di_mite_chan); - } else + } else { retval = -EIO; + } spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); return retval; diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c index f5606b26a501..51498b889c6c 100644 --- a/drivers/staging/comedi/drivers/unioxx5.c +++ b/drivers/staging/comedi/drivers/unioxx5.c @@ -411,8 +411,9 @@ static int __unioxx5_subdev_init(struct comedi_device *dev, if (ndef_flag) { usp->usp_module_type[i] = 0; ndef_flag = 0; - } else + } else { usp->usp_module_type[i] = inb(iobase + 6); + } udelay(1); } -- cgit v1.2.3 From 6301647b1873250cb8aac18e02a4ea062e72278e Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 2 Mar 2015 01:01:46 -0500 Subject: staging/lustre/ptlrpc: Do not use deprecated cpus_* functions As per Rusty Russel, cpus_* functions are deprecated. When mixing cpumask_copy with cpus_weight, they operate on different sized masks if CPUMASK_OFFSTACK is enabled, causing an immediate assertion failure. Copying of cpumasks by assignment is also not allowed now. Additionally, in ptlrpc/service.c avoid the cpumask copies, since we only use it to check how many siblings are there for core #0 and nothing else. Reported-by: Tyson Whitehead Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 8 ++++---- drivers/staging/lustre/lustre/ptlrpc/service.c | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 8f7be84aa187..0c178ec0e487 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -511,10 +511,10 @@ static int ptlrpcd_bind(int index, int max) #if defined(CONFIG_NUMA) { int i; - mask = *cpumask_of_node(cpu_to_node(index)); + cpumask_copy(&mask, cpumask_of_node(cpu_to_node(index))); for (i = max; i < num_online_cpus(); i++) - cpu_clear(i, mask); - pc->pc_npartners = cpus_weight(mask) - 1; + cpumask_clear_cpu(i, &mask); + pc->pc_npartners = cpumask_weight(&mask) - 1; set_bit(LIOD_BIND, &pc->pc_flags); } #else @@ -554,7 +554,7 @@ static int ptlrpcd_bind(int index, int max) * that are already initialized */ for (pidx = 0, i = 0; i < index; i++) { - if (cpu_isset(i, mask)) { + if (cpumask_test_cpu(i, &mask)) { ppc = &ptlrpcds->pd_threads[i]; pc->pc_partners[pidx++] = ppc; ppc->pc_partners[ppc-> diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 635b12b22cef..8e61421515cb 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -543,7 +543,6 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, if (tc->tc_thr_factor != 0) { int factor = tc->tc_thr_factor; const int fade = 4; - cpumask_t mask; /* * User wants to increase number of threads with for @@ -557,8 +556,8 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, * have too many threads no matter how many cores/HTs * there are. */ - cpumask_copy(&mask, topology_thread_cpumask(0)); - if (cpus_weight(mask) > 1) { /* weight is # of HTs */ + /* weight is # of HTs */ + if (cpumask_weight(topology_thread_cpumask(0)) > 1) { /* depress thread factor for hyper-thread */ factor = factor - (factor >> 1) + (factor >> 3); } @@ -2752,7 +2751,6 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait) int ptlrpc_hr_init(void) { - cpumask_t mask; struct ptlrpc_hr_partition *hrp; struct ptlrpc_hr_thread *hrt; int rc; @@ -2770,8 +2768,7 @@ int ptlrpc_hr_init(void) init_waitqueue_head(&ptlrpc_hr.hr_waitq); - cpumask_copy(&mask, topology_thread_cpumask(0)); - weight = cpus_weight(mask); + weight = cpumask_weight(topology_thread_cpumask(0)); cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) { hrp->hrp_cpt = i; -- cgit v1.2.3 From c96d236f8f4d479d25cb493c8ec240f7129709ca Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 2 Mar 2015 01:01:47 -0500 Subject: staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_ Rusty Russel advises that cpus_* functions are deprecated to work on cpumasks and cpumask_* functions should be called instead, otherwise problems with CPUMASK_OFFSTACK arise. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 78 +++++++++++----------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index 05f7595f18aa..1eeacefef52c 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -240,8 +240,8 @@ cfs_cpt_weight(struct cfs_cpt_table *cptab, int cpt) LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts)); return cpt == CFS_CPT_ANY ? - cpus_weight(*cptab->ctb_cpumask) : - cpus_weight(*cptab->ctb_parts[cpt].cpt_cpumask); + cpumask_weight(cptab->ctb_cpumask) : + cpumask_weight(cptab->ctb_parts[cpt].cpt_cpumask); } EXPORT_SYMBOL(cfs_cpt_weight); @@ -251,8 +251,8 @@ cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt) LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts)); return cpt == CFS_CPT_ANY ? - any_online_cpu(*cptab->ctb_cpumask) != NR_CPUS : - any_online_cpu(*cptab->ctb_parts[cpt].cpt_cpumask) != NR_CPUS; + any_online_cpu(*cptab->ctb_cpumask) < nr_cpu_ids : + any_online_cpu(*cptab->ctb_parts[cpt].cpt_cpumask) < nr_cpu_ids; } EXPORT_SYMBOL(cfs_cpt_online); @@ -283,7 +283,7 @@ cfs_cpt_set_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu) LASSERT(cpt >= 0 && cpt < cptab->ctb_nparts); - if (cpu < 0 || cpu >= NR_CPUS || !cpu_online(cpu)) { + if (cpu < 0 || cpu >= nr_cpu_ids || !cpu_online(cpu)) { CDEBUG(D_INFO, "CPU %d is invalid or it's offline\n", cpu); return 0; } @@ -296,11 +296,11 @@ cfs_cpt_set_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu) cptab->ctb_cpu2cpt[cpu] = cpt; - LASSERT(!cpu_isset(cpu, *cptab->ctb_cpumask)); - LASSERT(!cpu_isset(cpu, *cptab->ctb_parts[cpt].cpt_cpumask)); + LASSERT(!cpumask_test_cpu(cpu, cptab->ctb_cpumask)); + LASSERT(!cpumask_test_cpu(cpu, cptab->ctb_parts[cpt].cpt_cpumask)); - cpu_set(cpu, *cptab->ctb_cpumask); - cpu_set(cpu, *cptab->ctb_parts[cpt].cpt_cpumask); + cpumask_set_cpu(cpu, cptab->ctb_cpumask); + cpumask_set_cpu(cpu, cptab->ctb_parts[cpt].cpt_cpumask); node = cpu_to_node(cpu); @@ -324,7 +324,7 @@ cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu) LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts)); - if (cpu < 0 || cpu >= NR_CPUS) { + if (cpu < 0 || cpu >= nr_cpu_ids) { CDEBUG(D_INFO, "Invalid CPU id %d\n", cpu); return; } @@ -344,11 +344,11 @@ cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu) return; } - LASSERT(cpu_isset(cpu, *cptab->ctb_parts[cpt].cpt_cpumask)); - LASSERT(cpu_isset(cpu, *cptab->ctb_cpumask)); + LASSERT(cpumask_test_cpu(cpu, cptab->ctb_parts[cpt].cpt_cpumask)); + LASSERT(cpumask_test_cpu(cpu, cptab->ctb_cpumask)); - cpu_clear(cpu, *cptab->ctb_parts[cpt].cpt_cpumask); - cpu_clear(cpu, *cptab->ctb_cpumask); + cpumask_clear_cpu(cpu, cptab->ctb_parts[cpt].cpt_cpumask); + cpumask_clear_cpu(cpu, cptab->ctb_cpumask); cptab->ctb_cpu2cpt[cpu] = -1; node = cpu_to_node(cpu); @@ -383,7 +383,7 @@ cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt, cpumask_t *mask) { int i; - if (cpus_weight(*mask) == 0 || any_online_cpu(*mask) == NR_CPUS) { + if (cpumask_weight(mask) == 0 || any_online_cpu(*mask) >= nr_cpu_ids) { CDEBUG(D_INFO, "No online CPU is found in the CPU mask for CPU partition %d\n", cpt); return 0; @@ -554,7 +554,7 @@ EXPORT_SYMBOL(cfs_cpt_current); int cfs_cpt_of_cpu(struct cfs_cpt_table *cptab, int cpu) { - LASSERT(cpu >= 0 && cpu < NR_CPUS); + LASSERT(cpu >= 0 && cpu < nr_cpu_ids); return cptab->ctb_cpu2cpt[cpu]; } @@ -578,14 +578,14 @@ cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt) nodemask = cptab->ctb_parts[cpt].cpt_nodemask; } - if (any_online_cpu(*cpumask) == NR_CPUS) { + if (any_online_cpu(*cpumask) >= nr_cpu_ids) { CERROR("No online CPU found in CPU partition %d, did someone do CPU hotplug on system? You might need to reload Lustre modules to keep system working well.\n", cpt); return -EINVAL; } for_each_online_cpu(i) { - if (cpu_isset(i, *cpumask)) + if (cpumask_test_cpu(i, cpumask)) continue; rc = set_cpus_allowed_ptr(current, cpumask); @@ -616,14 +616,14 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, LASSERT(number > 0); - if (number >= cpus_weight(*node)) { - while (!cpus_empty(*node)) { - cpu = first_cpu(*node); + if (number >= cpumask_weight(node)) { + while (!cpumask_empty(node)) { + cpu = cpumask_first(node); rc = cfs_cpt_set_cpu(cptab, cpt, cpu); if (!rc) return -EINVAL; - cpu_clear(cpu, *node); + cpumask_clear_cpu(cpu, node); } return 0; } @@ -636,27 +636,27 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, goto out; } - while (!cpus_empty(*node)) { - cpu = first_cpu(*node); + while (!cpumask_empty(node)) { + cpu = cpumask_first(node); /* get cpumask for cores in the same socket */ cfs_cpu_core_siblings(cpu, socket); - cpus_and(*socket, *socket, *node); + cpumask_and(socket, socket, node); - LASSERT(!cpus_empty(*socket)); + LASSERT(!cpumask_empty(socket)); - while (!cpus_empty(*socket)) { + while (!cpumask_empty(socket)) { int i; /* get cpumask for hts in the same core */ cfs_cpu_ht_siblings(cpu, core); - cpus_and(*core, *core, *node); + cpumask_and(core, core, node); - LASSERT(!cpus_empty(*core)); + LASSERT(!cpumask_empty(core)); for_each_cpu_mask(i, *core) { - cpu_clear(i, *socket); - cpu_clear(i, *node); + cpumask_clear_cpu(i, socket); + cpumask_clear_cpu(i, node); rc = cfs_cpt_set_cpu(cptab, cpt, i); if (!rc) { @@ -667,7 +667,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, if (--number == 0) goto out; } - cpu = first_cpu(*socket); + cpu = cpumask_first(socket); } } @@ -767,7 +767,7 @@ cfs_cpt_table_create(int ncpt) for_each_online_node(i) { cfs_node_to_cpumask(i, mask); - while (!cpus_empty(*mask)) { + while (!cpumask_empty(mask)) { struct cfs_cpu_partition *part; int n; @@ -776,24 +776,24 @@ cfs_cpt_table_create(int ncpt) part = &cptab->ctb_parts[cpt]; - n = num - cpus_weight(*part->cpt_cpumask); + n = num - cpumask_weight(part->cpt_cpumask); LASSERT(n > 0); rc = cfs_cpt_choose_ncpus(cptab, cpt, mask, n); if (rc < 0) goto failed; - LASSERT(num >= cpus_weight(*part->cpt_cpumask)); - if (num == cpus_weight(*part->cpt_cpumask)) + LASSERT(num >= cpumask_weight(part->cpt_cpumask)); + if (num == cpumask_weight(part->cpt_cpumask)) cpt++; } } if (cpt != ncpt || - num != cpus_weight(*cptab->ctb_parts[ncpt - 1].cpt_cpumask)) { + num != cpumask_weight(cptab->ctb_parts[ncpt - 1].cpt_cpumask)) { CERROR("Expect %d(%d) CPU partitions but got %d(%d), CPU hotplug/unplug while setting?\n", cptab->ctb_nparts, num, cpt, - cpus_weight(*cptab->ctb_parts[ncpt - 1].cpt_cpumask)); + cpumask_weight(cptab->ctb_parts[ncpt - 1].cpt_cpumask)); goto failed; } @@ -845,7 +845,7 @@ cfs_cpt_table_create_pattern(char *pattern) return NULL; } - high = node ? MAX_NUMNODES - 1 : NR_CPUS - 1; + high = node ? MAX_NUMNODES - 1 : nr_cpu_ids - 1; cptab = cfs_cpt_table_alloc(ncpt); if (cptab == NULL) { -- cgit v1.2.3 From 804db5d06d549119b885443d9b2dc2da7d80f149 Mon Sep 17 00:00:00 2001 From: Alberto Pires de Oliveira Neto Date: Mon, 2 Mar 2015 21:09:48 -0300 Subject: staging: lustre: space prohibited between function name and open parenthesis '(' This patch fixes checkpatch.pl warning. WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Alberto Pires de Oliveira Neto Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index f3e9154afdc2..22e0d94bb0f8 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -279,7 +279,7 @@ EXPORT_SYMBOL(fld_client_del_target); static struct proc_dir_entry *fld_type_proc_dir; -#if defined (CONFIG_PROC_FS) +#if defined(CONFIG_PROC_FS) static int fld_client_proc_init(struct lu_client_fld *fld) { int rc; -- cgit v1.2.3 From 87643abf92484074937594897145bb53efc0e77e Mon Sep 17 00:00:00 2001 From: Matthew Tyler Date: Fri, 6 Mar 2015 18:09:27 +0800 Subject: staging:lustre:libcfs: Merge linux-proc.c into module.c module.c was previously the sole exporter of symbols from linux-proc.c This patch removes the global symbols by merging the two files Signed-off-by: Matthew Tyler Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/Makefile | 2 +- .../lustre/lustre/libcfs/linux/linux-proc.c | 577 --------------------- drivers/staging/lustre/lustre/libcfs/module.c | 561 +++++++++++++++++++- 3 files changed, 548 insertions(+), 592 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/Makefile b/drivers/staging/lustre/lustre/libcfs/Makefile index fcecbd2271af..2996a48a31fb 100644 --- a/drivers/staging/lustre/lustre/libcfs/Makefile +++ b/drivers/staging/lustre/lustre/libcfs/Makefile @@ -3,7 +3,7 @@ obj-$(CONFIG_LUSTRE_FS) += libcfs.o libcfs-linux-objs := linux-tracefile.o linux-debug.o libcfs-linux-objs += linux-prim.o linux-cpu.o libcfs-linux-objs += linux-tcpip.o -libcfs-linux-objs += linux-proc.o linux-curproc.o +libcfs-linux-objs += linux-curproc.o libcfs-linux-objs += linux-module.o libcfs-linux-objs += linux-crypto.o libcfs-linux-objs += linux-crypto-adler.o diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c deleted file mode 100644 index 3100cb138548..000000000000 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c +++ /dev/null @@ -1,577 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2011, 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * libcfs/libcfs/linux/linux-proc.c - * - * Author: Zach Brown - * Author: Peter J. Braam - * Author: Phil Schwan - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -# define DEBUG_SUBSYSTEM S_LNET - -#include "../../../include/linux/libcfs/libcfs.h" -#include -#include "../tracefile.h" - -static struct ctl_table_header *lnet_table_header = NULL; -extern char lnet_upcall[1024]; -/** - * The path of debug log dump upcall script. - */ -extern char lnet_debug_log_upcall[1024]; - -#define CTL_LNET (0x100) -enum { - PSDEV_DEBUG = 1, /* control debugging */ - PSDEV_SUBSYSTEM_DEBUG, /* control debugging */ - PSDEV_PRINTK, /* force all messages to console */ - PSDEV_CONSOLE_RATELIMIT, /* ratelimit console messages */ - PSDEV_CONSOLE_MAX_DELAY_CS, /* maximum delay over which we skip messages */ - PSDEV_CONSOLE_MIN_DELAY_CS, /* initial delay over which we skip messages */ - PSDEV_CONSOLE_BACKOFF, /* delay increase factor */ - PSDEV_DEBUG_PATH, /* crashdump log location */ - PSDEV_DEBUG_DUMP_PATH, /* crashdump tracelog location */ - PSDEV_CPT_TABLE, /* information about cpu partitions */ - PSDEV_LNET_UPCALL, /* User mode upcall script */ - PSDEV_LNET_MEMUSED, /* bytes currently PORTAL_ALLOCated */ - PSDEV_LNET_CATASTROPHE, /* if we have LBUGged or panic'd */ - PSDEV_LNET_PANIC_ON_LBUG, /* flag to panic on LBUG */ - PSDEV_LNET_DUMP_KERNEL, /* snapshot kernel debug buffer to file */ - PSDEV_LNET_DAEMON_FILE, /* spool kernel debug buffer to file */ - PSDEV_LNET_DEBUG_MB, /* size of debug buffer */ - PSDEV_LNET_DEBUG_LOG_UPCALL, /* debug log upcall script */ - PSDEV_LNET_WATCHDOG_RATELIMIT, /* ratelimit watchdog messages */ - PSDEV_LNET_FORCE_LBUG, /* hook to force an LBUG */ - PSDEV_LNET_FAIL_LOC, /* control test failures instrumentation */ - PSDEV_LNET_FAIL_VAL, /* userdata for fail loc */ -}; - -static int proc_call_handler(void *data, int write, loff_t *ppos, - void __user *buffer, size_t *lenp, - int (*handler)(void *data, int write, - loff_t pos, void __user *buffer, int len)) -{ - int rc = handler(data, write, *ppos, buffer, *lenp); - - if (rc < 0) - return rc; - - if (write) { - *ppos += *lenp; - } else { - *lenp = rc; - *ppos += rc; - } - return 0; -} - -static int __proc_dobitmasks(void *data, int write, - loff_t pos, void __user *buffer, int nob) -{ - const int tmpstrlen = 512; - char *tmpstr; - int rc; - unsigned int *mask = data; - int is_subsys = (mask == &libcfs_subsystem_debug) ? 1 : 0; - int is_printk = (mask == &libcfs_printk) ? 1 : 0; - - rc = cfs_trace_allocate_string_buffer(&tmpstr, tmpstrlen); - if (rc < 0) - return rc; - - if (!write) { - libcfs_debug_mask2str(tmpstr, tmpstrlen, *mask, is_subsys); - rc = strlen(tmpstr); - - if (pos >= rc) { - rc = 0; - } else { - rc = cfs_trace_copyout_string(buffer, nob, - tmpstr + pos, "\n"); - } - } else { - rc = cfs_trace_copyin_string(tmpstr, tmpstrlen, buffer, nob); - if (rc < 0) { - cfs_trace_free_string_buffer(tmpstr, tmpstrlen); - return rc; - } - - rc = libcfs_debug_str2mask(mask, tmpstr, is_subsys); - /* Always print LBUG/LASSERT to console, so keep this mask */ - if (is_printk) - *mask |= D_EMERG; - } - - cfs_trace_free_string_buffer(tmpstr, tmpstrlen); - return rc; -} - -static int proc_dobitmasks(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - return proc_call_handler(table->data, write, ppos, buffer, lenp, - __proc_dobitmasks); -} - -static int min_watchdog_ratelimit; /* disable ratelimiting */ -static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */ - -static int __proc_dump_kernel(void *data, int write, - loff_t pos, void __user *buffer, int nob) -{ - if (!write) - return 0; - - return cfs_trace_dump_debug_buffer_usrstr(buffer, nob); -} - -static int proc_dump_kernel(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - return proc_call_handler(table->data, write, ppos, buffer, lenp, - __proc_dump_kernel); -} - -static int __proc_daemon_file(void *data, int write, - loff_t pos, void __user *buffer, int nob) -{ - if (!write) { - int len = strlen(cfs_tracefile); - - if (pos >= len) - return 0; - - return cfs_trace_copyout_string(buffer, nob, - cfs_tracefile + pos, "\n"); - } - - return cfs_trace_daemon_command_usrstr(buffer, nob); -} - -static int proc_daemon_file(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - return proc_call_handler(table->data, write, ppos, buffer, lenp, - __proc_daemon_file); -} - -static int __proc_debug_mb(void *data, int write, - loff_t pos, void __user *buffer, int nob) -{ - if (!write) { - char tmpstr[32]; - int len = snprintf(tmpstr, sizeof(tmpstr), "%d", - cfs_trace_get_debug_mb()); - - if (pos >= len) - return 0; - - return cfs_trace_copyout_string(buffer, nob, tmpstr + pos, - "\n"); - } - - return cfs_trace_set_debug_mb_usrstr(buffer, nob); -} - -static int proc_debug_mb(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - return proc_call_handler(table->data, write, ppos, buffer, lenp, - __proc_debug_mb); -} - -static int proc_console_max_delay_cs(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, - loff_t *ppos) -{ - int rc, max_delay_cs; - struct ctl_table dummy = *table; - long d; - - dummy.data = &max_delay_cs; - dummy.proc_handler = &proc_dointvec; - - if (!write) { /* read */ - max_delay_cs = cfs_duration_sec(libcfs_console_max_delay * 100); - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - return rc; - } - - /* write */ - max_delay_cs = 0; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - if (rc < 0) - return rc; - if (max_delay_cs <= 0) - return -EINVAL; - - d = cfs_time_seconds(max_delay_cs) / 100; - if (d == 0 || d < libcfs_console_min_delay) - return -EINVAL; - libcfs_console_max_delay = d; - - return rc; -} - -static int proc_console_min_delay_cs(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, - loff_t *ppos) -{ - int rc, min_delay_cs; - struct ctl_table dummy = *table; - long d; - - dummy.data = &min_delay_cs; - dummy.proc_handler = &proc_dointvec; - - if (!write) { /* read */ - min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100); - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - return rc; - } - - /* write */ - min_delay_cs = 0; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - if (rc < 0) - return rc; - if (min_delay_cs <= 0) - return -EINVAL; - - d = cfs_time_seconds(min_delay_cs) / 100; - if (d == 0 || d > libcfs_console_max_delay) - return -EINVAL; - libcfs_console_min_delay = d; - - return rc; -} - -static int proc_console_backoff(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - int rc, backoff; - struct ctl_table dummy = *table; - - dummy.data = &backoff; - dummy.proc_handler = &proc_dointvec; - - if (!write) { /* read */ - backoff= libcfs_console_backoff; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - return rc; - } - - /* write */ - backoff = 0; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - if (rc < 0) - return rc; - if (backoff <= 0) - return -EINVAL; - - libcfs_console_backoff = backoff; - - return rc; -} - -static int libcfs_force_lbug(struct ctl_table *table, int write, - void __user *buffer, - size_t *lenp, loff_t *ppos) -{ - if (write) - LBUG(); - return 0; -} - -static int proc_fail_loc(struct ctl_table *table, int write, - void __user *buffer, - size_t *lenp, loff_t *ppos) -{ - int rc; - long old_fail_loc = cfs_fail_loc; - - rc = proc_doulongvec_minmax(table, write, buffer, lenp, ppos); - if (old_fail_loc != cfs_fail_loc) - wake_up(&cfs_race_waitq); - return rc; -} - -static int __proc_cpt_table(void *data, int write, - loff_t pos, void __user *buffer, int nob) -{ - char *buf = NULL; - int len = 4096; - int rc = 0; - - if (write) - return -EPERM; - - LASSERT(cfs_cpt_table != NULL); - - while (1) { - LIBCFS_ALLOC(buf, len); - if (buf == NULL) - return -ENOMEM; - - rc = cfs_cpt_table_print(cfs_cpt_table, buf, len); - if (rc >= 0) - break; - - if (rc == -EFBIG) { - LIBCFS_FREE(buf, len); - len <<= 1; - continue; - } - goto out; - } - - if (pos >= rc) { - rc = 0; - goto out; - } - - rc = cfs_trace_copyout_string(buffer, nob, buf + pos, NULL); - out: - if (buf != NULL) - LIBCFS_FREE(buf, len); - return rc; -} - -static int proc_cpt_table(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - return proc_call_handler(table->data, write, ppos, buffer, lenp, - __proc_cpt_table); -} - -static struct ctl_table lnet_table[] = { - /* - * NB No .strategy entries have been provided since sysctl(8) prefers - * to go via /proc for portability. - */ - { - .procname = "debug", - .data = &libcfs_debug, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dobitmasks, - }, - { - .procname = "subsystem_debug", - .data = &libcfs_subsystem_debug, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dobitmasks, - }, - { - .procname = "printk", - .data = &libcfs_printk, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dobitmasks, - }, - { - .procname = "console_ratelimit", - .data = &libcfs_console_ratelimit, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .procname = "console_max_delay_centisecs", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_console_max_delay_cs - }, - { - .procname = "console_min_delay_centisecs", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_console_min_delay_cs - }, - { - .procname = "console_backoff", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_console_backoff - }, - - { - .procname = "debug_path", - .data = libcfs_debug_file_path_arr, - .maxlen = sizeof(libcfs_debug_file_path_arr), - .mode = 0644, - .proc_handler = &proc_dostring, - }, - - { - .procname = "cpu_partition_table", - .maxlen = 128, - .mode = 0444, - .proc_handler = &proc_cpt_table, - }, - - { - .procname = "upcall", - .data = lnet_upcall, - .maxlen = sizeof(lnet_upcall), - .mode = 0644, - .proc_handler = &proc_dostring, - }, - { - .procname = "debug_log_upcall", - .data = lnet_debug_log_upcall, - .maxlen = sizeof(lnet_debug_log_upcall), - .mode = 0644, - .proc_handler = &proc_dostring, - }, - { - .procname = "lnet_memused", - .data = (int *)&libcfs_kmemory.counter, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec, - }, - { - .procname = "catastrophe", - .data = &libcfs_catastrophe, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec, - }, - { - .procname = "panic_on_lbug", - .data = &libcfs_panic_on_lbug, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { - .procname = "dump_kernel", - .maxlen = 256, - .mode = 0200, - .proc_handler = &proc_dump_kernel, - }, - { - .procname = "daemon_file", - .mode = 0644, - .maxlen = 256, - .proc_handler = &proc_daemon_file, - }, - { - .procname = "debug_mb", - .mode = 0644, - .proc_handler = &proc_debug_mb, - }, - { - .procname = "watchdog_ratelimit", - .data = &libcfs_watchdog_ratelimit, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec_minmax, - .extra1 = &min_watchdog_ratelimit, - .extra2 = &max_watchdog_ratelimit, - }, - { - .procname = "force_lbug", - .data = NULL, - .maxlen = 0, - .mode = 0200, - .proc_handler = &libcfs_force_lbug - }, - { - .procname = "fail_loc", - .data = &cfs_fail_loc, - .maxlen = sizeof(cfs_fail_loc), - .mode = 0644, - .proc_handler = &proc_fail_loc - }, - { - .procname = "fail_val", - .data = &cfs_fail_val, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - } -}; - -static struct ctl_table top_table[] = { - { - .procname = "lnet", - .mode = 0555, - .data = NULL, - .maxlen = 0, - .child = lnet_table, - }, - { - } -}; - -int insert_proc(void) -{ - if (lnet_table_header == NULL) - lnet_table_header = register_sysctl_table(top_table); - return 0; -} - -void remove_proc(void) -{ - if (lnet_table_header != NULL) - unregister_sysctl_table(lnet_table_header); - - lnet_table_header = NULL; -} diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index e35f5981cb43..f0ee76abfd5a 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -33,15 +33,82 @@ * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include -#define DEBUG_SUBSYSTEM S_LNET +#include + +#include +#include +#include + +#include +#include + +# define DEBUG_SUBSYSTEM S_LNET #include "../../include/linux/libcfs/libcfs.h" +#include + #include "../../include/linux/libcfs/libcfs_crypto.h" #include "../../include/linux/lnet/lib-lnet.h" #include "../../include/linux/lnet/lnet.h" #include "tracefile.h" +MODULE_AUTHOR("Peter J. Braam "); +MODULE_DESCRIPTION("Portals v3.1"); +MODULE_LICENSE("GPL"); + +extern struct miscdevice libcfs_dev; +extern struct rw_semaphore cfs_tracefile_sem; +extern struct mutex cfs_trace_thread_mutex; +extern struct cfs_wi_sched *cfs_sched_rehash; +extern void libcfs_init_nidstrings(void); + +static int insert_proc(void); +static void remove_proc(void); + +static struct ctl_table_header *lnet_table_header; +extern char lnet_upcall[1024]; +/** + * The path of debug log dump upcall script. + */ +extern char lnet_debug_log_upcall[1024]; + +#define CTL_LNET (0x100) + +enum { + PSDEV_DEBUG = 1, /* control debugging */ + PSDEV_SUBSYSTEM_DEBUG, /* control debugging */ + PSDEV_PRINTK, /* force all messages to console */ + PSDEV_CONSOLE_RATELIMIT, /* ratelimit console messages */ + PSDEV_CONSOLE_MAX_DELAY_CS, /* maximum delay over which we skip messages */ + PSDEV_CONSOLE_MIN_DELAY_CS, /* initial delay over which we skip messages */ + PSDEV_CONSOLE_BACKOFF, /* delay increase factor */ + PSDEV_DEBUG_PATH, /* crashdump log location */ + PSDEV_DEBUG_DUMP_PATH, /* crashdump tracelog location */ + PSDEV_CPT_TABLE, /* information about cpu partitions */ + PSDEV_LNET_UPCALL, /* User mode upcall script */ + PSDEV_LNET_MEMUSED, /* bytes currently PORTAL_ALLOCated */ + PSDEV_LNET_CATASTROPHE, /* if we have LBUGged or panic'd */ + PSDEV_LNET_PANIC_ON_LBUG, /* flag to panic on LBUG */ + PSDEV_LNET_DUMP_KERNEL, /* snapshot kernel debug buffer to file */ + PSDEV_LNET_DAEMON_FILE, /* spool kernel debug buffer to file */ + PSDEV_LNET_DEBUG_MB, /* size of debug buffer */ + PSDEV_LNET_DEBUG_LOG_UPCALL, /* debug log upcall script */ + PSDEV_LNET_WATCHDOG_RATELIMIT, /* ratelimit watchdog messages */ + PSDEV_LNET_FORCE_LBUG, /* hook to force an LBUG */ + PSDEV_LNET_FAIL_LOC, /* control test failures instrumentation */ + PSDEV_LNET_FAIL_VAL, /* userdata for fail loc */ +}; + static void kportal_memhog_free (struct libcfs_device_userstate *ldu) { struct page **level0p = &ldu->ldu_memhog_root_page; @@ -320,19 +387,6 @@ struct cfs_psdev_ops libcfs_psdev_ops = { libcfs_ioctl }; -extern int insert_proc(void); -extern void remove_proc(void); -MODULE_AUTHOR("Peter J. Braam "); -MODULE_DESCRIPTION("Portals v3.1"); -MODULE_LICENSE("GPL"); - -extern struct miscdevice libcfs_dev; -extern struct rw_semaphore cfs_tracefile_sem; -extern struct mutex cfs_trace_thread_mutex; -extern struct cfs_wi_sched *cfs_sched_rehash; - -extern void libcfs_init_nidstrings(void); - static int init_libcfs_module(void) { int rc; @@ -438,6 +492,485 @@ static void exit_libcfs_module(void) libcfs_arch_cleanup(); } +static int proc_call_handler(void *data, int write, loff_t *ppos, + void __user *buffer, size_t *lenp, + int (*handler)(void *data, int write, + loff_t pos, void __user *buffer, int len)) +{ + int rc = handler(data, write, *ppos, buffer, *lenp); + + if (rc < 0) + return rc; + + if (write) { + *ppos += *lenp; + } else { + *lenp = rc; + *ppos += rc; + } + return 0; +} + +static int __proc_dobitmasks(void *data, int write, + loff_t pos, void __user *buffer, int nob) +{ + const int tmpstrlen = 512; + char *tmpstr; + int rc; + unsigned int *mask = data; + int is_subsys = (mask == &libcfs_subsystem_debug) ? 1 : 0; + int is_printk = (mask == &libcfs_printk) ? 1 : 0; + + rc = cfs_trace_allocate_string_buffer(&tmpstr, tmpstrlen); + if (rc < 0) + return rc; + + if (!write) { + libcfs_debug_mask2str(tmpstr, tmpstrlen, *mask, is_subsys); + rc = strlen(tmpstr); + + if (pos >= rc) { + rc = 0; + } else { + rc = cfs_trace_copyout_string(buffer, nob, + tmpstr + pos, "\n"); + } + } else { + rc = cfs_trace_copyin_string(tmpstr, tmpstrlen, buffer, nob); + if (rc < 0) { + cfs_trace_free_string_buffer(tmpstr, tmpstrlen); + return rc; + } + + rc = libcfs_debug_str2mask(mask, tmpstr, is_subsys); + /* Always print LBUG/LASSERT to console, so keep this mask */ + if (is_printk) + *mask |= D_EMERG; + } + + cfs_trace_free_string_buffer(tmpstr, tmpstrlen); + return rc; +} + +static int proc_dobitmasks(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + return proc_call_handler(table->data, write, ppos, buffer, lenp, + __proc_dobitmasks); +} + +static int min_watchdog_ratelimit; /* disable ratelimiting */ +static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */ + +static int __proc_dump_kernel(void *data, int write, + loff_t pos, void __user *buffer, int nob) +{ + if (!write) + return 0; + + return cfs_trace_dump_debug_buffer_usrstr(buffer, nob); +} + +static int proc_dump_kernel(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + return proc_call_handler(table->data, write, ppos, buffer, lenp, + __proc_dump_kernel); +} + +static int __proc_daemon_file(void *data, int write, + loff_t pos, void __user *buffer, int nob) +{ + if (!write) { + int len = strlen(cfs_tracefile); + + if (pos >= len) + return 0; + + return cfs_trace_copyout_string(buffer, nob, + cfs_tracefile + pos, "\n"); + } + + return cfs_trace_daemon_command_usrstr(buffer, nob); +} + +static int proc_daemon_file(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + return proc_call_handler(table->data, write, ppos, buffer, lenp, + __proc_daemon_file); +} + +static int __proc_debug_mb(void *data, int write, + loff_t pos, void __user *buffer, int nob) +{ + if (!write) { + char tmpstr[32]; + int len = snprintf(tmpstr, sizeof(tmpstr), "%d", + cfs_trace_get_debug_mb()); + + if (pos >= len) + return 0; + + return cfs_trace_copyout_string(buffer, nob, tmpstr + pos, + "\n"); + } + + return cfs_trace_set_debug_mb_usrstr(buffer, nob); +} + +static int proc_debug_mb(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + return proc_call_handler(table->data, write, ppos, buffer, lenp, + __proc_debug_mb); +} + +static int proc_console_max_delay_cs(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, + loff_t *ppos) +{ + int rc, max_delay_cs; + struct ctl_table dummy = *table; + long d; + + dummy.data = &max_delay_cs; + dummy.proc_handler = &proc_dointvec; + + if (!write) { /* read */ + max_delay_cs = cfs_duration_sec(libcfs_console_max_delay * 100); + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); + return rc; + } + + /* write */ + max_delay_cs = 0; + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); + if (rc < 0) + return rc; + if (max_delay_cs <= 0) + return -EINVAL; + + d = cfs_time_seconds(max_delay_cs) / 100; + if (d == 0 || d < libcfs_console_min_delay) + return -EINVAL; + libcfs_console_max_delay = d; + + return rc; +} + +static int proc_console_min_delay_cs(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, + loff_t *ppos) +{ + int rc, min_delay_cs; + struct ctl_table dummy = *table; + long d; + + dummy.data = &min_delay_cs; + dummy.proc_handler = &proc_dointvec; + + if (!write) { /* read */ + min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100); + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); + return rc; + } + + /* write */ + min_delay_cs = 0; + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); + if (rc < 0) + return rc; + if (min_delay_cs <= 0) + return -EINVAL; + + d = cfs_time_seconds(min_delay_cs) / 100; + if (d == 0 || d > libcfs_console_max_delay) + return -EINVAL; + libcfs_console_min_delay = d; + + return rc; +} + +static int proc_console_backoff(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + int rc, backoff; + struct ctl_table dummy = *table; + + dummy.data = &backoff; + dummy.proc_handler = &proc_dointvec; + + if (!write) { /* read */ + backoff = libcfs_console_backoff; + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); + return rc; + } + + /* write */ + backoff = 0; + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); + if (rc < 0) + return rc; + if (backoff <= 0) + return -EINVAL; + + libcfs_console_backoff = backoff; + + return rc; +} + +static int libcfs_force_lbug(struct ctl_table *table, int write, + void __user *buffer, + size_t *lenp, loff_t *ppos) +{ + if (write) + LBUG(); + return 0; +} + +static int proc_fail_loc(struct ctl_table *table, int write, + void __user *buffer, + size_t *lenp, loff_t *ppos) +{ + int rc; + long old_fail_loc = cfs_fail_loc; + + rc = proc_doulongvec_minmax(table, write, buffer, lenp, ppos); + if (old_fail_loc != cfs_fail_loc) + wake_up(&cfs_race_waitq); + return rc; +} + +static int __proc_cpt_table(void *data, int write, + loff_t pos, void __user *buffer, int nob) +{ + char *buf = NULL; + int len = 4096; + int rc = 0; + + if (write) + return -EPERM; + + LASSERT(cfs_cpt_table != NULL); + + while (1) { + LIBCFS_ALLOC(buf, len); + if (buf == NULL) + return -ENOMEM; + + rc = cfs_cpt_table_print(cfs_cpt_table, buf, len); + if (rc >= 0) + break; + + if (rc == -EFBIG) { + LIBCFS_FREE(buf, len); + len <<= 1; + continue; + } + goto out; + } + + if (pos >= rc) { + rc = 0; + goto out; + } + + rc = cfs_trace_copyout_string(buffer, nob, buf + pos, NULL); + out: + if (buf != NULL) + LIBCFS_FREE(buf, len); + return rc; +} + +static int proc_cpt_table(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + return proc_call_handler(table->data, write, ppos, buffer, lenp, + __proc_cpt_table); +} + +static struct ctl_table lnet_table[] = { + /* + * NB No .strategy entries have been provided since sysctl(8) prefers + * to go via /proc for portability. + */ + { + .procname = "debug", + .data = &libcfs_debug, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dobitmasks, + }, + { + .procname = "subsystem_debug", + .data = &libcfs_subsystem_debug, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dobitmasks, + }, + { + .procname = "printk", + .data = &libcfs_printk, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dobitmasks, + }, + { + .procname = "console_ratelimit", + .data = &libcfs_console_ratelimit, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec + }, + { + .procname = "console_max_delay_centisecs", + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_console_max_delay_cs + }, + { + .procname = "console_min_delay_centisecs", + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_console_min_delay_cs + }, + { + .procname = "console_backoff", + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_console_backoff + }, + + { + .procname = "debug_path", + .data = libcfs_debug_file_path_arr, + .maxlen = sizeof(libcfs_debug_file_path_arr), + .mode = 0644, + .proc_handler = &proc_dostring, + }, + + { + .procname = "cpu_partition_table", + .maxlen = 128, + .mode = 0444, + .proc_handler = &proc_cpt_table, + }, + + { + .procname = "upcall", + .data = lnet_upcall, + .maxlen = sizeof(lnet_upcall), + .mode = 0644, + .proc_handler = &proc_dostring, + }, + { + .procname = "debug_log_upcall", + .data = lnet_debug_log_upcall, + .maxlen = sizeof(lnet_debug_log_upcall), + .mode = 0644, + .proc_handler = &proc_dostring, + }, + { + .procname = "lnet_memused", + .data = (int *)&libcfs_kmemory.counter, + .maxlen = sizeof(int), + .mode = 0444, + .proc_handler = &proc_dointvec, + }, + { + .procname = "catastrophe", + .data = &libcfs_catastrophe, + .maxlen = sizeof(int), + .mode = 0444, + .proc_handler = &proc_dointvec, + }, + { + .procname = "panic_on_lbug", + .data = &libcfs_panic_on_lbug, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, + { + .procname = "dump_kernel", + .maxlen = 256, + .mode = 0200, + .proc_handler = &proc_dump_kernel, + }, + { + .procname = "daemon_file", + .mode = 0644, + .maxlen = 256, + .proc_handler = &proc_daemon_file, + }, + { + .procname = "debug_mb", + .mode = 0644, + .proc_handler = &proc_debug_mb, + }, + { + .procname = "watchdog_ratelimit", + .data = &libcfs_watchdog_ratelimit, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec_minmax, + .extra1 = &min_watchdog_ratelimit, + .extra2 = &max_watchdog_ratelimit, + }, + { + .procname = "force_lbug", + .data = NULL, + .maxlen = 0, + .mode = 0200, + .proc_handler = &libcfs_force_lbug + }, + { + .procname = "fail_loc", + .data = &cfs_fail_loc, + .maxlen = sizeof(cfs_fail_loc), + .mode = 0644, + .proc_handler = &proc_fail_loc + }, + { + .procname = "fail_val", + .data = &cfs_fail_val, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec + }, + { + } +}; + +static struct ctl_table top_table[] = { + { + .procname = "lnet", + .mode = 0555, + .data = NULL, + .maxlen = 0, + .child = lnet_table, + }, + { + } +}; + +static int insert_proc(void) +{ + if (lnet_table_header == NULL) + lnet_table_header = register_sysctl_table(top_table); + return 0; +} + +static void remove_proc(void) +{ + if (lnet_table_header != NULL) + unregister_sysctl_table(lnet_table_header); + + lnet_table_header = NULL; +} + MODULE_VERSION("1.0.0"); + module_init(init_libcfs_module); module_exit(exit_libcfs_module); -- cgit v1.2.3 From 834d86735d2b12c74d252addf20fc448bae8f813 Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Sun, 1 Mar 2015 23:18:50 +0100 Subject: staging: dgnc: fix braces {} are not necessary for single statement blocks This patch fixes the following checkpatch.pl warning: braces {} are not necessary for single statement blocks Signed-off-by: Salah Triki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_tty.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index f81a375f8bc1..817934269520 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -886,10 +886,6 @@ void dgnc_check_queue_flow_control(struct channel_t *ch) ch->ch_stops_sent++; } } - /* No FLOW */ - else { - /* Empty... Can't do anything about the impending overflow... */ - } } /* -- cgit v1.2.3 From 5f9dca1e7d5a5463f9e9cc4e1f5c8e9bc9d118a9 Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Thu, 5 Mar 2015 03:50:24 +0100 Subject: Staging: dgnc: Fix checking return value of register_chrdev The failure code is negative. So check <0 instead of <=0. Return the failure code instead of -ENXIO. Signed-off-by: Salah Triki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index c1d1a97e0c94..fa1ee79ef88e 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -251,9 +251,9 @@ static int dgnc_start(void) * Register management/dpa devices */ rc = register_chrdev(0, "dgnc", &dgnc_BoardFops); - if (rc <= 0) { + if (rc < 0) { pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc); - return -ENXIO; + return rc; } dgnc_Major = rc; -- cgit v1.2.3 From e03b7297f8e8968e98ff9eab57e0f92e106248ad Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Tue, 10 Feb 2015 10:24:12 +0100 Subject: staging: ozwpan: Remove allocation from delaration line This patch removes allocation from declaration line because people are known to gloss over declarations. Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ozwpan/ozhcd.c | 5 +++-- drivers/staging/ozwpan/ozpd.c | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c index 8543bb29a138..96e95bf8fd32 100644 --- a/drivers/staging/ozwpan/ozhcd.c +++ b/drivers/staging/ozwpan/ozhcd.c @@ -280,8 +280,9 @@ static void oz_free_urb_link(struct oz_urb_link *urbl) */ static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags) { - struct oz_endpoint *ep = - kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags); + struct oz_endpoint *ep; + + ep = kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags); if (ep) { INIT_LIST_HEAD(&ep->urb_list); INIT_LIST_HEAD(&ep->link); diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c index 852c288aaf13..1c95d5799217 100644 --- a/drivers/staging/ozwpan/ozpd.c +++ b/drivers/staging/ozwpan/ozpd.c @@ -102,8 +102,9 @@ void oz_pd_put(struct oz_pd *pd) */ struct oz_pd *oz_pd_alloc(const u8 *mac_addr) { - struct oz_pd *pd = kzalloc(sizeof(struct oz_pd), GFP_ATOMIC); + struct oz_pd *pd; + pd = kzalloc(sizeof(struct oz_pd), GFP_ATOMIC); if (pd) { int i; @@ -652,8 +653,9 @@ static struct oz_isoc_stream *pd_stream_find(struct oz_pd *pd, u8 ep_num) */ int oz_isoc_stream_create(struct oz_pd *pd, u8 ep_num) { - struct oz_isoc_stream *st = - kzalloc(sizeof(struct oz_isoc_stream), GFP_ATOMIC); + struct oz_isoc_stream *st; + + st = kzalloc(sizeof(struct oz_isoc_stream), GFP_ATOMIC); if (!st) return -ENOMEM; st->ep_num = ep_num; -- cgit v1.2.3 From 6498613d2cf23269a6a483a751f61655115de251 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Tue, 10 Feb 2015 11:42:08 +0100 Subject: staging: ozwpan: Move code from success handling to error handling The original version was success handling rather than error handling, therefore this patch reduces nesting. Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ozwpan/ozhcd.c | 18 +++++++------- drivers/staging/ozwpan/ozpd.c | 53 +++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 34 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c index 96e95bf8fd32..5ff4716b72c3 100644 --- a/drivers/staging/ozwpan/ozhcd.c +++ b/drivers/staging/ozwpan/ozhcd.c @@ -283,15 +283,17 @@ static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags) struct oz_endpoint *ep; ep = kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags); - if (ep) { - INIT_LIST_HEAD(&ep->urb_list); - INIT_LIST_HEAD(&ep->link); - ep->credit = -1; - if (buffer_size) { - ep->buffer_size = buffer_size; - ep->buffer = (u8 *)(ep+1); - } + if (!ep) + return NULL; + + INIT_LIST_HEAD(&ep->urb_list); + INIT_LIST_HEAD(&ep->link); + ep->credit = -1; + if (buffer_size) { + ep->buffer_size = buffer_size; + ep->buffer = (u8 *)(ep+1); } + return ep; } diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c index 1c95d5799217..021d74a132dd 100644 --- a/drivers/staging/ozwpan/ozpd.c +++ b/drivers/staging/ozwpan/ozpd.c @@ -103,34 +103,35 @@ void oz_pd_put(struct oz_pd *pd) struct oz_pd *oz_pd_alloc(const u8 *mac_addr) { struct oz_pd *pd; + int i; pd = kzalloc(sizeof(struct oz_pd), GFP_ATOMIC); - if (pd) { - int i; - - atomic_set(&pd->ref_count, 2); - for (i = 0; i < OZ_NB_APPS; i++) - spin_lock_init(&pd->app_lock[i]); - pd->last_rx_pkt_num = 0xffffffff; - oz_pd_set_state(pd, OZ_PD_S_IDLE); - pd->max_tx_size = OZ_MAX_TX_SIZE; - ether_addr_copy(pd->mac_addr, mac_addr); - oz_elt_buf_init(&pd->elt_buff); - spin_lock_init(&pd->tx_frame_lock); - INIT_LIST_HEAD(&pd->tx_queue); - INIT_LIST_HEAD(&pd->farewell_list); - pd->last_sent_frame = &pd->tx_queue; - spin_lock_init(&pd->stream_lock); - INIT_LIST_HEAD(&pd->stream_list); - tasklet_init(&pd->heartbeat_tasklet, oz_pd_heartbeat_handler, - (unsigned long)pd); - tasklet_init(&pd->timeout_tasklet, oz_pd_timeout_handler, - (unsigned long)pd); - hrtimer_init(&pd->heartbeat, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - hrtimer_init(&pd->timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - pd->heartbeat.function = oz_pd_heartbeat_event; - pd->timeout.function = oz_pd_timeout_event; - } + if (!pd) + return NULL; + + atomic_set(&pd->ref_count, 2); + for (i = 0; i < OZ_NB_APPS; i++) + spin_lock_init(&pd->app_lock[i]); + pd->last_rx_pkt_num = 0xffffffff; + oz_pd_set_state(pd, OZ_PD_S_IDLE); + pd->max_tx_size = OZ_MAX_TX_SIZE; + ether_addr_copy(pd->mac_addr, mac_addr); + oz_elt_buf_init(&pd->elt_buff); + spin_lock_init(&pd->tx_frame_lock); + INIT_LIST_HEAD(&pd->tx_queue); + INIT_LIST_HEAD(&pd->farewell_list); + pd->last_sent_frame = &pd->tx_queue; + spin_lock_init(&pd->stream_lock); + INIT_LIST_HEAD(&pd->stream_list); + tasklet_init(&pd->heartbeat_tasklet, oz_pd_heartbeat_handler, + (unsigned long)pd); + tasklet_init(&pd->timeout_tasklet, oz_pd_timeout_handler, + (unsigned long)pd); + hrtimer_init(&pd->heartbeat, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + hrtimer_init(&pd->timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + pd->heartbeat.function = oz_pd_heartbeat_event; + pd->timeout.function = oz_pd_timeout_event; + return pd; } -- cgit v1.2.3 From d34add05946ffda90ad5c4f0f71af2819748c660 Mon Sep 17 00:00:00 2001 From: Christian Engelmayer Date: Wed, 11 Feb 2015 20:33:15 +0100 Subject: staging: vt6656: Fix possible leak in vnt_download_firmware() When failing to allocate buffer memory, function vnt_download_firmware() goes through the wrong exit path and fails to release the already requested firmware. Thus use the correct cleanup. Detected by Coverity CID 1269128. Signed-off-by: Christian Engelmayer Reviewed-by: Martin Kepplinger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index a177645af83e..d440f284bf18 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -61,7 +61,7 @@ int vnt_download_firmware(struct vnt_private *priv) buffer = kmalloc(FIRMWARE_CHUNK_SIZE, GFP_KERNEL); if (!buffer) - goto out; + goto free_fw; for (ii = 0; ii < fw->size; ii += FIRMWARE_CHUNK_SIZE) { length = min_t(int, fw->size - ii, FIRMWARE_CHUNK_SIZE); -- cgit v1.2.3 From 636cd168064937408114cb6cd9d2fa5095ac827c Mon Sep 17 00:00:00 2001 From: Ivan Stankovic Date: Thu, 12 Feb 2015 22:08:26 +0100 Subject: staging: vt6655: fix coding style issues in channel.c Observe the line length limit to make checkpatch.pl happy. Signed-off-by: Ivan Stankovic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/channel.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c index 3c17725d5910..7a717828fa09 100644 --- a/drivers/staging/vt6655/channel.c +++ b/drivers/staging/vt6655/channel.c @@ -193,7 +193,8 @@ bool set_channel(void *pDeviceHandler, struct ieee80211_channel *ch) /* clear NAV */ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MACCR, MACCR_CLRNAV); - /* TX_PE will reserve 3 us for MAX2829 A mode only, it is for better TX throughput */ + /* TX_PE will reserve 3 us for MAX2829 A mode only, + it is for better TX throughput */ if (pDevice->byRFType == RF_AIROHA7230) RFbAL7230SelectChannelPostProcess(pDevice, pDevice->byCurrentCh, @@ -217,9 +218,11 @@ bool set_channel(void *pDeviceHandler, struct ieee80211_channel *ch) /* set HW default power register */ MACvSelectPage1(pDevice->PortOffset); RFbSetPower(pDevice, RATE_1M, pDevice->byCurrentCh); - VNSvOutPortB(pDevice->PortOffset + MAC_REG_PWRCCK, pDevice->byCurPwr); + VNSvOutPortB(pDevice->PortOffset + MAC_REG_PWRCCK, + pDevice->byCurPwr); RFbSetPower(pDevice, RATE_6M, pDevice->byCurrentCh); - VNSvOutPortB(pDevice->PortOffset + MAC_REG_PWROFDM, pDevice->byCurPwr); + VNSvOutPortB(pDevice->PortOffset + MAC_REG_PWROFDM, + pDevice->byCurPwr); MACvSelectPage0(pDevice->PortOffset); spin_unlock_irqrestore(&pDevice->lock, flags); -- cgit v1.2.3 From 7e59b047ccb64c57e5a372ca1877b5ad979fdfdb Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 21 Feb 2015 10:40:02 +0100 Subject: Staging: vt6655 fix C99 style comments Signed-off-by: Matteo Semenzato Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/tmacro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/tmacro.h b/drivers/staging/vt6655/tmacro.h index 607b78f7a6a0..597efefc017f 100644 --- a/drivers/staging/vt6655/tmacro.h +++ b/drivers/staging/vt6655/tmacro.h @@ -55,4 +55,4 @@ #define MAKEDWORD(lw, hw) ((unsigned long)(((unsigned short)(lw)) | (((unsigned long)((unsigned short)(hw))) << 16))) #endif -#endif // __TMACRO_H__ +#endif /* __TMACRO_H__ */ -- cgit v1.2.3 From bb72dd53d7e5b8a13f5a2bbc1a3f0111fdc6450d Mon Sep 17 00:00:00 2001 From: Alex W Slater Date: Thu, 26 Feb 2015 20:09:26 +0000 Subject: staging: vt6655: Cleanup C99 comments Fix checkpatch.pl errors: "ERROR: do not use C99 // comments" Signed-off-by: Alex W Slater Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 4324282afe49..0204ea520385 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -64,9 +64,9 @@ #include /*--------------------- Static Definitions -------------------------*/ -// -// Define module options -// +/* + * Define module options + */ MODULE_AUTHOR("VIA Networking Technologies, Inc., "); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("VIA Networking Solomon-A/B/G Wireless LAN Adapter Driver"); @@ -126,9 +126,9 @@ DEVICE_PARAM(LongRetryLimit, "long frame retry limits"); DEVICE_PARAM(BasebandType, "baseband type"); -// -// Static vars definitions -// +/* + * Static vars definitions + */ static CHIP_INFO chip_info_table[] = { { VT3253, "VIA Networking Solomon-A/B/G Wireless LAN Adapter ", 256, 1, DEVICE_FLAGS_IP_ALIGN|DEVICE_FLAGS_TX_ALIGN }, @@ -231,9 +231,9 @@ device_set_options(struct vnt_private *pDevice) pr_debug(" byBBType= %d\n", (int)pDevice->byBBType); } -// -// Initialisation of MAC & BBP registers -// +/* + * Initialisation of MAC & BBP registers + */ static void device_init_registers(struct vnt_private *pDevice) { @@ -584,7 +584,7 @@ static bool device_init_rings(struct vnt_private *pDevice) pDevice->td1_pool_dma = pDevice->td0_pool_dma + pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc); - // vir_pool: pvoid type + /* vir_pool: pvoid type */ pDevice->apTD0Rings = vir_pool + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc); @@ -943,7 +943,7 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) byTsr0 = pTD->m_td0TD0.byTSR0; byTsr1 = pTD->m_td0TD0.byTSR1; - //Only the status of first TD in the chain is correct + /* Only the status of first TD in the chain is correct */ if (pTD->m_td1TD1.byTCR & TCR_STP) { if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) { @@ -992,7 +992,7 @@ static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; struct sk_buff *skb = pTDInfo->skb; - // pre-allocated buf_dma can't be unmapped. + /* pre-allocated buf_dma can't be unmapped. */ if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) { pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma, skb->len, PCI_DMA_TODEVICE); @@ -1084,7 +1084,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) spin_lock_irqsave(&pDevice->lock, flags); - //Make sure current page is 0 + /* Make sure current page is 0 */ VNSvInPortB(pDevice->PortOffset + MAC_REG_PAGE1SEL, &byOrgPageSel); if (byOrgPageSel == 1) MACvSelectPage0(pDevice->PortOffset); @@ -1092,10 +1092,12 @@ static irqreturn_t device_intr(int irq, void *dev_instance) byOrgPageSel = 0; MACvReadMIBCounter(pDevice->PortOffset, &dwMIBCounter); - // TBD.... - // Must do this after doing rx/tx, cause ISR bit is slow - // than RD/TD write back - // update ISR counter + /* + * TBD.... + * Must do this after doing rx/tx, cause ISR bit is slow + * than RD/TD write back + * update ISR counter + */ STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic, dwMIBCounter); while (pDevice->dwIsr != 0) { STAvUpdateIsrStatCounter(&pDevice->scStatistic, pDevice->dwIsr); -- cgit v1.2.3 From 9ab81fb7a968c81d16fa00584487d7f1e7211887 Mon Sep 17 00:00:00 2001 From: Matteo Semenzato Date: Sat, 28 Feb 2015 15:28:15 +0100 Subject: Staging: vt6655: fix C99 comments This patch fixes the following warning: do not use C99 // comments Signed-off-by: Matteo Semenzato Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/mac.c | 82 ++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c index 3653a2bd1e36..8048b3263360 100644 --- a/drivers/staging/vt6655/mac.c +++ b/drivers/staging/vt6655/mac.c @@ -141,7 +141,7 @@ bool MACbIsIntDisable(void __iomem *dwIoBase) */ void MACvSetShortRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit) { - // set SRT + /* set SRT */ VNSvOutPortB(dwIoBase + MAC_REG_SRT, byRetryLimit); } @@ -162,7 +162,7 @@ void MACvSetShortRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit) */ void MACvSetLongRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit) { - // set LRT + /* set LRT */ VNSvOutPortB(dwIoBase + MAC_REG_LRT, byRetryLimit); } @@ -186,7 +186,7 @@ void MACvSetLoopbackMode(void __iomem *dwIoBase, unsigned char byLoopbackMode) ASSERT(byLoopbackMode < 3); byLoopbackMode <<= 6; - // set TCR + /* set TCR */ VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue); byOrgValue = byOrgValue & 0x3F; byOrgValue = byOrgValue | byLoopbackMode; @@ -210,13 +210,13 @@ void MACvSaveContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf) { int ii; - // read page0 register + /* read page0 register */ for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE0; ii++) VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + ii)); MACvSelectPage1(dwIoBase); - // read page1 register + /* read page1 register */ for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii)); @@ -242,27 +242,27 @@ void MACvRestoreContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf) int ii; MACvSelectPage1(dwIoBase); - // restore page1 + /* restore page1 */ for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) VNSvOutPortB((dwIoBase + ii), *(pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii)); MACvSelectPage0(dwIoBase); - // restore RCR,TCR,IMR... + /* restore RCR,TCR,IMR... */ for (ii = MAC_REG_RCR; ii < MAC_REG_ISR; ii++) VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii)); - // restore MAC Config. + /* restore MAC Config. */ for (ii = MAC_REG_LRT; ii < MAC_REG_PAGE1SEL; ii++) VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii)); VNSvOutPortB(dwIoBase + MAC_REG_CFG, *(pbyCxtBuf + MAC_REG_CFG)); - // restore PS Config. + /* restore PS Config. */ for (ii = MAC_REG_PSCFG; ii < MAC_REG_BBREGCTL; ii++) VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii)); - // restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR + /* restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR */ VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0)); VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR)); VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_BCNDMAPTR)); @@ -290,7 +290,7 @@ bool MACbSoftwareReset(void __iomem *dwIoBase) unsigned char byData; unsigned short ww; - // turn on HOSTCR_SOFTRST, just write 0x01 to reset + /* turn on HOSTCR_SOFTRST, just write 0x01 to reset */ VNSvOutPortB(dwIoBase + MAC_REG_HOSTCR, 0x01); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { @@ -321,15 +321,15 @@ bool MACbSafeSoftwareReset(void __iomem *dwIoBase) unsigned char abyTmpRegData[MAC_MAX_CONTEXT_SIZE_PAGE0+MAC_MAX_CONTEXT_SIZE_PAGE1]; bool bRetVal; - // PATCH.... - // save some important register's value, then do - // reset, then restore register's value - - // save MAC context + /* PATCH.... + * save some important register's value, then do + * reset, then restore register's value + */ + /* save MAC context */ MACvSaveContext(dwIoBase, abyTmpRegData); - // do reset + /* do reset */ bRetVal = MACbSoftwareReset(dwIoBase); - // restore MAC context, except CR0 + /* restore MAC context, except CR0 */ MACvRestoreContext(dwIoBase, abyTmpRegData); return bRetVal; @@ -354,9 +354,9 @@ bool MACbSafeRxOff(void __iomem *dwIoBase) unsigned long dwData; unsigned char byData; - // turn off wow temp for turn off Rx safely + /* turn off wow temp for turn off Rx safely */ - // Clear RX DMA0,1 + /* Clear RX DMA0,1 */ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_CLRRUN); VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_CLRRUN); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { @@ -380,9 +380,9 @@ bool MACbSafeRxOff(void __iomem *dwIoBase) return false; } - // try to safe shutdown RX + /* try to safe shutdown RX */ MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON); - // W_MAX_TIMEOUT is the timeout period + /* W_MAX_TIMEOUT is the timeout period */ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData); if (!(byData & HOSTCR_RXONST)) @@ -415,10 +415,10 @@ bool MACbSafeTxOff(void __iomem *dwIoBase) unsigned long dwData; unsigned char byData; - // Clear TX DMA - //Tx0 + /* Clear TX DMA */ + /* Tx0 */ VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_CLRRUN); - //AC0 + /* AC0 */ VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_CLRRUN); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { @@ -442,10 +442,10 @@ bool MACbSafeTxOff(void __iomem *dwIoBase) return false; } - // try to safe shutdown TX + /* try to safe shutdown TX */ MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON); - // W_MAX_TIMEOUT is the timeout period + /* W_MAX_TIMEOUT is the timeout period */ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData); if (!(byData & HOSTCR_TXONST)) @@ -509,10 +509,10 @@ bool MACbSafeStop(void __iomem *dwIoBase) */ bool MACbShutdown(void __iomem *dwIoBase) { - // disable MAC IMR + /* disable MAC IMR */ MACvIntDisable(dwIoBase); MACvSetLoopbackMode(dwIoBase, MAC_LB_INTERNAL); - // stop the adapter + /* stop the adapter */ if (!MACbSafeStop(dwIoBase)) { MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE); return false; @@ -536,18 +536,18 @@ bool MACbShutdown(void __iomem *dwIoBase) */ void MACvInitialize(void __iomem *dwIoBase) { - // clear sticky bits + /* clear sticky bits */ MACvClearStckDS(dwIoBase); - // disable force PME-enable + /* disable force PME-enable */ VNSvOutPortB(dwIoBase + MAC_REG_PMC1, PME_OVR); - // only 3253 A + /* only 3253 A */ - // do reset + /* do reset */ MACbSoftwareReset(dwIoBase); - // reset TSF counter + /* reset TSF counter */ VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST); - // enable TSF counter + /* enable TSF counter */ VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN); } @@ -678,7 +678,7 @@ void MACvSetCurrTx0DescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAd * Return Value: none * */ -//TxDMA1 = AC0DMA +/* TxDMA1 = AC0DMA */ void MACvSetCurrAC0DescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAddr) { unsigned short ww; @@ -733,7 +733,7 @@ void MACvTimer0MicroSDelay(void __iomem *dwIoBase, unsigned int uDelay) VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0); VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelay); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE)); - for (ii = 0; ii < 66; ii++) { // assume max PCI clock is 66Mhz + for (ii = 0; ii < 66; ii++) { /* assume max PCI clock is 66Mhz */ for (uu = 0; uu < uDelay; uu++) { VNSvInPortB(dwIoBase + MAC_REG_TMCTL0, &byValue); if ((byValue == 0) || @@ -780,14 +780,14 @@ bool MACbPSWakeup(void __iomem *dwIoBase) { unsigned char byOrgValue; unsigned int ww; - // Read PSCTL + /* Read PSCTL */ if (MACbIsRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PS)) return true; - // Disable PS + /* Disable PS */ MACvRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PSEN); - // Check if SyncFlushOK + /* Check if SyncFlushOK */ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_PSCTL, &byOrgValue); if (byOrgValue & PSCTL_WAKEDONE) @@ -859,7 +859,7 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned in wOffset += (uKeyIdx * 4); for (ii = 0; ii < 4; ii++) { - // always push 128 bits + /* always push 128 bits */ pr_debug("3.(%d) wOffset: %d, Data: %X\n", ii, wOffset+ii, *pdwKey); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); -- cgit v1.2.3 From f43de77c9dddba86284f7cb58c5e257ebed843a3 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Feb 2015 17:26:02 +0530 Subject: staging: panel: register driver after checking device register the driver only if lcd or keypad has been enabled and if both are disabled then just exit. Signed-off-by: Sudip Mukherjee Acked-by: Willy Tarreau Signed-off-by: Greg Kroah-Hartman --- drivers/staging/panel/panel.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index 4da854ca3115..322b73d265d6 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -2377,23 +2377,17 @@ static int __init panel_init_module(void) /* tells various subsystems about the fact that we are initializing */ init_in_progress = 1; - if (parport_register_driver(&panel_driver)) { - pr_err("could not register with parport. Aborting.\n"); - return -EIO; - } - if (!lcd.enabled && !keypad.enabled) { - /* no device enabled, let's release the parport */ - if (pprt) { - parport_release(pprt); - parport_unregister_device(pprt); - pprt = NULL; - } - parport_unregister_driver(&panel_driver); + /* no device enabled, let's exit */ pr_err("driver version " PANEL_VERSION " disabled.\n"); return -ENODEV; } + if (parport_register_driver(&panel_driver)) { + pr_err("could not register with parport. Aborting.\n"); + return -EIO; + } + register_reboot_notifier(&panel_notifier); if (pprt) -- cgit v1.2.3 From 733345ec4ee3756822d455fc809f40713975bf76 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Wed, 11 Feb 2015 16:57:08 +0530 Subject: staging: panel: initialize lcd if lcd enabled initialiaze lcd parameters only if lcd is enabled. Signed-off-by: Sudip Mukherjee Acked-by: Willy Tarreau Signed-off-by: Greg Kroah-Hartman --- drivers/staging/panel/panel.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index 322b73d265d6..3339633e88d3 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -2321,25 +2321,6 @@ static int __init panel_init_module(void) break; } - /* - * Init lcd struct with load-time values to preserve exact current - * functionality (at least for now). - */ - lcd.height = lcd_height; - lcd.width = lcd_width; - lcd.bwidth = lcd_bwidth; - lcd.hwidth = lcd_hwidth; - lcd.charset = lcd_charset; - lcd.proto = lcd_proto; - lcd.pins.e = lcd_e_pin; - lcd.pins.rs = lcd_rs_pin; - lcd.pins.rw = lcd_rw_pin; - lcd.pins.cl = lcd_cl_pin; - lcd.pins.da = lcd_da_pin; - lcd.pins.bl = lcd_bl_pin; - - /* Leave it for now, just in case */ - lcd.esc_seq.len = -1; /* * Overwrite selection with module param values (both keypad and lcd), @@ -2359,6 +2340,28 @@ static int __init panel_init_module(void) lcd.enabled = (selected_lcd_type > 0); + if (lcd.enabled) { + /* + * Init lcd struct with load-time values to preserve exact + * current functionality (at least for now). + */ + lcd.height = lcd_height; + lcd.width = lcd_width; + lcd.bwidth = lcd_bwidth; + lcd.hwidth = lcd_hwidth; + lcd.charset = lcd_charset; + lcd.proto = lcd_proto; + lcd.pins.e = lcd_e_pin; + lcd.pins.rs = lcd_rs_pin; + lcd.pins.rw = lcd_rw_pin; + lcd.pins.cl = lcd_cl_pin; + lcd.pins.da = lcd_da_pin; + lcd.pins.bl = lcd_bl_pin; + + /* Leave it for now, just in case */ + lcd.esc_seq.len = -1; + } + switch (selected_keypad_type) { case KEYPAD_TYPE_OLD: keypad_profile = old_keypad_profile; -- cgit v1.2.3 From 8895f04b7a0c203af80a40f6bd0c85ac1fb3f7d7 Mon Sep 17 00:00:00 2001 From: Yannick Guerrini Date: Thu, 26 Feb 2015 17:36:33 +0100 Subject: staging: rtl8188eu: Fix trivial typos in comments Change 'disabed' and 'disabel' to 'disabled' Change 'inviation' to 'invitation' Change 'negoitation' to 'negotiation' Signed-off-by: Yannick Guerrini Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/wifi.h | 24 ++++++++++++------------ drivers/staging/rtl8188eu/os_dep/usb_intf.c | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index a68b52208192..a89275e0e0e0 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -888,7 +888,7 @@ enum ht_cap_ampdu_factor { #define P2P_STATUS_FAIL_INCOMPATIBLE_PROVSION 0x0A #define P2P_STATUS_FAIL_USER_REJECT 0x0B -/* Value of Inviation Flags Attribute */ +/* Value of Invitation Flags Attribute */ #define P2P_INVITATION_FLAGS_PERSISTENT BIT(0) #define DMP_P2P_DEVCAP_SUPPORT (P2P_DEVCAP_SERVICE_DISCOVERY | \ @@ -942,7 +942,7 @@ enum ht_cap_ampdu_factor { #define P2P_WILDCARD_SSID_LEN 7 -/* default value, used when: (1)p2p disabed or (2)p2p enabled +/* default value, used when: (1)p2p disabled or (2)p2p enabled * but only do 1 scan phase */ #define P2P_FINDPHASE_EX_NONE 0 /* used when p2p enabled and want to do 1 scan phase and @@ -1007,13 +1007,13 @@ enum P2P_STATE { P2P_STATE_TX_PROVISION_DIS_REQ = 6, P2P_STATE_RX_PROVISION_DIS_RSP = 7, P2P_STATE_RX_PROVISION_DIS_REQ = 8, - /* Doing the group owner negoitation handshake */ + /* Doing the group owner negotiation handshake */ P2P_STATE_GONEGO_ING = 9, - /* finish the group negoitation handshake with success */ + /* finish the group negotiation handshake with success */ P2P_STATE_GONEGO_OK = 10, - /* finish the group negoitation handshake with failure */ + /* finish the group negotiation handshake with failure */ P2P_STATE_GONEGO_FAIL = 11, - /* receiving the P2P Inviation request and match with the profile. */ + /* receiving the P2P Invitation request and match with the profile. */ P2P_STATE_RECV_INVITE_REQ_MATCH = 12, /* Doing the P2P WPS */ P2P_STATE_PROVISIONING_ING = 13, @@ -1023,17 +1023,17 @@ enum P2P_STATE { P2P_STATE_TX_INVITE_REQ = 15, /* Receiving the P2P Invitation response */ P2P_STATE_RX_INVITE_RESP_OK = 16, - /* receiving the P2P Inviation request and dismatch with the profile. */ + /* receiving the P2P Invitation request and dismatch with the profile. */ P2P_STATE_RECV_INVITE_REQ_DISMATCH = 17, - /* receiving the P2P Inviation request and this wifi is GO. */ + /* receiving the P2P Invitation request and this wifi is GO. */ P2P_STATE_RECV_INVITE_REQ_GO = 18, - /* receiving the P2P Inviation request to join an existing P2P Group. */ + /* receiving the P2P Invitation request to join an existing P2P Group. */ P2P_STATE_RECV_INVITE_REQ_JOIN = 19, - /* recveing the P2P Inviation response with failure */ + /* receiving the P2P Invitation response with failure */ P2P_STATE_RX_INVITE_RESP_FAIL = 20, - /* receiving p2p negoitation response with information is not available */ + /* receiving p2p negotiation response with information is not available */ P2P_STATE_RX_INFOR_NOREADY = 21, - /* sending p2p negoitation response with information is not available */ + /* sending p2p negotiation response with information is not available */ P2P_STATE_TX_INFOR_NOREADY = 22, }; diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index bee39c2278f1..ef3c73e38172 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -179,7 +179,7 @@ static void usb_intf_stop(struct adapter *padapter) { RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+usb_intf_stop\n")); - /* disabel_hw_interrupt */ + /* disable_hw_interrupt */ if (!padapter->bSurpriseRemoved) { /* device still exists, so driver can do i/o operation */ /* TODO: */ -- cgit v1.2.3 From 6a3386b15f40e3750b52b9be7a84100edc9ae0f6 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sat, 21 Feb 2015 18:53:44 -0800 Subject: staging: i2o: Remove use of seq_printf return value The seq_printf return value, because it's frequently misused, will eventually be converted to void. See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to seq_has_overflowed() and make public") Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/i2o_proc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/i2o_proc.c b/drivers/staging/i2o/i2o_proc.c index 27d6b824aff8..780fee3224ea 100644 --- a/drivers/staging/i2o/i2o_proc.c +++ b/drivers/staging/i2o/i2o_proc.c @@ -264,16 +264,22 @@ static int i2o_report_query_status(struct seq_file *seq, int block_status, { switch (block_status) { case -ETIMEDOUT: - return seq_printf(seq, "Timeout reading group %s.\n", group); + seq_printf(seq, "Timeout reading group %s.\n", group); + break; case -ENOMEM: - return seq_printf(seq, "No free memory to read the table.\n"); + seq_puts(seq, "No free memory to read the table.\n"); + break; case -I2O_PARAMS_STATUS_INVALID_GROUP_ID: - return seq_printf(seq, "Group %s not supported.\n", group); + seq_printf(seq, "Group %s not supported.\n", group); + break; default: - return seq_printf(seq, - "Error reading group %s. BlockStatus 0x%02X\n", - group, -block_status); + seq_printf(seq, + "Error reading group %s. BlockStatus 0x%02X\n", + group, -block_status); + break; } + + return 0; } static char *bus_strings[] = { -- cgit v1.2.3 From c3d6047d95fad6d70894d7ff79d49e47deae41e5 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Feb 2015 17:38:40 +0530 Subject: staging: sm7xxfb: make vgamode static the variable vgamode is used only in this file and hence can be safely made as static. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/staging/sm7xxfb/sm7xx.h index 7cc1896938b6..c5d62534e4a4 100644 --- a/drivers/staging/sm7xxfb/sm7xx.h +++ b/drivers/staging/sm7xxfb/sm7xx.h @@ -119,7 +119,7 @@ struct ModeInit { /********************************************************************** SM712 Mode table. **********************************************************************/ -struct ModeInit vgamode[] = { +static struct ModeInit vgamode[] = { { /* mode#0: 640 x 480 16Bpp 60Hz */ 640, 480, 16, 60, -- cgit v1.2.3 From 81dee67e215b23f0c98182eece122b906d35765a Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 3 Mar 2015 16:21:06 +0530 Subject: staging: sm750fb: add sm750 to staging sm750 of Silicon Motion is pci-e display controller device and has features like dual display and 2D acceleration. This patch adds the driver to staging. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/sm750fb/Kconfig | 10 + drivers/staging/sm750fb/Makefile | 4 + drivers/staging/sm750fb/TODO | 15 + drivers/staging/sm750fb/ddk750.h | 24 + drivers/staging/sm750fb/ddk750_chip.c | 639 ++++++++ drivers/staging/sm750fb/ddk750_chip.h | 83 + drivers/staging/sm750fb/ddk750_display.c | 318 ++++ drivers/staging/sm750fb/ddk750_display.h | 160 ++ drivers/staging/sm750fb/ddk750_dvi.c | 99 ++ drivers/staging/sm750fb/ddk750_dvi.h | 67 + drivers/staging/sm750fb/ddk750_help.c | 19 + drivers/staging/sm750fb/ddk750_help.h | 29 + drivers/staging/sm750fb/ddk750_hwi2c.c | 271 ++++ drivers/staging/sm750fb/ddk750_hwi2c.h | 10 + drivers/staging/sm750fb/ddk750_mode.c | 205 +++ drivers/staging/sm750fb/ddk750_mode.h | 43 + drivers/staging/sm750fb/ddk750_power.c | 239 +++ drivers/staging/sm750fb/ddk750_power.h | 71 + drivers/staging/sm750fb/ddk750_reg.h | 2616 ++++++++++++++++++++++++++++++ drivers/staging/sm750fb/ddk750_sii164.c | 425 +++++ drivers/staging/sm750fb/ddk750_sii164.h | 172 ++ drivers/staging/sm750fb/ddk750_swi2c.c | 535 ++++++ drivers/staging/sm750fb/ddk750_swi2c.h | 92 ++ drivers/staging/sm750fb/modedb.h | 221 +++ drivers/staging/sm750fb/readme | 38 + drivers/staging/sm750fb/sm750.c | 1451 +++++++++++++++++ drivers/staging/sm750fb/sm750.h | 185 +++ drivers/staging/sm750fb/sm750_accel.c | 516 ++++++ drivers/staging/sm750fb/sm750_accel.h | 276 ++++ drivers/staging/sm750fb/sm750_cursor.c | 254 +++ drivers/staging/sm750fb/sm750_cursor.h | 17 + drivers/staging/sm750fb/sm750_help.h | 111 ++ drivers/staging/sm750fb/sm750_hw.c | 640 ++++++++ drivers/staging/sm750fb/sm750_hw.h | 104 ++ 36 files changed, 9962 insertions(+) create mode 100644 drivers/staging/sm750fb/Kconfig create mode 100644 drivers/staging/sm750fb/Makefile create mode 100644 drivers/staging/sm750fb/TODO create mode 100644 drivers/staging/sm750fb/ddk750.h create mode 100644 drivers/staging/sm750fb/ddk750_chip.c create mode 100644 drivers/staging/sm750fb/ddk750_chip.h create mode 100644 drivers/staging/sm750fb/ddk750_display.c create mode 100644 drivers/staging/sm750fb/ddk750_display.h create mode 100644 drivers/staging/sm750fb/ddk750_dvi.c create mode 100644 drivers/staging/sm750fb/ddk750_dvi.h create mode 100644 drivers/staging/sm750fb/ddk750_help.c create mode 100644 drivers/staging/sm750fb/ddk750_help.h create mode 100644 drivers/staging/sm750fb/ddk750_hwi2c.c create mode 100644 drivers/staging/sm750fb/ddk750_hwi2c.h create mode 100644 drivers/staging/sm750fb/ddk750_mode.c create mode 100644 drivers/staging/sm750fb/ddk750_mode.h create mode 100644 drivers/staging/sm750fb/ddk750_power.c create mode 100644 drivers/staging/sm750fb/ddk750_power.h create mode 100644 drivers/staging/sm750fb/ddk750_reg.h create mode 100644 drivers/staging/sm750fb/ddk750_sii164.c create mode 100644 drivers/staging/sm750fb/ddk750_sii164.h create mode 100644 drivers/staging/sm750fb/ddk750_swi2c.c create mode 100644 drivers/staging/sm750fb/ddk750_swi2c.h create mode 100644 drivers/staging/sm750fb/modedb.h create mode 100644 drivers/staging/sm750fb/readme create mode 100644 drivers/staging/sm750fb/sm750.c create mode 100644 drivers/staging/sm750fb/sm750.h create mode 100644 drivers/staging/sm750fb/sm750_accel.c create mode 100644 drivers/staging/sm750fb/sm750_accel.h create mode 100644 drivers/staging/sm750fb/sm750_cursor.c create mode 100644 drivers/staging/sm750fb/sm750_cursor.h create mode 100644 drivers/staging/sm750fb/sm750_help.h create mode 100644 drivers/staging/sm750fb/sm750_hw.c create mode 100644 drivers/staging/sm750fb/sm750_hw.h (limited to 'drivers/staging') diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 45baa83be7ce..5da70fddd036 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -58,6 +58,8 @@ source "drivers/staging/iio/Kconfig" source "drivers/staging/sm7xxfb/Kconfig" +source "drivers/staging/sm750fb/Kconfig" + source "drivers/staging/xgifb/Kconfig" source "drivers/staging/emxx_udc/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 29160790841f..0b922ae30356 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_VT6656) += vt6656/ obj-$(CONFIG_VME_BUS) += vme/ obj-$(CONFIG_IIO) += iio/ obj-$(CONFIG_FB_SM7XX) += sm7xxfb/ +obj-$(CONFIG_FB_SM7XX) += sm750fb/ obj-$(CONFIG_FB_XGI) += xgifb/ obj-$(CONFIG_USB_EMXX) += emxx_udc/ obj-$(CONFIG_FT1000) += ft1000/ diff --git a/drivers/staging/sm750fb/Kconfig b/drivers/staging/sm750fb/Kconfig new file mode 100644 index 000000000000..c40d088a4d3b --- /dev/null +++ b/drivers/staging/sm750fb/Kconfig @@ -0,0 +1,10 @@ +config FB_SM750 + tristate "Silicon Motion SM750 framebuffer support" + depends on FB && PCI + help + Frame buffer driver for the Silicon Motion SM750 chip + with 2D accelearion and dual head support. + + This driver is also available as a module. The module will be + called sm750fb. If you want to compile it as a module, say M + here and read . diff --git a/drivers/staging/sm750fb/Makefile b/drivers/staging/sm750fb/Makefile new file mode 100644 index 000000000000..dcce3f487ed5 --- /dev/null +++ b/drivers/staging/sm750fb/Makefile @@ -0,0 +1,4 @@ +obj-$(CONFIG_FB_SM750) += sm750fb.o + +sm750fb-objs := sm750.o sm750_hw.o sm750_accel.o sm750_cursor.o ddk750_chip.o ddk750_power.o ddk750_mode.o +sm750fb-objs += ddk750_display.o ddk750_help.o ddk750_swi2c.o ddk750_sii164.o ddk750_dvi.o ddk750_hwi2c.o diff --git a/drivers/staging/sm750fb/TODO b/drivers/staging/sm750fb/TODO new file mode 100644 index 000000000000..bc1617249395 --- /dev/null +++ b/drivers/staging/sm750fb/TODO @@ -0,0 +1,15 @@ +TODO: +- lots of clechpatch cleanup +- use kernel coding style +- refine the code and remove unused code +- check on hardware effects of removal of USE_HW_I2C and USE_DVICHIP (these two + are supposed to be sample code which is given here if someone wants to + use those functionalities) +- move it to drivers/video/fbdev +- modify the code for drm framework + +Please send any patches to + Greg Kroah-Hartman + Sudip Mukherjee + Teddy Wang + Sudip Mukherjee diff --git a/drivers/staging/sm750fb/ddk750.h b/drivers/staging/sm750fb/ddk750.h new file mode 100644 index 000000000000..2c10a08ed964 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750.h @@ -0,0 +1,24 @@ +#ifndef DDK750_H__ +#define DDK750_H__ +/******************************************************************* +* +* Copyright (c) 2007 by Silicon Motion, Inc. (SMI) +* +* All rights are reserved. Reproduction or in part is prohibited +* without the written consent of the copyright owner. +* +* RegSC.h --- SM718 SDK +* This file contains the definitions for the System Configuration registers. +* +*******************************************************************/ +#include "ddk750_reg.h" +#include "ddk750_mode.h" +#include "ddk750_chip.h" +#include "ddk750_display.h" +#include "ddk750_power.h" +#include "ddk750_help.h" +#ifdef USE_HW_I2C +#include "ddk750_hwi2c.h" +#endif +#include "ddk750_swi2c.h" +#endif diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c new file mode 100644 index 000000000000..b71169ed063c --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -0,0 +1,639 @@ +#include "ddk750_help.h" +#include "ddk750_reg.h" +#include "ddk750_chip.h" +#include "ddk750_power.h" +typedef struct _pllcalparam{ + unsigned char power;/* d : 0~ 6*/ + unsigned char pod; + unsigned char od; + unsigned char value;/* value of 2 power d (2^d) */ +} +pllcalparam; + + +logical_chip_type_t getChipType() +{ + unsigned short physicalID; + char physicalRev; + logical_chip_type_t chip; + + physicalID = devId750;//either 0x718 or 0x750 + physicalRev = revId750; + + if (physicalID == 0x718) + { + chip = SM718; + } + else if (physicalID == 0x750) + { + chip = SM750; + /* SM750 and SM750LE are different in their revision ID only. */ + if (physicalRev == SM750LE_REVISION_ID){ + chip = SM750LE; + } + } + else + { + chip = SM_UNKNOWN; + } + + return chip; +} + + +inline unsigned int twoToPowerOfx(unsigned long x) +{ + unsigned long i; + unsigned long result = 1; + + for (i=1; i<=x; i++) + result *= 2; + return result; +} + +inline unsigned int calcPLL(pll_value_t *pPLL) +{ + return (pPLL->inputFreq * pPLL->M / pPLL->N / twoToPowerOfx(pPLL->OD) / twoToPowerOfx(pPLL->POD)); +} + +unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL) +{ + unsigned int ulPllReg = 0; + + pPLL->inputFreq = DEFAULT_INPUT_CLOCK; + pPLL->clockType = clockType; + + switch (clockType) + { + case MXCLK_PLL: + ulPllReg = PEEK32(MXCLK_PLL_CTRL); + break; + case PRIMARY_PLL: + ulPllReg = PEEK32(PANEL_PLL_CTRL); + break; + case SECONDARY_PLL: + ulPllReg = PEEK32(CRT_PLL_CTRL); + break; + case VGA0_PLL: + ulPllReg = PEEK32(VGA_PLL0_CTRL); + break; + case VGA1_PLL: + ulPllReg = PEEK32(VGA_PLL1_CTRL); + break; + } + + pPLL->M = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, M); + pPLL->N = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, N); + pPLL->OD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, OD); + pPLL->POD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, POD); + + return calcPLL(pPLL); +} + + +unsigned int getChipClock() +{ + pll_value_t pll; +#if 1 + if(getChipType() == SM750LE) + return MHz(130); +#endif + + return getPllValue(MXCLK_PLL, &pll); +} + + +/* + * This function set up the main chip clock. + * + * Input: Frequency to be set. + */ +void setChipClock(unsigned int frequency) +{ + pll_value_t pll; + unsigned int ulActualMxClk; +#if 1 + /* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */ + if (getChipType() == SM750LE) + return; +#endif + + if (frequency != 0) + { + /* + * Set up PLL, a structure to hold the value to be set in clocks. + */ + pll.inputFreq = DEFAULT_INPUT_CLOCK; /* Defined in CLOCK.H */ + pll.clockType = MXCLK_PLL; + + /* + * Call calcPllValue() to fill up the other fields for PLL structure. + * Sometime, the chip cannot set up the exact clock required by User. + * Return value from calcPllValue() gives the actual possible clock. + */ + ulActualMxClk = calcPllValue(frequency, &pll); + + /* Master Clock Control: MXCLK_PLL */ + POKE32(MXCLK_PLL_CTRL, formatPllReg(&pll)); + } +} + + + +void setMemoryClock(unsigned int frequency) +{ + unsigned int ulReg, divisor; + #if 1 + /* Cheok_0509: For SM750LE, the memory clock is fixed. Nothing to set. */ + if (getChipType() == SM750LE) + return; +#endif + if (frequency != 0) + { + /* Set the frequency to the maximum frequency that the DDR Memory can take + which is 336MHz. */ + if (frequency > MHz(336)) + frequency = MHz(336); + + /* Calculate the divisor */ + divisor = (unsigned int) roundedDiv(getChipClock(), frequency); + + /* Set the corresponding divisor in the register. */ + ulReg = PEEK32(CURRENT_GATE); + switch(divisor) + { + default: + case 1: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_1); + break; + case 2: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_2); + break; + case 3: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_3); + break; + case 4: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_4); + break; + } + + setCurrentGate(ulReg); + } +} + + +/* + * This function set up the master clock (MCLK). + * + * Input: Frequency to be set. + * + * NOTE: + * The maximum frequency the engine can run is 168MHz. + */ +void setMasterClock(unsigned int frequency) +{ + unsigned int ulReg, divisor; + #if 1 + /* Cheok_0509: For SM750LE, the memory clock is fixed. Nothing to set. */ + if (getChipType() == SM750LE) + return; +#endif + if (frequency != 0) + { + /* Set the frequency to the maximum frequency that the SM750 engine can + run, which is about 190 MHz. */ + if (frequency > MHz(190)) + frequency = MHz(190); + + /* Calculate the divisor */ + divisor = (unsigned int) roundedDiv(getChipClock(), frequency); + + /* Set the corresponding divisor in the register. */ + ulReg = PEEK32(CURRENT_GATE); + switch(divisor) + { + default: + case 3: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_3); + break; + case 4: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_4); + break; + case 6: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_6); + break; + case 8: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_8); + break; + } + + setCurrentGate(ulReg); + } +} + + +unsigned int ddk750_getVMSize() +{ + unsigned int reg; + unsigned int data; + + /* sm750le only use 64 mb memory*/ + if(getChipType() == SM750LE) + return MB(64); + + /* for 750,always use power mode0*/ + reg = PEEK32(MODE0_GATE); + reg = FIELD_SET(reg,MODE0_GATE,GPIO,ON); + POKE32(MODE0_GATE,reg); + + /* get frame buffer size from GPIO */ + reg = FIELD_GET(PEEK32(MISC_CTRL),MISC_CTRL,LOCALMEM_SIZE); + switch(reg){ + case MISC_CTRL_LOCALMEM_SIZE_8M: data = MB(8); break; /* 8 Mega byte */ + case MISC_CTRL_LOCALMEM_SIZE_16M: data = MB(16); break; /* 16 Mega byte */ + case MISC_CTRL_LOCALMEM_SIZE_32M: data = MB(32); break; /* 32 Mega byte */ + case MISC_CTRL_LOCALMEM_SIZE_64M: data = MB(64); break; /* 64 Mega byte */ + default: data = 0;break; + } + return data; + +} + +int ddk750_initHw(initchip_param_t * pInitParam) +{ + + unsigned int ulReg; +#if 0 + //move the code to map regiter function. + if(getChipType() == SM718){ + /* turn on big endian bit*/ + ulReg = PEEK32(0x74); + /* now consider register definition in a big endian pattern*/ + POKE32(0x74,ulReg|0x80000000); + } + +#endif + + + if (pInitParam->powerMode != 0 ) + pInitParam->powerMode = 0; + setPowerMode(pInitParam->powerMode); + + /* Enable display power gate & LOCALMEM power gate*/ + ulReg = PEEK32(CURRENT_GATE); + ulReg = FIELD_SET(ulReg, CURRENT_GATE, DISPLAY, ON); + ulReg = FIELD_SET(ulReg,CURRENT_GATE,LOCALMEM,ON); + setCurrentGate(ulReg); + + if(getChipType() != SM750LE){ + /* set panel pll and graphic mode via mmio_88 */ + ulReg = PEEK32(VGA_CONFIGURATION); + ulReg = FIELD_SET(ulReg,VGA_CONFIGURATION,PLL,PANEL); + ulReg = FIELD_SET(ulReg,VGA_CONFIGURATION,MODE,GRAPHIC); + POKE32(VGA_CONFIGURATION,ulReg); + }else{ +#if defined(__i386__) || defined( __x86_64__) + /* set graphic mode via IO method */ + outb_p(0x88,0x3d4); + outb_p(0x06,0x3d5); +#endif + } + + /* Set the Main Chip Clock */ + setChipClock(MHz((unsigned int)pInitParam->chipClock)); + + /* Set up memory clock. */ + setMemoryClock(MHz(pInitParam->memClock)); + + /* Set up master clock */ + setMasterClock(MHz(pInitParam->masterClock)); + + + /* Reset the memory controller. If the memory controller is not reset in SM750, + the system might hang when sw accesses the memory. + The memory should be resetted after changing the MXCLK. + */ + if (pInitParam->resetMemory == 1) + { + ulReg = PEEK32(MISC_CTRL); + ulReg = FIELD_SET(ulReg, MISC_CTRL, LOCALMEM_RESET, RESET); + POKE32(MISC_CTRL, ulReg); + + ulReg = FIELD_SET(ulReg, MISC_CTRL, LOCALMEM_RESET, NORMAL); + POKE32(MISC_CTRL, ulReg); + } + + if (pInitParam->setAllEngOff == 1) + { + enable2DEngine(0); + + /* Disable Overlay, if a former application left it on */ + ulReg = PEEK32(VIDEO_DISPLAY_CTRL); + ulReg = FIELD_SET(ulReg, VIDEO_DISPLAY_CTRL, PLANE, DISABLE); + POKE32(VIDEO_DISPLAY_CTRL, ulReg); + + /* Disable video alpha, if a former application left it on */ + ulReg = PEEK32(VIDEO_ALPHA_DISPLAY_CTRL); + ulReg = FIELD_SET(ulReg, VIDEO_ALPHA_DISPLAY_CTRL, PLANE, DISABLE); + POKE32(VIDEO_ALPHA_DISPLAY_CTRL, ulReg); + + /* Disable alpha plane, if a former application left it on */ + ulReg = PEEK32(ALPHA_DISPLAY_CTRL); + ulReg = FIELD_SET(ulReg, ALPHA_DISPLAY_CTRL, PLANE, DISABLE); + POKE32(ALPHA_DISPLAY_CTRL, ulReg); + +#if 0 + /* Disable LCD hardware cursor, if a former application left it on */ + ulReg = PEEK32(PANEL_HWC_ADDRESS); + ulReg = FIELD_SET(ulReg, PANEL_HWC_ADDRESS, ENABLE, DISABLE); + POKE32(PANEL_HWC_ADDRESS, ulReg); + + /* Disable CRT hardware cursor, if a former application left it on */ + ulReg = PEEK32(CRT_HWC_ADDRESS); + ulReg = FIELD_SET(ulReg, CRT_HWC_ADDRESS, ENABLE, DISABLE); + POKE32(CRT_HWC_ADDRESS, ulReg); + + /* Disable ZV Port 0, if a former application left it on */ + ulReg = PEEK32(ZV0_CAPTURE_CTRL); + ulReg = FIELD_SET(ulReg, ZV0_CAPTURE_CTRL, CAP, DISABLE); + POKE32(ZV0_CAPTURE_CTRL, ulReg); + + /* Disable ZV Port 1, if a former application left it on */ + ulReg = PEEK32(ZV1_CAPTURE_CTRL); + ulReg = FIELD_SET(ulReg, ZV1_CAPTURE_CTRL, CAP, DISABLE); + POKE32(ZV1_CAPTURE_CTRL, ulReg); + + /* Disable ZV Port Power, if a former application left it on */ + enableZVPort(0); + /* Disable DMA Channel, if a former application left it on */ + ulReg = PEEK32(DMA_ABORT_INTERRUPT); + ulReg = FIELD_SET(ulReg, DMA_ABORT_INTERRUPT, ABORT_1, ABORT); + POKE32(DMA_ABORT_INTERRUPT, ulReg); + + /* Disable i2c */ + enableI2C(0); +#endif + /* Disable DMA Channel, if a former application left it on */ + ulReg = PEEK32(DMA_ABORT_INTERRUPT); + ulReg = FIELD_SET(ulReg, DMA_ABORT_INTERRUPT, ABORT_1, ABORT); + POKE32(DMA_ABORT_INTERRUPT, ulReg); + + /* Disable DMA Power, if a former application left it on */ + enableDMA(0); + } + + /* We can add more initialization as needed. */ + + return 0; +} + +#if 0 + +unsigned int absDiff(unsigned int a, unsigned int b) +{ + if ( a > b ) + return(a - b); + else + return(b - a); +} + +#endif +/* + monk liu @ 4/6/2011: + re-write the calculatePLL function of ddk750. + the original version function does not use some mathematics tricks and shortcut + when it doing the calculation of the best N,M,D combination + I think this version gives a little upgrade in speed + + 750 pll clock formular: + Request Clock = (Input Clock * M )/(N * X) + + Input Clock = 14318181 hz + X = 2 power D + D ={0,1,2,3,4,5,6} + M = {1,...,255} + N = {2,...,15} +*/ +unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) +{ + /* used for primary and secondary channel pixel clock pll */ + static pllcalparam xparm_PIXEL[] = { + /* 2^0 = 1*/ {0,0,0,1}, + /* 2^ 1 =2*/ {1,0,1,2}, + /* 2^ 2 = 4*/ {2,0,2,4}, + {3,0,3,8}, + {4,1,3,16}, + {5,2,3,32}, + /* 2^6 = 64 */ {6,3,3,64}, + }; + + /* used for MXCLK (chip clock) */ + static pllcalparam xparm_MXCLK[] = { + /* 2^0 = 1*/ {0,0,0,1}, + /* 2^ 1 =2*/ {1,0,1,2}, + /* 2^ 2 = 4*/ {2,0,2,4}, + {3,0,3,8}, + }; + + /* as sm750 register definition, N located in 2,15 and M located in 1,255 */ + int N,M,X,d; + int xcnt; + int miniDiff; + unsigned int RN,quo,rem,fl_quo; + unsigned int input,request; + unsigned int tmpClock,ret; + pllcalparam * xparm; + +#if 1 + if (getChipType() == SM750LE) + { + /* SM750LE don't have prgrammable PLL and M/N values to work on. + Just return the requested clock. */ + return request_orig; + } +#endif + + ret = 0; + miniDiff = ~0; + request = request_orig / 1000; + input = pll->inputFreq / 1000; + + /* for MXCLK register , no POD provided, so need be treated differently */ + + if(pll->clockType != MXCLK_PLL){ + xparm = &xparm_PIXEL[0]; + xcnt = sizeof(xparm_PIXEL)/sizeof(xparm_PIXEL[0]); + }else{ + xparm = &xparm_MXCLK[0]; + xcnt = sizeof(xparm_MXCLK)/sizeof(xparm_MXCLK[0]); + } + + + for(N = 15;N>1;N--) + { + /* RN will not exceed maximum long if @request <= 285 MHZ (for 32bit cpu) */ + RN = N * request; + quo = RN / input; + rem = RN % input;/* rem always small than 14318181 */ + fl_quo = (rem * 10000 /input); + + for(d = xcnt - 1;d >= 0;d--){ + X = xparm[d].value; + M = quo*X; + M += fl_quo * X / 10000; + /* round step */ + M += (fl_quo*X % 10000)>5000?1:0; + if(M < 256 && M > 0) + { + unsigned int diff; + tmpClock = pll->inputFreq *M / N / X; + diff = absDiff(tmpClock,request_orig); + if(diff < miniDiff) + { + pll->M = M; + pll->N = N; + pll->OD = xparm[d].od; + pll->POD = xparm[d].pod; + miniDiff = diff; + ret = tmpClock; + } + } + } + } + + //printk("Finally: pll->n[%lu],m[%lu],od[%lu],pod[%lu]\n",pll->N,pll->M,pll->OD,pll->POD); + return ret; +} + +unsigned int calcPllValue2( +unsigned int ulRequestClk, /* Required pixel clock in Hz unit */ +pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ +) +{ + unsigned int M, N, OD, POD = 0, diff, pllClk, odPower, podPower; + unsigned int bestDiff = 0xffffffff; /* biggest 32 bit unsigned number */ + unsigned int ret; + /* Init PLL structure to know states */ + pPLL->M = 0; + pPLL->N = 0; + pPLL->OD = 0; + pPLL->POD = 0; + + /* Sanity check: None at the moment */ + + /* Convert everything in Khz range in order to avoid calculation overflow */ + pPLL->inputFreq /= 1000; + ulRequestClk /= 1000; + +#ifndef VALIDATION_CHIP + /* The maximum of post divider is 8. */ + for (POD=0; POD<=3; POD++) +#endif + { + +#ifndef VALIDATION_CHIP + /* MXCLK_PLL does not have post divider. */ + if ((POD > 0) && (pPLL->clockType == MXCLK_PLL)) + break; +#endif + + /* Work out 2 to the power of POD */ + podPower = twoToPowerOfx(POD); + + /* OD has only 2 bits [15:14] and its value must between 0 to 3 */ + for (OD=0; OD<=3; OD++) + { + /* Work out 2 to the power of OD */ + odPower = twoToPowerOfx(OD); + +#ifdef VALIDATION_CHIP + if (odPower > 4) + podPower = 4; + else + podPower = odPower; +#endif + + /* N has 4 bits [11:8] and its value must between 2 and 15. + The N == 1 will behave differently --> Result is not correct. */ + for (N=2; N<=15; N++) + { + /* The formula for PLL is ulRequestClk = inputFreq * M / N / (2^OD) + In the following steps, we try to work out a best M value given the others are known. + To avoid decimal calculation, we use 1000 as multiplier for up to 3 decimal places of accuracy. + */ + M = ulRequestClk * N * odPower * 1000 / pPLL->inputFreq; + M = roundedDiv(M, 1000); + + /* M field has only 8 bits, reject value bigger than 8 bits */ + if (M < 256) + { + /* Calculate the actual clock for a given M & N */ + pllClk = pPLL->inputFreq * M / N / odPower / podPower; + + /* How much are we different from the requirement */ + diff = absDiff(pllClk, ulRequestClk); + + if (diff < bestDiff) + { + bestDiff = diff; + + /* Store M and N values */ + pPLL->M = M; + pPLL->N = N; + pPLL->OD = OD; + +#ifdef VALIDATION_CHIP + if (OD > 2) + POD = 2; + else + POD = OD; +#endif + + pPLL->POD = POD; + } + } + } + } + } + + /* Restore input frequency from Khz to hz unit */ +// pPLL->inputFreq *= 1000; + ulRequestClk *= 1000; + pPLL->inputFreq = DEFAULT_INPUT_CLOCK; /* Default reference clock */ + + /* Output debug information */ + //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Requested Frequency = %d\n", ulRequestClk)); + //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Input CLK = %dHz, M=%d, N=%d, OD=%d, POD=%d\n", pPLL->inputFreq, pPLL->M, pPLL->N, pPLL->OD, pPLL->POD)); + + /* Return actual frequency that the PLL can set */ + ret = calcPLL(pPLL); + return ret; +} + + + + + +unsigned int formatPllReg(pll_value_t *pPLL) +{ + unsigned int ulPllReg = 0; + + /* Note that all PLL's have the same format. Here, we just use Panel PLL parameter + to work out the bit fields in the register. + On returning a 32 bit number, the value can be applied to any PLL in the calling function. + */ + ulPllReg = + FIELD_SET( 0, PANEL_PLL_CTRL, BYPASS, OFF) + | FIELD_SET( 0, PANEL_PLL_CTRL, POWER, ON) + | FIELD_SET( 0, PANEL_PLL_CTRL, INPUT, OSC) +#ifndef VALIDATION_CHIP + | FIELD_VALUE(0, PANEL_PLL_CTRL, POD, pPLL->POD) +#endif + | FIELD_VALUE(0, PANEL_PLL_CTRL, OD, pPLL->OD) + | FIELD_VALUE(0, PANEL_PLL_CTRL, N, pPLL->N) + | FIELD_VALUE(0, PANEL_PLL_CTRL, M, pPLL->M); + + return(ulPllReg); +} + + diff --git a/drivers/staging/sm750fb/ddk750_chip.h b/drivers/staging/sm750fb/ddk750_chip.h new file mode 100644 index 000000000000..1c7887512b69 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_chip.h @@ -0,0 +1,83 @@ +#ifndef DDK750_CHIP_H__ +#define DDK750_CHIP_H__ +#define DEFAULT_INPUT_CLOCK 14318181 /* Default reference clock */ +#define SM750LE_REVISION_ID (char)0xfe + +/* This is all the chips recognized by this library */ +typedef enum _logical_chip_type_t +{ + SM_UNKNOWN, + SM718, + SM750, + SM750LE, +} +logical_chip_type_t; + + +typedef enum _clock_type_t +{ + MXCLK_PLL, + PRIMARY_PLL, + SECONDARY_PLL, + VGA0_PLL, + VGA1_PLL, +} +clock_type_t; + +typedef struct _pll_value_t +{ + clock_type_t clockType; + unsigned long inputFreq; /* Input clock frequency to the PLL */ + + /* Use this when clockType = PANEL_PLL */ + unsigned long M; + unsigned long N; + unsigned long OD; + unsigned long POD; +} +pll_value_t; + +/* input struct to initChipParam() function */ +typedef struct _initchip_param_t +{ + unsigned short powerMode; /* Use power mode 0 or 1 */ + unsigned short chipClock; /* Speed of main chip clock in MHz unit + 0 = keep the current clock setting + Others = the new main chip clock + */ + unsigned short memClock; /* Speed of memory clock in MHz unit + 0 = keep the current clock setting + Others = the new memory clock + */ + unsigned short masterClock; /* Speed of master clock in MHz unit + 0 = keep the current clock setting + Others = the new master clock + */ + unsigned short setAllEngOff; /* 0 = leave all engine state untouched. + 1 = make sure they are off: 2D, Overlay, + video alpha, alpha, hardware cursors + */ + unsigned char resetMemory; /* 0 = Do not reset the memory controller + 1 = Reset the memory controller + */ + + /* More initialization parameter can be added if needed */ +} +initchip_param_t; + + +logical_chip_type_t getChipType(void); +unsigned int calcPllValue(unsigned int request,pll_value_t *pll); +unsigned int calcPllValue2(unsigned int,pll_value_t *); +unsigned int formatPllReg(pll_value_t *pPLL); +void ddk750_set_mmio(volatile unsigned char *,unsigned short,char); +unsigned int ddk750_getVMSize(void); +int ddk750_initHw(initchip_param_t *); +unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL); +unsigned int getChipClock(void); +void setChipClock(unsigned int); +void setMemoryClock(unsigned int frequency); +void setMasterClock(unsigned int frequency); + + +#endif diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c new file mode 100644 index 000000000000..57192e5b4730 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -0,0 +1,318 @@ +#include "ddk750_reg.h" +#include "ddk750_help.h" +#include "ddk750_display.h" +#include "ddk750_power.h" +#include "ddk750_dvi.h" + +#define primaryWaitVerticalSync(delay) waitNextVerticalSync(0,delay) + +static void setDisplayControl(int ctrl,int dispState) +{ + /* state != 0 means turn on both timing & plane en_bit */ + unsigned long ulDisplayCtrlReg, ulReservedBits; + int cnt; + + cnt = 0; + + /* Set the primary display control */ + if (!ctrl) + { + ulDisplayCtrlReg = PEEK32(PANEL_DISPLAY_CTRL); + /* Turn on/off the Panel display control */ + if (dispState) + { + /* Timing should be enabled first before enabling the plane + * because changing at the same time does not guarantee that + * the plane will also enabled or disabled. + */ + ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, + PANEL_DISPLAY_CTRL, TIMING, ENABLE); + POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); + + ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, + PANEL_DISPLAY_CTRL, PLANE, ENABLE); + + /* Added some masks to mask out the reserved bits. + * Sometimes, the reserved bits are set/reset randomly when + * writing to the PRIMARY_DISPLAY_CTRL, therefore, the register + * reserved bits are needed to be masked out. + */ + ulReservedBits = FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_1_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_2_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE); + + /* Somehow the register value on the plane is not set + * until a few delay. Need to write + * and read it a couple times + */ + do + { + cnt++; + POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); + } while((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != + (ulDisplayCtrlReg & ~ulReservedBits)); + printk("Set Panel Plane enbit:after tried %d times\n",cnt); + } + else + { + /* When turning off, there is no rule on the programming + * sequence since whenever the clock is off, then it does not + * matter whether the plane is enabled or disabled. + * Note: Modifying the plane bit will take effect on the + * next vertical sync. Need to find out if it is necessary to + * wait for 1 vsync before modifying the timing enable bit. + * */ + ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, + PANEL_DISPLAY_CTRL, PLANE, DISABLE); + POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); + + ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, + PANEL_DISPLAY_CTRL, TIMING, DISABLE); + POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); + } + + } + /* Set the secondary display control */ + else + { + ulDisplayCtrlReg = PEEK32(CRT_DISPLAY_CTRL); + + if (dispState) + { + /* Timing should be enabled first before enabling the plane because changing at the + same time does not guarantee that the plane will also enabled or disabled. + */ + ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, + CRT_DISPLAY_CTRL, TIMING, ENABLE); + POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); + + ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, + CRT_DISPLAY_CTRL, PLANE, ENABLE); + + /* Added some masks to mask out the reserved bits. + * Sometimes, the reserved bits are set/reset randomly when + * writing to the PRIMARY_DISPLAY_CTRL, therefore, the register + * reserved bits are needed to be masked out. + */ + + ulReservedBits = FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_1_MASK, ENABLE) | + FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_2_MASK, ENABLE) | + FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE) | + FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_4_MASK, ENABLE); + + do + { + cnt++; + POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); + } while((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) != + (ulDisplayCtrlReg & ~ulReservedBits)); + printk("Set Crt Plane enbit:after tried %d times\n",cnt); + } + else + { + /* When turning off, there is no rule on the programming + * sequence since whenever the clock is off, then it does not + * matter whether the plane is enabled or disabled. + * Note: Modifying the plane bit will take effect on the next + * vertical sync. Need to find out if it is necessary to + * wait for 1 vsync before modifying the timing enable bit. + */ + ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, + CRT_DISPLAY_CTRL, PLANE, DISABLE); + POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); + + ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, + CRT_DISPLAY_CTRL, TIMING, DISABLE); + POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); + } + } +} + + +static void waitNextVerticalSync(int ctrl,int delay) +{ + unsigned int status; + if(!ctrl){ + /* primary controller */ + + /* Do not wait when the Primary PLL is off or display control is already off. + This will prevent the software to wait forever. */ + if ((FIELD_GET(PEEK32(PANEL_PLL_CTRL), PANEL_PLL_CTRL, POWER) == + PANEL_PLL_CTRL_POWER_OFF) || + (FIELD_GET(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, TIMING) == + PANEL_DISPLAY_CTRL_TIMING_DISABLE)) + { + return; + } + + while (delay-- > 0) + { + /* Wait for end of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + PANEL_VSYNC); + } + while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); + + /* Wait for start of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + PANEL_VSYNC); + } + while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); + } + + }else{ + + /* Do not wait when the Primary PLL is off or display control is already off. + This will prevent the software to wait forever. */ + if ((FIELD_GET(PEEK32(CRT_PLL_CTRL), CRT_PLL_CTRL, POWER) == + CRT_PLL_CTRL_POWER_OFF) || + (FIELD_GET(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, TIMING) == + CRT_DISPLAY_CTRL_TIMING_DISABLE)) + { + return; + } + + while (delay-- > 0) + { + /* Wait for end of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + CRT_VSYNC); + } + while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE); + + /* Wait for start of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + CRT_VSYNC); + } + while (status == SYSTEM_CTRL_CRT_VSYNC_INACTIVE); + } + } +} + +static void swPanelPowerSequence_sm750le(int disp,int delay) +{ + unsigned int reg; + reg = PEEK32(DISPLAY_CONTROL_750LE); + if(disp) + reg |= 0xf; + else + reg &= ~0xf; + POKE32(DISPLAY_CONTROL_750LE,reg); +} + +static void swPanelPowerSequence(int disp,int delay) +{ + unsigned int reg; + + /* disp should be 1 to open sequence */ + reg = PEEK32(PANEL_DISPLAY_CTRL); + reg = FIELD_VALUE(reg,PANEL_DISPLAY_CTRL,FPEN,disp); + POKE32(PANEL_DISPLAY_CTRL,reg); + primaryWaitVerticalSync(delay); + + + reg = PEEK32(PANEL_DISPLAY_CTRL); + reg = FIELD_VALUE(reg,PANEL_DISPLAY_CTRL,DATA,disp); + POKE32(PANEL_DISPLAY_CTRL,reg); + primaryWaitVerticalSync(delay); + + reg = PEEK32(PANEL_DISPLAY_CTRL); + reg = FIELD_VALUE(reg,PANEL_DISPLAY_CTRL,VBIASEN,disp); + POKE32(PANEL_DISPLAY_CTRL,reg); + primaryWaitVerticalSync(delay); + + + reg = PEEK32(PANEL_DISPLAY_CTRL); + reg = FIELD_VALUE(reg,PANEL_DISPLAY_CTRL,FPEN,disp); + POKE32(PANEL_DISPLAY_CTRL,reg); + primaryWaitVerticalSync(delay); + +} + +void ddk750_setLogicalDispOut(disp_output_t output) +{ + unsigned int reg; + if(output & PNL_2_USAGE){ + /* set panel path controller select */ + reg = PEEK32(PANEL_DISPLAY_CTRL); + reg = FIELD_VALUE(reg,PANEL_DISPLAY_CTRL,SELECT,(output & PNL_2_MASK)>>PNL_2_OFFSET); + POKE32(PANEL_DISPLAY_CTRL,reg); + } + + if(output & CRT_2_USAGE){ + /* set crt path controller select */ + reg = PEEK32(CRT_DISPLAY_CTRL); + reg = FIELD_VALUE(reg,CRT_DISPLAY_CTRL,SELECT,(output & CRT_2_MASK)>>CRT_2_OFFSET); + /*se blank off */ + reg = FIELD_SET(reg,CRT_DISPLAY_CTRL,BLANK,OFF); + POKE32(CRT_DISPLAY_CTRL,reg); + + } + + if(output & PRI_TP_USAGE){ + /* set primary timing and plane en_bit */ + setDisplayControl(0,(output&PRI_TP_MASK)>>PRI_TP_OFFSET); + } + + if(output & SEC_TP_USAGE){ + /* set secondary timing and plane en_bit*/ + setDisplayControl(1,(output&SEC_TP_MASK)>>SEC_TP_OFFSET); + } + + if(output & PNL_SEQ_USAGE){ + /* set panel sequence */ + swPanelPowerSequence((output&PNL_SEQ_MASK)>>PNL_SEQ_OFFSET,4); + } + + if(output & DAC_USAGE) + setDAC((output & DAC_MASK)>>DAC_OFFSET); + + if(output & DPMS_USAGE) + ddk750_setDPMS((output & DPMS_MASK) >> DPMS_OFFSET); +} + + +int ddk750_initDVIDisp() +{ + /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are + not zeroed, then set the failure flag. If it is zeroe, it might mean + that the system is in Dual CRT Monitor configuration. */ + + /* De-skew enabled with default 111b value. + This will fix some artifacts problem in some mode on board 2.2. + Somehow this fix does not affect board 2.1. + */ + if ((dviInit(1, /* Select Rising Edge */ + 1, /* Select 24-bit bus */ + 0, /* Select Single Edge clock */ + 1, /* Enable HSync as is */ + 1, /* Enable VSync as is */ + 1, /* Enable De-skew */ + 7, /* Set the de-skew setting to maximum setup */ + 1, /* Enable continuous Sync */ + 1, /* Enable PLL Filter */ + 4 /* Use the recommended value for PLL Filter value */ + ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) + { + return (-1); + } + + /* TODO: Initialize other display component */ + + /* Success */ + return 0; + +} + diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h new file mode 100644 index 000000000000..ae0f84c68de5 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -0,0 +1,160 @@ +#ifndef DDK750_DISPLAY_H__ +#define DDK750_DISPLAY_H__ + +/* panel path select + 80000[29:28] +*/ + +#define PNL_2_OFFSET 0 +#define PNL_2_MASK (3 << PNL_2_OFFSET) +#define PNL_2_USAGE (PNL_2_MASK << 16) +#define PNL_2_PRI ((0 << PNL_2_OFFSET)|PNL_2_USAGE) +#define PNL_2_SEC ((2 << PNL_2_OFFSET)|PNL_2_USAGE) + + +/* primary timing & plane enable bit + 1: 80000[8] & 80000[2] on + 0: both off +*/ +#define PRI_TP_OFFSET 4 +#define PRI_TP_MASK (1 << PRI_TP_OFFSET) +#define PRI_TP_USAGE (PRI_TP_MASK << 16) +#define PRI_TP_ON ((0x1 << PRI_TP_OFFSET)|PRI_TP_USAGE) +#define PRI_TP_OFF ((0x0 << PRI_TP_OFFSET)|PRI_TP_USAGE) + + +/* panel sequency status + 80000[27:24] +*/ +#define PNL_SEQ_OFFSET 6 +#define PNL_SEQ_MASK (1 << PNL_SEQ_OFFSET) +#define PNL_SEQ_USAGE (PNL_SEQ_MASK << 16) +#define PNL_SEQ_ON ((1 << PNL_SEQ_OFFSET)|PNL_SEQ_USAGE) +#define PNL_SEQ_OFF ((0 << PNL_SEQ_OFFSET)|PNL_SEQ_USAGE) + +/* dual digital output + 80000[19] +*/ +#define DUAL_TFT_OFFSET 8 +#define DUAL_TFT_MASK (1 << DUAL_TFT_OFFSET) +#define DUAL_TFT_USAGE (DUAL_TFT_MASK << 16) +#define DUAL_TFT_ON ((1 << DUAL_TFT_OFFSET)|DUAL_TFT_USAGE) +#define DUAL_TFT_OFF ((0 << DUAL_TFT_OFFSET)|DUAL_TFT_USAGE) + +/* secondary timing & plane enable bit + 1:80200[8] & 80200[2] on + 0: both off +*/ +#define SEC_TP_OFFSET 5 +#define SEC_TP_MASK (1<< SEC_TP_OFFSET) +#define SEC_TP_USAGE (SEC_TP_MASK << 16) +#define SEC_TP_ON ((0x1 << SEC_TP_OFFSET)|SEC_TP_USAGE) +#define SEC_TP_OFF ((0x0 << SEC_TP_OFFSET)|SEC_TP_USAGE) + +/* crt path select + 80200[19:18] +*/ +#define CRT_2_OFFSET 2 +#define CRT_2_MASK (3 << CRT_2_OFFSET) +#define CRT_2_USAGE (CRT_2_MASK << 16) +#define CRT_2_PRI ((0x0 << CRT_2_OFFSET)|CRT_2_USAGE) +#define CRT_2_SEC ((0x2 << CRT_2_OFFSET)|CRT_2_USAGE) + + +/* DAC affect both DVI and DSUB + 4[20] +*/ +#define DAC_OFFSET 7 +#define DAC_MASK (1 << DAC_OFFSET) +#define DAC_USAGE (DAC_MASK << 16) +#define DAC_ON ((0x0<< DAC_OFFSET)|DAC_USAGE) +#define DAC_OFF ((0x1 << DAC_OFFSET)|DAC_USAGE) + +/* DPMS only affect D-SUB head + 0[31:30] +*/ +#define DPMS_OFFSET 9 +#define DPMS_MASK (3 << DPMS_OFFSET) +#define DPMS_USAGE (DPMS_MASK << 16) +#define DPMS_OFF ((3 << DPMS_OFFSET)|DPMS_USAGE) +#define DPMS_ON ((0 << DPMS_OFFSET)|DPMS_USAGE) + + + +/* + LCD1 means panel path TFT1 & panel path DVI (so enable DAC) + CRT means crt path DSUB +*/ +#if 0 +typedef enum _disp_output_t +{ + NO_DISPLAY = DPMS_OFF, + + LCD1_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DPMS_OFF|DAC_ON, + LCD1_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|DPMS_OFF|DAC_ON, + + LCD2_PRI = CRT_2_PRI|PRI_TP_ON|DUAL_TFT_ON|DPMS_OFF, + LCD2_SEC = CRT_2_SEC|SEC_TP_ON|DUAL_TFT_ON|DPMS_OFF, + + DSUB_PRI = CRT_2_PRI|PRI_TP_ON|DAC_ON, + DSUB_SEC = CRT_2_SEC|SEC_TP_ON|DAC_ON, + + LCD1_DSUB_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON| + CRT_2_PRI|SEC_TP_OFF|DAC_ON, + + LCD1_DSUB_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON| + CRT_2_SEC|PRI_TP_OFF|DAC_ON, + + /* LCD1 show primary and DSUB show secondary */ + LCD1_DSUB_DUAL = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON| + CRT_2_SEC|SEC_TP_ON|DAC_ON, + + /* LCD1 show secondary and DSUB show primary */ + LCD1_DSUB_DUAL_SWAP = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON| + CRT_2_PRI|PRI_TP_ON|DAC_ON, + + LCD1_LCD2_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON| + CRT_2_PRI|SEC_TP_OFF|DPMS_OFF|DUAL_TFT_ON, + + LCD1_LCD2_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON| + CRT_2_SEC|PRI_TP_OFF|DPMS_OFF|DUAL_TFT_ON, + + LCD1_LCD2_DSUB_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DAC_ON| + CRT_2_PRI|SEC_TP_OFF|DPMS_ON|DUAL_TFT_ON, + + LCD1_LCD2_DSUB_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|DAC_ON| + CRT_2_SEC|PRI_TP_OFF|DPMS_ON|DUAL_TFT_ON, + + +} +disp_output_t; +#else +typedef enum _disp_output_t{ + do_LCD1_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DAC_ON, + do_LCD1_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|DAC_ON, +#if 0 + do_LCD2_PRI = CRT_2_PRI|PRI_TP_ON, + do_LCD2_SEC = CRT_2_SEC|SEC_TP_ON, +#else + do_LCD2_PRI = CRT_2_PRI|PRI_TP_ON|DUAL_TFT_ON, + do_LCD2_SEC = CRT_2_SEC|SEC_TP_ON|DUAL_TFT_ON, +#endif + /* + do_DSUB_PRI = CRT_2_PRI|PRI_TP_ON|DPMS_ON|DAC_ON, + do_DSUB_SEC = CRT_2_SEC|SEC_TP_ON|DPMS_ON|DAC_ON, + */ +#if 0 + do_CRT_PRI = CRT_2_PRI|PRI_TP_ON, + do_CRT_SEC = CRT_2_SEC|SEC_TP_ON, +#else + do_CRT_PRI = CRT_2_PRI|PRI_TP_ON|DPMS_ON|DAC_ON, + do_CRT_SEC = CRT_2_SEC|SEC_TP_ON|DPMS_ON|DAC_ON, +#endif +} +disp_output_t; +#endif + +void ddk750_setLogicalDispOut(disp_output_t); +int ddk750_initDVIDisp(void); + +#endif diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c new file mode 100644 index 000000000000..1c083e7dc710 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -0,0 +1,99 @@ +#define USE_DVICHIP +#ifdef USE_DVICHIP +#include "ddk750_help.h" +#include "ddk750_reg.h" +#include "ddk750_dvi.h" +#include "ddk750_sii164.h" + + +/* This global variable contains all the supported driver and its corresponding + function API. Please set the function pointer to NULL whenever the function + is not supported. */ +static dvi_ctrl_device_t g_dcftSupportedDviController[] = +{ +#ifdef DVI_CTRL_SII164 + { + .pfnInit = sii164InitChip, + .pfnGetVendorId = sii164GetVendorID, + .pfnGetDeviceId = sii164GetDeviceID, +#ifdef SII164_FULL_FUNCTIONS + .pfnResetChip = sii164ResetChip, + .pfnGetChipString = sii164GetChipString, + .pfnSetPower = sii164SetPower, + .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection, + .pfnIsConnected = sii164IsConnected, + .pfnCheckInterrupt = sii164CheckInterrupt, + .pfnClearInterrupt = sii164ClearInterrupt, +#endif + }, +#endif +}; + + +int dviInit( + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue + ) +{ + dvi_ctrl_device_t *pCurrentDviCtrl; + pCurrentDviCtrl = g_dcftSupportedDviController; + if(pCurrentDviCtrl->pfnInit != NULL) + { + return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, + vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, + pllFilterEnable, pllFilterValue); + } + return -1;//error +} + + +/* + * dviGetVendorID + * This function gets the vendor ID of the DVI controller chip. + * + * Output: + * Vendor ID + */ +unsigned short dviGetVendorID() +{ + dvi_ctrl_device_t *pCurrentDviCtrl; + + //pCurrentDviCtrl = getDviCtrl(); + pCurrentDviCtrl = g_dcftSupportedDviController; + if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) + return pCurrentDviCtrl->pfnGetVendorId(); + + return 0x0000; +} + + +/* + * dviGetDeviceID + * This function gets the device ID of the DVI controller chip. + * + * Output: + * Device ID + */ +unsigned short dviGetDeviceID() +{ + dvi_ctrl_device_t *pCurrentDviCtrl; + +// pCurrentDviCtrl = getDviCtrl(); + pCurrentDviCtrl = g_dcftSupportedDviController; + if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) + return pCurrentDviCtrl->pfnGetDeviceId(); + + return 0x0000; +} + +#endif + + diff --git a/drivers/staging/sm750fb/ddk750_dvi.h b/drivers/staging/sm750fb/ddk750_dvi.h new file mode 100644 index 000000000000..50bcec29b2c0 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_dvi.h @@ -0,0 +1,67 @@ +#ifndef DDK750_DVI_H__ +#define DDK750_DVI_H__ + +/* dvi chip stuffs structros */ + +typedef long (*PFN_DVICTRL_INIT)( + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue); +typedef void (*PFN_DVICTRL_RESETCHIP)(void); +typedef char* (*PFN_DVICTRL_GETCHIPSTRING)(void); +typedef unsigned short (*PFN_DVICTRL_GETVENDORID)(void); +typedef unsigned short (*PFN_DVICTRL_GETDEVICEID)(void); +typedef void (*PFN_DVICTRL_SETPOWER)(unsigned char powerUp); +typedef void (*PFN_DVICTRL_HOTPLUGDETECTION)(unsigned char enableHotPlug); +typedef unsigned char (*PFN_DVICTRL_ISCONNECTED)(void); +typedef unsigned char (*PFN_DVICTRL_CHECKINTERRUPT)(void); +typedef void (*PFN_DVICTRL_CLEARINTERRUPT)(void); + + + +/* Structure to hold all the function pointer to the DVI Controller. */ +typedef struct _dvi_ctrl_device_t +{ + PFN_DVICTRL_INIT pfnInit; + PFN_DVICTRL_RESETCHIP pfnResetChip; + PFN_DVICTRL_GETCHIPSTRING pfnGetChipString; + PFN_DVICTRL_GETVENDORID pfnGetVendorId; + PFN_DVICTRL_GETDEVICEID pfnGetDeviceId; + PFN_DVICTRL_SETPOWER pfnSetPower; + PFN_DVICTRL_HOTPLUGDETECTION pfnEnableHotPlugDetection; + PFN_DVICTRL_ISCONNECTED pfnIsConnected; + PFN_DVICTRL_CHECKINTERRUPT pfnCheckInterrupt; + PFN_DVICTRL_CLEARINTERRUPT pfnClearInterrupt; +} dvi_ctrl_device_t; +#define DVI_CTRL_SII164 + + + +/* dvi functions prototype */ +int dviInit( + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue +); + +unsigned short dviGetVendorID(void); +unsigned short dviGetDeviceID(void); + + + +#endif + diff --git a/drivers/staging/sm750fb/ddk750_help.c b/drivers/staging/sm750fb/ddk750_help.c new file mode 100644 index 000000000000..cc00d2b32436 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_help.c @@ -0,0 +1,19 @@ +//#include "ddk750_reg.h" +//#include "ddk750_chip.h" +#include "ddk750_help.h" + +volatile unsigned char __iomem * mmio750 = NULL; +char revId750 = 0; +unsigned short devId750 = 0; + +/* after driver mapped io registers, use this function first */ +void ddk750_set_mmio(volatile unsigned char * addr,unsigned short devId,char revId) +{ + mmio750 = addr; + devId750 = devId; + revId750 = revId; + if(revId == 0xfe) + printk("found sm750le\n"); +} + + diff --git a/drivers/staging/sm750fb/ddk750_help.h b/drivers/staging/sm750fb/ddk750_help.h new file mode 100644 index 000000000000..4fc93b5d41c7 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_help.h @@ -0,0 +1,29 @@ +#ifndef DDK750_HELP_H__ +#define DDK750_HELP_H__ +#include "ddk750_chip.h" +#ifndef USE_INTERNAL_REGISTER_ACCESS + +#include +#include +#include +#include "sm750_help.h" + + +#if 0 +/* if 718 big endian turned on,be aware that don't use this driver for general use,only for ppc big-endian */ +#warning "big endian on target cpu and enable nature big endian support of 718 capability !" +#define PEEK32(addr) __raw_readl((void __iomem *)(mmio750)+(addr)) +#define POKE32(addr,data) __raw_writel((data),(void __iomem*)(mmio750)+(addr)) +#else /* software control endianess */ +#define PEEK32(addr) readl((addr)+mmio750) +#define POKE32(addr,data) writel((data),(addr)+mmio750) +#endif + +extern volatile unsigned char __iomem * mmio750; +extern char revId750; +extern unsigned short devId750; +#else +/* implement if you want use it*/ +#endif + +#endif diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c new file mode 100644 index 000000000000..84dfb6f41142 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_hwi2c.c @@ -0,0 +1,271 @@ +#define USE_HW_I2C +#ifdef USE_HW_I2C +#include "ddk750_help.h" +#include "ddk750_reg.h" +#include "ddk750_hwi2c.h" +#include "ddk750_power.h" + +#define MAX_HWI2C_FIFO 16 +#define HWI2C_WAIT_TIMEOUT 0xF0000 + + +int hwI2CInit( + unsigned char busSpeedMode +) +{ + unsigned int value; + + /* Enable GPIO 30 & 31 as IIC clock & data */ + value = PEEK32(GPIO_MUX); + + value = FIELD_SET(value, GPIO_MUX, 30, I2C) | + FIELD_SET(0, GPIO_MUX, 31, I2C); + POKE32(GPIO_MUX, value); + + /* Enable Hardware I2C power. + TODO: Check if we need to enable GPIO power? + */ + enableI2C(1); + + /* Enable the I2C Controller and set the bus speed mode */ + value = PEEK32(I2C_CTRL); + if (busSpeedMode == 0) + value = FIELD_SET(value, I2C_CTRL, MODE, STANDARD); + else + value = FIELD_SET(value, I2C_CTRL, MODE, FAST); + value = FIELD_SET(value, I2C_CTRL, EN, ENABLE); + POKE32(I2C_CTRL, value); + + return 0; +} + + +void hwI2CClose(void) +{ + unsigned int value; + + /* Disable I2C controller */ + value = PEEK32(I2C_CTRL); + value = FIELD_SET(value, I2C_CTRL, EN, DISABLE); + POKE32(I2C_CTRL, value); + + /* Disable I2C Power */ + enableI2C(0); + + /* Set GPIO 30 & 31 back as GPIO pins */ + value = PEEK32(GPIO_MUX); + value = FIELD_SET(value, GPIO_MUX, 30, GPIO); + value = FIELD_SET(value, GPIO_MUX, 31, GPIO); + POKE32(GPIO_MUX, value); +} + + +long hwI2CWaitTXDone(void) +{ + unsigned int timeout; + + /* Wait until the transfer is completed. */ + timeout = HWI2C_WAIT_TIMEOUT; + while ((FIELD_GET(PEEK32(I2C_STATUS), I2C_STATUS, TX) != I2C_STATUS_TX_COMPLETED) && + (timeout != 0)) + timeout--; + + if (timeout == 0) + return (-1); + + return 0; +} + + + +/* + * This function writes data to the i2c slave device registers. + * + * Parameters: + * deviceAddress - i2c Slave device address + * length - Total number of bytes to be written to the device + * pBuffer - The buffer that contains the data to be written to the + * i2c device. + * + * Return Value: + * Total number of bytes those are actually written. + */ +unsigned int hwI2CWriteData( + unsigned char deviceAddress, + unsigned int length, + unsigned char *pBuffer +) +{ + unsigned char count, i; + unsigned int totalBytes = 0; + + /* Set the Device Address */ + POKE32(I2C_SLAVE_ADDRESS, deviceAddress & ~0x01); + + /* Write data. + * Note: + * Only 16 byte can be accessed per i2c start instruction. + */ + do + { + /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ + POKE32(I2C_RESET, 0); + + /* Set the number of bytes to be written */ + if (length < MAX_HWI2C_FIFO) + count = length - 1; + else + count = MAX_HWI2C_FIFO - 1; + POKE32(I2C_BYTE_COUNT, count); + + /* Move the data to the I2C data register */ + for (i = 0; i <= count; i++) + POKE32(I2C_DATA0 + i, *pBuffer++); + + /* Start the I2C */ + POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); + + /* Wait until the transfer is completed. */ + if (hwI2CWaitTXDone() != 0) + break; + + /* Substract length */ + length -= (count + 1); + + /* Total byte written */ + totalBytes += (count + 1); + + } while (length > 0); + + return totalBytes; +} + + + + +/* + * This function reads data from the slave device and stores them + * in the given buffer + * + * Parameters: + * deviceAddress - i2c Slave device address + * length - Total number of bytes to be read + * pBuffer - Pointer to a buffer to be filled with the data read + * from the slave device. It has to be the same size as the + * length to make sure that it can keep all the data read. + * + * Return Value: + * Total number of actual bytes read from the slave device + */ +unsigned int hwI2CReadData( + unsigned char deviceAddress, + unsigned int length, + unsigned char *pBuffer +) +{ + unsigned char count, i; + unsigned int totalBytes = 0; + + /* Set the Device Address */ + POKE32(I2C_SLAVE_ADDRESS, deviceAddress | 0x01); + + /* Read data and save them to the buffer. + * Note: + * Only 16 byte can be accessed per i2c start instruction. + */ + do + { + /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ + POKE32(I2C_RESET, 0); + + /* Set the number of bytes to be read */ + if (length <= MAX_HWI2C_FIFO) + count = length - 1; + else + count = MAX_HWI2C_FIFO - 1; + POKE32(I2C_BYTE_COUNT, count); + + /* Start the I2C */ + POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); + + /* Wait until transaction done. */ + if (hwI2CWaitTXDone() != 0) + break; + + /* Save the data to the given buffer */ + for (i = 0; i <= count; i++) + *pBuffer++ = PEEK32(I2C_DATA0 + i); + + /* Substract length by 16 */ + length -= (count + 1); + + /* Number of bytes read. */ + totalBytes += (count + 1); + + } while (length > 0); + + return totalBytes; +} + + + + +/* + * This function reads the slave device's register + * + * Parameters: + * deviceAddress - i2c Slave device address which register + * to be read from + * registerIndex - Slave device's register to be read + * + * Return Value: + * Register value + */ +unsigned char hwI2CReadReg( + unsigned char deviceAddress, + unsigned char registerIndex +) +{ + unsigned char value = (0xFF); + + if (hwI2CWriteData(deviceAddress, 1, ®isterIndex) == 1) + hwI2CReadData(deviceAddress, 1, &value); + + return value; +} + + + + + +/* + * This function writes a value to the slave device's register + * + * Parameters: + * deviceAddress - i2c Slave device address which register + * to be written + * registerIndex - Slave device's register to be written + * data - Data to be written to the register + * + * Result: + * 0 - Success + * -1 - Fail + */ +int hwI2CWriteReg( + unsigned char deviceAddress, + unsigned char registerIndex, + unsigned char data +) +{ + unsigned char value[2]; + + value[0] = registerIndex; + value[1] = data; + if (hwI2CWriteData(deviceAddress, 2, value) == 2) + return 0; + + return (-1); +} + + +#endif diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.h b/drivers/staging/sm750fb/ddk750_hwi2c.h new file mode 100644 index 000000000000..ad311493c9fc --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_hwi2c.h @@ -0,0 +1,10 @@ +#ifndef DDK750_HWI2C_H__ +#define DDK750_HWI2C_H__ + +/* hwi2c functions */ +int hwI2CInit(unsigned char busSpeedMode); +void hwI2CClose(void); + +unsigned char hwI2CReadReg(unsigned char deviceAddress,unsigned char registerIndex); +int hwI2CWriteReg(unsigned char deviceAddress,unsigned char registerIndex,unsigned char data); +#endif diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c new file mode 100644 index 000000000000..2e418fb6ffde --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -0,0 +1,205 @@ + +#include "ddk750_help.h" +#include "ddk750_reg.h" +#include "ddk750_mode.h" +#include "ddk750_chip.h" + +/* + SM750LE only: + This function takes care extra registers and bit fields required to set + up a mode in SM750LE + + Explanation about Display Control register: + HW only supports 7 predefined pixel clocks, and clock select is + in bit 29:27 of Display Control register. +*/ +static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, unsigned long dispControl) +{ + unsigned long x, y; + + x = pModeParam->horizontal_display_end; + y = pModeParam->vertical_display_end; + + /* SM750LE has to set up the top-left and bottom-right + registers as well. + Note that normal SM750/SM718 only use those two register for + auto-centering mode. + */ + POKE32(CRT_AUTO_CENTERING_TL, + FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, TOP, 0) + | FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, LEFT, 0)); + + POKE32(CRT_AUTO_CENTERING_BR, + FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, BOTTOM, y-1) + | FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, RIGHT, x-1)); + + /* Assume common fields in dispControl have been properly set before + calling this function. + This function only sets the extra fields in dispControl. + */ + + /* Clear bit 29:27 of display control register */ + dispControl &= FIELD_CLEAR(CRT_DISPLAY_CTRL, CLK); + + /* Set bit 29:27 of display control register for the right clock */ + /* Note that SM750LE only need to supported 7 resoluitons. */ + if ( x == 800 && y == 600 ) + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); + else if (x == 1024 && y == 768) + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); + else if (x == 1152 && y == 864) + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); + else if (x == 1280 && y == 768) + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); + else if (x == 1280 && y == 720) + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL74); + else if (x == 1280 && y == 960) + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); + else if (x == 1280 && y == 1024) + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); + else /* default to VGA clock */ + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL25); + + /* Set bit 25:24 of display controller */ + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CRTSELECT, CRT); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, RGBBIT, 24BIT); + + /* Set bit 14 of display controller */ + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLOCK_PHASE, ACTIVE_LOW); + + POKE32(CRT_DISPLAY_CTRL, dispControl); + + return dispControl; +} + + + +/* only timing related registers will be programed */ +static int programModeRegisters(mode_parameter_t * pModeParam,pll_value_t * pll) +{ + int ret = 0; + int cnt = 0; + unsigned int ulTmpValue,ulReg; + if(pll->clockType == SECONDARY_PLL) + { + /* programe secondary pixel clock */ + POKE32(CRT_PLL_CTRL,formatPllReg(pll)); + POKE32(CRT_HORIZONTAL_TOTAL, + FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) + | FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); + + POKE32(CRT_HORIZONTAL_SYNC, + FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) + | FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); + + POKE32(CRT_VERTICAL_TOTAL, + FIELD_VALUE(0, CRT_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) + | FIELD_VALUE(0, CRT_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); + + POKE32(CRT_VERTICAL_SYNC, + FIELD_VALUE(0, CRT_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) + | FIELD_VALUE(0, CRT_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); + + + ulTmpValue = FIELD_VALUE(0,CRT_DISPLAY_CTRL,VSYNC_PHASE,pModeParam->vertical_sync_polarity)| + FIELD_VALUE(0,CRT_DISPLAY_CTRL,HSYNC_PHASE,pModeParam->horizontal_sync_polarity)| + FIELD_SET(0,CRT_DISPLAY_CTRL,TIMING,ENABLE)| + FIELD_SET(0,CRT_DISPLAY_CTRL,PLANE,ENABLE); + + + if(getChipType() == SM750LE){ + displayControlAdjust_SM750LE(pModeParam,ulTmpValue); + }else{ + ulReg = PEEK32(CRT_DISPLAY_CTRL) + & FIELD_CLEAR(CRT_DISPLAY_CTRL,VSYNC_PHASE) + & FIELD_CLEAR(CRT_DISPLAY_CTRL,HSYNC_PHASE) + & FIELD_CLEAR(CRT_DISPLAY_CTRL,TIMING) + & FIELD_CLEAR(CRT_DISPLAY_CTRL,PLANE); + + POKE32(CRT_DISPLAY_CTRL,ulTmpValue|ulReg); + } + + } + else if(pll->clockType == PRIMARY_PLL) + { + unsigned int ulReservedBits; + POKE32(PANEL_PLL_CTRL,formatPllReg(pll)); + + POKE32(PANEL_HORIZONTAL_TOTAL, + FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) + | FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); + + POKE32(PANEL_HORIZONTAL_SYNC, + FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) + | FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); + + POKE32(PANEL_VERTICAL_TOTAL, + FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) + | FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); + + POKE32(PANEL_VERTICAL_SYNC, + FIELD_VALUE(0, PANEL_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) + | FIELD_VALUE(0, PANEL_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); + + ulTmpValue = FIELD_VALUE(0,PANEL_DISPLAY_CTRL,VSYNC_PHASE,pModeParam->vertical_sync_polarity)| + FIELD_VALUE(0,PANEL_DISPLAY_CTRL,HSYNC_PHASE,pModeParam->horizontal_sync_polarity)| + FIELD_VALUE(0,PANEL_DISPLAY_CTRL,CLOCK_PHASE,pModeParam->clock_phase_polarity)| + FIELD_SET(0,PANEL_DISPLAY_CTRL,TIMING,ENABLE)| + FIELD_SET(0,PANEL_DISPLAY_CTRL,PLANE,ENABLE); + + ulReservedBits = FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_1_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_2_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE)| + FIELD_SET(0,PANEL_DISPLAY_CTRL,VSYNC,ACTIVE_LOW); + + ulReg = (PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, CLOCK_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, VSYNC_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, HSYNC_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, TIMING) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, PLANE); + + + /* May a hardware bug or just my test chip (not confirmed). + * PANEL_DISPLAY_CTRL register seems requiring few writes + * before a value can be succesfully written in. + * Added some masks to mask out the reserved bits. + * Note: This problem happens by design. The hardware will wait for the + * next vertical sync to turn on/off the plane. + */ + + POKE32(PANEL_DISPLAY_CTRL,ulTmpValue|ulReg); +#if 1 + while((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) + { + cnt++; + if(cnt > 1000) + break; + POKE32(PANEL_DISPLAY_CTRL,ulTmpValue|ulReg); + } +#endif + } + else{ + ret = -1; + } + return ret; +} + +int ddk750_setModeTiming(mode_parameter_t * parm,clock_type_t clock) +{ + pll_value_t pll; + unsigned int uiActualPixelClk; + pll.inputFreq = DEFAULT_INPUT_CLOCK; + pll.clockType = clock; + + uiActualPixelClk = calcPllValue(parm->pixel_clock,&pll); + if(getChipType() == SM750LE){ + /* set graphic mode via IO method */ + outb_p(0x88,0x3d4); + outb_p(0x06,0x3d5); + } + programModeRegisters(parm,&pll); + return 0; +} + + diff --git a/drivers/staging/sm750fb/ddk750_mode.h b/drivers/staging/sm750fb/ddk750_mode.h new file mode 100644 index 000000000000..6f8df96a8b02 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_mode.h @@ -0,0 +1,43 @@ +#ifndef DDK750_MODE_H__ +#define DDK750_MODE_H__ + +#include "ddk750_chip.h" + +typedef enum _spolarity_t +{ + POS = 0, /* positive */ + NEG, /* negative */ +} +spolarity_t; + + +typedef struct _mode_parameter_t +{ + /* Horizontal timing. */ + unsigned long horizontal_total; + unsigned long horizontal_display_end; + unsigned long horizontal_sync_start; + unsigned long horizontal_sync_width; + spolarity_t horizontal_sync_polarity; + + /* Vertical timing. */ + unsigned long vertical_total; + unsigned long vertical_display_end; + unsigned long vertical_sync_start; + unsigned long vertical_sync_height; + spolarity_t vertical_sync_polarity; + + /* Refresh timing. */ + unsigned long pixel_clock; + unsigned long horizontal_frequency; + unsigned long vertical_frequency; + + /* Clock Phase. This clock phase only applies to Panel. */ + spolarity_t clock_phase_polarity; +} +mode_parameter_t; + +int ddk750_setModeTiming(mode_parameter_t *,clock_type_t); + + +#endif diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c new file mode 100644 index 000000000000..98dfcbde1eb6 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -0,0 +1,239 @@ +#include "ddk750_help.h" +#include "ddk750_reg.h" +#include "ddk750_power.h" + +void ddk750_setDPMS(DPMS_t state) +{ + unsigned int value; + if(getChipType() == SM750LE){ + value = PEEK32(CRT_DISPLAY_CTRL); + POKE32(CRT_DISPLAY_CTRL,FIELD_VALUE(value,CRT_DISPLAY_CTRL,DPMS,state)); + }else{ + value = PEEK32(SYSTEM_CTRL); + value= FIELD_VALUE(value,SYSTEM_CTRL,DPMS,state); + POKE32(SYSTEM_CTRL, value); + } +} + +unsigned int getPowerMode() +{ + if(getChipType() == SM750LE) + return 0; + return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); +} + + +/* + * SM50x can operate in one of three modes: 0, 1 or Sleep. + * On hardware reset, power mode 0 is default. + */ +void setPowerMode(unsigned int powerMode) +{ + unsigned int control_value = 0; + + control_value = PEEK32(POWER_MODE_CTRL); + + if(getChipType() == SM750LE) + return; + + switch (powerMode) + { + case POWER_MODE_CTRL_MODE_MODE0: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); + break; + + case POWER_MODE_CTRL_MODE_MODE1: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE1); + break; + + case POWER_MODE_CTRL_MODE_SLEEP: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, SLEEP); + break; + + default: + break; + } + + /* Set up other fields in Power Control Register */ + if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) + { + control_value = +#ifdef VALIDATION_CHIP + FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | +#endif + FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); + } + else + { + control_value = +#ifdef VALIDATION_CHIP + FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | +#endif + FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); + } + + /* Program new power mode. */ + POKE32(POWER_MODE_CTRL, control_value); +} + +void setCurrentGate(unsigned int gate) +{ + unsigned int gate_reg; + unsigned int mode; + + /* Get current power mode. */ + mode = getPowerMode(); + + switch (mode) + { + case POWER_MODE_CTRL_MODE_MODE0: + gate_reg = MODE0_GATE; + break; + + case POWER_MODE_CTRL_MODE_MODE1: + gate_reg = MODE1_GATE; + break; + + default: + gate_reg = MODE0_GATE; + break; + } + POKE32(gate_reg, gate); +} + + + +/* + * This function enable/disable the 2D engine. + */ +void enable2DEngine(unsigned int enable) +{ + uint32_t gate; + + gate = PEEK32(CURRENT_GATE); + if (enable) + { + gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); + gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); + } + else + { + gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); + gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); + } + + setCurrentGate(gate); +} + + +/* + * This function enable/disable the ZV Port. + */ +void enableZVPort(unsigned int enable) +{ + uint32_t gate; + + /* Enable ZV Port Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + { + gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); +#if 1 + /* Using Software I2C */ + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); +#else + /* Using Hardware I2C */ + gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); +#endif + } + else + { + /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used + or not. Therefore, do not disable the GPIO gate. */ + gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); + } + + setCurrentGate(gate); +} + + +void enableSSP(unsigned int enable) +{ + uint32_t gate; + + /* Enable SSP Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, SSP, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, SSP, OFF); + + setCurrentGate(gate); +} + +void enableDMA(unsigned int enable) +{ + uint32_t gate; + + /* Enable DMA Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, DMA, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, DMA, OFF); + + setCurrentGate(gate); +} + +/* + * This function enable/disable the GPIO Engine + */ +void enableGPIO(unsigned int enable) +{ + uint32_t gate; + + /* Enable GPIO Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, OFF); + + setCurrentGate(gate); +} + +/* + * This function enable/disable the PWM Engine + */ +void enablePWM(unsigned int enable) +{ + uint32_t gate; + + /* Enable PWM Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, PWM, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, PWM, OFF); + + setCurrentGate(gate); +} + +/* + * This function enable/disable the I2C Engine + */ +void enableI2C(unsigned int enable) +{ + uint32_t gate; + + /* Enable I2C Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, I2C, OFF); + + setCurrentGate(gate); +} + + diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h new file mode 100644 index 000000000000..71dc7f980069 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_power.h @@ -0,0 +1,71 @@ +#ifndef DDK750_POWER_H__ +#define DDK750_POWER_H__ + +typedef enum _DPMS_t +{ + crtDPMS_ON = 0x0, + crtDPMS_STANDBY = 0x1, + crtDPMS_SUSPEND = 0x2, + crtDPMS_OFF = 0x3, +} +DPMS_t; + +#define setDAC(off) \ + { \ + POKE32(MISC_CTRL,FIELD_VALUE(PEEK32(MISC_CTRL), \ + MISC_CTRL, \ + DAC_POWER, \ + off)); \ + } + +void ddk750_setDPMS(DPMS_t); + +unsigned int getPowerMode(void); + +/* + * This function sets the current power mode + */ +void setPowerMode(unsigned int powerMode); + +/* + * This function sets current gate + */ +void setCurrentGate(unsigned int gate); + +/* + * This function enable/disable the 2D engine. + */ +void enable2DEngine(unsigned int enable); + +/* + * This function enable/disable the ZV Port + */ +void enableZVPort(unsigned int enable); + +/* + * This function enable/disable the DMA Engine + */ +void enableDMA(unsigned int enable); + +/* + * This function enable/disable the GPIO Engine + */ +void enableGPIO(unsigned int enable); + +/* + * This function enable/disable the PWM Engine + */ +void enablePWM(unsigned int enable); + +/* + * This function enable/disable the I2C Engine + */ +void enableI2C(unsigned int enable); + +/* + * This function enable/disable the SSP. + */ +void enableSSP(unsigned int enable); + + +#endif diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h new file mode 100644 index 000000000000..2016f97d2a3d --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_reg.h @@ -0,0 +1,2616 @@ +#ifndef DDK750_REG_H__ +#define DDK750_REG_H__ + +/* New register for SM750LE */ +#define DE_STATE1 0x100054 +#define DE_STATE1_DE_ABORT 0:0 +#define DE_STATE1_DE_ABORT_OFF 0 +#define DE_STATE1_DE_ABORT_ON 1 + +#define DE_STATE2 0x100058 +#define DE_STATE2_DE_FIFO 3:3 +#define DE_STATE2_DE_FIFO_NOTEMPTY 0 +#define DE_STATE2_DE_FIFO_EMPTY 1 +#define DE_STATE2_DE_STATUS 2:2 +#define DE_STATE2_DE_STATUS_IDLE 0 +#define DE_STATE2_DE_STATUS_BUSY 1 +#define DE_STATE2_DE_MEM_FIFO 1:1 +#define DE_STATE2_DE_MEM_FIFO_NOTEMPTY 0 +#define DE_STATE2_DE_MEM_FIFO_EMPTY 1 +#define DE_STATE2_DE_RESERVED 0:0 + + + +#define SYSTEM_CTRL 0x000000 +#define SYSTEM_CTRL_DPMS 31:30 +#define SYSTEM_CTRL_DPMS_VPHP 0 +#define SYSTEM_CTRL_DPMS_VPHN 1 +#define SYSTEM_CTRL_DPMS_VNHP 2 +#define SYSTEM_CTRL_DPMS_VNHN 3 +#define SYSTEM_CTRL_PCI_BURST 29:29 +#define SYSTEM_CTRL_PCI_BURST_OFF 0 +#define SYSTEM_CTRL_PCI_BURST_ON 1 +#define SYSTEM_CTRL_PCI_MASTER 25:25 +#define SYSTEM_CTRL_PCI_MASTER_OFF 0 +#define SYSTEM_CTRL_PCI_MASTER_ON 1 +#define SYSTEM_CTRL_LATENCY_TIMER 24:24 +#define SYSTEM_CTRL_LATENCY_TIMER_ON 0 +#define SYSTEM_CTRL_LATENCY_TIMER_OFF 1 +#define SYSTEM_CTRL_DE_FIFO 23:23 +#define SYSTEM_CTRL_DE_FIFO_NOTEMPTY 0 +#define SYSTEM_CTRL_DE_FIFO_EMPTY 1 +#define SYSTEM_CTRL_DE_STATUS 22:22 +#define SYSTEM_CTRL_DE_STATUS_IDLE 0 +#define SYSTEM_CTRL_DE_STATUS_BUSY 1 +#define SYSTEM_CTRL_DE_MEM_FIFO 21:21 +#define SYSTEM_CTRL_DE_MEM_FIFO_NOTEMPTY 0 +#define SYSTEM_CTRL_DE_MEM_FIFO_EMPTY 1 +#define SYSTEM_CTRL_CSC_STATUS 20:20 +#define SYSTEM_CTRL_CSC_STATUS_IDLE 0 +#define SYSTEM_CTRL_CSC_STATUS_BUSY 1 +#define SYSTEM_CTRL_CRT_VSYNC 19:19 +#define SYSTEM_CTRL_CRT_VSYNC_INACTIVE 0 +#define SYSTEM_CTRL_CRT_VSYNC_ACTIVE 1 +#define SYSTEM_CTRL_PANEL_VSYNC 18:18 +#define SYSTEM_CTRL_PANEL_VSYNC_INACTIVE 0 +#define SYSTEM_CTRL_PANEL_VSYNC_ACTIVE 1 +#define SYSTEM_CTRL_CURRENT_BUFFER 17:17 +#define SYSTEM_CTRL_CURRENT_BUFFER_NORMAL 0 +#define SYSTEM_CTRL_CURRENT_BUFFER_FLIP_PENDING 1 +#define SYSTEM_CTRL_DMA_STATUS 16:16 +#define SYSTEM_CTRL_DMA_STATUS_IDLE 0 +#define SYSTEM_CTRL_DMA_STATUS_BUSY 1 +#define SYSTEM_CTRL_PCI_BURST_READ 15:15 +#define SYSTEM_CTRL_PCI_BURST_READ_OFF 0 +#define SYSTEM_CTRL_PCI_BURST_READ_ON 1 +#define SYSTEM_CTRL_DE_ABORT 13:13 +#define SYSTEM_CTRL_DE_ABORT_OFF 0 +#define SYSTEM_CTRL_DE_ABORT_ON 1 +#define SYSTEM_CTRL_PCI_SUBSYS_ID_LOCK 11:11 +#define SYSTEM_CTRL_PCI_SUBSYS_ID_LOCK_OFF 0 +#define SYSTEM_CTRL_PCI_SUBSYS_ID_LOCK_ON 1 +#define SYSTEM_CTRL_PCI_RETRY 7:7 +#define SYSTEM_CTRL_PCI_RETRY_ON 0 +#define SYSTEM_CTRL_PCI_RETRY_OFF 1 +#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE 5:4 +#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE_1 0 +#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE_2 1 +#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE_4 2 +#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE_8 3 +#define SYSTEM_CTRL_CRT_TRISTATE 3:3 +#define SYSTEM_CTRL_CRT_TRISTATE_OFF 0 +#define SYSTEM_CTRL_CRT_TRISTATE_ON 1 +#define SYSTEM_CTRL_PCIMEM_TRISTATE 2:2 +#define SYSTEM_CTRL_PCIMEM_TRISTATE_OFF 0 +#define SYSTEM_CTRL_PCIMEM_TRISTATE_ON 1 +#define SYSTEM_CTRL_LOCALMEM_TRISTATE 1:1 +#define SYSTEM_CTRL_LOCALMEM_TRISTATE_OFF 0 +#define SYSTEM_CTRL_LOCALMEM_TRISTATE_ON 1 +#define SYSTEM_CTRL_PANEL_TRISTATE 0:0 +#define SYSTEM_CTRL_PANEL_TRISTATE_OFF 0 +#define SYSTEM_CTRL_PANEL_TRISTATE_ON 1 + +#define MISC_CTRL 0x000004 +#define MISC_CTRL_DRAM_RERESH_COUNT 27:27 +#define MISC_CTRL_DRAM_RERESH_COUNT_1ROW 0 +#define MISC_CTRL_DRAM_RERESH_COUNT_3ROW 1 +#define MISC_CTRL_DRAM_REFRESH_TIME 26:25 +#define MISC_CTRL_DRAM_REFRESH_TIME_8 0 +#define MISC_CTRL_DRAM_REFRESH_TIME_16 1 +#define MISC_CTRL_DRAM_REFRESH_TIME_32 2 +#define MISC_CTRL_DRAM_REFRESH_TIME_64 3 +#define MISC_CTRL_INT_OUTPUT 24:24 +#define MISC_CTRL_INT_OUTPUT_NORMAL 0 +#define MISC_CTRL_INT_OUTPUT_INVERT 1 +#define MISC_CTRL_PLL_CLK_COUNT 23:23 +#define MISC_CTRL_PLL_CLK_COUNT_OFF 0 +#define MISC_CTRL_PLL_CLK_COUNT_ON 1 +#define MISC_CTRL_DAC_POWER 20:20 +#define MISC_CTRL_DAC_POWER_ON 0 +#define MISC_CTRL_DAC_POWER_OFF 1 +#define MISC_CTRL_CLK_SELECT 16:16 +#define MISC_CTRL_CLK_SELECT_OSC 0 +#define MISC_CTRL_CLK_SELECT_TESTCLK 1 +#define MISC_CTRL_DRAM_COLUMN_SIZE 15:14 +#define MISC_CTRL_DRAM_COLUMN_SIZE_256 0 +#define MISC_CTRL_DRAM_COLUMN_SIZE_512 1 +#define MISC_CTRL_DRAM_COLUMN_SIZE_1024 2 +#define MISC_CTRL_LOCALMEM_SIZE 13:12 +#define MISC_CTRL_LOCALMEM_SIZE_8M 3 +#define MISC_CTRL_LOCALMEM_SIZE_16M 0 +#define MISC_CTRL_LOCALMEM_SIZE_32M 1 +#define MISC_CTRL_LOCALMEM_SIZE_64M 2 +#define MISC_CTRL_DRAM_TWTR 11:11 +#define MISC_CTRL_DRAM_TWTR_2CLK 0 +#define MISC_CTRL_DRAM_TWTR_1CLK 1 +#define MISC_CTRL_DRAM_TWR 10:10 +#define MISC_CTRL_DRAM_TWR_3CLK 0 +#define MISC_CTRL_DRAM_TWR_2CLK 1 +#define MISC_CTRL_DRAM_TRP 9:9 +#define MISC_CTRL_DRAM_TRP_3CLK 0 +#define MISC_CTRL_DRAM_TRP_4CLK 1 +#define MISC_CTRL_DRAM_TRFC 8:8 +#define MISC_CTRL_DRAM_TRFC_12CLK 0 +#define MISC_CTRL_DRAM_TRFC_14CLK 1 +#define MISC_CTRL_DRAM_TRAS 7:7 +#define MISC_CTRL_DRAM_TRAS_7CLK 0 +#define MISC_CTRL_DRAM_TRAS_8CLK 1 +#define MISC_CTRL_LOCALMEM_RESET 6:6 +#define MISC_CTRL_LOCALMEM_RESET_RESET 0 +#define MISC_CTRL_LOCALMEM_RESET_NORMAL 1 +#define MISC_CTRL_LOCALMEM_STATE 5:5 +#define MISC_CTRL_LOCALMEM_STATE_ACTIVE 0 +#define MISC_CTRL_LOCALMEM_STATE_INACTIVE 1 +#define MISC_CTRL_CPU_CAS_LATENCY 4:4 +#define MISC_CTRL_CPU_CAS_LATENCY_2CLK 0 +#define MISC_CTRL_CPU_CAS_LATENCY_3CLK 1 +#define MISC_CTRL_DLL 3:3 +#define MISC_CTRL_DLL_ON 0 +#define MISC_CTRL_DLL_OFF 1 +#define MISC_CTRL_DRAM_OUTPUT 2:2 +#define MISC_CTRL_DRAM_OUTPUT_LOW 0 +#define MISC_CTRL_DRAM_OUTPUT_HIGH 1 +#define MISC_CTRL_LOCALMEM_BUS_SIZE 1:1 +#define MISC_CTRL_LOCALMEM_BUS_SIZE_32 0 +#define MISC_CTRL_LOCALMEM_BUS_SIZE_64 1 +#define MISC_CTRL_EMBEDDED_LOCALMEM 0:0 +#define MISC_CTRL_EMBEDDED_LOCALMEM_ON 0 +#define MISC_CTRL_EMBEDDED_LOCALMEM_OFF 1 + +#define GPIO_MUX 0x000008 +#define GPIO_MUX_31 31:31 +#define GPIO_MUX_31_GPIO 0 +#define GPIO_MUX_31_I2C 1 +#define GPIO_MUX_30 30:30 +#define GPIO_MUX_30_GPIO 0 +#define GPIO_MUX_30_I2C 1 +#define GPIO_MUX_29 29:29 +#define GPIO_MUX_29_GPIO 0 +#define GPIO_MUX_29_SSP1 1 +#define GPIO_MUX_28 28:28 +#define GPIO_MUX_28_GPIO 0 +#define GPIO_MUX_28_SSP1 1 +#define GPIO_MUX_27 27:27 +#define GPIO_MUX_27_GPIO 0 +#define GPIO_MUX_27_SSP1 1 +#define GPIO_MUX_26 26:26 +#define GPIO_MUX_26_GPIO 0 +#define GPIO_MUX_26_SSP1 1 +#define GPIO_MUX_25 25:25 +#define GPIO_MUX_25_GPIO 0 +#define GPIO_MUX_25_SSP1 1 +#define GPIO_MUX_24 24:24 +#define GPIO_MUX_24_GPIO 0 +#define GPIO_MUX_24_SSP0 1 +#define GPIO_MUX_23 23:23 +#define GPIO_MUX_23_GPIO 0 +#define GPIO_MUX_23_SSP0 1 +#define GPIO_MUX_22 22:22 +#define GPIO_MUX_22_GPIO 0 +#define GPIO_MUX_22_SSP0 1 +#define GPIO_MUX_21 21:21 +#define GPIO_MUX_21_GPIO 0 +#define GPIO_MUX_21_SSP0 1 +#define GPIO_MUX_20 20:20 +#define GPIO_MUX_20_GPIO 0 +#define GPIO_MUX_20_SSP0 1 +#define GPIO_MUX_19 19:19 +#define GPIO_MUX_19_GPIO 0 +#define GPIO_MUX_19_PWM 1 +#define GPIO_MUX_18 18:18 +#define GPIO_MUX_18_GPIO 0 +#define GPIO_MUX_18_PWM 1 +#define GPIO_MUX_17 17:17 +#define GPIO_MUX_17_GPIO 0 +#define GPIO_MUX_17_PWM 1 +#define GPIO_MUX_16 16:16 +#define GPIO_MUX_16_GPIO_ZVPORT 0 +#define GPIO_MUX_16_TEST_DATA 1 +#define GPIO_MUX_15 15:15 +#define GPIO_MUX_15_GPIO_ZVPORT 0 +#define GPIO_MUX_15_TEST_DATA 1 +#define GPIO_MUX_14 14:14 +#define GPIO_MUX_14_GPIO_ZVPORT 0 +#define GPIO_MUX_14_TEST_DATA 1 +#define GPIO_MUX_13 13:13 +#define GPIO_MUX_13_GPIO_ZVPORT 0 +#define GPIO_MUX_13_TEST_DATA 1 +#define GPIO_MUX_12 12:12 +#define GPIO_MUX_12_GPIO_ZVPORT 0 +#define GPIO_MUX_12_TEST_DATA 1 +#define GPIO_MUX_11 11:11 +#define GPIO_MUX_11_GPIO_ZVPORT 0 +#define GPIO_MUX_11_TEST_DATA 1 +#define GPIO_MUX_10 10:10 +#define GPIO_MUX_10_GPIO_ZVPORT 0 +#define GPIO_MUX_10_TEST_DATA 1 +#define GPIO_MUX_9 9:9 +#define GPIO_MUX_9_GPIO_ZVPORT 0 +#define GPIO_MUX_9_TEST_DATA 1 +#define GPIO_MUX_8 8:8 +#define GPIO_MUX_8_GPIO_ZVPORT 0 +#define GPIO_MUX_8_TEST_DATA 1 +#define GPIO_MUX_7 7:7 +#define GPIO_MUX_7_GPIO_ZVPORT 0 +#define GPIO_MUX_7_TEST_DATA 1 +#define GPIO_MUX_6 6:6 +#define GPIO_MUX_6_GPIO_ZVPORT 0 +#define GPIO_MUX_6_TEST_DATA 1 +#define GPIO_MUX_5 5:5 +#define GPIO_MUX_5_GPIO_ZVPORT 0 +#define GPIO_MUX_5_TEST_DATA 1 +#define GPIO_MUX_4 4:4 +#define GPIO_MUX_4_GPIO_ZVPORT 0 +#define GPIO_MUX_4_TEST_DATA 1 +#define GPIO_MUX_3 3:3 +#define GPIO_MUX_3_GPIO_ZVPORT 0 +#define GPIO_MUX_3_TEST_DATA 1 +#define GPIO_MUX_2 2:2 +#define GPIO_MUX_2_GPIO_ZVPORT 0 +#define GPIO_MUX_2_TEST_DATA 1 +#define GPIO_MUX_1 1:1 +#define GPIO_MUX_1_GPIO_ZVPORT 0 +#define GPIO_MUX_1_TEST_DATA 1 +#define GPIO_MUX_0 0:0 +#define GPIO_MUX_0_GPIO_ZVPORT 0 +#define GPIO_MUX_0_TEST_DATA 1 + +#define LOCALMEM_ARBITRATION 0x00000C +#define LOCALMEM_ARBITRATION_ROTATE 28:28 +#define LOCALMEM_ARBITRATION_ROTATE_OFF 0 +#define LOCALMEM_ARBITRATION_ROTATE_ON 1 +#define LOCALMEM_ARBITRATION_VGA 26:24 +#define LOCALMEM_ARBITRATION_VGA_OFF 0 +#define LOCALMEM_ARBITRATION_VGA_PRIORITY_1 1 +#define LOCALMEM_ARBITRATION_VGA_PRIORITY_2 2 +#define LOCALMEM_ARBITRATION_VGA_PRIORITY_3 3 +#define LOCALMEM_ARBITRATION_VGA_PRIORITY_4 4 +#define LOCALMEM_ARBITRATION_VGA_PRIORITY_5 5 +#define LOCALMEM_ARBITRATION_VGA_PRIORITY_6 6 +#define LOCALMEM_ARBITRATION_VGA_PRIORITY_7 7 +#define LOCALMEM_ARBITRATION_DMA 22:20 +#define LOCALMEM_ARBITRATION_DMA_OFF 0 +#define LOCALMEM_ARBITRATION_DMA_PRIORITY_1 1 +#define LOCALMEM_ARBITRATION_DMA_PRIORITY_2 2 +#define LOCALMEM_ARBITRATION_DMA_PRIORITY_3 3 +#define LOCALMEM_ARBITRATION_DMA_PRIORITY_4 4 +#define LOCALMEM_ARBITRATION_DMA_PRIORITY_5 5 +#define LOCALMEM_ARBITRATION_DMA_PRIORITY_6 6 +#define LOCALMEM_ARBITRATION_DMA_PRIORITY_7 7 +#define LOCALMEM_ARBITRATION_ZVPORT1 18:16 +#define LOCALMEM_ARBITRATION_ZVPORT1_OFF 0 +#define LOCALMEM_ARBITRATION_ZVPORT1_PRIORITY_1 1 +#define LOCALMEM_ARBITRATION_ZVPORT1_PRIORITY_2 2 +#define LOCALMEM_ARBITRATION_ZVPORT1_PRIORITY_3 3 +#define LOCALMEM_ARBITRATION_ZVPORT1_PRIORITY_4 4 +#define LOCALMEM_ARBITRATION_ZVPORT1_PRIORITY_5 5 +#define LOCALMEM_ARBITRATION_ZVPORT1_PRIORITY_6 6 +#define LOCALMEM_ARBITRATION_ZVPORT1_PRIORITY_7 7 +#define LOCALMEM_ARBITRATION_ZVPORT0 14:12 +#define LOCALMEM_ARBITRATION_ZVPORT0_OFF 0 +#define LOCALMEM_ARBITRATION_ZVPORT0_PRIORITY_1 1 +#define LOCALMEM_ARBITRATION_ZVPORT0_PRIORITY_2 2 +#define LOCALMEM_ARBITRATION_ZVPORT0_PRIORITY_3 3 +#define LOCALMEM_ARBITRATION_ZVPORT0_PRIORITY_4 4 +#define LOCALMEM_ARBITRATION_ZVPORT0_PRIORITY_5 5 +#define LOCALMEM_ARBITRATION_ZVPORT0_PRIORITY_6 6 +#define LOCALMEM_ARBITRATION_ZVPORT0_PRIORITY_7 7 +#define LOCALMEM_ARBITRATION_VIDEO 10:8 +#define LOCALMEM_ARBITRATION_VIDEO_OFF 0 +#define LOCALMEM_ARBITRATION_VIDEO_PRIORITY_1 1 +#define LOCALMEM_ARBITRATION_VIDEO_PRIORITY_2 2 +#define LOCALMEM_ARBITRATION_VIDEO_PRIORITY_3 3 +#define LOCALMEM_ARBITRATION_VIDEO_PRIORITY_4 4 +#define LOCALMEM_ARBITRATION_VIDEO_PRIORITY_5 5 +#define LOCALMEM_ARBITRATION_VIDEO_PRIORITY_6 6 +#define LOCALMEM_ARBITRATION_VIDEO_PRIORITY_7 7 +#define LOCALMEM_ARBITRATION_PANEL 6:4 +#define LOCALMEM_ARBITRATION_PANEL_OFF 0 +#define LOCALMEM_ARBITRATION_PANEL_PRIORITY_1 1 +#define LOCALMEM_ARBITRATION_PANEL_PRIORITY_2 2 +#define LOCALMEM_ARBITRATION_PANEL_PRIORITY_3 3 +#define LOCALMEM_ARBITRATION_PANEL_PRIORITY_4 4 +#define LOCALMEM_ARBITRATION_PANEL_PRIORITY_5 5 +#define LOCALMEM_ARBITRATION_PANEL_PRIORITY_6 6 +#define LOCALMEM_ARBITRATION_PANEL_PRIORITY_7 7 +#define LOCALMEM_ARBITRATION_CRT 2:0 +#define LOCALMEM_ARBITRATION_CRT_OFF 0 +#define LOCALMEM_ARBITRATION_CRT_PRIORITY_1 1 +#define LOCALMEM_ARBITRATION_CRT_PRIORITY_2 2 +#define LOCALMEM_ARBITRATION_CRT_PRIORITY_3 3 +#define LOCALMEM_ARBITRATION_CRT_PRIORITY_4 4 +#define LOCALMEM_ARBITRATION_CRT_PRIORITY_5 5 +#define LOCALMEM_ARBITRATION_CRT_PRIORITY_6 6 +#define LOCALMEM_ARBITRATION_CRT_PRIORITY_7 7 + +#define PCIMEM_ARBITRATION 0x000010 +#define PCIMEM_ARBITRATION_ROTATE 28:28 +#define PCIMEM_ARBITRATION_ROTATE_OFF 0 +#define PCIMEM_ARBITRATION_ROTATE_ON 1 +#define PCIMEM_ARBITRATION_VGA 26:24 +#define PCIMEM_ARBITRATION_VGA_OFF 0 +#define PCIMEM_ARBITRATION_VGA_PRIORITY_1 1 +#define PCIMEM_ARBITRATION_VGA_PRIORITY_2 2 +#define PCIMEM_ARBITRATION_VGA_PRIORITY_3 3 +#define PCIMEM_ARBITRATION_VGA_PRIORITY_4 4 +#define PCIMEM_ARBITRATION_VGA_PRIORITY_5 5 +#define PCIMEM_ARBITRATION_VGA_PRIORITY_6 6 +#define PCIMEM_ARBITRATION_VGA_PRIORITY_7 7 +#define PCIMEM_ARBITRATION_DMA 22:20 +#define PCIMEM_ARBITRATION_DMA_OFF 0 +#define PCIMEM_ARBITRATION_DMA_PRIORITY_1 1 +#define PCIMEM_ARBITRATION_DMA_PRIORITY_2 2 +#define PCIMEM_ARBITRATION_DMA_PRIORITY_3 3 +#define PCIMEM_ARBITRATION_DMA_PRIORITY_4 4 +#define PCIMEM_ARBITRATION_DMA_PRIORITY_5 5 +#define PCIMEM_ARBITRATION_DMA_PRIORITY_6 6 +#define PCIMEM_ARBITRATION_DMA_PRIORITY_7 7 +#define PCIMEM_ARBITRATION_ZVPORT1 18:16 +#define PCIMEM_ARBITRATION_ZVPORT1_OFF 0 +#define PCIMEM_ARBITRATION_ZVPORT1_PRIORITY_1 1 +#define PCIMEM_ARBITRATION_ZVPORT1_PRIORITY_2 2 +#define PCIMEM_ARBITRATION_ZVPORT1_PRIORITY_3 3 +#define PCIMEM_ARBITRATION_ZVPORT1_PRIORITY_4 4 +#define PCIMEM_ARBITRATION_ZVPORT1_PRIORITY_5 5 +#define PCIMEM_ARBITRATION_ZVPORT1_PRIORITY_6 6 +#define PCIMEM_ARBITRATION_ZVPORT1_PRIORITY_7 7 +#define PCIMEM_ARBITRATION_ZVPORT0 14:12 +#define PCIMEM_ARBITRATION_ZVPORT0_OFF 0 +#define PCIMEM_ARBITRATION_ZVPORT0_PRIORITY_1 1 +#define PCIMEM_ARBITRATION_ZVPORT0_PRIORITY_2 2 +#define PCIMEM_ARBITRATION_ZVPORT0_PRIORITY_3 3 +#define PCIMEM_ARBITRATION_ZVPORT0_PRIORITY_4 4 +#define PCIMEM_ARBITRATION_ZVPORT0_PRIORITY_5 5 +#define PCIMEM_ARBITRATION_ZVPORT0_PRIORITY_6 6 +#define PCIMEM_ARBITRATION_ZVPORT0_PRIORITY_7 7 +#define PCIMEM_ARBITRATION_VIDEO 10:8 +#define PCIMEM_ARBITRATION_VIDEO_OFF 0 +#define PCIMEM_ARBITRATION_VIDEO_PRIORITY_1 1 +#define PCIMEM_ARBITRATION_VIDEO_PRIORITY_2 2 +#define PCIMEM_ARBITRATION_VIDEO_PRIORITY_3 3 +#define PCIMEM_ARBITRATION_VIDEO_PRIORITY_4 4 +#define PCIMEM_ARBITRATION_VIDEO_PRIORITY_5 5 +#define PCIMEM_ARBITRATION_VIDEO_PRIORITY_6 6 +#define PCIMEM_ARBITRATION_VIDEO_PRIORITY_7 7 +#define PCIMEM_ARBITRATION_PANEL 6:4 +#define PCIMEM_ARBITRATION_PANEL_OFF 0 +#define PCIMEM_ARBITRATION_PANEL_PRIORITY_1 1 +#define PCIMEM_ARBITRATION_PANEL_PRIORITY_2 2 +#define PCIMEM_ARBITRATION_PANEL_PRIORITY_3 3 +#define PCIMEM_ARBITRATION_PANEL_PRIORITY_4 4 +#define PCIMEM_ARBITRATION_PANEL_PRIORITY_5 5 +#define PCIMEM_ARBITRATION_PANEL_PRIORITY_6 6 +#define PCIMEM_ARBITRATION_PANEL_PRIORITY_7 7 +#define PCIMEM_ARBITRATION_CRT 2:0 +#define PCIMEM_ARBITRATION_CRT_OFF 0 +#define PCIMEM_ARBITRATION_CRT_PRIORITY_1 1 +#define PCIMEM_ARBITRATION_CRT_PRIORITY_2 2 +#define PCIMEM_ARBITRATION_CRT_PRIORITY_3 3 +#define PCIMEM_ARBITRATION_CRT_PRIORITY_4 4 +#define PCIMEM_ARBITRATION_CRT_PRIORITY_5 5 +#define PCIMEM_ARBITRATION_CRT_PRIORITY_6 6 +#define PCIMEM_ARBITRATION_CRT_PRIORITY_7 7 + +#define RAW_INT 0x000020 +#define RAW_INT_ZVPORT1_VSYNC 4:4 +#define RAW_INT_ZVPORT1_VSYNC_INACTIVE 0 +#define RAW_INT_ZVPORT1_VSYNC_ACTIVE 1 +#define RAW_INT_ZVPORT1_VSYNC_CLEAR 1 +#define RAW_INT_ZVPORT0_VSYNC 3:3 +#define RAW_INT_ZVPORT0_VSYNC_INACTIVE 0 +#define RAW_INT_ZVPORT0_VSYNC_ACTIVE 1 +#define RAW_INT_ZVPORT0_VSYNC_CLEAR 1 +#define RAW_INT_CRT_VSYNC 2:2 +#define RAW_INT_CRT_VSYNC_INACTIVE 0 +#define RAW_INT_CRT_VSYNC_ACTIVE 1 +#define RAW_INT_CRT_VSYNC_CLEAR 1 +#define RAW_INT_PANEL_VSYNC 1:1 +#define RAW_INT_PANEL_VSYNC_INACTIVE 0 +#define RAW_INT_PANEL_VSYNC_ACTIVE 1 +#define RAW_INT_PANEL_VSYNC_CLEAR 1 +#define RAW_INT_VGA_VSYNC 0:0 +#define RAW_INT_VGA_VSYNC_INACTIVE 0 +#define RAW_INT_VGA_VSYNC_ACTIVE 1 +#define RAW_INT_VGA_VSYNC_CLEAR 1 + +#define INT_STATUS 0x000024 +#define INT_STATUS_GPIO31 31:31 +#define INT_STATUS_GPIO31_INACTIVE 0 +#define INT_STATUS_GPIO31_ACTIVE 1 +#define INT_STATUS_GPIO30 30:30 +#define INT_STATUS_GPIO30_INACTIVE 0 +#define INT_STATUS_GPIO30_ACTIVE 1 +#define INT_STATUS_GPIO29 29:29 +#define INT_STATUS_GPIO29_INACTIVE 0 +#define INT_STATUS_GPIO29_ACTIVE 1 +#define INT_STATUS_GPIO28 28:28 +#define INT_STATUS_GPIO28_INACTIVE 0 +#define INT_STATUS_GPIO28_ACTIVE 1 +#define INT_STATUS_GPIO27 27:27 +#define INT_STATUS_GPIO27_INACTIVE 0 +#define INT_STATUS_GPIO27_ACTIVE 1 +#define INT_STATUS_GPIO26 26:26 +#define INT_STATUS_GPIO26_INACTIVE 0 +#define INT_STATUS_GPIO26_ACTIVE 1 +#define INT_STATUS_GPIO25 25:25 +#define INT_STATUS_GPIO25_INACTIVE 0 +#define INT_STATUS_GPIO25_ACTIVE 1 +#define INT_STATUS_I2C 12:12 +#define INT_STATUS_I2C_INACTIVE 0 +#define INT_STATUS_I2C_ACTIVE 1 +#define INT_STATUS_PWM 11:11 +#define INT_STATUS_PWM_INACTIVE 0 +#define INT_STATUS_PWM_ACTIVE 1 +#define INT_STATUS_DMA1 10:10 +#define INT_STATUS_DMA1_INACTIVE 0 +#define INT_STATUS_DMA1_ACTIVE 1 +#define INT_STATUS_DMA0 9:9 +#define INT_STATUS_DMA0_INACTIVE 0 +#define INT_STATUS_DMA0_ACTIVE 1 +#define INT_STATUS_PCI 8:8 +#define INT_STATUS_PCI_INACTIVE 0 +#define INT_STATUS_PCI_ACTIVE 1 +#define INT_STATUS_SSP1 7:7 +#define INT_STATUS_SSP1_INACTIVE 0 +#define INT_STATUS_SSP1_ACTIVE 1 +#define INT_STATUS_SSP0 6:6 +#define INT_STATUS_SSP0_INACTIVE 0 +#define INT_STATUS_SSP0_ACTIVE 1 +#define INT_STATUS_DE 5:5 +#define INT_STATUS_DE_INACTIVE 0 +#define INT_STATUS_DE_ACTIVE 1 +#define INT_STATUS_ZVPORT1_VSYNC 4:4 +#define INT_STATUS_ZVPORT1_VSYNC_INACTIVE 0 +#define INT_STATUS_ZVPORT1_VSYNC_ACTIVE 1 +#define INT_STATUS_ZVPORT0_VSYNC 3:3 +#define INT_STATUS_ZVPORT0_VSYNC_INACTIVE 0 +#define INT_STATUS_ZVPORT0_VSYNC_ACTIVE 1 +#define INT_STATUS_CRT_VSYNC 2:2 +#define INT_STATUS_CRT_VSYNC_INACTIVE 0 +#define INT_STATUS_CRT_VSYNC_ACTIVE 1 +#define INT_STATUS_PANEL_VSYNC 1:1 +#define INT_STATUS_PANEL_VSYNC_INACTIVE 0 +#define INT_STATUS_PANEL_VSYNC_ACTIVE 1 +#define INT_STATUS_VGA_VSYNC 0:0 +#define INT_STATUS_VGA_VSYNC_INACTIVE 0 +#define INT_STATUS_VGA_VSYNC_ACTIVE 1 + +#define INT_MASK 0x000028 +#define INT_MASK_GPIO31 31:31 +#define INT_MASK_GPIO31_DISABLE 0 +#define INT_MASK_GPIO31_ENABLE 1 +#define INT_MASK_GPIO30 30:30 +#define INT_MASK_GPIO30_DISABLE 0 +#define INT_MASK_GPIO30_ENABLE 1 +#define INT_MASK_GPIO29 29:29 +#define INT_MASK_GPIO29_DISABLE 0 +#define INT_MASK_GPIO29_ENABLE 1 +#define INT_MASK_GPIO28 28:28 +#define INT_MASK_GPIO28_DISABLE 0 +#define INT_MASK_GPIO28_ENABLE 1 +#define INT_MASK_GPIO27 27:27 +#define INT_MASK_GPIO27_DISABLE 0 +#define INT_MASK_GPIO27_ENABLE 1 +#define INT_MASK_GPIO26 26:26 +#define INT_MASK_GPIO26_DISABLE 0 +#define INT_MASK_GPIO26_ENABLE 1 +#define INT_MASK_GPIO25 25:25 +#define INT_MASK_GPIO25_DISABLE 0 +#define INT_MASK_GPIO25_ENABLE 1 +#define INT_MASK_I2C 12:12 +#define INT_MASK_I2C_DISABLE 0 +#define INT_MASK_I2C_ENABLE 1 +#define INT_MASK_PWM 11:11 +#define INT_MASK_PWM_DISABLE 0 +#define INT_MASK_PWM_ENABLE 1 +#define INT_MASK_DMA1 10:10 +#define INT_MASK_DMA1_DISABLE 0 +#define INT_MASK_DMA1_ENABLE 1 +#define INT_MASK_DMA 9:9 +#define INT_MASK_DMA_DISABLE 0 +#define INT_MASK_DMA_ENABLE 1 +#define INT_MASK_PCI 8:8 +#define INT_MASK_PCI_DISABLE 0 +#define INT_MASK_PCI_ENABLE 1 +#define INT_MASK_SSP1 7:7 +#define INT_MASK_SSP1_DISABLE 0 +#define INT_MASK_SSP1_ENABLE 1 +#define INT_MASK_SSP0 6:6 +#define INT_MASK_SSP0_DISABLE 0 +#define INT_MASK_SSP0_ENABLE 1 +#define INT_MASK_DE 5:5 +#define INT_MASK_DE_DISABLE 0 +#define INT_MASK_DE_ENABLE 1 +#define INT_MASK_ZVPORT1_VSYNC 4:4 +#define INT_MASK_ZVPORT1_VSYNC_DISABLE 0 +#define INT_MASK_ZVPORT1_VSYNC_ENABLE 1 +#define INT_MASK_ZVPORT0_VSYNC 3:3 +#define INT_MASK_ZVPORT0_VSYNC_DISABLE 0 +#define INT_MASK_ZVPORT0_VSYNC_ENABLE 1 +#define INT_MASK_CRT_VSYNC 2:2 +#define INT_MASK_CRT_VSYNC_DISABLE 0 +#define INT_MASK_CRT_VSYNC_ENABLE 1 +#define INT_MASK_PANEL_VSYNC 1:1 +#define INT_MASK_PANEL_VSYNC_DISABLE 0 +#define INT_MASK_PANEL_VSYNC_ENABLE 1 +#define INT_MASK_VGA_VSYNC 0:0 +#define INT_MASK_VGA_VSYNC_DISABLE 0 +#define INT_MASK_VGA_VSYNC_ENABLE 1 + +#define CURRENT_GATE 0x000040 +#define CURRENT_GATE_MCLK 15:14 +#ifdef VALIDATION_CHIP + #define CURRENT_GATE_MCLK_112MHZ 0 + #define CURRENT_GATE_MCLK_84MHZ 1 + #define CURRENT_GATE_MCLK_56MHZ 2 + #define CURRENT_GATE_MCLK_42MHZ 3 +#else + #define CURRENT_GATE_MCLK_DIV_3 0 + #define CURRENT_GATE_MCLK_DIV_4 1 + #define CURRENT_GATE_MCLK_DIV_6 2 + #define CURRENT_GATE_MCLK_DIV_8 3 +#endif +#define CURRENT_GATE_M2XCLK 13:12 +#ifdef VALIDATION_CHIP + #define CURRENT_GATE_M2XCLK_336MHZ 0 + #define CURRENT_GATE_M2XCLK_168MHZ 1 + #define CURRENT_GATE_M2XCLK_112MHZ 2 + #define CURRENT_GATE_M2XCLK_84MHZ 3 +#else + #define CURRENT_GATE_M2XCLK_DIV_1 0 + #define CURRENT_GATE_M2XCLK_DIV_2 1 + #define CURRENT_GATE_M2XCLK_DIV_3 2 + #define CURRENT_GATE_M2XCLK_DIV_4 3 +#endif +#define CURRENT_GATE_VGA 10:10 +#define CURRENT_GATE_VGA_OFF 0 +#define CURRENT_GATE_VGA_ON 1 +#define CURRENT_GATE_PWM 9:9 +#define CURRENT_GATE_PWM_OFF 0 +#define CURRENT_GATE_PWM_ON 1 +#define CURRENT_GATE_I2C 8:8 +#define CURRENT_GATE_I2C_OFF 0 +#define CURRENT_GATE_I2C_ON 1 +#define CURRENT_GATE_SSP 7:7 +#define CURRENT_GATE_SSP_OFF 0 +#define CURRENT_GATE_SSP_ON 1 +#define CURRENT_GATE_GPIO 6:6 +#define CURRENT_GATE_GPIO_OFF 0 +#define CURRENT_GATE_GPIO_ON 1 +#define CURRENT_GATE_ZVPORT 5:5 +#define CURRENT_GATE_ZVPORT_OFF 0 +#define CURRENT_GATE_ZVPORT_ON 1 +#define CURRENT_GATE_CSC 4:4 +#define CURRENT_GATE_CSC_OFF 0 +#define CURRENT_GATE_CSC_ON 1 +#define CURRENT_GATE_DE 3:3 +#define CURRENT_GATE_DE_OFF 0 +#define CURRENT_GATE_DE_ON 1 +#define CURRENT_GATE_DISPLAY 2:2 +#define CURRENT_GATE_DISPLAY_OFF 0 +#define CURRENT_GATE_DISPLAY_ON 1 +#define CURRENT_GATE_LOCALMEM 1:1 +#define CURRENT_GATE_LOCALMEM_OFF 0 +#define CURRENT_GATE_LOCALMEM_ON 1 +#define CURRENT_GATE_DMA 0:0 +#define CURRENT_GATE_DMA_OFF 0 +#define CURRENT_GATE_DMA_ON 1 + +#define MODE0_GATE 0x000044 +#define MODE0_GATE_MCLK 15:14 +#define MODE0_GATE_MCLK_112MHZ 0 +#define MODE0_GATE_MCLK_84MHZ 1 +#define MODE0_GATE_MCLK_56MHZ 2 +#define MODE0_GATE_MCLK_42MHZ 3 +#define MODE0_GATE_M2XCLK 13:12 +#define MODE0_GATE_M2XCLK_336MHZ 0 +#define MODE0_GATE_M2XCLK_168MHZ 1 +#define MODE0_GATE_M2XCLK_112MHZ 2 +#define MODE0_GATE_M2XCLK_84MHZ 3 +#define MODE0_GATE_VGA 10:10 +#define MODE0_GATE_VGA_OFF 0 +#define MODE0_GATE_VGA_ON 1 +#define MODE0_GATE_PWM 9:9 +#define MODE0_GATE_PWM_OFF 0 +#define MODE0_GATE_PWM_ON 1 +#define MODE0_GATE_I2C 8:8 +#define MODE0_GATE_I2C_OFF 0 +#define MODE0_GATE_I2C_ON 1 +#define MODE0_GATE_SSP 7:7 +#define MODE0_GATE_SSP_OFF 0 +#define MODE0_GATE_SSP_ON 1 +#define MODE0_GATE_GPIO 6:6 +#define MODE0_GATE_GPIO_OFF 0 +#define MODE0_GATE_GPIO_ON 1 +#define MODE0_GATE_ZVPORT 5:5 +#define MODE0_GATE_ZVPORT_OFF 0 +#define MODE0_GATE_ZVPORT_ON 1 +#define MODE0_GATE_CSC 4:4 +#define MODE0_GATE_CSC_OFF 0 +#define MODE0_GATE_CSC_ON 1 +#define MODE0_GATE_DE 3:3 +#define MODE0_GATE_DE_OFF 0 +#define MODE0_GATE_DE_ON 1 +#define MODE0_GATE_DISPLAY 2:2 +#define MODE0_GATE_DISPLAY_OFF 0 +#define MODE0_GATE_DISPLAY_ON 1 +#define MODE0_GATE_LOCALMEM 1:1 +#define MODE0_GATE_LOCALMEM_OFF 0 +#define MODE0_GATE_LOCALMEM_ON 1 +#define MODE0_GATE_DMA 0:0 +#define MODE0_GATE_DMA_OFF 0 +#define MODE0_GATE_DMA_ON 1 + +#define MODE1_GATE 0x000048 +#define MODE1_GATE_MCLK 15:14 +#define MODE1_GATE_MCLK_112MHZ 0 +#define MODE1_GATE_MCLK_84MHZ 1 +#define MODE1_GATE_MCLK_56MHZ 2 +#define MODE1_GATE_MCLK_42MHZ 3 +#define MODE1_GATE_M2XCLK 13:12 +#define MODE1_GATE_M2XCLK_336MHZ 0 +#define MODE1_GATE_M2XCLK_168MHZ 1 +#define MODE1_GATE_M2XCLK_112MHZ 2 +#define MODE1_GATE_M2XCLK_84MHZ 3 +#define MODE1_GATE_VGA 10:10 +#define MODE1_GATE_VGA_OFF 0 +#define MODE1_GATE_VGA_ON 1 +#define MODE1_GATE_PWM 9:9 +#define MODE1_GATE_PWM_OFF 0 +#define MODE1_GATE_PWM_ON 1 +#define MODE1_GATE_I2C 8:8 +#define MODE1_GATE_I2C_OFF 0 +#define MODE1_GATE_I2C_ON 1 +#define MODE1_GATE_SSP 7:7 +#define MODE1_GATE_SSP_OFF 0 +#define MODE1_GATE_SSP_ON 1 +#define MODE1_GATE_GPIO 6:6 +#define MODE1_GATE_GPIO_OFF 0 +#define MODE1_GATE_GPIO_ON 1 +#define MODE1_GATE_ZVPORT 5:5 +#define MODE1_GATE_ZVPORT_OFF 0 +#define MODE1_GATE_ZVPORT_ON 1 +#define MODE1_GATE_CSC 4:4 +#define MODE1_GATE_CSC_OFF 0 +#define MODE1_GATE_CSC_ON 1 +#define MODE1_GATE_DE 3:3 +#define MODE1_GATE_DE_OFF 0 +#define MODE1_GATE_DE_ON 1 +#define MODE1_GATE_DISPLAY 2:2 +#define MODE1_GATE_DISPLAY_OFF 0 +#define MODE1_GATE_DISPLAY_ON 1 +#define MODE1_GATE_LOCALMEM 1:1 +#define MODE1_GATE_LOCALMEM_OFF 0 +#define MODE1_GATE_LOCALMEM_ON 1 +#define MODE1_GATE_DMA 0:0 +#define MODE1_GATE_DMA_OFF 0 +#define MODE1_GATE_DMA_ON 1 + +#define POWER_MODE_CTRL 0x00004C +#ifdef VALIDATION_CHIP + #define POWER_MODE_CTRL_336CLK 4:4 + #define POWER_MODE_CTRL_336CLK_OFF 0 + #define POWER_MODE_CTRL_336CLK_ON 1 +#endif +#define POWER_MODE_CTRL_OSC_INPUT 3:3 +#define POWER_MODE_CTRL_OSC_INPUT_OFF 0 +#define POWER_MODE_CTRL_OSC_INPUT_ON 1 +#define POWER_MODE_CTRL_ACPI 2:2 +#define POWER_MODE_CTRL_ACPI_OFF 0 +#define POWER_MODE_CTRL_ACPI_ON 1 +#define POWER_MODE_CTRL_MODE 1:0 +#define POWER_MODE_CTRL_MODE_MODE0 0 +#define POWER_MODE_CTRL_MODE_MODE1 1 +#define POWER_MODE_CTRL_MODE_SLEEP 2 + +#define PCI_MASTER_BASE 0x000050 +#define PCI_MASTER_BASE_ADDRESS 7:0 + +#define DEVICE_ID 0x000054 +#define DEVICE_ID_DEVICE_ID 31:16 +#define DEVICE_ID_REVISION_ID 7:0 + +#define PLL_CLK_COUNT 0x000058 +#define PLL_CLK_COUNT_COUNTER 15:0 + +#define PANEL_PLL_CTRL 0x00005C +#define PANEL_PLL_CTRL_BYPASS 18:18 +#define PANEL_PLL_CTRL_BYPASS_OFF 0 +#define PANEL_PLL_CTRL_BYPASS_ON 1 +#define PANEL_PLL_CTRL_POWER 17:17 +#define PANEL_PLL_CTRL_POWER_OFF 0 +#define PANEL_PLL_CTRL_POWER_ON 1 +#define PANEL_PLL_CTRL_INPUT 16:16 +#define PANEL_PLL_CTRL_INPUT_OSC 0 +#define PANEL_PLL_CTRL_INPUT_TESTCLK 1 +#ifdef VALIDATION_CHIP + #define PANEL_PLL_CTRL_OD 15:14 +#else + #define PANEL_PLL_CTRL_POD 15:14 + #define PANEL_PLL_CTRL_OD 13:12 +#endif +#define PANEL_PLL_CTRL_N 11:8 +#define PANEL_PLL_CTRL_M 7:0 + +#define CRT_PLL_CTRL 0x000060 +#define CRT_PLL_CTRL_BYPASS 18:18 +#define CRT_PLL_CTRL_BYPASS_OFF 0 +#define CRT_PLL_CTRL_BYPASS_ON 1 +#define CRT_PLL_CTRL_POWER 17:17 +#define CRT_PLL_CTRL_POWER_OFF 0 +#define CRT_PLL_CTRL_POWER_ON 1 +#define CRT_PLL_CTRL_INPUT 16:16 +#define CRT_PLL_CTRL_INPUT_OSC 0 +#define CRT_PLL_CTRL_INPUT_TESTCLK 1 +#ifdef VALIDATION_CHIP + #define CRT_PLL_CTRL_OD 15:14 +#else + #define CRT_PLL_CTRL_POD 15:14 + #define CRT_PLL_CTRL_OD 13:12 +#endif +#define CRT_PLL_CTRL_N 11:8 +#define CRT_PLL_CTRL_M 7:0 + +#define VGA_PLL0_CTRL 0x000064 +#define VGA_PLL0_CTRL_BYPASS 18:18 +#define VGA_PLL0_CTRL_BYPASS_OFF 0 +#define VGA_PLL0_CTRL_BYPASS_ON 1 +#define VGA_PLL0_CTRL_POWER 17:17 +#define VGA_PLL0_CTRL_POWER_OFF 0 +#define VGA_PLL0_CTRL_POWER_ON 1 +#define VGA_PLL0_CTRL_INPUT 16:16 +#define VGA_PLL0_CTRL_INPUT_OSC 0 +#define VGA_PLL0_CTRL_INPUT_TESTCLK 1 +#ifdef VALIDATION_CHIP + #define VGA_PLL0_CTRL_OD 15:14 +#else + #define VGA_PLL0_CTRL_POD 15:14 + #define VGA_PLL0_CTRL_OD 13:12 +#endif +#define VGA_PLL0_CTRL_N 11:8 +#define VGA_PLL0_CTRL_M 7:0 + +#define VGA_PLL1_CTRL 0x000068 +#define VGA_PLL1_CTRL_BYPASS 18:18 +#define VGA_PLL1_CTRL_BYPASS_OFF 0 +#define VGA_PLL1_CTRL_BYPASS_ON 1 +#define VGA_PLL1_CTRL_POWER 17:17 +#define VGA_PLL1_CTRL_POWER_OFF 0 +#define VGA_PLL1_CTRL_POWER_ON 1 +#define VGA_PLL1_CTRL_INPUT 16:16 +#define VGA_PLL1_CTRL_INPUT_OSC 0 +#define VGA_PLL1_CTRL_INPUT_TESTCLK 1 +#ifdef VALIDATION_CHIP + #define VGA_PLL1_CTRL_OD 15:14 +#else + #define VGA_PLL1_CTRL_POD 15:14 + #define VGA_PLL1_CTRL_OD 13:12 +#endif +#define VGA_PLL1_CTRL_N 11:8 +#define VGA_PLL1_CTRL_M 7:0 + +#define SCRATCH_DATA 0x00006c + +#ifndef VALIDATION_CHIP + +#define MXCLK_PLL_CTRL 0x000070 +#define MXCLK_PLL_CTRL_BYPASS 18:18 +#define MXCLK_PLL_CTRL_BYPASS_OFF 0 +#define MXCLK_PLL_CTRL_BYPASS_ON 1 +#define MXCLK_PLL_CTRL_POWER 17:17 +#define MXCLK_PLL_CTRL_POWER_OFF 0 +#define MXCLK_PLL_CTRL_POWER_ON 1 +#define MXCLK_PLL_CTRL_INPUT 16:16 +#define MXCLK_PLL_CTRL_INPUT_OSC 0 +#define MXCLK_PLL_CTRL_INPUT_TESTCLK 1 +#define MXCLK_PLL_CTRL_POD 15:14 +#define MXCLK_PLL_CTRL_OD 13:12 +#define MXCLK_PLL_CTRL_N 11:8 +#define MXCLK_PLL_CTRL_M 7:0 + +#define VGA_CONFIGURATION 0x000088 +#define VGA_CONFIGURATION_USER_DEFINE 5:4 +#define VGA_CONFIGURATION_PLL 2:2 +#define VGA_CONFIGURATION_PLL_VGA 0 +#define VGA_CONFIGURATION_PLL_PANEL 1 +#define VGA_CONFIGURATION_MODE 1:1 +#define VGA_CONFIGURATION_MODE_TEXT 0 +#define VGA_CONFIGURATION_MODE_GRAPHIC 1 + +#endif + +#define GPIO_DATA 0x010000 +#define GPIO_DATA_31 31:31 +#define GPIO_DATA_30 30:30 +#define GPIO_DATA_29 29:29 +#define GPIO_DATA_28 28:28 +#define GPIO_DATA_27 27:27 +#define GPIO_DATA_26 26:26 +#define GPIO_DATA_25 25:25 +#define GPIO_DATA_24 24:24 +#define GPIO_DATA_23 23:23 +#define GPIO_DATA_22 22:22 +#define GPIO_DATA_21 21:21 +#define GPIO_DATA_20 20:20 +#define GPIO_DATA_19 19:19 +#define GPIO_DATA_18 18:18 +#define GPIO_DATA_17 17:17 +#define GPIO_DATA_16 16:16 +#define GPIO_DATA_15 15:15 +#define GPIO_DATA_14 14:14 +#define GPIO_DATA_13 13:13 +#define GPIO_DATA_12 12:12 +#define GPIO_DATA_11 11:11 +#define GPIO_DATA_10 10:10 +#define GPIO_DATA_9 9:9 +#define GPIO_DATA_8 8:8 +#define GPIO_DATA_7 7:7 +#define GPIO_DATA_6 6:6 +#define GPIO_DATA_5 5:5 +#define GPIO_DATA_4 4:4 +#define GPIO_DATA_3 3:3 +#define GPIO_DATA_2 2:2 +#define GPIO_DATA_1 1:1 +#define GPIO_DATA_0 0:0 + +#define GPIO_DATA_DIRECTION 0x010004 +#define GPIO_DATA_DIRECTION_31 31:31 +#define GPIO_DATA_DIRECTION_31_INPUT 0 +#define GPIO_DATA_DIRECTION_31_OUTPUT 1 +#define GPIO_DATA_DIRECTION_30 30:30 +#define GPIO_DATA_DIRECTION_30_INPUT 0 +#define GPIO_DATA_DIRECTION_30_OUTPUT 1 +#define GPIO_DATA_DIRECTION_29 29:29 +#define GPIO_DATA_DIRECTION_29_INPUT 0 +#define GPIO_DATA_DIRECTION_29_OUTPUT 1 +#define GPIO_DATA_DIRECTION_28 28:28 +#define GPIO_DATA_DIRECTION_28_INPUT 0 +#define GPIO_DATA_DIRECTION_28_OUTPUT 1 +#define GPIO_DATA_DIRECTION_27 27:27 +#define GPIO_DATA_DIRECTION_27_INPUT 0 +#define GPIO_DATA_DIRECTION_27_OUTPUT 1 +#define GPIO_DATA_DIRECTION_26 26:26 +#define GPIO_DATA_DIRECTION_26_INPUT 0 +#define GPIO_DATA_DIRECTION_26_OUTPUT 1 +#define GPIO_DATA_DIRECTION_25 25:25 +#define GPIO_DATA_DIRECTION_25_INPUT 0 +#define GPIO_DATA_DIRECTION_25_OUTPUT 1 +#define GPIO_DATA_DIRECTION_24 24:24 +#define GPIO_DATA_DIRECTION_24_INPUT 0 +#define GPIO_DATA_DIRECTION_24_OUTPUT 1 +#define GPIO_DATA_DIRECTION_23 23:23 +#define GPIO_DATA_DIRECTION_23_INPUT 0 +#define GPIO_DATA_DIRECTION_23_OUTPUT 1 +#define GPIO_DATA_DIRECTION_22 22:22 +#define GPIO_DATA_DIRECTION_22_INPUT 0 +#define GPIO_DATA_DIRECTION_22_OUTPUT 1 +#define GPIO_DATA_DIRECTION_21 21:21 +#define GPIO_DATA_DIRECTION_21_INPUT 0 +#define GPIO_DATA_DIRECTION_21_OUTPUT 1 +#define GPIO_DATA_DIRECTION_20 20:20 +#define GPIO_DATA_DIRECTION_20_INPUT 0 +#define GPIO_DATA_DIRECTION_20_OUTPUT 1 +#define GPIO_DATA_DIRECTION_19 19:19 +#define GPIO_DATA_DIRECTION_19_INPUT 0 +#define GPIO_DATA_DIRECTION_19_OUTPUT 1 +#define GPIO_DATA_DIRECTION_18 18:18 +#define GPIO_DATA_DIRECTION_18_INPUT 0 +#define GPIO_DATA_DIRECTION_18_OUTPUT 1 +#define GPIO_DATA_DIRECTION_17 17:17 +#define GPIO_DATA_DIRECTION_17_INPUT 0 +#define GPIO_DATA_DIRECTION_17_OUTPUT 1 +#define GPIO_DATA_DIRECTION_16 16:16 +#define GPIO_DATA_DIRECTION_16_INPUT 0 +#define GPIO_DATA_DIRECTION_16_OUTPUT 1 +#define GPIO_DATA_DIRECTION_15 15:15 +#define GPIO_DATA_DIRECTION_15_INPUT 0 +#define GPIO_DATA_DIRECTION_15_OUTPUT 1 +#define GPIO_DATA_DIRECTION_14 14:14 +#define GPIO_DATA_DIRECTION_14_INPUT 0 +#define GPIO_DATA_DIRECTION_14_OUTPUT 1 +#define GPIO_DATA_DIRECTION_13 13:13 +#define GPIO_DATA_DIRECTION_13_INPUT 0 +#define GPIO_DATA_DIRECTION_13_OUTPUT 1 +#define GPIO_DATA_DIRECTION_12 12:12 +#define GPIO_DATA_DIRECTION_12_INPUT 0 +#define GPIO_DATA_DIRECTION_12_OUTPUT 1 +#define GPIO_DATA_DIRECTION_11 11:11 +#define GPIO_DATA_DIRECTION_11_INPUT 0 +#define GPIO_DATA_DIRECTION_11_OUTPUT 1 +#define GPIO_DATA_DIRECTION_10 10:10 +#define GPIO_DATA_DIRECTION_10_INPUT 0 +#define GPIO_DATA_DIRECTION_10_OUTPUT 1 +#define GPIO_DATA_DIRECTION_9 9:9 +#define GPIO_DATA_DIRECTION_9_INPUT 0 +#define GPIO_DATA_DIRECTION_9_OUTPUT 1 +#define GPIO_DATA_DIRECTION_8 8:8 +#define GPIO_DATA_DIRECTION_8_INPUT 0 +#define GPIO_DATA_DIRECTION_8_OUTPUT 1 +#define GPIO_DATA_DIRECTION_7 7:7 +#define GPIO_DATA_DIRECTION_7_INPUT 0 +#define GPIO_DATA_DIRECTION_7_OUTPUT 1 +#define GPIO_DATA_DIRECTION_6 6:6 +#define GPIO_DATA_DIRECTION_6_INPUT 0 +#define GPIO_DATA_DIRECTION_6_OUTPUT 1 +#define GPIO_DATA_DIRECTION_5 5:5 +#define GPIO_DATA_DIRECTION_5_INPUT 0 +#define GPIO_DATA_DIRECTION_5_OUTPUT 1 +#define GPIO_DATA_DIRECTION_4 4:4 +#define GPIO_DATA_DIRECTION_4_INPUT 0 +#define GPIO_DATA_DIRECTION_4_OUTPUT 1 +#define GPIO_DATA_DIRECTION_3 3:3 +#define GPIO_DATA_DIRECTION_3_INPUT 0 +#define GPIO_DATA_DIRECTION_3_OUTPUT 1 +#define GPIO_DATA_DIRECTION_2 2:2 +#define GPIO_DATA_DIRECTION_2_INPUT 0 +#define GPIO_DATA_DIRECTION_2_OUTPUT 1 +#define GPIO_DATA_DIRECTION_1 131 +#define GPIO_DATA_DIRECTION_1_INPUT 0 +#define GPIO_DATA_DIRECTION_1_OUTPUT 1 +#define GPIO_DATA_DIRECTION_0 0:0 +#define GPIO_DATA_DIRECTION_0_INPUT 0 +#define GPIO_DATA_DIRECTION_0_OUTPUT 1 + +#define GPIO_INTERRUPT_SETUP 0x010008 +#define GPIO_INTERRUPT_SETUP_TRIGGER_31 22:22 +#define GPIO_INTERRUPT_SETUP_TRIGGER_31_EDGE 0 +#define GPIO_INTERRUPT_SETUP_TRIGGER_31_LEVEL 1 +#define GPIO_INTERRUPT_SETUP_TRIGGER_30 21:21 +#define GPIO_INTERRUPT_SETUP_TRIGGER_30_EDGE 0 +#define GPIO_INTERRUPT_SETUP_TRIGGER_30_LEVEL 1 +#define GPIO_INTERRUPT_SETUP_TRIGGER_29 20:20 +#define GPIO_INTERRUPT_SETUP_TRIGGER_29_EDGE 0 +#define GPIO_INTERRUPT_SETUP_TRIGGER_29_LEVEL 1 +#define GPIO_INTERRUPT_SETUP_TRIGGER_28 19:19 +#define GPIO_INTERRUPT_SETUP_TRIGGER_28_EDGE 0 +#define GPIO_INTERRUPT_SETUP_TRIGGER_28_LEVEL 1 +#define GPIO_INTERRUPT_SETUP_TRIGGER_27 18:18 +#define GPIO_INTERRUPT_SETUP_TRIGGER_27_EDGE 0 +#define GPIO_INTERRUPT_SETUP_TRIGGER_27_LEVEL 1 +#define GPIO_INTERRUPT_SETUP_TRIGGER_26 17:17 +#define GPIO_INTERRUPT_SETUP_TRIGGER_26_EDGE 0 +#define GPIO_INTERRUPT_SETUP_TRIGGER_26_LEVEL 1 +#define GPIO_INTERRUPT_SETUP_TRIGGER_25 16:16 +#define GPIO_INTERRUPT_SETUP_TRIGGER_25_EDGE 0 +#define GPIO_INTERRUPT_SETUP_TRIGGER_25_LEVEL 1 +#define GPIO_INTERRUPT_SETUP_ACTIVE_31 14:14 +#define GPIO_INTERRUPT_SETUP_ACTIVE_31_LOW 0 +#define GPIO_INTERRUPT_SETUP_ACTIVE_31_HIGH 1 +#define GPIO_INTERRUPT_SETUP_ACTIVE_30 13:13 +#define GPIO_INTERRUPT_SETUP_ACTIVE_30_LOW 0 +#define GPIO_INTERRUPT_SETUP_ACTIVE_30_HIGH 1 +#define GPIO_INTERRUPT_SETUP_ACTIVE_29 12:12 +#define GPIO_INTERRUPT_SETUP_ACTIVE_29_LOW 0 +#define GPIO_INTERRUPT_SETUP_ACTIVE_29_HIGH 1 +#define GPIO_INTERRUPT_SETUP_ACTIVE_28 11:11 +#define GPIO_INTERRUPT_SETUP_ACTIVE_28_LOW 0 +#define GPIO_INTERRUPT_SETUP_ACTIVE_28_HIGH 1 +#define GPIO_INTERRUPT_SETUP_ACTIVE_27 10:10 +#define GPIO_INTERRUPT_SETUP_ACTIVE_27_LOW 0 +#define GPIO_INTERRUPT_SETUP_ACTIVE_27_HIGH 1 +#define GPIO_INTERRUPT_SETUP_ACTIVE_26 9:9 +#define GPIO_INTERRUPT_SETUP_ACTIVE_26_LOW 0 +#define GPIO_INTERRUPT_SETUP_ACTIVE_26_HIGH 1 +#define GPIO_INTERRUPT_SETUP_ACTIVE_25 8:8 +#define GPIO_INTERRUPT_SETUP_ACTIVE_25_LOW 0 +#define GPIO_INTERRUPT_SETUP_ACTIVE_25_HIGH 1 +#define GPIO_INTERRUPT_SETUP_ENABLE_31 6:6 +#define GPIO_INTERRUPT_SETUP_ENABLE_31_GPIO 0 +#define GPIO_INTERRUPT_SETUP_ENABLE_31_INTERRUPT 1 +#define GPIO_INTERRUPT_SETUP_ENABLE_30 5:5 +#define GPIO_INTERRUPT_SETUP_ENABLE_30_GPIO 0 +#define GPIO_INTERRUPT_SETUP_ENABLE_30_INTERRUPT 1 +#define GPIO_INTERRUPT_SETUP_ENABLE_29 4:4 +#define GPIO_INTERRUPT_SETUP_ENABLE_29_GPIO 0 +#define GPIO_INTERRUPT_SETUP_ENABLE_29_INTERRUPT 1 +#define GPIO_INTERRUPT_SETUP_ENABLE_28 3:3 +#define GPIO_INTERRUPT_SETUP_ENABLE_28_GPIO 0 +#define GPIO_INTERRUPT_SETUP_ENABLE_28_INTERRUPT 1 +#define GPIO_INTERRUPT_SETUP_ENABLE_27 2:2 +#define GPIO_INTERRUPT_SETUP_ENABLE_27_GPIO 0 +#define GPIO_INTERRUPT_SETUP_ENABLE_27_INTERRUPT 1 +#define GPIO_INTERRUPT_SETUP_ENABLE_26 1:1 +#define GPIO_INTERRUPT_SETUP_ENABLE_26_GPIO 0 +#define GPIO_INTERRUPT_SETUP_ENABLE_26_INTERRUPT 1 +#define GPIO_INTERRUPT_SETUP_ENABLE_25 0:0 +#define GPIO_INTERRUPT_SETUP_ENABLE_25_GPIO 0 +#define GPIO_INTERRUPT_SETUP_ENABLE_25_INTERRUPT 1 + +#define GPIO_INTERRUPT_STATUS 0x01000C +#define GPIO_INTERRUPT_STATUS_31 22:22 +#define GPIO_INTERRUPT_STATUS_31_INACTIVE 0 +#define GPIO_INTERRUPT_STATUS_31_ACTIVE 1 +#define GPIO_INTERRUPT_STATUS_31_RESET 1 +#define GPIO_INTERRUPT_STATUS_30 21:21 +#define GPIO_INTERRUPT_STATUS_30_INACTIVE 0 +#define GPIO_INTERRUPT_STATUS_30_ACTIVE 1 +#define GPIO_INTERRUPT_STATUS_30_RESET 1 +#define GPIO_INTERRUPT_STATUS_29 20:20 +#define GPIO_INTERRUPT_STATUS_29_INACTIVE 0 +#define GPIO_INTERRUPT_STATUS_29_ACTIVE 1 +#define GPIO_INTERRUPT_STATUS_29_RESET 1 +#define GPIO_INTERRUPT_STATUS_28 19:19 +#define GPIO_INTERRUPT_STATUS_28_INACTIVE 0 +#define GPIO_INTERRUPT_STATUS_28_ACTIVE 1 +#define GPIO_INTERRUPT_STATUS_28_RESET 1 +#define GPIO_INTERRUPT_STATUS_27 18:18 +#define GPIO_INTERRUPT_STATUS_27_INACTIVE 0 +#define GPIO_INTERRUPT_STATUS_27_ACTIVE 1 +#define GPIO_INTERRUPT_STATUS_27_RESET 1 +#define GPIO_INTERRUPT_STATUS_26 17:17 +#define GPIO_INTERRUPT_STATUS_26_INACTIVE 0 +#define GPIO_INTERRUPT_STATUS_26_ACTIVE 1 +#define GPIO_INTERRUPT_STATUS_26_RESET 1 +#define GPIO_INTERRUPT_STATUS_25 16:16 +#define GPIO_INTERRUPT_STATUS_25_INACTIVE 0 +#define GPIO_INTERRUPT_STATUS_25_ACTIVE 1 +#define GPIO_INTERRUPT_STATUS_25_RESET 1 + + +#define PANEL_DISPLAY_CTRL 0x080000 +#define PANEL_DISPLAY_CTRL_RESERVED_1_MASK 31:30 +#define PANEL_DISPLAY_CTRL_RESERVED_1_MASK_DISABLE 0 +#define PANEL_DISPLAY_CTRL_RESERVED_1_MASK_ENABLE 3 +#define PANEL_DISPLAY_CTRL_SELECT 29:28 +#define PANEL_DISPLAY_CTRL_SELECT_PANEL 0 +#define PANEL_DISPLAY_CTRL_SELECT_VGA 1 +#define PANEL_DISPLAY_CTRL_SELECT_CRT 2 +#define PANEL_DISPLAY_CTRL_FPEN 27:27 +#define PANEL_DISPLAY_CTRL_FPEN_LOW 0 +#define PANEL_DISPLAY_CTRL_FPEN_HIGH 1 +#define PANEL_DISPLAY_CTRL_VBIASEN 26:26 +#define PANEL_DISPLAY_CTRL_VBIASEN_LOW 0 +#define PANEL_DISPLAY_CTRL_VBIASEN_HIGH 1 +#define PANEL_DISPLAY_CTRL_DATA 25:25 +#define PANEL_DISPLAY_CTRL_DATA_DISABLE 0 +#define PANEL_DISPLAY_CTRL_DATA_ENABLE 1 +#define PANEL_DISPLAY_CTRL_FPVDDEN 24:24 +#define PANEL_DISPLAY_CTRL_FPVDDEN_LOW 0 +#define PANEL_DISPLAY_CTRL_FPVDDEN_HIGH 1 +#define PANEL_DISPLAY_CTRL_RESERVED_2_MASK 23:20 +#define PANEL_DISPLAY_CTRL_RESERVED_2_MASK_DISABLE 0 +#define PANEL_DISPLAY_CTRL_RESERVED_2_MASK_ENABLE 15 + +#define PANEL_DISPLAY_CTRL_TFT_DISP 19:18 +#define PANEL_DISPLAY_CTRL_TFT_DISP_24 0 +#define PANEL_DISPLAY_CTRL_TFT_DISP_36 1 +#define PANEL_DISPLAY_CTRL_TFT_DISP_18 2 + + +#define PANEL_DISPLAY_CTRL_DUAL_DISPLAY 19:19 +#define PANEL_DISPLAY_CTRL_DUAL_DISPLAY_DISABLE 0 +#define PANEL_DISPLAY_CTRL_DUAL_DISPLAY_ENABLE 1 +#define PANEL_DISPLAY_CTRL_DOUBLE_PIXEL 18:18 +#define PANEL_DISPLAY_CTRL_DOUBLE_PIXEL_DISABLE 0 +#define PANEL_DISPLAY_CTRL_DOUBLE_PIXEL_ENABLE 1 +#define PANEL_DISPLAY_CTRL_FIFO 17:16 +#define PANEL_DISPLAY_CTRL_FIFO_1 0 +#define PANEL_DISPLAY_CTRL_FIFO_3 1 +#define PANEL_DISPLAY_CTRL_FIFO_7 2 +#define PANEL_DISPLAY_CTRL_FIFO_11 3 +#define PANEL_DISPLAY_CTRL_RESERVED_3_MASK 15:15 +#define PANEL_DISPLAY_CTRL_RESERVED_3_MASK_DISABLE 0 +#define PANEL_DISPLAY_CTRL_RESERVED_3_MASK_ENABLE 1 +#define PANEL_DISPLAY_CTRL_CLOCK_PHASE 14:14 +#define PANEL_DISPLAY_CTRL_CLOCK_PHASE_ACTIVE_HIGH 0 +#define PANEL_DISPLAY_CTRL_CLOCK_PHASE_ACTIVE_LOW 1 +#define PANEL_DISPLAY_CTRL_VSYNC_PHASE 13:13 +#define PANEL_DISPLAY_CTRL_VSYNC_PHASE_ACTIVE_HIGH 0 +#define PANEL_DISPLAY_CTRL_VSYNC_PHASE_ACTIVE_LOW 1 +#define PANEL_DISPLAY_CTRL_HSYNC_PHASE 12:12 +#define PANEL_DISPLAY_CTRL_HSYNC_PHASE_ACTIVE_HIGH 0 +#define PANEL_DISPLAY_CTRL_HSYNC_PHASE_ACTIVE_LOW 1 +#define PANEL_DISPLAY_CTRL_VSYNC 11:11 +#define PANEL_DISPLAY_CTRL_VSYNC_ACTIVE_HIGH 0 +#define PANEL_DISPLAY_CTRL_VSYNC_ACTIVE_LOW 1 +#define PANEL_DISPLAY_CTRL_CAPTURE_TIMING 10:10 +#define PANEL_DISPLAY_CTRL_CAPTURE_TIMING_DISABLE 0 +#define PANEL_DISPLAY_CTRL_CAPTURE_TIMING_ENABLE 1 +#define PANEL_DISPLAY_CTRL_COLOR_KEY 9:9 +#define PANEL_DISPLAY_CTRL_COLOR_KEY_DISABLE 0 +#define PANEL_DISPLAY_CTRL_COLOR_KEY_ENABLE 1 +#define PANEL_DISPLAY_CTRL_TIMING 8:8 +#define PANEL_DISPLAY_CTRL_TIMING_DISABLE 0 +#define PANEL_DISPLAY_CTRL_TIMING_ENABLE 1 +#define PANEL_DISPLAY_CTRL_VERTICAL_PAN_DIR 7:7 +#define PANEL_DISPLAY_CTRL_VERTICAL_PAN_DIR_DOWN 0 +#define PANEL_DISPLAY_CTRL_VERTICAL_PAN_DIR_UP 1 +#define PANEL_DISPLAY_CTRL_VERTICAL_PAN 6:6 +#define PANEL_DISPLAY_CTRL_VERTICAL_PAN_DISABLE 0 +#define PANEL_DISPLAY_CTRL_VERTICAL_PAN_ENABLE 1 +#define PANEL_DISPLAY_CTRL_HORIZONTAL_PAN_DIR 5:5 +#define PANEL_DISPLAY_CTRL_HORIZONTAL_PAN_DIR_RIGHT 0 +#define PANEL_DISPLAY_CTRL_HORIZONTAL_PAN_DIR_LEFT 1 +#define PANEL_DISPLAY_CTRL_HORIZONTAL_PAN 4:4 +#define PANEL_DISPLAY_CTRL_HORIZONTAL_PAN_DISABLE 0 +#define PANEL_DISPLAY_CTRL_HORIZONTAL_PAN_ENABLE 1 +#define PANEL_DISPLAY_CTRL_GAMMA 3:3 +#define PANEL_DISPLAY_CTRL_GAMMA_DISABLE 0 +#define PANEL_DISPLAY_CTRL_GAMMA_ENABLE 1 +#define PANEL_DISPLAY_CTRL_PLANE 2:2 +#define PANEL_DISPLAY_CTRL_PLANE_DISABLE 0 +#define PANEL_DISPLAY_CTRL_PLANE_ENABLE 1 +#define PANEL_DISPLAY_CTRL_FORMAT 1:0 +#define PANEL_DISPLAY_CTRL_FORMAT_8 0 +#define PANEL_DISPLAY_CTRL_FORMAT_16 1 +#define PANEL_DISPLAY_CTRL_FORMAT_32 2 + +#define PANEL_PAN_CTRL 0x080004 +#define PANEL_PAN_CTRL_VERTICAL_PAN 31:24 +#define PANEL_PAN_CTRL_VERTICAL_VSYNC 21:16 +#define PANEL_PAN_CTRL_HORIZONTAL_PAN 15:8 +#define PANEL_PAN_CTRL_HORIZONTAL_VSYNC 5:0 + +#define PANEL_COLOR_KEY 0x080008 +#define PANEL_COLOR_KEY_MASK 31:16 +#define PANEL_COLOR_KEY_VALUE 15:0 + +#define PANEL_FB_ADDRESS 0x08000C +#define PANEL_FB_ADDRESS_STATUS 31:31 +#define PANEL_FB_ADDRESS_STATUS_CURRENT 0 +#define PANEL_FB_ADDRESS_STATUS_PENDING 1 +#define PANEL_FB_ADDRESS_EXT 27:27 +#define PANEL_FB_ADDRESS_EXT_LOCAL 0 +#define PANEL_FB_ADDRESS_EXT_EXTERNAL 1 +#define PANEL_FB_ADDRESS_ADDRESS 25:0 + +#define PANEL_FB_WIDTH 0x080010 +#define PANEL_FB_WIDTH_WIDTH 29:16 +#define PANEL_FB_WIDTH_OFFSET 13:0 + +#define PANEL_WINDOW_WIDTH 0x080014 +#define PANEL_WINDOW_WIDTH_WIDTH 27:16 +#define PANEL_WINDOW_WIDTH_X 11:0 + +#define PANEL_WINDOW_HEIGHT 0x080018 +#define PANEL_WINDOW_HEIGHT_HEIGHT 27:16 +#define PANEL_WINDOW_HEIGHT_Y 11:0 + +#define PANEL_PLANE_TL 0x08001C +#define PANEL_PLANE_TL_TOP 26:16 +#define PANEL_PLANE_TL_LEFT 10:0 + +#define PANEL_PLANE_BR 0x080020 +#define PANEL_PLANE_BR_BOTTOM 26:16 +#define PANEL_PLANE_BR_RIGHT 10:0 + +#define PANEL_HORIZONTAL_TOTAL 0x080024 +#define PANEL_HORIZONTAL_TOTAL_TOTAL 27:16 +#define PANEL_HORIZONTAL_TOTAL_DISPLAY_END 11:0 + +#define PANEL_HORIZONTAL_SYNC 0x080028 +#define PANEL_HORIZONTAL_SYNC_WIDTH 23:16 +#define PANEL_HORIZONTAL_SYNC_START 11:0 + +#define PANEL_VERTICAL_TOTAL 0x08002C +#define PANEL_VERTICAL_TOTAL_TOTAL 26:16 +#define PANEL_VERTICAL_TOTAL_DISPLAY_END 10:0 + +#define PANEL_VERTICAL_SYNC 0x080030 +#define PANEL_VERTICAL_SYNC_HEIGHT 21:16 +#define PANEL_VERTICAL_SYNC_START 10:0 + +#define PANEL_CURRENT_LINE 0x080034 +#define PANEL_CURRENT_LINE_LINE 10:0 + +/* Video Control */ + +#define VIDEO_DISPLAY_CTRL 0x080040 +#define VIDEO_DISPLAY_CTRL_LINE_BUFFER 18:18 +#define VIDEO_DISPLAY_CTRL_LINE_BUFFER_DISABLE 0 +#define VIDEO_DISPLAY_CTRL_LINE_BUFFER_ENABLE 1 +#define VIDEO_DISPLAY_CTRL_FIFO 17:16 +#define VIDEO_DISPLAY_CTRL_FIFO_1 0 +#define VIDEO_DISPLAY_CTRL_FIFO_3 1 +#define VIDEO_DISPLAY_CTRL_FIFO_7 2 +#define VIDEO_DISPLAY_CTRL_FIFO_11 3 +#define VIDEO_DISPLAY_CTRL_BUFFER 15:15 +#define VIDEO_DISPLAY_CTRL_BUFFER_0 0 +#define VIDEO_DISPLAY_CTRL_BUFFER_1 1 +#define VIDEO_DISPLAY_CTRL_CAPTURE 14:14 +#define VIDEO_DISPLAY_CTRL_CAPTURE_DISABLE 0 +#define VIDEO_DISPLAY_CTRL_CAPTURE_ENABLE 1 +#define VIDEO_DISPLAY_CTRL_DOUBLE_BUFFER 13:13 +#define VIDEO_DISPLAY_CTRL_DOUBLE_BUFFER_DISABLE 0 +#define VIDEO_DISPLAY_CTRL_DOUBLE_BUFFER_ENABLE 1 +#define VIDEO_DISPLAY_CTRL_BYTE_SWAP 12:12 +#define VIDEO_DISPLAY_CTRL_BYTE_SWAP_DISABLE 0 +#define VIDEO_DISPLAY_CTRL_BYTE_SWAP_ENABLE 1 +#define VIDEO_DISPLAY_CTRL_VERTICAL_SCALE 11:11 +#define VIDEO_DISPLAY_CTRL_VERTICAL_SCALE_NORMAL 0 +#define VIDEO_DISPLAY_CTRL_VERTICAL_SCALE_HALF 1 +#define VIDEO_DISPLAY_CTRL_HORIZONTAL_SCALE 10:10 +#define VIDEO_DISPLAY_CTRL_HORIZONTAL_SCALE_NORMAL 0 +#define VIDEO_DISPLAY_CTRL_HORIZONTAL_SCALE_HALF 1 +#define VIDEO_DISPLAY_CTRL_VERTICAL_MODE 9:9 +#define VIDEO_DISPLAY_CTRL_VERTICAL_MODE_REPLICATE 0 +#define VIDEO_DISPLAY_CTRL_VERTICAL_MODE_INTERPOLATE 1 +#define VIDEO_DISPLAY_CTRL_HORIZONTAL_MODE 8:8 +#define VIDEO_DISPLAY_CTRL_HORIZONTAL_MODE_REPLICATE 0 +#define VIDEO_DISPLAY_CTRL_HORIZONTAL_MODE_INTERPOLATE 1 +#define VIDEO_DISPLAY_CTRL_PIXEL 7:4 +#define VIDEO_DISPLAY_CTRL_GAMMA 3:3 +#define VIDEO_DISPLAY_CTRL_GAMMA_DISABLE 0 +#define VIDEO_DISPLAY_CTRL_GAMMA_ENABLE 1 +#define VIDEO_DISPLAY_CTRL_PLANE 2:2 +#define VIDEO_DISPLAY_CTRL_PLANE_DISABLE 0 +#define VIDEO_DISPLAY_CTRL_PLANE_ENABLE 1 +#define VIDEO_DISPLAY_CTRL_FORMAT 1:0 +#define VIDEO_DISPLAY_CTRL_FORMAT_8 0 +#define VIDEO_DISPLAY_CTRL_FORMAT_16 1 +#define VIDEO_DISPLAY_CTRL_FORMAT_32 2 +#define VIDEO_DISPLAY_CTRL_FORMAT_YUV 3 + +#define VIDEO_FB_0_ADDRESS 0x080044 +#define VIDEO_FB_0_ADDRESS_STATUS 31:31 +#define VIDEO_FB_0_ADDRESS_STATUS_CURRENT 0 +#define VIDEO_FB_0_ADDRESS_STATUS_PENDING 1 +#define VIDEO_FB_0_ADDRESS_EXT 27:27 +#define VIDEO_FB_0_ADDRESS_EXT_LOCAL 0 +#define VIDEO_FB_0_ADDRESS_EXT_EXTERNAL 1 +#define VIDEO_FB_0_ADDRESS_ADDRESS 25:0 + +#define VIDEO_FB_WIDTH 0x080048 +#define VIDEO_FB_WIDTH_WIDTH 29:16 +#define VIDEO_FB_WIDTH_OFFSET 13:0 + +#define VIDEO_FB_0_LAST_ADDRESS 0x08004C +#define VIDEO_FB_0_LAST_ADDRESS_EXT 27:27 +#define VIDEO_FB_0_LAST_ADDRESS_EXT_LOCAL 0 +#define VIDEO_FB_0_LAST_ADDRESS_EXT_EXTERNAL 1 +#define VIDEO_FB_0_LAST_ADDRESS_ADDRESS 25:0 + +#define VIDEO_PLANE_TL 0x080050 +#define VIDEO_PLANE_TL_TOP 26:16 +#define VIDEO_PLANE_TL_LEFT 10:0 + +#define VIDEO_PLANE_BR 0x080054 +#define VIDEO_PLANE_BR_BOTTOM 26:16 +#define VIDEO_PLANE_BR_RIGHT 10:0 + +#define VIDEO_SCALE 0x080058 +#define VIDEO_SCALE_VERTICAL_MODE 31:31 +#define VIDEO_SCALE_VERTICAL_MODE_EXPAND 0 +#define VIDEO_SCALE_VERTICAL_MODE_SHRINK 1 +#define VIDEO_SCALE_VERTICAL_SCALE 27:16 +#define VIDEO_SCALE_HORIZONTAL_MODE 15:15 +#define VIDEO_SCALE_HORIZONTAL_MODE_EXPAND 0 +#define VIDEO_SCALE_HORIZONTAL_MODE_SHRINK 1 +#define VIDEO_SCALE_HORIZONTAL_SCALE 11:0 + +#define VIDEO_INITIAL_SCALE 0x08005C +#define VIDEO_INITIAL_SCALE_FB_1 27:16 +#define VIDEO_INITIAL_SCALE_FB_0 11:0 + +#define VIDEO_YUV_CONSTANTS 0x080060 +#define VIDEO_YUV_CONSTANTS_Y 31:24 +#define VIDEO_YUV_CONSTANTS_R 23:16 +#define VIDEO_YUV_CONSTANTS_G 15:8 +#define VIDEO_YUV_CONSTANTS_B 7:0 + +#define VIDEO_FB_1_ADDRESS 0x080064 +#define VIDEO_FB_1_ADDRESS_STATUS 31:31 +#define VIDEO_FB_1_ADDRESS_STATUS_CURRENT 0 +#define VIDEO_FB_1_ADDRESS_STATUS_PENDING 1 +#define VIDEO_FB_1_ADDRESS_EXT 27:27 +#define VIDEO_FB_1_ADDRESS_EXT_LOCAL 0 +#define VIDEO_FB_1_ADDRESS_EXT_EXTERNAL 1 +#define VIDEO_FB_1_ADDRESS_ADDRESS 25:0 + +#define VIDEO_FB_1_LAST_ADDRESS 0x080068 +#define VIDEO_FB_1_LAST_ADDRESS_EXT 27:27 +#define VIDEO_FB_1_LAST_ADDRESS_EXT_LOCAL 0 +#define VIDEO_FB_1_LAST_ADDRESS_EXT_EXTERNAL 1 +#define VIDEO_FB_1_LAST_ADDRESS_ADDRESS 25:0 + +/* Video Alpha Control */ + +#define VIDEO_ALPHA_DISPLAY_CTRL 0x080080 +#define VIDEO_ALPHA_DISPLAY_CTRL_SELECT 28:28 +#define VIDEO_ALPHA_DISPLAY_CTRL_SELECT_PER_PIXEL 0 +#define VIDEO_ALPHA_DISPLAY_CTRL_SELECT_ALPHA 1 +#define VIDEO_ALPHA_DISPLAY_CTRL_ALPHA 27:24 +#define VIDEO_ALPHA_DISPLAY_CTRL_FIFO 17:16 +#define VIDEO_ALPHA_DISPLAY_CTRL_FIFO_1 0 +#define VIDEO_ALPHA_DISPLAY_CTRL_FIFO_3 1 +#define VIDEO_ALPHA_DISPLAY_CTRL_FIFO_7 2 +#define VIDEO_ALPHA_DISPLAY_CTRL_FIFO_11 3 +#define VIDEO_ALPHA_DISPLAY_CTRL_VERT_SCALE 11:11 +#define VIDEO_ALPHA_DISPLAY_CTRL_VERT_SCALE_NORMAL 0 +#define VIDEO_ALPHA_DISPLAY_CTRL_VERT_SCALE_HALF 1 +#define VIDEO_ALPHA_DISPLAY_CTRL_HORZ_SCALE 10:10 +#define VIDEO_ALPHA_DISPLAY_CTRL_HORZ_SCALE_NORMAL 0 +#define VIDEO_ALPHA_DISPLAY_CTRL_HORZ_SCALE_HALF 1 +#define VIDEO_ALPHA_DISPLAY_CTRL_VERT_MODE 9:9 +#define VIDEO_ALPHA_DISPLAY_CTRL_VERT_MODE_REPLICATE 0 +#define VIDEO_ALPHA_DISPLAY_CTRL_VERT_MODE_INTERPOLATE 1 +#define VIDEO_ALPHA_DISPLAY_CTRL_HORZ_MODE 8:8 +#define VIDEO_ALPHA_DISPLAY_CTRL_HORZ_MODE_REPLICATE 0 +#define VIDEO_ALPHA_DISPLAY_CTRL_HORZ_MODE_INTERPOLATE 1 +#define VIDEO_ALPHA_DISPLAY_CTRL_PIXEL 7:4 +#define VIDEO_ALPHA_DISPLAY_CTRL_CHROMA_KEY 3:3 +#define VIDEO_ALPHA_DISPLAY_CTRL_CHROMA_KEY_DISABLE 0 +#define VIDEO_ALPHA_DISPLAY_CTRL_CHROMA_KEY_ENABLE 1 +#define VIDEO_ALPHA_DISPLAY_CTRL_PLANE 2:2 +#define VIDEO_ALPHA_DISPLAY_CTRL_PLANE_DISABLE 0 +#define VIDEO_ALPHA_DISPLAY_CTRL_PLANE_ENABLE 1 +#define VIDEO_ALPHA_DISPLAY_CTRL_FORMAT 1:0 +#define VIDEO_ALPHA_DISPLAY_CTRL_FORMAT_8 0 +#define VIDEO_ALPHA_DISPLAY_CTRL_FORMAT_16 1 +#define VIDEO_ALPHA_DISPLAY_CTRL_FORMAT_ALPHA_4_4 2 +#define VIDEO_ALPHA_DISPLAY_CTRL_FORMAT_ALPHA_4_4_4_4 3 + +#define VIDEO_ALPHA_FB_ADDRESS 0x080084 +#define VIDEO_ALPHA_FB_ADDRESS_STATUS 31:31 +#define VIDEO_ALPHA_FB_ADDRESS_STATUS_CURRENT 0 +#define VIDEO_ALPHA_FB_ADDRESS_STATUS_PENDING 1 +#define VIDEO_ALPHA_FB_ADDRESS_EXT 27:27 +#define VIDEO_ALPHA_FB_ADDRESS_EXT_LOCAL 0 +#define VIDEO_ALPHA_FB_ADDRESS_EXT_EXTERNAL 1 +#define VIDEO_ALPHA_FB_ADDRESS_ADDRESS 25:0 + +#define VIDEO_ALPHA_FB_WIDTH 0x080088 +#define VIDEO_ALPHA_FB_WIDTH_WIDTH 29:16 +#define VIDEO_ALPHA_FB_WIDTH_OFFSET 13:0 + +#define VIDEO_ALPHA_FB_LAST_ADDRESS 0x08008C +#define VIDEO_ALPHA_FB_LAST_ADDRESS_EXT 27:27 +#define VIDEO_ALPHA_FB_LAST_ADDRESS_EXT_LOCAL 0 +#define VIDEO_ALPHA_FB_LAST_ADDRESS_EXT_EXTERNAL 1 +#define VIDEO_ALPHA_FB_LAST_ADDRESS_ADDRESS 25:0 + +#define VIDEO_ALPHA_PLANE_TL 0x080090 +#define VIDEO_ALPHA_PLANE_TL_TOP 26:16 +#define VIDEO_ALPHA_PLANE_TL_LEFT 10:0 + +#define VIDEO_ALPHA_PLANE_BR 0x080094 +#define VIDEO_ALPHA_PLANE_BR_BOTTOM 26:16 +#define VIDEO_ALPHA_PLANE_BR_RIGHT 10:0 + +#define VIDEO_ALPHA_SCALE 0x080098 +#define VIDEO_ALPHA_SCALE_VERTICAL_MODE 31:31 +#define VIDEO_ALPHA_SCALE_VERTICAL_MODE_EXPAND 0 +#define VIDEO_ALPHA_SCALE_VERTICAL_MODE_SHRINK 1 +#define VIDEO_ALPHA_SCALE_VERTICAL_SCALE 27:16 +#define VIDEO_ALPHA_SCALE_HORIZONTAL_MODE 15:15 +#define VIDEO_ALPHA_SCALE_HORIZONTAL_MODE_EXPAND 0 +#define VIDEO_ALPHA_SCALE_HORIZONTAL_MODE_SHRINK 1 +#define VIDEO_ALPHA_SCALE_HORIZONTAL_SCALE 11:0 + +#define VIDEO_ALPHA_INITIAL_SCALE 0x08009C +#define VIDEO_ALPHA_INITIAL_SCALE_VERTICAL 27:16 +#define VIDEO_ALPHA_INITIAL_SCALE_HORIZONTAL 11:0 + +#define VIDEO_ALPHA_CHROMA_KEY 0x0800A0 +#define VIDEO_ALPHA_CHROMA_KEY_MASK 31:16 +#define VIDEO_ALPHA_CHROMA_KEY_VALUE 15:0 + +#define VIDEO_ALPHA_COLOR_LOOKUP_01 0x0800A4 +#define VIDEO_ALPHA_COLOR_LOOKUP_01_1 31:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_01_1_RED 31:27 +#define VIDEO_ALPHA_COLOR_LOOKUP_01_1_GREEN 26:21 +#define VIDEO_ALPHA_COLOR_LOOKUP_01_1_BLUE 20:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_01_0 15:0 +#define VIDEO_ALPHA_COLOR_LOOKUP_01_0_RED 15:11 +#define VIDEO_ALPHA_COLOR_LOOKUP_01_0_GREEN 10:5 +#define VIDEO_ALPHA_COLOR_LOOKUP_01_0_BLUE 4:0 + +#define VIDEO_ALPHA_COLOR_LOOKUP_23 0x0800A8 +#define VIDEO_ALPHA_COLOR_LOOKUP_23_3 31:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_23_3_RED 31:27 +#define VIDEO_ALPHA_COLOR_LOOKUP_23_3_GREEN 26:21 +#define VIDEO_ALPHA_COLOR_LOOKUP_23_3_BLUE 20:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_23_2 15:0 +#define VIDEO_ALPHA_COLOR_LOOKUP_23_2_RED 15:11 +#define VIDEO_ALPHA_COLOR_LOOKUP_23_2_GREEN 10:5 +#define VIDEO_ALPHA_COLOR_LOOKUP_23_2_BLUE 4:0 + +#define VIDEO_ALPHA_COLOR_LOOKUP_45 0x0800AC +#define VIDEO_ALPHA_COLOR_LOOKUP_45_5 31:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_45_5_RED 31:27 +#define VIDEO_ALPHA_COLOR_LOOKUP_45_5_GREEN 26:21 +#define VIDEO_ALPHA_COLOR_LOOKUP_45_5_BLUE 20:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_45_4 15:0 +#define VIDEO_ALPHA_COLOR_LOOKUP_45_4_RED 15:11 +#define VIDEO_ALPHA_COLOR_LOOKUP_45_4_GREEN 10:5 +#define VIDEO_ALPHA_COLOR_LOOKUP_45_4_BLUE 4:0 + +#define VIDEO_ALPHA_COLOR_LOOKUP_67 0x0800B0 +#define VIDEO_ALPHA_COLOR_LOOKUP_67_7 31:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_67_7_RED 31:27 +#define VIDEO_ALPHA_COLOR_LOOKUP_67_7_GREEN 26:21 +#define VIDEO_ALPHA_COLOR_LOOKUP_67_7_BLUE 20:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_67_6 15:0 +#define VIDEO_ALPHA_COLOR_LOOKUP_67_6_RED 15:11 +#define VIDEO_ALPHA_COLOR_LOOKUP_67_6_GREEN 10:5 +#define VIDEO_ALPHA_COLOR_LOOKUP_67_6_BLUE 4:0 + +#define VIDEO_ALPHA_COLOR_LOOKUP_89 0x0800B4 +#define VIDEO_ALPHA_COLOR_LOOKUP_89_9 31:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_89_9_RED 31:27 +#define VIDEO_ALPHA_COLOR_LOOKUP_89_9_GREEN 26:21 +#define VIDEO_ALPHA_COLOR_LOOKUP_89_9_BLUE 20:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_89_8 15:0 +#define VIDEO_ALPHA_COLOR_LOOKUP_89_8_RED 15:11 +#define VIDEO_ALPHA_COLOR_LOOKUP_89_8_GREEN 10:5 +#define VIDEO_ALPHA_COLOR_LOOKUP_89_8_BLUE 4:0 + +#define VIDEO_ALPHA_COLOR_LOOKUP_AB 0x0800B8 +#define VIDEO_ALPHA_COLOR_LOOKUP_AB_B 31:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_AB_B_RED 31:27 +#define VIDEO_ALPHA_COLOR_LOOKUP_AB_B_GREEN 26:21 +#define VIDEO_ALPHA_COLOR_LOOKUP_AB_B_BLUE 20:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_AB_A 15:0 +#define VIDEO_ALPHA_COLOR_LOOKUP_AB_A_RED 15:11 +#define VIDEO_ALPHA_COLOR_LOOKUP_AB_A_GREEN 10:5 +#define VIDEO_ALPHA_COLOR_LOOKUP_AB_A_BLUE 4:0 + +#define VIDEO_ALPHA_COLOR_LOOKUP_CD 0x0800BC +#define VIDEO_ALPHA_COLOR_LOOKUP_CD_D 31:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_CD_D_RED 31:27 +#define VIDEO_ALPHA_COLOR_LOOKUP_CD_D_GREEN 26:21 +#define VIDEO_ALPHA_COLOR_LOOKUP_CD_D_BLUE 20:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_CD_C 15:0 +#define VIDEO_ALPHA_COLOR_LOOKUP_CD_C_RED 15:11 +#define VIDEO_ALPHA_COLOR_LOOKUP_CD_C_GREEN 10:5 +#define VIDEO_ALPHA_COLOR_LOOKUP_CD_C_BLUE 4:0 + +#define VIDEO_ALPHA_COLOR_LOOKUP_EF 0x0800C0 +#define VIDEO_ALPHA_COLOR_LOOKUP_EF_F 31:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_EF_F_RED 31:27 +#define VIDEO_ALPHA_COLOR_LOOKUP_EF_F_GREEN 26:21 +#define VIDEO_ALPHA_COLOR_LOOKUP_EF_F_BLUE 20:16 +#define VIDEO_ALPHA_COLOR_LOOKUP_EF_E 15:0 +#define VIDEO_ALPHA_COLOR_LOOKUP_EF_E_RED 15:11 +#define VIDEO_ALPHA_COLOR_LOOKUP_EF_E_GREEN 10:5 +#define VIDEO_ALPHA_COLOR_LOOKUP_EF_E_BLUE 4:0 + +/* Panel Cursor Control */ + +#define PANEL_HWC_ADDRESS 0x0800F0 +#define PANEL_HWC_ADDRESS_ENABLE 31:31 +#define PANEL_HWC_ADDRESS_ENABLE_DISABLE 0 +#define PANEL_HWC_ADDRESS_ENABLE_ENABLE 1 +#define PANEL_HWC_ADDRESS_EXT 27:27 +#define PANEL_HWC_ADDRESS_EXT_LOCAL 0 +#define PANEL_HWC_ADDRESS_EXT_EXTERNAL 1 +#define PANEL_HWC_ADDRESS_ADDRESS 25:0 + +#define PANEL_HWC_LOCATION 0x0800F4 +#define PANEL_HWC_LOCATION_TOP 27:27 +#define PANEL_HWC_LOCATION_TOP_INSIDE 0 +#define PANEL_HWC_LOCATION_TOP_OUTSIDE 1 +#define PANEL_HWC_LOCATION_Y 26:16 +#define PANEL_HWC_LOCATION_LEFT 11:11 +#define PANEL_HWC_LOCATION_LEFT_INSIDE 0 +#define PANEL_HWC_LOCATION_LEFT_OUTSIDE 1 +#define PANEL_HWC_LOCATION_X 10:0 + +#define PANEL_HWC_COLOR_12 0x0800F8 +#define PANEL_HWC_COLOR_12_2_RGB565 31:16 +#define PANEL_HWC_COLOR_12_1_RGB565 15:0 + +#define PANEL_HWC_COLOR_3 0x0800FC +#define PANEL_HWC_COLOR_3_RGB565 15:0 + +/* Old Definitions +++ */ +#define PANEL_HWC_COLOR_01 0x0800F8 +#define PANEL_HWC_COLOR_01_1_RED 31:27 +#define PANEL_HWC_COLOR_01_1_GREEN 26:21 +#define PANEL_HWC_COLOR_01_1_BLUE 20:16 +#define PANEL_HWC_COLOR_01_0_RED 15:11 +#define PANEL_HWC_COLOR_01_0_GREEN 10:5 +#define PANEL_HWC_COLOR_01_0_BLUE 4:0 + +#define PANEL_HWC_COLOR_2 0x0800FC +#define PANEL_HWC_COLOR_2_RED 15:11 +#define PANEL_HWC_COLOR_2_GREEN 10:5 +#define PANEL_HWC_COLOR_2_BLUE 4:0 +/* Old Definitions --- */ + +/* Alpha Control */ + +#define ALPHA_DISPLAY_CTRL 0x080100 +#define ALPHA_DISPLAY_CTRL_SELECT 28:28 +#define ALPHA_DISPLAY_CTRL_SELECT_PER_PIXEL 0 +#define ALPHA_DISPLAY_CTRL_SELECT_ALPHA 1 +#define ALPHA_DISPLAY_CTRL_ALPHA 27:24 +#define ALPHA_DISPLAY_CTRL_FIFO 17:16 +#define ALPHA_DISPLAY_CTRL_FIFO_1 0 +#define ALPHA_DISPLAY_CTRL_FIFO_3 1 +#define ALPHA_DISPLAY_CTRL_FIFO_7 2 +#define ALPHA_DISPLAY_CTRL_FIFO_11 3 +#define ALPHA_DISPLAY_CTRL_PIXEL 7:4 +#define ALPHA_DISPLAY_CTRL_CHROMA_KEY 3:3 +#define ALPHA_DISPLAY_CTRL_CHROMA_KEY_DISABLE 0 +#define ALPHA_DISPLAY_CTRL_CHROMA_KEY_ENABLE 1 +#define ALPHA_DISPLAY_CTRL_PLANE 2:2 +#define ALPHA_DISPLAY_CTRL_PLANE_DISABLE 0 +#define ALPHA_DISPLAY_CTRL_PLANE_ENABLE 1 +#define ALPHA_DISPLAY_CTRL_FORMAT 1:0 +#define ALPHA_DISPLAY_CTRL_FORMAT_16 1 +#define ALPHA_DISPLAY_CTRL_FORMAT_ALPHA_4_4 2 +#define ALPHA_DISPLAY_CTRL_FORMAT_ALPHA_4_4_4_4 3 + +#define ALPHA_FB_ADDRESS 0x080104 +#define ALPHA_FB_ADDRESS_STATUS 31:31 +#define ALPHA_FB_ADDRESS_STATUS_CURRENT 0 +#define ALPHA_FB_ADDRESS_STATUS_PENDING 1 +#define ALPHA_FB_ADDRESS_EXT 27:27 +#define ALPHA_FB_ADDRESS_EXT_LOCAL 0 +#define ALPHA_FB_ADDRESS_EXT_EXTERNAL 1 +#define ALPHA_FB_ADDRESS_ADDRESS 25:0 + +#define ALPHA_FB_WIDTH 0x080108 +#define ALPHA_FB_WIDTH_WIDTH 29:16 +#define ALPHA_FB_WIDTH_OFFSET 13:0 + +#define ALPHA_PLANE_TL 0x08010C +#define ALPHA_PLANE_TL_TOP 26:16 +#define ALPHA_PLANE_TL_LEFT 10:0 + +#define ALPHA_PLANE_BR 0x080110 +#define ALPHA_PLANE_BR_BOTTOM 26:16 +#define ALPHA_PLANE_BR_RIGHT 10:0 + +#define ALPHA_CHROMA_KEY 0x080114 +#define ALPHA_CHROMA_KEY_MASK 31:16 +#define ALPHA_CHROMA_KEY_VALUE 15:0 + +#define ALPHA_COLOR_LOOKUP_01 0x080118 +#define ALPHA_COLOR_LOOKUP_01_1 31:16 +#define ALPHA_COLOR_LOOKUP_01_1_RED 31:27 +#define ALPHA_COLOR_LOOKUP_01_1_GREEN 26:21 +#define ALPHA_COLOR_LOOKUP_01_1_BLUE 20:16 +#define ALPHA_COLOR_LOOKUP_01_0 15:0 +#define ALPHA_COLOR_LOOKUP_01_0_RED 15:11 +#define ALPHA_COLOR_LOOKUP_01_0_GREEN 10:5 +#define ALPHA_COLOR_LOOKUP_01_0_BLUE 4:0 + +#define ALPHA_COLOR_LOOKUP_23 0x08011C +#define ALPHA_COLOR_LOOKUP_23_3 31:16 +#define ALPHA_COLOR_LOOKUP_23_3_RED 31:27 +#define ALPHA_COLOR_LOOKUP_23_3_GREEN 26:21 +#define ALPHA_COLOR_LOOKUP_23_3_BLUE 20:16 +#define ALPHA_COLOR_LOOKUP_23_2 15:0 +#define ALPHA_COLOR_LOOKUP_23_2_RED 15:11 +#define ALPHA_COLOR_LOOKUP_23_2_GREEN 10:5 +#define ALPHA_COLOR_LOOKUP_23_2_BLUE 4:0 + +#define ALPHA_COLOR_LOOKUP_45 0x080120 +#define ALPHA_COLOR_LOOKUP_45_5 31:16 +#define ALPHA_COLOR_LOOKUP_45_5_RED 31:27 +#define ALPHA_COLOR_LOOKUP_45_5_GREEN 26:21 +#define ALPHA_COLOR_LOOKUP_45_5_BLUE 20:16 +#define ALPHA_COLOR_LOOKUP_45_4 15:0 +#define ALPHA_COLOR_LOOKUP_45_4_RED 15:11 +#define ALPHA_COLOR_LOOKUP_45_4_GREEN 10:5 +#define ALPHA_COLOR_LOOKUP_45_4_BLUE 4:0 + +#define ALPHA_COLOR_LOOKUP_67 0x080124 +#define ALPHA_COLOR_LOOKUP_67_7 31:16 +#define ALPHA_COLOR_LOOKUP_67_7_RED 31:27 +#define ALPHA_COLOR_LOOKUP_67_7_GREEN 26:21 +#define ALPHA_COLOR_LOOKUP_67_7_BLUE 20:16 +#define ALPHA_COLOR_LOOKUP_67_6 15:0 +#define ALPHA_COLOR_LOOKUP_67_6_RED 15:11 +#define ALPHA_COLOR_LOOKUP_67_6_GREEN 10:5 +#define ALPHA_COLOR_LOOKUP_67_6_BLUE 4:0 + +#define ALPHA_COLOR_LOOKUP_89 0x080128 +#define ALPHA_COLOR_LOOKUP_89_9 31:16 +#define ALPHA_COLOR_LOOKUP_89_9_RED 31:27 +#define ALPHA_COLOR_LOOKUP_89_9_GREEN 26:21 +#define ALPHA_COLOR_LOOKUP_89_9_BLUE 20:16 +#define ALPHA_COLOR_LOOKUP_89_8 15:0 +#define ALPHA_COLOR_LOOKUP_89_8_RED 15:11 +#define ALPHA_COLOR_LOOKUP_89_8_GREEN 10:5 +#define ALPHA_COLOR_LOOKUP_89_8_BLUE 4:0 + +#define ALPHA_COLOR_LOOKUP_AB 0x08012C +#define ALPHA_COLOR_LOOKUP_AB_B 31:16 +#define ALPHA_COLOR_LOOKUP_AB_B_RED 31:27 +#define ALPHA_COLOR_LOOKUP_AB_B_GREEN 26:21 +#define ALPHA_COLOR_LOOKUP_AB_B_BLUE 20:16 +#define ALPHA_COLOR_LOOKUP_AB_A 15:0 +#define ALPHA_COLOR_LOOKUP_AB_A_RED 15:11 +#define ALPHA_COLOR_LOOKUP_AB_A_GREEN 10:5 +#define ALPHA_COLOR_LOOKUP_AB_A_BLUE 4:0 + +#define ALPHA_COLOR_LOOKUP_CD 0x080130 +#define ALPHA_COLOR_LOOKUP_CD_D 31:16 +#define ALPHA_COLOR_LOOKUP_CD_D_RED 31:27 +#define ALPHA_COLOR_LOOKUP_CD_D_GREEN 26:21 +#define ALPHA_COLOR_LOOKUP_CD_D_BLUE 20:16 +#define ALPHA_COLOR_LOOKUP_CD_C 15:0 +#define ALPHA_COLOR_LOOKUP_CD_C_RED 15:11 +#define ALPHA_COLOR_LOOKUP_CD_C_GREEN 10:5 +#define ALPHA_COLOR_LOOKUP_CD_C_BLUE 4:0 + +#define ALPHA_COLOR_LOOKUP_EF 0x080134 +#define ALPHA_COLOR_LOOKUP_EF_F 31:16 +#define ALPHA_COLOR_LOOKUP_EF_F_RED 31:27 +#define ALPHA_COLOR_LOOKUP_EF_F_GREEN 26:21 +#define ALPHA_COLOR_LOOKUP_EF_F_BLUE 20:16 +#define ALPHA_COLOR_LOOKUP_EF_E 15:0 +#define ALPHA_COLOR_LOOKUP_EF_E_RED 15:11 +#define ALPHA_COLOR_LOOKUP_EF_E_GREEN 10:5 +#define ALPHA_COLOR_LOOKUP_EF_E_BLUE 4:0 + +/* CRT Graphics Control */ + +#define CRT_DISPLAY_CTRL 0x080200 +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK 31:27 +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_DISABLE 0 +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_ENABLE 0x1F + +/* SM750LE definition */ +#define CRT_DISPLAY_CTRL_DPMS 31:30 +#define CRT_DISPLAY_CTRL_DPMS_0 0 +#define CRT_DISPLAY_CTRL_DPMS_1 1 +#define CRT_DISPLAY_CTRL_DPMS_2 2 +#define CRT_DISPLAY_CTRL_DPMS_3 3 +#define CRT_DISPLAY_CTRL_CLK 29:27 +#define CRT_DISPLAY_CTRL_CLK_PLL25 0 +#define CRT_DISPLAY_CTRL_CLK_PLL41 1 +#define CRT_DISPLAY_CTRL_CLK_PLL62 2 +#define CRT_DISPLAY_CTRL_CLK_PLL65 3 +#define CRT_DISPLAY_CTRL_CLK_PLL74 4 +#define CRT_DISPLAY_CTRL_CLK_PLL80 5 +#define CRT_DISPLAY_CTRL_CLK_PLL108 6 +#define CRT_DISPLAY_CTRL_CLK_RESERVED 7 +#define CRT_DISPLAY_CTRL_SHIFT_VGA_DAC 26:26 +#define CRT_DISPLAY_CTRL_SHIFT_VGA_DAC_DISABLE 1 +#define CRT_DISPLAY_CTRL_SHIFT_VGA_DAC_ENABLE 0 + + +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK 25:24 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_ENABLE 3 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_DISABLE 0 + +/* SM750LE definition */ +#define CRT_DISPLAY_CTRL_CRTSELECT 25:25 +#define CRT_DISPLAY_CTRL_CRTSELECT_VGA 0 +#define CRT_DISPLAY_CTRL_CRTSELECT_CRT 1 +#define CRT_DISPLAY_CTRL_RGBBIT 24:24 +#define CRT_DISPLAY_CTRL_RGBBIT_24BIT 0 +#define CRT_DISPLAY_CTRL_RGBBIT_12BIT 1 + + +#define CRT_DISPLAY_CTRL_RESERVED_3_MASK 15:15 +#define CRT_DISPLAY_CTRL_RESERVED_3_MASK_DISABLE 0 +#define CRT_DISPLAY_CTRL_RESERVED_3_MASK_ENABLE 1 + +#define CRT_DISPLAY_CTRL_RESERVED_4_MASK 9:9 +#define CRT_DISPLAY_CTRL_RESERVED_4_MASK_DISABLE 0 +#define CRT_DISPLAY_CTRL_RESERVED_4_MASK_ENABLE 1 + +#ifndef VALIDATION_CHIP + #define CRT_DISPLAY_CTRL_SHIFT_VGA_DAC 26:26 + #define CRT_DISPLAY_CTRL_SHIFT_VGA_DAC_DISABLE 1 + #define CRT_DISPLAY_CTRL_SHIFT_VGA_DAC_ENABLE 0 + #define CRT_DISPLAY_CTRL_CENTERING 24:24 + #define CRT_DISPLAY_CTRL_CENTERING_DISABLE 0 + #define CRT_DISPLAY_CTRL_CENTERING_ENABLE 1 +#endif +#define CRT_DISPLAY_CTRL_LOCK_TIMING 23:23 +#define CRT_DISPLAY_CTRL_LOCK_TIMING_DISABLE 0 +#define CRT_DISPLAY_CTRL_LOCK_TIMING_ENABLE 1 +#define CRT_DISPLAY_CTRL_EXPANSION 22:22 +#define CRT_DISPLAY_CTRL_EXPANSION_DISABLE 0 +#define CRT_DISPLAY_CTRL_EXPANSION_ENABLE 1 +#define CRT_DISPLAY_CTRL_VERTICAL_MODE 21:21 +#define CRT_DISPLAY_CTRL_VERTICAL_MODE_REPLICATE 0 +#define CRT_DISPLAY_CTRL_VERTICAL_MODE_INTERPOLATE 1 +#define CRT_DISPLAY_CTRL_HORIZONTAL_MODE 20:20 +#define CRT_DISPLAY_CTRL_HORIZONTAL_MODE_REPLICATE 0 +#define CRT_DISPLAY_CTRL_HORIZONTAL_MODE_INTERPOLATE 1 +#define CRT_DISPLAY_CTRL_SELECT 19:18 +#define CRT_DISPLAY_CTRL_SELECT_PANEL 0 +#define CRT_DISPLAY_CTRL_SELECT_VGA 1 +#define CRT_DISPLAY_CTRL_SELECT_CRT 2 +#define CRT_DISPLAY_CTRL_FIFO 17:16 +#define CRT_DISPLAY_CTRL_FIFO_1 0 +#define CRT_DISPLAY_CTRL_FIFO_3 1 +#define CRT_DISPLAY_CTRL_FIFO_7 2 +#define CRT_DISPLAY_CTRL_FIFO_11 3 +#define CRT_DISPLAY_CTRL_CLOCK_PHASE 14:14 +#define CRT_DISPLAY_CTRL_CLOCK_PHASE_ACTIVE_HIGH 0 +#define CRT_DISPLAY_CTRL_CLOCK_PHASE_ACTIVE_LOW 1 +#define CRT_DISPLAY_CTRL_VSYNC_PHASE 13:13 +#define CRT_DISPLAY_CTRL_VSYNC_PHASE_ACTIVE_HIGH 0 +#define CRT_DISPLAY_CTRL_VSYNC_PHASE_ACTIVE_LOW 1 +#define CRT_DISPLAY_CTRL_HSYNC_PHASE 12:12 +#define CRT_DISPLAY_CTRL_HSYNC_PHASE_ACTIVE_HIGH 0 +#define CRT_DISPLAY_CTRL_HSYNC_PHASE_ACTIVE_LOW 1 +#define CRT_DISPLAY_CTRL_BLANK 10:10 +#define CRT_DISPLAY_CTRL_BLANK_OFF 0 +#define CRT_DISPLAY_CTRL_BLANK_ON 1 +#define CRT_DISPLAY_CTRL_TIMING 8:8 +#define CRT_DISPLAY_CTRL_TIMING_DISABLE 0 +#define CRT_DISPLAY_CTRL_TIMING_ENABLE 1 +#define CRT_DISPLAY_CTRL_PIXEL 7:4 +#define CRT_DISPLAY_CTRL_GAMMA 3:3 +#define CRT_DISPLAY_CTRL_GAMMA_DISABLE 0 +#define CRT_DISPLAY_CTRL_GAMMA_ENABLE 1 +#define CRT_DISPLAY_CTRL_PLANE 2:2 +#define CRT_DISPLAY_CTRL_PLANE_DISABLE 0 +#define CRT_DISPLAY_CTRL_PLANE_ENABLE 1 +#define CRT_DISPLAY_CTRL_FORMAT 1:0 +#define CRT_DISPLAY_CTRL_FORMAT_8 0 +#define CRT_DISPLAY_CTRL_FORMAT_16 1 +#define CRT_DISPLAY_CTRL_FORMAT_32 2 +#define CRT_DISPLAY_CTRL_RESERVED_BITS_MASK 0xFF000200 + +#define CRT_FB_ADDRESS 0x080204 +#define CRT_FB_ADDRESS_STATUS 31:31 +#define CRT_FB_ADDRESS_STATUS_CURRENT 0 +#define CRT_FB_ADDRESS_STATUS_PENDING 1 +#define CRT_FB_ADDRESS_EXT 27:27 +#define CRT_FB_ADDRESS_EXT_LOCAL 0 +#define CRT_FB_ADDRESS_EXT_EXTERNAL 1 +#define CRT_FB_ADDRESS_ADDRESS 25:0 + +#define CRT_FB_WIDTH 0x080208 +#define CRT_FB_WIDTH_WIDTH 29:16 +#define CRT_FB_WIDTH_OFFSET 13:0 + +#define CRT_HORIZONTAL_TOTAL 0x08020C +#define CRT_HORIZONTAL_TOTAL_TOTAL 27:16 +#define CRT_HORIZONTAL_TOTAL_DISPLAY_END 11:0 + +#define CRT_HORIZONTAL_SYNC 0x080210 +#define CRT_HORIZONTAL_SYNC_WIDTH 23:16 +#define CRT_HORIZONTAL_SYNC_START 11:0 + +#define CRT_VERTICAL_TOTAL 0x080214 +#define CRT_VERTICAL_TOTAL_TOTAL 26:16 +#define CRT_VERTICAL_TOTAL_DISPLAY_END 10:0 + +#define CRT_VERTICAL_SYNC 0x080218 +#define CRT_VERTICAL_SYNC_HEIGHT 21:16 +#define CRT_VERTICAL_SYNC_START 10:0 + +#define CRT_SIGNATURE_ANALYZER 0x08021C +#define CRT_SIGNATURE_ANALYZER_STATUS 31:16 +#define CRT_SIGNATURE_ANALYZER_ENABLE 3:3 +#define CRT_SIGNATURE_ANALYZER_ENABLE_DISABLE 0 +#define CRT_SIGNATURE_ANALYZER_ENABLE_ENABLE 1 +#define CRT_SIGNATURE_ANALYZER_RESET 2:2 +#define CRT_SIGNATURE_ANALYZER_RESET_NORMAL 0 +#define CRT_SIGNATURE_ANALYZER_RESET_RESET 1 +#define CRT_SIGNATURE_ANALYZER_SOURCE 1:0 +#define CRT_SIGNATURE_ANALYZER_SOURCE_RED 0 +#define CRT_SIGNATURE_ANALYZER_SOURCE_GREEN 1 +#define CRT_SIGNATURE_ANALYZER_SOURCE_BLUE 2 + +#define CRT_CURRENT_LINE 0x080220 +#define CRT_CURRENT_LINE_LINE 10:0 + +#define CRT_MONITOR_DETECT 0x080224 +#define CRT_MONITOR_DETECT_VALUE 25:25 +#define CRT_MONITOR_DETECT_VALUE_DISABLE 0 +#define CRT_MONITOR_DETECT_VALUE_ENABLE 1 +#define CRT_MONITOR_DETECT_ENABLE 24:24 +#define CRT_MONITOR_DETECT_ENABLE_DISABLE 0 +#define CRT_MONITOR_DETECT_ENABLE_ENABLE 1 +#define CRT_MONITOR_DETECT_RED 23:16 +#define CRT_MONITOR_DETECT_GREEN 15:8 +#define CRT_MONITOR_DETECT_BLUE 7:0 + +#define CRT_SCALE 0x080228 +#define CRT_SCALE_VERTICAL_MODE 31:31 +#define CRT_SCALE_VERTICAL_MODE_EXPAND 0 +#define CRT_SCALE_VERTICAL_MODE_SHRINK 1 +#define CRT_SCALE_VERTICAL_SCALE 27:16 +#define CRT_SCALE_HORIZONTAL_MODE 15:15 +#define CRT_SCALE_HORIZONTAL_MODE_EXPAND 0 +#define CRT_SCALE_HORIZONTAL_MODE_SHRINK 1 +#define CRT_SCALE_HORIZONTAL_SCALE 11:0 + +/* CRT Cursor Control */ + +#define CRT_HWC_ADDRESS 0x080230 +#define CRT_HWC_ADDRESS_ENABLE 31:31 +#define CRT_HWC_ADDRESS_ENABLE_DISABLE 0 +#define CRT_HWC_ADDRESS_ENABLE_ENABLE 1 +#define CRT_HWC_ADDRESS_EXT 27:27 +#define CRT_HWC_ADDRESS_EXT_LOCAL 0 +#define CRT_HWC_ADDRESS_EXT_EXTERNAL 1 +#define CRT_HWC_ADDRESS_ADDRESS 25:0 + +#define CRT_HWC_LOCATION 0x080234 +#define CRT_HWC_LOCATION_TOP 27:27 +#define CRT_HWC_LOCATION_TOP_INSIDE 0 +#define CRT_HWC_LOCATION_TOP_OUTSIDE 1 +#define CRT_HWC_LOCATION_Y 26:16 +#define CRT_HWC_LOCATION_LEFT 11:11 +#define CRT_HWC_LOCATION_LEFT_INSIDE 0 +#define CRT_HWC_LOCATION_LEFT_OUTSIDE 1 +#define CRT_HWC_LOCATION_X 10:0 + +#define CRT_HWC_COLOR_12 0x080238 +#define CRT_HWC_COLOR_12_2_RGB565 31:16 +#define CRT_HWC_COLOR_12_1_RGB565 15:0 + +#define CRT_HWC_COLOR_3 0x08023C +#define CRT_HWC_COLOR_3_RGB565 15:0 + +/* Old Definitions +++. Need to be removed if no application use it. */ +#if 0 + #define CRT_HWC_COLOR_01 0x080238 + #define CRT_HWC_COLOR_01_1_RED 31:27 + #define CRT_HWC_COLOR_01_1_GREEN 26:21 + #define CRT_HWC_COLOR_01_1_BLUE 20:16 + #define CRT_HWC_COLOR_01_0_RED 15:11 + #define CRT_HWC_COLOR_01_0_GREEN 10:5 + #define CRT_HWC_COLOR_01_0_BLUE 4:0 + + #define CRT_HWC_COLOR_2 0x08023C + #define CRT_HWC_COLOR_2_RED 15:11 + #define CRT_HWC_COLOR_2_GREEN 10:5 + #define CRT_HWC_COLOR_2_BLUE 4:0 +#endif +/* Old Definitions --- */ + +/* This vertical expansion below start at 0x080240 ~ 0x080264 */ +#define CRT_VERTICAL_EXPANSION 0x080240 +#ifndef VALIDATION_CHIP + #define CRT_VERTICAL_CENTERING_VALUE 31:24 +#endif +#define CRT_VERTICAL_EXPANSION_COMPARE_VALUE 23:16 +#define CRT_VERTICAL_EXPANSION_LINE_BUFFER 15:12 +#define CRT_VERTICAL_EXPANSION_SCALE_FACTOR 11:0 + +/* This horizontal expansion below start at 0x080268 ~ 0x08027C */ +#define CRT_HORIZONTAL_EXPANSION 0x080268 +#ifndef VALIDATION_CHIP + #define CRT_HORIZONTAL_CENTERING_VALUE 31:24 +#endif +#define CRT_HORIZONTAL_EXPANSION_COMPARE_VALUE 23:16 +#define CRT_HORIZONTAL_EXPANSION_SCALE_FACTOR 11:0 + +#ifndef VALIDATION_CHIP + /* Auto Centering */ + #define CRT_AUTO_CENTERING_TL 0x080280 + #define CRT_AUTO_CENTERING_TL_TOP 26:16 + #define CRT_AUTO_CENTERING_TL_LEFT 10:0 + + #define CRT_AUTO_CENTERING_BR 0x080284 + #define CRT_AUTO_CENTERING_BR_BOTTOM 26:16 + #define CRT_AUTO_CENTERING_BR_RIGHT 10:0 +#endif + +/* sm750le new register to control panel output */ +#define DISPLAY_CONTROL_750LE 0x80288 +/* Palette RAM */ + +/* Panel Pallete register starts at 0x080400 ~ 0x0807FC */ +#define PANEL_PALETTE_RAM 0x080400 + +/* Panel Pallete register starts at 0x080C00 ~ 0x080FFC */ +#define CRT_PALETTE_RAM 0x080C00 + +/* 2D registers + * move their defination into general lynx_accel.h file + * because all smi graphic chip share the same drawing engine + * register format */ +#if 0 +#define DE_SOURCE 0x100000 +#define DE_SOURCE_WRAP 31:31 +#define DE_SOURCE_WRAP_DISABLE 0 +#define DE_SOURCE_WRAP_ENABLE 1 + +/* + * The following definitions are used in different setting + */ + +/* Use these definitions in XY addressing mode or linear addressing mode. */ +#define DE_SOURCE_X_K1 27:16 +#define DE_SOURCE_Y_K2 11:0 + +/* Use this definition in host write mode for mono. The Y_K2 is not used + in host write mode. */ +#define DE_SOURCE_X_K1_MONO 20:16 + +/* Use these definitions in Bresenham line drawing mode. */ +#define DE_SOURCE_X_K1_LINE 29:16 +#define DE_SOURCE_Y_K2_LINE 13:0 + +#define DE_DESTINATION 0x100004 +#define DE_DESTINATION_WRAP 31:31 +#define DE_DESTINATION_WRAP_DISABLE 0 +#define DE_DESTINATION_WRAP_ENABLE 1 +#if 1 + #define DE_DESTINATION_X 27:16 + #define DE_DESTINATION_Y 11:0 +#else + #define DE_DESTINATION_X 28:16 + #define DE_DESTINATION_Y 15:0 +#endif + +#define DE_DIMENSION 0x100008 +#define DE_DIMENSION_X 28:16 +#define DE_DIMENSION_Y_ET 15:0 + +#define DE_CONTROL 0x10000C +#define DE_CONTROL_STATUS 31:31 +#define DE_CONTROL_STATUS_STOP 0 +#define DE_CONTROL_STATUS_START 1 +#define DE_CONTROL_PATTERN 30:30 +#define DE_CONTROL_PATTERN_MONO 0 +#define DE_CONTROL_PATTERN_COLOR 1 +#define DE_CONTROL_UPDATE_DESTINATION_X 29:29 +#define DE_CONTROL_UPDATE_DESTINATION_X_DISABLE 0 +#define DE_CONTROL_UPDATE_DESTINATION_X_ENABLE 1 +#define DE_CONTROL_QUICK_START 28:28 +#define DE_CONTROL_QUICK_START_DISABLE 0 +#define DE_CONTROL_QUICK_START_ENABLE 1 +#define DE_CONTROL_DIRECTION 27:27 +#define DE_CONTROL_DIRECTION_LEFT_TO_RIGHT 0 +#define DE_CONTROL_DIRECTION_RIGHT_TO_LEFT 1 +#define DE_CONTROL_MAJOR 26:26 +#define DE_CONTROL_MAJOR_X 0 +#define DE_CONTROL_MAJOR_Y 1 +#define DE_CONTROL_STEP_X 25:25 +#define DE_CONTROL_STEP_X_POSITIVE 0 +#define DE_CONTROL_STEP_X_NEGATIVE 1 +#define DE_CONTROL_STEP_Y 24:24 +#define DE_CONTROL_STEP_Y_POSITIVE 0 +#define DE_CONTROL_STEP_Y_NEGATIVE 1 +#define DE_CONTROL_STRETCH 23:23 +#define DE_CONTROL_STRETCH_DISABLE 0 +#define DE_CONTROL_STRETCH_ENABLE 1 +#define DE_CONTROL_HOST 22:22 +#define DE_CONTROL_HOST_COLOR 0 +#define DE_CONTROL_HOST_MONO 1 +#define DE_CONTROL_LAST_PIXEL 21:21 +#define DE_CONTROL_LAST_PIXEL_OFF 0 +#define DE_CONTROL_LAST_PIXEL_ON 1 +#define DE_CONTROL_COMMAND 20:16 +#define DE_CONTROL_COMMAND_BITBLT 0 +#define DE_CONTROL_COMMAND_RECTANGLE_FILL 1 +#define DE_CONTROL_COMMAND_DE_TILE 2 +#define DE_CONTROL_COMMAND_TRAPEZOID_FILL 3 +#define DE_CONTROL_COMMAND_ALPHA_BLEND 4 +#define DE_CONTROL_COMMAND_RLE_STRIP 5 +#define DE_CONTROL_COMMAND_SHORT_STROKE 6 +#define DE_CONTROL_COMMAND_LINE_DRAW 7 +#define DE_CONTROL_COMMAND_HOST_WRITE 8 +#define DE_CONTROL_COMMAND_HOST_READ 9 +#define DE_CONTROL_COMMAND_HOST_WRITE_BOTTOM_UP 10 +#define DE_CONTROL_COMMAND_ROTATE 11 +#define DE_CONTROL_COMMAND_FONT 12 +#define DE_CONTROL_COMMAND_TEXTURE_LOAD 15 +#define DE_CONTROL_ROP_SELECT 15:15 +#define DE_CONTROL_ROP_SELECT_ROP3 0 +#define DE_CONTROL_ROP_SELECT_ROP2 1 +#define DE_CONTROL_ROP2_SOURCE 14:14 +#define DE_CONTROL_ROP2_SOURCE_BITMAP 0 +#define DE_CONTROL_ROP2_SOURCE_PATTERN 1 +#define DE_CONTROL_MONO_DATA 13:12 +#define DE_CONTROL_MONO_DATA_NOT_PACKED 0 +#define DE_CONTROL_MONO_DATA_8_PACKED 1 +#define DE_CONTROL_MONO_DATA_16_PACKED 2 +#define DE_CONTROL_MONO_DATA_32_PACKED 3 +#define DE_CONTROL_REPEAT_ROTATE 11:11 +#define DE_CONTROL_REPEAT_ROTATE_DISABLE 0 +#define DE_CONTROL_REPEAT_ROTATE_ENABLE 1 +#define DE_CONTROL_TRANSPARENCY_MATCH 10:10 +#define DE_CONTROL_TRANSPARENCY_MATCH_OPAQUE 0 +#define DE_CONTROL_TRANSPARENCY_MATCH_TRANSPARENT 1 +#define DE_CONTROL_TRANSPARENCY_SELECT 9:9 +#define DE_CONTROL_TRANSPARENCY_SELECT_SOURCE 0 +#define DE_CONTROL_TRANSPARENCY_SELECT_DESTINATION 1 +#define DE_CONTROL_TRANSPARENCY 8:8 +#define DE_CONTROL_TRANSPARENCY_DISABLE 0 +#define DE_CONTROL_TRANSPARENCY_ENABLE 1 +#define DE_CONTROL_ROP 7:0 + +/* Pseudo fields. */ + +#define DE_CONTROL_SHORT_STROKE_DIR 27:24 +#define DE_CONTROL_SHORT_STROKE_DIR_225 0 +#define DE_CONTROL_SHORT_STROKE_DIR_135 1 +#define DE_CONTROL_SHORT_STROKE_DIR_315 2 +#define DE_CONTROL_SHORT_STROKE_DIR_45 3 +#define DE_CONTROL_SHORT_STROKE_DIR_270 4 +#define DE_CONTROL_SHORT_STROKE_DIR_90 5 +#define DE_CONTROL_SHORT_STROKE_DIR_180 8 +#define DE_CONTROL_SHORT_STROKE_DIR_0 10 +#define DE_CONTROL_ROTATION 25:24 +#define DE_CONTROL_ROTATION_0 0 +#define DE_CONTROL_ROTATION_270 1 +#define DE_CONTROL_ROTATION_90 2 +#define DE_CONTROL_ROTATION_180 3 + +#define DE_PITCH 0x100010 +#define DE_PITCH_DESTINATION 28:16 +#define DE_PITCH_SOURCE 12:0 + +#define DE_FOREGROUND 0x100014 +#define DE_FOREGROUND_COLOR 31:0 + +#define DE_BACKGROUND 0x100018 +#define DE_BACKGROUND_COLOR 31:0 + +#define DE_STRETCH_FORMAT 0x10001C +#define DE_STRETCH_FORMAT_PATTERN_XY 30:30 +#define DE_STRETCH_FORMAT_PATTERN_XY_NORMAL 0 +#define DE_STRETCH_FORMAT_PATTERN_XY_OVERWRITE 1 +#define DE_STRETCH_FORMAT_PATTERN_Y 29:27 +#define DE_STRETCH_FORMAT_PATTERN_X 25:23 +#define DE_STRETCH_FORMAT_PIXEL_FORMAT 21:20 +#define DE_STRETCH_FORMAT_PIXEL_FORMAT_8 0 +#define DE_STRETCH_FORMAT_PIXEL_FORMAT_16 1 +#define DE_STRETCH_FORMAT_PIXEL_FORMAT_32 2 +#define DE_STRETCH_FORMAT_ADDRESSING 19:16 +#define DE_STRETCH_FORMAT_ADDRESSING_XY 0 +#define DE_STRETCH_FORMAT_ADDRESSING_LINEAR 15 +#define DE_STRETCH_FORMAT_SOURCE_HEIGHT 11:0 + +#define DE_COLOR_COMPARE 0x100020 +#define DE_COLOR_COMPARE_COLOR 23:0 + +#define DE_COLOR_COMPARE_MASK 0x100024 +#define DE_COLOR_COMPARE_MASK_MASKS 23:0 + +#define DE_MASKS 0x100028 +#define DE_MASKS_BYTE_MASK 31:16 +#define DE_MASKS_BIT_MASK 15:0 + +#define DE_CLIP_TL 0x10002C +#define DE_CLIP_TL_TOP 31:16 +#define DE_CLIP_TL_STATUS 13:13 +#define DE_CLIP_TL_STATUS_DISABLE 0 +#define DE_CLIP_TL_STATUS_ENABLE 1 +#define DE_CLIP_TL_INHIBIT 12:12 +#define DE_CLIP_TL_INHIBIT_OUTSIDE 0 +#define DE_CLIP_TL_INHIBIT_INSIDE 1 +#define DE_CLIP_TL_LEFT 11:0 + +#define DE_CLIP_BR 0x100030 +#define DE_CLIP_BR_BOTTOM 31:16 +#define DE_CLIP_BR_RIGHT 12:0 + +#define DE_MONO_PATTERN_LOW 0x100034 +#define DE_MONO_PATTERN_LOW_PATTERN 31:0 + +#define DE_MONO_PATTERN_HIGH 0x100038 +#define DE_MONO_PATTERN_HIGH_PATTERN 31:0 + +#define DE_WINDOW_WIDTH 0x10003C +#define DE_WINDOW_WIDTH_DESTINATION 28:16 +#define DE_WINDOW_WIDTH_SOURCE 12:0 + +#define DE_WINDOW_SOURCE_BASE 0x100040 +#define DE_WINDOW_SOURCE_BASE_EXT 27:27 +#define DE_WINDOW_SOURCE_BASE_EXT_LOCAL 0 +#define DE_WINDOW_SOURCE_BASE_EXT_EXTERNAL 1 +#define DE_WINDOW_SOURCE_BASE_CS 26:26 +#define DE_WINDOW_SOURCE_BASE_CS_0 0 +#define DE_WINDOW_SOURCE_BASE_CS_1 1 +#define DE_WINDOW_SOURCE_BASE_ADDRESS 25:0 + +#define DE_WINDOW_DESTINATION_BASE 0x100044 +#define DE_WINDOW_DESTINATION_BASE_EXT 27:27 +#define DE_WINDOW_DESTINATION_BASE_EXT_LOCAL 0 +#define DE_WINDOW_DESTINATION_BASE_EXT_EXTERNAL 1 +#define DE_WINDOW_DESTINATION_BASE_CS 26:26 +#define DE_WINDOW_DESTINATION_BASE_CS_0 0 +#define DE_WINDOW_DESTINATION_BASE_CS_1 1 +#define DE_WINDOW_DESTINATION_BASE_ADDRESS 25:0 + +#define DE_ALPHA 0x100048 +#define DE_ALPHA_VALUE 7:0 + +#define DE_WRAP 0x10004C +#define DE_WRAP_X 31:16 +#define DE_WRAP_Y 15:0 + +#define DE_STATUS 0x100050 +#define DE_STATUS_CSC 1:1 +#define DE_STATUS_CSC_CLEAR 0 +#define DE_STATUS_CSC_NOT_ACTIVE 0 +#define DE_STATUS_CSC_ACTIVE 1 +#define DE_STATUS_2D 0:0 +#define DE_STATUS_2D_CLEAR 0 +#define DE_STATUS_2D_NOT_ACTIVE 0 +#define DE_STATUS_2D_ACTIVE 1 +#endif +/* Color Space Conversion registers. */ + +#define CSC_Y_SOURCE_BASE 0x1000C8 +#define CSC_Y_SOURCE_BASE_EXT 27:27 +#define CSC_Y_SOURCE_BASE_EXT_LOCAL 0 +#define CSC_Y_SOURCE_BASE_EXT_EXTERNAL 1 +#define CSC_Y_SOURCE_BASE_CS 26:26 +#define CSC_Y_SOURCE_BASE_CS_0 0 +#define CSC_Y_SOURCE_BASE_CS_1 1 +#define CSC_Y_SOURCE_BASE_ADDRESS 25:0 + +#define CSC_CONSTANTS 0x1000CC +#define CSC_CONSTANTS_Y 31:24 +#define CSC_CONSTANTS_R 23:16 +#define CSC_CONSTANTS_G 15:8 +#define CSC_CONSTANTS_B 7:0 + +#define CSC_Y_SOURCE_X 0x1000D0 +#define CSC_Y_SOURCE_X_INTEGER 26:16 +#define CSC_Y_SOURCE_X_FRACTION 15:3 + +#define CSC_Y_SOURCE_Y 0x1000D4 +#define CSC_Y_SOURCE_Y_INTEGER 27:16 +#define CSC_Y_SOURCE_Y_FRACTION 15:3 + +#define CSC_U_SOURCE_BASE 0x1000D8 +#define CSC_U_SOURCE_BASE_EXT 27:27 +#define CSC_U_SOURCE_BASE_EXT_LOCAL 0 +#define CSC_U_SOURCE_BASE_EXT_EXTERNAL 1 +#define CSC_U_SOURCE_BASE_CS 26:26 +#define CSC_U_SOURCE_BASE_CS_0 0 +#define CSC_U_SOURCE_BASE_CS_1 1 +#define CSC_U_SOURCE_BASE_ADDRESS 25:0 + +#define CSC_V_SOURCE_BASE 0x1000DC +#define CSC_V_SOURCE_BASE_EXT 27:27 +#define CSC_V_SOURCE_BASE_EXT_LOCAL 0 +#define CSC_V_SOURCE_BASE_EXT_EXTERNAL 1 +#define CSC_V_SOURCE_BASE_CS 26:26 +#define CSC_V_SOURCE_BASE_CS_0 0 +#define CSC_V_SOURCE_BASE_CS_1 1 +#define CSC_V_SOURCE_BASE_ADDRESS 25:0 + +#define CSC_SOURCE_DIMENSION 0x1000E0 +#define CSC_SOURCE_DIMENSION_X 31:16 +#define CSC_SOURCE_DIMENSION_Y 15:0 + +#define CSC_SOURCE_PITCH 0x1000E4 +#define CSC_SOURCE_PITCH_Y 31:16 +#define CSC_SOURCE_PITCH_UV 15:0 + +#define CSC_DESTINATION 0x1000E8 +#define CSC_DESTINATION_WRAP 31:31 +#define CSC_DESTINATION_WRAP_DISABLE 0 +#define CSC_DESTINATION_WRAP_ENABLE 1 +#define CSC_DESTINATION_X 27:16 +#define CSC_DESTINATION_Y 11:0 + +#define CSC_DESTINATION_DIMENSION 0x1000EC +#define CSC_DESTINATION_DIMENSION_X 31:16 +#define CSC_DESTINATION_DIMENSION_Y 15:0 + +#define CSC_DESTINATION_PITCH 0x1000F0 +#define CSC_DESTINATION_PITCH_X 31:16 +#define CSC_DESTINATION_PITCH_Y 15:0 + +#define CSC_SCALE_FACTOR 0x1000F4 +#define CSC_SCALE_FACTOR_HORIZONTAL 31:16 +#define CSC_SCALE_FACTOR_VERTICAL 15:0 + +#define CSC_DESTINATION_BASE 0x1000F8 +#define CSC_DESTINATION_BASE_EXT 27:27 +#define CSC_DESTINATION_BASE_EXT_LOCAL 0 +#define CSC_DESTINATION_BASE_EXT_EXTERNAL 1 +#define CSC_DESTINATION_BASE_CS 26:26 +#define CSC_DESTINATION_BASE_CS_0 0 +#define CSC_DESTINATION_BASE_CS_1 1 +#define CSC_DESTINATION_BASE_ADDRESS 25:0 + +#define CSC_CONTROL 0x1000FC +#define CSC_CONTROL_STATUS 31:31 +#define CSC_CONTROL_STATUS_STOP 0 +#define CSC_CONTROL_STATUS_START 1 +#define CSC_CONTROL_SOURCE_FORMAT 30:28 +#define CSC_CONTROL_SOURCE_FORMAT_YUV422 0 +#define CSC_CONTROL_SOURCE_FORMAT_YUV420I 1 +#define CSC_CONTROL_SOURCE_FORMAT_YUV420 2 +#define CSC_CONTROL_SOURCE_FORMAT_YVU9 3 +#define CSC_CONTROL_SOURCE_FORMAT_IYU1 4 +#define CSC_CONTROL_SOURCE_FORMAT_IYU2 5 +#define CSC_CONTROL_SOURCE_FORMAT_RGB565 6 +#define CSC_CONTROL_SOURCE_FORMAT_RGB8888 7 +#define CSC_CONTROL_DESTINATION_FORMAT 27:26 +#define CSC_CONTROL_DESTINATION_FORMAT_RGB565 0 +#define CSC_CONTROL_DESTINATION_FORMAT_RGB8888 1 +#define CSC_CONTROL_HORIZONTAL_FILTER 25:25 +#define CSC_CONTROL_HORIZONTAL_FILTER_DISABLE 0 +#define CSC_CONTROL_HORIZONTAL_FILTER_ENABLE 1 +#define CSC_CONTROL_VERTICAL_FILTER 24:24 +#define CSC_CONTROL_VERTICAL_FILTER_DISABLE 0 +#define CSC_CONTROL_VERTICAL_FILTER_ENABLE 1 +#define CSC_CONTROL_BYTE_ORDER 23:23 +#define CSC_CONTROL_BYTE_ORDER_YUYV 0 +#define CSC_CONTROL_BYTE_ORDER_UYVY 1 + +#define DE_DATA_PORT 0x110000 + +#define I2C_BYTE_COUNT 0x010040 +#define I2C_BYTE_COUNT_COUNT 3:0 + +#define I2C_CTRL 0x010041 +#define I2C_CTRL_INT 4:4 +#define I2C_CTRL_INT_DISABLE 0 +#define I2C_CTRL_INT_ENABLE 1 +#define I2C_CTRL_DIR 3:3 +#define I2C_CTRL_DIR_WR 0 +#define I2C_CTRL_DIR_RD 1 +#define I2C_CTRL_CTRL 2:2 +#define I2C_CTRL_CTRL_STOP 0 +#define I2C_CTRL_CTRL_START 1 +#define I2C_CTRL_MODE 1:1 +#define I2C_CTRL_MODE_STANDARD 0 +#define I2C_CTRL_MODE_FAST 1 +#define I2C_CTRL_EN 0:0 +#define I2C_CTRL_EN_DISABLE 0 +#define I2C_CTRL_EN_ENABLE 1 + +#define I2C_STATUS 0x010042 +#define I2C_STATUS_TX 3:3 +#define I2C_STATUS_TX_PROGRESS 0 +#define I2C_STATUS_TX_COMPLETED 1 +#define I2C_TX_DONE 0x08 +#define I2C_STATUS_ERR 2:2 +#define I2C_STATUS_ERR_NORMAL 0 +#define I2C_STATUS_ERR_ERROR 1 +#define I2C_STATUS_ERR_CLEAR 0 +#define I2C_STATUS_ACK 1:1 +#define I2C_STATUS_ACK_RECEIVED 0 +#define I2C_STATUS_ACK_NOT 1 +#define I2C_STATUS_BSY 0:0 +#define I2C_STATUS_BSY_IDLE 0 +#define I2C_STATUS_BSY_BUSY 1 + +#define I2C_RESET 0x010042 +#define I2C_RESET_BUS_ERROR 2:2 +#define I2C_RESET_BUS_ERROR_CLEAR 0 + +#define I2C_SLAVE_ADDRESS 0x010043 +#define I2C_SLAVE_ADDRESS_ADDRESS 7:1 +#define I2C_SLAVE_ADDRESS_RW 0:0 +#define I2C_SLAVE_ADDRESS_RW_W 0 +#define I2C_SLAVE_ADDRESS_RW_R 1 + +#define I2C_DATA0 0x010044 +#define I2C_DATA1 0x010045 +#define I2C_DATA2 0x010046 +#define I2C_DATA3 0x010047 +#define I2C_DATA4 0x010048 +#define I2C_DATA5 0x010049 +#define I2C_DATA6 0x01004A +#define I2C_DATA7 0x01004B +#define I2C_DATA8 0x01004C +#define I2C_DATA9 0x01004D +#define I2C_DATA10 0x01004E +#define I2C_DATA11 0x01004F +#define I2C_DATA12 0x010050 +#define I2C_DATA13 0x010051 +#define I2C_DATA14 0x010052 +#define I2C_DATA15 0x010053 + + +#define ZV0_CAPTURE_CTRL 0x090000 +#define ZV0_CAPTURE_CTRL_FIELD_INPUT 27:27 +#define ZV0_CAPTURE_CTRL_FIELD_INPUT_EVEN_FIELD 0 +#define ZV0_CAPTURE_CTRL_FIELD_INPUT_ODD_FIELD 1 +#define ZV0_CAPTURE_CTRL_SCAN 26:26 +#define ZV0_CAPTURE_CTRL_SCAN_PROGRESSIVE 0 +#define ZV0_CAPTURE_CTRL_SCAN_INTERLACE 1 +#define ZV0_CAPTURE_CTRL_CURRENT_BUFFER 25:25 +#define ZV0_CAPTURE_CTRL_CURRENT_BUFFER_0 0 +#define ZV0_CAPTURE_CTRL_CURRENT_BUFFER_1 1 +#define ZV0_CAPTURE_CTRL_VERTICAL_SYNC 24:24 +#define ZV0_CAPTURE_CTRL_VERTICAL_SYNC_INACTIVE 0 +#define ZV0_CAPTURE_CTRL_VERTICAL_SYNC_ACTIVE 1 +#define ZV0_CAPTURE_CTRL_ADJ 19:19 +#define ZV0_CAPTURE_CTRL_ADJ_NORMAL 0 +#define ZV0_CAPTURE_CTRL_ADJ_DELAY 1 +#define ZV0_CAPTURE_CTRL_HA 18:18 +#define ZV0_CAPTURE_CTRL_HA_DISABLE 0 +#define ZV0_CAPTURE_CTRL_HA_ENABLE 1 +#define ZV0_CAPTURE_CTRL_VSK 17:17 +#define ZV0_CAPTURE_CTRL_VSK_DISABLE 0 +#define ZV0_CAPTURE_CTRL_VSK_ENABLE 1 +#define ZV0_CAPTURE_CTRL_HSK 16:16 +#define ZV0_CAPTURE_CTRL_HSK_DISABLE 0 +#define ZV0_CAPTURE_CTRL_HSK_ENABLE 1 +#define ZV0_CAPTURE_CTRL_FD 15:15 +#define ZV0_CAPTURE_CTRL_FD_RISING 0 +#define ZV0_CAPTURE_CTRL_FD_FALLING 1 +#define ZV0_CAPTURE_CTRL_VP 14:14 +#define ZV0_CAPTURE_CTRL_VP_HIGH 0 +#define ZV0_CAPTURE_CTRL_VP_LOW 1 +#define ZV0_CAPTURE_CTRL_HP 13:13 +#define ZV0_CAPTURE_CTRL_HP_HIGH 0 +#define ZV0_CAPTURE_CTRL_HP_LOW 1 +#define ZV0_CAPTURE_CTRL_CP 12:12 +#define ZV0_CAPTURE_CTRL_CP_HIGH 0 +#define ZV0_CAPTURE_CTRL_CP_LOW 1 +#define ZV0_CAPTURE_CTRL_UVS 11:11 +#define ZV0_CAPTURE_CTRL_UVS_DISABLE 0 +#define ZV0_CAPTURE_CTRL_UVS_ENABLE 1 +#define ZV0_CAPTURE_CTRL_BS 10:10 +#define ZV0_CAPTURE_CTRL_BS_DISABLE 0 +#define ZV0_CAPTURE_CTRL_BS_ENABLE 1 +#define ZV0_CAPTURE_CTRL_CS 9:9 +#define ZV0_CAPTURE_CTRL_CS_16 0 +#define ZV0_CAPTURE_CTRL_CS_8 1 +#define ZV0_CAPTURE_CTRL_CF 8:8 +#define ZV0_CAPTURE_CTRL_CF_YUV 0 +#define ZV0_CAPTURE_CTRL_CF_RGB 1 +#define ZV0_CAPTURE_CTRL_FS 7:7 +#define ZV0_CAPTURE_CTRL_FS_DISABLE 0 +#define ZV0_CAPTURE_CTRL_FS_ENABLE 1 +#define ZV0_CAPTURE_CTRL_WEAVE 6:6 +#define ZV0_CAPTURE_CTRL_WEAVE_DISABLE 0 +#define ZV0_CAPTURE_CTRL_WEAVE_ENABLE 1 +#define ZV0_CAPTURE_CTRL_BOB 5:5 +#define ZV0_CAPTURE_CTRL_BOB_DISABLE 0 +#define ZV0_CAPTURE_CTRL_BOB_ENABLE 1 +#define ZV0_CAPTURE_CTRL_DB 4:4 +#define ZV0_CAPTURE_CTRL_DB_DISABLE 0 +#define ZV0_CAPTURE_CTRL_DB_ENABLE 1 +#define ZV0_CAPTURE_CTRL_CC 3:3 +#define ZV0_CAPTURE_CTRL_CC_CONTINUE 0 +#define ZV0_CAPTURE_CTRL_CC_CONDITION 1 +#define ZV0_CAPTURE_CTRL_RGB 2:2 +#define ZV0_CAPTURE_CTRL_RGB_DISABLE 0 +#define ZV0_CAPTURE_CTRL_RGB_ENABLE 1 +#define ZV0_CAPTURE_CTRL_656 1:1 +#define ZV0_CAPTURE_CTRL_656_DISABLE 0 +#define ZV0_CAPTURE_CTRL_656_ENABLE 1 +#define ZV0_CAPTURE_CTRL_CAP 0:0 +#define ZV0_CAPTURE_CTRL_CAP_DISABLE 0 +#define ZV0_CAPTURE_CTRL_CAP_ENABLE 1 + +#define ZV0_CAPTURE_CLIP 0x090004 +#define ZV0_CAPTURE_CLIP_YCLIP_EVEN_FIELD 25:16 +#define ZV0_CAPTURE_CLIP_YCLIP 25:16 +#define ZV0_CAPTURE_CLIP_XCLIP 9:0 + +#define ZV0_CAPTURE_SIZE 0x090008 +#define ZV0_CAPTURE_SIZE_HEIGHT 26:16 +#define ZV0_CAPTURE_SIZE_WIDTH 10:0 + +#define ZV0_CAPTURE_BUF0_ADDRESS 0x09000C +#define ZV0_CAPTURE_BUF0_ADDRESS_STATUS 31:31 +#define ZV0_CAPTURE_BUF0_ADDRESS_STATUS_CURRENT 0 +#define ZV0_CAPTURE_BUF0_ADDRESS_STATUS_PENDING 1 +#define ZV0_CAPTURE_BUF0_ADDRESS_EXT 27:27 +#define ZV0_CAPTURE_BUF0_ADDRESS_EXT_LOCAL 0 +#define ZV0_CAPTURE_BUF0_ADDRESS_EXT_EXTERNAL 1 +#define ZV0_CAPTURE_BUF0_ADDRESS_CS 26:26 +#define ZV0_CAPTURE_BUF0_ADDRESS_CS_0 0 +#define ZV0_CAPTURE_BUF0_ADDRESS_CS_1 1 +#define ZV0_CAPTURE_BUF0_ADDRESS_ADDRESS 25:0 + +#define ZV0_CAPTURE_BUF1_ADDRESS 0x090010 +#define ZV0_CAPTURE_BUF1_ADDRESS_STATUS 31:31 +#define ZV0_CAPTURE_BUF1_ADDRESS_STATUS_CURRENT 0 +#define ZV0_CAPTURE_BUF1_ADDRESS_STATUS_PENDING 1 +#define ZV0_CAPTURE_BUF1_ADDRESS_EXT 27:27 +#define ZV0_CAPTURE_BUF1_ADDRESS_EXT_LOCAL 0 +#define ZV0_CAPTURE_BUF1_ADDRESS_EXT_EXTERNAL 1 +#define ZV0_CAPTURE_BUF1_ADDRESS_CS 26:26 +#define ZV0_CAPTURE_BUF1_ADDRESS_CS_0 0 +#define ZV0_CAPTURE_BUF1_ADDRESS_CS_1 1 +#define ZV0_CAPTURE_BUF1_ADDRESS_ADDRESS 25:0 + +#define ZV0_CAPTURE_BUF_OFFSET 0x090014 +#ifndef VALIDATION_CHIP + #define ZV0_CAPTURE_BUF_OFFSET_YCLIP_ODD_FIELD 25:16 +#endif +#define ZV0_CAPTURE_BUF_OFFSET_OFFSET 15:0 + +#define ZV0_CAPTURE_FIFO_CTRL 0x090018 +#define ZV0_CAPTURE_FIFO_CTRL_FIFO 2:0 +#define ZV0_CAPTURE_FIFO_CTRL_FIFO_0 0 +#define ZV0_CAPTURE_FIFO_CTRL_FIFO_1 1 +#define ZV0_CAPTURE_FIFO_CTRL_FIFO_2 2 +#define ZV0_CAPTURE_FIFO_CTRL_FIFO_3 3 +#define ZV0_CAPTURE_FIFO_CTRL_FIFO_4 4 +#define ZV0_CAPTURE_FIFO_CTRL_FIFO_5 5 +#define ZV0_CAPTURE_FIFO_CTRL_FIFO_6 6 +#define ZV0_CAPTURE_FIFO_CTRL_FIFO_7 7 + +#define ZV0_CAPTURE_YRGB_CONST 0x09001C +#define ZV0_CAPTURE_YRGB_CONST_Y 31:24 +#define ZV0_CAPTURE_YRGB_CONST_R 23:16 +#define ZV0_CAPTURE_YRGB_CONST_G 15:8 +#define ZV0_CAPTURE_YRGB_CONST_B 7:0 + +#define ZV0_CAPTURE_LINE_COMP 0x090020 +#define ZV0_CAPTURE_LINE_COMP_LC 10:0 + +/* ZV1 */ + +#define ZV1_CAPTURE_CTRL 0x098000 +#define ZV1_CAPTURE_CTRL_FIELD_INPUT 27:27 +#define ZV1_CAPTURE_CTRL_FIELD_INPUT_EVEN_FIELD 0 +#define ZV1_CAPTURE_CTRL_FIELD_INPUT_ODD_FIELD 0 +#define ZV1_CAPTURE_CTRL_SCAN 26:26 +#define ZV1_CAPTURE_CTRL_SCAN_PROGRESSIVE 0 +#define ZV1_CAPTURE_CTRL_SCAN_INTERLACE 1 +#define ZV1_CAPTURE_CTRL_CURRENT_BUFFER 25:25 +#define ZV1_CAPTURE_CTRL_CURRENT_BUFFER_0 0 +#define ZV1_CAPTURE_CTRL_CURRENT_BUFFER_1 1 +#define ZV1_CAPTURE_CTRL_VERTICAL_SYNC 24:24 +#define ZV1_CAPTURE_CTRL_VERTICAL_SYNC_INACTIVE 0 +#define ZV1_CAPTURE_CTRL_VERTICAL_SYNC_ACTIVE 1 +#define ZV1_CAPTURE_CTRL_PANEL 20:20 +#define ZV1_CAPTURE_CTRL_PANEL_DISABLE 0 +#define ZV1_CAPTURE_CTRL_PANEL_ENABLE 1 +#define ZV1_CAPTURE_CTRL_ADJ 19:19 +#define ZV1_CAPTURE_CTRL_ADJ_NORMAL 0 +#define ZV1_CAPTURE_CTRL_ADJ_DELAY 1 +#define ZV1_CAPTURE_CTRL_HA 18:18 +#define ZV1_CAPTURE_CTRL_HA_DISABLE 0 +#define ZV1_CAPTURE_CTRL_HA_ENABLE 1 +#define ZV1_CAPTURE_CTRL_VSK 17:17 +#define ZV1_CAPTURE_CTRL_VSK_DISABLE 0 +#define ZV1_CAPTURE_CTRL_VSK_ENABLE 1 +#define ZV1_CAPTURE_CTRL_HSK 16:16 +#define ZV1_CAPTURE_CTRL_HSK_DISABLE 0 +#define ZV1_CAPTURE_CTRL_HSK_ENABLE 1 +#define ZV1_CAPTURE_CTRL_FD 15:15 +#define ZV1_CAPTURE_CTRL_FD_RISING 0 +#define ZV1_CAPTURE_CTRL_FD_FALLING 1 +#define ZV1_CAPTURE_CTRL_VP 14:14 +#define ZV1_CAPTURE_CTRL_VP_HIGH 0 +#define ZV1_CAPTURE_CTRL_VP_LOW 1 +#define ZV1_CAPTURE_CTRL_HP 13:13 +#define ZV1_CAPTURE_CTRL_HP_HIGH 0 +#define ZV1_CAPTURE_CTRL_HP_LOW 1 +#define ZV1_CAPTURE_CTRL_CP 12:12 +#define ZV1_CAPTURE_CTRL_CP_HIGH 0 +#define ZV1_CAPTURE_CTRL_CP_LOW 1 +#define ZV1_CAPTURE_CTRL_UVS 11:11 +#define ZV1_CAPTURE_CTRL_UVS_DISABLE 0 +#define ZV1_CAPTURE_CTRL_UVS_ENABLE 1 +#define ZV1_CAPTURE_CTRL_BS 10:10 +#define ZV1_CAPTURE_CTRL_BS_DISABLE 0 +#define ZV1_CAPTURE_CTRL_BS_ENABLE 1 +#define ZV1_CAPTURE_CTRL_CS 9:9 +#define ZV1_CAPTURE_CTRL_CS_16 0 +#define ZV1_CAPTURE_CTRL_CS_8 1 +#define ZV1_CAPTURE_CTRL_CF 8:8 +#define ZV1_CAPTURE_CTRL_CF_YUV 0 +#define ZV1_CAPTURE_CTRL_CF_RGB 1 +#define ZV1_CAPTURE_CTRL_FS 7:7 +#define ZV1_CAPTURE_CTRL_FS_DISABLE 0 +#define ZV1_CAPTURE_CTRL_FS_ENABLE 1 +#define ZV1_CAPTURE_CTRL_WEAVE 6:6 +#define ZV1_CAPTURE_CTRL_WEAVE_DISABLE 0 +#define ZV1_CAPTURE_CTRL_WEAVE_ENABLE 1 +#define ZV1_CAPTURE_CTRL_BOB 5:5 +#define ZV1_CAPTURE_CTRL_BOB_DISABLE 0 +#define ZV1_CAPTURE_CTRL_BOB_ENABLE 1 +#define ZV1_CAPTURE_CTRL_DB 4:4 +#define ZV1_CAPTURE_CTRL_DB_DISABLE 0 +#define ZV1_CAPTURE_CTRL_DB_ENABLE 1 +#define ZV1_CAPTURE_CTRL_CC 3:3 +#define ZV1_CAPTURE_CTRL_CC_CONTINUE 0 +#define ZV1_CAPTURE_CTRL_CC_CONDITION 1 +#define ZV1_CAPTURE_CTRL_RGB 2:2 +#define ZV1_CAPTURE_CTRL_RGB_DISABLE 0 +#define ZV1_CAPTURE_CTRL_RGB_ENABLE 1 +#define ZV1_CAPTURE_CTRL_656 1:1 +#define ZV1_CAPTURE_CTRL_656_DISABLE 0 +#define ZV1_CAPTURE_CTRL_656_ENABLE 1 +#define ZV1_CAPTURE_CTRL_CAP 0:0 +#define ZV1_CAPTURE_CTRL_CAP_DISABLE 0 +#define ZV1_CAPTURE_CTRL_CAP_ENABLE 1 + +#define ZV1_CAPTURE_CLIP 0x098004 +#define ZV1_CAPTURE_CLIP_YCLIP 25:16 +#define ZV1_CAPTURE_CLIP_XCLIP 9:0 + +#define ZV1_CAPTURE_SIZE 0x098008 +#define ZV1_CAPTURE_SIZE_HEIGHT 26:16 +#define ZV1_CAPTURE_SIZE_WIDTH 10:0 + +#define ZV1_CAPTURE_BUF0_ADDRESS 0x09800C +#define ZV1_CAPTURE_BUF0_ADDRESS_STATUS 31:31 +#define ZV1_CAPTURE_BUF0_ADDRESS_STATUS_CURRENT 0 +#define ZV1_CAPTURE_BUF0_ADDRESS_STATUS_PENDING 1 +#define ZV1_CAPTURE_BUF0_ADDRESS_EXT 27:27 +#define ZV1_CAPTURE_BUF0_ADDRESS_EXT_LOCAL 0 +#define ZV1_CAPTURE_BUF0_ADDRESS_EXT_EXTERNAL 1 +#define ZV1_CAPTURE_BUF0_ADDRESS_CS 26:26 +#define ZV1_CAPTURE_BUF0_ADDRESS_CS_0 0 +#define ZV1_CAPTURE_BUF0_ADDRESS_CS_1 1 +#define ZV1_CAPTURE_BUF0_ADDRESS_ADDRESS 25:0 + +#define ZV1_CAPTURE_BUF1_ADDRESS 0x098010 +#define ZV1_CAPTURE_BUF1_ADDRESS_STATUS 31:31 +#define ZV1_CAPTURE_BUF1_ADDRESS_STATUS_CURRENT 0 +#define ZV1_CAPTURE_BUF1_ADDRESS_STATUS_PENDING 1 +#define ZV1_CAPTURE_BUF1_ADDRESS_EXT 27:27 +#define ZV1_CAPTURE_BUF1_ADDRESS_EXT_LOCAL 0 +#define ZV1_CAPTURE_BUF1_ADDRESS_EXT_EXTERNAL 1 +#define ZV1_CAPTURE_BUF1_ADDRESS_CS 26:26 +#define ZV1_CAPTURE_BUF1_ADDRESS_CS_0 0 +#define ZV1_CAPTURE_BUF1_ADDRESS_CS_1 1 +#define ZV1_CAPTURE_BUF1_ADDRESS_ADDRESS 25:0 + +#define ZV1_CAPTURE_BUF_OFFSET 0x098014 +#define ZV1_CAPTURE_BUF_OFFSET_OFFSET 15:0 + +#define ZV1_CAPTURE_FIFO_CTRL 0x098018 +#define ZV1_CAPTURE_FIFO_CTRL_FIFO 2:0 +#define ZV1_CAPTURE_FIFO_CTRL_FIFO_0 0 +#define ZV1_CAPTURE_FIFO_CTRL_FIFO_1 1 +#define ZV1_CAPTURE_FIFO_CTRL_FIFO_2 2 +#define ZV1_CAPTURE_FIFO_CTRL_FIFO_3 3 +#define ZV1_CAPTURE_FIFO_CTRL_FIFO_4 4 +#define ZV1_CAPTURE_FIFO_CTRL_FIFO_5 5 +#define ZV1_CAPTURE_FIFO_CTRL_FIFO_6 6 +#define ZV1_CAPTURE_FIFO_CTRL_FIFO_7 7 + +#define ZV1_CAPTURE_YRGB_CONST 0x09801C +#define ZV1_CAPTURE_YRGB_CONST_Y 31:24 +#define ZV1_CAPTURE_YRGB_CONST_R 23:16 +#define ZV1_CAPTURE_YRGB_CONST_G 15:8 +#define ZV1_CAPTURE_YRGB_CONST_B 7:0 + +#define DMA_1_SOURCE 0x0D0010 +#define DMA_1_SOURCE_ADDRESS_EXT 27:27 +#define DMA_1_SOURCE_ADDRESS_EXT_LOCAL 0 +#define DMA_1_SOURCE_ADDRESS_EXT_EXTERNAL 1 +#define DMA_1_SOURCE_ADDRESS_CS 26:26 +#define DMA_1_SOURCE_ADDRESS_CS_0 0 +#define DMA_1_SOURCE_ADDRESS_CS_1 1 +#define DMA_1_SOURCE_ADDRESS 25:0 + +#define DMA_1_DESTINATION 0x0D0014 +#define DMA_1_DESTINATION_ADDRESS_EXT 27:27 +#define DMA_1_DESTINATION_ADDRESS_EXT_LOCAL 0 +#define DMA_1_DESTINATION_ADDRESS_EXT_EXTERNAL 1 +#define DMA_1_DESTINATION_ADDRESS_CS 26:26 +#define DMA_1_DESTINATION_ADDRESS_CS_0 0 +#define DMA_1_DESTINATION_ADDRESS_CS_1 1 +#define DMA_1_DESTINATION_ADDRESS 25:0 + +#define DMA_1_SIZE_CONTROL 0x0D0018 +#define DMA_1_SIZE_CONTROL_STATUS 31:31 +#define DMA_1_SIZE_CONTROL_STATUS_IDLE 0 +#define DMA_1_SIZE_CONTROL_STATUS_ACTIVE 1 +#define DMA_1_SIZE_CONTROL_SIZE 23:0 + +#define DMA_ABORT_INTERRUPT 0x0D0020 +#define DMA_ABORT_INTERRUPT_ABORT_1 5:5 +#define DMA_ABORT_INTERRUPT_ABORT_1_ENABLE 0 +#define DMA_ABORT_INTERRUPT_ABORT_1_ABORT 1 +#define DMA_ABORT_INTERRUPT_ABORT_0 4:4 +#define DMA_ABORT_INTERRUPT_ABORT_0_ENABLE 0 +#define DMA_ABORT_INTERRUPT_ABORT_0_ABORT 1 +#define DMA_ABORT_INTERRUPT_INT_1 1:1 +#define DMA_ABORT_INTERRUPT_INT_1_CLEAR 0 +#define DMA_ABORT_INTERRUPT_INT_1_FINISHED 1 +#define DMA_ABORT_INTERRUPT_INT_0 0:0 +#define DMA_ABORT_INTERRUPT_INT_0_CLEAR 0 +#define DMA_ABORT_INTERRUPT_INT_0_FINISHED 1 + + + + + +/* Default i2c CLK and Data GPIO. These are the default i2c pins */ +#define DEFAULT_I2C_SCL 30 +#define DEFAULT_I2C_SDA 31 + + +#define GPIO_DATA_SM750LE 0x020018 +#define GPIO_DATA_SM750LE_1 1:1 +#define GPIO_DATA_SM750LE_0 0:0 + +#define GPIO_DATA_DIRECTION_SM750LE 0x02001C +#define GPIO_DATA_DIRECTION_SM750LE_1 1:1 +#define GPIO_DATA_DIRECTION_SM750LE_1_INPUT 0 +#define GPIO_DATA_DIRECTION_SM750LE_1_OUTPUT 1 +#define GPIO_DATA_DIRECTION_SM750LE_0 0:0 +#define GPIO_DATA_DIRECTION_SM750LE_0_INPUT 0 +#define GPIO_DATA_DIRECTION_SM750LE_0_OUTPUT 1 + + +#endif diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c new file mode 100644 index 000000000000..faf825093e7f --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -0,0 +1,425 @@ +#define USE_DVICHIP +#ifdef USE_DVICHIP + +#include "ddk750_sii164.h" +#include "ddk750_hwi2c.h" + +/* I2C Address of each SII164 chip */ +#define SII164_I2C_ADDRESS 0x70 + +/* Define this definition to use hardware i2c. */ +#define USE_HW_I2C + +#ifdef USE_HW_I2C + #define i2cWriteReg hwI2CWriteReg + #define i2cReadReg hwI2CReadReg +#else + #define i2cWriteReg swI2CWriteReg + #define i2cReadReg swI2CReadReg +#endif + +/* SII164 Vendor and Device ID */ +#define SII164_VENDOR_ID 0x0001 +#define SII164_DEVICE_ID 0x0006 + +#ifdef SII164_FULL_FUNCTIONS +/* Name of the DVI Controller chip */ +static char *gDviCtrlChipName = "Silicon Image SiI 164"; +#endif + +/* + * sii164GetVendorID + * This function gets the vendor ID of the DVI controller chip. + * + * Output: + * Vendor ID + */ +unsigned short sii164GetVendorID() +{ + unsigned short vendorID; + + vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) | + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW); + + return vendorID; +} + +/* + * sii164GetDeviceID + * This function gets the device ID of the DVI controller chip. + * + * Output: + * Device ID + */ +unsigned short sii164GetDeviceID() +{ + unsigned short deviceID; + + deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) | + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW); + + return deviceID; +} + + + +/* DVI.C will handle all SiI164 chip stuffs and try it best to make code minimal and useful */ + +/* + * sii164InitChip + * This function initialize and detect the DVI controller chip. + * + * Input: + * edgeSelect - Edge Select: + * 0 = Input data is falling edge latched (falling edge + * latched first in dual edge mode) + * 1 = Input data is rising edge latched (rising edge + * latched first in dual edge mode) + * busSelect - Input Bus Select: + * 0 = Input data bus is 12-bits wide + * 1 = Input data bus is 24-bits wide + * dualEdgeClkSelect - Dual Edge Clock Select + * 0 = Input data is single edge latched + * 1 = Input data is dual edge latched + * hsyncEnable - Horizontal Sync Enable: + * 0 = HSYNC input is transmitted as fixed LOW + * 1 = HSYNC input is transmitted as is + * vsyncEnable - Vertical Sync Enable: + * 0 = VSYNC input is transmitted as fixed LOW + * 1 = VSYNC input is transmitted as is + * deskewEnable - De-skewing Enable: + * 0 = De-skew disabled + * 1 = De-skew enabled + * deskewSetting - De-skewing Setting (increment of 260psec) + * 0 = 1 step --> minimum setup / maximum hold + * 1 = 2 step + * 2 = 3 step + * 3 = 4 step + * 4 = 5 step + * 5 = 6 step + * 6 = 7 step + * 7 = 8 step --> maximum setup / minimum hold + * continuousSyncEnable- SYNC Continuous: + * 0 = Disable + * 1 = Enable + * pllFilterEnable - PLL Filter Enable + * 0 = Disable PLL Filter + * 1 = Enable PLL Filter + * pllFilterValue - PLL Filter characteristics: + * 0~7 (recommended value is 4) + * + * Output: + * 0 - Success + * -1 - Fail. + */ +long sii164InitChip( + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue +) +{ + //unsigned char ucRegIndex, ucRegValue; + //unsigned char ucDeviceAddress, + unsigned char config; + //unsigned long delayCount; + + /* Initialize the i2c bus */ +#ifdef USE_HW_I2C + /* Use fast mode. */ + hwI2CInit(1); +#else + swI2CInit(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA); +#endif + + /* Check if SII164 Chip exists */ + if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) + { + +#ifdef DDKDEBUG + //sii164PrintRegisterValues(); +#endif + /* + * Initialize SII164 controller chip. + */ + + /* Select the edge */ + if (edgeSelect == 0) + config = SII164_CONFIGURATION_LATCH_FALLING; + else + config = SII164_CONFIGURATION_LATCH_RISING; + + /* Select bus wide */ + if (busSelect == 0) + config |= SII164_CONFIGURATION_BUS_12BITS; + else + config |= SII164_CONFIGURATION_BUS_24BITS; + + /* Select Dual/Single Edge Clock */ + if (dualEdgeClkSelect == 0) + config |= SII164_CONFIGURATION_CLOCK_SINGLE; + else + config |= SII164_CONFIGURATION_CLOCK_DUAL; + + /* Select HSync Enable */ + if (hsyncEnable == 0) + config |= SII164_CONFIGURATION_HSYNC_FORCE_LOW; + else + config |= SII164_CONFIGURATION_HSYNC_AS_IS; + + /* Select VSync Enable */ + if (vsyncEnable == 0) + config |= SII164_CONFIGURATION_VSYNC_FORCE_LOW; + else + config |= SII164_CONFIGURATION_VSYNC_AS_IS; + + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + + /* De-skew enabled with default 111b value. + This will fix some artifacts problem in some mode on board 2.2. + Somehow this fix does not affect board 2.1. + */ + if (deskewEnable == 0) + config = SII164_DESKEW_DISABLE; + else + config = SII164_DESKEW_ENABLE; + + switch (deskewSetting) + { + case 0: + config |= SII164_DESKEW_1_STEP; + break; + case 1: + config |= SII164_DESKEW_2_STEP; + break; + case 2: + config |= SII164_DESKEW_3_STEP; + break; + case 3: + config |= SII164_DESKEW_4_STEP; + break; + case 4: + config |= SII164_DESKEW_5_STEP; + break; + case 5: + config |= SII164_DESKEW_6_STEP; + break; + case 6: + config |= SII164_DESKEW_7_STEP; + break; + case 7: + config |= SII164_DESKEW_8_STEP; + break; + } + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config); + + /* Enable/Disable Continuous Sync. */ + if (continuousSyncEnable == 0) + config = SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE; + else + config = SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE; + + /* Enable/Disable PLL Filter */ + if (pllFilterEnable == 0) + config |= SII164_PLL_FILTER_DISABLE; + else + config |= SII164_PLL_FILTER_ENABLE; + + /* Set the PLL Filter value */ + config |= ((pllFilterValue & 0x07) << 1); + + i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config); + + /* Recover from Power Down and enable output. */ + config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + config |= SII164_CONFIGURATION_POWER_NORMAL; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + +#ifdef DDKDEBUG + //sii164PrintRegisterValues(); +#endif + + return 0; + } + + /* Return -1 if initialization fails. */ + return (-1); +} + + + + + +/* below sii164 function is not neccessary */ + +#ifdef SII164_FULL_FUNCTIONS + +/* + * sii164ResetChip + * This function resets the DVI Controller Chip. + */ +void sii164ResetChip() +{ + /* Power down */ + sii164SetPower(0); + sii164SetPower(1); +} + + +/* + * sii164GetChipString + * This function returns a char string name of the current DVI Controller chip. + * It's convenient for application need to display the chip name. + */ +char *sii164GetChipString() +{ + return gDviCtrlChipName; +} + + +/* + * sii164SetPower + * This function sets the power configuration of the DVI Controller Chip. + * + * Input: + * powerUp - Flag to set the power down or up + */ +void sii164SetPower( + unsigned char powerUp +) +{ + unsigned char config; + + config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + if (powerUp == 1) + { + /* Power up the chip */ + config &= ~SII164_CONFIGURATION_POWER_MASK; + config |= SII164_CONFIGURATION_POWER_NORMAL; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + } + else + { + /* Power down the chip */ + config &= ~SII164_CONFIGURATION_POWER_MASK; + config |= SII164_CONFIGURATION_POWER_DOWN; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + } +} + + +/* + * sii164SelectHotPlugDetectionMode + * This function selects the mode of the hot plug detection. + */ +static void sii164SelectHotPlugDetectionMode( + sii164_hot_plug_mode_t hotPlugMode +) +{ + unsigned char detectReg; + + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; + switch (hotPlugMode) + { + case SII164_HOTPLUG_DISABLE: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; + break; + case SII164_HOTPLUG_USE_MDI: + detectReg &= ~SII164_DETECT_INTERRUPT_MASK; + detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; + break; + case SII164_HOTPLUG_USE_RSEN: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; + break; + case SII164_HOTPLUG_USE_HTPLG: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; + break; + } + + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg); +} + +/* + * sii164EnableHotPlugDetection + * This function enables the Hot Plug detection. + * + * enableHotPlug - Enable (=1) / disable (=0) Hot Plug detection + */ +void sii164EnableHotPlugDetection( + unsigned char enableHotPlug +) +{ + unsigned char detectReg; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); + + /* Depending on each DVI controller, need to enable the hot plug based on each + individual chip design. */ + if (enableHotPlug != 0) + sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI); + else + sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE); +} + +/* + * sii164IsConnected + * Check if the DVI Monitor is connected. + * + * Output: + * 0 - Not Connected + * 1 - Connected + */ +unsigned char sii164IsConnected() +{ + unsigned char hotPlugValue; + + hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_HOT_PLUG_STATUS_MASK; + if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON) + return 1; + else + return 0; +} + +/* + * sii164CheckInterrupt + * Checks if interrupt has occured. + * + * Output: + * 0 - No interrupt + * 1 - Interrupt occurs + */ +unsigned char sii164CheckInterrupt() +{ + unsigned char detectReg; + + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_MONITOR_STATE_MASK; + if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE) + return 1; + else + return 0; +} + +/* + * sii164ClearInterrupt + * Clear the hot plug interrupt. + */ +void sii164ClearInterrupt() +{ + unsigned char detectReg; + + /* Clear the MDI interrupt */ + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg | SII164_DETECT_MONITOR_STATE_CLEAR); +} + +#endif + +#endif + + diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h new file mode 100644 index 000000000000..2b4c7d3381df --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_sii164.h @@ -0,0 +1,172 @@ +#ifndef DDK750_SII164_H__ +#define DDK750_SII164_H__ + +#define USE_DVICHIP + +/* Hot Plug detection mode structure */ +typedef enum _sii164_hot_plug_mode_t +{ + SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ + SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ + SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ + SII164_HOTPLUG_USE_HTPLG /* Use Hot Plug detect bit. */ +} sii164_hot_plug_mode_t; + + +/* Silicon Image SiI164 chip prototype */ +long sii164InitChip( + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue +); + +unsigned short sii164GetVendorID(void); +unsigned short sii164GetDeviceID(void); + + +#ifdef SII164_FULL_FUNCTIONS +void sii164ResetChip(void); +char *sii164GetChipString(void); +void sii164SetPower(unsigned char powerUp); +void sii164EnableHotPlugDetection(unsigned char enableHotPlug); +unsigned char sii164IsConnected(void); +unsigned char sii164CheckInterrupt(void); +void sii164ClearInterrupt(void); +#endif +/* below register definination is used for Silicon Image SiI164 DVI controller chip */ +/* + * Vendor ID registers + */ +#define SII164_VENDOR_ID_LOW 0x00 +#define SII164_VENDOR_ID_HIGH 0x01 + +/* + * Device ID registers + */ +#define SII164_DEVICE_ID_LOW 0x02 +#define SII164_DEVICE_ID_HIGH 0x03 + +/* + * Device Revision + */ +#define SII164_DEVICE_REVISION 0x04 + +/* + * Frequency Limitation registers + */ +#define SII164_FREQUENCY_LIMIT_LOW 0x06 +#define SII164_FREQUENCY_LIMIT_HIGH 0x07 + +/* + * Power Down and Input Signal Configuration registers + */ +#define SII164_CONFIGURATION 0x08 + +/* Power down (PD) */ +#define SII164_CONFIGURATION_POWER_DOWN 0x00 +#define SII164_CONFIGURATION_POWER_NORMAL 0x01 +#define SII164_CONFIGURATION_POWER_MASK 0x01 + +/* Input Edge Latch Select (EDGE) */ +#define SII164_CONFIGURATION_LATCH_FALLING 0x00 +#define SII164_CONFIGURATION_LATCH_RISING 0x02 + +/* Bus Select (BSEL) */ +#define SII164_CONFIGURATION_BUS_12BITS 0x00 +#define SII164_CONFIGURATION_BUS_24BITS 0x04 + +/* Dual Edge Clock Select (DSEL) */ +#define SII164_CONFIGURATION_CLOCK_SINGLE 0x00 +#define SII164_CONFIGURATION_CLOCK_DUAL 0x08 + +/* Horizontal Sync Enable (HEN) */ +#define SII164_CONFIGURATION_HSYNC_FORCE_LOW 0x00 +#define SII164_CONFIGURATION_HSYNC_AS_IS 0x10 + +/* Vertical Sync Enable (VEN) */ +#define SII164_CONFIGURATION_VSYNC_FORCE_LOW 0x00 +#define SII164_CONFIGURATION_VSYNC_AS_IS 0x20 + +/* + * Detection registers + */ +#define SII164_DETECT 0x09 + +/* Monitor Detect Interrupt (MDI) */ +#define SII164_DETECT_MONITOR_STATE_CHANGE 0x00 +#define SII164_DETECT_MONITOR_STATE_NO_CHANGE 0x01 +#define SII164_DETECT_MONITOR_STATE_CLEAR 0x01 +#define SII164_DETECT_MONITOR_STATE_MASK 0x01 + +/* Hot Plug detect Input (HTPLG) */ +#define SII164_DETECT_HOT_PLUG_STATUS_OFF 0x00 +#define SII164_DETECT_HOT_PLUG_STATUS_ON 0x02 +#define SII164_DETECT_HOT_PLUG_STATUS_MASK 0x02 + +/* Receiver Sense (RSEN) */ +#define SII164_DETECT_RECEIVER_SENSE_NOT_DETECTED 0x00 +#define SII164_DETECT_RECEIVER_SENSE_DETECTED 0x04 + +/* Interrupt Generation Method (TSEL) */ +#define SII164_DETECT_INTERRUPT_BY_RSEN_PIN 0x00 +#define SII164_DETECT_INTERRUPT_BY_HTPLG_PIN 0x08 +#define SII164_DETECT_INTERRUPT_MASK 0x08 + +/* Monitor Sense Output (MSEN) */ +#define SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH 0x00 +#define SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI 0x10 +#define SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN 0x20 +#define SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG 0x30 +#define SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG 0x30 + +/* + * Skewing registers + */ +#define SII164_DESKEW 0x0A + +/* General Purpose Input (CTL[3:1]) */ +#define SII164_DESKEW_GENERAL_PURPOSE_INPUT_MASK 0x0E + +/* De-skewing Enable bit (DKEN) */ +#define SII164_DESKEW_DISABLE 0x00 +#define SII164_DESKEW_ENABLE 0x10 + +/* De-skewing Setting (DK[3:1])*/ +#define SII164_DESKEW_1_STEP 0x00 +#define SII164_DESKEW_2_STEP 0x20 +#define SII164_DESKEW_3_STEP 0x40 +#define SII164_DESKEW_4_STEP 0x60 +#define SII164_DESKEW_5_STEP 0x80 +#define SII164_DESKEW_6_STEP 0xA0 +#define SII164_DESKEW_7_STEP 0xC0 +#define SII164_DESKEW_8_STEP 0xE0 + +/* + * User Configuration Data registers (CFG 7:0) + */ +#define SII164_USER_CONFIGURATION 0x0B + +/* + * PLL registers + */ +#define SII164_PLL 0x0C + +/* PLL Filter Value (PLLF) */ +#define SII164_PLL_FILTER_VALUE_MASK 0x0E + +/* PLL Filter Enable (PFEN) */ +#define SII164_PLL_FILTER_DISABLE 0x00 +#define SII164_PLL_FILTER_ENABLE 0x01 + +/* Sync Continuous (SCNT) */ +#define SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE 0x00 +#define SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE 0x80 + +#endif diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c new file mode 100644 index 000000000000..b53407bb2042 --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_swi2c.c @@ -0,0 +1,535 @@ +/******************************************************************* +* +* Copyright (c) 2007 by Silicon Motion, Inc. (SMI) +* +* All rights are reserved. Reproduction or in part is prohibited +* without the written consent of the copyright owner. +* +* swi2c.c --- SM750/SM718 DDK +* This file contains the source code for I2C using software +* implementation. +* +*******************************************************************/ +#include "ddk750_help.h" +#include "ddk750_reg.h" +#include "ddk750_swi2c.h" +#include "ddk750_power.h" + + +/******************************************************************* + * I2C Software Master Driver: + * =========================== + * Each i2c cycle is split into 4 sections. Each of these section marks + * a point in time where the SCL or SDA may be changed. + * + * 1 Cycle == | Section I. | Section 2. | Section 3. | Section 4. | + * +-------------+-------------+-------------+-------------+ + * | SCL set LOW |SCL no change| SCL set HIGH|SCL no change| + * + * ____________ _____________ + * SCL == XXXX _____________ ____________ / + * + * I.e. the SCL may only be changed in section 1. and section 3. while + * the SDA may only be changed in section 2. and section 4. The table + * below gives the changes for these 2 lines in the varios sections. + * + * Section changes Table: + * ====================== + * blank = no change, L = set bit LOW, H = set bit HIGH + * + * | 1.| 2.| 3.| 4.| + * ---------------+---+---+---+---+ + * Tx Start SDA | | H | | L | + * SCL | L | | H | | + * ---------------+---+---+---+---+ + * Tx Stop SDA | | L | | H | + * SCL | L | | H | | + * ---------------+---+---+---+---+ + * Tx bit H SDA | | H | | | + * SCL | L | | H | | + * ---------------+---+---+---+---+ + * Tx bit L SDA | | L | | | + * SCL | L | | H | | + * ---------------+---+---+---+---+ + * + ******************************************************************/ + +/* GPIO pins used for this I2C. It ranges from 0 to 63. */ +static unsigned char g_i2cClockGPIO = DEFAULT_I2C_SCL; +static unsigned char g_i2cDataGPIO = DEFAULT_I2C_SDA; + +/* + * Below is the variable declaration for the GPIO pin register usage + * for the i2c Clock and i2c Data. + * + * Note: + * Notice that the GPIO usage for the i2c clock and i2c Data are + * separated. This is to make this code flexible enough when + * two separate GPIO pins for the clock and data are located + * in two different GPIO register set (worst case). + */ + +/* i2c Clock GPIO Register usage */ +static unsigned long g_i2cClkGPIOMuxReg = GPIO_MUX; +static unsigned long g_i2cClkGPIODataReg = GPIO_DATA; +static unsigned long g_i2cClkGPIODataDirReg = GPIO_DATA_DIRECTION; + +/* i2c Data GPIO Register usage */ +static unsigned long g_i2cDataGPIOMuxReg = GPIO_MUX; +static unsigned long g_i2cDataGPIODataReg = GPIO_DATA; +static unsigned long g_i2cDataGPIODataDirReg = GPIO_DATA_DIRECTION; + +static unsigned char peekIO(unsigned short port,unsigned short index) +{ +#if defined(__i386__) || defined( __x86_64__) + outb_p(index,port); + return inb_p(port+1); +#endif +} + +/* + * This function puts a delay between command + */ +static void swI2CWait(void) +{ + /* find a bug: + * peekIO method works well before suspend/resume + * but after suspend, peekIO(0x3ce,0x61) & 0x10 + * always be non-zero,which makes the while loop + * never finish. + * use non-ultimate for loop below is safe + * */ +#if 0 + /* Change wait algorithm to use PCI bus clock, + it's more reliable than counter loop .. + write 0x61 to 0x3ce and read from 0x3cf + */ + while(peekIO(0x3ce,0x61) & 0x10); +#else + int i, Temp; + + for(i=0; i<600; i++) + { + Temp = i; + Temp += i; + } +#endif +} + +/* + * This function set/reset the SCL GPIO pin + * + * Parameters: + * value - Bit value to set to the SCL or SDA (0 = low, 1 = high) + * + * Notes: + * When setting SCL to high, just set the GPIO as input where the pull up + * resistor will pull the signal up. Do not use software to pull up the + * signal because the i2c will fail when other device try to drive the + * signal due to SM50x will drive the signal to always high. + */ +void swI2CSCL(unsigned char value) +{ + unsigned long ulGPIOData; + unsigned long ulGPIODirection; + + ulGPIODirection = PEEK32(g_i2cClkGPIODataDirReg); + if (value) /* High */ + { + /* Set direction as input. This will automatically pull the signal up. */ + ulGPIODirection &= ~(1 << g_i2cClockGPIO); + POKE32(g_i2cClkGPIODataDirReg, ulGPIODirection); + } + else /* Low */ + { + /* Set the signal down */ + ulGPIOData = PEEK32(g_i2cClkGPIODataReg); + ulGPIOData &= ~(1 << g_i2cClockGPIO); + POKE32(g_i2cClkGPIODataReg, ulGPIOData); + + /* Set direction as output */ + ulGPIODirection |= (1 << g_i2cClockGPIO); + POKE32(g_i2cClkGPIODataDirReg, ulGPIODirection); + } +} + +/* + * This function set/reset the SDA GPIO pin + * + * Parameters: + * value - Bit value to set to the SCL or SDA (0 = low, 1 = high) + * + * Notes: + * When setting SCL to high, just set the GPIO as input where the pull up + * resistor will pull the signal up. Do not use software to pull up the + * signal because the i2c will fail when other device try to drive the + * signal due to SM50x will drive the signal to always high. + */ +void swI2CSDA(unsigned char value) +{ + unsigned long ulGPIOData; + unsigned long ulGPIODirection; + + ulGPIODirection = PEEK32(g_i2cDataGPIODataDirReg); + if (value) /* High */ + { + /* Set direction as input. This will automatically pull the signal up. */ + ulGPIODirection &= ~(1 << g_i2cDataGPIO); + POKE32(g_i2cDataGPIODataDirReg, ulGPIODirection); + } + else /* Low */ + { + /* Set the signal down */ + ulGPIOData = PEEK32(g_i2cDataGPIODataReg); + ulGPIOData &= ~(1 << g_i2cDataGPIO); + POKE32(g_i2cDataGPIODataReg, ulGPIOData); + + /* Set direction as output */ + ulGPIODirection |= (1 << g_i2cDataGPIO); + POKE32(g_i2cDataGPIODataDirReg, ulGPIODirection); + } +} + +/* + * This function read the data from the SDA GPIO pin + * + * Return Value: + * The SDA data bit sent by the Slave + */ +static unsigned char swI2CReadSDA(void) +{ + unsigned long ulGPIODirection; + unsigned long ulGPIOData; + + /* Make sure that the direction is input (High) */ + ulGPIODirection = PEEK32(g_i2cDataGPIODataDirReg); + if ((ulGPIODirection & (1 << g_i2cDataGPIO)) != (~(1 << g_i2cDataGPIO))) + { + ulGPIODirection &= ~(1 << g_i2cDataGPIO); + POKE32(g_i2cDataGPIODataDirReg, ulGPIODirection); + } + + /* Now read the SDA line */ + ulGPIOData = PEEK32(g_i2cDataGPIODataReg); + if (ulGPIOData & (1 << g_i2cDataGPIO)) + return 1; + else + return 0; +} + +#pragma optimize( "", off ) + +/* + * This function sends ACK signal + */ +static void swI2CAck(void) +{ + return; /* Single byte read is ok without it. */ +} + +/* + * This function sends the start command to the slave device + */ +void swI2CStart(void) +{ + /* Start I2C */ + swI2CSDA(1); + swI2CSCL(1); + swI2CSDA(0); +} + +/* + * This function sends the stop command to the slave device + */ +void swI2CStop(void) +{ + /* Stop the I2C */ + swI2CSCL(1); + swI2CSDA(0); + swI2CSDA(1); +} + +/* + * This function writes one byte to the slave device + * + * Parameters: + * data - Data to be write to the slave device + * + * Return Value: + * 0 - Success + * -1 - Fail to write byte + */ +long swI2CWriteByte(unsigned char data) +{ + unsigned char value = data; + int i; + + /* Sending the data bit by bit */ + for (i=0; i<8; i++) + { + /* Set SCL to low */ + swI2CSCL(0); + + /* Send data bit */ + if ((value & 0x80) != 0) + swI2CSDA(1); + else + swI2CSDA(0); + + swI2CWait(); + + /* Toggle clk line to one */ + swI2CSCL(1); + swI2CWait(); + + /* Shift byte to be sent */ + value = value << 1; + } + + /* Set the SCL Low and SDA High (prepare to get input) */ + swI2CSCL(0); + swI2CSDA(1); + + /* Set the SCL High for ack */ + swI2CWait(); + swI2CSCL(1); + swI2CWait(); + + /* Read SDA, until SDA==0 */ + for(i=0; i<0xff; i++) + { + if (!swI2CReadSDA()) + break; + + swI2CSCL(0); + swI2CWait(); + swI2CSCL(1); + swI2CWait(); + } + + /* Set the SCL Low and SDA High */ + swI2CSCL(0); + swI2CSDA(1); + + if (i<0xff) + return 0; + else + return (-1); +} + +/* + * This function reads one byte from the slave device + * + * Parameters: + * ack - Flag to indicate either to send the acknowledge + * message to the slave device or not + * + * Return Value: + * One byte data read from the Slave device + */ +unsigned char swI2CReadByte(unsigned char ack) +{ + int i; + unsigned char data = 0; + + for(i=7; i>=0; i--) + { + /* Set the SCL to Low and SDA to High (Input) */ + swI2CSCL(0); + swI2CSDA(1); + swI2CWait(); + + /* Set the SCL High */ + swI2CSCL(1); + swI2CWait(); + + /* Read data bits from SDA */ + data |= (swI2CReadSDA() << i); + } + + if (ack) + swI2CAck(); + + /* Set the SCL Low and SDA High */ + swI2CSCL(0); + swI2CSDA(1); + + return data; +} +#pragma optimize( "", on ) + +/* + * This function initializes GPIO port for SW I2C communication. + * + * Parameters: + * i2cClkGPIO - The GPIO pin to be used as i2c SCL + * i2cDataGPIO - The GPIO pin to be used as i2c SDA + * + * Return Value: + * -1 - Fail to initialize the i2c + * 0 - Success + */ +long swI2CInit_SM750LE( + unsigned char i2cClkGPIO, + unsigned char i2cDataGPIO +) +{ + int i; + + /* Initialize the GPIO pin for the i2c Clock Register */ + g_i2cClkGPIODataReg = GPIO_DATA_SM750LE; + g_i2cClkGPIODataDirReg = GPIO_DATA_DIRECTION_SM750LE; + + /* Initialize the Clock GPIO Offset */ + g_i2cClockGPIO = i2cClkGPIO; + + /* Initialize the GPIO pin for the i2c Data Register */ + g_i2cDataGPIODataReg = GPIO_DATA_SM750LE; + g_i2cDataGPIODataDirReg = GPIO_DATA_DIRECTION_SM750LE; + + /* Initialize the Data GPIO Offset */ + g_i2cDataGPIO = i2cDataGPIO; + + /* Note that SM750LE don't have GPIO MUX and power is always on */ + + /* Clear the i2c lines. */ + for(i=0; i<9; i++) + swI2CStop(); + + return 0; +} + +/* + * This function initializes the i2c attributes and bus + * + * Parameters: + * i2cClkGPIO - The GPIO pin to be used as i2c SCL + * i2cDataGPIO - The GPIO pin to be used as i2c SDA + * + * Return Value: + * -1 - Fail to initialize the i2c + * 0 - Success + */ +long swI2CInit( + unsigned char i2cClkGPIO, + unsigned char i2cDataGPIO +) +{ + int i; + + /* Return 0 if the GPIO pins to be used is out of range. The range is only from [0..63] */ + if ((i2cClkGPIO > 31) || (i2cDataGPIO > 31)) + return (-1); + + if (getChipType() == SM750LE) + return( swI2CInit_SM750LE(i2cClkGPIO, i2cDataGPIO) ); + + /* Initialize the GPIO pin for the i2c Clock Register */ + g_i2cClkGPIOMuxReg = GPIO_MUX; + g_i2cClkGPIODataReg = GPIO_DATA; + g_i2cClkGPIODataDirReg = GPIO_DATA_DIRECTION; + + /* Initialize the Clock GPIO Offset */ + g_i2cClockGPIO = i2cClkGPIO; + + /* Initialize the GPIO pin for the i2c Data Register */ + g_i2cDataGPIOMuxReg = GPIO_MUX; + g_i2cDataGPIODataReg = GPIO_DATA; + g_i2cDataGPIODataDirReg = GPIO_DATA_DIRECTION; + + /* Initialize the Data GPIO Offset */ + g_i2cDataGPIO = i2cDataGPIO; + + /* Enable the GPIO pins for the i2c Clock and Data (GPIO MUX) */ + POKE32(g_i2cClkGPIOMuxReg, + PEEK32(g_i2cClkGPIOMuxReg) & ~(1 << g_i2cClockGPIO)); + POKE32(g_i2cDataGPIOMuxReg, + PEEK32(g_i2cDataGPIOMuxReg) & ~(1 << g_i2cDataGPIO)); + + /* Enable GPIO power */ + enableGPIO(1); + + /* Clear the i2c lines. */ + for(i=0; i<9; i++) + swI2CStop(); + + return 0; +} + +/* + * This function reads the slave device's register + * + * Parameters: + * deviceAddress - i2c Slave device address which register + * to be read from + * registerIndex - Slave device's register to be read + * + * Return Value: + * Register value + */ +unsigned char swI2CReadReg( + unsigned char deviceAddress, + unsigned char registerIndex +) +{ + unsigned char data; + + /* Send the Start signal */ + swI2CStart(); + + /* Send the device address */ + swI2CWriteByte(deviceAddress); + + /* Send the register index */ + swI2CWriteByte(registerIndex); + + /* Get the bus again and get the data from the device read address */ + swI2CStart(); + swI2CWriteByte(deviceAddress + 1); + data = swI2CReadByte(1); + + /* Stop swI2C and release the bus */ + swI2CStop(); + + return data; +} + +/* + * This function writes a value to the slave device's register + * + * Parameters: + * deviceAddress - i2c Slave device address which register + * to be written + * registerIndex - Slave device's register to be written + * data - Data to be written to the register + * + * Result: + * 0 - Success + * -1 - Fail + */ +long swI2CWriteReg( + unsigned char deviceAddress, + unsigned char registerIndex, + unsigned char data +) +{ + long returnValue = 0; + + /* Send the Start signal */ + swI2CStart(); + + /* Send the device address and read the data. All should return success + in order for the writing processed to be successful + */ + if ((swI2CWriteByte(deviceAddress) != 0) || + (swI2CWriteByte(registerIndex) != 0) || + (swI2CWriteByte(data) != 0)) + { + returnValue = -1; + } + + /* Stop i2c and release the bus */ + swI2CStop(); + + return returnValue; +} diff --git a/drivers/staging/sm750fb/ddk750_swi2c.h b/drivers/staging/sm750fb/ddk750_swi2c.h new file mode 100644 index 000000000000..ec5463b98ddf --- /dev/null +++ b/drivers/staging/sm750fb/ddk750_swi2c.h @@ -0,0 +1,92 @@ +/******************************************************************* +* +* Copyright (c) 2007 by Silicon Motion, Inc. (SMI) +* +* All rights are reserved. Reproduction or in part is prohibited +* without the written consent of the copyright owner. +* +* swi2c.h --- SM750/SM718 DDK +* This file contains the definitions for i2c using software +* implementation. +* +*******************************************************************/ +#ifndef _SWI2C_H_ +#define _SWI2C_H_ + +/* Default i2c CLK and Data GPIO. These are the default i2c pins */ +#define DEFAULT_I2C_SCL 30 +#define DEFAULT_I2C_SDA 31 + +/* + * This function initializes the i2c attributes and bus + * + * Parameters: + * i2cClkGPIO - The GPIO pin to be used as i2c SCL + * i2cDataGPIO - The GPIO pin to be used as i2c SDA + * + * Return Value: + * -1 - Fail to initialize the i2c + * 0 - Success + */ +long swI2CInit( + unsigned char i2cClkGPIO, + unsigned char i2cDataGPIO +); + +/* + * This function reads the slave device's register + * + * Parameters: + * deviceAddress - i2c Slave device address which register + * to be read from + * registerIndex - Slave device's register to be read + * + * Return Value: + * Register value + */ +unsigned char swI2CReadReg( + unsigned char deviceAddress, + unsigned char registerIndex +); + +/* + * This function writes a value to the slave device's register + * + * Parameters: + * deviceAddress - i2c Slave device address which register + * to be written + * registerIndex - Slave device's register to be written + * data - Data to be written to the register + * + * Result: + * 0 - Success + * -1 - Fail + */ +long swI2CWriteReg( + unsigned char deviceAddress, + unsigned char registerIndex, + unsigned char data +); + +/* + * These two functions are used to toggle the data on the SCL and SDA I2C lines. + * The used of these two functions are not recommended unless it is necessary. + */ + +/* + * This function set/reset the SCL GPIO pin + * + * Parameters: + * value - Bit value to set to the SCL or SDA (0 = low, 1 = high) + */ +void swI2CSCL(unsigned char value); + +/* + * This function set/reset the SDA GPIO pin + * + * Parameters: + * value - Bit value to set to the SCL or SDA (0 = low, 1 = high) + */ +void swI2CSDA(unsigned char value); + +#endif /* _SWI2C_H_ */ diff --git a/drivers/staging/sm750fb/modedb.h b/drivers/staging/sm750fb/modedb.h new file mode 100644 index 000000000000..c5275c6fffaf --- /dev/null +++ b/drivers/staging/sm750fb/modedb.h @@ -0,0 +1,221 @@ + +static const struct fb_videomode modedb2[] = { + { + /* 640x400 @ 70 Hz, 31.5 kHz hsync */ + NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2, + 0, FB_VMODE_NONINTERLACED + }, { + /* 640x480 @ 60 Hz, 31.5 kHz hsync */ + NULL, 60, 640, 480, 39721, 40, 24, 32, 11, 96, 2, + 0, FB_VMODE_NONINTERLACED + }, { + /* 800x600 @ 56 Hz, 35.15 kHz hsync */ + NULL, 56, 800, 600, 27777, 128, 24, 22, 1, 72, 2, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync */ + NULL, 87, 1024, 768, 22271, 56, 24, 33, 8, 160, 8, + 0, FB_VMODE_INTERLACED + }, { + /* 640x400 @ 85 Hz, 37.86 kHz hsync */ + NULL, 85, 640, 400, 31746, 96, 32, 41, 1, 64, 3, + FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 640x480 @ 72 Hz, 36.5 kHz hsync */ + NULL, 72, 640, 480, 31746, 144, 40, 30, 8, 40, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 640x480 @ 75 Hz, 37.50 kHz hsync */ + NULL, 75, 640, 480, 31746, 120, 16, 16, 1, 64, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 800x600 @ 60 Hz, 37.8 kHz hsync */ + NULL, 60, 800, 600, 25000, 88, 40, 23, 1, 128, 4, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 640x480 @ 85 Hz, 43.27 kHz hsync */ + NULL, 85, 640, 480, 27777, 80, 56, 25, 1, 56, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1152x864 @ 89 Hz interlaced, 44 kHz hsync */ + NULL, 69, 1152, 864, 15384, 96, 16, 110, 1, 216, 10, + 0, FB_VMODE_INTERLACED + }, { + /* 800x600 @ 72 Hz, 48.0 kHz hsync */ + NULL, 72, 800, 600, 20000, 64, 56, 23, 37, 120, 6, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 1024x768 @ 60 Hz, 48.4 kHz hsync */ + NULL, 60, 1024, 768, 15384, 168, 8, 29, 3, 144, 6, + 0, FB_VMODE_NONINTERLACED + }, { + /* 640x480 @ 100 Hz, 53.01 kHz hsync */ + NULL, 100, 640, 480, 21834, 96, 32, 36, 8, 96, 6, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1152x864 @ 60 Hz, 53.5 kHz hsync */ + NULL, 60, 1152, 864, 11123, 208, 64, 16, 4, 256, 8, + 0, FB_VMODE_NONINTERLACED + }, { + /* 800x600 @ 85 Hz, 55.84 kHz hsync */ + NULL, 85, 800, 600, 16460, 160, 64, 36, 16, 64, 5, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1024x768 @ 70 Hz, 56.5 kHz hsync */ + NULL, 70, 1024, 768, 13333, 144, 24, 29, 3, 136, 6, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1280x960-60 VESA */ + NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA + }, { + /* 1280x1024-60 VESA */ + NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA + }, { + /* 1280x1024 @ 87 Hz interlaced, 51 kHz hsync */ + NULL, 87, 1280, 1024, 12500, 56, 16, 128, 1, 216, 12, + 0, FB_VMODE_INTERLACED + }, { + /* 800x600 @ 100 Hz, 64.02 kHz hsync */ + NULL, 100, 800, 600, 14357, 160, 64, 30, 4, 64, 6, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1024x768 @ 76 Hz, 62.5 kHz hsync */ + NULL, 76, 1024, 768, 11764, 208, 8, 36, 16, 120, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1152x864 @ 70 Hz, 62.4 kHz hsync */ + NULL, 70, 1152, 864, 10869, 106, 56, 20, 1, 160, 10, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1280x1024 @ 61 Hz, 64.2 kHz hsync */ + NULL, 61, 1280, 1024, 9090, 200, 48, 26, 1, 184, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1400x1050 @ 60Hz, 63.9 kHz hsync */ + NULL, 68, 1400, 1050, 9259, 136, 40, 13, 1, 112, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1400x1050 @ 75,107 Hz, 82,392 kHz +hsync +vsync*/ + NULL, 75, 1400, 1050, 9271, 120, 56, 13, 0, 112, 3, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 1400x1050 @ 60 Hz, ? kHz +hsync +vsync*/ + NULL, 60, 1400, 1050, 9259, 128, 40, 12, 0, 112, 3, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 1024x768 @ 85 Hz, 70.24 kHz hsync */ + NULL, 85, 1024, 768, 10111, 192, 32, 34, 14, 160, 6, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1152x864 @ 78 Hz, 70.8 kHz hsync */ + NULL, 78, 1152, 864, 9090, 228, 88, 32, 0, 84, 12, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1280x1024 @ 70 Hz, 74.59 kHz hsync */ + NULL, 70, 1280, 1024, 7905, 224, 32, 28, 8, 160, 8, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1600x1200 @ 60Hz, 75.00 kHz hsync */ + NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 1152x864 @ 84 Hz, 76.0 kHz hsync */ + NULL, 84, 1152, 864, 7407, 184, 312, 32, 0, 128, 12, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1280x1024 @ 74 Hz, 78.85 kHz hsync */ + NULL, 74, 1280, 1024, 7407, 256, 32, 34, 3, 144, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1024x768 @ 100Hz, 80.21 kHz hsync */ + NULL, 100, 1024, 768, 8658, 192, 32, 21, 3, 192, 10, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1280x1024 @ 76 Hz, 81.13 kHz hsync */ + NULL, 76, 1280, 1024, 7407, 248, 32, 34, 3, 104, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1600x1200 @ 70 Hz, 87.50 kHz hsync */ + NULL, 70, 1600, 1200, 5291, 304, 64, 46, 1, 192, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1152x864 @ 100 Hz, 89.62 kHz hsync */ + NULL, 100, 1152, 864, 7264, 224, 32, 17, 2, 128, 19, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1280x1024 @ 85 Hz, 91.15 kHz hsync */ + NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 1600x1200 @ 75 Hz, 93.75 kHz hsync */ + NULL, 75, 1600, 1200, 4938, 304, 64, 46, 1, 192, 3, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 1600x1200 @ 85 Hz, 105.77 kHz hsync */ + NULL, 85, 1600, 1200, 4545, 272, 16, 37, 4, 192, 3, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 1280x1024 @ 100 Hz, 107.16 kHz hsync */ + NULL, 100, 1280, 1024, 5502, 256, 32, 26, 7, 128, 15, + 0, FB_VMODE_NONINTERLACED + }, { + /* 1800x1440 @ 64Hz, 96.15 kHz hsync */ + NULL, 64, 1800, 1440, 4347, 304, 96, 46, 1, 192, 3, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 1800x1440 @ 70Hz, 104.52 kHz hsync */ + NULL, 70, 1800, 1440, 4000, 304, 96, 46, 1, 192, 3, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 512x384 @ 78 Hz, 31.50 kHz hsync */ + NULL, 78, 512, 384, 49603, 48, 16, 16, 1, 64, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 512x384 @ 85 Hz, 34.38 kHz hsync */ + NULL, 85, 512, 384, 45454, 48, 16, 16, 1, 64, 3, + 0, FB_VMODE_NONINTERLACED + }, { + /* 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio */ + NULL, 70, 320, 200, 79440, 16, 16, 20, 4, 48, 1, + 0, FB_VMODE_DOUBLE + }, { + /* 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio */ + NULL, 60, 320, 240, 79440, 16, 16, 16, 5, 48, 1, + 0, FB_VMODE_DOUBLE + }, { + /* 320x240 @ 72 Hz, 36.5 kHz hsync */ + NULL, 72, 320, 240, 63492, 16, 16, 16, 4, 48, 2, + 0, FB_VMODE_DOUBLE + }, { + /* 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio */ + NULL, 56, 400, 300, 55555, 64, 16, 10, 1, 32, 1, + 0, FB_VMODE_DOUBLE + }, { + /* 400x300 @ 60 Hz, 37.8 kHz hsync */ + NULL, 60, 400, 300, 50000, 48, 16, 11, 1, 64, 2, + 0, FB_VMODE_DOUBLE + }, { + /* 400x300 @ 72 Hz, 48.0 kHz hsync */ + NULL, 72, 400, 300, 40000, 32, 24, 11, 19, 64, 3, + 0, FB_VMODE_DOUBLE + }, { + /* 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio */ + NULL, 56, 480, 300, 46176, 80, 16, 10, 1, 40, 1, + 0, FB_VMODE_DOUBLE + }, { + /* 480x300 @ 60 Hz, 37.8 kHz hsync */ + NULL, 60, 480, 300, 41858, 56, 16, 11, 1, 80, 2, + 0, FB_VMODE_DOUBLE + }, { + /* 480x300 @ 63 Hz, 39.6 kHz hsync */ + NULL, 63, 480, 300, 40000, 56, 16, 11, 1, 80, 2, + 0, FB_VMODE_DOUBLE + }, { + /* 480x300 @ 72 Hz, 48.0 kHz hsync */ + NULL, 72, 480, 300, 33386, 40, 24, 11, 19, 80, 3, + 0, FB_VMODE_DOUBLE + }, +}; +static const int nmodedb2 = sizeof(modedb2); diff --git a/drivers/staging/sm750fb/readme b/drivers/staging/sm750fb/readme new file mode 100644 index 000000000000..ab9af791653d --- /dev/null +++ b/drivers/staging/sm750fb/readme @@ -0,0 +1,38 @@ +Introduction: + SM750 of Silicon MOtion is pci express display controller device. + The SM750 embedded graphics features include: + - dual display + - 2D acceleration + - 16MB integrated video memory + +About the kernel module paramter of driver: + + Use 1280,8bpp index color and 60 hz mode: + insmod ./sm750fb.ko g_option="1280x1024-8@60" + + Disable MTRR,Disable 2d acceleration,Disable hardware cursor, + and use a 800x600 mode : + insmod ./sm750fb.ko g_option="noaccel:nomtrr:nohwc:800x600" + + dual frame buffer for driver with "dual" parameter + insmod ./sm750fb.ko g_option="dual,800x600:1024x768" + it will create fb0 and fb1 (or fb1,fb2 if fb0 already exist) under /dev + and user can use con2fb to link fbX and ttyX + + Notes: + 1) if you build the driver with built-in method, the paramter + you edited in the grub config file will be also the + same format as above modular method,but additionaly add + "video=sm750fb:" + ahead of parameters,so,it looks like: + video=sm750fb:noaccel,1280x1024@60,otherparam,etc... + it equal to modular method with below command: + insmod ./sm750fb.ko g_option="noaccel:1280x1024@60:otherparm:etc..." + + 2) if you put 800x600 into the paramter without bpp and + refresh rate, kernel driver will defaulty use 16bpp and 60hz + +Important: + if you have vesafb enabled in your config then /dev/fb0 will be created by vesafb + and this driver will use fb1, fb2. In that case, you need to configure your X-server + to use fb1. Another simple althernative is to disable vesafb from your config. diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c new file mode 100644 index 000000000000..520c69e3ab74 --- /dev/null +++ b/drivers/staging/sm750fb/sm750.c @@ -0,0 +1,1451 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_MTRR +#include +#endif +#include +#include "sm750.h" +#include "sm750_hw.h" +#include "sm750_accel.h" +#include "sm750_cursor.h" + +#include "modedb.h" + +int smi_indent = 0; + + +/* +#ifdef __BIG_ENDIAN +ssize_t lynxfb_ops_write(struct fb_info *info, const char __user *buf, + size_t count, loff_t *ppos); +ssize_t lynxfb_ops_read(struct fb_info *info, char __user *buf, + size_t count, loff_t *ppos); +#endif + */ + +typedef void (*PROC_SPEC_SETUP)(struct lynx_share*,char *); +typedef int (*PROC_SPEC_MAP)(struct lynx_share*,struct pci_dev*); +typedef int (*PROC_SPEC_INITHW)(struct lynx_share*,struct pci_dev*); + + +/* common var for all device */ +static int g_hwcursor = 1; +static int g_noaccel = 0; +#ifdef CONFIG_MTRR +static int g_nomtrr = 0; +#endif +static const char * g_fbmode[] = {NULL,NULL}; +static const char * g_def_fbmode = "800x600-16@60"; +static char * g_settings = NULL; +static int g_dualview = 0; +#ifdef MODULE +static char * g_option = NULL; +#endif + +/* if not use spin_lock,system will die if user load driver + * and immediatly unload driver frequently (dual)*/ +static inline void myspin_lock(spinlock_t * sl){ + struct lynx_share * share; + share = container_of(sl,struct lynx_share,slock); + if(share->dual){ + spin_lock(sl); + } +} + +static inline void myspin_unlock(spinlock_t * sl){ + struct lynx_share * share; + share = container_of(sl,struct lynx_share,slock); + if(share->dual){ + spin_unlock(sl); + } +} +static const struct fb_videomode lynx750_ext[] = { + /* 1024x600-60 VESA [1.71:1] */ + {NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + + /* 1024x600-70 VESA */ + {NULL, 70, 1024, 600, 17211, 152, 48, 21, 1, 104, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + + /* 1024x600-75 VESA */ + {NULL, 75, 1024, 600, 15822, 160, 56, 23, 1, 104, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + + /* 1024x600-85 VESA */ + {NULL, 85, 1024, 600, 13730, 168, 56, 26, 1, 112, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + + /* 720x480 */ + {NULL, 60, 720, 480, 37427, 88, 16, 13, 1, 72, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + + /* 1280x720 [1.78:1] */ + {NULL, 60, 1280, 720, 13426, 162, 86, 22, 1, 136, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + + /* 1280x768@60 */ + {NULL,60,1280,768,12579,192,64,20,3,128,7, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + + {NULL,60,1360,768,11804,208,64,23,1,144,3, + FB_SYNC_HOR_HIGH_ACT|FB_VMODE_NONINTERLACED}, + + /* 1360 x 768 [1.77083:1] */ + {NULL, 60, 1360, 768, 11804, 208, 64, 23, 1, 144, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + + /* 1368 x 768 [1.78:1] */ + {NULL, 60, 1368, 768, 11647, 216, 72, 23, 1, 144, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + + /* 1440 x 900 [16:10] */ + {NULL, 60, 1440, 900, 9392, 232, 80, 28, 1, 152, 3, + FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + + /* 1440x960 [15:10] */ + {NULL, 60, 1440, 960, 8733, 240, 88, 30, 1, 152, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + + /* 1920x1080 [16:9] */ + {NULL, 60, 1920, 1080, 6734, 148, 88, 41, 1, 44, 3, + FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, +}; + + + + +/* no hardware cursor supported under version 2.6.10, kernel bug */ +static int lynxfb_ops_cursor(struct fb_info* info,struct fb_cursor* fbcursor) +{ + struct lynxfb_par * par; + struct lynxfb_crtc * crtc; + struct lynx_cursor * cursor; + + par = info->par; + crtc = &par->crtc; + cursor = &crtc->cursor; + + if(fbcursor->image.width > cursor->maxW || + fbcursor->image.height > cursor->maxH || + fbcursor->image.depth > 1){ + return -ENXIO; + } + + cursor->disable(cursor); + if(fbcursor->set & FB_CUR_SETSIZE){ + cursor->setSize(cursor,fbcursor->image.width,fbcursor->image.height); + } + + if(fbcursor->set & FB_CUR_SETPOS){ + cursor->setPos(cursor,fbcursor->image.dx - info->var.xoffset, + fbcursor->image.dy - info->var.yoffset); + } + + if(fbcursor->set & FB_CUR_SETCMAP){ + /* get the 16bit color of kernel means */ + u16 fg,bg; + fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800))| + ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5)| + ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11); + + bg = ((info->cmap.red[fbcursor->image.bg_color] & 0xf800))| + ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5)| + ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11); + + cursor->setColor(cursor,fg,bg); + } + + + if(fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) + { + cursor->setData(cursor, + fbcursor->rop, + fbcursor->image.data, + fbcursor->mask); + } + + if(fbcursor->enable){ + cursor->enable(cursor); + } + + return 0; +} + +static void lynxfb_ops_fillrect(struct fb_info* info,const struct fb_fillrect* region) +{ + struct lynxfb_par * par; + struct lynx_share * share; + unsigned int base,pitch,Bpp,rop; + u32 color; + + if(info->state != FBINFO_STATE_RUNNING){ + return; + } + + par = info->par; + share = par->share; + + /* each time 2d function begin to work,below three variable always need + * be set, seems we can put them together in some place */ + base = par->crtc.oScreen; + pitch = info->fix.line_length; + Bpp = info->var.bits_per_pixel >> 3; + + color = (Bpp == 1)?region->color:((u32*)info->pseudo_palette)[region->color]; + rop = ( region->rop != ROP_COPY ) ? HW_ROP2_XOR:HW_ROP2_COPY; + + myspin_lock(&share->slock); + share->accel.de_fillrect(&share->accel, + base,pitch,Bpp, + region->dx,region->dy, + region->width,region->height, + color,rop); + myspin_unlock(&share->slock); +} + +static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea * region) +{ + struct lynxfb_par * par; + struct lynx_share * share; + unsigned int base,pitch,Bpp; + + par = info->par; + share = par->share; + + /* each time 2d function begin to work,below three variable always need + * be set, seems we can put them together in some place */ + base = par->crtc.oScreen; + pitch = info->fix.line_length; + Bpp = info->var.bits_per_pixel >> 3; + + myspin_lock(&share->slock); + share->accel.de_copyarea(&share->accel, + base,pitch,region->sx,region->sy, + base,pitch,Bpp,region->dx,region->dy, + region->width,region->height,HW_ROP2_COPY); + myspin_unlock(&share->slock); +} + +static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* image) +{ + unsigned int base,pitch,Bpp; + unsigned int fgcol,bgcol; + struct lynxfb_par * par; + struct lynx_share * share; + + par = info->par; + share = par->share; + /* each time 2d function begin to work,below three variable always need + * be set, seems we can put them together in some place */ + base = par->crtc.oScreen; + pitch = info->fix.line_length; + Bpp = info->var.bits_per_pixel >> 3; + + if(image->depth == 1){ + if(info->fix.visual == FB_VISUAL_TRUECOLOR || + info->fix.visual == FB_VISUAL_DIRECTCOLOR) + { + fgcol = ((u32*)info->pseudo_palette)[image->fg_color]; + bgcol = ((u32*)info->pseudo_palette)[image->bg_color]; + } + else + { + fgcol = image->fg_color; + bgcol = image->bg_color; + } + goto _do_work; + } + return; +_do_work: + myspin_lock(&share->slock); + share->accel.de_imageblit(&share->accel, + image->data,image->width>>3,0, + base,pitch,Bpp, + image->dx,image->dy, + image->width,image->height, + fgcol,bgcol,HW_ROP2_COPY); + myspin_unlock(&share->slock); +} + +static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, + struct fb_info *info) +{ + struct lynxfb_par * par; + struct lynxfb_crtc * crtc; + int ret; + + + if(!info) + return -EINVAL; + + ret = 0; + par = info->par; + crtc = &par->crtc; + ret = crtc->proc_panDisplay(crtc, var, info); + + return ret; +} + + + + +#ifdef CONFIG_PM +static int lynxfb_suspend(struct pci_dev * pdev,pm_message_t mesg) +{ + struct fb_info * info; + struct lynx_share * share; + int ret; + + + if(mesg.event == pdev->dev.power.power_state.event) + return 0; + + ret = 0; + share = pci_get_drvdata(pdev); + switch (mesg.event) { + case PM_EVENT_FREEZE: + case PM_EVENT_PRETHAW: + pdev->dev.power.power_state = mesg; + return 0; + } + + console_lock(); + if (mesg.event & PM_EVENT_SLEEP) { + info = share->fbinfo[0]; + if(info) + fb_set_suspend(info, 1);/* 1 means do suspend*/ + + info = share->fbinfo[1]; + if(info) + fb_set_suspend(info, 1);/* 1 means do suspend*/ + + ret = pci_save_state(pdev); + if(ret){ + pr_err("error:%d occured in pci_save_state\n",ret); + return ret; + } + + /* set chip to sleep mode */ + if(share->suspend) + (*share->suspend)(share); + + pci_disable_device(pdev); + ret = pci_set_power_state(pdev,pci_choose_state(pdev,mesg)); + if(ret){ + pr_err("error:%d occured in pci_set_power_state\n",ret); + return ret; + } + } + + pdev->dev.power.power_state = mesg; + console_unlock(); + return ret; +} + +static int lynxfb_ops_set_par(struct fb_info * info) +{ + struct lynxfb_par * par; + struct lynx_share * share; + struct lynxfb_crtc * crtc; + struct lynxfb_output * output; + struct fb_var_screeninfo * var; + struct fb_fix_screeninfo * fix; + int ret; + unsigned int line_length; + + + if(!info) + return -EINVAL; + + ret = 0; + par = info->par; + share = par->share; + crtc = &par->crtc; + output = &par->output; + var = &info->var; + fix = &info->fix; + + /* fix structur is not so FIX ... */ + line_length = var->xres_virtual * var->bits_per_pixel / 8; + line_length = PADDING(crtc->line_pad,line_length); + fix->line_length = line_length; + pr_err("fix->line_length = %d\n",fix->line_length); + + /* var->red,green,blue,transp are need to be set by driver + * and these data should be set before setcolreg routine + * */ + + switch(var->bits_per_pixel){ + case 8: + fix->visual = FB_VISUAL_PSEUDOCOLOR; + var->red.offset = 0; + var->red.length = 8; + var->green.offset = 0; + var->green.length = 8; + var->blue.offset = 0; + var->blue.length = 8; + var->transp.length = 0; + var->transp.offset = 0; + break; + case 16: + var->red.offset = 11; + var->red.length = 5; + var->green.offset = 5; + var->green.length = 6; + var->blue.offset = 0; + var->blue.length = 5; + var->transp.length = 0; + var->transp.offset = 0; + fix->visual = FB_VISUAL_TRUECOLOR; + break; + case 24: + case 32: + var->red.offset = 16; + var->red.length = 8; + var->green.offset = 8; + var->green.length = 8; + var->blue.offset = 0 ; + var->blue.length = 8; + fix->visual = FB_VISUAL_TRUECOLOR; + break; + default: + ret = -EINVAL; + break; + } + var->height = var->width = -1; + var->accel_flags = 0;/*FB_ACCELF_TEXT;*/ + + if(ret){ + pr_err("pixel bpp format not satisfied\n."); + return ret; + } + ret = crtc->proc_setMode(crtc,var,fix); + if(!ret) + ret = output->proc_setMode(output,var,fix); + return ret; +} +static inline unsigned int chan_to_field(unsigned int chan,struct fb_bitfield * bf) +{ + chan &= 0xffff; + chan >>= 16 - bf->length; + return chan << bf->offset; +} + + +static int lynxfb_resume(struct pci_dev* pdev) +{ + struct fb_info * info; + struct lynx_share * share; + + struct lynxfb_par * par; + struct lynxfb_crtc * crtc; + struct lynx_cursor * cursor; + + int ret; + + + ret = 0; + share = pci_get_drvdata(pdev); + + console_lock(); + + if((ret = pci_set_power_state(pdev, PCI_D0)) != 0){ + pr_err("error:%d occured in pci_set_power_state\n",ret); + return ret; + } + + + if(pdev->dev.power.power_state.event != PM_EVENT_FREEZE){ + pci_restore_state(pdev); + if ((ret = pci_enable_device(pdev)) != 0){ + pr_err("error:%d occured in pci_enable_device\n",ret); + return ret; + } + pci_set_master(pdev); + } + if(share->resume) + (*share->resume)(share); + + hw_sm750_inithw(share,pdev); + + + info = share->fbinfo[0]; + + if(info){ + par = info->par; + crtc = &par->crtc; + cursor = &crtc->cursor; + memset(cursor->vstart, 0x0, cursor->size); + memset(crtc->vScreen,0x0,crtc->vidmem_size); + lynxfb_ops_set_par(info); + fb_set_suspend(info, 0); + } + + info = share->fbinfo[1]; + + if(info){ + par = info->par; + crtc = &par->crtc; + cursor = &crtc->cursor; + memset(cursor->vstart, 0x0, cursor->size); + memset(crtc->vScreen,0x0,crtc->vidmem_size); + lynxfb_ops_set_par(info); + fb_set_suspend(info, 0); + } + + + console_unlock(); + return ret; +} +#endif + +static int lynxfb_ops_mmap(struct fb_info * info, struct vm_area_struct * vma) +{ + unsigned long off; + unsigned long start; + u32 len; + struct file *file; + + file = vma->vm_file; + + if (!info) + return -ENODEV; + if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) + return -EINVAL; + off = vma->vm_pgoff << PAGE_SHIFT; + printk("lynxfb mmap pgoff: %x\n", vma->vm_pgoff); + printk("lynxfb mmap off 1: %x\n", off); + + /* frame buffer memory */ + start = info->fix.smem_start; + len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len); + + printk("lynxfb mmap start 1: %x\n", start); + printk("lynxfb mmap len 1: %x\n", len); + + if (off >= len) { + /* memory mapped io */ + off -= len; + printk("lynxfb mmap off 2: %x\n", off); + if (info->var.accel_flags) { + printk("lynxfb mmap accel flags true"); + return -EINVAL; + } + start = info->fix.mmio_start; + len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); + + printk("lynxfb mmap start 2: %x\n", start); + printk("lynxfb mmap len 2: %x\n", len); + } + start &= PAGE_MASK; + printk("lynxfb mmap start 3: %x\n", start); + printk("lynxfb mmap vm start: %x\n", vma->vm_start); + printk("lynxfb mmap vm end: %x\n", vma->vm_end); + printk("lynxfb mmap len: %x\n", len); + printk("lynxfb mmap off: %x\n", off); + if ((vma->vm_end - vma->vm_start + off) > len) + { + return -EINVAL; + } + off += start; + printk("lynxfb mmap off 3: %x\n", off); + vma->vm_pgoff = off >> PAGE_SHIFT; + /* This is an IO map - tell maydump to skip this VMA */ + vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; + vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); + fb_pgprotect(file, vma, off); + printk("lynxfb mmap off 4: %x\n", off); + printk("lynxfb mmap pgprot: %x\n", vma->vm_page_prot); + if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, + vma->vm_end - vma->vm_start, vma->vm_page_prot)) + return -EAGAIN; + return 0; +} + +static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* info) +{ + struct lynxfb_par * par; + struct lynxfb_crtc * crtc; + struct lynxfb_output * output; + struct lynx_share * share; + int ret; + resource_size_t request; + + + par = info->par; + crtc = &par->crtc; + output = &par->output; + share = par->share; + ret = 0; + + pr_debug("check var:%dx%d-%d\n", + var->xres, + var->yres, + var->bits_per_pixel); + + + switch(var->bits_per_pixel){ + case 8: + case 16: + case 24: /* support 24 bpp for only lynx712/722/720 */ + case 32: + break; + default: + pr_err("bpp %d not supported\n",var->bits_per_pixel); + ret = -EINVAL; + goto exit; + } + + switch(var->bits_per_pixel){ + case 8: + info->fix.visual = FB_VISUAL_PSEUDOCOLOR; + var->red.offset = 0; + var->red.length = 8; + var->green.offset = 0; + var->green.length = 8; + var->blue.offset = 0; + var->blue.length = 8; + var->transp.length = 0; + var->transp.offset = 0; + break; + case 16: + var->red.offset = 11; + var->red.length = 5; + var->green.offset = 5; + var->green.length = 6; + var->blue.offset = 0; + var->blue.length = 5; + var->transp.length = 0; + var->transp.offset = 0; + info->fix.visual = FB_VISUAL_TRUECOLOR; + break; + case 24: + case 32: + var->red.offset = 16; + var->red.length = 8; + var->green.offset = 8; + var->green.length = 8; + var->blue.offset = 0 ; + var->blue.length = 8; + info->fix.visual = FB_VISUAL_TRUECOLOR; + break; + default: + ret = -EINVAL; + break; + } + var->height = var->width = -1; + var->accel_flags = 0;/*FB_ACCELF_TEXT;*/ + + /* check if current fb's video memory big enought to hold the onscreen */ + request = var->xres_virtual * (var->bits_per_pixel >> 3); + /* defaulty crtc->channel go with par->index */ + + request = PADDING(crtc->line_pad,request); + request = request * var->yres_virtual; + if(crtc->vidmem_size < request){ + pr_err("not enough video memory for mode\n"); + return -ENOMEM; + } + + ret = output->proc_checkMode(output,var); + if(!ret) + ret = crtc->proc_checkMode(crtc,var); +exit: + return ret; +} + + +static int lynxfb_ops_setcolreg(unsigned regno,unsigned red, + unsigned green,unsigned blue, + unsigned transp,struct fb_info * info) +{ + struct lynxfb_par * par; + struct lynxfb_crtc * crtc; + struct fb_var_screeninfo * var; + int ret; + + par = info->par; + crtc = &par->crtc; + var = &info->var; + ret = 0; + + //pr_debug("regno=%d,red=%d,green=%d,blue=%d\n",regno,red,green,blue); + if(regno > 256){ + pr_err("regno = %d\n",regno); + return -EINVAL; + } + + if(info->var.grayscale) + red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; + + if(var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR) + { + red >>= 8; + green >>= 8; + blue >>= 8; + ret = crtc->proc_setColReg(crtc,regno,red,green,blue); + goto exit; + } + + + if(info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 ) + { + u32 val; + if(var->bits_per_pixel == 16 || + var->bits_per_pixel == 32 || + var->bits_per_pixel == 24) + { + val = chan_to_field(red,&var->red); + val |= chan_to_field(green,&var->green); + val |= chan_to_field(blue,&var->blue); + par->pseudo_palette[regno] = val; + goto exit; + } + } + + ret = -EINVAL; + +exit: + return ret; +} + +static int lynxfb_ops_blank(int blank,struct fb_info* info) +{ + struct lynxfb_par * par; + struct lynxfb_output * output; + + pr_debug("blank = %d.\n",blank); + par = info->par; + output = &par->output; + return output->proc_setBLANK(output,blank); +} + +static int sm750fb_set_drv(struct lynxfb_par * par) +{ + int ret; + struct lynx_share * share; + struct sm750_share * spec_share; + struct lynxfb_output * output; + struct lynxfb_crtc * crtc; + + ret = 0; + + share = par->share; + spec_share = container_of(share,struct sm750_share,share); + output = &par->output; + crtc = &par->crtc; + + crtc->vidmem_size = (share->dual)?share->vidmem_size>>1:share->vidmem_size; + /* setup crtc and output member */ + spec_share->hwCursor = g_hwcursor; + + crtc->proc_setMode = hw_sm750_crtc_setMode; + crtc->proc_checkMode = hw_sm750_crtc_checkMode; + crtc->proc_setColReg = hw_sm750_setColReg; + crtc->proc_panDisplay = hw_sm750_pan_display; + crtc->clear = hw_sm750_crtc_clear; + crtc->line_pad = 16; + //crtc->xpanstep = crtc->ypanstep = crtc->ywrapstep = 0; + crtc->xpanstep = 8; + crtc->ypanstep = 1; + crtc->ywrapstep = 0; + + output->proc_setMode = hw_sm750_output_setMode; + output->proc_checkMode = hw_sm750_output_checkMode; + + output->proc_setBLANK = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_setBLANK:hw_sm750_setBLANK; + output->clear = hw_sm750_output_clear; + /* chip specific phase */ + share->accel.de_wait = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_deWait: hw_sm750_deWait; + switch (spec_share->state.dataflow) + { + case sm750_simul_pri: + output->paths = sm750_pnc; + crtc->channel = sm750_primary; + crtc->oScreen = 0; + crtc->vScreen = share->pvMem; + pr_info("use simul primary mode\n"); + break; + case sm750_simul_sec: + output->paths = sm750_pnc; + crtc->channel = sm750_secondary; + crtc->oScreen = 0; + crtc->vScreen = share->pvMem; + break; + case sm750_dual_normal: + if(par->index == 0){ + output->paths = sm750_panel; + crtc->channel = sm750_primary; + crtc->oScreen = 0; + crtc->vScreen = share->pvMem; + }else{ + output->paths = sm750_crt; + crtc->channel = sm750_secondary; + /* not consider of padding stuffs for oScreen,need fix*/ + crtc->oScreen = (share->vidmem_size >> 1); + crtc->vScreen = share->pvMem + crtc->oScreen; + } + break; + case sm750_dual_swap: + if(par->index == 0){ + output->paths = sm750_panel; + crtc->channel = sm750_secondary; + crtc->oScreen = 0; + crtc->vScreen = share->pvMem; + }else{ + output->paths = sm750_crt; + crtc->channel = sm750_primary; + /* not consider of padding stuffs for oScreen,need fix*/ + crtc->oScreen = (share->vidmem_size >> 1); + crtc->vScreen = share->pvMem + crtc->oScreen; + } + break; + default: + ret = -EINVAL; + } + + return ret; +} + +static struct fb_ops lynxfb_ops={ + .owner = THIS_MODULE, + .fb_check_var = lynxfb_ops_check_var, + .fb_set_par = lynxfb_ops_set_par, + .fb_setcolreg = lynxfb_ops_setcolreg, + .fb_blank = lynxfb_ops_blank, + /*.fb_mmap = lynxfb_ops_mmap,*/ + /* will be hooked by hardware */ + .fb_fillrect = cfb_fillrect, + .fb_imageblit = cfb_imageblit, + .fb_copyarea = cfb_copyarea, + /* cursor */ + .fb_cursor = lynxfb_ops_cursor, +}; + + +static int lynxfb_set_fbinfo(struct fb_info* info,int index) +{ + int i; + struct lynxfb_par * par; + struct lynx_share * share; + struct lynxfb_crtc * crtc; + struct lynxfb_output * output; + struct fb_var_screeninfo * var; + struct fb_fix_screeninfo * fix; + + const struct fb_videomode * pdb[] = { + lynx750_ext, NULL,vesa_modes, + }; + int cdb[] = {ARRAY_SIZE(lynx750_ext),0,VESA_MODEDB_SIZE}; + static const char * mdb_desc[] ={ + "driver prepared modes", + "kernel prepared default modedb", + "kernel HELPERS prepared vesa_modes", + }; + + + static const char * fixId[2]= + { + "sm750_fb1","sm750_fb2", + }; + + int ret,line_length; + + ret = 0; + par = (struct lynxfb_par *)info->par; + share = par->share; + crtc = &par->crtc; + output = &par->output; + var = &info->var; + fix = &info->fix; + + /* set index */ + par->index = index; + output->channel = &crtc->channel; + sm750fb_set_drv(par); + lynxfb_ops.fb_pan_display = lynxfb_ops_pan_display; + + + /* set current cursor variable and proc pointer, + * must be set after crtc member initialized */ + crtc->cursor.offset = crtc->oScreen + crtc->vidmem_size - 1024; + crtc->cursor.mmio = share->pvReg + 0x800f0 + (int)crtc->channel * 0x140; + + pr_info("crtc->cursor.mmio = %p\n",crtc->cursor.mmio); + crtc->cursor.maxH = crtc->cursor.maxW = 64; + crtc->cursor.size = crtc->cursor.maxH*crtc->cursor.maxW*2/8; + crtc->cursor.disable = hw_cursor_disable; + crtc->cursor.enable = hw_cursor_enable; + crtc->cursor.setColor = hw_cursor_setColor; + crtc->cursor.setPos = hw_cursor_setPos; + crtc->cursor.setSize = hw_cursor_setSize; + crtc->cursor.setData = hw_cursor_setData; + crtc->cursor.vstart = share->pvMem + crtc->cursor.offset; + + + crtc->cursor.share = share; + memset(crtc->cursor.vstart, 0, crtc->cursor.size); + if(!g_hwcursor){ + lynxfb_ops.fb_cursor = NULL; + crtc->cursor.disable(&crtc->cursor); + } + + + /* set info->fbops, must be set before fb_find_mode */ + if(!share->accel_off){ + /* use 2d acceleration */ + lynxfb_ops.fb_fillrect = lynxfb_ops_fillrect; + lynxfb_ops.fb_copyarea = lynxfb_ops_copyarea; + lynxfb_ops.fb_imageblit = lynxfb_ops_imageblit; + } + info->fbops = &lynxfb_ops; + + if(!g_fbmode[index]){ + g_fbmode[index] = g_def_fbmode; + if(index) + g_fbmode[index] = g_fbmode[0]; + } + + + for(i=0;i<3;i++){ + + ret = fb_find_mode(var,info,g_fbmode[index], + pdb[i],cdb[i],NULL,8); + + if(ret == 1){ + pr_info("success! use specified mode:%s in %s\n", + g_fbmode[index], + mdb_desc[i]); + break; + }else if(ret == 2){ + pr_warn("use specified mode:%s in %s,with an ignored refresh rate\n", + g_fbmode[index], + mdb_desc[i]); + break; + }else if(ret == 3){ + pr_warn("wanna use default mode\n"); +// break; + }else if(ret == 4){ + pr_warn("fall back to any valid mode\n"); + }else{ + pr_warn("ret = %d,fb_find_mode failed,with %s\n",ret,mdb_desc[i]); + } + } + + /* some member of info->var had been set by fb_find_mode */ + + pr_info("Member of info->var is :\n\ + xres=%d\n\ + yres=%d\n\ + xres_virtual=%d\n\ + yres_virtual=%d\n\ + xoffset=%d\n\ + yoffset=%d\n\ + bits_per_pixel=%d\n \ + ...\n",var->xres,var->yres,var->xres_virtual,var->yres_virtual, + var->xoffset,var->yoffset,var->bits_per_pixel); + + /* set par */ + par->info = info; + + /* set info */ + line_length = PADDING(crtc->line_pad, + (var->xres_virtual * var->bits_per_pixel/8)); + + info->pseudo_palette = &par->pseudo_palette[0]; + info->screen_base = crtc->vScreen; + pr_debug("screen_base vaddr = %p\n",info->screen_base); + info->screen_size = line_length * var->yres_virtual; + info->flags = FBINFO_FLAG_DEFAULT|0; + + /* set info->fix */ + fix->type = FB_TYPE_PACKED_PIXELS; + fix->type_aux = 0; + fix->xpanstep = crtc->xpanstep; + fix->ypanstep = crtc->ypanstep; + fix->ywrapstep = crtc->ywrapstep; + fix->accel = FB_ACCEL_SMI; + + strlcpy(fix->id,fixId[index],sizeof(fix->id)); + + + fix->smem_start = crtc->oScreen + share->vidmem_start; + pr_info("fix->smem_start = %lx\n",fix->smem_start); + /* according to mmap experiment from user space application, + * fix->mmio_len should not larger than virtual size + * (xres_virtual x yres_virtual x ByPP) + * Below line maybe buggy when user mmap fb dev node and write + * data into the bound over virtual size + * */ + fix->smem_len = crtc->vidmem_size; + pr_info("fix->smem_len = %x\n",fix->smem_len); + info->screen_size = fix->smem_len; + fix->line_length = line_length; + fix->mmio_start = share->vidreg_start; + pr_info("fix->mmio_start = %lx\n",fix->mmio_start); + fix->mmio_len = share->vidreg_size; + pr_info("fix->mmio_len = %x\n",fix->mmio_len); + switch(var->bits_per_pixel) + { + case 8: + fix->visual = FB_VISUAL_PSEUDOCOLOR; + break; + case 16: + case 32: + fix->visual = FB_VISUAL_TRUECOLOR; + break; + } + + /* set var */ + var->activate = FB_ACTIVATE_NOW; + var->accel_flags = 0; + var->vmode = FB_VMODE_NONINTERLACED; + + pr_debug("#1 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", + info->cmap.start,info->cmap.len, + info->cmap.red,info->cmap.green,info->cmap.blue, + info->cmap.transp); + + if((ret = fb_alloc_cmap(&info->cmap,256,0)) < 0){ + pr_err("Could not allcate memory for cmap.\n"); + goto exit; + } + + pr_debug("#2 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", + info->cmap.start,info->cmap.len, + info->cmap.red,info->cmap.green,info->cmap.blue, + info->cmap.transp); + +exit: + lynxfb_ops_check_var(var,info); +// lynxfb_ops_set_par(info); + return ret; +} + +/* chip specific g_option configuration routine */ +static void sm750fb_setup(struct lynx_share * share,char * src) +{ + struct sm750_share * spec_share; + char * opt; +#ifdef CAP_EXPENSION + char * exp_res; +#endif + int swap; + + + spec_share = container_of(share,struct sm750_share,share); +#ifdef CAP_EXPENSIION + exp_res = NULL; +#endif + swap = 0; + + spec_share->state.initParm.chip_clk = 0; + spec_share->state.initParm.mem_clk = 0; + spec_share->state.initParm.master_clk = 0; + spec_share->state.initParm.powerMode = 0; + spec_share->state.initParm.setAllEngOff = 0; + spec_share->state.initParm.resetMemory = 1; + + /*defaultly turn g_hwcursor on for both view */ + g_hwcursor = 3; + + if(!src || !*src){ + pr_warn("no specific g_option.\n"); + goto NO_PARAM; + } + + while((opt = strsep(&src,":")) != NULL && *opt != NULL){ + pr_err("opt=%s\n",opt); + pr_err("src=%s\n",src); + + if(!strncmp(opt,"swap",strlen("swap"))) + swap = 1; + else if(!strncmp(opt,"nocrt",strlen("nocrt"))) + spec_share->state.nocrt = 1; + else if(!strncmp(opt,"36bit",strlen("36bit"))) + spec_share->state.pnltype = sm750_doubleTFT; + else if(!strncmp(opt,"18bit",strlen("18bit"))) + spec_share->state.pnltype = sm750_dualTFT; + else if(!strncmp(opt,"24bit",strlen("24bit"))) + spec_share->state.pnltype = sm750_24TFT; +#ifdef CAP_EXPANSION + else if(!strncmp(opt,"exp:",strlen("exp:"))) + exp_res = opt + strlen("exp:"); +#endif + else if(!strncmp(opt,"nohwc0",strlen("nohwc0"))) + g_hwcursor &= ~0x1; + else if(!strncmp(opt,"nohwc1",strlen("nohwc1"))) + g_hwcursor &= ~0x2; + else if(!strncmp(opt,"nohwc",strlen("nohwc"))) + g_hwcursor = 0; + else + { + if(!g_fbmode[0]){ + g_fbmode[0] = opt; + pr_info("find fbmode0 : %s\n",g_fbmode[0]); + }else if(!g_fbmode[1]){ + g_fbmode[1] = opt; + pr_info("find fbmode1 : %s\n",g_fbmode[1]); + }else{ + pr_warn("How many view you wann set?\n"); + } + } + } +#ifdef CAP_EXPANSION + if(getExpRes(exp_res,&spec_share->state.xLCD,&spec_share->state.yLCD)) + { + /* seems exp_res is not valid*/ + spec_share->state.xLCD = spec_share->state.yLCD = 0; + } +#endif + +NO_PARAM: + if(share->revid != SM750LE_REVISION_ID){ + if(share->dual) + { + if(swap) + spec_share->state.dataflow = sm750_dual_swap; + else + spec_share->state.dataflow = sm750_dual_normal; + }else{ + if(swap) + spec_share->state.dataflow = sm750_simul_sec; + else + spec_share->state.dataflow = sm750_simul_pri; + } + }else{ + /* SM750LE only have one crt channel */ + spec_share->state.dataflow = sm750_simul_sec; + /* sm750le do not have complex attributes*/ + spec_share->state.nocrt = 0; + } +} + +static int lynxfb_pci_probe(struct pci_dev * pdev, + const struct pci_device_id * ent) +{ + struct fb_info * info[] = {NULL,NULL}; + struct lynx_share * share = NULL; + + struct sm750_share *spec_share = NULL; + size_t spec_offset = 0; + int fbidx; + + + /* enable device */ + if(pci_enable_device(pdev)){ + pr_err("can not enable device.\n"); + goto err_enable; + } + + /* though offset of share in sm750_share is 0, + * we use this marcro as the same */ + spec_offset = offsetof(struct sm750_share,share); + + spec_share = kzalloc(sizeof(*spec_share),GFP_KERNEL); + if(!spec_share){ + pr_err("Could not allocate memory for share.\n"); + goto err_share; + } + + /* setting share structure */ + share = (struct lynx_share * )(&(spec_share->share)); + share->fbinfo[0] = share->fbinfo[1] = NULL; + share->devid = pdev->device; + share->revid = pdev->revision; + + pr_info("share->revid = %02x\n",share->revid); + share->pdev = pdev; +#ifdef CONFIG_MTRR + share->mtrr_off = g_nomtrr; + share->mtrr.vram = 0; + share->mtrr.vram_added = 0; +#endif + share->accel_off = g_noaccel; + share->dual = g_dualview; + spin_lock_init(&share->slock); + + if(!share->accel_off){ + /* hook deInit and 2d routines, notes that below hw_xxx + * routine can work on most of lynx chips + * if some chip need specific function,please hook it in smXXX_set_drv + * routine */ + share->accel.de_init = hw_de_init; + share->accel.de_fillrect = hw_fillrect; + share->accel.de_copyarea = hw_copyarea; + share->accel.de_imageblit = hw_imageblit; + pr_info("enable 2d acceleration\n"); + }else{ + pr_info("disable 2d acceleration\n"); + } + + /* call chip specific setup routine */ + sm750fb_setup(share,g_settings); + + /* call chip specific mmap routine */ + if(hw_sm750_map(share,pdev)){ + pr_err("Memory map failed\n"); + goto err_map; + } + +#ifdef CONFIG_MTRR + if(!share->mtrr_off){ + pr_info("enable mtrr\n"); + share->mtrr.vram = mtrr_add(share->vidmem_start, + share->vidmem_size, + MTRR_TYPE_WRCOMB,1); + + if(share->mtrr.vram < 0){ + /* don't block driver with the failure of MTRR */ + pr_err("Unable to setup MTRR.\n"); + }else{ + share->mtrr.vram_added = 1; + pr_info("MTRR added succesfully\n"); + } + } +#endif + + memset(share->pvMem,0,share->vidmem_size); + + pr_info("sm%3x mmio address = %p\n",share->devid,share->pvReg); + + pci_set_drvdata(pdev,share); + + /* call chipInit routine */ + hw_sm750_inithw(share,pdev); + + /* allocate frame buffer info structor according to g_dualview */ + fbidx = 0; +ALLOC_FB: + info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par),&pdev->dev); + if(!info[fbidx]) + { + pr_err("Could not allocate framebuffer #%d.\n",fbidx); + if(fbidx == 0) + goto err_info0_alloc; + else + goto err_info1_alloc; + } + else + { + struct lynxfb_par * par; + pr_info("framebuffer #%d alloc okay\n",fbidx); + share->fbinfo[fbidx] = info[fbidx]; + par = info[fbidx]->par; + par->share = share; + + /* set fb_info structure */ + if(lynxfb_set_fbinfo(info[fbidx],fbidx)){ + pr_err("Failed to initial fb_info #%d.\n",fbidx); + if(fbidx == 0) + goto err_info0_set; + else + goto err_info1_set; + } + + /* register frame buffer*/ + pr_info("Ready to register framebuffer #%d.\n",fbidx); + int errno = register_framebuffer(info[fbidx]); + if (errno < 0) { + pr_err("Failed to register fb_info #%d. err %d\n",fbidx, errno); + if(fbidx == 0) + goto err_register0; + else + goto err_register1; + } + pr_info("Accomplished register framebuffer #%d.\n",fbidx); + } + + /* no dual view by far */ + fbidx++; + if(share->dual && fbidx < 2) + goto ALLOC_FB; + + return 0; + +err_register1: +err_info1_set: + framebuffer_release(info[1]); +err_info1_alloc: + unregister_framebuffer(info[0]); +err_register0: +err_info0_set: + framebuffer_release(info[0]); +err_info0_alloc: +err_map: + kfree(spec_share); +err_share: +err_enable: + return -ENODEV; +} + +static void __exit lynxfb_pci_remove(struct pci_dev * pdev) +{ + struct fb_info * info; + struct lynx_share * share; + void * spec_share; + struct lynxfb_par * par; + int cnt; + + cnt = 2; + share = pci_get_drvdata(pdev); + + while(cnt-- > 0){ + info = share->fbinfo[cnt]; + if(!info) + continue; + par = info->par; + + unregister_framebuffer(info); + /* clean crtc & output allocations*/ + par->crtc.clear(&par->crtc); + par->output.clear(&par->output); + /* release frame buffer*/ + framebuffer_release(info); + } +#ifdef CONFIG_MTRR + if(share->mtrr.vram_added) + mtrr_del(share->mtrr.vram,share->vidmem_start,share->vidmem_size); +#endif + // pci_release_regions(pdev); + + iounmap(share->pvReg); + iounmap(share->pvMem); + spec_share = container_of(share,struct sm750_share,share); + kfree(g_settings); + kfree(spec_share); + pci_set_drvdata(pdev,NULL); +} + +static int __init lynxfb_setup(char * options) +{ + int len; + char * opt,*tmp; + + + if(!options || !*options){ + pr_warn("no options.\n"); + return 0; + } + + pr_info("options:%s\n",options); + + len = strlen(options) + 1; + g_settings = kmalloc(len,GFP_KERNEL); + if(!g_settings) + return -ENOMEM; + + memset(g_settings,0,len); + tmp = g_settings; + + /* Notes: + char * strsep(char **s,const char * ct); + @s: the string to be searched + @ct :the characters to search for + + strsep() updates @options to pointer after the first found token + it also returns the pointer ahead the token. + */ + while((opt = strsep(&options,":"))!=NULL) + { + /* options that mean for any lynx chips are configured here */ + if(!strncmp(opt,"noaccel",strlen("noaccel"))) + g_noaccel = 1; +#ifdef CONFIG_MTRR + else if(!strncmp(opt,"nomtrr",strlen("nomtrr"))) + g_nomtrr = 1; +#endif + else if(!strncmp(opt,"dual",strlen("dual"))) + g_dualview = 1; + else + { + strcat(tmp,opt); + tmp += strlen(opt); + if(options != NULL) + *tmp++ = ':'; + else + *tmp++ = 0; + } + } + + /* misc g_settings are transport to chip specific routines */ + pr_info("parameter left for chip specific analysis:%s\n",g_settings); + return 0; +} + +static struct pci_device_id smi_pci_table[] = { + { PCI_DEVICE(0x126f, 0x0750), }, + {0,} +}; + +MODULE_DEVICE_TABLE(pci,smi_pci_table); + +static struct pci_driver lynxfb_driver = { + .name = "sm750fb", + .id_table = smi_pci_table, + .probe = lynxfb_pci_probe, + .remove = lynxfb_pci_remove, +#ifdef CONFIG_PM + .suspend = lynxfb_suspend, + .resume = lynxfb_resume, +#endif +}; + + +static int __init lynxfb_init(void) +{ + char *option ; + int ret; + +#ifdef MODULE + option = g_option; +#else + if(fb_get_options("sm750fb",&option)) + return -ENODEV; +#endif + + lynxfb_setup(option); + ret = pci_register_driver(&lynxfb_driver); + return ret; +} +module_init(lynxfb_init); + +static void __exit lynxfb_exit(void) +{ + pci_unregister_driver(&lynxfb_driver); +} +module_exit(lynxfb_exit); + +module_param(g_option,charp,S_IRUGO); + +MODULE_PARM_DESC(g_option, + "\n\t\tCommon options:\n" + "\t\tnoaccel:disable 2d capabilities\n" + "\t\tnomtrr:disable MTRR attribute for video memory\n" + "\t\tdualview:dual frame buffer feature enabled\n" + "\t\tnohwc:disable hardware cursor\n" + "\t\tUsual example:\n" + "\t\tinsmod ./sm750fb.ko g_option=\"noaccel,nohwc,1280x1024-8@60\"\n" + ); + +MODULE_AUTHOR("monk liu "); +MODULE_AUTHOR("Sudip Mukherjee "); +MODULE_DESCRIPTION("Frame buffer driver for SM750 chipset"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h new file mode 100644 index 000000000000..711676c58839 --- /dev/null +++ b/drivers/staging/sm750fb/sm750.h @@ -0,0 +1,185 @@ +#ifndef LYNXDRV_H_ +#define LYNXDRV_H_ + + + +#define FB_ACCEL_SMI 0xab +/* please use revision id to distinguish sm750le and sm750*/ +#define SPC_SM750 0 + +//#define SPC_SM750LE 8 + +#define MB(x) ((x)<<20) +#define MHZ(x) ((x) * 1000000) +/* align should be 2,4,8,16 */ +#define PADDING(align,data) (((data)+(align)-1)&(~((align) -1))) +extern int smi_indent; + + +struct lynx_accel{ + /* base virtual address of DPR registers */ + volatile unsigned char __iomem * dprBase; + /* base virtual address of de data port */ + volatile unsigned char __iomem * dpPortBase; + + /* function fointers */ + int (*de_init)(struct lynx_accel *); + + int (*de_wait)(void);/* see if hardware ready to work */ + + int (*de_fillrect)(struct lynx_accel *,u32,u32,u32, + u32,u32,u32,u32,u32,u32); + + int (*de_copyarea)(struct lynx_accel *,u32,u32,u32,u32, + u32,u32,u32,u32, + u32,u32,u32,u32); + + int (*de_imageblit)(struct lynx_accel *,const char *,u32,u32,u32, + u32,u32,u32,u32,u32,u32,u32,u32,u32); + +}; + +/* lynx_share stands for a presentation of two frame buffer + that use one smi adaptor , it is similar to a basic class of C++ +*/ +struct lynx_share{ + /* common members */ + u16 devid; + u8 revid; + struct pci_dev * pdev; + struct fb_info * fbinfo[2]; + struct lynx_accel accel; + int accel_off; + int dual; +#ifdef CONFIG_MTRR + int mtrr_off; + struct{ + int vram; + int vram_added; + }mtrr; +#endif + /* all smi graphic adaptor got below attributes */ + resource_size_t vidmem_start; + resource_size_t vidreg_start; + resource_size_t vidmem_size; + resource_size_t vidreg_size; + volatile unsigned char __iomem * pvReg; + unsigned char __iomem * pvMem; + /* locks*/ + spinlock_t slock; + /* function pointers */ + void (*suspend)(struct lynx_share*); + void (*resume)(struct lynx_share*); +}; + +struct lynx_cursor{ + /* cursor width ,height and size */ + int w; + int h; + int size; + /* hardware limitation */ + int maxW; + int maxH; + /* base virtual address and offset of cursor image */ + char __iomem * vstart; + int offset; + /* mmio addr of hw cursor */ + volatile char __iomem * mmio; + /* the lynx_share of this adaptor */ + struct lynx_share * share; + /* proc_routines */ + void (*enable)(struct lynx_cursor *); + void (*disable)(struct lynx_cursor *); + void (*setSize)(struct lynx_cursor *,int,int); + void (*setPos)(struct lynx_cursor *,int,int); + void (*setColor)(struct lynx_cursor *,u32,u32); + void (*setData)(struct lynx_cursor *,u16,const u8*,const u8*); +}; + +struct lynxfb_crtc{ + unsigned char __iomem * vCursor;//virtual address of cursor + unsigned char __iomem * vScreen;//virtual address of on_screen + int oCursor;//cursor address offset in vidmem + int oScreen;//onscreen address offset in vidmem + int channel;/* which channel this crtc stands for*/ + resource_size_t vidmem_size;/* this view's video memory max size */ + + /* below attributes belong to info->fix, their value depends on specific adaptor*/ + u16 line_pad;/* padding information:0,1,2,4,8,16,... */ + u16 xpanstep; + u16 ypanstep; + u16 ywrapstep; + + void * priv; + + int(*proc_setMode)(struct lynxfb_crtc*, + struct fb_var_screeninfo*, + struct fb_fix_screeninfo*); + + int(*proc_checkMode)(struct lynxfb_crtc*,struct fb_var_screeninfo*); + int(*proc_setColReg)(struct lynxfb_crtc*,ushort,ushort,ushort,ushort); + void (*clear)(struct lynxfb_crtc*); + /* pan display */ + int(*proc_panDisplay)(struct lynxfb_crtc*, struct fb_var_screeninfo*, + struct fb_info*); + /* cursor information */ + struct lynx_cursor cursor; +}; + +struct lynxfb_output{ + int dpms; + int paths; + /* which paths(s) this output stands for,for sm750: + paths=1:means output for panel paths + paths=2:means output for crt paths + paths=3:means output for both panel and crt paths + */ + + int * channel; + /* which channel these outputs linked with,for sm750: + *channel=0 means primary channel + *channel=1 means secondary channel + output->channel ==> &crtc->channel + */ + void * priv; + + int(*proc_setMode)(struct lynxfb_output*, + struct fb_var_screeninfo*, + struct fb_fix_screeninfo*); + + int(*proc_checkMode)(struct lynxfb_output*,struct fb_var_screeninfo*); + int(*proc_setBLANK)(struct lynxfb_output*,int); + void (*clear)(struct lynxfb_output*); +}; + +struct lynxfb_par{ + /* either 0 or 1 for dual head adaptor,0 is the older one registered */ + int index; + unsigned int pseudo_palette[256]; + struct lynxfb_crtc crtc; + struct lynxfb_output output; + struct fb_info * info; + struct lynx_share * share; +}; + +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif + + +#define PS_TO_HZ(ps) \ + ({ \ + unsigned long long hz = 1000*1000*1000*1000ULL; \ + do_div(hz,ps); \ + (unsigned long)hz;}) + +static inline unsigned long ps_to_hz(unsigned int psvalue) +{ + unsigned long long numerator=1000*1000*1000*1000ULL; + /* 10^12 / picosecond period gives frequency in Hz */ + do_div(numerator, psvalue); + return (unsigned long)numerator; +} + + +#endif diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c new file mode 100644 index 000000000000..ee211deb9975 --- /dev/null +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -0,0 +1,516 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sm750.h" +#include "sm750_accel.h" +#include "sm750_help.h" +static inline void write_dpr(struct lynx_accel * accel,int offset,u32 regValue) +{ + writel(regValue,accel->dprBase + offset); +} + +static inline u32 read_dpr(struct lynx_accel * accel,int offset) +{ + return readl(accel->dprBase + offset); +} + +static inline void write_dpPort(struct lynx_accel * accel,u32 data) +{ + writel(data,accel->dpPortBase); +} + +void hw_de_init(struct lynx_accel * accel) +{ + /* setup 2d engine registers */ + u32 reg,clr; + + write_dpr(accel,DE_MASKS,0xFFFFFFFF); + + /* dpr1c */ + reg = FIELD_SET(0,DE_STRETCH_FORMAT,PATTERN_XY,NORMAL)| + FIELD_VALUE(0,DE_STRETCH_FORMAT,PATTERN_Y,0)| + FIELD_VALUE(0,DE_STRETCH_FORMAT,PATTERN_X,0)| + FIELD_SET(0,DE_STRETCH_FORMAT,ADDRESSING,XY)| + FIELD_VALUE(0,DE_STRETCH_FORMAT,SOURCE_HEIGHT,3); + + clr = FIELD_CLEAR(DE_STRETCH_FORMAT,PATTERN_XY)& + FIELD_CLEAR(DE_STRETCH_FORMAT,PATTERN_Y)& + FIELD_CLEAR(DE_STRETCH_FORMAT,PATTERN_X)& + FIELD_CLEAR(DE_STRETCH_FORMAT,ADDRESSING)& + FIELD_CLEAR(DE_STRETCH_FORMAT,SOURCE_HEIGHT); + + /* DE_STRETCH bpp format need be initilized in setMode routine */ + write_dpr(accel,DE_STRETCH_FORMAT,(read_dpr(accel,DE_STRETCH_FORMAT) & clr) | reg); + + /* disable clipping and transparent */ + write_dpr(accel,DE_CLIP_TL,0);//dpr2c + write_dpr(accel,DE_CLIP_BR,0);//dpr30 + + write_dpr(accel,DE_COLOR_COMPARE_MASK,0);//dpr24 + write_dpr(accel,DE_COLOR_COMPARE,0); + + reg = FIELD_SET(0,DE_CONTROL,TRANSPARENCY,DISABLE)| + FIELD_SET(0,DE_CONTROL,TRANSPARENCY_MATCH,OPAQUE)| + FIELD_SET(0,DE_CONTROL,TRANSPARENCY_SELECT,SOURCE); + + clr = FIELD_CLEAR(DE_CONTROL,TRANSPARENCY)& + FIELD_CLEAR(DE_CONTROL,TRANSPARENCY_MATCH)& + FIELD_CLEAR(DE_CONTROL,TRANSPARENCY_SELECT); + + /* dpr0c */ + write_dpr(accel,DE_CONTROL,(read_dpr(accel,DE_CONTROL)&clr)|reg); +} + +/* set2dformat only be called from setmode functions + * but if you need dual framebuffer driver,need call set2dformat + * every time you use 2d function */ + +void hw_set2dformat(struct lynx_accel * accel,int fmt) +{ + u32 reg; + + /* fmt=0,1,2 for 8,16,32,bpp on sm718/750/502 */ + reg = read_dpr(accel,DE_STRETCH_FORMAT); + reg = FIELD_VALUE(reg,DE_STRETCH_FORMAT,PIXEL_FORMAT,fmt); + write_dpr(accel,DE_STRETCH_FORMAT,reg); +} + +/* seems sm712 RectFill command is broken,so need use BitBlt to + * replace it. */ + +int hw712_fillrect(struct lynx_accel * accel, + u32 base,u32 pitch,u32 Bpp, + u32 x,u32 y,u32 width,u32 height, + u32 color,u32 rop) +{ + u32 deCtrl; + if(accel->de_wait() != 0) + { + /* int time wait and always busy,seems hardware + * got something error */ + pr_debug("%s:De engine always bussy\n",__func__); + return -1; + } + /* 24bpp 2d acceleration still not work,we already support 2d on + * both 8/16/32 bpp now, so there is no harm if we disable 2d on + * 24bpp for current stage. */ +#if 0 + if(Bpp == 3){ + width *= 3; + x *= 3; + write_dpr(accel,DE_PITCH, + FIELD_VALUE(0,DE_PITCH,DESTINATION,pitch)| + FIELD_VALUE(0,DE_PITCH,SOURCE,pitch));//dpr10 + } + else +#endif + { + write_dpr(accel,DE_PITCH, + FIELD_VALUE(0,DE_PITCH,DESTINATION,pitch/Bpp)| + FIELD_VALUE(0,DE_PITCH,SOURCE,pitch/Bpp));//dpr10 + + } + + write_dpr(accel,DE_FOREGROUND,color);//DPR14 + write_dpr(accel,DE_MONO_PATTERN_HIGH,~0);//DPR34 + write_dpr(accel,DE_MONO_PATTERN_LOW,~0);//DPR38 + + write_dpr(accel,DE_WINDOW_SOURCE_BASE,base);//dpr44 + write_dpr(accel,DE_WINDOW_DESTINATION_BASE,base);//dpr40 + + + write_dpr(accel,DE_WINDOW_WIDTH, + FIELD_VALUE(0,DE_WINDOW_WIDTH,DESTINATION,pitch/Bpp)| + FIELD_VALUE(0,DE_WINDOW_WIDTH,SOURCE,pitch/Bpp));//dpr3c + + + write_dpr(accel,DE_DESTINATION, + FIELD_SET(0,DE_DESTINATION,WRAP,DISABLE)| + FIELD_VALUE(0,DE_DESTINATION,X,x)| + FIELD_VALUE(0,DE_DESTINATION,Y,y));//dpr4 + + write_dpr(accel,DE_DIMENSION, + FIELD_VALUE(0,DE_DIMENSION,X,width)| + FIELD_VALUE(0,DE_DIMENSION,Y_ET,height));//dpr8 + + deCtrl = + FIELD_SET(0,DE_CONTROL,STATUS,START)| + FIELD_SET(0,DE_CONTROL,COMMAND,BITBLT)| + FIELD_SET(0,DE_CONTROL,ROP2_SOURCE,PATTERN)| + FIELD_SET(0,DE_CONTROL,ROP_SELECT,ROP2)| + FIELD_VALUE(0,DE_CONTROL,ROP,rop);//dpr0xc +#if 0 + /* dump registers */ + int i; + inf_msg("x,y,w,h = %d,%d,%d,%d\n",x,y,width,height); + for(i=0x04;i<=0x44;i+=4){ + inf_msg("dpr%02x = %08x\n",i,read_dpr(accel,i)); + } + inf_msg("deCtrl = %08x\n",deCtrl); +#endif + + write_dpr(accel,DE_CONTROL,deCtrl); + return 0; +} + +int hw_fillrect(struct lynx_accel * accel, + u32 base,u32 pitch,u32 Bpp, + u32 x,u32 y,u32 width,u32 height, + u32 color,u32 rop) +{ + u32 deCtrl; + + if(accel->de_wait() != 0) + { + /* int time wait and always busy,seems hardware + * got something error */ + pr_debug("%s:De engine always bussy\n",__func__); + return -1; + } + + write_dpr(accel,DE_WINDOW_DESTINATION_BASE,base);//dpr40 + write_dpr(accel,DE_PITCH, + FIELD_VALUE(0,DE_PITCH,DESTINATION,pitch/Bpp)| + FIELD_VALUE(0,DE_PITCH,SOURCE,pitch/Bpp));//dpr10 + + write_dpr(accel,DE_WINDOW_WIDTH, + FIELD_VALUE(0,DE_WINDOW_WIDTH,DESTINATION,pitch/Bpp)| + FIELD_VALUE(0,DE_WINDOW_WIDTH,SOURCE,pitch/Bpp));//dpr44 + + write_dpr(accel,DE_FOREGROUND,color);//DPR14 + + write_dpr(accel,DE_DESTINATION, + FIELD_SET(0,DE_DESTINATION,WRAP,DISABLE)| + FIELD_VALUE(0,DE_DESTINATION,X,x)| + FIELD_VALUE(0,DE_DESTINATION,Y,y));//dpr4 + + write_dpr(accel,DE_DIMENSION, + FIELD_VALUE(0,DE_DIMENSION,X,width)| + FIELD_VALUE(0,DE_DIMENSION,Y_ET,height));//dpr8 + + deCtrl = + FIELD_SET(0,DE_CONTROL,STATUS,START)| + FIELD_SET(0,DE_CONTROL,DIRECTION,LEFT_TO_RIGHT)| + FIELD_SET(0,DE_CONTROL,LAST_PIXEL,ON)| + FIELD_SET(0,DE_CONTROL,COMMAND,RECTANGLE_FILL)| + FIELD_SET(0,DE_CONTROL,ROP_SELECT,ROP2)| + FIELD_VALUE(0,DE_CONTROL,ROP,rop);//dpr0xc + + write_dpr(accel,DE_CONTROL,deCtrl); + return 0; +} + +int hw_copyarea( +struct lynx_accel * accel, +unsigned int sBase, /* Address of source: offset in frame buffer */ +unsigned int sPitch, /* Pitch value of source surface in BYTE */ +unsigned int sx, +unsigned int sy, /* Starting coordinate of source surface */ +unsigned int dBase, /* Address of destination: offset in frame buffer */ +unsigned int dPitch, /* Pitch value of destination surface in BYTE */ +unsigned int Bpp, /* Color depth of destination surface */ +unsigned int dx, +unsigned int dy, /* Starting coordinate of destination surface */ +unsigned int width, +unsigned int height, /* width and height of rectangle in pixel value */ +unsigned int rop2) /* ROP value */ +{ + unsigned int nDirection, de_ctrl; + int opSign; + nDirection = LEFT_TO_RIGHT; + /* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */ + opSign = 1; + de_ctrl = 0; + + /* If source and destination are the same surface, need to check for overlay cases */ + if (sBase == dBase && sPitch == dPitch) + { + /* Determine direction of operation */ + if (sy < dy) + { + /* +----------+ + |S | + | +----------+ + | | | | + | | | | + +---|------+ | + | D| + +----------+ */ + + nDirection = BOTTOM_TO_TOP; + } + else if (sy > dy) + { + /* +----------+ + |D | + | +----------+ + | | | | + | | | | + +---|------+ | + | S| + +----------+ */ + + nDirection = TOP_TO_BOTTOM; + } + else + { + /* sy == dy */ + + if (sx <= dx) + { + /* +------+---+------+ + |S | | D| + | | | | + | | | | + | | | | + +------+---+------+ */ + + nDirection = RIGHT_TO_LEFT; + } + else + { + /* sx > dx */ + + /* +------+---+------+ + |D | | S| + | | | | + | | | | + | | | | + +------+---+------+ */ + + nDirection = LEFT_TO_RIGHT; + } + } + } + + if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) + { + sx += width - 1; + sy += height - 1; + dx += width - 1; + dy += height - 1; + opSign = (-1); + } + + /* Note: + DE_FOREGROUND are DE_BACKGROUND are don't care. + DE_COLOR_COMPARE and DE_COLOR_COMPARE_MAKS are set by set deSetTransparency(). + */ + + /* 2D Source Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel,DE_WINDOW_SOURCE_BASE, sBase);//dpr40 + + /* 2D Destination Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel,DE_WINDOW_DESTINATION_BASE, dBase);//dpr44 + +#if 0 + /* Program pitch (distance between the 1st points of two adjacent lines). + Note that input pitch is BYTE value, but the 2D Pitch register uses + pixel values. Need Byte to pixel convertion. + */ + if(Bpp == 3){ + sx *= 3; + dx *= 3; + width *= 3; + write_dpr(accel,DE_PITCH, + FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch) | + FIELD_VALUE(0, DE_PITCH, SOURCE, sPitch));//dpr10 + } + else +#endif + { + write_dpr(accel,DE_PITCH, + FIELD_VALUE(0, DE_PITCH, DESTINATION, (dPitch/Bpp)) | + FIELD_VALUE(0, DE_PITCH, SOURCE, (sPitch/Bpp)));//dpr10 + } + + /* Screen Window width in Pixels. + 2D engine uses this value to calculate the linear address in frame buffer for a given point. + */ + write_dpr(accel,DE_WINDOW_WIDTH, + FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | + FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp)));//dpr3c + + if (accel->de_wait() != 0){ + return -1; + } + + { + + write_dpr(accel,DE_SOURCE, + FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | + FIELD_VALUE(0, DE_SOURCE, Y_K2, sy));//dpr0 + write_dpr(accel,DE_DESTINATION, + FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_VALUE(0, DE_DESTINATION, X, dx) | + FIELD_VALUE(0, DE_DESTINATION, Y, dy));//dpr04 + write_dpr(accel,DE_DIMENSION, + FIELD_VALUE(0, DE_DIMENSION, X, width) | + FIELD_VALUE(0, DE_DIMENSION, Y_ET, height));//dpr08 + + de_ctrl = + FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | + FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | + FIELD_SET(0, DE_CONTROL, COMMAND, BITBLT) | + ((nDirection == RIGHT_TO_LEFT) ? + FIELD_SET(0, DE_CONTROL, DIRECTION, RIGHT_TO_LEFT) + : FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT)) | + FIELD_SET(0, DE_CONTROL, STATUS, START); + write_dpr(accel,DE_CONTROL,de_ctrl);//dpr0c + } + + return 0; +} + +static unsigned int deGetTransparency(struct lynx_accel * accel) +{ + unsigned int de_ctrl; + + de_ctrl = read_dpr(accel,DE_CONTROL); + + de_ctrl &= + FIELD_MASK(DE_CONTROL_TRANSPARENCY_MATCH) | + FIELD_MASK(DE_CONTROL_TRANSPARENCY_SELECT)| + FIELD_MASK(DE_CONTROL_TRANSPARENCY); + + return de_ctrl; +} + +int hw_imageblit( +struct lynx_accel * accel, +unsigned char *pSrcbuf, /* pointer to start of source buffer in system memory */ +int srcDelta, /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */ +unsigned int startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */ +unsigned int dBase, /* Address of destination: offset in frame buffer */ +unsigned int dPitch, /* Pitch value of destination surface in BYTE */ +unsigned int bytePerPixel, /* Color depth of destination surface */ +unsigned int dx, +unsigned int dy, /* Starting coordinate of destination surface */ +unsigned int width, +unsigned int height, /* width and height of rectange in pixel value */ +unsigned int fColor, /* Foreground color (corresponding to a 1 in the monochrome data */ +unsigned int bColor, /* Background color (corresponding to a 0 in the monochrome data */ +unsigned int rop2) /* ROP value */ +{ + unsigned int ulBytesPerScan; + unsigned int ul4BytesPerScan; + unsigned int ulBytesRemain; + unsigned int de_ctrl = 0; + unsigned char ajRemain[4]; + int i, j; + + startBit &= 7; /* Just make sure the start bit is within legal range */ + ulBytesPerScan = (width + startBit + 7) / 8; + ul4BytesPerScan = ulBytesPerScan & ~3; + ulBytesRemain = ulBytesPerScan & 3; + + if(accel->de_wait() != 0) + { +// inf_msg("*** ImageBlit return -1 ***\n"); + return -1; + } + + /* 2D Source Base. + Use 0 for HOST Blt. + */ + write_dpr(accel,DE_WINDOW_SOURCE_BASE, 0); + + /* 2D Destination Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel,DE_WINDOW_DESTINATION_BASE, dBase); +#if 0 + /* Program pitch (distance between the 1st points of two adjacent lines). + Note that input pitch is BYTE value, but the 2D Pitch register uses + pixel values. Need Byte to pixel convertion. + */ + if(bytePerPixel == 3 ){ + dx *= 3; + width *= 3; + startBit *= 3; + write_dpr(accel,DE_PITCH, + FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch) | + FIELD_VALUE(0, DE_PITCH, SOURCE, dPitch));//dpr10 + + } + else +#endif + { + write_dpr(accel,DE_PITCH, + FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch/bytePerPixel) | + FIELD_VALUE(0, DE_PITCH, SOURCE, dPitch/bytePerPixel));//dpr10 + } + + /* Screen Window width in Pixels. + 2D engine uses this value to calculate the linear address in frame buffer for a given point. + */ + write_dpr(accel,DE_WINDOW_WIDTH, + FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/bytePerPixel)) | + FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (dPitch/bytePerPixel))); + + /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. + For mono bitmap, use startBit for X_K1. */ + write_dpr(accel,DE_SOURCE, + FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit));//dpr00 + + write_dpr(accel,DE_DESTINATION, + FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_VALUE(0, DE_DESTINATION, X, dx) | + FIELD_VALUE(0, DE_DESTINATION, Y, dy));//dpr04 + + write_dpr(accel,DE_DIMENSION, + FIELD_VALUE(0, DE_DIMENSION, X, width) | + FIELD_VALUE(0, DE_DIMENSION, Y_ET, height));//dpr08 + + write_dpr(accel,DE_FOREGROUND, fColor); + write_dpr(accel,DE_BACKGROUND, bColor); + + de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | + FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | + FIELD_SET(0, DE_CONTROL, COMMAND, HOST_WRITE) | + FIELD_SET(0, DE_CONTROL, HOST, MONO) | + FIELD_SET(0, DE_CONTROL, STATUS, START); + + write_dpr(accel,DE_CONTROL, de_ctrl | deGetTransparency(accel)); + + /* Write MONO data (line by line) to 2D Engine data port */ + for (i=0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sm750.h" +#include "sm750_help.h" +#include "sm750_cursor.h" + + +#define PEEK32(addr) \ +readl(cursor->mmio + (addr)) + +#define POKE32(addr,data) \ +writel((data),cursor->mmio + (addr)) + +/* cursor control for voyager and 718/750*/ +#define HWC_ADDRESS 0x0 +#define HWC_ADDRESS_ENABLE 31:31 +#define HWC_ADDRESS_ENABLE_DISABLE 0 +#define HWC_ADDRESS_ENABLE_ENABLE 1 +#define HWC_ADDRESS_EXT 27:27 +#define HWC_ADDRESS_EXT_LOCAL 0 +#define HWC_ADDRESS_EXT_EXTERNAL 1 +#define HWC_ADDRESS_CS 26:26 +#define HWC_ADDRESS_CS_0 0 +#define HWC_ADDRESS_CS_1 1 +#define HWC_ADDRESS_ADDRESS 25:0 + +#define HWC_LOCATION 0x4 +#define HWC_LOCATION_TOP 27:27 +#define HWC_LOCATION_TOP_INSIDE 0 +#define HWC_LOCATION_TOP_OUTSIDE 1 +#define HWC_LOCATION_Y 26:16 +#define HWC_LOCATION_LEFT 11:11 +#define HWC_LOCATION_LEFT_INSIDE 0 +#define HWC_LOCATION_LEFT_OUTSIDE 1 +#define HWC_LOCATION_X 10:0 + +#define HWC_COLOR_12 0x8 +#define HWC_COLOR_12_2_RGB565 31:16 +#define HWC_COLOR_12_1_RGB565 15:0 + +#define HWC_COLOR_3 0xC +#define HWC_COLOR_3_RGB565 15:0 + + +/* hw_cursor_xxx works for voyager,718 and 750 */ +void hw_cursor_enable(struct lynx_cursor * cursor) +{ + u32 reg; + reg = FIELD_VALUE(0,HWC_ADDRESS,ADDRESS,cursor->offset)| + FIELD_SET(0,HWC_ADDRESS,EXT,LOCAL)| + FIELD_SET(0,HWC_ADDRESS,ENABLE,ENABLE); + POKE32(HWC_ADDRESS,reg); +} +void hw_cursor_disable(struct lynx_cursor * cursor) +{ + POKE32(HWC_ADDRESS,0); +} + +void hw_cursor_setSize(struct lynx_cursor * cursor, + int w,int h) +{ + cursor->w = w; + cursor->h = h; +} +void hw_cursor_setPos(struct lynx_cursor * cursor, + int x,int y) +{ + u32 reg; + reg = FIELD_VALUE(0,HWC_LOCATION,Y,y)| + FIELD_VALUE(0,HWC_LOCATION,X,x); + POKE32(HWC_LOCATION,reg); +} +void hw_cursor_setColor(struct lynx_cursor * cursor, + u32 fg,u32 bg) +{ + POKE32(HWC_COLOR_12,(fg<<16)|(bg&0xffff)); + POKE32(HWC_COLOR_3,0xffe0); +} + +void hw_cursor_setData(struct lynx_cursor * cursor, + u16 rop,const u8* pcol,const u8* pmsk) +{ + int i,j,count,pitch,offset; + u8 color,mask,opr; + u16 data; + u16 * pbuffer,*pstart; + static ulong odd = 0; + + /* in byte*/ + pitch = cursor->w >> 3; + + /* in byte */ + count = pitch * cursor->h; + + /* in ushort */ + offset = cursor->maxW * 2 / 8 / 2; + + data = 0; + pstart = (u16 *)cursor->vstart; + pbuffer = pstart; + +/* + if(odd &1){ + hw_cursor_setData2(cursor,rop,pcol,pmsk); + } + odd++; + if(odd > 0xfffffff0) + odd=0; +*/ + + for(i=0;i> j)) + { //use fg color,id = 2 + data |= 2 << (j*2); + }else{ + //use bg color,id = 1 + data |= 1 << (j*2); + } + } +#else + for(j=0;j<8;j++){ + if(mask & (0x80>>j)){ + if(rop == ROP_XOR) + opr = mask ^ color; + else + opr = mask & color; + + /* 2 stands for forecolor and 1 for backcolor */ + data |= ((opr & (0x80>>j))?2:1)<<(j*2); + } + } +#endif + *pbuffer = data; + + /* assume pitch is 1,2,4,8,...*/ +#if 0 + if(!((i+1)&(pitch-1))) /* below line equal to is line */ +#else + if((i+1) % pitch == 0) +#endif + { + /* need a return */ + pstart += offset; + pbuffer = pstart; + }else{ + pbuffer++; + } + + } + + +} + + +void hw_cursor_setData2(struct lynx_cursor * cursor, + u16 rop,const u8* pcol,const u8* pmsk) +{ + int i,j,count,pitch,offset; + u8 color,mask,opr; + u16 data; + u16 * pbuffer,*pstart; + + /* in byte*/ + pitch = cursor->w >> 3; + + /* in byte */ + count = pitch * cursor->h; + + /* in ushort */ + offset = cursor->maxW * 2 / 8 / 2; + + data = 0; + pstart = (u16 *)cursor->vstart; + pbuffer = pstart; + + for(i=0;i> j)) + { //use fg color,id = 2 + data |= 2 << (j*2); + }else{ + //use bg color,id = 1 + data |= 1 << (j*2); + } + } +#else + for(j=0;j<8;j++){ + if(mask & (1<> (32 - _COUNT(f))) +#define GET_MASK(f) (RAW_MASK(f) << _LSB(f)) +#define GET_FIELD(d,f) (((d) >> _LSB(f)) & RAW_MASK(f)) +#define TEST_FIELD(d,f,v) (GET_FIELD(d,f) == f ## _ ## v) +#define SET_FIELD(d,f,v) (((d) & ~GET_MASK(f)) | \ + (((f ## _ ## v) & RAW_MASK(f)) << _LSB(f))) +#define SET_FIELDV(d,f,v) (((d) & ~GET_MASK(f)) | \ + (((v) & RAW_MASK(f)) << _LSB(f))) + + +//////////////////////////////////////////////////////////////////////////////// +// // +// Internal macros // +// // +//////////////////////////////////////////////////////////////////////////////// + +#define _F_START(f) (0 ? f) +#define _F_END(f) (1 ? f) +#define _F_SIZE(f) (1 + _F_END(f) - _F_START(f)) +#define _F_MASK(f) (((1 << _F_SIZE(f)) - 1) << _F_START(f)) +#define _F_NORMALIZE(v, f) (((v) & _F_MASK(f)) >> _F_START(f)) +#define _F_DENORMALIZE(v, f) (((v) << _F_START(f)) & _F_MASK(f)) + + +//////////////////////////////////////////////////////////////////////////////// +// // +// Global macros // +// // +//////////////////////////////////////////////////////////////////////////////// + +#define FIELD_GET(x, reg, field) \ +( \ + _F_NORMALIZE((x), reg ## _ ## field) \ +) + +#define FIELD_SET(x, reg, field, value) \ +( \ + (x & ~_F_MASK(reg ## _ ## field)) \ + | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \ +) + +#define FIELD_VALUE(x, reg, field, value) \ +( \ + (x & ~_F_MASK(reg ## _ ## field)) \ + | _F_DENORMALIZE(value, reg ## _ ## field) \ +) + +#define FIELD_CLEAR(reg, field) \ +( \ + ~ _F_MASK(reg ## _ ## field) \ +) + + +//////////////////////////////////////////////////////////////////////////////// +// // +// Field Macros // +// // +//////////////////////////////////////////////////////////////////////////////// + +#define FIELD_START(field) (0 ? field) +#define FIELD_END(field) (1 ? field) +#define FIELD_SIZE(field) (1 + FIELD_END(field) - FIELD_START(field)) +#define FIELD_MASK(field) (((1 << (FIELD_SIZE(field)-1)) | ((1 << (FIELD_SIZE(field)-1)) - 1)) << FIELD_START(field)) +#define FIELD_NORMALIZE(reg, field) (((reg) & FIELD_MASK(field)) >> FIELD_START(field)) +#define FIELD_DENORMALIZE(field, value) (((value) << FIELD_START(field)) & FIELD_MASK(field)) + +#define FIELD_INIT(reg, field, value) FIELD_DENORMALIZE(reg ## _ ## field, \ + reg ## _ ## field ## _ ## value) +#define FIELD_INIT_VAL(reg, field, value) \ + (FIELD_DENORMALIZE(reg ## _ ## field, value)) +#define FIELD_VAL_SET(x, r, f, v) x = x & ~FIELD_MASK(r ## _ ## f) \ + | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) + +#define RGB(r, g, b) \ +( \ + (unsigned long) (((r) << 16) | ((g) << 8) | (b)) \ +) + +#define RGB16(r, g, b) \ +( \ + (unsigned short) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | (((b) & 0xF8) >> 3)) \ +) + +static inline unsigned int absDiff(unsigned int a,unsigned int b) +{ + if(a +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_MTRR +#include +#endif +#include +#include + +#include "sm750.h" +#include "sm750_hw.h" +#include "ddk750.h" +#include "sm750_accel.h" + +int hw_sm750_map(struct lynx_share* share,struct pci_dev* pdev) +{ + int ret; + struct sm750_share * spec_share; + + + spec_share = container_of(share,struct sm750_share,share); + ret = 0; + + share->vidreg_start = pci_resource_start(pdev,1); + share->vidreg_size = MB(2); + + pr_info("mmio phyAddr = %x\n",share->vidreg_start); + + /* reserve the vidreg space of smi adaptor + * if you do this, u need to add release region code + * in lynxfb_remove, or memory will not be mapped again + * successfully + * */ + + if((ret = pci_request_region(pdev,1,"sm750fb"))) + { + pr_err("Can not request PCI regions.\n"); + goto exit; + } + + /* now map mmio and vidmem*/ + share->pvReg = ioremap_nocache(share->vidreg_start,share->vidreg_size); + if(!share->pvReg){ + pr_err("mmio failed\n"); + ret = -EFAULT; + goto exit; + }else{ + pr_info("mmio virtual addr = %p\n",share->pvReg); + } + + + share->accel.dprBase = share->pvReg + DE_BASE_ADDR_TYPE1; + share->accel.dpPortBase = share->pvReg + DE_PORT_ADDR_TYPE1; + + ddk750_set_mmio(share->pvReg,share->devid,share->revid); + + share->vidmem_start = pci_resource_start(pdev,0); + /* don't use pdev_resource[x].end - resource[x].start to + * calculate the resource size,its only the maximum available + * size but not the actual size,use + * @hw_sm750_getVMSize function can be safe. + * */ + share->vidmem_size = hw_sm750_getVMSize(share); + pr_info("video memory phyAddr = %x, size = %d bytes\n", + share->vidmem_start,share->vidmem_size); + + /* reserve the vidmem space of smi adaptor */ +#if 0 + if((ret = pci_request_region(pdev,0,_moduleName_))) + { + pr_err("Can not request PCI regions.\n"); + goto exit; + } +#endif + + share->pvMem = ioremap(share->vidmem_start, + share->vidmem_size); + + if(!share->pvMem){ + pr_err("Map video memory failed\n"); + ret = -EFAULT; + goto exit; + }else{ + pr_info("video memory vaddr = %p\n",share->pvMem); + } +exit: + return ret; +} + + + +int hw_sm750_inithw(struct lynx_share* share,struct pci_dev * pdev) +{ + struct sm750_share * spec_share; + struct init_status * parm; + + spec_share = container_of(share,struct sm750_share,share); + parm = &spec_share->state.initParm; + if(parm->chip_clk == 0) + parm->chip_clk = (getChipType() == SM750LE)? + DEFAULT_SM750LE_CHIP_CLOCK : + DEFAULT_SM750_CHIP_CLOCK; + + if(parm->mem_clk == 0) + parm->mem_clk = parm->chip_clk; + if(parm->master_clk == 0) + parm->master_clk = parm->chip_clk/3; + + ddk750_initHw((initchip_param_t *)&spec_share->state.initParm); + /* for sm718,open pci burst */ + if(share->devid == 0x718){ + POKE32(SYSTEM_CTRL, + FIELD_SET(PEEK32(SYSTEM_CTRL),SYSTEM_CTRL,PCI_BURST,ON)); + } + + /* sm750 use sii164, it can be setup with default value + * by on power, so initDVIDisp can be skipped */ +#if 0 + ddk750_initDVIDisp(); +#endif + + if(getChipType() != SM750LE) + { + /* does user need CRT ?*/ + if(spec_share->state.nocrt){ + POKE32(MISC_CTRL, + FIELD_SET(PEEK32(MISC_CTRL), + MISC_CTRL, + DAC_POWER,OFF)); + /* shut off dpms */ + POKE32(SYSTEM_CTRL, + FIELD_SET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + DPMS,VNHN)); + }else{ + POKE32(MISC_CTRL, + FIELD_SET(PEEK32(MISC_CTRL), + MISC_CTRL, + DAC_POWER,ON)); + /* turn on dpms */ + POKE32(SYSTEM_CTRL, + FIELD_SET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + DPMS,VPHP)); + } + + switch (spec_share->state.pnltype){ + case sm750_doubleTFT: + case sm750_24TFT: + case sm750_dualTFT: + POKE32(PANEL_DISPLAY_CTRL, + FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), + PANEL_DISPLAY_CTRL, + TFT_DISP, + spec_share->state.pnltype)); + break; + } + }else{ + /* for 750LE ,no DVI chip initilization makes Monitor no signal */ + /* Set up GPIO for software I2C to program DVI chip in the + Xilinx SP605 board, in order to have video signal. + */ + swI2CInit(0,1); + + + /* Customer may NOT use CH7301 DVI chip, which has to be + initialized differently. + */ + if (swI2CReadReg(0xec, 0x4a) == 0x95) + { + /* The following register values for CH7301 are from + Chrontel app note and our experiment. + */ + pr_info("yes,CH7301 DVI chip found\n"); + swI2CWriteReg(0xec, 0x1d, 0x16); + swI2CWriteReg(0xec, 0x21, 0x9); + swI2CWriteReg(0xec, 0x49, 0xC0); + pr_info("okay,CH7301 DVI chip setup done\n"); + } + } + + /* init 2d engine */ + if(!share->accel_off){ + hw_sm750_initAccel(share); +// share->accel.de_wait = hw_sm750_deWait; + } + + return 0; +} + + +resource_size_t hw_sm750_getVMSize(struct lynx_share * share) +{ + resource_size_t ret; + + ret = ddk750_getVMSize(); + return ret; +} + + + +int hw_sm750_output_checkMode(struct lynxfb_output* output,struct fb_var_screeninfo* var) +{ + + return 0; +} + + +int hw_sm750_output_setMode(struct lynxfb_output* output, + struct fb_var_screeninfo* var,struct fb_fix_screeninfo* fix) +{ + int ret; + disp_output_t dispSet; + int channel; + + ret = 0; + dispSet = 0; + channel = *output->channel; + + + if(getChipType() != SM750LE){ + if(channel == sm750_primary){ + pr_info("primary channel\n"); + if(output->paths & sm750_panel) + dispSet |= do_LCD1_PRI; + if(output->paths & sm750_crt) + dispSet |= do_CRT_PRI; + + }else{ + pr_info("secondary channel\n"); + if(output->paths & sm750_panel) + dispSet |= do_LCD1_SEC; + if(output->paths & sm750_crt) + dispSet |= do_CRT_SEC; + + } + ddk750_setLogicalDispOut(dispSet); + }else{ + /* just open DISPLAY_CONTROL_750LE register bit 3:0*/ + u32 reg; + reg = PEEK32(DISPLAY_CONTROL_750LE); + reg |= 0xf; + POKE32(DISPLAY_CONTROL_750LE,reg); + } + + pr_info("ddk setlogicdispout done \n"); + return ret; +} + +void hw_sm750_output_clear(struct lynxfb_output* output) +{ + + return; +} + +int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc,struct fb_var_screeninfo* var) +{ + struct lynx_share * share; + + + share = container_of(crtc,struct lynxfb_par,crtc)->share; + + switch (var->bits_per_pixel){ + case 8: + case 16: + break; + case 32: + if(share->revid == (unsigned char)SM750LE_REVISION_ID){ + pr_debug("750le do not support 32bpp\n"); + return -EINVAL; + } + break; + default: + return -EINVAL; + + } + + return 0; +} + + +/* + set the controller's mode for @crtc charged with @var and @fix parameters +*/ +int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, + struct fb_var_screeninfo* var, + struct fb_fix_screeninfo* fix) +{ + int ret,fmt; + u32 reg; + mode_parameter_t modparm; + clock_type_t clock; + struct lynx_share * share; + struct lynxfb_par * par; + + + ret = 0; + par = container_of(crtc,struct lynxfb_par,crtc); + share = par->share; +#if 1 + if(!share->accel_off){ + /* set 2d engine pixel format according to mode bpp */ + switch(var->bits_per_pixel){ + case 8: + fmt = 0; + break; + case 16: + fmt = 1; + break; + case 32: + default: + fmt = 2; + break; + } + hw_set2dformat(&share->accel,fmt); + } +#endif + + /* set timing */ +// modparm.pixel_clock = PS_TO_HZ(var->pixclock); + modparm.pixel_clock = ps_to_hz(var->pixclock); + modparm.vertical_sync_polarity = (var->sync & FB_SYNC_HOR_HIGH_ACT) ? POS:NEG; + modparm.horizontal_sync_polarity = (var->sync & FB_SYNC_VERT_HIGH_ACT) ? POS:NEG; + modparm.clock_phase_polarity = (var->sync& FB_SYNC_COMP_HIGH_ACT) ? POS:NEG; + modparm.horizontal_display_end = var->xres; + modparm.horizontal_sync_width = var->hsync_len; + modparm.horizontal_sync_start = var->xres + var->right_margin; + modparm.horizontal_total = var->xres + var->left_margin + var->right_margin + var->hsync_len; + modparm.vertical_display_end = var->yres; + modparm.vertical_sync_height = var->vsync_len; + modparm.vertical_sync_start = var->yres + var->lower_margin; + modparm.vertical_total = var->yres + var->upper_margin + var->lower_margin + var->vsync_len; + + /* choose pll */ + if(crtc->channel != sm750_secondary) + clock = PRIMARY_PLL; + else + clock = SECONDARY_PLL; + + pr_debug("Request pixel clock = %lu\n",modparm.pixel_clock); + ret = ddk750_setModeTiming(&modparm,clock); + if(ret){ + pr_err("Set mode timing failed\n"); + goto exit; + } + + if(crtc->channel != sm750_secondary){ + /* set pitch, offset ,width,start address ,etc... */ + POKE32(PANEL_FB_ADDRESS, + FIELD_SET(0,PANEL_FB_ADDRESS,STATUS,CURRENT)| + FIELD_SET(0,PANEL_FB_ADDRESS,EXT,LOCAL)| + FIELD_VALUE(0,PANEL_FB_ADDRESS,ADDRESS,crtc->oScreen)); + + reg = var->xres * (var->bits_per_pixel >> 3); + /* crtc->channel is not equal to par->index on numeric,be aware of that */ + reg = PADDING(crtc->line_pad,reg); + + POKE32(PANEL_FB_WIDTH, + FIELD_VALUE(0,PANEL_FB_WIDTH,WIDTH,reg)| + FIELD_VALUE(0,PANEL_FB_WIDTH,OFFSET,fix->line_length)); + + POKE32(PANEL_WINDOW_WIDTH, + FIELD_VALUE(0,PANEL_WINDOW_WIDTH,WIDTH,var->xres -1)| + FIELD_VALUE(0,PANEL_WINDOW_WIDTH,X,var->xoffset)); + + POKE32(PANEL_WINDOW_HEIGHT, + FIELD_VALUE(0,PANEL_WINDOW_HEIGHT,HEIGHT,var->yres_virtual - 1)| + FIELD_VALUE(0,PANEL_WINDOW_HEIGHT,Y,var->yoffset)); + + POKE32(PANEL_PLANE_TL,0); + + POKE32(PANEL_PLANE_BR, + FIELD_VALUE(0,PANEL_PLANE_BR,BOTTOM,var->yres - 1)| + FIELD_VALUE(0,PANEL_PLANE_BR,RIGHT,var->xres - 1)); + + /* set pixel format */ + reg = PEEK32(PANEL_DISPLAY_CTRL); + POKE32(PANEL_DISPLAY_CTRL, + FIELD_VALUE(reg, + PANEL_DISPLAY_CTRL,FORMAT, + (var->bits_per_pixel >> 4) + )); + }else{ + /* not implemented now */ + POKE32(CRT_FB_ADDRESS,crtc->oScreen); + reg = var->xres * (var->bits_per_pixel >> 3); + /* crtc->channel is not equal to par->index on numeric,be aware of that */ + reg = PADDING(crtc->line_pad,reg); + + POKE32(CRT_FB_WIDTH, + FIELD_VALUE(0,CRT_FB_WIDTH,WIDTH,reg)| + FIELD_VALUE(0,CRT_FB_WIDTH,OFFSET,fix->line_length)); + + /* SET PIXEL FORMAT */ + reg = PEEK32(CRT_DISPLAY_CTRL); + reg = FIELD_VALUE(reg,CRT_DISPLAY_CTRL,FORMAT,var->bits_per_pixel >> 4); + POKE32(CRT_DISPLAY_CTRL,reg); + + } + + +exit: + return ret; +} + +void hw_sm750_crtc_clear(struct lynxfb_crtc* crtc) +{ + + return; +} + +int hw_sm750_setColReg(struct lynxfb_crtc* crtc,ushort index, + ushort red,ushort green,ushort blue) +{ + static unsigned int add[]={PANEL_PALETTE_RAM,CRT_PALETTE_RAM}; + POKE32(add[crtc->channel] + index*4 ,(red<<16)|(green<<8)|blue); + return 0; +} + +int hw_sm750le_setBLANK(struct lynxfb_output * output,int blank){ + int dpms,crtdb; + + switch(blank) + { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_UNBLANK: +#else + case VESA_NO_BLANKING: +#endif + dpms = CRT_DISPLAY_CTRL_DPMS_0; + crtdb = CRT_DISPLAY_CTRL_BLANK_OFF; + break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_NORMAL: + dpms = CRT_DISPLAY_CTRL_DPMS_0; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_VSYNC_SUSPEND: +#else + case VESA_VSYNC_SUSPEND: +#endif + dpms = CRT_DISPLAY_CTRL_DPMS_2; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_HSYNC_SUSPEND: +#else + case VESA_HSYNC_SUSPEND: +#endif + dpms = CRT_DISPLAY_CTRL_DPMS_1; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_POWERDOWN: +#else + case VESA_POWERDOWN: +#endif + dpms = CRT_DISPLAY_CTRL_DPMS_3; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; + } + + if(output->paths & sm750_crt){ + POKE32(CRT_DISPLAY_CTRL,FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL),CRT_DISPLAY_CTRL,DPMS,dpms)); + POKE32(CRT_DISPLAY_CTRL,FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL),CRT_DISPLAY_CTRL,BLANK,crtdb)); + } + return 0; +} + +int hw_sm750_setBLANK(struct lynxfb_output* output,int blank) +{ + unsigned int dpms,pps,crtdb; + + dpms = pps = crtdb = 0; + + switch (blank) + { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_UNBLANK: +#else + case VESA_NO_BLANKING: +#endif + pr_info("flag = FB_BLANK_UNBLANK \n"); + dpms = SYSTEM_CTRL_DPMS_VPHP; + pps = PANEL_DISPLAY_CTRL_DATA_ENABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_OFF; + break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_NORMAL: + pr_info("flag = FB_BLANK_NORMAL \n"); + dpms = SYSTEM_CTRL_DPMS_VPHP; + pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_VSYNC_SUSPEND: +#else + case VESA_VSYNC_SUSPEND: +#endif + dpms = SYSTEM_CTRL_DPMS_VNHP; + pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_HSYNC_SUSPEND: +#else + case VESA_HSYNC_SUSPEND: +#endif + dpms = SYSTEM_CTRL_DPMS_VPHN; + pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + case FB_BLANK_POWERDOWN: +#else + case VESA_POWERDOWN: +#endif + dpms = SYSTEM_CTRL_DPMS_VNHN; + pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; + crtdb = CRT_DISPLAY_CTRL_BLANK_ON; + break; + } + + if(output->paths & sm750_crt){ + + POKE32(SYSTEM_CTRL,FIELD_VALUE(PEEK32(SYSTEM_CTRL),SYSTEM_CTRL,DPMS,dpms)); + POKE32(CRT_DISPLAY_CTRL,FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL),CRT_DISPLAY_CTRL,BLANK,crtdb)); + } + + if(output->paths & sm750_panel){ + POKE32(PANEL_DISPLAY_CTRL,FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL),PANEL_DISPLAY_CTRL,DATA,pps)); + } + + return 0; +} + + +void hw_sm750_initAccel(struct lynx_share * share) +{ + u32 reg; + enable2DEngine(1); + + if(getChipType() == SM750LE){ + reg = PEEK32(DE_STATE1); + reg = FIELD_SET(reg,DE_STATE1,DE_ABORT,ON); + POKE32(DE_STATE1,reg); + + reg = PEEK32(DE_STATE1); + reg = FIELD_SET(reg,DE_STATE1,DE_ABORT,OFF); + POKE32(DE_STATE1,reg); + + }else{ + /* engine reset */ + reg = PEEK32(SYSTEM_CTRL); + reg = FIELD_SET(reg,SYSTEM_CTRL,DE_ABORT,ON); + POKE32(SYSTEM_CTRL,reg); + + reg = PEEK32(SYSTEM_CTRL); + reg = FIELD_SET(reg,SYSTEM_CTRL,DE_ABORT,OFF); + POKE32(SYSTEM_CTRL,reg); + } + + /* call 2d init */ + share->accel.de_init(&share->accel); +} + +int hw_sm750le_deWait() +{ + int i=0x10000000; + while(i--){ + unsigned int dwVal = PEEK32(DE_STATE2); + if((FIELD_GET(dwVal,DE_STATE2,DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && + (FIELD_GET(dwVal,DE_STATE2,DE_FIFO) == DE_STATE2_DE_FIFO_EMPTY) && + (FIELD_GET(dwVal,DE_STATE2,DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) + { + return 0; + } + } + /* timeout error */ + return -1; +} + + +int hw_sm750_deWait() +{ + int i=0x10000000; + while(i--){ + unsigned int dwVal = PEEK32(SYSTEM_CTRL); + if((FIELD_GET(dwVal,SYSTEM_CTRL,DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && + (FIELD_GET(dwVal,SYSTEM_CTRL,DE_FIFO) == SYSTEM_CTRL_DE_FIFO_EMPTY) && + (FIELD_GET(dwVal,SYSTEM_CTRL,DE_MEM_FIFO) == SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) + { + return 0; + } + } + /* timeout error */ + return -1; +} + +int hw_sm750_pan_display(struct lynxfb_crtc *crtc, + const struct fb_var_screeninfo *var, + const struct fb_info *info) +{ + uint32_t total; + //check params + if ((var->xoffset + var->xres > var->xres_virtual) || + (var->yoffset + var->yres > var->yres_virtual)) { + return -EINVAL; + } + + total = var->yoffset * info->fix.line_length + + ((var->xoffset * var->bits_per_pixel) >> 3); + total += crtc->oScreen; + if (crtc->channel == sm750_primary) { + POKE32(PANEL_FB_ADDRESS, + FIELD_VALUE(PEEK32(PANEL_FB_ADDRESS), + PANEL_FB_ADDRESS, ADDRESS, total)); + } else { + POKE32(CRT_FB_ADDRESS, + FIELD_VALUE(PEEK32(CRT_FB_ADDRESS), + CRT_FB_ADDRESS, ADDRESS, total)); + } + return 0; +} + diff --git a/drivers/staging/sm750fb/sm750_hw.h b/drivers/staging/sm750fb/sm750_hw.h new file mode 100644 index 000000000000..b05be5e99f51 --- /dev/null +++ b/drivers/staging/sm750fb/sm750_hw.h @@ -0,0 +1,104 @@ +#ifndef LYNX_HW750_H__ +#define LYNX_HW750_H__ + + +#define DEFAULT_SM750_CHIP_CLOCK 290 +#define DEFAULT_SM750LE_CHIP_CLOCK 333 +#ifndef SM750LE_REVISION_ID +#define SM750LE_REVISION_ID (unsigned char)0xfe +#endif + +//#define DEFAULT_MEM_CLOCK (DEFAULT_SM750_CHIP_CLOCK/1) +//#define DEFAULT_MASTER_CLOCK (DEFAULT_SM750_CHIP_CLOCK/3) + + +enum sm750_pnltype{ + + sm750_24TFT = 0,/* 24bit tft */ + + sm750_dualTFT = 2,/* dual 18 bit tft */ + + sm750_doubleTFT = 1,/* 36 bit double pixel tft */ +}; + +/* vga channel is not concerned */ +enum sm750_dataflow{ + sm750_simul_pri,/* primary => all head */ + + sm750_simul_sec,/* secondary => all head */ + + sm750_dual_normal,/* primary => panel head and secondary => crt */ + + sm750_dual_swap,/* primary => crt head and secondary => panel */ +}; + + +enum sm750_channel{ + sm750_primary = 0, + /* enum value equal to the register filed data */ + sm750_secondary = 1, +}; + +enum sm750_path{ + sm750_panel = 1, + sm750_crt = 2, + sm750_pnc = 3,/* panel and crt */ +}; + +struct init_status{ + ushort powerMode; + /* below three clocks are in unit of MHZ*/ + ushort chip_clk; + ushort mem_clk; + ushort master_clk; + ushort setAllEngOff; + ushort resetMemory; +}; + +struct sm750_state{ + struct init_status initParm; + enum sm750_pnltype pnltype; + enum sm750_dataflow dataflow; + int nocrt; + int xLCD; + int yLCD; +}; + +/* sm750_share stands for a presentation of two frame buffer + that use one sm750 adaptor, it is similiar to the super class of lynx_share + in C++ +*/ + +struct sm750_share{ + /* it's better to put lynx_share struct to the first place of sm750_share */ + struct lynx_share share; + struct sm750_state state; + int hwCursor; + /* 0: no hardware cursor + 1: primary crtc hw cursor enabled, + 2: secondary crtc hw cursor enabled + 3: both ctrc hw cursor enabled + */ +}; + +int hw_sm750_map(struct lynx_share* share,struct pci_dev* pdev); +int hw_sm750_inithw(struct lynx_share*,struct pci_dev *); +void hw_sm750_initAccel(struct lynx_share *); +int hw_sm750_deWait(void); +int hw_sm750le_deWait(void); + +resource_size_t hw_sm750_getVMSize(struct lynx_share *); +int hw_sm750_output_checkMode(struct lynxfb_output*,struct fb_var_screeninfo*); +int hw_sm750_output_setMode(struct lynxfb_output*,struct fb_var_screeninfo*,struct fb_fix_screeninfo*); +int hw_sm750_crtc_checkMode(struct lynxfb_crtc*,struct fb_var_screeninfo*); +int hw_sm750_crtc_setMode(struct lynxfb_crtc*,struct fb_var_screeninfo*,struct fb_fix_screeninfo*); +int hw_sm750_setColReg(struct lynxfb_crtc*,ushort,ushort,ushort,ushort); +int hw_sm750_setBLANK(struct lynxfb_output*,int); +int hw_sm750le_setBLANK(struct lynxfb_output*,int); +void hw_sm750_crtc_clear(struct lynxfb_crtc*); +void hw_sm750_output_clear(struct lynxfb_output*); +int hw_sm750_pan_display(struct lynxfb_crtc *crtc, + const struct fb_var_screeninfo *var, + const struct fb_info *info); + +#endif -- cgit v1.2.3 From d9fabbde633e2d567a2c0f9e29e4e4d2f9bf5196 Mon Sep 17 00:00:00 2001 From: Drew Fustini Date: Wed, 4 Mar 2015 02:10:11 -0600 Subject: Staging: fbtft: add header for internal functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove extern keyword from function prototypes to suppress warning from checkpatch.pl with --strict option: https://lkml.org/lkml/2013/7/23/422 fbtft maintainer Noralf Tronnes advised these functions are internal to this module & suggested moving these prototypes to new internal.h file. He also advised fbtft.h file will eventually live in include/linux/fbtft.h Suggested-by: Noralf Trønnes Signed-off-by: Drew Fustini Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 7 +------ drivers/staging/fbtft/internal.h | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 drivers/staging/fbtft/internal.h (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index fd9f92e2dba6..16c726030f37 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -41,12 +41,7 @@ #include #include "fbtft.h" - -extern void fbtft_sysfs_init(struct fbtft_par *par); -extern void fbtft_sysfs_exit(struct fbtft_par *par); -extern void fbtft_expand_debug_value(unsigned long *debug); -extern int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves, - const char *str, int size); +#include "internal.h" static unsigned long debug; module_param(debug, ulong, 0); diff --git a/drivers/staging/fbtft/internal.h b/drivers/staging/fbtft/internal.h new file mode 100644 index 000000000000..f69db8289151 --- /dev/null +++ b/drivers/staging/fbtft/internal.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2013 Noralf Tronnes + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __LINUX_FBTFT__INTERNAL_H +#define __LINUX_FBTFT_INTERNAL_H + +void fbtft_sysfs_init(struct fbtft_par *par); +void fbtft_sysfs_exit(struct fbtft_par *par); +void fbtft_expand_debug_value(unsigned long *debug); +int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves, + const char *str, int size); + +#endif /* __LINUX_FBTFT_INTERNAL_H */ -- cgit v1.2.3 From 4de57acbb6fddea4159dfcb62440b1e1309e3d9e Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Wed, 4 Mar 2015 12:14:21 -0500 Subject: staging: unisys: remove DBGINF, DBGVER, DEBUGDEV, and DEBUGDRV macros The messages put out by these macros are for driver debugging and aren't needed any more, so just remove all use of them, and the macros too. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/timskmod.h | 2 - drivers/staging/unisys/include/uniklog.h | 39 ----------------- drivers/staging/unisys/uislib/uislib.c | 5 --- drivers/staging/unisys/uislib/uisutils.c | 1 - drivers/staging/unisys/virthba/virthba.c | 69 ++++-------------------------- drivers/staging/unisys/virtpci/virtpci.c | 28 ------------ drivers/staging/unisys/visorchipset/file.c | 10 ----- 7 files changed, 9 insertions(+), 145 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index 4019a0d63645..eef29e73099b 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h @@ -94,7 +94,6 @@ #define WARNDRV(fmt, args...) LOGWRN(fmt, ## args) #define SECUREDRV(fmt, args...) LOGWRN(fmt, ## args) #define INFODRV(fmt, args...) LOGINF(fmt, ## args) -#define DEBUGDRV(fmt, args...) DBGINF(fmt, ## args) #define PRINTKDEV(devname, fmt, args...) LOGINFDEV(devname, fmt, ## args) #define TBDDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args) @@ -105,7 +104,6 @@ #define SECUREDEV(devname, fmt, args...) LOGWRNDEV(devname, fmt, ## args) #define INFODEV(devname, fmt, args...) LOGINFDEV(devname, fmt, ## args) #define INFODEVX(devno, fmt, args...) LOGINFDEVX(devno, fmt, ## args) -#define DEBUGDEV(devname, fmt, args...) DBGINFDEV(devname, fmt, ## args) /** Verifies the consistency of your PRIVATEDEVICEDATA structure using * conventional "signature" fields: diff --git a/drivers/staging/unisys/include/uniklog.h b/drivers/staging/unisys/include/uniklog.h index ecd1bdb6d097..10171a185871 100644 --- a/drivers/staging/unisys/include/uniklog.h +++ b/drivers/staging/unisys/include/uniklog.h @@ -25,45 +25,6 @@ #include -/* - * # DBGINF - * - * \brief Log debug informational message - log a LOG_INFO message only - * if DEBUG compiletime option enabled - * - * \param devname the device name of the device reporting this message, or - * NULL if this message is NOT device-related. - * \param fmt printf()-style format string containing the message to log. - * \param args Optional arguments to be formatted and inserted into the - * format string. - * \return nothing - * - * Log a message at the LOG_INFO level, but only if DEBUG is enabled. If - * DEBUG is disabled, this expands to a no-op. - */ - -/* - * # DBGVER - * - * \brief Log debug verbose message - log a LOG_DEBUG message only if - * DEBUG compiletime option enabled - * - * \param devname the device name of the device reporting this message, or - * NULL if this message is NOT device-related. - * \param fmt printf()-style format string containing the message to log. - * \param args Optional arguments to be formatted and inserted into the - * format string. - * \return nothing - * - * Log a message at the LOG_DEBUG level, but only if DEBUG is enabled. If - * DEBUG is disabled, this expands to a no-op. Note also that LOG_DEBUG - * messages can be enabled/disabled at runtime as well. - */ -#define DBGINFDEV(devname, fmt, args...) do { } while (0) -#define DBGVERDEV(devname, fmt, args...) do { } while (0) -#define DBGINF(fmt, args...) do { } while (0) -#define DBGVER(fmt, args...) do { } while (0) - /* * # LOGINF * diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 6d2432bed267..4fdddc301157 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -1161,7 +1161,6 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, /* *start = buf; */ if (debug_buf == NULL) { - DBGINF("debug_buf == NULL; allocating buffer.\n."); debug_buf = vmalloc(PROC_READ_BUFFER_SIZE); if (debug_buf == NULL) { @@ -1173,7 +1172,6 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, temp = debug_buf; if ((*offset == 0) || (!debug_buf_valid)) { - DBGINF("calling info_debugfs_read_helper.\n"); /* if the read fails, then -1 will be returned */ total_bytes = info_debugfs_read_helper(&temp, &remaining_bytes); debug_buf_valid = 1; @@ -1333,7 +1331,6 @@ static int process_incoming(void *v) idle_cycles = idle_cycles + delta_cycles; } } - DBGINF("exiting.\n"); complete_and_exit(&incoming_ti.has_stopped, 0); } @@ -1512,8 +1509,6 @@ uislib_mod_exit(void) debugfs_remove(cycles_before_wait_debugfs_read); debugfs_remove(platformnumber_debugfs_read); debugfs_remove(dir_debugfs); - - DBGINF("goodbye.\n"); } module_init(uislib_mod_init); diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c index 1ba6c15bcbe0..2fbada3471a6 100644 --- a/drivers/staging/unisys/uislib/uisutils.c +++ b/drivers/staging/unisys/uislib/uisutils.c @@ -53,7 +53,6 @@ uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining, va_list args; int len; - DBGINF("buffer = 0x%p : *buffer = 0x%p.\n", buffer, *buffer); va_start(args, format); len = vsnprintf(*buffer, *buffer_remaining, format, args); va_end(args); diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index 2ad0c1939623..a19dac12b9c0 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -26,8 +26,6 @@ * which start with an 8 digit sequence number, a colon, and then * letters after that */ -#undef DBGINF - #include #ifdef CONFIG_MODVERSIONS #include @@ -482,7 +480,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) * initialization. The host is not published to the scsi * midlayer until scsi_add_host is called. */ - DBGINF("calling scsi_host_alloc.\n"); /* arg 2 passed in length of extra space we want allocated * with scsi_host struct for our own use scsi_host_alloc @@ -493,9 +490,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) if (scsihost == NULL) return -ENODEV; - DBGINF("scsihost: 0x%p, scsihost->this_id: %d, host_no: %d.\n", - scsihost, scsihost->this_id, scsihost->host_no); - scsihost->this_id = UIS_MAGIC_VHBA; /* linux treats max-channel differently than max-id & max-lun. * In the latter cases, those two values result in 0 to max-1 @@ -527,8 +521,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) scsihost->can_queue, scsihost->cmd_per_lun, scsihost->max_sectors, scsihost->sg_tablesize); - DBGINF("calling scsi_add_host\n"); - /* this creates "host%d" in sysfs. If 2nd argument is NULL, * then this generic /sys/devices/platform/host? device is * created and /sys/scsi_host/host? -> @@ -560,9 +552,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) virthbainfo->virtpcidev = virtpcidev; spin_lock_init(&virthbainfo->chinfo.insertlock); - DBGINF("generic_dev: 0x%p, queueinfo: 0x%p.\n", - &virtpcidev->generic_dev, &virtpcidev->queueinfo); - init_waitqueue_head(&virthbainfo->rsp_queue); spin_lock_init(&virthbainfo->privlock); memset(&virthbainfo->pending, 0, sizeof(virthbainfo->pending)); @@ -584,8 +573,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) ULTRA_IO_CHANNEL_IS_POLLING, &virthbainfo->chinfo.queueinfo->chan->features); /* start thread that will receive scsicmnd responses */ - DBGINF("starting rsp thread -- queueinfo: 0x%p, threadinfo: 0x%p.\n", - virthbainfo->chinfo.queueinfo, &virthbainfo->chinfo.threadinfo); channel_header = virthbainfo->chinfo.queueinfo->chan; pqhdr = (struct signal_queue_header __iomem *) @@ -635,9 +622,7 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) rsltq_wait_usecs = 4000000; } - DBGINF("calling scsi_scan_host.\n"); scsi_scan_host(scsihost); - DBGINF("return from scsi_scan_host.\n"); LOGINF("virthba added scsihost:0x%p\n", scsihost); POSTCODE_LINUX_2(VHBA_PROBE_EXIT_PC, POSTCODE_SEVERITY_INFO); @@ -659,15 +644,10 @@ virthba_remove(struct virtpci_dev *virtpcidev) LOGINF("Removing virtpcidev: 0x%p, virthbainfo: 0x%p\n", virtpcidev, virthbainfo); - DBGINF("removing scsihost: 0x%p, scsihost->this_id: %d\n", scsihost, - scsihost->this_id); scsi_remove_host(scsihost); - DBGINF("stopping thread.\n"); uisthread_stop(&virthbainfo->chinfo.threadinfo); - DBGINF("calling scsi_host_put\n"); - /* decr refcount on scsihost which was incremented by * scsi_add_host so the scsi_host gets deleted */ @@ -689,10 +669,8 @@ forward_vdiskmgmt_command(enum vdisk_mgmt_types vdiskcmdtype, LOGINF("vDiskMgmt:%d %d:%d:%d\n", vdiskcmdtype, vdest->channel, vdest->id, vdest->lun); - if (virthbainfo->serverdown || virthbainfo->serverchangingstate) { - DBGINF("Server is down/changing state. Returning Failure.\n"); + if (virthbainfo->serverdown || virthbainfo->serverchangingstate) return FAILED; - } cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); if (cmdrsp == NULL) @@ -750,10 +728,8 @@ forward_taskmgmt_command(enum task_mgmt_types tasktype, LOGINF("TaskMgmt:%d %d:%d:%llu\n", tasktype, scsidev->channel, scsidev->id, scsidev->lun); - if (virthbainfo->serverdown || virthbainfo->serverchangingstate) { - DBGINF("Server is down/changing state. Returning Failure.\n"); + if (virthbainfo->serverdown || virthbainfo->serverchangingstate) return FAILED; - } cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); if (cmdrsp == NULL) @@ -895,7 +871,6 @@ virthba_get_info(struct Scsi_Host *shp) static int virthba_ioctl(struct scsi_device *dev, int cmd, void __user *arg) { - DBGINF("In virthba_ioctl: ioctl: cmd=0x%x\n", cmd); return -EINVAL; } @@ -919,11 +894,8 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, struct scatterlist *sgl = NULL; int sg_failed = 0; - if (virthbainfo->serverdown || virthbainfo->serverchangingstate) { - DBGINF("Server is down/changing state. Returning SCSI_MLQUEUE_DEVICE_BUSY.\n"); + if (virthbainfo->serverdown || virthbainfo->serverchangingstate) return SCSI_MLQUEUE_DEVICE_BUSY; - } - cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); if (cmdrsp == NULL) return 1; /* reject the command */ @@ -979,8 +951,6 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, LOGERR("**** FAILED No scatter list for bufflen > 0\n"); BUG_ON(scsi_sg_count(scsicmd) == 0); } - DBGINF("No sg; buffer:0x%p bufflen:%d\n", - scsi_sglist(scsicmd), scsi_bufflen(scsicmd)); } else { /* buffer is scatterlist - copy it out */ sgl = scsi_sglist(scsicmd); @@ -1191,8 +1161,6 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) sg = scsi_sglist(scsicmd); for (i = 0; i < scsi_sg_count(scsicmd); i++) { - DBGVER("copying OUT OF buf into 0x%p %d\n", - sg_page(sg + i), sg[i].length); thispage_orig = kmap_atomic(sg_page(sg + i)); thispage = (void *)((unsigned long)thispage_orig | sg[i].offset); @@ -1222,8 +1190,6 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) static void complete_scsi_command(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) { - DBGINF("cmdrsp: 0x%p, scsistat:0x%x.\n", cmdrsp, cmdrsp->scsi.scsistat); - /* take what we need out of cmdrsp and complete the scsicmd */ scsicmd->result = cmdrsp->scsi.linuxstat; if (cmdrsp->scsi.linuxstat) @@ -1231,10 +1197,8 @@ complete_scsi_command(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) else do_scsi_nolinuxstat(cmdrsp, scsicmd); - if (scsicmd->scsi_done) { - DBGVER("Scsi_DONE\n"); + if (scsicmd->scsi_done) scsicmd->scsi_done(scsicmd); - } } static inline void @@ -1352,7 +1316,6 @@ process_incoming_rsps(void *v) kfree(cmdrsp); - DBGINF("exiting processing incoming rsps.\n"); complete_and_exit(&dc->threadinfo.has_stopped, 0); } @@ -1475,13 +1438,9 @@ virthba_serverup(struct virtpci_dev *virtpcidev) (struct virthba_info *)((struct Scsi_Host *)virtpcidev->scsi. scsihost)->hostdata; - DBGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, - virtpcidev->device_no); - - if (!virthbainfo->serverdown) { - DBGINF("Server up message received while server is already up.\n"); + if (!virthbainfo->serverdown) return 1; - } + if (virthbainfo->serverchangingstate) { LOGERR("Server already processing change state message\n"); return 0; @@ -1540,12 +1499,10 @@ virthba_serverdown_complete(struct work_struct *work) break; case CMD_SCSITASKMGMT_TYPE: cmdrsp = (struct uiscmdrsp *)pendingdel->sent; - DBGINF("cmdrsp=0x%x, notify=0x%x\n", cmdrsp, - cmdrsp->scsitaskmgmt.notify); - *(int *)cmdrsp->scsitaskmgmt.notifyresult = - TASK_MGMT_FAILED; wake_up_all((wait_queue_head_t *) cmdrsp->scsitaskmgmt.notify); + *(int *)cmdrsp->scsitaskmgmt.notifyresult = + TASK_MGMT_FAILED; break; case CMD_VDISKMGMT_TYPE: cmdrsp = (struct uiscmdrsp *)pendingdel->sent; @@ -1566,8 +1523,6 @@ virthba_serverdown_complete(struct work_struct *work) virtpcidev = virthbainfo->virtpcidev; - DBGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, - virtpcidev->device_no); virthbainfo->serverdown = true; virthbainfo->serverchangingstate = false; /* Return the ServerDown response to Command */ @@ -1585,10 +1540,6 @@ virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state) (struct virthba_info *)((struct Scsi_Host *)virtpcidev->scsi. scsihost)->hostdata; - DBGINF("virthba_serverdown"); - DBGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, - virtpcidev->device_no); - if (!virthbainfo->serverdown && !virthbainfo->serverchangingstate) { virthbainfo->serverchangingstate = true; queue_work(virthba_serverdown_workqueue, @@ -1610,7 +1561,6 @@ virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state) static int __init virthba_parse_line(char *str) { - DBGINF("In virthba_parse_line %s\n", str); return 1; } @@ -1626,8 +1576,7 @@ virthba_parse_options(char *line) next = strchr(line, ' '); if (next != NULL) *next++ = 0; - if (!virthba_parse_line(line)) - DBGINF("Unknown option '%s'\n", line); + virthba_parse_line(line); } POSTCODE_LINUX_2(VHBA_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO); diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index edaf43f5a77d..a20af632c38a 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -708,9 +708,6 @@ virtpci_match_device(const struct pci_device_id *ids, const struct virtpci_dev *dev) { while (ids->vendor || ids->subvendor || ids->class_mask) { - DBGINF("ids->vendor:%x dev->vendor:%x ids->device:%x dev->device:%x\n", - ids->vendor, dev->vendor, ids->device, dev->device); - if ((ids->vendor == dev->vendor) && (ids->device == dev->device)) return ids; @@ -731,20 +728,15 @@ static int virtpci_bus_match(struct device *dev, struct device_driver *drv) struct virtpci_driver *virtpcidrv = driver_to_virtpci_driver(drv); int match = 0; - DBGINF("In virtpci_bus_match dev->bus_id:%s drv->name:%s\n", - dev->bus_id, drv->name); - /* check ids list for a match */ if (virtpci_match_device(virtpcidrv->id_table, virtpcidev)) match = 1; - DBGINF("returning match:%d\n", match); return match; /* 0 - no match; 1 - yes it matches */ } static int virtpci_uevent(struct device *dev, struct kobj_uevent_env *env) { - DBGINF("In virtpci_hotplug\n"); /* add variables to the environment prior to the generation of * hotplug events to user space */ @@ -876,10 +868,7 @@ static int virtpci_device_remove(struct device *dev_) virtpcidev->mydriver = NULL; } - DBGINF("calling putdevice\n"); put_device(dev_); - - DBGINF("Leaving\n"); return 0; } @@ -889,11 +878,6 @@ static int virtpci_device_remove(struct device *dev_) static void virtpci_bus_release(struct device *dev) { - /* this function is called when the last reference to the - * device is removed - */ - DBGINF("In virtpci_bus_release\n"); - /* what else is supposed to happen here? */ } /*****************************************************/ @@ -1023,8 +1007,6 @@ static int virtpci_device_add(struct device *parentbus, int devtype, * list. Otherwise, a device_unregister from this function can * cause a "scheduling while atomic". */ - DBGINF("registering device:%p with bus_id:%s\n", - &virtpcidev->generic_dev, virtpcidev->generic_dev.bus_id); ret = device_register(&virtpcidev->generic_dev); /* NOTE: THIS IS CALLING HOTPLUG virtpci_hotplug!!! * This call to device_register results in virtpci_bus_match @@ -1323,8 +1305,6 @@ static ssize_t virtpci_driver_attr_show(struct kobject *kobj, struct driver_private *dprivate = to_driver(kobj); struct device_driver *driver = dprivate->driver; - DBGINF("In virtpci_driver_attr_show driver->name:%s\n", driver->name); - if (dattr->show) ret = dattr->show(driver, buf); @@ -1341,8 +1321,6 @@ static ssize_t virtpci_driver_attr_store(struct kobject *kobj, struct driver_private *dprivate = to_driver(kobj); struct device_driver *driver = dprivate->driver; - DBGINF("In virtpci_driver_attr_store driver->name:%s\n", driver->name); - if (dattr->store) ret = dattr->store(driver, buf, count); @@ -1354,8 +1332,6 @@ int virtpci_register_driver(struct virtpci_driver *drv) { int result = 0; - DBGINF("In virtpci_register_driver\n"); - if (drv->id_table == NULL) { LOGERR("id_table missing\n"); return 1; @@ -1388,7 +1364,6 @@ EXPORT_SYMBOL_GPL(virtpci_register_driver); void virtpci_unregister_driver(struct virtpci_driver *drv) { - DBGINF("In virtpci_unregister_driver drv:%p\n", drv); driver_unregister(&drv->core_driver); /* driver_unregister calls bus_remove_driver * bus_remove_driver calls device_detach @@ -1398,7 +1373,6 @@ void virtpci_unregister_driver(struct virtpci_driver *drv) * virtpci_device_remove * virtpci_device_remove calls virthba_remove */ - DBGINF("Leaving\n"); } EXPORT_SYMBOL_GPL(virtpci_unregister_driver); @@ -1511,7 +1485,6 @@ static int __init virtpci_mod_init(void) POSTCODE_SEVERITY_ERR); return ret; } - DBGINF("bus_register successful\n"); bus_device_info_init(&bus_driver_info, "clientbus", "virtpci", VERSION, NULL); @@ -1524,7 +1497,6 @@ static int __init virtpci_mod_init(void) POSTCODE_SEVERITY_ERR); return ret; } - DBGINF("device_register successful ret:%x\n", ret); if (!uisctrl_register_req_handler(2, (void *)&virtpci_ctrlchan_func, &chipset_driver_info)) { diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index b2b1b619c0b4..f580fb6f1ee0 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -106,7 +106,6 @@ visorchipset_open(struct inode *inode, struct file *file) { unsigned minor_number = iminor(inode); - DEBUGDRV("%s", __func__); if (minor_number != 0) return -ENODEV; file->private_data = NULL; @@ -116,7 +115,6 @@ visorchipset_open(struct inode *inode, struct file *file) static int visorchipset_release(struct inode *inode, struct file *file) { - DEBUGDRV("%s", __func__); return 0; } @@ -128,7 +126,6 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma) GUEST_PHYSICAL_ADDRESS addr = 0; /* sv_enable_dfp(); */ - DEBUGDRV("%s", __func__); if (offset & (PAGE_SIZE - 1)) { ERRDRV("%s virtual address NOT page-aligned!", __func__); return -ENXIO; /* need aligned offsets */ @@ -149,7 +146,6 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma) return -ENXIO; } physaddr = (ulong)addr; - DEBUGDRV("mapping physical address = 0x%lx", physaddr); if (remap_pfn_range(vma, vma->vm_start, physaddr >> PAGE_SHIFT, vma->vm_end - vma->vm_start, @@ -162,7 +158,6 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma) default: return -ENOSYS; } - DEBUGDRV("%s success!", __func__); return 0; } @@ -172,7 +167,6 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd, s64 adjustment; s64 vrtc_offset; - DBGINF("entered visorchipset_ioctl, cmd=%d", cmd); switch (cmd) { case VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET: /* get the physical rtc offset */ @@ -181,16 +175,12 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd, ((void __user *)arg, &vrtc_offset, sizeof(vrtc_offset))) { return -EFAULT; } - DBGINF("insde visorchipset_ioctl, cmd=%d, vrtc_offset=%lld", - cmd, vrtc_offset); return SUCCESS; case VMCALL_UPDATE_PHYSICAL_TIME: if (copy_from_user (&adjustment, (void __user *)arg, sizeof(adjustment))) { return -EFAULT; } - DBGINF("insde visorchipset_ioctl, cmd=%d, adjustment=%lld", cmd, - adjustment); return issue_vmcall_update_physical_time(adjustment); default: LOGERR("visorchipset_ioctl received invalid command"); -- cgit v1.2.3 From 2098dbd1b2a8e428001e0d075ae148124af6f57d Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Wed, 4 Mar 2015 12:14:22 -0500 Subject: staging: unisys: remove LOGINF macros Remove the LOGINF, LOGINFDEV, LOGINFDEVX, LOGINFNAME, PRINTKDRV, and INFODRV macros entirely from the driver set. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/timskmod.h | 2 - drivers/staging/unisys/include/uniklog.h | 29 ------- drivers/staging/unisys/uislib/uislib.c | 31 -------- drivers/staging/unisys/uislib/uisthread.c | 5 -- drivers/staging/unisys/uislib/uisutils.c | 2 - drivers/staging/unisys/virthba/virthba.c | 54 ------------- drivers/staging/unisys/virtpci/virtpci.c | 89 +--------------------- .../unisys/visorchannel/visorchannel_main.c | 2 - drivers/staging/unisys/visorchipset/file.c | 4 - .../unisys/visorchipset/visorchipset_main.c | 78 +------------------ 10 files changed, 5 insertions(+), 291 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index eef29e73099b..ff0fc167413c 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h @@ -87,13 +87,11 @@ (void *)(p2) = SWAPPOINTERS_TEMP; \ } while (0) -#define PRINTKDRV(fmt, args...) LOGINF(fmt, ## args) #define TBDDRV(fmt, args...) LOGERR(fmt, ## args) #define HUHDRV(fmt, args...) LOGERR(fmt, ## args) #define ERRDRV(fmt, args...) LOGERR(fmt, ## args) #define WARNDRV(fmt, args...) LOGWRN(fmt, ## args) #define SECUREDRV(fmt, args...) LOGWRN(fmt, ## args) -#define INFODRV(fmt, args...) LOGINF(fmt, ## args) #define PRINTKDEV(devname, fmt, args...) LOGINFDEV(devname, fmt, ## args) #define TBDDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args) diff --git a/drivers/staging/unisys/include/uniklog.h b/drivers/staging/unisys/include/uniklog.h index 10171a185871..e3c374cfe26e 100644 --- a/drivers/staging/unisys/include/uniklog.h +++ b/drivers/staging/unisys/include/uniklog.h @@ -25,35 +25,6 @@ #include -/* - * # LOGINF - * - * \brief Log informational message - logs a message at the LOG_INFO level - * - * \param devname the device name of the device reporting this message, or - * NULL if this message is NOT device-related. - * \param fmt printf()-style format string containing the message to log. - * \param args Optional arguments to be formatted and inserted into the - * format string. - * \return nothing - * - * Logs the specified message at the LOG_INFO level. - */ - -#define LOGINF(fmt, args...) pr_info(fmt, ## args) -#define LOGINFDEV(devname, fmt, args...) \ - pr_info("%s " fmt, devname, ## args) -#define LOGINFDEVX(devno, fmt, args...) \ - pr_info("dev%d " fmt, devno, ## args) -#define LOGINFNAME(vnic, fmt, args...) \ - do { \ - if (vnic != NULL) { \ - pr_info("%s " fmt, vnic->name, ## args); \ - } else { \ - pr_info(fmt, ## args); \ - } \ - } while (0) - /* * # LOGVER * diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 4fdddc301157..93b471412bd5 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -671,8 +671,6 @@ static int destroy_device(struct controlvm_message *msg, char *buf) dev_no = msg->cmd.destroy_device.bus_no; read_lock(&bus_list_lock); - LOGINF("destroy_device called for bus_no=%u, dev_no=%u", bus_no, - dev_no); for (bus = bus_list; bus; bus = bus->next) { if (bus->bus_no == bus_no) { /* make sure the device number is valid */ @@ -733,12 +731,10 @@ static int destroy_device(struct controlvm_message *msg, char *buf) * kernel paging request" */ if (dev->polling) { - LOGINF("calling uislib_disable_channel_interrupts"); uislib_disable_channel_interrupts(bus_no, dev_no); } /* unmap the channel memory for the device. */ if (!msg->hdr.flags.test_message) { - LOGINF("destroy_device, doing iounmap"); uislib_iounmap(dev->chanptr); } kfree(dev); @@ -806,7 +802,6 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, { struct controlvm_message msg; - LOGINF("enter busNo=0x%x\n", bus_no); /* step 0: init the chipset */ POSTCODE_LINUX_3(CHIPSET_INIT_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO); @@ -826,7 +821,6 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, LOGERR("init_chipset failed.\n"); return 0; } - LOGINF("chipset initialized\n"); POSTCODE_LINUX_3(CHIPSET_INIT_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO); } @@ -906,7 +900,6 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, { struct controlvm_message msg; - LOGINF(" enter busNo=0x%x devNo=0x%x\n", bus_no, dev_no); /* chipset init'ed with bus bus has been previously created - * Verify it still exists step 2: create the VHBA device on the * bus @@ -965,7 +958,6 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, { struct controlvm_message msg; - LOGINF(" enter busNo=0x%x devNo=0x%x\n", bus_no, dev_no); /* chipset init'ed with bus bus has been previously created - * Verify it still exists step 2: create the VNIC device on the * bus @@ -1249,7 +1241,6 @@ static int process_incoming(void *v) wait_cycles = (cur_cycles - old_cycles); } } - LOGINF("wait_cycles=%llu", wait_cycles); cycles_before_wait = wait_cycles; idle_cycles = 0; poll_dev_start = 0; @@ -1310,7 +1301,6 @@ static int process_incoming(void *v) if (kthread_should_stop()) break; if (en_smart_wakeup == 0xFF) { - LOGINF("en_smart_wakeup set to 0xff, to force exiting process_incoming"); break; } /* wait for POLLJIFFIES_NORMAL jiffies, or until @@ -1441,27 +1431,6 @@ uislib_mod_init(void) if (!unisys_spar_platform) return -ENODEV; - LOGINF("MONITORAPIS"); - - LOGINF("sizeof(struct uiscmdrsp):%lu bytes\n", - (ulong)sizeof(struct uiscmdrsp)); - LOGINF("sizeof(struct phys_info):%lu\n", - (ulong)sizeof(struct phys_info)); - LOGINF("sizeof(uiscmdrsp_scsi):%lu\n", - (ulong)sizeof(struct uiscmdrsp_scsi)); - LOGINF("sizeof(uiscmdrsp_net):%lu\n", - (ulong)sizeof(struct uiscmdrsp_net)); - LOGINF("sizeof(CONTROLVM_MESSAGE):%lu bytes\n", - (ulong)sizeof(struct controlvm_message)); - LOGINF("sizeof(struct spar_controlvm_channel_protocol):%lu bytes\n", - (ulong)sizeof(struct spar_controlvm_channel_protocol)); - LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n", - (ulong)sizeof(struct channel_header)); - LOGINF("sizeof(struct spar_io_channel_protocol):%lu bytes\n", - (ulong)sizeof(struct spar_io_channel_protocol)); - LOGINF("SIZEOF_CMDRSP:%lu bytes\n", SIZEOF_CMDRSP); - LOGINF("SIZEOF_PROTOCOL:%lu bytes\n", SIZEOF_PROTOCOL); - /* initialize global pointers to NULL */ bus_list = NULL; bus_list_count = 0; diff --git a/drivers/staging/unisys/uislib/uisthread.c b/drivers/staging/unisys/uislib/uisthread.c index d54005d8f50d..5b0041c4a137 100644 --- a/drivers/staging/unisys/uislib/uisthread.c +++ b/drivers/staging/unisys/uislib/uisthread.c @@ -47,7 +47,6 @@ uisthread_start(struct uisthread_info *thrinfo, return 0; /* failure */ } thrinfo->id = thrinfo->task->pid; - LOGINF("started thread pid:%d\n", thrinfo->id); return 1; } EXPORT_SYMBOL_GPL(uisthread_start); @@ -60,16 +59,12 @@ uisthread_stop(struct uisthread_info *thrinfo) if (thrinfo->id == 0) return; /* thread not running */ - LOGINF("uisthread_stop stopping id:%d\n", thrinfo->id); kthread_stop(thrinfo->task); /* give up if the thread has NOT died in 1 minute */ if (wait_for_completion_timeout(&thrinfo->has_stopped, 60 * HZ)) stopped = 1; - else - LOGERR("timed out trying to signal thread\n"); if (stopped) { - LOGINF("uisthread_stop stopped id:%d\n", thrinfo->id); thrinfo->id = 0; } } diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c index 2fbada3471a6..7d7f408505f2 100644 --- a/drivers/staging/unisys/uislib/uisutils.c +++ b/drivers/staging/unisys/uislib/uisutils.c @@ -74,8 +74,6 @@ int uisctrl_register_req_handler(int type, void *fptr, struct ultra_vbus_deviceinfo *chipset_driver_info) { - LOGINF("type = %d, fptr = 0x%p.\n", type, fptr); - switch (type) { case 2: if (fptr) { diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index a19dac12b9c0..5ec2423a4138 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -469,9 +469,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) LOGVER("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, virtpcidev->device_no); - LOGINF("entering virthba_probe...\n"); - LOGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, - virtpcidev->device_no); POSTCODE_LINUX_2(VHBA_PROBE_ENTRY_PC, POSTCODE_SEVERITY_INFO); /* call scsi_host_alloc to register a scsi host adapter * instance - this virthba that has just been created is an @@ -497,12 +494,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) * scan is 0 to max (inclusive); so we will subtract one from * the max-channel value. */ - LOGINF("virtpcidev->scsi.max.max_channel=%u, max_id=%u, max_lun=%u, cmd_per_lun=%u, max_io_size=%u\n", - (unsigned)virtpcidev->scsi.max.max_channel - 1, - (unsigned)virtpcidev->scsi.max.max_id, - (unsigned)virtpcidev->scsi.max.max_lun, - (unsigned)virtpcidev->scsi.max.cmd_per_lun, - (unsigned)virtpcidev->scsi.max.max_io_size); scsihost->max_channel = (unsigned)virtpcidev->scsi.max.max_channel; scsihost->max_id = (unsigned)virtpcidev->scsi.max.max_id; scsihost->max_lun = (unsigned)virtpcidev->scsi.max.max_lun; @@ -513,13 +504,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) (unsigned short)(virtpcidev->scsi.max.max_io_size / PAGE_SIZE); if (scsihost->sg_tablesize > MAX_PHYS_INFO) scsihost->sg_tablesize = MAX_PHYS_INFO; - LOGINF("scsihost->max_channel=%u, max_id=%u, max_lun=%llu, cmd_per_lun=%u, max_sectors=%hu, sg_tablesize=%hu\n", - scsihost->max_channel, scsihost->max_id, scsihost->max_lun, - scsihost->cmd_per_lun, scsihost->max_sectors, - scsihost->sg_tablesize); - LOGINF("scsihost->can_queue=%u, scsihost->cmd_per_lun=%u, max_sectors=%hu, sg_tablesize=%hu\n", - scsihost->can_queue, scsihost->cmd_per_lun, scsihost->max_sectors, - scsihost->sg_tablesize); /* this creates "host%d" in sysfs. If 2nd argument is NULL, * then this generic /sys/devices/platform/host? device is @@ -591,15 +575,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) scsi_host_put(scsihost); return -ENODEV; } - LOGINF("sendInterruptHandle=0x%16llX", - virthbainfo->intr.send_irq_handle); - LOGINF("recvInterruptHandle=0x%16llX", - virthbainfo->intr.recv_irq_handle); - LOGINF("recvInterruptVector=0x%8X", - virthbainfo->intr.recv_irq_vector); - LOGINF("recvInterruptShared=0x%2X", - virthbainfo->intr.recv_irq_shared); - LOGINF("scsihost.hostt->name=%s", scsihost->hostt->name); virthbainfo->interrupt_vector = virthbainfo->intr.recv_irq_handle & INTERRUPT_VECTOR_MASK; rsp = request_irq(virthbainfo->interrupt_vector, handler, IRQF_SHARED, @@ -624,7 +599,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) scsi_scan_host(scsihost); - LOGINF("virthba added scsihost:0x%p\n", scsihost); POSTCODE_LINUX_2(VHBA_PROBE_EXIT_PC, POSTCODE_SEVERITY_INFO); return 0; } @@ -636,13 +610,9 @@ virthba_remove(struct virtpci_dev *virtpcidev) struct Scsi_Host *scsihost = (struct Scsi_Host *)virtpcidev->scsi.scsihost; - LOGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, - virtpcidev->device_no); virthbainfo = (struct virthba_info *)scsihost->hostdata; if (virthbainfo->interrupt_vector != -1) free_irq(virthbainfo->interrupt_vector, virthbainfo); - LOGINF("Removing virtpcidev: 0x%p, virthbainfo: 0x%p\n", virtpcidev, - virthbainfo); scsi_remove_host(scsihost); @@ -652,7 +622,6 @@ virthba_remove(struct virtpci_dev *virtpcidev) * scsi_add_host so the scsi_host gets deleted */ scsi_host_put(scsihost); - LOGINF("virthba removed scsi_host.\n"); } static int @@ -666,9 +635,6 @@ forward_vdiskmgmt_command(enum vdisk_mgmt_types vdiskcmdtype, int notifyresult = 0xffff; wait_queue_head_t notifyevent; - LOGINF("vDiskMgmt:%d %d:%d:%d\n", vdiskcmdtype, - vdest->channel, vdest->id, vdest->lun); - if (virthbainfo->serverdown || virthbainfo->serverchangingstate) return FAILED; @@ -703,10 +669,7 @@ forward_vdiskmgmt_command(enum vdisk_mgmt_types vdiskcmdtype, &virthbainfo->chinfo.insertlock, DONT_ISSUE_INTERRUPT, (u64)NULL, OK_TO_WAIT, "vhba"); - LOGINF("VdiskMgmt waiting on event notifyevent=0x%p\n", - cmdrsp->scsitaskmgmt.notify); wait_event(notifyevent, notifyresult != 0xffff); - LOGINF("VdiskMgmt complete; result:%d\n", cmdrsp->vdiskmgmt.result); kfree(cmdrsp); return SUCCESS; } @@ -725,9 +688,6 @@ forward_taskmgmt_command(enum task_mgmt_types tasktype, int notifyresult = 0xffff; wait_queue_head_t notifyevent; - LOGINF("TaskMgmt:%d %d:%d:%llu\n", tasktype, - scsidev->channel, scsidev->id, scsidev->lun); - if (virthbainfo->serverdown || virthbainfo->serverchangingstate) return FAILED; @@ -761,10 +721,7 @@ forward_taskmgmt_command(enum task_mgmt_types tasktype, &virthbainfo->chinfo.insertlock, DONT_ISSUE_INTERRUPT, (u64)NULL, OK_TO_WAIT, "vhba"); - LOGINF("TaskMgmt waiting on event notifyevent=0x%p\n", - cmdrsp->scsitaskmgmt.notify); wait_event(notifyevent, notifyresult != 0xffff); - LOGINF("TaskMgmt complete; result:%d\n", cmdrsp->scsitaskmgmt.result); kfree(cmdrsp); return SUCCESS; } @@ -958,9 +915,6 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, for_each_sg(sgl, sg, scsi_sg_count(scsicmd), i) { cmdrsp->scsi.gpi_list[i].address = sg_phys(sg); cmdrsp->scsi.gpi_list[i].length = sg->length; - if ((i != 0) && (sg->offset != 0)) - LOGINF("Offset on a sg_entry other than zero =<<%d>>.\n", - sg->offset); } if (sg_failed) { @@ -1208,7 +1162,6 @@ complete_vdiskmgmt_command(struct uiscmdrsp *cmdrsp) /* wake up the error handler that is waiting for this */ *(int *)cmdrsp->vdiskmgmt.notifyresult = cmdrsp->vdiskmgmt.result; wake_up_all((wait_queue_head_t *)cmdrsp->vdiskmgmt.notify); - LOGINF("set notify result to %d\n", cmdrsp->vdiskmgmt.result); } static inline void @@ -1219,7 +1172,6 @@ complete_taskmgmt_command(struct uiscmdrsp *cmdrsp) *(int *)cmdrsp->scsitaskmgmt.notifyresult = cmdrsp->scsitaskmgmt.result; wake_up_all((wait_queue_head_t *)cmdrsp->scsitaskmgmt.notify); - LOGINF("set notify result to %d\n", cmdrsp->scsitaskmgmt.result); } static void @@ -1591,8 +1543,6 @@ virthba_mod_init(void) if (!unisys_spar_platform) return -ENODEV; - LOGINF("Entering virthba_mod_init...\n"); - POSTCODE_LINUX_2(VHBA_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); virthba_parse_options(virthba_options); @@ -1630,7 +1580,6 @@ virthba_mod_init(void) } POSTCODE_LINUX_2(VHBA_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO); - LOGINF("Leaving virthba_mod_init\n"); return error; } @@ -1680,8 +1629,6 @@ static DEVICE_ATTRIBUTE *virthba_shost_attrs[] = { static void __exit virthba_mod_exit(void) { - LOGINF("entering virthba_mod_exit...\n"); - virtpci_unregister_driver(&virthba_driver); /* unregister is going to call virthba_remove */ /* destroy serverdown completion workqueue */ @@ -1691,7 +1638,6 @@ virthba_mod_exit(void) } debugfs_remove_recursive(virthba_debugfs_dir); - LOGINF("Leaving virthba_mod_exit\n"); } /* specify function to be run at module insertion time */ diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index a20af632c38a..d87ebcc615d4 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -279,8 +279,6 @@ static int add_vbus(struct add_vbus_guestpart *addparams) &chipset_driver_info); write_vbus_bus_info(vbus->platform_data /* chanptr */, &bus_driver_info); - LOGINF("Added vbus %d; device %s created successfully\n", - addparams->bus_no, BUS_ID(vbus)); POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO); return 1; } @@ -328,14 +326,8 @@ static int add_vhba(struct add_virt_guestpart *addparams) return 0; } - LOGINF("Adding vhba wwnn:%x:%x config:%d-%d-%d-%d chanptr:%p\n", - scsi.wwnn.wwnn1, scsi.wwnn.wwnn2, - scsi.max.max_channel, scsi.max.max_id, scsi.max.max_lun, - scsi.max.cmd_per_lun, addparams->chanptr); i = virtpci_device_add(vbus, VIRTHBA_TYPE, addparams, &scsi, NULL); if (i) { - LOGINF("Added vhba wwnn:%x:%x chanptr:%p\n", scsi.wwnn.wwnn1, - scsi.wwnn.wwnn2, addparams->chanptr); POSTCODE_LINUX_3(VPCI_CREATE_EXIT_PC, i, POSTCODE_SEVERITY_INFO); } @@ -391,15 +383,8 @@ add_vnic(struct add_virt_guestpart *addparams) return 0; } - LOGINF("Adding vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x rcvbufs:%d mtu:%d chanptr:%p%pUL\n", - net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], - net.mac_addr[3], net.mac_addr[4], net.mac_addr[5], - net.num_rcv_bufs, net.mtu, addparams->chanptr, &net.zone_uuid); i = virtpci_device_add(vbus, VIRTNIC_TYPE, addparams, NULL, &net); if (i) { - LOGINF("Added vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x\n", - net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], - net.mac_addr[3], net.mac_addr[4], net.mac_addr[5]); POSTCODE_LINUX_3(VPCI_CREATE_EXIT_PC, i, POSTCODE_SEVERITY_INFO); return 1; @@ -426,10 +411,6 @@ delete_vbus(struct del_vbus_guestpart *delparams) } /* ensure that bus has no devices? -- TBD */ - LOGINF("Deleting %s\n", BUS_ID(vbus)); - if (delete_vbus_device(vbus, NULL)) - return 0; /* failure */ - LOGINF("Deleted vbus %d\n", delparams->bus_no); return 1; } @@ -441,13 +422,10 @@ delete_vbus_device(struct device *vbus, void *data) if ((checkforroot) && match_busid(vbus, (void *)BUS_ID(dev))) { /* skip it - don't delete root bus */ - LOGINF("skipping root bus\n"); return 0; /* pretend no error */ } - LOGINF("Calling unregister for %s\n", BUS_ID(vbus)); device_unregister(vbus); kfree(vbus); - LOGINF("VBus unregister and freed\n"); return 0; /* no error */ } @@ -461,12 +439,8 @@ static int pause_vhba(struct pause_virt_guestpart *pauseparams) GET_SCSIADAPINFO_FROM_CHANPTR(pauseparams->chanptr); - LOGINF("Pausing vhba wwnn:%x:%x\n", scsi.wwnn.wwnn1, scsi.wwnn.wwnn2); i = virtpci_device_serverdown(NULL /*no parent bus */, VIRTHBA_TYPE, &scsi.wwnn, NULL); - if (i) - LOGINF("Paused vhba wwnn:%x:%x\n", scsi.wwnn.wwnn1, - scsi.wwnn.wwnn2); return i; } @@ -480,16 +454,8 @@ static int pause_vnic(struct pause_virt_guestpart *pauseparams) GET_NETADAPINFO_FROM_CHANPTR(pauseparams->chanptr); - LOGINF("Pausing vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x\n", - net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], - net.mac_addr[3], net.mac_addr[4], net.mac_addr[5]); i = virtpci_device_serverdown(NULL /*no parent bus */, VIRTNIC_TYPE, NULL, net.mac_addr); - if (i) { - LOGINF(" Paused vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x\n", - net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], - net.mac_addr[3], net.mac_addr[4], net.mac_addr[5]); - } return i; } @@ -503,12 +469,8 @@ static int resume_vhba(struct resume_virt_guestpart *resumeparams) GET_SCSIADAPINFO_FROM_CHANPTR(resumeparams->chanptr); - LOGINF("Resuming vhba wwnn:%x:%x\n", scsi.wwnn.wwnn1, scsi.wwnn.wwnn2); i = virtpci_device_serverup(NULL /*no parent bus */, VIRTHBA_TYPE, &scsi.wwnn, NULL); - if (i) - LOGINF("Resumed vhba wwnn:%x:%x\n", scsi.wwnn.wwnn1, - scsi.wwnn.wwnn2); return i; } @@ -523,16 +485,8 @@ resume_vnic(struct resume_virt_guestpart *resumeparams) GET_NETADAPINFO_FROM_CHANPTR(resumeparams->chanptr); - LOGINF("Resuming vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x\n", - net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], - net.mac_addr[3], net.mac_addr[4], net.mac_addr[5]); i = virtpci_device_serverup(NULL /*no parent bus */, VIRTNIC_TYPE, NULL, net.mac_addr); - if (i) { - LOGINF(" Resumed vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x\n", - net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], - net.mac_addr[3], net.mac_addr[4], net.mac_addr[5]); - } return i; } @@ -546,12 +500,9 @@ static int delete_vhba(struct del_virt_guestpart *delparams) GET_SCSIADAPINFO_FROM_CHANPTR(delparams->chanptr); - LOGINF("Deleting vhba wwnn:%x:%x\n", scsi.wwnn.wwnn1, scsi.wwnn.wwnn2); i = virtpci_device_del(NULL /*no parent bus */, VIRTHBA_TYPE, &scsi.wwnn, NULL); if (i) { - LOGINF("Deleted vhba wwnn:%x:%x\n", scsi.wwnn.wwnn1, - scsi.wwnn.wwnn2); return 1; } return 0; @@ -567,23 +518,13 @@ static int delete_vnic(struct del_virt_guestpart *delparams) GET_NETADAPINFO_FROM_CHANPTR(delparams->chanptr); - LOGINF("Deleting vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x\n", - net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], - net.mac_addr[3], net.mac_addr[4], net.mac_addr[5]); i = virtpci_device_del(NULL /*no parent bus */, VIRTNIC_TYPE, NULL, net.mac_addr); - if (i) { - LOGINF("Deleted vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x\n", - net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], - net.mac_addr[3], net.mac_addr[4], net.mac_addr[5]); - } return i; } #define DELETE_ONE_VPCIDEV(vpcidev) { \ - LOGINF("calling device_unregister:%p\n", &vpcidev->generic_dev); \ device_unregister(&vpcidev->generic_dev); \ - LOGINF("Deleted %p\n", vpcidev); \ kfree(vpcidev); \ } @@ -610,12 +551,10 @@ static void delete_all(void) tmpvpcidev = nextvpcidev; count++; } - LOGINF("Deleted %d vhbas/vnics.\n", count); /* now delete each vbus */ - if (bus_for_each_dev - (&virtpci_bus_type, NULL, (void *)1, delete_vbus_device)) - LOGERR("delete of all vbus failed\n"); + bus_for_each_dev(&virtpci_bus_type, NULL, (void *)1, + delete_vbus_device); } /* deletes all vnics or vhbas @@ -643,13 +582,8 @@ static int delete_all_virt(enum virtpci_dev_type devtype, return 0; } - LOGINF("Deleting all %s in vbus %s\n", - devtype == VIRTHBA_TYPE ? "vhbas" : "vnics", busid); /* delete all vhbas/vnics */ i = virtpci_device_del(vbus, devtype, NULL, NULL); - if (i > 0) - LOGINF("Deleted %d %s\n", i, - devtype == VIRTHBA_TYPE ? "vhbas" : "vnics"); return 1; } @@ -812,8 +746,6 @@ static int virtpci_device_probe(struct device *dev) const struct pci_device_id *id; int error = 0; - LOGINF("In virtpci_device_probe dev:%p virtpcidev:%p virtpcidrv:%p\n", - dev, virtpcidev, virtpcidrv); /* VERBOSE/DEBUG ? */ POSTCODE_LINUX_2(VPCI_PROBE_ENTRY_PC, POSTCODE_SEVERITY_INFO); /* static match and static probe vs dynamic match & dynamic * probe - do we care?. @@ -858,9 +790,6 @@ static int virtpci_device_remove(struct device *dev_) struct virtpci_dev *virtpcidev = device_to_virtpci_dev(dev_); struct virtpci_driver *virtpcidrv = virtpcidev->mydriver; - LOGINF("In virtpci_device_remove bus_id:%s dev_:%p virtpcidev:%p dev->driver:%p drivername:%s\n", - BUS_ID(dev_), dev_, virtpcidev, dev_->driver, - dev_->driver->name); /* VERBOSE/DEBUG */ if (virtpcidrv) { /* TEMP: assuming we have only one such driver for now */ if (virtpcidrv->remove) @@ -899,9 +828,6 @@ static int virtpci_device_add(struct device *parentbus, int devtype, struct spar_io_channel_protocol __iomem *io_chan = NULL; struct device *dev; - LOGINF("virtpci_device_add parentbus:%p chanptr:%p\n", parentbus, - addparams->chanptr); - POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) { @@ -1041,10 +967,6 @@ static int virtpci_device_add(struct device *parentbus, int devtype, return 0; } - LOGINF("Added %s:%d:%d &virtpcidev->generic_dev:%p\n", - (devtype == VIRTHBA_TYPE) ? "virthba" : "virtnic", - addparams->bus_no, addparams->device_no, - &virtpcidev->generic_dev); POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO); return 1; } @@ -1284,7 +1206,6 @@ static void virtpci_device_release(struct device *dev_) /* this function is called when the last reference to the * device is removed */ - LOGINF("In virtpci_device_release:%p - NOT YET IMPLEMENTED\n", dev_); } /*****************************************************/ @@ -1507,21 +1428,16 @@ static int __init virtpci_mod_init(void) return -1; } - LOGINF("successfully registered virtpci_ctrlchan_func (0x%p) as callback.\n", - (void *)&virtpci_ctrlchan_func); /* create debugfs directory and info file inside. */ virtpci_debugfs_dir = debugfs_create_dir("virtpci", NULL); debugfs_create_file("info", S_IRUSR, virtpci_debugfs_dir, NULL, &debugfs_info_fops); - LOGINF("Leaving\n"); POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO); return 0; } static void __exit virtpci_mod_exit(void) { - LOGINF("virtpci_mod_exit...\n"); - /* unregister the callback function */ if (!uisctrl_register_req_handler(2, NULL, NULL)) LOGERR("uisctrl_register_req_handler ****FAILED.\n"); @@ -1529,7 +1445,6 @@ static void __exit virtpci_mod_exit(void) device_unregister(&virtpci_rootbus_device); bus_unregister(&virtpci_bus_type); debugfs_remove_recursive(virtpci_debugfs_dir); - LOGINF("Leaving\n"); } module_init(virtpci_mod_init); diff --git a/drivers/staging/unisys/visorchannel/visorchannel_main.c b/drivers/staging/unisys/visorchannel/visorchannel_main.c index f4be2e62c97d..787d4774b199 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_main.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_main.c @@ -32,14 +32,12 @@ visorchannel_init(void) if (!unisys_spar_platform) return -ENODEV; - INFODRV("driver version %s loaded", VERSION); return 0; } static void visorchannel_exit(void) { - INFODRV("driver unloaded"); } module_init(visorchannel_init); diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index f580fb6f1ee0..b37113263151 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -66,7 +66,6 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) return -1; } registered = TRUE; - INFODRV("New major number %d registered\n", MAJOR(majordev)); } else { /* static major device number registration required */ if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0) { @@ -74,15 +73,12 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) return -1; } registered = TRUE; - INFODRV("Static major number %d registered\n", MAJOR(majordev)); } rc = cdev_add(&file_cdev, MKDEV(MAJOR(majordev), 0), 1); if (rc < 0) { ERRDRV("failed to create char device: (status=%d)\n", rc); return -1; } - INFODRV("Registered char device for %s (major=%d)", - MYDRVNAME, MAJOR(majordev)); return 0; } diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 4b5def838ebb..a49ba6141544 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -712,11 +712,9 @@ controlvm_respond(struct controlvm_message_header *msgHdr, int response) && g_DeviceChangeStatePacket.device_change_state.dev_no == g_diagpoolDevNo) outmsg.cmd = g_DeviceChangeStatePacket; - if (outmsg.hdr.flags.test_message == 1) { - LOGINF("%s controlvm_msg=0x%x response=%d for test message", - __func__, outmsg.hdr.id, response); + if (outmsg.hdr.flags.test_message == 1) return; - } + if (!visorchannel_signalinsert(ControlVm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { LOGERR("signalinsert failed!"); @@ -1063,8 +1061,6 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, */ if (busNo == g_diagpoolBusNo && devNo == g_diagpoolDevNo) { - LOGINF("DEVICE_CHANGESTATE(DiagpoolChannel busNo=%d devNo=%d is pausing...)", - busNo, devNo); /* this will trigger the * diag_shutdown.sh script in * the visorchipset hotplug */ @@ -1292,8 +1288,6 @@ Away: is_diagpool_channel(pDevInfo->chan_info.channel_type_uuid)) { g_diagpoolBusNo = busNo; g_diagpoolDevNo = devNo; - LOGINF("CONTROLVM_DEVICE_CREATE for DiagPool channel: busNo=%lu, devNo=%lu", - g_diagpoolBusNo, g_diagpoolDevNo); } device_epilog(busNo, devNo, segment_state_running, CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc, @@ -1404,8 +1398,6 @@ initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes, info->offset = offset; info->bytes = bytes; info->ptr = payload; - LOGINF("offset=%llu, bytes=%lu, ptr=%p", - (u64) (info->offset), (ulong) (info->bytes), info->ptr); Away: if (rc < 0) { @@ -1506,7 +1498,6 @@ chipset_ready(struct controlvm_message_header *msgHdr) * and disks mounted for the partition */ g_ChipSetMsgHdr = *msgHdr; - LOGINF("Holding CHIPSET_READY response"); } } @@ -1643,12 +1634,6 @@ parahotplug_request_kickoff(struct parahotplug_request *req) sprintf(env_func, "SPAR_PARAHOTPLUG_FUNCTION=%d", cmd->device_change_state.dev_no & 0x7); - LOGINF("parahotplug_request_kickoff: state=%d, bdf=%d/%d/%d, id=%u\n", - cmd->device_change_state.state.active, - cmd->device_change_state.bus_no, - cmd->device_change_state.dev_no >> 3, - cmd->device_change_state.dev_no & 7, req->id); - kobject_uevent_env(&Visorchipset_platform_device.dev.kobj, KOBJ_CHANGE, envp); } @@ -1827,43 +1812,24 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) } switch (inmsg.hdr.id) { case CONTROLVM_CHIPSET_INIT: - LOGINF("CHIPSET_INIT(#busses=%lu,#switches=%lu)", - (ulong) inmsg.cmd.init_chipset.bus_count, - (ulong) inmsg.cmd.init_chipset.switch_count); chipset_init(&inmsg); break; case CONTROLVM_BUS_CREATE: - LOGINF("BUS_CREATE(%lu,#devs=%lu)", - (ulong) cmd->create_bus.bus_no, - (ulong) cmd->create_bus.dev_count); bus_create(&inmsg); break; case CONTROLVM_BUS_DESTROY: - LOGINF("BUS_DESTROY(%lu)", (ulong) cmd->destroy_bus.bus_no); bus_destroy(&inmsg); break; case CONTROLVM_BUS_CONFIGURE: - LOGINF("BUS_CONFIGURE(%lu)", (ulong) cmd->configure_bus.bus_no); bus_configure(&inmsg, parser_ctx); break; case CONTROLVM_DEVICE_CREATE: - LOGINF("DEVICE_CREATE(%lu,%lu)", - (ulong) cmd->create_device.bus_no, - (ulong) cmd->create_device.dev_no); my_device_create(&inmsg); break; case CONTROLVM_DEVICE_CHANGESTATE: if (cmd->device_change_state.flags.phys_device) { - LOGINF("DEVICE_CHANGESTATE for physical device (%lu,%lu, active=%lu)", - (ulong) cmd->device_change_state.bus_no, - (ulong) cmd->device_change_state.dev_no, - (ulong) cmd->device_change_state.state.active); parahotplug_process_message(&inmsg); } else { - LOGINF("DEVICE_CHANGESTATE for virtual device (%lu,%lu, state.Alive=0x%lx)", - (ulong) cmd->device_change_state.bus_no, - (ulong) cmd->device_change_state.dev_no, - (ulong) cmd->device_change_state.state.alive); /* save the hdr and cmd structures for later use */ /* when sending back the response to Command */ my_device_changestate(&inmsg); @@ -1873,29 +1839,20 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) } break; case CONTROLVM_DEVICE_DESTROY: - LOGINF("DEVICE_DESTROY(%lu,%lu)", - (ulong) cmd->destroy_device.bus_no, - (ulong) cmd->destroy_device.dev_no); my_device_destroy(&inmsg); break; case CONTROLVM_DEVICE_CONFIGURE: - LOGINF("DEVICE_CONFIGURE(%lu,%lu)", - (ulong) cmd->configure_device.bus_no, - (ulong) cmd->configure_device.dev_no); /* no op for now, just send a respond that we passed */ if (inmsg.hdr.flags.response_expected) controlvm_respond(&inmsg.hdr, CONTROLVM_RESP_SUCCESS); break; case CONTROLVM_CHIPSET_READY: - LOGINF("CHIPSET_READY"); chipset_ready(&inmsg.hdr); break; case CONTROLVM_CHIPSET_SELFTEST: - LOGINF("CHIPSET_SELFTEST"); chipset_selftest(&inmsg.hdr); break; case CONTROLVM_CHIPSET_STOP: - LOGINF("CHIPSET_STOP"); chipset_notready(&inmsg.hdr); break; default: @@ -1923,7 +1880,6 @@ static HOSTADDRESS controlvm_get_channel_address(void) __func__); return 0; } - INFODRV("controlvm addr=%Lx", addr); return addr; } @@ -1956,7 +1912,6 @@ controlvm_periodic_work(struct work_struct *work) if (visorchipset_holdchipsetready && (g_ChipSetMsgHdr.id != CONTROLVM_INVALID)) { if (check_chipset_events() == 1) { - LOGINF("Sending CHIPSET_READY response"); controlvm_respond(&g_ChipSetMsgHdr, 0); clear_chipset_events(); memset(&g_ChipSetMsgHdr, 0, @@ -2019,13 +1974,11 @@ Away: * polling */ if (Poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_SLOW) { - LOGINF("switched to slow controlvm polling"); Poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW; } } else { if (Poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_FAST) { Poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; - LOGINF("switched to fast controlvm polling"); } } @@ -2135,7 +2088,6 @@ setup_crash_devices_work_queue(struct work_struct *work) POSTCODE_SEVERITY_ERR); return; } - LOGINF("Bus and device ready for dumping"); POSTCODE_LINUX_2(CRASH_DEV_EXIT_PC, POSTCODE_SEVERITY_INFO); return; @@ -2344,25 +2296,11 @@ static int __init visorchipset_init(void) { int rc = 0, x = 0; - char s[64]; HOSTADDRESS addr; if (!unisys_spar_platform) return -ENODEV; - LOGINF("chipset driver version %s loaded", VERSION); - /* process module options */ - POSTCODE_LINUX_2(DRIVER_ENTRY_PC, POSTCODE_SEVERITY_INFO); - - LOGINF("option - testvnic=%d", visorchipset_testvnic); - LOGINF("option - testvnicclient=%d", visorchipset_testvnicclient); - LOGINF("option - testmsg=%d", visorchipset_testmsg); - LOGINF("option - testteardown=%d", visorchipset_testteardown); - LOGINF("option - major=%d", visorchipset_major); - LOGINF("option - serverregwait=%d", visorchipset_serverregwait); - LOGINF("option - clientregwait=%d", visorchipset_clientregwait); - LOGINF("option - holdchipsetready=%d", visorchipset_holdchipsetready); - memset(&BusDev_Server_Notifiers, 0, sizeof(BusDev_Server_Notifiers)); memset(&BusDev_Client_Notifiers, 0, sizeof(BusDev_Client_Notifiers)); memset(&ControlVm_payload_info, 0, sizeof(ControlVm_payload_info)); @@ -2386,8 +2324,6 @@ visorchipset_init(void) spar_controlvm_channel_protocol_uuid); if (SPAR_CONTROLVM_CHANNEL_OK_CLIENT( visorchannel_get_header(ControlVm_channel))) { - LOGINF("Channel %s (ControlVm) discovered", - visorchannel_id(ControlVm_channel, s)); initialize_controlvm_payload(); } else { LOGERR("controlvm channel is invalid"); @@ -2424,9 +2360,7 @@ visorchipset_init(void) rc = -1; goto Away; } - if (visorchipset_disable_controlvm) { - LOGINF("visorchipset_init:controlvm disabled"); - } else { + if (!visorchipset_disable_controlvm) { /* if booting in a crash kernel */ if (visorchipset_crash_kernel) INIT_DELAYED_WORK(&Periodic_controlvm_work, @@ -2465,7 +2399,6 @@ visorchipset_init(void) rc = -1; goto Away; } - LOGINF("visorchipset device created"); POSTCODE_LINUX_2(CHIPSET_INIT_SUCCESS_PC, POSTCODE_SEVERITY_INFO); rc = 0; Away: @@ -2480,8 +2413,6 @@ Away: static void visorchipset_exit(void) { - char s[99]; - POSTCODE_LINUX_2(DRIVER_EXIT_PC, POSTCODE_SEVERITY_INFO); if (visorchipset_disable_controlvm) { @@ -2507,13 +2438,10 @@ visorchipset_exit(void) memset(&g_DelDumpMsgHdr, 0, sizeof(struct controlvm_message_header)); - LOGINF("Channel %s (ControlVm) disconnected", - visorchannel_id(ControlVm_channel, s)); visorchannel_destroy(ControlVm_channel); visorchipset_file_cleanup(); POSTCODE_LINUX_2(DRIVER_EXIT_PC, POSTCODE_SEVERITY_INFO); - LOGINF("chipset driver unloaded"); } module_param_named(testvnic, visorchipset_testvnic, int, S_IRUGO); -- cgit v1.2.3 From 1a84fec17106f03100aa7f41c96b78f9c0b6531b Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Wed, 4 Mar 2015 12:14:23 -0500 Subject: staging: unisys: remove ASSERT() macro Remove the ASSERT macro from timskmod.h, and replace its single use with WARN_ON() instead. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/timskmod.h | 9 --------- drivers/staging/unisys/visorutil/periodic_work.c | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index ff0fc167413c..667eae6b9477 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h @@ -68,15 +68,6 @@ #define HOSTADDRESS unsigned long long #endif -/** Try to evaulate the provided expression, and do a RETINT(x) iff - * the expression evaluates to < 0. - */ -#define ASSERT(cond) \ - do { if (!(cond)) \ - HUHDRV("ASSERT failed - %s", \ - __stringify(cond)); \ - } while (0) - #define sizeofmember(TYPE, MEMBER) (sizeof(((TYPE *)0)->MEMBER)) /** "Covered quotient" function */ #define COVQ(v, d) (((v) + (d) - 1) / (d)) diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index 0908bf929401..411fd1ea0784 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c @@ -182,7 +182,7 @@ BOOL visor_periodic_work_stop(struct periodic_work *pw) /* We get here if the delayed work was pending as * delayed work, but was NOT run. */ - ASSERT(pw->is_scheduled); + WARN_ON(!pw->is_scheduled); pw->is_scheduled = FALSE; } else { /* If we get here, either the delayed work: -- cgit v1.2.3 From 61620a1b187f645a13e77763b367e52ac129f411 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Wed, 4 Mar 2015 12:14:24 -0500 Subject: staging: unisys: remove LOGVER macro Remove the LOGVER macro from the drivers entirely. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/uniklog.h | 28 ---------------------------- drivers/staging/unisys/virthba/virthba.c | 4 ---- 2 files changed, 32 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/uniklog.h b/drivers/staging/unisys/include/uniklog.h index e3c374cfe26e..799c5710850a 100644 --- a/drivers/staging/unisys/include/uniklog.h +++ b/drivers/staging/unisys/include/uniklog.h @@ -25,34 +25,6 @@ #include -/* - * # LOGVER - * - * \brief Log verbose message - logs a message at the LOG_DEBUG level, - * which can be disabled at runtime - * - * \param devname the device name of the device reporting this message, or - * NULL if this message is NOT device-related. - * \param fmt printf()-style format string containing the message to log. - * \param args Optional arguments to be formatted and inserted into the format - * \param string. - * \return nothing - * - * Logs the specified message at the LOG_DEBUG level. Note also that - * LOG_DEBUG messages can be enabled/disabled at runtime as well. - */ -#define LOGVER(fmt, args...) pr_debug(fmt, ## args) -#define LOGVERDEV(devname, fmt, args...) \ - pr_debug("%s " fmt, devname, ## args) -#define LOGVERNAME(vnic, fmt, args...) \ - do { \ - if (vnic != NULL) { \ - pr_debug("%s " fmt, vnic->name, ## args); \ - } else { \ - pr_debug(fmt, ## args); \ - } \ - } while (0) - /* * # LOGERR * diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index 5ec2423a4138..5445863c2bab 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -465,10 +465,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) struct signal_queue_header __iomem *pqhdr; u64 mask; - LOGVER("entering virthba_probe...\n"); - LOGVER("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, - virtpcidev->device_no); - POSTCODE_LINUX_2(VHBA_PROBE_ENTRY_PC, POSTCODE_SEVERITY_INFO); /* call scsi_host_alloc to register a scsi host adapter * instance - this virthba that has just been created is an -- cgit v1.2.3 From 0aca78449b58603586df83cca1e9eaba1acc1cfd Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Wed, 4 Mar 2015 12:14:25 -0500 Subject: staging: unisys: remove ERRDEV macros Remove the LOGERR, LOGERRDEV, LOGERRDEVX, LOGERRNAME, LOGORDUMPERR macros from all the drivers. In one case the removal of the ERRDRV() changed things such that a macro which returned a value was needed, but the return value was no longer being used. In this case the macro was replaced with the contents of the macro, but with the truth calculation removed so that it would not generate a warning. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/timskmod.h | 3 - drivers/staging/unisys/include/uisutils.h | 2 - drivers/staging/unisys/include/uniklog.h | 38 ----- drivers/staging/unisys/uislib/uislib.c | 156 +++---------------- drivers/staging/unisys/uislib/uisqueue.c | 6 +- drivers/staging/unisys/uislib/uisutils.c | 2 - drivers/staging/unisys/virthba/virthba.c | 95 ++---------- drivers/staging/unisys/virtpci/virtpci.c | 113 ++++---------- .../unisys/visorchannel/visorchannel_funcs.c | 66 +++----- drivers/staging/unisys/visorchipset/file.c | 22 +-- drivers/staging/unisys/visorchipset/parser.c | 66 ++------ .../unisys/visorchipset/visorchipset_main.c | 167 ++++----------------- drivers/staging/unisys/visorutil/charqueue.c | 5 +- drivers/staging/unisys/visorutil/easyproc.c | 26 +--- .../staging/unisys/visorutil/memregion_direct.c | 36 ++--- drivers/staging/unisys/visorutil/periodic_work.c | 4 - drivers/staging/unisys/visorutil/procobjecttree.c | 25 ++- 17 files changed, 154 insertions(+), 678 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index 667eae6b9477..5a933d7bf39f 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h @@ -78,9 +78,6 @@ (void *)(p2) = SWAPPOINTERS_TEMP; \ } while (0) -#define TBDDRV(fmt, args...) LOGERR(fmt, ## args) -#define HUHDRV(fmt, args...) LOGERR(fmt, ## args) -#define ERRDRV(fmt, args...) LOGERR(fmt, ## args) #define WARNDRV(fmt, args...) LOGWRN(fmt, ## args) #define SECUREDRV(fmt, args...) LOGWRN(fmt, ## args) diff --git a/drivers/staging/unisys/include/uisutils.h b/drivers/staging/unisys/include/uisutils.h index e2dfb2e784de..c7d0ba8aafd8 100644 --- a/drivers/staging/unisys/include/uisutils.h +++ b/drivers/staging/unisys/include/uisutils.h @@ -184,10 +184,8 @@ wait_for_valid_guid(uuid_le __iomem *guid) (void __iomem *)guid, sizeof(uuid_le)); if (uuid_le_cmp(tmpguid, NULL_UUID_LE) != 0) break; - LOGERR("Waiting for non-0 GUID (why???)...\n"); UIS_THREAD_WAIT_SEC(5); } - LOGERR("OK... GUID is non-0 now\n"); } static inline unsigned int diff --git a/drivers/staging/unisys/include/uniklog.h b/drivers/staging/unisys/include/uniklog.h index 799c5710850a..cca662a3f3e4 100644 --- a/drivers/staging/unisys/include/uniklog.h +++ b/drivers/staging/unisys/include/uniklog.h @@ -25,44 +25,6 @@ #include -/* - * # LOGERR - * - * \brief Log error message - logs a message at the LOG_ERR level, - * including source line number information - * - * \param devname the device name of the device reporting this message, or - * NULL if this message is NOT device-related. - * \param fmt printf()-style format string containing the message to log. - * \param args Optional arguments to be formatted and inserted into the format - * \param string. - * \return nothing - * - * Logs the specified error message at the LOG_ERR level. It will also - * include the file, line number, and function name of where the error - * originated in the log message. - */ -#define LOGERR(fmt, args...) pr_err(fmt, ## args) -#define LOGERRDEV(devname, fmt, args...) \ - pr_err("%s " fmt, devname, ## args) -#define LOGERRDEVX(devno, fmt, args...) \ - pr_err("dev%d " fmt, devno, ## args) -#define LOGERRNAME(vnic, fmt, args...) \ - do { \ - if (vnic != NULL) { \ - pr_err("%s " fmt, vnic->name, ## args); \ - } else { \ - pr_err(fmt, ## args); \ - } \ - } while (0) -#define LOGORDUMPERR(seqfile, fmt, args...) do { \ - if (seqfile) { \ - seq_printf(seqfile, fmt, ## args); \ - } else { \ - LOGERR(fmt, ## args); \ - } \ - } while (0) - /* * # LOGWRN * diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 93b471412bd5..9fe96e7d5693 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -132,14 +132,10 @@ static __iomem void *init_vbus_channel(u64 ch_addr, u32 ch_bytes) { void __iomem *ch = uislib_ioremap_cache(ch_addr, ch_bytes); - if (!ch) { - LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", - (unsigned long long)ch_addr, - (unsigned long long)ch_bytes); + if (!ch) return NULL; - } + if (!SPAR_VBUS_CHANNEL_OK_CLIENT(ch)) { - ERRDRV("%s channel cannot be used", __func__); uislib_iounmap(ch); return NULL; } @@ -154,8 +150,6 @@ create_bus(struct controlvm_message *msg, char *buf) size_t size; if (max_bus_count == bus_list_count) { - LOGERR("CONTROLVM_BUS_CREATE Failed: max buses:%d already created\n", - max_bus_count); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, max_bus_count, POSTCODE_SEVERITY_ERR); return CONTROLVM_RESP_ERROR_MAX_BUSES; @@ -208,8 +202,6 @@ create_bus(struct controlvm_message *msg, char *buf) /* found a bus already in the list with same bus_no - * reject add */ - LOGERR("CONTROLVM_BUS_CREATE Failed: bus %d already exists.\n", - bus->bus_no); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); @@ -233,14 +225,12 @@ create_bus(struct controlvm_message *msg, char *buf) cmd.add_vbus.bus_uuid = msg->cmd.create_bus.bus_data_type_uuid; cmd.add_vbus.instance_uuid = msg->cmd.create_bus.bus_inst_uuid; if (!virt_control_chan_func) { - LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci callback not registered."); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci GUEST_ADD_VBUS returned error."); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); @@ -286,8 +276,6 @@ destroy_bus(struct controlvm_message *msg, char *buf) } if (!bus) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: failed to find bus %d.\n", - bus_no); read_unlock(&bus_list_lock); return CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -295,8 +283,6 @@ destroy_bus(struct controlvm_message *msg, char *buf) /* verify that this bus has no devices. */ for (i = 0; i < bus->device_count; i++) { if (bus->device[i] != NULL) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: device %i attached to bus %d.", - i, bus_no); read_unlock(&bus_list_lock); return CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED; } @@ -310,14 +296,11 @@ destroy_bus(struct controlvm_message *msg, char *buf) with this bus. */ cmd.msgtype = GUEST_DEL_VBUS; cmd.del_vbus.bus_no = bus_no; - if (!virt_control_chan_func) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci callback not registered."); + if (!virt_control_chan_func) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; - } - if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci GUEST_DEL_VBUS returned error."); + + if (!virt_control_chan_func(&cmd)) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; - } /* finally, remove the bus from the list */ remove: @@ -379,9 +362,6 @@ static int create_device(struct controlvm_message *msg, char *buf) */ min_size = req_handler->min_channel_bytes; if (min_size > msg->cmd.create_device.channel_bytes) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: channel size is too small, channel size:0x%lx, required size:0x%lx", - (ulong)msg->cmd.create_device.channel_bytes, - (ulong)min_size); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL; @@ -391,9 +371,6 @@ static int create_device(struct controlvm_message *msg, char *buf) uislib_ioremap_cache(dev->channel_addr, msg->cmd.create_device.channel_bytes); if (!dev->chanptr) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", - dev->channel_addr, - msg->cmd.create_device.channel_bytes); result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED; POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -409,8 +386,6 @@ static int create_device(struct controlvm_message *msg, char *buf) continue; /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: device (%d) >= deviceCount (%d).", - dev_no, bus->device_count); result = CONTROLVM_RESP_ERROR_MAX_DEVICES; POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -419,8 +394,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } /* make sure this device is not already set */ if (bus->device[dev_no]) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: device %d is already exists.", - dev_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -443,8 +416,6 @@ static int create_device(struct controlvm_message *msg, char *buf) wait_for_valid_guid(&((struct channel_header __iomem *) (dev->chanptr))->chtype); if (!SPAR_VHBA_CHANNEL_OK_CLIENT(dev->chanptr)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed:[CLIENT]VHBA dev %d chan invalid.", - dev_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -462,8 +433,6 @@ static int create_device(struct controlvm_message *msg, char *buf) wait_for_valid_guid(&((struct channel_header __iomem *) (dev->chanptr))->chtype); if (!SPAR_VNIC_CHANNEL_OK_CLIENT(dev->chanptr)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: VNIC[CLIENT] dev %d chan invalid.", - dev_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -477,7 +446,6 @@ static int create_device(struct controlvm_message *msg, char *buf) cmd.add_vnic.instance_uuid = dev->instance_uuid; cmd.add_vhba.intr = dev->intr; } else { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: unknown channelTypeGuid.\n"); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; @@ -485,7 +453,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci callback not registered."); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; @@ -493,7 +460,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci GUEST_ADD_[VHBA||VNIC] returned error."); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = @@ -508,8 +474,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } read_unlock(&bus_list_lock); - LOGERR("CONTROLVM_DEVICE_CREATE Failed: failed to find bus %d.", - bus_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_BUS_INVALID; @@ -540,15 +504,11 @@ static int pause_device(struct controlvm_message *msg) if (bus->bus_no == bus_no) { /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device(%d) >= deviceCount(%d).", - dev_no, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ dev = bus->device[dev_no]; if (!dev) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device %d does not exist.", - dev_no); retval = CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -556,11 +516,9 @@ static int pause_device(struct controlvm_message *msg) break; } } - if (!bus) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: bus %d does not exist", - bus_no); + if (!bus) retval = CONTROLVM_RESP_ERROR_BUS_INVALID; - } + read_unlock(&bus_list_lock); if (retval == CONTROLVM_RESP_SUCCESS) { /* the msg is bound for virtpci; send @@ -575,15 +533,12 @@ static int pause_device(struct controlvm_message *msg) cmd.msgtype = GUEST_PAUSE_VNIC; cmd.pause_vnic.chanptr = dev->chanptr; } else { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: virtpci GUEST_PAUSE_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -607,15 +562,11 @@ static int resume_device(struct controlvm_message *msg) if (bus->bus_no == bus_no) { /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device(%d) >= deviceCount(%d).", - dev_no, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ dev = bus->device[dev_no]; if (!dev) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device %d does not exist.", - dev_no); retval = CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -624,11 +575,9 @@ static int resume_device(struct controlvm_message *msg) } } - if (!bus) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: bus %d does not exist", - bus_no); + if (!bus) retval = CONTROLVM_RESP_ERROR_BUS_INVALID; - } + read_unlock(&bus_list_lock); /* the msg is bound for virtpci; send * guest_msgs struct to callback @@ -643,15 +592,12 @@ static int resume_device(struct controlvm_message *msg) cmd.msgtype = GUEST_RESUME_VNIC; cmd.resume_vnic.chanptr = dev->chanptr; } else { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: virtpci GUEST_RESUME_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -675,15 +621,11 @@ static int destroy_device(struct controlvm_message *msg, char *buf) if (bus->bus_no == bus_no) { /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device(%d) >= device_count(%d).", - dev_no, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ dev = bus->device[dev_no]; if (!dev) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device %d does not exist.", - dev_no); retval = CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -692,11 +634,8 @@ static int destroy_device(struct controlvm_message *msg, char *buf) } } - if (!bus) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: bus %d does not exist", - bus_no); + if (!bus) retval = CONTROLVM_RESP_ERROR_BUS_INVALID; - } read_unlock(&bus_list_lock); if (retval == CONTROLVM_RESP_SUCCESS) { /* the msg is bound for virtpci; send @@ -711,17 +650,14 @@ static int destroy_device(struct controlvm_message *msg, char *buf) cmd.msgtype = GUEST_DEL_VNIC; cmd.del_vnic.chanptr = dev->chanptr; } else { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci callback not registered."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci GUEST_DEL_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -774,10 +710,8 @@ static int delete_bus_glue(u32 bus_no) init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0); msg.cmd.destroy_bus.bus_no = bus_no; - if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("destroy_bus failed. bus_no=0x%x\n", bus_no); + if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) return 0; - } return 1; } @@ -788,11 +722,8 @@ static int delete_device_glue(u32 bus_no, u32 dev_no) init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0); msg.cmd.destroy_device.bus_no = bus_no; msg.cmd.destroy_device.dev_no = dev_no; - if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("destroy_device failed. bus_no=0x%x dev_no=0x%x\n", - bus_no, dev_no); + if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) return 0; - } return 1; } @@ -817,10 +748,8 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, */ msg.cmd.init_chipset.bus_count = 23; msg.cmd.init_chipset.switch_count = 0; - if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("init_chipset failed.\n"); + if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS) return 0; - } POSTCODE_LINUX_3(CHIPSET_INIT_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO); } @@ -834,7 +763,6 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, msg.cmd.create_bus.channel_addr = channel_addr; msg.cmd.create_bus.channel_bytes = n_channel_bytes; if (create_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("create_bus failed.\n"); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); return 0; @@ -863,11 +791,8 @@ uislib_client_inject_pause_vhba(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_standby; rc = pause_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VHBA pause_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return rc; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vhba); @@ -883,11 +808,8 @@ uislib_client_inject_resume_vhba(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_running; rc = resume_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VHBA resume_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return rc; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vhba); @@ -923,8 +845,6 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, sizeof(struct irq_info)); msg.cmd.create_device.channel_addr = phys_chan_addr; if (chan_bytes < MIN_IO_CHANNEL_SIZE) { - LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", - chan_bytes, (unsigned int)MIN_IO_CHANNEL_SIZE); POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, chan_bytes, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; @@ -932,7 +852,6 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, msg.cmd.create_device.channel_bytes = chan_bytes; msg.cmd.create_device.data_type_uuid = spar_vhba_channel_protocol_uuid; if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("VHBA create_device failed.\n"); POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); return 0; @@ -981,8 +900,6 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, sizeof(struct irq_info)); msg.cmd.create_device.channel_addr = phys_chan_addr; if (chan_bytes < MIN_IO_CHANNEL_SIZE) { - LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", - chan_bytes, (unsigned int)MIN_IO_CHANNEL_SIZE); POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, chan_bytes, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; @@ -990,7 +907,6 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, msg.cmd.create_device.channel_bytes = chan_bytes; msg.cmd.create_device.data_type_uuid = spar_vnic_channel_protocol_uuid; if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("VNIC create_device failed.\n"); POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); return 0; @@ -1014,8 +930,6 @@ uislib_client_inject_pause_vnic(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.state = segment_state_standby; rc = pause_device(&msg); if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VNIC pause_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); return -1; } return 0; @@ -1033,11 +947,8 @@ uislib_client_inject_resume_vnic(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_running; rc = resume_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VNIC resume_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return -1; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vnic); @@ -1059,11 +970,8 @@ uislib_cache_alloc(struct kmem_cache *cur_pool, char *fn, int ln) */ void *p = kmem_cache_alloc(cur_pool, GFP_ATOMIC | __GFP_NORETRY); - if (p == NULL) { - LOGERR("uislib_malloc failed to alloc uiscmdrsp @%s:%d", - fn, ln); + if (p == NULL) return NULL; - } return p; } EXPORT_SYMBOL_GPL(uislib_cache_alloc); @@ -1071,10 +979,8 @@ EXPORT_SYMBOL_GPL(uislib_cache_alloc); void uislib_cache_free(struct kmem_cache *cur_pool, void *p, char *fn, int ln) { - if (p == NULL) { - LOGERR("uislib_free NULL pointer @%s:%d", fn, ln); + if (p == NULL) return; - } kmem_cache_free(cur_pool, p); } EXPORT_SYMBOL_GPL(uislib_cache_free); @@ -1155,10 +1061,8 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, if (debug_buf == NULL) { debug_buf = vmalloc(PROC_READ_BUFFER_SIZE); - if (debug_buf == NULL) { - LOGERR("failed to allocate buffer to provide proc data.\n"); + if (debug_buf == NULL) return -ENOMEM; - } } temp = debug_buf; @@ -1184,17 +1088,9 @@ static struct device_info *find_dev(u32 bus_no, u32 dev_no) for (bus = bus_list; bus; bus = bus->next) { if (bus->bus_no == bus_no) { /* make sure the device number is valid */ - if (dev_no >= bus->device_count) { - LOGERR("%s bad bus_no, dev_no=%d,%d", - __func__, - (int)bus_no, (int)dev_no); + if (dev_no >= bus->device_count) break; - } dev = bus->device[dev_no]; - if (!dev) - LOGERR("%s bad bus_no, dev_no=%d,%d", - __func__, - (int)bus_no, (int)dev_no); break; } } @@ -1331,7 +1227,6 @@ initialize_incoming_thread(void) return TRUE; if (!uisthread_start(&incoming_ti, &process_incoming, NULL, "dev_incoming")) { - LOGERR("uisthread_start initialize_incoming_thread ****FAILED"); return FALSE; } incoming_started = TRUE; @@ -1352,11 +1247,9 @@ uislib_enable_channel_interrupts(u32 bus_no, u32 dev_no, struct device_info *dev; dev = find_dev(bus_no, dev_no); - if (!dev) { - LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no), - (int)(dev_no)); + if (!dev) return; - } + down(&poll_dev_lock); initialize_incoming_thread(); dev->interrupt = interrupt; @@ -1377,11 +1270,8 @@ uislib_disable_channel_interrupts(u32 bus_no, u32 dev_no) struct device_info *dev; dev = find_dev(bus_no, dev_no); - if (!dev) { - LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no), - (int)(dev_no)); + if (!dev) return; - } down(&poll_dev_lock); list_del(&dev->list_polling_device_channels); dev->polling = FALSE; diff --git a/drivers/staging/unisys/uislib/uisqueue.c b/drivers/staging/unisys/uislib/uisqueue.c index 71bb7b608e9a..d46dd7428a30 100644 --- a/drivers/staging/unisys/uislib/uisqueue.c +++ b/drivers/staging/unisys/uislib/uisqueue.c @@ -295,12 +295,10 @@ uisqueue_put_cmdrsp_with_lock_client(struct uisqueue_info *queueinfo, while (!do_locked_client_insert(queueinfo, whichqueue, cmdrsp, (spinlock_t *)insertlock, channel_id)) { - if (oktowait != OK_TO_WAIT) { - LOGERR("****FAILED visor_signal_insert failed; cannot wait; insert aborted\n"); + if (oktowait != OK_TO_WAIT) return 0; /* failed to queue */ - } + /* try again */ - LOGERR("****FAILED visor_signal_insert failed; waiting to try again\n"); set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(10)); } diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c index 7d7f408505f2..9f3f0ab6ca49 100644 --- a/drivers/staging/unisys/uislib/uisutils.c +++ b/drivers/staging/unisys/uislib/uisutils.c @@ -60,7 +60,6 @@ uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining, *buffer += *buffer_remaining; *total += *buffer_remaining; *buffer_remaining = 0; - LOGERR("bytes remaining is too small!\n"); return -1; } *buffer_remaining -= len; @@ -88,7 +87,6 @@ uisctrl_register_req_handler(int type, void *fptr, break; default: - LOGERR("invalid type %d.\n", type); return 0; } if (chipset_driver_info) diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index 5445863c2bab..23874de4e354 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -262,8 +262,6 @@ add_scsipending_entry(struct virthba_info *vhbainfo, char cmdtype, void *new) while (vhbainfo->pending[insert_location].sent != NULL) { insert_location = (insert_location + 1) % MAX_PENDING_REQUESTS; if (insert_location == (int)vhbainfo->nextinsert) { - LOGERR("Queue should be full. insert_location<<%d>> Unable to find open slot for pending commands.\n", - insert_location); spin_unlock_irqrestore(&vhbainfo->privlock, flags); return -1; } @@ -284,7 +282,6 @@ add_scsipending_entry_with_wait(struct virthba_info *vhbainfo, char cmdtype, int insert_location = add_scsipending_entry(vhbainfo, cmdtype, new); while (insert_location == -1) { - LOGERR("Failed to find empty queue slot. Waiting to try again\n"); set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(10)); insert_location = add_scsipending_entry(vhbainfo, cmdtype, new); @@ -299,16 +296,8 @@ del_scsipending_entry(struct virthba_info *vhbainfo, uintptr_t del) unsigned long flags; void *sent = NULL; - if (del >= MAX_PENDING_REQUESTS) { - LOGERR("Invalid queue position <<%lu>> given to delete. MAX_PENDING_REQUESTS <<%d>>\n", - (unsigned long)del, MAX_PENDING_REQUESTS); - } else { + if (del < MAX_PENDING_REQUESTS) { spin_lock_irqsave(&vhbainfo->privlock, flags); - - if (vhbainfo->pending[del].sent == NULL) - LOGERR("Deleting already cleared queue entry at <<%lu>>.\n", - (unsigned long)del); - sent = vhbainfo->pending[del].sent; vhbainfo->pending[del].cmdtype = 0; @@ -355,13 +344,7 @@ send_disk_add_remove(struct diskaddremove *dar) error = scsi_add_device(dar->shost, dar->channel, dar->id, dar->lun); - if (error) - LOGERR("Failed scsi_add_device: host_no=%d[chan=%d:id=%d:lun=%d]\n", - dar->shost->host_no, dar->channel, dar->id, - dar->lun); - } else - LOGERR("Failed scsi_device_lookup:[chan=%d:id=%d:lun=%d]\n", - dar->channel, dar->id, dar->lun); + } kfree(dar); } @@ -406,10 +389,6 @@ process_disk_notify(struct Scsi_Host *shost, struct uiscmdrsp *cmdrsp) dar->id = cmdrsp->disknotify.id; dar->lun = cmdrsp->disknotify.lun; QUEUE_DISKADDREMOVE(dar); - } else { - LOGERR("kmalloc failed for dar. host_no=%d[chan=%d:id=%d:lun=%d]\n", - shost->host_no, cmdrsp->disknotify.channel, - cmdrsp->disknotify.id, cmdrsp->disknotify.lun); } } @@ -510,7 +489,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) */ error = scsi_add_host(scsihost, &virtpcidev->generic_dev); if (error) { - LOGERR("scsi_add_host ****FAILED 0x%x TBD - RECOVER\n", error); POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR); /* decr refcount on scsihost which was incremented by * scsi_add_host so the scsi_host gets deleted @@ -563,7 +541,6 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) if (!uisthread_start(&virthbainfo->chinfo.threadinfo, process_incoming_rsps, virthbainfo, "vhba_incoming")) { - LOGERR("uisthread_start rsp ****FAILED\n"); /* decr refcount on scsihost which was incremented by * scsi_add_host so the scsi_host gets deleted */ @@ -576,15 +553,11 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) rsp = request_irq(virthbainfo->interrupt_vector, handler, IRQF_SHARED, scsihost->hostt->name, virthbainfo); if (rsp != 0) { - LOGERR("request_irq(%d) uislib_virthba_ISR request failed with rsp=%d\n", - virthbainfo->interrupt_vector, rsp); virthbainfo->interrupt_vector = -1; POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR); } else { u64 __iomem *Features_addr = &virthbainfo->chinfo.queueinfo->chan->features; - LOGERR("request_irq(%d) uislib_virthba_ISR request succeeded\n", - virthbainfo->interrupt_vector); mask = ~(ULTRA_IO_CHANNEL_IS_POLLING | ULTRA_IO_DRIVER_DISABLES_INTS); uisqueue_interlocked_and(Features_addr, mask); @@ -807,7 +780,6 @@ static int virthba_host_reset_handler(struct scsi_cmnd *scsicmd) { /* issue TASK_MGMT_TARGET_RESET for each target on each bus for host */ - LOGERR("virthba_host_reset_handler Not yet implemented\n"); return SUCCESS; } @@ -866,7 +838,6 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, if (insert_location != -1) { cmdrsp->scsi.scsicmd = (void *)(uintptr_t)insert_location; } else { - LOGERR("Queue is full. Returning busy.\n"); kfree(cmdrsp); return SCSI_MLQUEUE_DEVICE_BUSY; } @@ -887,8 +858,6 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, max_buff_len = cmdrsp->scsi.bufflen; if (scsi_sg_count(scsicmd) > MAX_PHYS_INFO) { - LOGERR("scsicmd use_sg:%d greater than MAX:%d\n", - scsi_sg_count(scsicmd), MAX_PHYS_INFO); del_scsipending_entry(virthbainfo, (uintptr_t)insert_location); kfree(cmdrsp); return 1; /* reject the command */ @@ -901,7 +870,6 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, /* convert buffer to phys information */ if (scsi_sg_count(scsicmd) == 0) { if (scsi_bufflen(scsicmd) > 0) { - LOGERR("**** FAILED No scatter list for bufflen > 0\n"); BUG_ON(scsi_sg_count(scsicmd) == 0); } } else { @@ -914,15 +882,6 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, } if (sg_failed) { - LOGERR("Start sg_list dump (entries %d, bufflen %d)...\n", - scsi_sg_count(scsicmd), cmdrsp->scsi.bufflen); - for_each_sg(sgl, sg, scsi_sg_count(scsicmd), i) { - LOGERR(" Entry(%d): page->[0x%p], phys->[0x%Lx], off(%d), len(%d)\n", - i, sg_page(sg), - (unsigned long long)sg_phys(sg), - sg->offset, sg->length); - } - LOGERR("Done sg_list dump.\n"); /* BUG(); ***** For now, let it fail in uissd * if it is a problem, as it might just * work @@ -941,7 +900,6 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, (u64)NULL, DONT_WAIT, "vhba"); if (i == 0) { /* queue must be full - and we said don't wait - return busy */ - LOGERR("uisqueue_put_cmdrsp_with_lock ****FAILED\n"); kfree(cmdrsp); del_scsipending_entry(virthbainfo, (uintptr_t)insert_location); return SCSI_MLQUEUE_DEVICE_BUSY; @@ -966,10 +924,9 @@ virthba_slave_alloc(struct scsi_device *scsidev) struct Scsi_Host *scsihost = (struct Scsi_Host *)scsidev->host; virthbainfo = (struct virthba_info *)scsihost->hostdata; - if (!virthbainfo) { - LOGERR("Could not find virthba_info for scsihost\n"); + if (!virthbainfo) return 0; /* even though we errored, treat as success */ - } + for (vdisk = &virthbainfo->head; vdisk->next; vdisk = vdisk->next) { if (vdisk->next->valid && (vdisk->next->channel == scsidev->channel) && @@ -1006,8 +963,6 @@ virthba_slave_destroy(struct scsi_device *scsidev) struct Scsi_Host *scsihost = (struct Scsi_Host *)scsidev->host; virthbainfo = (struct virthba_info *)scsihost->hostdata; - if (!virthbainfo) - LOGERR("Could not find virthba_info for scsihost\n"); for (vdisk = &virthbainfo->head; vdisk->next; vdisk = vdisk->next) { if (vdisk->next->valid && (vdisk->next->channel == scsidev->channel) && @@ -1052,19 +1007,6 @@ do_scsi_linuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) if (atomic_read(&vdisk->error_count) < VIRTHBA_ERROR_COUNT) { atomic_inc(&vdisk->error_count); - LOGERR("SCSICMD ****FAILED scsicmd:0x%p op:0x%x <%d:%d:%d:%llu> 0x%x-0x%x-0x%x-0x%x-0x%x.\n", - scsicmd, cmdrsp->scsi.cmnd[0], - scsidev->host->host_no, scsidev->id, - scsidev->channel, scsidev->lun, - cmdrsp->scsi.linuxstat, sd->valid, sd->sense_key, - sd->additional_sense_code, - sd->additional_sense_code_qualifier); - if (atomic_read(&vdisk->error_count) == - VIRTHBA_ERROR_COUNT) { - LOGERR("Throtling SCSICMD errors disk <%d:%d:%d:%llu>\n", - scsidev->host->host_no, scsidev->id, - scsidev->channel, scsidev->lun); - } atomic_set(&vdisk->ios_threshold, IOS_ERROR_THRESHOLD); } } @@ -1100,7 +1042,6 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) if (scsi_sg_count(scsicmd) == 0) { if (scsi_bufflen(scsicmd) > 0) { - LOGERR("**** FAILED No scatter list for bufflen > 0\n"); BUG_ON(scsi_sg_count(scsicmd) == 0); } @@ -1129,7 +1070,6 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) if (atomic_read(&vdisk->ios_threshold) > 0) { atomic_dec(&vdisk->ios_threshold); if (atomic_read(&vdisk->ios_threshold) == 0) { - LOGERR("Resetting error count for disk\n"); atomic_set(&vdisk->error_count, 0); } } @@ -1223,8 +1163,7 @@ drain_queue(struct virthba_info *virthbainfo, struct chaninfo *dc, cmdrsp->vdiskmgmt.scsicmd)) break; complete_vdiskmgmt_command(cmdrsp); - } else - LOGERR("Invalid cmdtype %d\n", cmdrsp->cmdtype); + } /* cmdrsp is now available for reuse */ } } @@ -1338,19 +1277,13 @@ static ssize_t enable_ints_write(struct file *file, const char __user *buffer, return -EINVAL; buf[count] = '\0'; - if (copy_from_user(buf, buffer, count)) { - LOGERR("copy_from_user failed. buf<<%.*s>> count<<%lu>>\n", - (int)count, buf, count); + if (copy_from_user(buf, buffer, count)) return -EFAULT; - } i = kstrtoint(buf, 10, &new_value); - if (i != 0) { - LOGERR("Failed to scan value for enable_ints, buf<<%.*s>>", - (int)count, buf); + if (i != 0) return -EFAULT; - } /* set all counts to new_value usually 0 */ for (i = 0; i < VIRTHBASOPENMAX; i++) { @@ -1389,10 +1322,8 @@ virthba_serverup(struct virtpci_dev *virtpcidev) if (!virthbainfo->serverdown) return 1; - if (virthbainfo->serverchangingstate) { - LOGERR("Server already processing change state message\n"); + if (virthbainfo->serverchangingstate) return 0; - } virthbainfo->serverchangingstate = true; /* Must transition channel to ATTACHED state BEFORE we @@ -1406,7 +1337,6 @@ virthba_serverup(struct virtpci_dev *virtpcidev) if (!uisthread_start(&virthbainfo->chinfo.threadinfo, process_incoming_rsps, virthbainfo, "vhba_incoming")) { - LOGERR("uisthread_start rsp ****FAILED\n"); return 0; } virthbainfo->serverdown = false; @@ -1460,9 +1390,7 @@ virthba_serverdown_complete(struct work_struct *work) cmdrsp->vdiskmgmt.notify); break; default: - if (pendingdel->sent != NULL) - LOGERR("Unknown command type: 0x%x. Only freeing list structure.\n", - pendingdel->cmdtype); + break; } pendingdel->cmdtype = 0; pendingdel->sent = NULL; @@ -1493,10 +1421,7 @@ virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state) queue_work(virthba_serverdown_workqueue, &virthbainfo->serverdown_completion); } else if (virthbainfo->serverchangingstate) { - LOGERR("Server already processing change state message\n"); stat = 0; - } else { - LOGERR("Server already down, but another server down message received."); } return stat; @@ -1544,7 +1469,6 @@ virthba_mod_init(void) error = virtpci_register_driver(&virthba_driver); if (error < 0) { - LOGERR("register ****FAILED 0x%x\n", error); POSTCODE_LINUX_3(VHBA_CREATE_FAILURE_PC, error, POSTCODE_SEVERITY_ERR); } else { @@ -1568,7 +1492,6 @@ virthba_mod_init(void) virthba_serverdown_workqueue = create_singlethread_workqueue("virthba_serverdown"); if (virthba_serverdown_workqueue == NULL) { - LOGERR("**** FAILED virthba_serverdown_workqueue creation\n"); POSTCODE_LINUX_2(VHBA_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); error = -1; diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index d87ebcc615d4..87336b6591ba 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -187,13 +187,11 @@ static int write_vbus_chp_info(struct spar_vbus_channel_protocol *chan, { int off; - if (!chan) { - LOGERR("vbus channel not present"); + if (!chan) return -1; - } + off = sizeof(struct channel_header) + chan->hdr_info.chp_info_offset; if (chan->hdr_info.chp_info_offset == 0) { - LOGERR("vbus channel not used, because chp_info_offset == 0"); return -1; } memcpy(((u8 *)(chan)) + off, info, sizeof(*info)); @@ -206,15 +204,12 @@ static int write_vbus_bus_info(struct spar_vbus_channel_protocol *chan, { int off; - if (!chan) { - LOGERR("vbus channel not present"); + if (!chan) return -1; - } + off = sizeof(struct channel_header) + chan->hdr_info.bus_info_offset; - if (chan->hdr_info.bus_info_offset == 0) { - LOGERR("vbus channel not used, because bus_info_offset == 0"); + if (chan->hdr_info.bus_info_offset == 0) return -1; - } memcpy(((u8 *)(chan)) + off, info, sizeof(*info)); return 0; } @@ -228,18 +223,16 @@ write_vbus_dev_info(struct spar_vbus_channel_protocol *chan, { int off; - if (!chan) { - LOGERR("vbus channel not present"); + if (!chan) return -1; - } + off = (sizeof(struct channel_header) + chan->hdr_info.dev_info_offset) + (chan->hdr_info.device_info_struct_bytes * devix); - if (chan->hdr_info.dev_info_offset == 0) { - LOGERR("vbus channel not used, because dev_info_offset == 0"); + if (chan->hdr_info.dev_info_offset == 0) return -1; - } + memcpy(((u8 *)(chan)) + off, info, sizeof(*info)); return 0; } @@ -271,7 +264,6 @@ static int add_vbus(struct add_vbus_guestpart *addparams) */ ret = device_register(vbus); if (ret) { - LOGERR("device_register FAILED:%d\n", ret); POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); return 0; } @@ -310,7 +302,6 @@ static int add_vhba(struct add_virt_guestpart *addparams) POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); if (!WAIT_FOR_IO_CHANNEL ((struct spar_io_channel_protocol __iomem *)addparams->chanptr)) { - LOGERR("Timed out. Channel not ready\n"); POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); return 0; } @@ -321,10 +312,8 @@ static int add_vhba(struct add_virt_guestpart *addparams) sprintf(busid, "vbus%d", addparams->bus_no); vbus = bus_find_device(&virtpci_bus_type, NULL, (void *)busid, match_busid); - if (!vbus) { - LOGERR("**** FAILED to find vbus %s\n", busid); + if (!vbus) return 0; - } i = virtpci_device_add(vbus, VIRTHBA_TYPE, addparams, &scsi, NULL); if (i) { @@ -367,7 +356,6 @@ add_vnic(struct add_virt_guestpart *addparams) POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); if (!WAIT_FOR_IO_CHANNEL ((struct spar_io_channel_protocol __iomem *)addparams->chanptr)) { - LOGERR("Timed out, channel not ready\n"); POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); return 0; } @@ -378,10 +366,8 @@ add_vnic(struct add_virt_guestpart *addparams) sprintf(busid, "vbus%d", addparams->bus_no); vbus = bus_find_device(&virtpci_bus_type, NULL, (void *)busid, match_busid); - if (!vbus) { - LOGERR("**** FAILED to find vbus %s\n", busid); + if (!vbus) return 0; - } i = virtpci_device_add(vbus, VIRTNIC_TYPE, addparams, NULL, &net); if (i) { @@ -405,10 +391,8 @@ delete_vbus(struct del_vbus_guestpart *delparams) sprintf(busid, "vbus%d", delparams->bus_no); vbus = bus_find_device(&virtpci_bus_type, NULL, (void *)busid, match_busid); - if (!vbus) { - LOGERR("**** FAILED to find vbus %s\n", busid); + if (!vbus) return 0; - } /* ensure that bus has no devices? -- TBD */ return 1; @@ -571,16 +555,11 @@ static int delete_all_virt(enum virtpci_dev_type devtype, sprintf(busid, "vbus%d", delparams->bus_no); vbus = bus_find_device(&virtpci_bus_type, NULL, (void *)busid, match_busid); - if (!vbus) { - LOGERR("**** FAILED to find vbus %s\n", busid); + if (!vbus) return 0; - } - if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) { - LOGERR("**** FAILED to delete all devices; devtype:%d not vhba:%d or vnic:%d\n", - devtype, VIRTHBA_TYPE, VIRTNIC_TYPE); + if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) return 0; - } /* delete all vhbas/vnics */ i = virtpci_device_del(vbus, devtype, NULL, NULL); @@ -618,7 +597,6 @@ static int virtpci_ctrlchan_func(struct guest_msgs *msg) case GUEST_RESUME_VNIC: return resume_vnic(&msg->resume_vnic); default: - LOGERR("invalid message type %d.\n", msg->msgtype); return 0; } } @@ -692,24 +670,19 @@ static void fix_vbus_dev_info(struct device *dev, int dev_no, int dev_type, struct ultra_vbus_deviceinfo dev_info; const char *stype; - if (!dev) { - LOGERR("%s dev is NULL", __func__); + if (!dev) return; - } - if (!virtpcidrv) { - LOGERR("%s driver is NULL", __func__); + if (!virtpcidrv) return; - } + vbus = dev->parent; - if (!vbus) { - LOGERR("%s dev has no parent bus", __func__); + if (!vbus) return; - } + chan = vbus->platform_data; - if (!chan) { - LOGERR("%s dev bus has no channel", __func__); + if (!chan) return; - } + switch (dev_type) { case PCI_DEVICE_ID_VIRTHBA: stype = "vHBA"; @@ -831,8 +804,6 @@ static int virtpci_device_add(struct device *parentbus, int devtype, POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) { - LOGERR("**** FAILED to add device; devtype:%d not vhba:%d or vnic:%d\n", - devtype, VIRTHBA_TYPE, VIRTNIC_TYPE); POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, devtype, POSTCODE_SEVERITY_ERR); return 0; @@ -902,7 +873,6 @@ static int virtpci_device_add(struct device *parentbus, int devtype, */ write_unlock_irqrestore(&vpcidev_list_lock, flags); kfree(virtpcidev); - LOGERR("**** FAILED vhba/vnic already exists in the list\n"); POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); return 0; } @@ -944,7 +914,6 @@ static int virtpci_device_add(struct device *parentbus, int devtype, * virtpci_device_probe is successful */ if (ret) { - LOGERR("device_register returned %d\n", ret); dev = &virtpcidev->generic_dev; SPAR_CHANNEL_CLIENT_TRANSITION(addparams->chanptr, BUS_ID(dev), @@ -983,11 +952,8 @@ static int virtpci_device_serverdown(struct device *parentbus, unsigned long flags; int rc = 0; - if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) { - LOGERR("**** FAILED to pause device; devtype:%d not vhba:%d or vnic:%d\n", - devtype, VIRTHBA_TYPE, VIRTNIC_TYPE); + if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) return 0; - } /* find the vhba or vnic in virtpci device list */ write_lock_irqsave(&vpcidev_list_lock, flags); @@ -1022,10 +988,8 @@ static int virtpci_device_serverdown(struct device *parentbus, } write_unlock_irqrestore(&vpcidev_list_lock, flags); - if (!found) { - LOGERR("**** FAILED to find vhba/vnic in the list\n"); + if (!found) return 0; - } return rc; } @@ -1042,11 +1006,9 @@ static int virtpci_device_serverup(struct device *parentbus, unsigned long flags; int rc = 0; - if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) { - LOGERR("**** FAILED to resume device; devtype:%d not vhba:%d or vnic:%d\n", - devtype, VIRTHBA_TYPE, VIRTNIC_TYPE); + if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) return 0; - } + /* find the vhba or vnic in virtpci device list */ write_lock_irqsave(&vpcidev_list_lock, flags); @@ -1090,10 +1052,8 @@ static int virtpci_device_serverup(struct device *parentbus, write_unlock_irqrestore(&vpcidev_list_lock, flags); - if (!found) { - LOGERR("**** FAILED to find vhba/vnic in the list\n"); + if (!found) return 0; - } return rc; } @@ -1112,11 +1072,8 @@ static int virtpci_device_del(struct device *parentbus, continue; \ } - if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) { - LOGERR("**** FAILED to delete device; devtype:%d not vhba:%d or vnic:%d\n", - devtype, VIRTHBA_TYPE, VIRTNIC_TYPE); + if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) return 0; - } /* see if we are to delete all - NOTE: all implies we have a * valid parentbus @@ -1183,10 +1140,8 @@ static int virtpci_device_del(struct device *parentbus, } write_unlock_irqrestore(&vpcidev_list_lock, flags); - if (!all && (count == 0)) { - LOGERR("**** FAILED to find vhba/vnic in the list\n"); + if (!all && (count == 0)) return 0; - } /* now delete each one from delete list */ while (dellist) { @@ -1253,10 +1208,9 @@ int virtpci_register_driver(struct virtpci_driver *drv) { int result = 0; - if (drv->id_table == NULL) { - LOGERR("id_table missing\n"); + if (drv->id_table == NULL) return 1; - } + /* initialize core driver fields needed to call driver_register */ drv->core_driver.name = drv->name; /* name of driver in sysfs */ drv->core_driver.bus = &virtpci_bus_type; /* type of bus this @@ -1338,7 +1292,6 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, printparam.len = &len; if (bus_for_each_dev(&virtpci_bus_type, NULL, (void *)&printparam, print_vbus)) - LOGERR("Failed to find bus\n"); str_pos += scnprintf(vbuf + str_pos, len - str_pos, "\n Virtual PCI devices\n"); @@ -1401,7 +1354,6 @@ static int __init virtpci_mod_init(void) * drivers directory */ if (ret) { - LOGERR("bus_register ****FAILED:%d\n", ret); POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, ret, POSTCODE_SEVERITY_ERR); return ret; @@ -1412,7 +1364,6 @@ static int __init virtpci_mod_init(void) /* create a root bus used to parent all the virtpci buses. */ ret = device_register(&virtpci_rootbus_device); if (ret) { - LOGERR("device_register FAILED:%d\n", ret); bus_unregister(&virtpci_bus_type); POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, ret, POSTCODE_SEVERITY_ERR); @@ -1421,7 +1372,6 @@ static int __init virtpci_mod_init(void) if (!uisctrl_register_req_handler(2, (void *)&virtpci_ctrlchan_func, &chipset_driver_info)) { - LOGERR("uisctrl_register_req_handler ****FAILED.\n"); POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); device_unregister(&virtpci_rootbus_device); bus_unregister(&virtpci_bus_type); @@ -1439,9 +1389,6 @@ static int __init virtpci_mod_init(void) static void __exit virtpci_mod_exit(void) { /* unregister the callback function */ - if (!uisctrl_register_req_handler(2, NULL, NULL)) - LOGERR("uisctrl_register_req_handler ****FAILED.\n"); - device_unregister(&virtpci_rootbus_device); bus_unregister(&virtpci_bus_type); debugfs_remove_recursive(virtpci_debugfs_dir); diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index 01b0b200feb6..de0a64624e3d 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c @@ -77,13 +77,11 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, visor_memregion_create_overlapped(parent->memregion, off, sizeof(struct channel_header)); if (p->memregion == NULL) { - ERRDRV("visor_memregion_create failed failed: (status=0)\n"); rc = NULL; goto cleanup; } if (visor_memregion_read(p->memregion, 0, &p->chan_hdr, sizeof(struct channel_header)) < 0) { - ERRDRV("visor_memregion_read failed: (status=0)\n"); rc = NULL; goto cleanup; } @@ -94,7 +92,6 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, /* we had better be a CLIENT of this channel */ guid = p->chan_hdr.chtype; if (visor_memregion_resize(p->memregion, channel_bytes) < 0) { - ERRDRV("visor_memregion_resize failed: (status=0)\n"); rc = NULL; goto cleanup; } @@ -255,10 +252,9 @@ visorchannel_clear(struct visorchannel *channel, ulong offset, u8 ch, int written = 0; u8 *buf = vmalloc(bufsize); - if (buf == NULL) { - ERRDRV("%s failed memory allocation", __func__); + if (buf == NULL) goto cleanup; - } + memset(buf, ch, bufsize); while (nbytes > 0) { ulong thisbytes = bufsize; @@ -323,10 +319,8 @@ sig_read_header(struct visorchannel *channel, u32 queue, { BOOL rc = FALSE; - if (channel->chan_hdr.ch_space_offset < sizeof(struct channel_header)) { - ERRDRV("oChannelSpace too small: (status=%d)\n", rc); + if (channel->chan_hdr.ch_space_offset < sizeof(struct channel_header)) goto cleanup; - } /* Read the appropriate SIGNAL_QUEUE_HEADER into local memory. */ @@ -334,10 +328,6 @@ sig_read_header(struct visorchannel *channel, u32 queue, SIG_QUEUE_OFFSET(&channel->chan_hdr, queue), sig_hdr, sizeof(struct signal_queue_header)) < 0) { - ERRDRV("queue=%d SIG_QUEUE_OFFSET=%d", - queue, (int)SIG_QUEUE_OFFSET(&channel->chan_hdr, queue)); - ERRDRV("visor_memregion_read of signal queue failed: (status=%d)\n", - rc); goto cleanup; } rc = TRUE; @@ -357,15 +347,11 @@ sig_do_data(struct visorchannel *channel, u32 queue, if (visor_memregion_write(channel->memregion, signal_data_offset, data, sig_hdr->signal_size) < 0) { - ERRDRV("visor_memregion_write of signal data failed: (status=%d)\n", - rc); goto cleanup; } } else { if (visor_memregion_read(channel->memregion, signal_data_offset, data, sig_hdr->signal_size) < 0) { - ERRDRV("visor_memregion_read of signal data failed: (status=%d)\n", - rc); goto cleanup; } } @@ -403,8 +389,6 @@ safe_sig_queue_validate(struct signal_queue_header *psafe_sqh, punsafe_sqh->head = *phead; punsafe_sqh->tail = *ptail; - ERRDRV("safe_sig_queue_validate: head = 0x%x, tail = 0x%x, MaxSlots = 0x%x", - *phead, *ptail, psafe_sqh->max_slots); return 0; } return 1; @@ -422,7 +406,6 @@ signalremove_inner(struct visorchannel *channel, u32 queue, void *msg) sig_hdr.tail = (sig_hdr.tail + 1) % sig_hdr.max_slots; if (!sig_read_data(channel, queue, &sig_hdr, sig_hdr.tail, msg)) { - ERRDRV("sig_read_data failed\n"); return FALSE; } sig_hdr.num_received++; @@ -431,14 +414,10 @@ signalremove_inner(struct visorchannel *channel, u32 queue, void *msg) * update host memory. */ mb(); /* required for channel synch */ - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail)) { - ERRDRV("visor_memregion_write of Tail failed\n"); + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail)) return FALSE; - } - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received)) { - ERRDRV("visor_memregion_write of NumSignalsReceived failed\n"); + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received)) return FALSE; - } return TRUE; } @@ -470,28 +449,28 @@ signalinsert_inner(struct visorchannel *channel, u32 queue, void *msg) sig_hdr.head = ((sig_hdr.head + 1) % sig_hdr.max_slots); if (sig_hdr.head == sig_hdr.tail) { sig_hdr.num_overflows++; - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_overflows)) - ERRDRV("visor_memregion_write of NumOverflows failed\n"); - + visor_memregion_write(channel->memregion, + SIG_QUEUE_OFFSET(&channel->chan_hdr, + queue) + + offsetof(struct signal_queue_header, + num_overflows), + &(sig_hdr.num_overflows), + sizeof(sig_hdr.num_overflows)); return FALSE; } - if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg)) { - ERRDRV("sig_write_data failed\n"); + if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg)) return FALSE; - } + sig_hdr.num_sent++; /* For each data field in SIGNAL_QUEUE_HEADER that was modified, * update host memory. */ mb(); /* required for channel synch */ - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, head)) { - ERRDRV("visor_memregion_write of Head failed\n"); + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, head)) return FALSE; - } if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_sent)) { - ERRDRV("visor_memregion_write of NumSignalsSent failed\n"); return FALSE; } @@ -581,15 +560,13 @@ visorchannel_debug(struct visorchannel *channel, int num_queues, int i = 0; int errcode = 0; - if (channel == NULL) { - ERRDRV("%s no channel", __func__); + if (channel == NULL) return; - } + memregion = channel->memregion; - if (memregion == NULL) { - ERRDRV("%s no memregion", __func__); + if (memregion == NULL) return; - } + addr = visor_memregion_get_physaddr(memregion); nbytes_region = visor_memregion_get_nbytes(memregion); errcode = visorchannel_read(channel, off, @@ -669,11 +646,8 @@ visorchannel_dump_section(struct visorchannel *chan, char *s, goto fmt_failed; errcode = visorchannel_read(chan, off, buf, len); - if (errcode < 0) { - ERRDRV("%s failed to read %s from channel errcode=%d", - s, __func__, errcode); + if (errcode < 0) goto read_failed; - } seq_printf(seq, "channel %s:\n", s); tbuf = buf; while (len > 0) { diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index b37113263151..9ca7f1eb1e7e 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -60,25 +60,18 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) file_cdev.owner = THIS_MODULE; if (MAJOR(majordev) == 0) { /* dynamic major device number registration required */ - if (alloc_chrdev_region(&majordev, 0, 1, MYDRVNAME) < 0) { - ERRDRV("Unable to allocate+register char device %s", - MYDRVNAME); + if (alloc_chrdev_region(&majordev, 0, 1, MYDRVNAME) < 0) return -1; - } registered = TRUE; } else { /* static major device number registration required */ - if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0) { - ERRDRV("Unable to register char device %s", MYDRVNAME); + if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0) return -1; - } registered = TRUE; } rc = cdev_add(&file_cdev, MKDEV(MAJOR(majordev), 0), 1); - if (rc < 0) { - ERRDRV("failed to create char device: (status=%d)\n", rc); + if (rc < 0) return -1; - } return 0; } @@ -122,15 +115,13 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma) GUEST_PHYSICAL_ADDRESS addr = 0; /* sv_enable_dfp(); */ - if (offset & (PAGE_SIZE - 1)) { - ERRDRV("%s virtual address NOT page-aligned!", __func__); + if (offset & (PAGE_SIZE - 1)) return -ENXIO; /* need aligned offsets */ - } + switch (offset) { case VISORCHIPSET_MMAP_CONTROLCHANOFFSET: vma->vm_flags |= VM_IO; if (*file_controlvm_channel == NULL) { - ERRDRV("%s no controlvm channel yet", __func__); return -ENXIO; } visorchannel_read(*file_controlvm_channel, @@ -138,7 +129,6 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma) gp_control_channel), &addr, sizeof(addr)); if (addr == 0) { - ERRDRV("%s control channel address is 0", __func__); return -ENXIO; } physaddr = (ulong)addr; @@ -147,7 +137,6 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma) vma->vm_end - vma->vm_start, /*pgprot_noncached */ (vma->vm_page_prot))) { - ERRDRV("%s remap_pfn_range failed", __func__); return -EAGAIN; } break; @@ -179,7 +168,6 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd, } return issue_vmcall_update_physical_time(adjustment); default: - LOGERR("visorchipset_ioctl received invalid command"); return -EFAULT; } } diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 686fe6474ee3..0683472ba47c 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -59,9 +59,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, allocbytes++; if ((Controlvm_Payload_Bytes_Buffered + bytes) > MAX_CONTROLVM_PAYLOAD_BYTES) { - ERRDRV("%s (%s:%d) - prevented allocation of %d bytes to prevent exceeding throttling max (%d)", - __func__, __FILE__, __LINE__, allocbytes, - MAX_CONTROLVM_PAYLOAD_BYTES); if (tryAgain) *tryAgain = TRUE; rc = NULL; @@ -84,9 +81,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, void *p; if (addr > virt_to_phys(high_memory - 1)) { - ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)", - __func__, - (unsigned long long) addr, (ulong) bytes); rc = NULL; goto Away; } @@ -110,27 +104,15 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, } phdr = (struct spar_controlvm_parameters_header *)(ctx->data); if (phdr->total_length != bytes) { - ERRDRV("%s - bad total length %lu (should be %lu)", - __func__, - (ulong) (phdr->total_length), (ulong) (bytes)); rc = NULL; goto Away; } if (phdr->total_length < phdr->header_length) { - ERRDRV("%s - total length < header length (%lu < %lu)", - __func__, - (ulong) (phdr->total_length), - (ulong) (phdr->header_length)); rc = NULL; goto Away; } if (phdr->header_length < sizeof(struct spar_controlvm_parameters_header)) { - ERRDRV("%s - header is too small (%lu < %lu)", - __func__, - (ulong) (phdr->header_length), - (ulong)(sizeof( - struct spar_controlvm_parameters_header))); rc = NULL; goto Away; } @@ -198,11 +180,8 @@ parser_id_get(PARSER_CONTEXT *ctx) { struct spar_controlvm_parameters_header *phdr = NULL; - if (ctx == NULL) { - ERRDRV("%s (%s:%d) - no context", - __func__, __FILE__, __LINE__); + if (ctx == NULL) return NULL_UUID_LE; - } phdr = (struct spar_controlvm_parameters_header *)(ctx->data); return phdr->id; } @@ -212,11 +191,8 @@ parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string) { struct spar_controlvm_parameters_header *phdr = NULL; - if (ctx == NULL) { - ERRDRV("%s (%s:%d) - no context", - __func__, __FILE__, __LINE__); + if (ctx == NULL) goto Away; - } phdr = (struct spar_controlvm_parameters_header *)(ctx->data); switch (which_string) { case PARSERSTRING_INITIATOR: @@ -236,7 +212,6 @@ parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string) ctx->bytes_remaining = phdr->name_length; break; default: - ERRDRV("%s - bad which_string %d", __func__, which_string); break; } @@ -319,25 +294,18 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize) } while (*pscan != ':') { - if (namesize <= 0) { - ERRDRV("%s - name too big", __func__); + if (namesize <= 0) return NULL; - } *pnam = toupper(*pscan); pnam++; namesize--; pscan++; nscan--; - if (nscan == 0) { - ERRDRV("%s - unexpected end of input parsing name", - __func__); + if (nscan == 0) return NULL; - } } - if (namesize <= 0) { - ERRDRV("%s - name too big", __func__); + if (namesize <= 0) return NULL; - } *pnam = '\0'; nam[string_length_no_trail(nam, strlen(nam))] = '\0'; @@ -348,26 +316,17 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize) while (isspace(*pscan)) { pscan++; nscan--; - if (nscan == 0) { - ERRDRV("%s - unexpected end of input looking for value", - __func__); + if (nscan == 0) return NULL; - } } - if (nscan == 0) { - ERRDRV("%s - unexpected end of input looking for value", - __func__); + if (nscan == 0) return NULL; - } if (*pscan == '\'' || *pscan == '"') { closing_quote = *pscan; pscan++; nscan--; - if (nscan == 0) { - ERRDRV("%s - unexpected end of input after %c", - __func__, closing_quote); + if (nscan == 0) return NULL; - } } /* look for a separator character, terminator character, or @@ -375,10 +334,8 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize) */ for (i = 0, value_length = -1; i < nscan; i++) { if (closing_quote) { - if (pscan[i] == '\0') { - ERRDRV("%s - unexpected end of input parsing quoted value", __func__); + if (pscan[i] == '\0') return NULL; - } if (pscan[i] == closing_quote) { value_length = i; break; @@ -391,10 +348,8 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize) } } if (value_length < 0) { - if (closing_quote) { - ERRDRV("%s - unexpected end of input parsing quoted value", __func__); + if (closing_quote) return NULL; - } value_length = nscan; } orig_value_length = value_length; @@ -431,7 +386,6 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize) pscan++; nscan--; } else if (*pscan != '\0') { - ERRDRV("%s - missing separator after quoted string", __func__); kfree(value); value = NULL; return NULL; diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index a49ba6141544..74a27e37f437 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -659,7 +659,6 @@ chipset_init(struct controlvm_message *inmsg) POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO); if (chipset_inited) { - LOGERR("CONTROLVM_CHIPSET_INIT Failed: Already Done."); rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; goto Away; } @@ -717,7 +716,6 @@ controlvm_respond(struct controlvm_message_header *msgHdr, int response) if (!visorchannel_signalinsert(ControlVm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { - LOGERR("signalinsert failed!"); return; } } @@ -733,7 +731,6 @@ controlvm_respond_chipset_init(struct controlvm_message_header *msgHdr, outmsg.cmd.init_chipset.features = features; if (!visorchannel_signalinsert(ControlVm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { - LOGERR("signalinsert failed!"); return; } } @@ -749,7 +746,6 @@ static void controlvm_respond_physdev_changestate( outmsg.cmd.device_change_state.flags.phys_device = 1; if (!visorchannel_signalinsert(ControlVm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { - LOGERR("signalinsert failed!"); return; } } @@ -766,15 +762,12 @@ visorchipset_save_message(struct controlvm_message *msg, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_count), &localSavedCrashMsgCount, sizeof(u16)) < 0) { - LOGERR("failed to get Saved Message Count"); POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; } if (localSavedCrashMsgCount != CONTROLVM_CRASHMSG_MAX) { - LOGERR("Saved Message Count incorrect %d", - localSavedCrashMsgCount); POSTCODE_LINUX_3(CRASH_DEV_COUNT_FAILURE_PC, localSavedCrashMsgCount, POSTCODE_SEVERITY_ERR); @@ -786,7 +779,6 @@ visorchipset_save_message(struct controlvm_message *msg, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_offset), &localSavedCrashMsgOffset, sizeof(u32)) < 0) { - LOGERR("failed to get Saved Message Offset"); POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -797,7 +789,6 @@ visorchipset_save_message(struct controlvm_message *msg, localSavedCrashMsgOffset, msg, sizeof(struct controlvm_message)) < 0) { - LOGERR("SAVE_MSG_BUS_FAILURE: Failed to write CrashCreateBusMsg!"); POSTCODE_LINUX_2(SAVE_MSG_BUS_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -807,7 +798,6 @@ visorchipset_save_message(struct controlvm_message *msg, localSavedCrashMsgOffset + sizeof(struct controlvm_message), msg, sizeof(struct controlvm_message)) < 0) { - LOGERR("SAVE_MSG_DEV_FAILURE: Failed to write CrashCreateDevMsg!"); POSTCODE_LINUX_2(SAVE_MSG_DEV_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -823,10 +813,9 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response) BOOL need_clear = FALSE; p = findbus(&BusInfoList, busNo); - if (!p) { - LOGERR("internal error busNo=%lu", busNo); + if (!p) return; - } + if (response < 0) { if ((cmdId == CONTROLVM_BUS_CREATE) && (response != (-CONTROLVM_RESP_ERROR_ALREADY_DONE))) @@ -839,14 +828,10 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response) need_clear = TRUE; } - if (p->pending_msg_hdr.id == CONTROLVM_INVALID) { - LOGERR("bus_responder no pending msg"); + if (p->pending_msg_hdr.id == CONTROLVM_INVALID) return; /* no controlvm response needed */ - } - if (p->pending_msg_hdr.id != (u32) cmdId) { - LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id); + if (p->pending_msg_hdr.id != (u32) cmdId) return; - } controlvm_respond(&p->pending_msg_hdr, response); p->pending_msg_hdr.id = CONTROLVM_INVALID; if (need_clear) { @@ -864,18 +849,12 @@ device_changestate_responder(enum controlvm_id cmdId, struct controlvm_message outmsg; p = finddevice(&DevInfoList, busNo, devNo); - if (!p) { - LOGERR("internal error; busNo=%lu, devNo=%lu", busNo, devNo); + if (!p) return; - } - if (p->pending_msg_hdr.id == CONTROLVM_INVALID) { - LOGERR("device_responder no pending msg"); + if (p->pending_msg_hdr.id == CONTROLVM_INVALID) return; /* no controlvm response needed */ - } - if (p->pending_msg_hdr.id != cmdId) { - LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id); + if (p->pending_msg_hdr.id != cmdId) return; - } controlvm_init_response(&outmsg, &p->pending_msg_hdr, response); @@ -884,10 +863,8 @@ device_changestate_responder(enum controlvm_id cmdId, outmsg.cmd.device_change_state.state = responseState; if (!visorchannel_signalinsert(ControlVm_channel, - CONTROLVM_QUEUE_REQUEST, &outmsg)) { - LOGERR("signalinsert failed!"); + CONTROLVM_QUEUE_REQUEST, &outmsg)) return; - } p->pending_msg_hdr.id = CONTROLVM_INVALID; } @@ -900,10 +877,8 @@ device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, BOOL need_clear = FALSE; p = finddevice(&DevInfoList, busNo, devNo); - if (!p) { - LOGERR("internal error; busNo=%lu, devNo=%lu", busNo, devNo); + if (!p) return; - } if (response >= 0) { if (cmdId == CONTROLVM_DEVICE_CREATE) p->state.created = 1; @@ -911,14 +886,12 @@ device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, need_clear = TRUE; } - if (p->pending_msg_hdr.id == CONTROLVM_INVALID) { - LOGERR("device_responder no pending msg"); + if (p->pending_msg_hdr.id == CONTROLVM_INVALID) return; /* no controlvm response needed */ - } - if (p->pending_msg_hdr.id != (u32) cmdId) { - LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id); + + if (p->pending_msg_hdr.id != (u32) cmdId) return; - } + controlvm_respond(&p->pending_msg_hdr, response); p->pending_msg_hdr.id = CONTROLVM_INVALID; if (need_clear) @@ -934,10 +907,9 @@ bus_epilog(u32 busNo, struct visorchipset_bus_info *pBusInfo = findbus(&BusInfoList, busNo); - if (!pBusInfo) { - LOGERR("HUH? bad busNo=%d", busNo); + if (!pBusInfo) return; - } + if (needResponse) { memcpy(&pBusInfo->pending_msg_hdr, msgHdr, sizeof(struct controlvm_message_header)); @@ -1007,10 +979,9 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, NULL }; - if (!pDevInfo) { - LOGERR("HUH? bad busNo=%d, devNo=%d", busNo, devNo); + if (!pDevInfo) return; - } + if (for_visorbus) notifiers = &BusDev_Server_Notifiers; else @@ -1100,8 +1071,6 @@ bus_create(struct controlvm_message *inmsg) pBusInfo = findbus(&BusInfoList, busNo); if (pBusInfo && (pBusInfo->state.created == 1)) { - LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu already exists", - busNo); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; @@ -1152,13 +1121,10 @@ bus_destroy(struct controlvm_message *inmsg) pBusInfo = findbus(&BusInfoList, busNo); if (!pBusInfo) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu invalid", busNo); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; goto Away; } if (pBusInfo->state.created == 0) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu already destroyed", - busNo); rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; goto Away; } @@ -1182,16 +1148,12 @@ bus_configure(struct controlvm_message *inmsg, PARSER_CONTEXT *parser_ctx) pBusInfo = findbus(&BusInfoList, busNo); if (!pBusInfo) { - LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu invalid", - busNo); POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; goto Away; } if (pBusInfo->state.created == 0) { - LOGERR("CONTROLVM_BUS_CONFIGURE Failed: Invalid bus %lu - not created yet", - busNo); POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; @@ -1199,8 +1161,6 @@ bus_configure(struct controlvm_message *inmsg, PARSER_CONTEXT *parser_ctx) } /* TBD - add this check to other commands also... */ if (pBusInfo->pending_msg_hdr.id != CONTROLVM_INVALID) { - LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu MsgId=%u outstanding", - busNo, (uint) pBusInfo->pending_msg_hdr.id); POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT; @@ -1231,8 +1191,6 @@ my_device_create(struct controlvm_message *inmsg) pDevInfo = finddevice(&DevInfoList, busNo, devNo); if (pDevInfo && (pDevInfo->state.created == 1)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: busNo=%lu, devNo=%lu already exists", - busNo, devNo); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; @@ -1240,16 +1198,12 @@ my_device_create(struct controlvm_message *inmsg) } pBusInfo = findbus(&BusInfoList, busNo); if (!pBusInfo) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: Invalid bus %lu - out of range", - busNo); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; goto Away; } if (pBusInfo->state.created == 0) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: Invalid bus %lu - not created yet", - busNo); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; @@ -1307,16 +1261,12 @@ my_device_changestate(struct controlvm_message *inmsg) pDevInfo = finddevice(&DevInfoList, busNo, devNo); if (!pDevInfo) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: busNo=%lu, devNo=%lu invalid (doesn't exist)", - busNo, devNo); POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; goto Away; } if (pDevInfo->state.created == 0) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: busNo=%lu, devNo=%lu invalid (not created)", - busNo, devNo); POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; @@ -1341,14 +1291,10 @@ my_device_destroy(struct controlvm_message *inmsg) pDevInfo = finddevice(&DevInfoList, busNo, devNo); if (!pDevInfo) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu invalid", - busNo, devNo); rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; goto Away; } if (pDevInfo->state.created == 0) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu already destroyed", - busNo, devNo); rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -1375,22 +1321,16 @@ initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes, int rc = CONTROLVM_RESP_SUCCESS; if (info == NULL) { - LOGERR("HUH ? CONTROLVM_PAYLOAD_INIT Failed : Programmer check at %s:%d", - __FILE__, __LINE__); rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID; goto Away; } memset(info, 0, sizeof(struct controlvm_payload_info)); if ((offset == 0) || (bytes == 0)) { - LOGERR("CONTROLVM_PAYLOAD_INIT Failed: request_payload_offset=%llu request_payload_bytes=%llu!", - (u64) offset, (u64) bytes); rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID; goto Away; } payload = ioremap_cache(phys_addr + offset, bytes); if (payload == NULL) { - LOGERR("CONTROLVM_PAYLOAD_INIT Failed: ioremap_cache %llu for %llu bytes failed", - (u64) offset, (u64) bytes); rc = -CONTROLVM_RESP_ERROR_IOREMAP_FAILED; goto Away; } @@ -1430,7 +1370,6 @@ initialize_controlvm_payload(void) offsetof(struct spar_controlvm_channel_protocol, request_payload_offset), &payloadOffset, sizeof(payloadOffset)) < 0) { - LOGERR("CONTROLVM_PAYLOAD_INIT Failed to read controlvm channel!"); POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -1439,7 +1378,6 @@ initialize_controlvm_payload(void) offsetof(struct spar_controlvm_channel_protocol, request_payload_bytes), &payloadBytes, sizeof(payloadBytes)) < 0) { - LOGERR("CONTROLVM_PAYLOAD_INIT Failed to read controlvm channel!"); POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -1532,11 +1470,8 @@ read_controlvm_event(struct controlvm_message *msg) if (visorchannel_signalremove(ControlVm_channel, CONTROLVM_QUEUE_EVENT, msg)) { /* got a message */ - if (msg->hdr.flags.test_message == 1) { - LOGERR("ignoring bad CONTROLVM_QUEUE_EVENT msg with controlvm_msg_id=0x%x because Flags.testMessage is nonsensical (=1)", - msg->hdr.id); + if (msg->hdr.flags.test_message == 1) return FALSE; - } return TRUE; } return FALSE; @@ -1714,10 +1649,8 @@ parahotplug_process_message(struct controlvm_message *inmsg) req = parahotplug_request_create(inmsg); - if (req == NULL) { - LOGERR("parahotplug_process_message: couldn't allocate request"); + if (req == NULL) return; - } if (inmsg->cmd.device_change_state.state.active) { /* For enable messages, just respond with success @@ -1771,10 +1704,8 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) /* create parsing context if necessary */ isLocalAddr = (inmsg.hdr.flags.test_message == 1); - if (channel_addr == 0) { - LOGERR("HUH? channel_addr is 0!"); + if (channel_addr == 0) return TRUE; - } parametersAddr = channel_addr + inmsg.hdr.payload_vm_offset; parametersBytes = inmsg.hdr.payload_bytes; @@ -1856,7 +1787,6 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) chipset_notready(&inmsg.hdr); break; default: - LOGERR("unrecognized controlvm cmd=%d", (int) inmsg.hdr.id); if (inmsg.hdr.flags.response_expected) controlvm_respond(&inmsg.hdr, -CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN); @@ -1875,11 +1805,9 @@ static HOSTADDRESS controlvm_get_channel_address(void) u64 addr = 0; u32 size = 0; - if (!VMCALL_SUCCESSFUL(issue_vmcall_io_controlvm_addr(&addr, &size))) { - ERRDRV("%s - vmcall to determine controlvm channel addr failed", - __func__); + if (!VMCALL_SUCCESSFUL(issue_vmcall_io_controlvm_addr(&addr, &size))) return 0; - } + return addr; } @@ -1922,12 +1850,6 @@ controlvm_periodic_work(struct work_struct *work) while (visorchannel_signalremove(ControlVm_channel, CONTROLVM_QUEUE_RESPONSE, &inmsg)) { - if (inmsg.hdr.payload_max_bytes != 0) { - LOGERR("Payload of size %lu returned @%lu with unexpected message id %d.", - (ulong) inmsg.hdr.payload_max_bytes, - (ulong) inmsg.hdr.payload_vm_offset, - inmsg.hdr.id); - } } if (!gotACommand) { if (ControlVm_Pending_Msg_Valid) { @@ -2020,15 +1942,12 @@ setup_crash_devices_work_queue(struct work_struct *work) offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_count), &localSavedCrashMsgCount, sizeof(u16)) < 0) { - LOGERR("failed to get Saved Message Count"); POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; } if (localSavedCrashMsgCount != CONTROLVM_CRASHMSG_MAX) { - LOGERR("Saved Message Count incorrect %d", - localSavedCrashMsgCount); POSTCODE_LINUX_3(CRASH_DEV_COUNT_FAILURE_PC, localSavedCrashMsgCount, POSTCODE_SEVERITY_ERR); @@ -2040,7 +1959,6 @@ setup_crash_devices_work_queue(struct work_struct *work) offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_offset), &localSavedCrashMsgOffset, sizeof(u32)) < 0) { - LOGERR("failed to get Saved Message Offset"); POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -2051,7 +1969,6 @@ setup_crash_devices_work_queue(struct work_struct *work) localSavedCrashMsgOffset, &localCrashCreateBusMsg, sizeof(struct controlvm_message)) < 0) { - LOGERR("CRASH_DEV_RD_BUS_FAIULRE: Failed to read CrashCreateBusMsg!"); POSTCODE_LINUX_2(CRASH_DEV_RD_BUS_FAIULRE_PC, POSTCODE_SEVERITY_ERR); return; @@ -2063,7 +1980,6 @@ setup_crash_devices_work_queue(struct work_struct *work) sizeof(struct controlvm_message), &localCrashCreateDevMsg, sizeof(struct controlvm_message)) < 0) { - LOGERR("CRASH_DEV_RD_DEV_FAIULRE: Failed to read CrashCreateDevMsg!"); POSTCODE_LINUX_2(CRASH_DEV_RD_DEV_FAIULRE_PC, POSTCODE_SEVERITY_ERR); return; @@ -2073,7 +1989,6 @@ setup_crash_devices_work_queue(struct work_struct *work) if (localCrashCreateBusMsg.cmd.create_bus.channel_addr != 0) bus_create(&localCrashCreateBusMsg); else { - LOGERR("CrashCreateBusMsg is null, no dump will be taken"); POSTCODE_LINUX_2(CRASH_DEV_BUS_NULL_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -2083,7 +1998,6 @@ setup_crash_devices_work_queue(struct work_struct *work) if (localCrashCreateDevMsg.cmd.create_device.channel_addr != 0) my_device_create(&localCrashCreateDevMsg); else { - LOGERR("CrashCreateDevMsg is null, no dump will be taken"); POSTCODE_LINUX_2(CRASH_DEV_DEV_NULL_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -2146,10 +2060,8 @@ visorchipset_get_bus_info(ulong bus_no, struct visorchipset_bus_info *bus_info) { void *p = findbus(&BusInfoList, bus_no); - if (!p) { - LOGERR("(%lu) failed", bus_no); + if (!p) return FALSE; - } memcpy(bus_info, p, sizeof(struct visorchipset_bus_info)); return TRUE; } @@ -2160,10 +2072,8 @@ visorchipset_set_bus_context(ulong bus_no, void *context) { struct visorchipset_bus_info *p = findbus(&BusInfoList, bus_no); - if (!p) { - LOGERR("(%lu) failed", bus_no); + if (!p) return FALSE; - } p->bus_driver_context = context; return TRUE; } @@ -2175,10 +2085,8 @@ visorchipset_get_device_info(ulong bus_no, ulong dev_no, { void *p = finddevice(&DevInfoList, bus_no, dev_no); - if (!p) { - LOGERR("(%lu,%lu) failed", bus_no, dev_no); + if (!p) return FALSE; - } memcpy(dev_info, p, sizeof(struct visorchipset_device_info)); return TRUE; } @@ -2190,10 +2098,8 @@ visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context) struct visorchipset_device_info *p = finddevice(&DevInfoList, bus_no, dev_no); - if (!p) { - LOGERR("(%lu,%lu) failed", bus_no, dev_no); + if (!p) return FALSE; - } p->bus_driver_context = context; return TRUE; } @@ -2221,10 +2127,9 @@ visorchipset_cache_alloc(struct kmem_cache *pool, BOOL ok_to_block, */ gfp |= __GFP_NORETRY; p = kmem_cache_alloc(pool, gfp); - if (!p) { - LOGERR("kmem_cache_alloc failed early @%s:%d\n", fn, ln); + if (!p) return NULL; - } + atomic_inc(&Visorchipset_cache_buffers_in_use); return p; } @@ -2234,10 +2139,9 @@ visorchipset_cache_alloc(struct kmem_cache *pool, BOOL ok_to_block, void visorchipset_cache_free(struct kmem_cache *pool, void *p, char *fn, int ln) { - if (!p) { - LOGERR("NULL pointer @%s:%d\n", fn, ln); + if (!p) return; - } + atomic_dec(&Visorchipset_cache_buffers_in_use); kmem_cache_free(pool, p); } @@ -2308,8 +2212,6 @@ visorchipset_init(void) atomic_set(&LiveDump_info.buffers_in_use, 0); if (visorchipset_testvnic) { - ERRDRV("testvnic option no longer supported: (status = %d)\n", - x); POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, x, DIAG_SEVERITY_ERR); rc = x; goto Away; @@ -2326,20 +2228,17 @@ visorchipset_init(void) visorchannel_get_header(ControlVm_channel))) { initialize_controlvm_payload(); } else { - LOGERR("controlvm channel is invalid"); visorchannel_destroy(ControlVm_channel); ControlVm_channel = NULL; return -ENODEV; } } else { - LOGERR("no controlvm channel discovered"); return -ENODEV; } MajorDev = MKDEV(visorchipset_major, 0); rc = visorchipset_file_init(MajorDev, &ControlVm_channel); if (rc < 0) { - ERRDRV("visorchipset_file_init(MajorDev, &ControlVm_channel): error (status=%d)\n", rc); POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR); goto Away; } @@ -2355,7 +2254,6 @@ visorchipset_init(void) sizeof(struct putfile_buffer_entry), 0, SLAB_HWCACHE_ALIGN, NULL); if (!Putfile_buffer_list_pool) { - ERRDRV("failed to alloc Putfile_buffer_list_pool: (status=-1)\n"); POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR); rc = -1; goto Away; @@ -2372,8 +2270,6 @@ visorchipset_init(void) create_singlethread_workqueue("visorchipset_controlvm"); if (Periodic_controlvm_workqueue == NULL) { - ERRDRV("cannot create controlvm workqueue: (status=%d)\n", - -ENOMEM); POSTCODE_LINUX_2(CREATE_WORKQUEUE_FAILED_PC, DIAG_SEVERITY_ERR); rc = -ENOMEM; @@ -2384,7 +2280,6 @@ visorchipset_init(void) rc = queue_delayed_work(Periodic_controlvm_workqueue, &Periodic_controlvm_work, Poll_jiffies); if (rc < 0) { - ERRDRV("queue_delayed_work(Periodic_controlvm_workqueue, &Periodic_controlvm_work, Poll_jiffies): error (status=%d)\n", rc); POSTCODE_LINUX_2(QUEUE_DELAYED_WORK_PC, DIAG_SEVERITY_ERR); goto Away; @@ -2394,7 +2289,6 @@ visorchipset_init(void) Visorchipset_platform_device.dev.devt = MajorDev; if (platform_device_register(&Visorchipset_platform_device) < 0) { - ERRDRV("platform_device_register(visorchipset) failed: (status=-1)\n"); POSTCODE_LINUX_2(DEVICE_REGISTER_FAILURE_PC, DIAG_SEVERITY_ERR); rc = -1; goto Away; @@ -2403,7 +2297,6 @@ visorchipset_init(void) rc = 0; Away: if (rc) { - LOGERR("visorchipset_init failed"); POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, rc, POSTCODE_SEVERITY_ERR); } diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index e2ee5ee7585e..c91752a2d06b 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -39,11 +39,8 @@ struct charqueue *visor_charqueue_create(ulong nslots) struct charqueue *cq; cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); - if (cq == NULL) { - ERRDRV("visor_charqueue_create allocation failed (alloc_size=%d)", - alloc_size); + if (cq == NULL) return NULL; - } cq->alloc_size = alloc_size; cq->nslots = nslots; cq->head = 0; diff --git a/drivers/staging/unisys/visorutil/easyproc.c b/drivers/staging/unisys/visorutil/easyproc.c index 40f1ae9a155c..53408056268e 100644 --- a/drivers/staging/unisys/visorutil/easyproc.c +++ b/drivers/staging/unisys/visorutil/easyproc.c @@ -61,9 +61,6 @@ static struct proc_dir_entry * createProcDir(char *name, struct proc_dir_entry *parent) { struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent); - - if (p == NULL) - ERRDRV("failed to create /proc directory %s", name); return p; } @@ -114,8 +111,6 @@ void visor_easyproc_InitDriver(struct easyproc_driver_info *pdriver, { memset(pdriver, 0, sizeof(struct easyproc_driver_info)); pdriver->ProcId = procId; - if (pdriver->ProcId == NULL) - ERRDRV("ProcId cannot be NULL (trouble ahead)!"); pdriver->Show_driver_info = show_driver_info; pdriver->Show_device_info = show_device_info; if (pdriver->ProcDir == NULL) @@ -132,9 +127,6 @@ void visor_easyproc_InitDriver(struct easyproc_driver_info *pdriver, proc_create_data("diag", 0, pdriver->ProcDriverDir, &proc_fops_driver, pdriver); - if (pdriver->ProcDriverDiagFile == NULL) - ERRDRV("failed to register /proc/%s/driver/diag entry", - pdriver->ProcId); } } EXPORT_SYMBOL_GPL(visor_easyproc_InitDriver); @@ -209,10 +201,6 @@ void visor_easyproc_InitDevice(struct easyproc_driver_info *pdriver, p->procDevicexDiagFile = proc_create_data("diag", 0, p->procDevicexDir, &proc_fops_device, p); - if (p->procDevicexDiagFile == NULL) - ERRDEVX(devno, "failed to register /proc/%s/device/%d/diag entry", - pdriver->ProcId, devno - ); } memset(&(p->device_property_info[0]), 0, sizeof(p->device_property_info)); @@ -229,34 +217,26 @@ void visor_easyproc_CreateDeviceProperty(struct easyproc_device_info *p, size_t i; struct easyproc_device_property_info *px = NULL; - if (p->procDevicexDir == NULL) { - ERRDRV("state error"); + if (p->procDevicexDir == NULL) return; - } for (i = 0; i < ARRAY_SIZE(p->device_property_info); i++) { if (p->device_property_info[i].procEntry == NULL) { px = &(p->device_property_info[i]); break; } } - if (!px) { - ERRDEVX(p->devno, "too many device properties"); + if (!px) return; - } + px->devdata = p->devdata; px->pdriver = p->pdriver; px->procEntry = proc_create_data(property_name, 0, p->procDevicexDir, &proc_fops_device_property, px); if (strlen(property_name)+1 > sizeof(px->property_name)) { - ERRDEVX(p->devno, "device property name %s too long", - property_name); return; } strcpy(px->property_name, property_name); if (px->procEntry == NULL) { - ERRDEVX(p->devno, - "failed to register /proc/%s/device/%d/%s entry", - p->pdriver->ProcId, p->devno, property_name); return; } px->show_device_property_info = show_property_info; diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index aa52a6fd1bf0..07aa2975bd6a 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -44,10 +44,9 @@ visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) struct memregion *memregion; memregion = kzalloc(sizeof(*memregion), GFP_KERNEL | __GFP_NORETRY); - if (memregion == NULL) { - ERRDRV("visor_memregion_create allocation failed"); + if (memregion == NULL) return NULL; - } + memregion->physaddr = physaddr; memregion->nbytes = nbytes; memregion->overlapped = FALSE; @@ -71,20 +70,16 @@ visor_memregion_create_overlapped(struct memregion *parent, ulong offset, { struct memregion *memregion = NULL; - if (parent == NULL) { - ERRDRV("%s parent is NULL", __func__); + if (parent == NULL) return NULL; - } - if (parent->mapped == NULL) { - ERRDRV("%s parent is not mapped!", __func__); + + if (parent->mapped == NULL) return NULL; - } + if ((offset >= parent->nbytes) || - ((offset + nbytes) >= parent->nbytes)) { - ERRDRV("%s range (%lu,%lu) out of parent range", - __func__, offset, nbytes); + ((offset + nbytes) >= parent->nbytes)) return NULL; - } + memregion = kzalloc(sizeof(*memregion), GFP_KERNEL|__GFP_NORETRY); if (memregion == NULL) return NULL; @@ -105,17 +100,11 @@ mapit(struct memregion *memregion) ulong nbytes = memregion->nbytes; memregion->requested = FALSE; - if (!request_mem_region(physaddr, nbytes, MYDRVNAME)) - ERRDRV("cannot reserve channel memory @0x%lx for 0x%lx-- no big deal", - physaddr, nbytes); - else + if (request_mem_region(physaddr, nbytes, MYDRVNAME)) memregion->requested = TRUE; memregion->mapped = ioremap_cache(physaddr, nbytes); - if (memregion->mapped == NULL) { - ERRDRV("cannot ioremap_cache channel memory @0x%lx for 0x%lx", - physaddr, nbytes); + if (!memregion->mapped) return FALSE; - } return TRUE; } @@ -179,10 +168,9 @@ memregion_readwrite(BOOL is_write, struct memregion *memregion, ulong offset, void *local, ulong nbytes) { - if (offset + nbytes > memregion->nbytes) { - ERRDRV("memregion_readwrite offset out of range!!"); + if (offset + nbytes > memregion->nbytes) return -EIO; - } + if (is_write) memcpy_toio(memregion->mapped + offset, local, nbytes); else diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index 411fd1ea0784..f8f2e2461b2e 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c @@ -90,7 +90,6 @@ BOOL visor_periodic_work_nextperiod(struct periodic_work *pw) goto unlock; } else if (queue_delayed_work(pw->workqueue, &pw->work, pw->jiffy_interval) < 0) { - ERRDEV(pw->devnam, "queue_delayed_work failed!"); pw->is_scheduled = FALSE; rc = FALSE; goto unlock; @@ -116,15 +115,12 @@ BOOL visor_periodic_work_start(struct periodic_work *pw) goto unlock; } if (pw->want_to_stop) { - ERRDEV(pw->devnam, - "dev_start_periodic_work failed!"); rc = FALSE; goto unlock; } INIT_DELAYED_WORK(&pw->work, &periodic_work_func); if (queue_delayed_work(pw->workqueue, &pw->work, pw->jiffy_interval) < 0) { - ERRDEV(pw->devnam, "%s queue_delayed_work failed!", __func__); rc = FALSE; goto unlock; } diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c index 0672e8c9f686..0ba75547b2c5 100644 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ b/drivers/staging/unisys/visorutil/procobjecttree.c @@ -96,8 +96,6 @@ createProcDir(const char *name, struct proc_dir_entry *parent) { struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent); - if (p == NULL) - ERRDRV("failed to create /proc directory %s", name); return p; } @@ -107,8 +105,6 @@ createProcFile(const char *name, struct proc_dir_entry *parent, { struct proc_dir_entry *p = proc_create_data(name, 0, parent, fops, data); - if (p == NULL) - ERRDRV("failed to create /proc file %s", name); return p; } @@ -137,17 +133,16 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot, MYPROCTYPE *rc = NULL, *type = NULL; struct proc_dir_entry *parent = NULL; - if (procDirRoot == NULL) { - ERRDRV("procDirRoot cannot be NULL!\n"); + if (procDirRoot == NULL) goto Away; - } - if (name == NULL || name[0] == NULL) { - ERRDRV("name must contain at least 1 node name!\n"); + + if (name == NULL || name[0] == NULL) goto Away; - } + type = kzalloc(sizeof(MYPROCTYPE), GFP_KERNEL | __GFP_NORETRY); if (type == NULL) goto Away; + type->name = name; type->propertyNames = propertyNames; type->nProperties = 0; @@ -222,13 +217,13 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, MYPROCOBJECT *obj = NULL, *rc = NULL; int i = 0; - if (type == NULL) { - ERRDRV("type cannot be NULL\n"); + if (type == NULL) goto Away; - } + obj = kzalloc(sizeof(MYPROCOBJECT), GFP_KERNEL | __GFP_NORETRY); if (obj == NULL) goto Away; + obj->type = type; obj->context = context; if (name == NULL) { @@ -332,10 +327,8 @@ static int seq_show(struct seq_file *seq, void *offset) { struct proc_dir_entry_context *ctx = seq->private; - if (ctx == NULL) { - ERRDRV("I don't have a freakin' clue..."); + if (ctx == NULL) return 0; - } (*ctx->show_property)(seq, ctx->procObject->context, ctx->propertyIndex); return 0; -- cgit v1.2.3 From 1b08872e59309458a54ed00cded95eeda43426e5 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Wed, 4 Mar 2015 12:14:26 -0500 Subject: staging: unisys: remove LOGWRN() macros and uniklog.h Remove the last set of macros from uniklog.h. Without LOGWRN() and friends, uniklog.h is empty so we can delete the file itself as well. This macro was not used a lot but the file was included in many places. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/procobjecttree.h | 1 - drivers/staging/unisys/include/uisqueue.h | 1 - drivers/staging/unisys/include/uniklog.h | 57 ---------------------- drivers/staging/unisys/uislib/uislib.c | 1 - drivers/staging/unisys/uislib/uisthread.c | 1 - drivers/staging/unisys/uislib/uisutils.c | 1 - drivers/staging/unisys/virthba/virthba.c | 1 - drivers/staging/unisys/virtpci/virtpci.c | 1 - drivers/staging/unisys/visorchannel/globals.h | 1 - drivers/staging/unisys/visorchipset/globals.h | 1 - drivers/staging/unisys/visorchipset/parser.h | 1 - .../unisys/visorchipset/visorchipset_main.c | 23 +++------ drivers/staging/unisys/visorutil/charqueue.h | 1 - drivers/staging/unisys/visorutil/easyproc.c | 1 - .../staging/unisys/visorutil/memregion_direct.c | 1 - drivers/staging/unisys/visorutil/periodic_work.c | 9 ---- drivers/staging/unisys/visorutil/visorkmodutils.c | 1 - 17 files changed, 6 insertions(+), 97 deletions(-) delete mode 100644 drivers/staging/unisys/include/uniklog.h (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/procobjecttree.h b/drivers/staging/unisys/include/procobjecttree.h index 1174056ec3d9..809c6794290e 100644 --- a/drivers/staging/unisys/include/procobjecttree.h +++ b/drivers/staging/unisys/include/procobjecttree.h @@ -26,7 +26,6 @@ #ifndef __PROCOBJECTTREE_H__ #define __PROCOBJECTTREE_H__ -#include "uniklog.h" #include "timskmod.h" /* These are opaque structures to users. diff --git a/drivers/staging/unisys/include/uisqueue.h b/drivers/staging/unisys/include/uisqueue.h index 25b6181d78af..08ba16ea840e 100644 --- a/drivers/staging/unisys/include/uisqueue.h +++ b/drivers/staging/unisys/include/uisqueue.h @@ -25,7 +25,6 @@ #include "linux/version.h" #include "iochannel.h" -#include "uniklog.h" #include #include #include diff --git a/drivers/staging/unisys/include/uniklog.h b/drivers/staging/unisys/include/uniklog.h deleted file mode 100644 index cca662a3f3e4..000000000000 --- a/drivers/staging/unisys/include/uniklog.h +++ /dev/null @@ -1,57 +0,0 @@ -/* uniklog.h - * - * Copyright (C) 2010 - 2013 UNISYS CORPORATION - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - */ - -/* This module contains macros to aid developers in logging messages. - * - * This module is affected by the DEBUG compiletime option. - * - */ -#ifndef __UNIKLOG_H__ -#define __UNIKLOG_H__ - -#include - -/* - * # LOGWRN - * - * \brief Log warning message - Logs a message at the LOG_WARNING level, - * including source line number information - * - * \param devname the device name of the device reporting this message, or - * NULL if this message is NOT device-related. - * \param fmt printf()-style format string containing the message to log. - * \param args Optional arguments to be formatted and inserted into the format - * \param string. - * \return nothing - * - * Logs the specified error message at the LOG_WARNING level. It will also - * include the file, line number, and function name of where the error - * originated in the log message. - */ -#define LOGWRN(fmt, args...) pr_warn(fmt, ## args) -#define LOGWRNDEV(devname, fmt, args...) \ - pr_warn("%s " fmt, devname, ## args) -#define LOGWRNNAME(vnic, fmt, args...) \ - do { \ - if (vnic != NULL) { \ - pr_warn("%s " fmt, vnic->name, ## args); \ - } else { \ - pr_warn(fmt, ## args); \ - } \ - } while (0) - -#endif /* __UNIKLOG_H__ */ diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 9fe96e7d5693..4318f06f6e7e 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -29,7 +29,6 @@ #include #include -#include "uniklog.h" #include "diagnostics/appos_subsystems.h" #include "uisutils.h" #include "vbuschannel.h" diff --git a/drivers/staging/unisys/uislib/uisthread.c b/drivers/staging/unisys/uislib/uisthread.c index 5b0041c4a137..bbe2a23784a5 100644 --- a/drivers/staging/unisys/uislib/uisthread.c +++ b/drivers/staging/unisys/uislib/uisthread.c @@ -20,7 +20,6 @@ #include #include #include -#include "uniklog.h" #include "uisutils.h" #include "uisthread.h" diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c index 9f3f0ab6ca49..26ab76526813 100644 --- a/drivers/staging/unisys/uislib/uisutils.c +++ b/drivers/staging/unisys/uislib/uisutils.c @@ -21,7 +21,6 @@ #include #include #include -#include "uniklog.h" #include "uisutils.h" #include "version.h" #include "vbushelper.h" diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index 23874de4e354..e5b0dd8b4719 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -31,7 +31,6 @@ #include #endif -#include "uniklog.h" #include "diagnostics/appos_subsystems.h" #include "uisutils.h" #include "uisqueue.h" diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index 87336b6591ba..43b573611d51 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -21,7 +21,6 @@ #ifdef CONFIG_MODVERSIONS #include #endif -#include "uniklog.h" #include "diagnostics/appos_subsystems.h" #include "uisutils.h" #include "vbuschannel.h" diff --git a/drivers/staging/unisys/visorchannel/globals.h b/drivers/staging/unisys/visorchannel/globals.h index 581ed83fe6d0..0ed8e1d8033a 100644 --- a/drivers/staging/unisys/visorchannel/globals.h +++ b/drivers/staging/unisys/visorchannel/globals.h @@ -18,7 +18,6 @@ #ifndef __VISORCHANNEL_GLOBALS_H__ #define __VISORCHANNEL_GLOBALS_H__ -#include "uniklog.h" #include "timskmod.h" #include "memregion.h" #include "version.h" diff --git a/drivers/staging/unisys/visorchipset/globals.h b/drivers/staging/unisys/visorchipset/globals.h index a1d35d4bef2e..f76e498a36b5 100644 --- a/drivers/staging/unisys/visorchipset/globals.h +++ b/drivers/staging/unisys/visorchipset/globals.h @@ -18,7 +18,6 @@ #ifndef __VISORCHIPSET_GLOBALS_H__ #define __VISORCHIPSET_GLOBALS_H__ -#include "uniklog.h" #include "diagnostics/appos_subsystems.h" #include "timskmod.h" #include "visorchipset.h" diff --git a/drivers/staging/unisys/visorchipset/parser.h b/drivers/staging/unisys/visorchipset/parser.h index 9fbe3b5b7cc3..7e015d1e744d 100644 --- a/drivers/staging/unisys/visorchipset/parser.h +++ b/drivers/staging/unisys/visorchipset/parser.h @@ -20,7 +20,6 @@ #include -#include "uniklog.h" #include "timskmod.h" #include "channel.h" diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 74a27e37f437..ec258aeba768 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -22,7 +22,6 @@ #include "periodic_work.h" #include "file.h" #include "parser.h" -#include "uniklog.h" #include "uisutils.h" #include "controlvmcompletionstatus.h" #include "guestlinuxdebug.h" @@ -1719,27 +1718,17 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) parser_ctx = parser_init_byteStream(parametersAddr, parametersBytes, isLocalAddr, &retry); - if (!parser_ctx) { - if (retry) { - LOGWRN("throttling to copy payload"); - return FALSE; - } - LOGWRN("parsing failed"); - LOGWRN("inmsg.hdr.Id=0x%lx", (ulong) inmsg.hdr.id); - LOGWRN("parametersAddr=0x%llx", (u64) parametersAddr); - LOGWRN("parametersBytes=%lu", (ulong) parametersBytes); - LOGWRN("isLocalAddr=%d", isLocalAddr); - } + if (!parser_ctx && retry) + return FALSE; } if (!isLocalAddr) { controlvm_init_response(&ackmsg, &inmsg.hdr, CONTROLVM_RESP_SUCCESS); - if ((ControlVm_channel) - && - (!visorchannel_signalinsert - (ControlVm_channel, CONTROLVM_QUEUE_ACK, &ackmsg))) - LOGWRN("failed to send ACK failed"); + if (ControlVm_channel) + visorchannel_signalinsert(ControlVm_channel, + CONTROLVM_QUEUE_ACK, + &ackmsg); } switch (inmsg.hdr.id) { case CONTROLVM_CHIPSET_INIT: diff --git a/drivers/staging/unisys/visorutil/charqueue.h b/drivers/staging/unisys/visorutil/charqueue.h index 56c1f79a54b0..f46a776b935b 100644 --- a/drivers/staging/unisys/visorutil/charqueue.h +++ b/drivers/staging/unisys/visorutil/charqueue.h @@ -18,7 +18,6 @@ #ifndef __CHARQUEUE_H__ #define __CHARQUEUE_H__ -#include "uniklog.h" #include "timskmod.h" /* struct charqueue is an opaque structure to users. diff --git a/drivers/staging/unisys/visorutil/easyproc.c b/drivers/staging/unisys/visorutil/easyproc.c index 53408056268e..3cb55d39370b 100644 --- a/drivers/staging/unisys/visorutil/easyproc.c +++ b/drivers/staging/unisys/visorutil/easyproc.c @@ -34,7 +34,6 @@ #include -#include "uniklog.h" #include "timskmod.h" #include "easyproc.h" diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index 07aa2975bd6a..eb7422fbe20f 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -20,7 +20,6 @@ * channel memory (in main memory of the host system) from code running in * a virtual partition. */ -#include "uniklog.h" #include "timskmod.h" #include "memregion.h" diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index f8f2e2461b2e..abbfb48894f3 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c @@ -19,7 +19,6 @@ * Helper functions to schedule periodic work in Linux kernel mode. */ -#include "uniklog.h" #include "timskmod.h" #include "periodic_work.h" @@ -193,14 +192,6 @@ BOOL visor_periodic_work_stop(struct periodic_work *pw) } if (pw->is_scheduled) { write_unlock(&pw->lock); - WARNDEV(pw->devnam, - "waiting for delayed work..."); - /* We rely on the delayed work function running here, - * and eventually calling - * visor_periodic_work_nextperiod(), - * which will see that want_to_stop is set, and - * subsequently clear is_scheduled. - */ SLEEPJIFFIES(10); write_lock(&pw->lock); } else { diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c index 556e2642d2d9..62f0f7046e17 100644 --- a/drivers/staging/unisys/visorutil/visorkmodutils.c +++ b/drivers/staging/unisys/visorutil/visorkmodutils.c @@ -15,7 +15,6 @@ * details. */ -#include "uniklog.h" #include "timskmod.h" #define MYDRVNAME "timskmodutils" -- cgit v1.2.3 From 535f2e7df820d84fd8a4395bb52f19846f6a2290 Mon Sep 17 00:00:00 2001 From: Rickard Strandqvist Date: Sat, 7 Feb 2015 15:56:10 +0100 Subject: staging: rtl8192u: r8192U_core: Fix driver_info dereference as a null pointer Fix possible use of use of driver_info as a null pointer in query_rxdesc_status() This could happen if stats->RxIs40MHzPacket still has the default value of zero. Signed-off-by: Rickard Strandqvist Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 0d64d2dfd38c..8f7a3219eff1 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4476,13 +4476,10 @@ static void query_rxdesc_status(struct sk_buff *skb, skb_pull(skb, stats->RxBufShift + stats->RxDrvInfoSize); } - /* for debug 2008.5.29 */ - - //added by vivi, for MP, 20080108 - stats->RxIs40MHzPacket = driver_info->BW; - if (stats->RxDrvInfoSize != 0) + if (driver_info) { + stats->RxIs40MHzPacket = driver_info->BW; TranslateRxSignalStuff819xUsb(skb, stats, driver_info); - + } } static void rtl8192_rx_nomal(struct sk_buff *skb) -- cgit v1.2.3 From 8edd9e7cf1a051688923c66bdba0cab38cdb7d9d Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Thu, 19 Feb 2015 21:54:08 -0800 Subject: Staging: rtl8192u: r819xU_firmware: removed commented out variable Removed commented out variable Signed-off-by: Tolga Ceylan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_firmware.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index 1a3a09f81895..f0ae3abd1185 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -37,7 +37,6 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, bool rt_status = true; u16 frag_threshold; u16 frag_length, frag_offset = 0; - //u16 total_size; int i; rt_firmware *pfirmware = priv->pFirmware; -- cgit v1.2.3 From 23723ea046d7ee7cdf0144cf244170a7c39a2e60 Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Thu, 19 Feb 2015 21:54:09 -0800 Subject: Staging: rtl8192u: r819xU_firmware: removed commented out assert Removed an assert that was commented out. The comment provides no documentation value as rt_status is properly handled. Signed-off-by: Tolga Ceylan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_firmware.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index f0ae3abd1185..ff4ce790355f 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -329,8 +329,6 @@ bool init_firmware(struct net_device *dev) } RT_TRACE(COMP_FIRMWARE, "Firmware Download Success\n"); - //assert(pfirmware->firmware_status == FW_STATUS_5_READY, ("Firmware Download Fail\n")); - return rt_status; download_firmware_fail: -- cgit v1.2.3 From 6f4380427bf8447c8282930d8aeb5949b37ee4d3 Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Thu, 19 Feb 2015 21:54:10 -0800 Subject: Staging: rtl9182u: r819xU_firmware: Replaced C99 comments with C89 Replaced C99 comments with C89. Signed-off-by: Tolga Ceylan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_firmware.c | 33 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index ff4ce790355f..e208c899bc5e 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -47,7 +47,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u8 index; firmware_init_param(dev); - //Fragmentation might be required + /* Fragmentation might be required */ frag_threshold = pfirmware->cmdpacket_frag_thresold; do { if ((buffer_len - frag_offset) > frag_threshold) { @@ -106,19 +106,20 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, } -//----------------------------------------------------------------------------- -// Procedure: Check whether main code is download OK. If OK, turn on CPU -// -// Description: CPU register locates in different page against general register. -// Switch to CPU register in the begin and switch back before return -// -// -// Arguments: The pointer of the adapter -// -// Returns: -// NDIS_STATUS_FAILURE - the following initialization process should be terminated -// NDIS_STATUS_SUCCESS - if firmware initialization process success -//----------------------------------------------------------------------------- +/* + * Procedure: Check whether main code is download OK. If OK, turn on CPU + * + * Description: CPU register locates in different page against general register. + * Switch to CPU register in the begin and switch back before return + * + * + * Arguments: The pointer of the adapter + * + * Returns: + * NDIS_STATUS_FAILURE - the following initialization process should + * be terminated + * NDIS_STATUS_SUCCESS - if firmware initialization process success + */ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) { bool rt_status = true; @@ -221,7 +222,7 @@ bool init_firmware(struct net_device *dev) /* it is called by reset */ rst_opt = OPT_SYSTEM_RESET; starting_state = FW_INIT_STEP0_BOOT; - // TODO: system reset + /* TODO: system reset */ } else if (pfirmware->firmware_status == FW_STATUS_5_READY) { /* it is called by Initialize */ @@ -290,7 +291,7 @@ bool init_firmware(struct net_device *dev) * will set polling bit when firmware code is also configured */ pfirmware->firmware_status = FW_STATUS_1_MOVE_BOOT_CODE; - //mdelay(1000); + /* mdelay(1000); */ /* * To initialize IMEM, CPU move code from 0x80000080, * hence, we send 0x80 byte packet -- cgit v1.2.3 From 5877ecc3f70fc3af1fb36c25503391a0244b461f Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Fri, 20 Feb 2015 18:14:24 -0800 Subject: Staging: rtl8192u: ieee80211: dot11d: added parenthesis to RESET_CIE_WATCHDOG macro Added parenthesis to RESET_CIE_WATCHDOG macro to resolve checkpatch error. Signed-off-by: Tolga Ceylan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/dot11d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.h b/drivers/staging/rtl8192u/ieee80211/dot11d.h index bd75e29adc2c..8ae673b217d8 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.h +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.h @@ -53,7 +53,7 @@ typedef struct _RT_DOT11D_INFO { #define CIE_WATCHDOG_TH 1 #define GET_CIE_WATCHDOG(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) -#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 +#define RESET_CIE_WATCHDOG(__pIeeeDev) (GET_CIE_WATCHDOG(__pIeeeDev) = 0) #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) #define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) -- cgit v1.2.3 From d08c028c75e293598b9f3e2c8ad87fb43199298c Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sat, 21 Feb 2015 18:53:45 -0800 Subject: staging: rtl8192x: Remove use of seq_printf return value The seq_printf return value, because it's frequently misused, will eventually be converted to void. See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to seq_has_overflowed() and make public") Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_module.c | 4 +++- drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index 0cf38091f8c5..248cc0d352ad 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -207,7 +207,9 @@ static struct proc_dir_entry *rtllib_proc; static int show_debug_level(struct seq_file *m, void *v) { - return seq_printf(m, "0x%08X\n", rtllib_debug_level); + seq_printf(m, "0x%08X\n", rtllib_debug_level); + + return 0; } static ssize_t write_debug_level(struct file *file, const char __user *buffer, diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 014922565588..9a607253823c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -245,7 +245,9 @@ static struct proc_dir_entry *ieee80211_proc; static int show_debug_level(struct seq_file *m, void *v) { - return seq_printf(m, "0x%08X\n", ieee80211_debug_level); + seq_printf(m, "0x%08X\n", ieee80211_debug_level); + + return 0; } static ssize_t write_debug_level(struct file *file, const char __user *buffer, -- cgit v1.2.3 From b6b0012c2d410704782301299d36d311f9a39334 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Thu, 5 Mar 2015 14:12:15 +0100 Subject: staging: rtl8192e: Remove unnecessary OOM message This patch reduces the kernel size by removing error messages that duplicate the normal OOM message. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr) @@ identifier f,print,l; expression e; constant char[] c; @@ e = \(kzalloc\|kmalloc\|devm_kzalloc\|devm_kmalloc\)(...); if (e == NULL) { <+... - print(...,c,...); ... when any ( goto l; | return ...; ) ...+> } Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_module.c | 10 +++------- drivers/staging/rtl8192e/rtllib_rx.c | 11 ++++------- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index 248cc0d352ad..32cc8df9d3a7 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -72,11 +72,8 @@ static inline int rtllib_networks_allocate(struct rtllib_device *ieee) ieee->networks = kzalloc( MAX_NETWORK_COUNT * sizeof(struct rtllib_network), GFP_KERNEL); - if (!ieee->networks) { - printk(KERN_WARNING "%s: Out of memory allocating beacons\n", - ieee->dev->name); + if (!ieee->networks) return -ENOMEM; - } return 0; } @@ -161,10 +158,9 @@ struct net_device *alloc_rtllib(int sizeof_priv) rtllib_softmac_init(ieee); ieee->pHTInfo = kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL); - if (ieee->pHTInfo == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc memory for HTInfo\n"); + if (ieee->pHTInfo == NULL) return NULL; - } + HTUpdateDefaultSetting(ieee); HTInitializeHTInfo(ieee); TSInitialize(ieee); diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 1664040efdab..0a9cf445a0ef 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -394,10 +394,9 @@ static int is_duplicate_packet(struct rtllib_device *ieee, } if (p == &ieee->ibss_mac_hash[index]) { entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); - if (!entry) { - printk(KERN_WARNING "Cannot malloc new mac entry\n"); + if (!entry) return 0; - } + memcpy(entry->mac, mac, ETH_ALEN); entry->seq_num[tid] = seq; entry->frag_num[tid] = frag; @@ -1345,11 +1344,9 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /* skb: hdr + (possible reassembled) full plaintext payload */ payload = skb->data + hdrlen; rxb = kmalloc(sizeof(struct rtllib_rxb), GFP_ATOMIC); - if (rxb == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, - "%s(): kmalloc rxb error\n", __func__); + if (rxb == NULL) goto rx_dropped; - } + /* to parse amsdu packets */ /* qos data packets & reserved bit is 1 */ if (parse_subframe(ieee, skb, rx_stats, rxb, src, dst) == 0) { -- cgit v1.2.3 From ad22d55c4b304a163c7372c00768f50adaecc686 Mon Sep 17 00:00:00 2001 From: Matteo Semenzato Date: Wed, 4 Mar 2015 19:53:10 +0100 Subject: Staging: rtl8192e: remove assignment of function parameter This patch removes the assignment of a function parameter that has no effect. Signed-off-by: Matteo Semenzato Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 0a9cf445a0ef..d640420f0076 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1225,7 +1225,6 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, } } kfree(rxb); - rxb = NULL; } static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, -- cgit v1.2.3 From 0cd189a42da07c89c809debc1f6a75f5ec0f5c43 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 26 Feb 2015 18:53:09 +0300 Subject: staging: vme: use image mutex for ioctl() This implements more granular locking in vme_user_ioctl() by using separate locks for each devfs device. This also provides a synchronization between vme_user_read(), vme_user_write() and vme_user_ioctl(). Signed-off-by: Dmitry Kalinkin Cc: Martyn Welch Cc: Igor Alekseev Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 8b1f53331433..87318386034b 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -41,7 +41,6 @@ #include "vme_user.h" -static DEFINE_MUTEX(vme_user_mutex); static const char driver_name[] = "vme_user"; static int bus[VME_USER_BUS_MAX]; @@ -555,10 +554,12 @@ static long vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int ret; + struct inode *inode = file_inode(file); + unsigned int minor = MINOR(inode->i_rdev); - mutex_lock(&vme_user_mutex); - ret = vme_user_ioctl(file_inode(file), file, cmd, arg); - mutex_unlock(&vme_user_mutex); + mutex_lock(&image[minor].mutex); + ret = vme_user_ioctl(inode, file, cmd, arg); + mutex_unlock(&image[minor].mutex); return ret; } -- cgit v1.2.3 From c74a804f115bdedcac72ea52ca33f46cfae3b74f Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 26 Feb 2015 18:53:10 +0300 Subject: staging: vme: mmap() support for vme_user We also make sure that user won't be able to reconfigure the window while it is mmap'ed. Signed-off-by: Dmitry Kalinkin Cc: Martyn Welch Cc: Igor Alekseev Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 85 ++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 87318386034b..19ba749bb122 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -17,6 +17,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -99,6 +100,7 @@ struct image_desc { struct device *device; /* Sysfs device */ struct vme_resource *resource; /* VME resource */ int users; /* Number of current users */ + int mmap_count; /* Number of current mmap's */ }; static struct image_desc image[VME_DEVS]; @@ -134,6 +136,10 @@ static ssize_t vme_user_write(struct file *, const char __user *, size_t, loff_t *); static loff_t vme_user_llseek(struct file *, loff_t, int); static long vme_user_unlocked_ioctl(struct file *, unsigned int, unsigned long); +static int vme_user_mmap(struct file *file, struct vm_area_struct *vma); + +static void vme_user_vm_open(struct vm_area_struct *vma); +static void vme_user_vm_close(struct vm_area_struct *vma); static int vme_user_match(struct vme_dev *); static int vme_user_probe(struct vme_dev *); @@ -147,6 +153,17 @@ static const struct file_operations vme_user_fops = { .llseek = vme_user_llseek, .unlocked_ioctl = vme_user_unlocked_ioctl, .compat_ioctl = vme_user_unlocked_ioctl, + .mmap = vme_user_mmap, +}; + +struct vme_user_vma_priv { + unsigned int minor; + atomic_t refcnt; +}; + +static const struct vm_operations_struct vme_user_vm_ops = { + .open = vme_user_vm_open, + .close = vme_user_vm_close, }; @@ -488,6 +505,11 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, case VME_SET_MASTER: + if (image[minor].mmap_count != 0) { + pr_warn("Can't adjust mapped window\n"); + return -EPERM; + } + copied = copy_from_user(&master, argp, sizeof(master)); if (copied != 0) { pr_warn("Partial copy from userspace\n"); @@ -564,6 +586,69 @@ vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return ret; } +static void vme_user_vm_open(struct vm_area_struct *vma) +{ + struct vme_user_vma_priv *vma_priv = vma->vm_private_data; + + atomic_inc(&vma_priv->refcnt); +} + +static void vme_user_vm_close(struct vm_area_struct *vma) +{ + struct vme_user_vma_priv *vma_priv = vma->vm_private_data; + unsigned int minor = vma_priv->minor; + + if (!atomic_dec_and_test(&vma_priv->refcnt)) + return; + + mutex_lock(&image[minor].mutex); + image[minor].mmap_count--; + mutex_unlock(&image[minor].mutex); + + kfree(vma_priv); +} + +static int vme_user_master_mmap(unsigned int minor, struct vm_area_struct *vma) +{ + int err; + struct vme_user_vma_priv *vma_priv; + + mutex_lock(&image[minor].mutex); + + err = vme_master_mmap(image[minor].resource, vma); + if (err) { + mutex_unlock(&image[minor].mutex); + return err; + } + + vma_priv = kmalloc(sizeof(struct vme_user_vma_priv), GFP_KERNEL); + if (vma_priv == NULL) { + mutex_unlock(&image[minor].mutex); + return -ENOMEM; + } + + vma_priv->minor = minor; + atomic_set(&vma_priv->refcnt, 1); + vma->vm_ops = &vme_user_vm_ops; + vma->vm_private_data = vma_priv; + + image[minor].mmap_count++; + + mutex_unlock(&image[minor].mutex); + + return 0; +} + +static int vme_user_mmap(struct file *file, struct vm_area_struct *vma) +{ + unsigned int minor = MINOR(file_inode(file)->i_rdev); + + if (type[minor] == MASTER_MINOR) + return vme_user_master_mmap(minor, vma); + + return -ENODEV; +} + /* * Unallocate a previously allocated buffer -- cgit v1.2.3 From 4c1d2dcb64db1d881d1822b5789022a03bc6abe4 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 3 Mar 2015 09:55:43 -0300 Subject: staging: dgap: Avoid name collision Building for ARM64 leads to the following build warning: In file included from drivers/staging/dgap/dgap.c:66:0: drivers/staging/dgap/dgap.h:124:0: warning: "PCI_IO_SIZE" redefined #define PCI_IO_SIZE 0x00200000 ^ In file included from ./arch/arm64/include/asm/page.h:66:0, from include/linux/mm_types.h:15, from include/linux/sched.h:27, from ./arch/arm64/include/asm/compat.h:25, from ./arch/arm64/include/asm/stat.h:23, from include/linux/stat.h:5, from include/linux/module.h:10, from drivers/staging/dgap/dgap.c:47: ./arch/arm64/include/asm/memory.h:39:0: note: this is the location of the previous definition #define PCI_IO_SIZE SZ_16M ^ Use PCI_IO_SIZE_DGAP to avoid the name collision. Reported-by: Olof's autobuilder Signed-off-by: Fabio Estevam Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgap/dgap.c | 2 +- drivers/staging/dgap/dgap.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 914e332e13a1..d4d98a78f3ac 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -2196,7 +2196,7 @@ static struct board_t *dgap_found_board(struct pci_dev *pdev, int id, * will be mapped into the low 2MB of the 4MB memory space */ brd->port = brd->membase + PCI_IO_OFFSET; - brd->port_end = brd->port + PCI_IO_SIZE; + brd->port_end = brd->port + PCI_IO_SIZE_DGAP; /* * Special initialization for non-PLX boards diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h index 684033156e8c..a2e5b26c673a 100644 --- a/drivers/staging/dgap/dgap.h +++ b/drivers/staging/dgap/dgap.h @@ -121,7 +121,7 @@ #define PCI_IO_OFFSET 0x00200000 /* Size of IO (2MB) */ -#define PCI_IO_SIZE 0x00200000 +#define PCI_IO_SIZE_DGAP 0x00200000 /* Number of boards we support at once. */ #define MAXBOARDS 32 -- cgit v1.2.3 From dae7f15e538537d58eb1b9f7046600d98af16cd7 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Sat, 28 Feb 2015 21:54:42 +0100 Subject: staging: iio: hmc5843: Set iio name property in sysfs Without this change file name for hmc5843 is empty in /sys/bus/iio/devices/iio\:device*/name With this change name is reported correctly: cat /sys/bus/iio/devices/iio\:device*/name hmc5843 Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/magnetometer/hmc5843_core.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c index fd171d8b38fb..90cc18b703cf 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_core.c +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c @@ -592,6 +592,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap, mutex_init(&data->lock); indio_dev->dev.parent = dev; + indio_dev->name = dev->driver->name; indio_dev->info = &hmc5843_info; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = data->variant->channels; -- cgit v1.2.3 From c2073f3b0df8d22ed368bb27f0c3cc87487a25d4 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:34 -0500 Subject: staging: rtl8723au: Remove unused struct rx_hp Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/include/odm.h | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index 0d1285c1bff0..d097465e4c14 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -158,19 +158,6 @@ struct false_alarm_stats { u32 Cnt_BW_LSC; /* Gary */ }; -struct rx_hp { - u8 RXHP_flag; - u8 PSD_func_trigger; - u8 PSD_bitmap_RXHP[80]; - u8 Pre_IGI; - u8 Cur_IGI; - u8 Pre_pw_th; - u8 Cur_pw_th; - bool First_time_enter; - bool RXHP_enable; - u8 TP_Mode; -}; - #define ASSOCIATE_ENTRY_NUM 32 /* Max size of AsocEntry[]. */ #define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM @@ -649,7 +636,6 @@ struct dm_odm_t { /* */ struct dig_t DM_DigTable; struct dynamic_pwr_sav DM_PSTable; - struct rx_hp DM_RXHP_Table; struct false_alarm_stats FalseAlmCnt; struct false_alarm_stats FlaseAlmCntBuddyAdapter; struct sw_ant_sw DM_SWAT_Table; -- cgit v1.2.3 From bb514494539196965e9b884a335ccc33b494ff13 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:35 -0500 Subject: staging: rtl8723au: Remove a number of unused entries from struct dm_odm_t Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 9 --------- drivers/staging/rtl8723au/include/odm.h | 28 +--------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 2d3653e784d2..937b6d79ce96 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -330,15 +330,6 @@ void ODM_CmnInfoInit23a(struct dm_odm_t *pDM_Odm, /* do nothing */ break; } - - /* */ - /* Tx power tracking BB swing table. */ - /* The base index = 12. +((12-n)/2)dB 13~?? = decrease tx pwr by -((n-12)/2)dB */ - /* */ - pDM_Odm->BbSwingIdxOfdm = 12; /* Set defalut value as index 12. */ - pDM_Odm->BbSwingIdxOfdmCurrent = 12; - pDM_Odm->BbSwingFlagOfdm = false; - } void ODM_CmnInfoPtrArrayHook23a(struct dm_odm_t *pDM_Odm, enum odm_cmninfo CmnInfo, diff --git a/drivers/staging/rtl8723au/include/odm.h b/drivers/staging/rtl8723au/include/odm.h index d097465e4c14..24f2f28c473f 100644 --- a/drivers/staging/rtl8723au/include/odm.h +++ b/drivers/staging/rtl8723au/include/odm.h @@ -609,14 +609,6 @@ struct dm_odm_t { /* 2012/01/12 MH For MP, we need to reduce one array pointer for default port.?? */ struct sta_info * pODM_StaInfo[ODM_ASSOCIATE_ENTRY_NUM]; - /* */ - /* 2012/02/14 MH Add to share 88E ra with other SW team. */ - /* We need to colelct all support abilit to a proper area. */ - /* */ - bool RaSupport88E; - - /* Define ........... */ - /* Latest packet phy info (ODM write) */ struct odm_phy_dbg_info PhyDbgInfo; /* PHY_INFO_88E PhyInfo; */ @@ -648,29 +640,11 @@ struct dm_odm_t { /* */ /* PSD */ - bool bUserAssignLevel; - u8 RSSI_BT; /* come from BT */ - bool bPSDinProcess; - + u8 RSSI_BT; /* come from BT */ struct odm_rate_adapt RateAdaptive; struct odm_rf_cal_t RFCalibrateInfo; - - /* */ - /* TX power tracking */ - /* */ - u8 BbSwingIdxOfdm; - u8 BbSwingIdxOfdmCurrent; - u8 BbSwingIdxOfdmBase; - bool BbSwingFlagOfdm; - u8 BbSwingIdxCck; - u8 BbSwingIdxCckCurrent; - u8 BbSwingIdxCckBase; - bool BbSwingFlagCck; - /* */ - /* ODM system resource. */ - /* */ }; /* DM_Dynamic_Mechanism_Structure */ enum odm_rf_content { -- cgit v1.2.3 From def0c450585089be57bf090c37dbd85d53587053 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:36 -0500 Subject: staging: rtl8723au: Remove pointless wrappers around odm_TXPowerTrackingInit() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 937b6d79ce96..79a78dfce1ee 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -198,9 +198,7 @@ static void odm_RefreshRateAdaptiveMask(struct dm_odm_t *pDM_Odm); void odm_RateAdaptiveMaskInit23a(struct dm_odm_t *pDM_Odm); -void odm_TXPowerTrackingThermalMeterInit23a(struct dm_odm_t *pDM_Odm); - -void odm_TXPowerTrackingInit23a(struct dm_odm_t *pDM_Odm); +static void odm_TXPowerTrackingInit(struct dm_odm_t *pDM_Odm); static void odm_EdcaTurboCheck23a(struct dm_odm_t *pDM_Odm); static void ODM_EdcaTurboInit23a(struct dm_odm_t *pDM_Odm); @@ -234,7 +232,7 @@ void ODM23a_DMInit(struct dm_odm_t *pDM_Odm) odm23a_DynBBPSInit(pDM_Odm); odm_DynamicTxPower23aInit(pDM_Odm); - odm_TXPowerTrackingInit23a(pDM_Odm); + odm_TXPowerTrackingInit(pDM_Odm); ODM_EdcaTurboInit23a(pDM_Odm); } @@ -1242,12 +1240,7 @@ static void odm_RSSIMonitorCheck(struct dm_odm_t *pDM_Odm) /* 3 Tx Power Tracking */ /* 3 ============================================================ */ -void odm_TXPowerTrackingInit23a(struct dm_odm_t *pDM_Odm) -{ - odm_TXPowerTrackingThermalMeterInit23a(pDM_Odm); -} - -void odm_TXPowerTrackingThermalMeterInit23a(struct dm_odm_t *pDM_Odm) +static void odm_TXPowerTrackingInit(struct dm_odm_t *pDM_Odm) { struct rtw_adapter *Adapter = pDM_Odm->Adapter; struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); -- cgit v1.2.3 From bfd83bbe92e89b27b7809ae1cffc142dfb763db6 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:37 -0500 Subject: staging: rtl8723au: Reduce the usage of ODM_[GS]et_BBReg() The vendor code has at least three different APIs for accessing registers. One more ugly than the other. This is the start to move away from ODM_[GS]et_BBReg() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 89 +++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 43 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 79a78dfce1ee..7a5cff5431c7 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1366,8 +1366,10 @@ dm_CheckEdcaTurbo_EXIT: precvpriv->last_rx_bytes = precvpriv->rx_bytes; } -u32 GetPSDData(struct dm_odm_t *pDM_Odm, unsigned int point, u8 initial_gain_psd) +u32 GetPSDData(struct dm_odm_t *pDM_Odm, unsigned int point, + u8 initial_gain_psd) { + struct rtw_adapter *adapter = pDM_Odm->Adapter; u32 psd_report; /* Set DCO frequency index, offset = (40MHz/SamplePts)*point */ @@ -1379,7 +1381,7 @@ u32 GetPSDData(struct dm_odm_t *pDM_Odm, unsigned int point, u8 initial_gain_psd udelay(30); ODM_SetBBReg(pDM_Odm, 0x808, BIT(22), 0); /* Read PSD report, Reg8B4[15:0] */ - psd_report = ODM_GetBBReg(pDM_Odm, 0x8B4, bMaskDWord) & 0x0000FFFF; + psd_report = rtl8723au_read32(adapter, 0x8B4) & 0x0000FFFF; psd_report = (u32)(ConvertTo_dB23a(psd_report)) + (u32)(initial_gain_psd-0x1c); @@ -1436,7 +1438,7 @@ static void odm_PHY_SaveAFERegisters(struct dm_odm_t *pDM_Odm, u32 *AFEReg, u32 i; for (i = 0 ; i < RegisterNum ; i++) - AFEBackup[i] = ODM_GetBBReg(pDM_Odm, AFEReg[i], bMaskDWord); + AFEBackup[i] = rtl8723au_read32(pDM_Odm->Adapter, AFEReg[i]); } static void odm_PHY_ReloadAFERegisters(struct dm_odm_t *pDM_Odm, u32 *AFEReg, @@ -1445,7 +1447,7 @@ static void odm_PHY_ReloadAFERegisters(struct dm_odm_t *pDM_Odm, u32 *AFEReg, u32 i; for (i = 0 ; i < RegiesterNum; i++) - ODM_SetBBReg(pDM_Odm, AFEReg[i], bMaskDWord, AFEBackup[i]); + rtl8723au_write32(pDM_Odm->Adapter, AFEReg[i], AFEBackup[i]); } /* 2 8723A ANT DETECT */ @@ -1455,6 +1457,7 @@ static void odm_PHY_ReloadAFERegisters(struct dm_odm_t *pDM_Odm, u32 *AFEReg, bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) { struct sw_ant_sw *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + struct rtw_adapter *adapter = pDM_Odm->Adapter; u32 CurrentChannel, RfLoopReg; u8 n; u32 Reg88c, Regc08, Reg874, Regc50; @@ -1490,10 +1493,10 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) udelay(10); /* Store A Path Register 88c, c08, 874, c50 */ - Reg88c = ODM_GetBBReg(pDM_Odm, rFPGA0_AnalogParameter4, bMaskDWord); - Regc08 = ODM_GetBBReg(pDM_Odm, rOFDM0_TRMuxPar, bMaskDWord); - Reg874 = ODM_GetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord); - Regc50 = ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskDWord); + Reg88c = rtl8723au_read32(adapter, rFPGA0_AnalogParameter4); + Regc08 = rtl8723au_read32(adapter, rOFDM0_TRMuxPar); + Reg874 = rtl8723au_read32(adapter, rFPGA0_XCD_RFInterfaceSW); + Regc50 = rtl8723au_read32(adapter, rOFDM0_XAAGCCore1); /* Store AFE Registers */ odm_PHY_SaveAFERegisters(pDM_Odm, AFE_REG_8723A, AFE_Backup, 16); @@ -1505,49 +1508,49 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) ODM_SetRFReg(pDM_Odm, RF_PATH_A, ODM_CHANNEL, bRFRegOffsetMask, 0x01); /* AFE all on step */ - ODM_SetBBReg(pDM_Odm, rRx_Wait_CCA, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rTx_CCK_RFON, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rTx_CCK_BBON, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rTx_OFDM_RFON, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rTx_OFDM_BBON, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rTx_To_Rx, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rTx_To_Tx, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rRx_CCK, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rRx_OFDM, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rRx_Wait_RIFS, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rRx_TO_Rx, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rStandby, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rSleep, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rPMPD_ANAEN, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_SwitchControl, bMaskDWord, 0x6FDB25A4); - ODM_SetBBReg(pDM_Odm, rBlue_Tooth, bMaskDWord, 0x6FDB25A4); + rtl8723au_write32(adapter, rRx_Wait_CCA, 0x6FDB25A4); + rtl8723au_write32(adapter, rTx_CCK_RFON, 0x6FDB25A4); + rtl8723au_write32(adapter, rTx_CCK_BBON, 0x6FDB25A4); + rtl8723au_write32(adapter, rTx_OFDM_RFON, 0x6FDB25A4); + rtl8723au_write32(adapter, rTx_OFDM_BBON, 0x6FDB25A4); + rtl8723au_write32(adapter, rTx_To_Rx, 0x6FDB25A4); + rtl8723au_write32(adapter, rTx_To_Tx, 0x6FDB25A4); + rtl8723au_write32(adapter, rRx_CCK, 0x6FDB25A4); + rtl8723au_write32(adapter, rRx_OFDM, 0x6FDB25A4); + rtl8723au_write32(adapter, rRx_Wait_RIFS, 0x6FDB25A4); + rtl8723au_write32(adapter, rRx_TO_Rx, 0x6FDB25A4); + rtl8723au_write32(adapter, rStandby, 0x6FDB25A4); + rtl8723au_write32(adapter, rSleep, 0x6FDB25A4); + rtl8723au_write32(adapter, rPMPD_ANAEN, 0x6FDB25A4); + rtl8723au_write32(adapter, rFPGA0_XCD_SwitchControl, 0x6FDB25A4); + rtl8723au_write32(adapter, rBlue_Tooth, 0x6FDB25A4); /* 3 wire Disable */ - ODM_SetBBReg(pDM_Odm, rFPGA0_AnalogParameter4, bMaskDWord, 0xCCF000C0); + rtl8723au_write32(adapter, rFPGA0_AnalogParameter4, 0xCCF000C0); /* BB IQK Setting */ - ODM_SetBBReg(pDM_Odm, rOFDM0_TRMuxPar, bMaskDWord, 0x000800E4); - ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, 0x22208000); + rtl8723au_write32(adapter, rOFDM0_TRMuxPar, 0x000800E4); + rtl8723au_write32(adapter, rFPGA0_XCD_RFInterfaceSW, 0x22208000); /* IQK setting tone@ 4.34Mhz */ - ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x10008C1C); - ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); + rtl8723au_write32(adapter, rTx_IQK_Tone_A, 0x10008C1C); + rtl8723au_write32(adapter, rTx_IQK, 0x01007c00); /* Page B init */ - ODM_SetBBReg(pDM_Odm, rConfig_AntA, bMaskDWord, 0x00080000); - ODM_SetBBReg(pDM_Odm, rConfig_AntA, bMaskDWord, 0x0f600000); - ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x01004800); - ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x10008c1f); - ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82150008); - ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28150008); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Rsp, bMaskDWord, 0x001028d0); + rtl8723au_write32(adapter, rConfig_AntA, 0x00080000); + rtl8723au_write32(adapter, rConfig_AntA, 0x0f600000); + rtl8723au_write32(adapter, rRx_IQK, 0x01004800); + rtl8723au_write32(adapter, rRx_IQK_Tone_A, 0x10008c1f); + rtl8723au_write32(adapter, rTx_IQK_PI_A, 0x82150008); + rtl8723au_write32(adapter, rRx_IQK_PI_A, 0x28150008); + rtl8723au_write32(adapter, rIQK_AGC_Rsp, 0x001028d0); /* RF loop Setting */ ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0x0, 0xFFFFF, 0x50008); /* IQK Single tone start */ - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); + rtl8723au_write32(adapter, rFPGA0_IQK, 0x80800000); + rtl8723au_write32(adapter, rIQK_AGC_Pts, 0xf8000000); udelay(1000); PSD_report_tmp = 0x0; @@ -1580,16 +1583,16 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) } /* Close IQK Single Tone function */ - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + rtl8723au_write32(adapter, rFPGA0_IQK, 0x00000000); PSD_report_tmp = 0x0; /* 1 Return to antanna A */ ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, Antenna_A); - ODM_SetBBReg(pDM_Odm, rFPGA0_AnalogParameter4, bMaskDWord, Reg88c); - ODM_SetBBReg(pDM_Odm, rOFDM0_TRMuxPar, bMaskDWord, Regc08); - ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, Reg874); + rtl8723au_write32(adapter, rFPGA0_AnalogParameter4, Reg88c); + rtl8723au_write32(adapter, rOFDM0_TRMuxPar, Regc08); + rtl8723au_write32(adapter, rFPGA0_XCD_RFInterfaceSW, Reg874); ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, 0x7F, 0x40); - ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskDWord, Regc50); + rtl8723au_write32(adapter, rOFDM0_XAAGCCore1, Regc50); ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, CurrentChannel); ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0x00, bRFRegOffsetMask, RfLoopReg); -- cgit v1.2.3 From 598fda7b1c16e79ca363b20c4ae9c1321bfe0c14 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:38 -0500 Subject: staging: rtl8723au: Clean up PHY_{Query,Set}BBReg() 32 bit read/writes This switches pure 32 bit read/writes to use the rtl8723au_{read,write}32() functions directly. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c | 209 ++++++++++++--------- 1 file changed, 116 insertions(+), 93 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c index 163e4d28eef0..ba373744ece9 100644 --- a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c +++ b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c @@ -65,8 +65,8 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) if (ThermalValue) { /* Query OFDM path A default setting */ - ele_D = PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, - bMaskDWord)&bMaskOFDM_D; + ele_D = rtl8723au_read32(Adapter, rOFDM0_XATxIQImbalance) & + bMaskOFDM_D; for (i = 0; i < OFDM_TABLE_SIZE_92C; i++) { /* find the index */ if (ele_D == (OFDMSwingTable23A[i]&bMaskOFDM_D)) { @@ -77,8 +77,9 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) /* Query OFDM path B default setting */ if (pHalData->rf_type == RF_2T2R) { - ele_D = PHY_QueryBBReg(Adapter, rOFDM0_XBTxIQImbalance, - bMaskDWord)&bMaskOFDM_D; + ele_D = rtl8723au_read32(Adapter, + rOFDM0_XBTxIQImbalance); + ele_D &= bMaskOFDM_D; for (i = 0; i < OFDM_TABLE_SIZE_92C; i++) { /* find the index */ if (ele_D == (OFDMSwingTable23A[i]&bMaskOFDM_D)) { OFDM_index_old[1] = (u8)i; @@ -88,8 +89,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) } /* Query CCK default setting From 0xa24 */ - TempCCk = PHY_QueryBBReg(Adapter, rCCK0_TxFilter2, - bMaskDWord)&bMaskCCK; + TempCCk = rtl8723au_read32(Adapter, rCCK0_TxFilter2) & bMaskCCK; for (i = 0 ; i < CCK_TABLE_SIZE ; i++) { if (pdmpriv->bCCKinCH14) { if (!memcmp(&TempCCk, @@ -227,7 +227,8 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) CCK_index = 0; } - if (pdmpriv->TxPowerTrackControl && (delta != 0 || delta_HP != 0)) { + if (pdmpriv->TxPowerTrackControl && + (delta != 0 || delta_HP != 0)) { /* Adujst OFDM Ant_A according to IQK result */ ele_D = (OFDMSwingTable23A[OFDM_index[0]] & 0xFFC00000)>>22; X = pdmpriv->RegE94; @@ -245,7 +246,9 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) /* write new elements A, C, D to regC80 and regC94, element B is always 0 */ value32 = (ele_D<<22)|((ele_C&0x3F)<<16)|ele_A; - PHY_SetBBReg(Adapter, rOFDM0_XATxIQImbalance, bMaskDWord, value32); + rtl8723au_write32(Adapter, + rOFDM0_XATxIQImbalance, + value32); value32 = (ele_C&0x000003C0)>>6; PHY_SetBBReg(Adapter, rOFDM0_XCTxAFE, bMaskH4Bits, value32); @@ -258,9 +261,9 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, BIT(29), value32); } else { - PHY_SetBBReg(Adapter, rOFDM0_XATxIQImbalance, - bMaskDWord, - OFDMSwingTable23A[OFDM_index[0]]); + rtl8723au_write32(Adapter, + rOFDM0_XATxIQImbalance, + OFDMSwingTable23A[OFDM_index[0]]); PHY_SetBBReg(Adapter, rOFDM0_XCTxAFE, bMaskH4Bits, 0x00); PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, @@ -307,7 +310,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) /* write new elements A, C, D to regC88 and regC9C, element B is always 0 */ value32 = (ele_D<<22)|((ele_C&0x3F)<<16) | ele_A; - PHY_SetBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord, value32); + rtl8723au_write32(Adapter, rOFDM0_XBTxIQImbalance, value32); value32 = (ele_C&0x000003C0)>>6; PHY_SetBBReg(Adapter, rOFDM0_XDTxAFE, bMaskH4Bits, value32); @@ -322,10 +325,9 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) rOFDM0_ECCAThreshold, BIT(25), value32); } else { - PHY_SetBBReg(Adapter, - rOFDM0_XBTxIQImbalance, - bMaskDWord, - OFDMSwingTable23A[OFDM_index[1]]); + rtl8723au_write32(Adapter, + rOFDM0_XBTxIQImbalance, + OFDMSwingTable23A[OFDM_index[1]]); PHY_SetBBReg(Adapter, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00); @@ -386,36 +388,37 @@ static u8 _PHY_PathA_IQK(struct rtw_adapter *pAdapter, bool configPathB) struct hal_data_8723a *pHalData = GET_HAL_DATA(pAdapter); /* path-A IQK setting */ - PHY_SetBBReg(pAdapter, rTx_IQK_Tone_A, bMaskDWord, 0x10008c1f); - PHY_SetBBReg(pAdapter, rRx_IQK_Tone_A, bMaskDWord, 0x10008c1f); - PHY_SetBBReg(pAdapter, rTx_IQK_PI_A, bMaskDWord, 0x82140102); + rtl8723au_write32(pAdapter, rTx_IQK_Tone_A, 0x10008c1f); + rtl8723au_write32(pAdapter, rRx_IQK_Tone_A, 0x10008c1f); + rtl8723au_write32(pAdapter, rTx_IQK_PI_A, 0x82140102); - PHY_SetBBReg(pAdapter, rRx_IQK_PI_A, bMaskDWord, configPathB ? 0x28160202 : + rtl8723au_write32(pAdapter, rRx_IQK_PI_A, configPathB ? 0x28160202 : IS_81xxC_VENDOR_UMC_B_CUT(pHalData->VersionID)?0x28160202:0x28160502); /* path-B IQK setting */ if (configPathB) { - PHY_SetBBReg(pAdapter, rTx_IQK_Tone_B, bMaskDWord, 0x10008c22); - PHY_SetBBReg(pAdapter, rRx_IQK_Tone_B, bMaskDWord, 0x10008c22); - PHY_SetBBReg(pAdapter, rTx_IQK_PI_B, bMaskDWord, 0x82140102); - PHY_SetBBReg(pAdapter, rRx_IQK_PI_B, bMaskDWord, 0x28160202); + rtl8723au_write32(pAdapter, rTx_IQK_Tone_B, 0x10008c22); + rtl8723au_write32(pAdapter, rRx_IQK_Tone_B, 0x10008c22); + rtl8723au_write32(pAdapter, rTx_IQK_PI_B, 0x82140102); + rtl8723au_write32(pAdapter, rRx_IQK_PI_B, 0x28160202); } /* LO calibration setting */ - PHY_SetBBReg(pAdapter, rIQK_AGC_Rsp, bMaskDWord, 0x001028d1); + rtl8723au_write32(pAdapter, rIQK_AGC_Rsp, 0x001028d1); /* One shot, path A LOK & IQK */ - PHY_SetBBReg(pAdapter, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); - PHY_SetBBReg(pAdapter, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); + rtl8723au_write32(pAdapter, rIQK_AGC_Pts, 0xf9000000); + rtl8723au_write32(pAdapter, rIQK_AGC_Pts, 0xf8000000); /* delay x ms */ - udelay(IQK_DELAY_TIME*1000);/* PlatformStallExecution(IQK_DELAY_TIME*1000); */ + /* PlatformStallExecution(IQK_DELAY_TIME*1000); */ + udelay(IQK_DELAY_TIME*1000); /* Check failed */ - regEAC = PHY_QueryBBReg(pAdapter, rRx_Power_After_IQK_A_2, bMaskDWord); - regE94 = PHY_QueryBBReg(pAdapter, rTx_Power_Before_IQK_A, bMaskDWord); - regE9C = PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_A, bMaskDWord); - regEA4 = PHY_QueryBBReg(pAdapter, rRx_Power_Before_IQK_A_2, bMaskDWord); + regEAC = rtl8723au_read32(pAdapter, rRx_Power_After_IQK_A_2); + regE94 = rtl8723au_read32(pAdapter, rTx_Power_Before_IQK_A); + regE9C = rtl8723au_read32(pAdapter, rTx_Power_After_IQK_A); + regEA4 = rtl8723au_read32(pAdapter, rRx_Power_Before_IQK_A_2); if (!(regEAC & BIT(28)) && (((regE94 & 0x03FF0000)>>16) != 0x142) && @@ -424,7 +427,7 @@ static u8 _PHY_PathA_IQK(struct rtw_adapter *pAdapter, bool configPathB) else /* if Tx not OK, ignore Rx */ return result; - if (!(regEAC & BIT(27)) && /* if Tx is OK, check whether Rx is OK */ + if (!(regEAC & BIT(27)) && /* if Tx is OK, check whether Rx is OK */ (((regEA4 & 0x03FF0000)>>16) != 0x132) && (((regEAC & 0x03FF0000)>>16) != 0x36)) result |= 0x02; @@ -439,18 +442,18 @@ static u8 _PHY_PathB_IQK(struct rtw_adapter *pAdapter) u8 result = 0x00; /* One shot, path B LOK & IQK */ - PHY_SetBBReg(pAdapter, rIQK_AGC_Cont, bMaskDWord, 0x00000002); - PHY_SetBBReg(pAdapter, rIQK_AGC_Cont, bMaskDWord, 0x00000000); + rtl8723au_write32(pAdapter, rIQK_AGC_Cont, 0x00000002); + rtl8723au_write32(pAdapter, rIQK_AGC_Cont, 0x00000000); /* delay x ms */ udelay(IQK_DELAY_TIME*1000); /* Check failed */ - regEAC = PHY_QueryBBReg(pAdapter, rRx_Power_After_IQK_A_2, bMaskDWord); - regEB4 = PHY_QueryBBReg(pAdapter, rTx_Power_Before_IQK_B, bMaskDWord); - regEBC = PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_B, bMaskDWord); - regEC4 = PHY_QueryBBReg(pAdapter, rRx_Power_Before_IQK_B_2, bMaskDWord); - regECC = PHY_QueryBBReg(pAdapter, rRx_Power_After_IQK_B_2, bMaskDWord); + regEAC = rtl8723au_read32(pAdapter, rRx_Power_After_IQK_A_2); + regEB4 = rtl8723au_read32(pAdapter, rTx_Power_Before_IQK_B); + regEBC = rtl8723au_read32(pAdapter, rTx_Power_After_IQK_B); + regEC4 = rtl8723au_read32(pAdapter, rRx_Power_Before_IQK_B_2); + regECC = rtl8723au_read32(pAdapter, rRx_Power_After_IQK_B_2); if (!(regEAC & BIT(31)) && (((regEB4 & 0x03FF0000)>>16) != 0x142) && @@ -483,22 +486,27 @@ static void _PHY_PathAFillIQKMatrix(struct rtw_adapter *pAdapter, if (final_candidate == 0xFF) { return; } else if (bIQKOK) { - Oldval_0 = (PHY_QueryBBReg(pAdapter, rOFDM0_XATxIQImbalance, bMaskDWord) >> 22) & 0x3FF; + Oldval_0 = rtl8723au_read32(pAdapter, rOFDM0_XATxIQImbalance); + Oldval_0 = (Oldval_0 >> 22) & 0x3FF; X = result[final_candidate][0]; if ((X & 0x00000200) != 0) X = X | 0xFFFFFC00; TX0_A = (X * Oldval_0) >> 8; PHY_SetBBReg(pAdapter, rOFDM0_XATxIQImbalance, 0x3FF, TX0_A); - PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(31), ((X * Oldval_0>>7) & 0x1)); + PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(31), + ((X * Oldval_0>>7) & 0x1)); Y = result[final_candidate][1]; if ((Y & 0x00000200) != 0) Y = Y | 0xFFFFFC00; TX0_C = (Y * Oldval_0) >> 8; - PHY_SetBBReg(pAdapter, rOFDM0_XCTxAFE, 0xF0000000, ((TX0_C&0x3C0)>>6)); - PHY_SetBBReg(pAdapter, rOFDM0_XATxIQImbalance, 0x003F0000, (TX0_C&0x3F)); - PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(29), ((Y * Oldval_0>>7) & 0x1)); + PHY_SetBBReg(pAdapter, rOFDM0_XCTxAFE, 0xF0000000, + ((TX0_C&0x3C0)>>6)); + PHY_SetBBReg(pAdapter, rOFDM0_XATxIQImbalance, 0x003F0000, + (TX0_C&0x3F)); + PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(29), + ((Y * Oldval_0>>7) & 0x1)); if (bTxOnly) { DBG_8723A("_PHY_PathAFillIQKMatrix only Tx OK\n"); @@ -526,22 +534,27 @@ static void _PHY_PathBFillIQKMatrix(struct rtw_adapter *pAdapter, bool bIQKOK, i if (final_candidate == 0xFF) { return; } else if (bIQKOK) { - Oldval_1 = (PHY_QueryBBReg(pAdapter, rOFDM0_XBTxIQImbalance, bMaskDWord) >> 22) & 0x3FF; + Oldval_1 = rtl8723au_read32(pAdapter, rOFDM0_XBTxIQImbalance); + Oldval_1 = (Oldval_1 >> 22) & 0x3FF; X = result[final_candidate][4]; if ((X & 0x00000200) != 0) X = X | 0xFFFFFC00; TX1_A = (X * Oldval_1) >> 8; PHY_SetBBReg(pAdapter, rOFDM0_XBTxIQImbalance, 0x3FF, TX1_A); - PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(27), ((X * Oldval_1>>7) & 0x1)); + PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(27), + ((X * Oldval_1 >> 7) & 0x1)); Y = result[final_candidate][5]; if ((Y & 0x00000200) != 0) Y = Y | 0xFFFFFC00; TX1_C = (Y * Oldval_1) >> 8; - PHY_SetBBReg(pAdapter, rOFDM0_XDTxAFE, 0xF0000000, ((TX1_C&0x3C0)>>6)); - PHY_SetBBReg(pAdapter, rOFDM0_XBTxIQImbalance, 0x003F0000, (TX1_C&0x3F)); - PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(25), ((Y * Oldval_1>>7) & 0x1)); + PHY_SetBBReg(pAdapter, rOFDM0_XDTxAFE, 0xF0000000, + ((TX1_C & 0x3C0) >> 6)); + PHY_SetBBReg(pAdapter, rOFDM0_XBTxIQImbalance, 0x003F0000, + (TX1_C & 0x3F)); + PHY_SetBBReg(pAdapter, rOFDM0_ECCAThreshold, BIT(25), + ((Y * Oldval_1 >> 7) & 0x1)); if (bTxOnly) return; @@ -562,11 +575,12 @@ static void _PHY_SaveADDARegisters(struct rtw_adapter *pAdapter, u32 *ADDAReg, u u32 i; for (i = 0 ; i < RegisterNum ; i++) { - ADDABackup[i] = PHY_QueryBBReg(pAdapter, ADDAReg[i], bMaskDWord); + ADDABackup[i] = rtl8723au_read32(pAdapter, ADDAReg[i]); } } -static void _PHY_SaveMACRegisters(struct rtw_adapter *pAdapter, u32 *MACReg, u32 *MACBackup) +static void _PHY_SaveMACRegisters(struct rtw_adapter *pAdapter, u32 *MACReg, + u32 *MACBackup) { u32 i; @@ -576,16 +590,19 @@ static void _PHY_SaveMACRegisters(struct rtw_adapter *pAdapter, u32 *MACReg, u32 MACBackup[i] = rtl8723au_read32(pAdapter, MACReg[i]); } -static void _PHY_ReloadADDARegisters(struct rtw_adapter *pAdapter, u32 *ADDAReg, u32 *ADDABackup, u32 RegiesterNum) +static void _PHY_ReloadADDARegisters(struct rtw_adapter *pAdapter, + u32 *ADDAReg, u32 *ADDABackup, + u32 RegiesterNum) { u32 i; for (i = 0 ; i < RegiesterNum ; i++) { - PHY_SetBBReg(pAdapter, ADDAReg[i], bMaskDWord, ADDABackup[i]); + rtl8723au_write32(pAdapter, ADDAReg[i], ADDABackup[i]); } } -static void _PHY_ReloadMACRegisters(struct rtw_adapter *pAdapter, u32 *MACReg, u32 *MACBackup) +static void _PHY_ReloadMACRegisters(struct rtw_adapter *pAdapter, + u32 *MACReg, u32 *MACBackup) { u32 i; @@ -595,7 +612,8 @@ static void _PHY_ReloadMACRegisters(struct rtw_adapter *pAdapter, u32 *MACReg, u rtl8723au_write32(pAdapter, MACReg[i], MACBackup[i]); } -static void _PHY_PathADDAOn(struct rtw_adapter *pAdapter, u32 *ADDAReg, bool isPathAOn, bool is2T) +static void _PHY_PathADDAOn(struct rtw_adapter *pAdapter, u32 *ADDAReg, + bool isPathAOn, bool is2T) { u32 pathOn; u32 i; @@ -603,16 +621,17 @@ static void _PHY_PathADDAOn(struct rtw_adapter *pAdapter, u32 *ADDAReg, bool isP pathOn = isPathAOn ? 0x04db25a4 : 0x0b1b25a4; if (!is2T) { pathOn = 0x0bdb25a0; - PHY_SetBBReg(pAdapter, ADDAReg[0], bMaskDWord, 0x0b1b25a0); + rtl8723au_write32(pAdapter, ADDAReg[0], 0x0b1b25a0); } else { - PHY_SetBBReg(pAdapter, ADDAReg[0], bMaskDWord, pathOn); + rtl8723au_write32(pAdapter, ADDAReg[0], pathOn); } for (i = 1 ; i < IQK_ADDA_REG_NUM ; i++) - PHY_SetBBReg(pAdapter, ADDAReg[i], bMaskDWord, pathOn); + rtl8723au_write32(pAdapter, ADDAReg[i], pathOn); } -static void _PHY_MACSettingCalibration(struct rtw_adapter *pAdapter, u32 *MACReg, u32 *MACBackup) +static void _PHY_MACSettingCalibration(struct rtw_adapter *pAdapter, + u32 *MACReg, u32 *MACBackup) { u32 i = 0; @@ -627,9 +646,9 @@ static void _PHY_MACSettingCalibration(struct rtw_adapter *pAdapter, u32 *MACReg static void _PHY_PathAStandBy(struct rtw_adapter *pAdapter) { - PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x0); - PHY_SetBBReg(pAdapter, 0x840, bMaskDWord, 0x00010000); - PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x80800000); + rtl8723au_write32(pAdapter, rFPGA0_IQK, 0x0); + rtl8723au_write32(pAdapter, 0x840, 0x00010000); + rtl8723au_write32(pAdapter, rFPGA0_IQK, 0x80800000); } static void _PHY_PIModeSwitch(struct rtw_adapter *pAdapter, bool PIMode) @@ -637,8 +656,8 @@ static void _PHY_PIModeSwitch(struct rtw_adapter *pAdapter, bool PIMode) u32 mode; mode = PIMode ? 0x01000100 : 0x01000000; - PHY_SetBBReg(pAdapter, 0x820, bMaskDWord, mode); - PHY_SetBBReg(pAdapter, 0x828, bMaskDWord, mode); + rtl8723au_write32(pAdapter, 0x820, mode); + rtl8723au_write32(pAdapter, 0x828, mode); } /* @@ -735,7 +754,7 @@ static void _PHY_IQCalibrate(struct rtw_adapter *pAdapter, int result[][8], u8 t u32 bbvalue; if (t == 0) { - bbvalue = PHY_QueryBBReg(pAdapter, rFPGA0_RFMOD, bMaskDWord); + bbvalue = rtl8723au_read32(pAdapter, rFPGA0_RFMOD); /* Save ADDA parameters, turn Path A ADDA on */ _PHY_SaveADDARegisters(pAdapter, ADDA_REG, pdmpriv->ADDA_backup, IQK_ADDA_REG_NUM); @@ -755,48 +774,50 @@ static void _PHY_IQCalibrate(struct rtw_adapter *pAdapter, int result[][8], u8 t } PHY_SetBBReg(pAdapter, rFPGA0_RFMOD, BIT(24), 0x00); - PHY_SetBBReg(pAdapter, rOFDM0_TRxPathEnable, bMaskDWord, 0x03a05600); - PHY_SetBBReg(pAdapter, rOFDM0_TRMuxPar, bMaskDWord, 0x000800e4); - PHY_SetBBReg(pAdapter, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, 0x22204000); + rtl8723au_write32(pAdapter, rOFDM0_TRxPathEnable, 0x03a05600); + rtl8723au_write32(pAdapter, rOFDM0_TRMuxPar, 0x000800e4); + rtl8723au_write32(pAdapter, rFPGA0_XCD_RFInterfaceSW, 0x22204000); PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT(10), 0x01); PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFInterfaceSW, BIT(26), 0x01); PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, BIT(10), 0x00); PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT(10), 0x00); if (is2T) { - PHY_SetBBReg(pAdapter, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00010000); - PHY_SetBBReg(pAdapter, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00010000); + rtl8723au_write32(pAdapter, + rFPGA0_XA_LSSIParameter, 0x00010000); + rtl8723au_write32(pAdapter, + rFPGA0_XB_LSSIParameter, 0x00010000); } /* MAC settings */ _PHY_MACSettingCalibration(pAdapter, IQK_MAC_REG, pdmpriv->IQK_MAC_backup); /* Page B init */ - PHY_SetBBReg(pAdapter, rConfig_AntA, bMaskDWord, 0x00080000); + rtl8723au_write32(pAdapter, rConfig_AntA, 0x00080000); if (is2T) - PHY_SetBBReg(pAdapter, rConfig_AntB, bMaskDWord, 0x00080000); + rtl8723au_write32(pAdapter, rConfig_AntB, 0x00080000); /* IQ calibration setting */ - PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0x80800000); - PHY_SetBBReg(pAdapter, rTx_IQK, bMaskDWord, 0x01007c00); - PHY_SetBBReg(pAdapter, rRx_IQK, bMaskDWord, 0x01004800); + rtl8723au_write32(pAdapter, rFPGA0_IQK, 0x80800000); + rtl8723au_write32(pAdapter, rTx_IQK, 0x01007c00); + rtl8723au_write32(pAdapter, rRx_IQK, 0x01004800); for (i = 0 ; i < retryCount ; i++) { PathAOK = _PHY_PathA_IQK(pAdapter, is2T); if (PathAOK == 0x03) { DBG_8723A("Path A IQK Success!!\n"); - result[t][0] = (PHY_QueryBBReg(pAdapter, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; - result[t][1] = (PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; - result[t][2] = (PHY_QueryBBReg(pAdapter, rRx_Power_Before_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; - result[t][3] = (PHY_QueryBBReg(pAdapter, rRx_Power_After_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; + result[t][0] = (rtl8723au_read32(pAdapter, rTx_Power_Before_IQK_A)&0x3FF0000)>>16; + result[t][1] = (rtl8723au_read32(pAdapter, rTx_Power_After_IQK_A)&0x3FF0000)>>16; + result[t][2] = (rtl8723au_read32(pAdapter, rRx_Power_Before_IQK_A_2)&0x3FF0000)>>16; + result[t][3] = (rtl8723au_read32(pAdapter, rRx_Power_After_IQK_A_2)&0x3FF0000)>>16; break; } else if (i == (retryCount-1) && PathAOK == 0x01) { /* Tx IQK OK */ DBG_8723A("Path A IQK Only Tx Success!!\n"); - result[t][0] = (PHY_QueryBBReg(pAdapter, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; - result[t][1] = (PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; + result[t][0] = (rtl8723au_read32(pAdapter, rTx_Power_Before_IQK_A)&0x3FF0000)>>16; + result[t][1] = (rtl8723au_read32(pAdapter, rTx_Power_After_IQK_A)&0x3FF0000)>>16; } } @@ -814,16 +835,16 @@ static void _PHY_IQCalibrate(struct rtw_adapter *pAdapter, int result[][8], u8 t PathBOK = _PHY_PathB_IQK(pAdapter); if (PathBOK == 0x03) { DBG_8723A("Path B IQK Success!!\n"); - result[t][4] = (PHY_QueryBBReg(pAdapter, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16; - result[t][5] = (PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16; - result[t][6] = (PHY_QueryBBReg(pAdapter, rRx_Power_Before_IQK_B_2, bMaskDWord)&0x3FF0000)>>16; - result[t][7] = (PHY_QueryBBReg(pAdapter, rRx_Power_After_IQK_B_2, bMaskDWord)&0x3FF0000)>>16; + result[t][4] = (rtl8723au_read32(pAdapter, rTx_Power_Before_IQK_B)&0x3FF0000)>>16; + result[t][5] = (rtl8723au_read32(pAdapter, rTx_Power_After_IQK_B)&0x3FF0000)>>16; + result[t][6] = (rtl8723au_read32(pAdapter, rRx_Power_Before_IQK_B_2)&0x3FF0000)>>16; + result[t][7] = (rtl8723au_read32(pAdapter, rRx_Power_After_IQK_B_2)&0x3FF0000)>>16; break; } else if (i == (retryCount - 1) && PathBOK == 0x01) { /* Tx IQK OK */ DBG_8723A("Path B Only Tx IQK Success!!\n"); - result[t][4] = (PHY_QueryBBReg(pAdapter, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16; - result[t][5] = (PHY_QueryBBReg(pAdapter, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16; + result[t][4] = (rtl8723au_read32(pAdapter, rTx_Power_Before_IQK_B)&0x3FF0000)>>16; + result[t][5] = (rtl8723au_read32(pAdapter, rTx_Power_After_IQK_B)&0x3FF0000)>>16; } } @@ -833,7 +854,7 @@ static void _PHY_IQCalibrate(struct rtw_adapter *pAdapter, int result[][8], u8 t } /* Back to BB mode, load original value */ - PHY_SetBBReg(pAdapter, rFPGA0_IQK, bMaskDWord, 0); + rtl8723au_write32(pAdapter, rFPGA0_IQK, 0); if (t != 0) { if (!pdmpriv->bRfPiEnable) { @@ -851,14 +872,16 @@ static void _PHY_IQCalibrate(struct rtw_adapter *pAdapter, int result[][8], u8 t _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pdmpriv->IQK_BB_backup, IQK_BB_REG_NUM); /* Restore RX initial gain */ - PHY_SetBBReg(pAdapter, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00032ed3); + rtl8723au_write32(pAdapter, + rFPGA0_XA_LSSIParameter, 0x00032ed3); if (is2T) { - PHY_SetBBReg(pAdapter, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00032ed3); + rtl8723au_write32(pAdapter, + rFPGA0_XB_LSSIParameter, 0x00032ed3); } /* load 0xe30 IQC default value */ - PHY_SetBBReg(pAdapter, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); - PHY_SetBBReg(pAdapter, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); + rtl8723au_write32(pAdapter, rTx_IQK_Tone_A, 0x01008c00); + rtl8723au_write32(pAdapter, rRx_IQK_Tone_A, 0x01008c00); } } -- cgit v1.2.3 From b3ced7caa245e5cf2bd628e6fd8b6581f30acb50 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:39 -0500 Subject: staging: rtl8723au: writeOFDMPowerReg() use rtl8723au_write32() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c b/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c index 1aad4384471c..32c58c6124b0 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c @@ -353,7 +353,7 @@ static void writeOFDMPowerReg(struct rtw_adapter *Adapter, u8 index, else RegOffset = RegOffset_B[index]; - PHY_SetBBReg(Adapter, RegOffset, bMaskDWord, writeVal); + rtl8723au_write32(Adapter, RegOffset, writeVal); /* 201005115 Joseph: Set Tx Power diff for Tx power training mechanism. */ -- cgit v1.2.3 From dbe2d4dfde1941aa14c0a13e9dbc9044b522086e Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:40 -0500 Subject: staging: rtl8723au: rtl8723a_phycfg.c: Use proper register read/write functions Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c index 6d597169c11c..d34a1481b13a 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c @@ -190,25 +190,24 @@ phy_RFSerialRead(struct rtw_adapter *Adapter, enum RF_RADIO_PATH eRFPath, /* For 92S LSSI Read RFLSSIRead */ /* For RF A/B write 0x824/82c(does not work in the future) */ /* We must use 0x824 for RF A and B to execute read trigger */ - tmplong = PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord); + tmplong = rtl8723au_read32(Adapter, rFPGA0_XA_HSSIParameter2); if (eRFPath == RF_PATH_A) tmplong2 = tmplong; else - tmplong2 = PHY_QueryBBReg(Adapter, pPhyReg->rfHSSIPara2, - bMaskDWord); + tmplong2 = rtl8723au_read32(Adapter, pPhyReg->rfHSSIPara2); tmplong2 = (tmplong2 & ~bLSSIReadAddress) | (NewOffset << 23) | bLSSIReadEdge; /* T65 RF */ - PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, - bMaskDWord, tmplong & (~bLSSIReadEdge)); + rtl8723au_write32(Adapter, rFPGA0_XA_HSSIParameter2, + tmplong & (~bLSSIReadEdge)); udelay(10);/* PlatformStallExecution(10); */ - PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord, tmplong2); + rtl8723au_write32(Adapter, pPhyReg->rfHSSIPara2, tmplong2); udelay(100);/* PlatformStallExecution(100); */ - PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, - tmplong | bLSSIReadEdge); + rtl8723au_write32(Adapter, rFPGA0_XA_HSSIParameter2, + tmplong | bLSSIReadEdge); udelay(10);/* PlatformStallExecution(10); */ if (eRFPath == RF_PATH_A) @@ -319,9 +318,7 @@ phy_RFSerialWrite(struct rtw_adapter *Adapter, enum RF_RADIO_PATH eRFPath, /* */ /* Write Operation */ /* */ - PHY_SetBBReg(Adapter, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr); - /* RTPRINT(FPHY, PHY_RFW, ("RFW-%d Addr[0x%lx]= 0x%lx\n", eRFPath, pPhyReg->rf3wireOffset, DataAndAddr)); */ - + rtl8723au_write32(Adapter, pPhyReg->rf3wireOffset, DataAndAddr); } /** @@ -830,7 +827,7 @@ PHY_BBConfig8723A(struct rtw_adapter *Adapter) (CrystalCap | (CrystalCap << 6))); } - PHY_SetBBReg(Adapter, REG_LDOA15_CTRL, bMaskDWord, 0x01572505); + rtl8723au_write32(Adapter, REG_LDOA15_CTRL, 0x01572505); return rtStatus; } -- cgit v1.2.3 From 2c177a8c7799651c1a62b007d16300e50688c287 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:41 -0500 Subject: staging: rtl8723au: usb_halinit.c: Use rtl8723au_{read,write}32() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/usb_halinit.c | 43 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index 57518dc67509..bd9c549f4a0a 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -609,17 +609,22 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) } /* reducing 80M spur */ - PHY_SetBBReg(Adapter, REG_AFE_XTAL_CTRL, bMaskDWord, 0x0381808d); - PHY_SetBBReg(Adapter, REG_AFE_PLL_CTRL, bMaskDWord, 0xf0ffff83); - PHY_SetBBReg(Adapter, REG_AFE_PLL_CTRL, bMaskDWord, 0xf0ffff82); - PHY_SetBBReg(Adapter, REG_AFE_PLL_CTRL, bMaskDWord, 0xf0ffff83); + rtl8723au_write32(Adapter, REG_AFE_XTAL_CTRL, 0x0381808d); + rtl8723au_write32(Adapter, REG_AFE_PLL_CTRL, 0xf0ffff83); + rtl8723au_write32(Adapter, REG_AFE_PLL_CTRL, 0xf0ffff82); + rtl8723au_write32(Adapter, REG_AFE_PLL_CTRL, 0xf0ffff83); /* RFSW Control */ - PHY_SetBBReg(Adapter, rFPGA0_TxInfo, bMaskDWord, 0x00000003); /* 0x804[14]= 0 */ - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFInterfaceSW, bMaskDWord, 0x07000760); /* 0x870[6:5]= b'11 */ - PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, bMaskDWord, 0x66F60210); /* 0x860[6:5]= b'00 */ + /* 0x804[14]= 0 */ + rtl8723au_write32(Adapter, rFPGA0_TxInfo, 0x00000003); + /* 0x870[6:5]= b'11 */ + rtl8723au_write32(Adapter, rFPGA0_XAB_RFInterfaceSW, 0x07000760); + /* 0x860[6:5]= b'00 */ + rtl8723au_write32(Adapter, rFPGA0_XA_RFInterfaceOE, 0x66F60210); - RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("%s: 0x870 = value 0x%x\n", __func__, PHY_QueryBBReg(Adapter, 0x870, bMaskDWord))); + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, + ("%s: 0x870 = value 0x%x\n", __func__, + rtl8723au_read32(Adapter, 0x870))); /* */ /* Joseph Note: Keep RfRegChnlVal for later use. */ @@ -790,11 +795,9 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, /* AFE */ if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x63DB25A0); + rtl8723au_write32(Adapter, rRx_Wait_CCA, 0x63DB25A0); else if (pHalData->rf_type == RF_1T1R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x631B25A0); + rtl8723au_write32(Adapter, rRx_Wait_CCA, 0x631B25A0); /* 4. issue 3-wire command that RF set to Rx idle mode. This is used to re-write the RX idle mode. */ @@ -825,13 +828,11 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, for packet detection */ /* (4) Reg800[1] = 1 enable preamble power saving */ Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF0] = - PHY_QueryBBReg(Adapter, rFPGA0_XAB_RFParameter, - bMaskDWord); + rtl8723au_read32(Adapter, rFPGA0_XAB_RFParameter); Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF1] = - PHY_QueryBBReg(Adapter, rOFDM0_TRxPathEnable, - bMaskDWord); + rtl8723au_read32(Adapter, rOFDM0_TRxPathEnable); Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF2] = - PHY_QueryBBReg(Adapter, rFPGA0_RFMOD, bMaskDWord); + rtl8723au_read32(Adapter, rFPGA0_RFMOD); if (pHalData->rf_type == RF_2T2R) { PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, 0x380038, 0); @@ -843,13 +844,11 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, /* 2 .AFE control register to power down. bit[30:22] */ Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_AFE0] = - PHY_QueryBBReg(Adapter, rRx_Wait_CCA, bMaskDWord); + rtl8723au_read32(Adapter, rRx_Wait_CCA); if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x00DB25A0); + rtl8723au_write32(Adapter, rRx_Wait_CCA, 0x00DB25A0); else if (pHalData->rf_type == RF_1T1R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x001B25A0); + rtl8723au_write32(Adapter, rRx_Wait_CCA, 0x001B25A0); /* 3. issue 3-wire command that RF set to power down.*/ PHY_SetRFReg(Adapter, RF_PATH_A, RF_AC, bRFRegOffsetMask, 0); -- cgit v1.2.3 From a39bd1f53c5cea79db22b37a59b75dbee6e36aa3 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:42 -0500 Subject: staging: rtl8723au: odm.c: Use rtl8723au_{read, write}32() for 32 bit register access Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 7a5cff5431c7..5220a0b535a3 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -714,28 +714,25 @@ void odm_DIG23a(struct rtw_adapter *adapter) void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) { - u32 ret_value; + struct rtw_adapter *adapter = pDM_Odm->Adapter; struct false_alarm_stats *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; + u32 ret_value; /* hold ofdm counter */ - /* hold page C counter */ + /* hold page C counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT(31), 1); /* hold page D counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT(31), 1); - ret_value = - ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE1_11N, bMaskDWord); + ret_value = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_TYPE1_11N); FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); FalseAlmCnt->Cnt_SB_Search_fail = (ret_value & 0xffff0000)>>16; - ret_value = - ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE2_11N, bMaskDWord); + ret_value = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_TYPE2_11N); FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); FalseAlmCnt->Cnt_Parity_Fail = (ret_value & 0xffff0000)>>16; - ret_value = - ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE3_11N, bMaskDWord); + ret_value = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_TYPE3_11N); FalseAlmCnt->Cnt_Rate_Illegal = (ret_value&0xffff); FalseAlmCnt->Cnt_Crc8_fail = (ret_value & 0xffff0000)>>16; - ret_value = - ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE4_11N, bMaskDWord); + ret_value = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_TYPE4_11N); FalseAlmCnt->Cnt_Mcs_fail = (ret_value&0xffff); FalseAlmCnt->Cnt_Ofdm_fail = FalseAlmCnt->Cnt_Parity_Fail + @@ -753,7 +750,7 @@ void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_MSB_11N, bMaskByte3); FalseAlmCnt->Cnt_Cck_fail += (ret_value & 0xff) << 8; - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_CCA_CNT_11N, bMaskDWord); + ret_value = rtl8723au_read32(adapter, ODM_REG_CCK_CCA_CNT_11N); FalseAlmCnt->Cnt_CCK_CCA = ((ret_value&0xFF)<<8) | ((ret_value&0xFF00)>>8); @@ -881,19 +878,19 @@ void odm_DynamicBBPowerSaving23a(struct dm_odm_t *pDM_Odm) void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) { struct dynamic_pwr_sav *pDM_PSTable = &pDM_Odm->DM_PSTable; + struct rtw_adapter *adapter = pDM_Odm->Adapter; u8 Rssi_Up_bound = 30; u8 Rssi_Low_bound = 25; if (pDM_PSTable->initialize == 0) { - pDM_PSTable->Reg874 = (ODM_GetBBReg(pDM_Odm, 0x874, - bMaskDWord)&0x1CC000) >> 14; + pDM_PSTable->Reg874 = + (rtl8723au_read32(adapter, 0x874) & 0x1CC000) >> 14; pDM_PSTable->RegC70 = - (ODM_GetBBReg(pDM_Odm, 0xc70, bMaskDWord) & BIT(3)) >>3; - pDM_PSTable->Reg85C = (ODM_GetBBReg(pDM_Odm, 0x85c, - bMaskDWord)&0xFF000000)>>24; - pDM_PSTable->RegA74 = (ODM_GetBBReg(pDM_Odm, 0xa74, - bMaskDWord)&0xF000)>>12; - /* Reg818 = PHY_QueryBBReg(pAdapter, 0x818, bMaskDWord); */ + (rtl8723au_read32(adapter, 0xc70) & BIT(3)) >>3; + pDM_PSTable->Reg85C = + (rtl8723au_read32(adapter, 0x85c) & 0xFF000000) >> 24; + pDM_PSTable->RegA74 = + (rtl8723au_read32(adapter, 0xa74) & 0xF000) >> 12; pDM_PSTable->initialize = 1; } -- cgit v1.2.3 From 539b61bfd79bee0663f438009d21013abd36f17b Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:43 -0500 Subject: staging: rtl8723au: odm_ConfigBB_AGC_8723A() always does 32 bit writes Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c | 5 ++--- drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c | 14 ++++---------- drivers/staging/rtl8723au/include/odm_RegConfig8723A.h | 3 +-- 3 files changed, 7 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c b/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c index 577b9113b212..efeb82cfa4a2 100644 --- a/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c +++ b/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c @@ -215,7 +215,6 @@ static u32 Array_AGC_TAB_1T_8723A[] = { void ODM_ReadAndConfig_AGC_TAB_1T_8723A(struct dm_odm_t *pDM_Odm) { - u32 hex; u32 i; u8 platform = 0x04; @@ -233,7 +232,7 @@ void ODM_ReadAndConfig_AGC_TAB_1T_8723A(struct dm_odm_t *pDM_Odm) /* This (offset, data) pair meets the condition. */ if (v1 < 0xCDCDCDCD) { - odm_ConfigBB_AGC_8723A(pDM_Odm, v1, bMaskDWord, v2); + odm_ConfigBB_AGC_8723A(pDM_Odm, v1, v2); continue; } else { if (!CheckCondition(Array[i], hex)) { @@ -250,7 +249,7 @@ void ODM_ReadAndConfig_AGC_TAB_1T_8723A(struct dm_odm_t *pDM_Odm) while (v2 != 0xDEAD && v2 != 0xCDEF && v2 != 0xCDCD && i < ArrayLen - 2) { - odm_ConfigBB_AGC_8723A(pDM_Odm, v1, bMaskDWord, v2); + odm_ConfigBB_AGC_8723A(pDM_Odm, v1, v2); READ_NEXT_PAIR(v1, v2, i); } while (v2 != 0xDEAD && i < ArrayLen - 2) diff --git a/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c b/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c index 88e0126e855a..7fa1b38f83a0 100644 --- a/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c +++ b/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c @@ -14,6 +14,7 @@ ******************************************************************************/ #include "odm_precomp.h" +#include "usb_ops_linux.h" void odm_ConfigRFReg_8723A( @@ -54,21 +55,14 @@ void odm_ConfigMAC_8723A(struct dm_odm_t *pDM_Odm, Addr, Data)); } -void -odm_ConfigBB_AGC_8723A( - struct dm_odm_t *pDM_Odm, - u32 Addr, - u32 Bitmask, - u32 Data - ) +void odm_ConfigBB_AGC_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data) { - ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data); + rtl8723au_write32(pDM_Odm->Adapter, addr, data); /* Add 1us delay between BB/RF register setting. */ udelay(1); ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, - ("===> ODM_ConfigBBWithHeaderFile23a: [AGC_TAB] %08X %08X\n", - Addr, Data)); + ("===> %s: [AGC_TAB] %08X %08X\n", __func__, addr, data)); } void diff --git a/drivers/staging/rtl8723au/include/odm_RegConfig8723A.h b/drivers/staging/rtl8723au/include/odm_RegConfig8723A.h index a6cfb6df4cf7..5f6bc30b43af 100644 --- a/drivers/staging/rtl8723au/include/odm_RegConfig8723A.h +++ b/drivers/staging/rtl8723au/include/odm_RegConfig8723A.h @@ -20,8 +20,7 @@ void odm_ConfigRFReg_8723A(struct dm_odm_t *pDM_Odm, u32 Addr, u32 Data, void odm_ConfigMAC_8723A(struct dm_odm_t *pDM_Odm, u32 Addr, u8 Data); -void odm_ConfigBB_AGC_8723A(struct dm_odm_t *pDM_Odm, u32 Addr, - u32 Bitmask, u32 Data); +void odm_ConfigBB_AGC_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data); void odm_ConfigBB_PHY_8723A(struct dm_odm_t *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data); -- cgit v1.2.3 From 2f3cf84fceb77a62e0d9ea0d003fea619c99db4e Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:44 -0500 Subject: staging: rtl8723au: odm_ConfigBB_PHY_8723A() always issues 32 bit writes Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c | 35 ++++++++++++---------- drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c | 28 +++++++---------- .../staging/rtl8723au/include/odm_RegConfig8723A.h | 2 +- 3 files changed, 31 insertions(+), 34 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c b/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c index efeb82cfa4a2..e8cab9e97385 100644 --- a/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c +++ b/drivers/staging/rtl8723au/hal/HalHWImg8723A_BB.c @@ -236,7 +236,7 @@ void ODM_ReadAndConfig_AGC_TAB_1T_8723A(struct dm_odm_t *pDM_Odm) continue; } else { if (!CheckCondition(Array[i], hex)) { - /* Discard the following (offset, data) pairs. */ + /* Discard the following (offset, data) pairs */ READ_NEXT_PAIR(v1, v2, i); while (v2 != 0xDEAD && v2 != 0xCDEF && @@ -244,7 +244,8 @@ void ODM_ReadAndConfig_AGC_TAB_1T_8723A(struct dm_odm_t *pDM_Odm) READ_NEXT_PAIR(v1, v2, i); i -= 2; /* prevent from for-loop += 2 */ } else { - /* Configure matched pairs and skip to end of if-else. */ + /* Configure matched pairs and skip to + end of if-else. */ READ_NEXT_PAIR(v1, v2, i); while (v2 != 0xDEAD && v2 != 0xCDEF && @@ -479,11 +480,11 @@ void ODM_ReadAndConfig_PHY_REG_1T_8723A(struct dm_odm_t *pDM_Odm) /* This (offset, data) pair meets the condition. */ if (v1 < 0xCDCDCDCD) { - odm_ConfigBB_PHY_8723A(pDM_Odm, v1, bMaskDWord, v2); + odm_ConfigBB_PHY_8723A(pDM_Odm, v1, v2); continue; } else { if (!CheckCondition(Array[i], hex)) { - /* Discard the following (offset, data) pairs. */ + /* Discard the following (offset, data) pairs */ READ_NEXT_PAIR(v1, v2, i); while (v2 != 0xDEAD && v2 != 0xCDEF && @@ -491,12 +492,13 @@ void ODM_ReadAndConfig_PHY_REG_1T_8723A(struct dm_odm_t *pDM_Odm) READ_NEXT_PAIR(v1, v2, i); i -= 2; /* prevent from for-loop += 2 */ } else { - /* Configure matched pairs and skip to end of if-else. */ + /* Configure matched pairs and skip to + end of if-else. */ READ_NEXT_PAIR(v1, v2, i); while (v2 != 0xDEAD && v2 != 0xCDEF && v2 != 0xCDCD && i < ArrayLen - 2) { - odm_ConfigBB_PHY_8723A(pDM_Odm, v1, bMaskDWord, v2); + odm_ConfigBB_PHY_8723A(pDM_Odm, v1, v2); READ_NEXT_PAIR(v1, v2, i); } while (v2 != 0xDEAD && i < ArrayLen - 2) @@ -517,12 +519,12 @@ static u32 Array_PHY_REG_MP_8723A[] = { void ODM_ReadAndConfig_PHY_REG_MP_8723A(struct dm_odm_t *pDM_Odm) { - u32 hex = 0; - u32 i = 0; - u8 platform = 0x04; - u8 board = pDM_Odm->BoardType; - u32 ArrayLen = sizeof(Array_PHY_REG_MP_8723A)/sizeof(u32); - u32 *Array = Array_PHY_REG_MP_8723A; + u32 hex = 0; + u32 i; + u8 platform = 0x04; + u8 board = pDM_Odm->BoardType; + u32 ArrayLen = sizeof(Array_PHY_REG_MP_8723A)/sizeof(u32); + u32 *Array = Array_PHY_REG_MP_8723A; hex += board; hex += ODM_ITRF_USB << 8; @@ -534,11 +536,11 @@ void ODM_ReadAndConfig_PHY_REG_MP_8723A(struct dm_odm_t *pDM_Odm) /* This (offset, data) pair meets the condition. */ if (v1 < 0xCDCDCDCD) { - odm_ConfigBB_PHY_8723A(pDM_Odm, v1, bMaskDWord, v2); + odm_ConfigBB_PHY_8723A(pDM_Odm, v1, v2); continue; } else { if (!CheckCondition(Array[i], hex)) { - /* Discard the following (offset, data) pairs. */ + /* Discard the following (offset, data) pairs */ READ_NEXT_PAIR(v1, v2, i); while (v2 != 0xDEAD && v2 != 0xCDEF && @@ -546,12 +548,13 @@ void ODM_ReadAndConfig_PHY_REG_MP_8723A(struct dm_odm_t *pDM_Odm) READ_NEXT_PAIR(v1, v2, i); i -= 2; /* prevent from for-loop += 2 */ } else { - /* Configure matched pairs and skip to end of if-else. */ + /* Configure matched pairs and skip to + end of if-else. */ READ_NEXT_PAIR(v1, v2, i); while (v2 != 0xDEAD && v2 != 0xCDEF && v2 != 0xCDCD && i < ArrayLen - 2) { - odm_ConfigBB_PHY_8723A(pDM_Odm, v1, bMaskDWord, v2); + odm_ConfigBB_PHY_8723A(pDM_Odm, v1, v2); READ_NEXT_PAIR(v1, v2, i); } while (v2 != 0xDEAD && i < ArrayLen - 2) diff --git a/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c b/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c index 7fa1b38f83a0..fb84f6ce5a91 100644 --- a/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c +++ b/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c @@ -66,33 +66,27 @@ void odm_ConfigBB_AGC_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data) } void -odm_ConfigBB_PHY_8723A( - struct dm_odm_t *pDM_Odm, - u32 Addr, - u32 Bitmask, - u32 Data - ) +odm_ConfigBB_PHY_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data) { - if (Addr == 0xfe) + if (addr == 0xfe) msleep(50); - else if (Addr == 0xfd) + else if (addr == 0xfd) mdelay(5); - else if (Addr == 0xfc) + else if (addr == 0xfc) mdelay(1); - else if (Addr == 0xfb) + else if (addr == 0xfb) udelay(50); - else if (Addr == 0xfa) + else if (addr == 0xfa) udelay(5); - else if (Addr == 0xf9) + else if (addr == 0xf9) udelay(1); - else if (Addr == 0xa24) - pDM_Odm->RFCalibrateInfo.RegA24 = Data; - ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data); + else if (addr == 0xa24) + pDM_Odm->RFCalibrateInfo.RegA24 = data; + rtl8723au_write32(pDM_Odm->Adapter, addr, data); /* Add 1us delay between BB/RF register setting. */ udelay(1); ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, - ("===> ODM_ConfigBBWithHeaderFile23a: [PHY_REG] %08X %08X\n", - Addr, Data)); + ("===> %s: [PHY_REG] %08X %08X\n", __func__, addr, data)); } diff --git a/drivers/staging/rtl8723au/include/odm_RegConfig8723A.h b/drivers/staging/rtl8723au/include/odm_RegConfig8723A.h index 5f6bc30b43af..f2a54d829ed5 100644 --- a/drivers/staging/rtl8723au/include/odm_RegConfig8723A.h +++ b/drivers/staging/rtl8723au/include/odm_RegConfig8723A.h @@ -22,6 +22,6 @@ void odm_ConfigMAC_8723A(struct dm_odm_t *pDM_Odm, u32 Addr, u8 Data); void odm_ConfigBB_AGC_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data); -void odm_ConfigBB_PHY_8723A(struct dm_odm_t *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data); +void odm_ConfigBB_PHY_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data); #endif /* end of SUPPORT */ -- cgit v1.2.3 From 4f092cc7eacb35cf9a7f0a86813094b5c78e476f Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:45 -0500 Subject: staging: rtl8723au: Eliminate ODM_Write1Byte() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 4 ++-- drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c | 10 +++------- drivers/staging/rtl8723au/hal/odm_interface.c | 7 ------- drivers/staging/rtl8723au/include/odm_interface.h | 1 - 4 files changed, 5 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 5220a0b535a3..247ae631077f 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -849,8 +849,8 @@ void ODM_Write_CCK_CCA_Thres23a(struct dm_odm_t *pDM_Odm, u8 CurCCK_CCAThres) struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; if (pDM_DigTable->CurCCK_CCAThres != CurCCK_CCAThres) - ODM_Write1Byte(pDM_Odm, ODM_REG(CCK_CCA, pDM_Odm), - CurCCK_CCAThres); + rtl8723au_write8(pDM_Odm->Adapter, ODM_REG(CCK_CCA, pDM_Odm), + CurCCK_CCAThres); pDM_DigTable->PreCCK_CCAThres = pDM_DigTable->CurCCK_CCAThres; pDM_DigTable->CurCCK_CCAThres = CurCCK_CCAThres; } diff --git a/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c b/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c index fb84f6ce5a91..342dec3e939f 100644 --- a/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c +++ b/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c @@ -44,15 +44,11 @@ odm_ConfigRFReg_8723A( } } -void odm_ConfigMAC_8723A(struct dm_odm_t *pDM_Odm, - u32 Addr, - u8 Data - ) +void odm_ConfigMAC_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u8 data) { - ODM_Write1Byte(pDM_Odm, Addr, Data); + rtl8723au_write8(pDM_Odm->Adapter, addr, data); ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, - ("===> ODM_ConfigMACWithHeaderFile23a: [MAC_REG] %08X %08X\n", - Addr, Data)); + ("===> %s: [MAC_REG] %08X %08X\n", __func__, addr, data)); } void odm_ConfigBB_AGC_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data) diff --git a/drivers/staging/rtl8723au/hal/odm_interface.c b/drivers/staging/rtl8723au/hal/odm_interface.c index f03f6d4a3888..36fe7b711905 100644 --- a/drivers/staging/rtl8723au/hal/odm_interface.c +++ b/drivers/staging/rtl8723au/hal/odm_interface.c @@ -46,13 +46,6 @@ u32 ODM_Read4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr) return rtl8723au_read32(Adapter, RegAddr); } -void ODM_Write1Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u8 Data) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - rtl8723au_write8(Adapter, RegAddr, Data); -} - void ODM_Write2Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u16 Data) { struct rtw_adapter *Adapter = pDM_Odm->Adapter; diff --git a/drivers/staging/rtl8723au/include/odm_interface.h b/drivers/staging/rtl8723au/include/odm_interface.h index ea35070b744f..e993d8d3ffc2 100644 --- a/drivers/staging/rtl8723au/include/odm_interface.h +++ b/drivers/staging/rtl8723au/include/odm_interface.h @@ -58,7 +58,6 @@ typedef void (*RT_WORKITEM_CALL_BACK)(struct work_struct *pContext); u8 ODM_Read1Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr); u16 ODM_Read2Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr); u32 ODM_Read4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr); -void ODM_Write1Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u8 Data); void ODM_Write2Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u16 Data); void ODM_Write4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 Data); void ODM_SetMACReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask, u32 Data); -- cgit v1.2.3 From c43b3e319f558acebd2e05bd24b5ba0bed27c3f2 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:46 -0500 Subject: staging: rtl8723au: Remove various ODM_* register access wrappers Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm_interface.c | 53 ----------------------- drivers/staging/rtl8723au/include/odm_interface.h | 6 --- 2 files changed, 59 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm_interface.c b/drivers/staging/rtl8723au/hal/odm_interface.c index 36fe7b711905..01413006e11d 100644 --- a/drivers/staging/rtl8723au/hal/odm_interface.c +++ b/drivers/staging/rtl8723au/hal/odm_interface.c @@ -23,22 +23,6 @@ /* */ #include -u8 ODM_Read1Byte(struct dm_odm_t *pDM_Odm, - u32 RegAddr - ) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - return rtl8723au_read8(Adapter, RegAddr); -} - -u16 ODM_Read2Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - return rtl8723au_read16(Adapter, RegAddr); -} - u32 ODM_Read4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr) { struct rtw_adapter *Adapter = pDM_Odm->Adapter; @@ -46,43 +30,6 @@ u32 ODM_Read4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr) return rtl8723au_read32(Adapter, RegAddr); } -void ODM_Write2Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u16 Data) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - rtl8723au_write16(Adapter, RegAddr, Data); -} - -void ODM_Write4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 Data) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - rtl8723au_write32(Adapter, RegAddr, Data); -} - -void ODM_SetMACReg( - struct dm_odm_t *pDM_Odm, - u32 RegAddr, - u32 BitMask, - u32 Data - ) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - PHY_SetBBReg(Adapter, RegAddr, BitMask, Data); -} - -u32 ODM_GetMACReg( - struct dm_odm_t *pDM_Odm, - u32 RegAddr, - u32 BitMask - ) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - return PHY_QueryBBReg(Adapter, RegAddr, BitMask); -} - void ODM_SetBBReg( struct dm_odm_t *pDM_Odm, u32 RegAddr, diff --git a/drivers/staging/rtl8723au/include/odm_interface.h b/drivers/staging/rtl8723au/include/odm_interface.h index e993d8d3ffc2..a4ce5ce6400a 100644 --- a/drivers/staging/rtl8723au/include/odm_interface.h +++ b/drivers/staging/rtl8723au/include/odm_interface.h @@ -55,13 +55,7 @@ typedef void (*RT_WORKITEM_CALL_BACK)(struct work_struct *pContext); /* */ -u8 ODM_Read1Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr); -u16 ODM_Read2Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr); u32 ODM_Read4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr); -void ODM_Write2Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u16 Data); -void ODM_Write4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 Data); -void ODM_SetMACReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask, u32 Data); -u32 ODM_GetMACReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask); void ODM_SetBBReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask, u32 Data); u32 ODM_GetBBReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask); void ODM_SetRFReg(struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath, -- cgit v1.2.3 From 53de9947e3488b743a6cec200e967237af481b11 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:47 -0500 Subject: staging: rtl8723au: Get rid of ODM_Read4Byte() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 9 ++++----- drivers/staging/rtl8723au/hal/odm_interface.c | 7 ------- drivers/staging/rtl8723au/include/odm_interface.h | 2 -- 3 files changed, 4 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 247ae631077f..59af7bcdb647 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -1256,7 +1256,6 @@ static void odm_TXPowerTrackingInit(struct dm_odm_t *pDM_Odm) /* EDCA Turbo */ static void ODM_EdcaTurboInit23a(struct dm_odm_t *pDM_Odm) { - struct rtw_adapter *Adapter = pDM_Odm->Adapter; pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; @@ -1264,16 +1263,16 @@ static void ODM_EdcaTurboInit23a(struct dm_odm_t *pDM_Odm) ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial VO PARAM: 0x%x\n", - ODM_Read4Byte(pDM_Odm, ODM_EDCA_VO_PARAM))); + rtl8723au_read32(Adapter, ODM_EDCA_VO_PARAM))); ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial VI PARAM: 0x%x\n", - ODM_Read4Byte(pDM_Odm, ODM_EDCA_VI_PARAM))); + rtl8723au_read32(Adapter, ODM_EDCA_VI_PARAM))); ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial BE PARAM: 0x%x\n", - ODM_Read4Byte(pDM_Odm, ODM_EDCA_BE_PARAM))); + rtl8723au_read32(Adapter, ODM_EDCA_BE_PARAM))); ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial BK PARAM: 0x%x\n", - ODM_Read4Byte(pDM_Odm, ODM_EDCA_BK_PARAM))); + rtl8723au_read32(Adapter, ODM_EDCA_BK_PARAM))); } static void odm_EdcaTurboCheck23a(struct dm_odm_t *pDM_Odm) diff --git a/drivers/staging/rtl8723au/hal/odm_interface.c b/drivers/staging/rtl8723au/hal/odm_interface.c index 01413006e11d..5b57641d0c00 100644 --- a/drivers/staging/rtl8723au/hal/odm_interface.c +++ b/drivers/staging/rtl8723au/hal/odm_interface.c @@ -23,13 +23,6 @@ /* */ #include -u32 ODM_Read4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - return rtl8723au_read32(Adapter, RegAddr); -} - void ODM_SetBBReg( struct dm_odm_t *pDM_Odm, u32 RegAddr, diff --git a/drivers/staging/rtl8723au/include/odm_interface.h b/drivers/staging/rtl8723au/include/odm_interface.h index a4ce5ce6400a..62a46c03e98b 100644 --- a/drivers/staging/rtl8723au/include/odm_interface.h +++ b/drivers/staging/rtl8723au/include/odm_interface.h @@ -54,8 +54,6 @@ typedef void (*RT_WORKITEM_CALL_BACK)(struct work_struct *pContext); /* =========== EXtern Function Prototype */ /* */ - -u32 ODM_Read4Byte(struct dm_odm_t *pDM_Odm, u32 RegAddr); void ODM_SetBBReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask, u32 Data); u32 ODM_GetBBReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask); void ODM_SetRFReg(struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath, -- cgit v1.2.3 From 3f9cb6a093030f8deb5785b4cddcbffdf1aa4c3e Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:48 -0500 Subject: staging: rtl8723au: Eliminate ODM_GetBBReg() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 28 ++++++++++++++--------- drivers/staging/rtl8723au/hal/odm_interface.c | 11 --------- drivers/staging/rtl8723au/include/odm_interface.h | 1 - 3 files changed, 17 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 59af7bcdb647..20499d2b2945 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -379,13 +379,18 @@ void ODM_CmnInfoUpdate23a(struct dm_odm_t *pDM_Odm, u32 CmnInfo, u64 Value) } -void odm_CommonInfoSelfInit23a(struct dm_odm_t *pDM_Odm - ) +void odm_CommonInfoSelfInit23a(struct dm_odm_t *pDM_Odm) { - pDM_Odm->bCckHighPower = - (bool) ODM_GetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter2, BIT(9)); + u32 val32; + + val32 = rtl8723au_read32(pDM_Odm->Adapter, rFPGA0_XA_HSSIParameter2); + if (val32 & BIT(9)) + pDM_Odm->bCckHighPower = true; + else + pDM_Odm->bCckHighPower = false; + pDM_Odm->RFPathRxEnable = - (u8) ODM_GetBBReg(pDM_Odm, rOFDM0_TRxPathEnable, 0x0F); + rtl8723au_read32(pDM_Odm->Adapter, rOFDM0_TRxPathEnable) & 0x0F; ODM_InitDebugSetting23a(pDM_Odm); } @@ -504,10 +509,11 @@ void odm_DIG23abyRSSI_LPS(struct dm_odm_t *pDM_Odm) void odm_DIG23aInit(struct dm_odm_t *pDM_Odm) { struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; + u32 val32; + + val32 = rtl8723au_read32(pDM_Odm->Adapter, ODM_REG_IGI_A_11N); + pDM_DigTable->CurIGValue = val32 & ODM_BIT_IGI_11N; - pDM_DigTable->CurIGValue = (u8) ODM_GetBBReg(pDM_Odm, - ODM_REG(IGI_A, pDM_Odm), - ODM_BIT(IGI, pDM_Odm)); pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW; pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; pDM_DigTable->FALowThresh = DM_FALSEALARM_THRESH_LOW; @@ -745,10 +751,10 @@ void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT(12), 1); ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT(14), 1); - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_LSB_11N, bMaskByte0); + ret_value = rtl8723au_read32(adapter, ODM_REG_CCK_FA_LSB_11N) & 0xff; FalseAlmCnt->Cnt_Cck_fail = ret_value; - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_MSB_11N, bMaskByte3); - FalseAlmCnt->Cnt_Cck_fail += (ret_value & 0xff) << 8; + ret_value = rtl8723au_read32(adapter, ODM_REG_CCK_FA_MSB_11N) >> 16; + FalseAlmCnt->Cnt_Cck_fail += (ret_value & 0xff00); ret_value = rtl8723au_read32(adapter, ODM_REG_CCK_CCA_CNT_11N); FalseAlmCnt->Cnt_CCK_CCA = diff --git a/drivers/staging/rtl8723au/hal/odm_interface.c b/drivers/staging/rtl8723au/hal/odm_interface.c index 5b57641d0c00..e005bfa38944 100644 --- a/drivers/staging/rtl8723au/hal/odm_interface.c +++ b/drivers/staging/rtl8723au/hal/odm_interface.c @@ -35,17 +35,6 @@ void ODM_SetBBReg( PHY_SetBBReg(Adapter, RegAddr, BitMask, Data); } -u32 ODM_GetBBReg( - struct dm_odm_t *pDM_Odm, - u32 RegAddr, - u32 BitMask - ) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - return PHY_QueryBBReg(Adapter, RegAddr, BitMask); -} - void ODM_SetRFReg( struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath, diff --git a/drivers/staging/rtl8723au/include/odm_interface.h b/drivers/staging/rtl8723au/include/odm_interface.h index 62a46c03e98b..b1d505dc9776 100644 --- a/drivers/staging/rtl8723au/include/odm_interface.h +++ b/drivers/staging/rtl8723au/include/odm_interface.h @@ -55,7 +55,6 @@ typedef void (*RT_WORKITEM_CALL_BACK)(struct work_struct *pContext); /* */ void ODM_SetBBReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask, u32 Data); -u32 ODM_GetBBReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask); void ODM_SetRFReg(struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath, u32 RegAddr, u32 BitMask, u32 Data); u32 ODM_GetRFReg(struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath, -- cgit v1.2.3 From 2635f19c7aeed25d90ac69958c249dd3fe2f787a Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:49 -0500 Subject: staging: rtl8723au: odm.c: Further reduce the use of ODM_SetBBReg() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 168 +++++++++++++++++++++++++----------- 1 file changed, 119 insertions(+), 49 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 20499d2b2945..7a01a8a7340a 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -441,15 +441,15 @@ void odm_CmnInfoUpdate_Debug23a(struct dm_odm_t *pDM_Odm) void ODM_Write_DIG23a(struct dm_odm_t *pDM_Odm, u8 CurrentIGI) { + struct rtw_adapter *adapter = pDM_Odm->Adapter; struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, - ("ODM_REG(IGI_A, pDM_Odm) = 0x%x, ODM_BIT(IGI, pDM_Odm) = 0x%x \n", - ODM_REG(IGI_A, pDM_Odm), ODM_BIT(IGI, pDM_Odm))); + u32 val32; if (pDM_DigTable->CurIGValue != CurrentIGI) { - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A, pDM_Odm), - ODM_BIT(IGI, pDM_Odm), CurrentIGI); + val32 = rtl8723au_read32(adapter, ODM_REG_IGI_A_11N); + val32 &= ~ODM_BIT_IGI_11N; + val32 |= CurrentIGI; + rtl8723au_write32(adapter, ODM_REG_IGI_A_11N, val32); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("CurrentIGI(0x%02x). \n", CurrentIGI)); pDM_DigTable->CurIGValue = CurrentIGI; @@ -722,13 +722,17 @@ void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) { struct rtw_adapter *adapter = pDM_Odm->Adapter; struct false_alarm_stats *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; - u32 ret_value; + u32 ret_value, val32; /* hold ofdm counter */ /* hold page C counter */ - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT(31), 1); + val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_HOLDC_11N); + val32 |= BIT(31); + rtl8723au_write32(adapter, ODM_REG_OFDM_FA_HOLDC_11N, val32); /* hold page D counter */ - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT(31), 1); + val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_RSTD_11N); + val32 |= BIT(31); + rtl8723au_write32(adapter, ODM_REG_OFDM_FA_RSTD_11N, val32); ret_value = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_TYPE1_11N); FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); FalseAlmCnt->Cnt_SB_Search_fail = (ret_value & 0xffff0000)>>16; @@ -748,8 +752,9 @@ void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) FalseAlmCnt->Cnt_Fast_Fsync + FalseAlmCnt->Cnt_SB_Search_fail; /* hold cck counter */ - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT(12), 1); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT(14), 1); + val32 = rtl8723au_read32(adapter, ODM_REG_CCK_FA_RST_11N); + val32 |= (BIT(12) | BIT(14)); + rtl8723au_write32(adapter, ODM_REG_CCK_FA_RST_11N, val32); ret_value = rtl8723au_read32(adapter, ODM_REG_CCK_FA_LSB_11N) & 0xff; FalseAlmCnt->Cnt_Cck_fail = ret_value; @@ -773,26 +778,39 @@ void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) if (pDM_Odm->SupportICType >= ODM_RTL8723A) { /* reset false alarm counter registers */ - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT(31), 1); - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT(31), 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT(27), 1); - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT(27), 0); + val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_RSTC_11N); + val32 |= BIT(31); + rtl8723au_write32(adapter, ODM_REG_OFDM_FA_RSTC_11N, val32); + val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_RSTC_11N); + val32 &= ~BIT(31); + rtl8723au_write32(adapter, ODM_REG_OFDM_FA_RSTC_11N, val32); + + val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_RSTD_11N); + val32 |= BIT(27); + rtl8723au_write32(adapter, ODM_REG_OFDM_FA_RSTD_11N, val32); + val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_RSTD_11N); + val32 &= ~BIT(27); + rtl8723au_write32(adapter, ODM_REG_OFDM_FA_RSTD_11N, val32); + /* update ofdm counter */ /* update page C counter */ - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT(31), 0); + val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_HOLDC_11N); + val32 &= ~BIT(31); + rtl8723au_write32(adapter, ODM_REG_OFDM_FA_HOLDC_11N, val32); + /* update page D counter */ - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT(31), 0); + val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_RSTD_11N); + val32 &= ~BIT(31); + rtl8723au_write32(adapter, ODM_REG_OFDM_FA_RSTD_11N, val32); /* reset CCK CCA counter */ - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, - BIT(13) | BIT(12), 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, - BIT(13) | BIT(12), 2); - /* reset CCK FA counter */ - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, - BIT(15) | BIT(14), 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, - BIT(15) | BIT(14), 2); + val32 = rtl8723au_read32(adapter, ODM_REG_CCK_FA_RST_11N); + val32 &= ~(BIT(12) | BIT(13) | BIT(14) | BIT(15)); + rtl8723au_write32(adapter, ODM_REG_CCK_FA_RST_11N, val32); + + val32 = rtl8723au_read32(adapter, ODM_REG_CCK_FA_RST_11N); + val32 |= (BIT(13) | BIT(15)); + rtl8723au_write32(adapter, ODM_REG_CCK_FA_RST_11N, val32); } ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, @@ -885,6 +903,7 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) { struct dynamic_pwr_sav *pDM_PSTable = &pDM_Odm->DM_PSTable; struct rtw_adapter *adapter = pDM_Odm->Adapter; + u32 val32; u8 Rssi_Up_bound = 30; u8 Rssi_Low_bound = 25; if (pDM_PSTable->initialize == 0) { @@ -926,22 +945,43 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) * Set 0x874[5]= 1 when enter BB power saving mode. */ /* Suggested by SD3 Yu-Nan. 2011.01.20. */ /* Reg874[5]= 1b'1 */ - if (pDM_Odm->SupportICType == ODM_RTL8723A) - ODM_SetBBReg(pDM_Odm, 0x874, BIT(5), 0x1); + if (pDM_Odm->SupportICType == ODM_RTL8723A) { + val32 = rtl8723au_read32(adapter, 0x874); + val32 |= BIT(5); + rtl8723au_write32(adapter, 0x874, val32); + } /* Reg874[20:18]= 3'b010 */ - ODM_SetBBReg(pDM_Odm, 0x874, 0x1C0000, 0x2); + val32 = rtl8723au_read32(adapter, 0x874); + val32 &= ~(BIT(18) | BIT(20)); + val32 |= BIT(19); + rtl8723au_write32(adapter, 0x874, val32); /* RegC70[3]= 1'b0 */ - ODM_SetBBReg(pDM_Odm, 0xc70, BIT(3), 0); + val32 = rtl8723au_read32(adapter, 0xc70); + val32 &= ~BIT(3); + rtl8723au_write32(adapter, 0xc70, val32); /* Reg85C[31:24]= 0x63 */ - ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, 0x63); + val32 = rtl8723au_read32(adapter, 0x85c); + val32 &= 0x00ffffff; + val32 |= 0x63000000; + rtl8723au_write32(adapter, 0x85c, val32); /* Reg874[15:14]= 2'b10 */ - ODM_SetBBReg(pDM_Odm, 0x874, 0xC000, 0x2); + val32 = rtl8723au_read32(adapter, 0x874); + val32 &= ~BIT(14); + val32 |= BIT(15); + rtl8723au_write32(adapter, 0x874, val32); /* RegA75[7:4]= 0x3 */ - ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, 0x3); + val32 = rtl8723au_read32(adapter, 0xa74); + val32 &= ~(BIT(14) | BIT(15)); + val32 |= (BIT(12) | BIT(13)); + rtl8723au_write32(adapter, 0xa74, val32); /* Reg818[28]= 1'b0 */ - ODM_SetBBReg(pDM_Odm, 0x818, BIT(28), 0x0); + val32 = rtl8723au_read32(adapter, 0x818); + val32 &= ~BIT(28); + rtl8723au_write32(adapter, 0x818, val32); /* Reg818[28]= 1'b1 */ - ODM_SetBBReg(pDM_Odm, 0x818, BIT(28), 0x1); + val32 = rtl8723au_read32(adapter, 0x818); + val32 |= BIT(28); + rtl8723au_write32(adapter, 0x818, val32); } else { ODM_SetBBReg(pDM_Odm, 0x874, 0x1CC000, pDM_PSTable->Reg874); @@ -951,11 +991,16 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) pDM_PSTable->Reg85C); ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, pDM_PSTable->RegA74); - ODM_SetBBReg(pDM_Odm, 0x818, BIT(28), 0x0); + val32 = rtl8723au_read32(adapter, 0x818); + val32 &= ~BIT(28); + rtl8723au_write32(adapter, 0x818, val32); /* Reg874[5]= 1b'0 */ - if (pDM_Odm->SupportICType == ODM_RTL8723A) - ODM_SetBBReg(pDM_Odm, 0x874, BIT(5), 0x0); + if (pDM_Odm->SupportICType == ODM_RTL8723A) { + val32 = rtl8723au_read32(adapter, 0x874); + val32 &= ~BIT(5); + rtl8723au_write32(adapter, 0x874, val32); + } } pDM_PSTable->PreRFState = pDM_PSTable->CurRFState; } @@ -1372,16 +1417,23 @@ u32 GetPSDData(struct dm_odm_t *pDM_Odm, unsigned int point, u8 initial_gain_psd) { struct rtw_adapter *adapter = pDM_Odm->Adapter; - u32 psd_report; + u32 psd_report, val32; /* Set DCO frequency index, offset = (40MHz/SamplePts)*point */ - ODM_SetBBReg(pDM_Odm, 0x808, 0x3FF, point); + val32 = rtl8723au_read32(adapter, 0x808); + val32 &= ~0x3ff; + val32 |= (point & 0x3ff); + rtl8723au_write32(adapter, 0x808, val32); /* Start PSD calculation, Reg808[22]= 0->1 */ - ODM_SetBBReg(pDM_Odm, 0x808, BIT(22), 1); + val32 = rtl8723au_read32(adapter, 0x808); + val32 |= BIT(22); + rtl8723au_write32(adapter, 0x808, val32); /* Need to wait for HW PSD report */ udelay(30); - ODM_SetBBReg(pDM_Odm, 0x808, BIT(22), 0); + val32 = rtl8723au_read32(adapter, 0x808); + val32 &= ~BIT(22); + rtl8723au_write32(adapter, 0x808, val32); /* Read PSD report, Reg8B4[15:0] */ psd_report = rtl8723au_read32(adapter, 0x8B4) & 0x0000FFFF; @@ -1462,7 +1514,7 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) struct rtw_adapter *adapter = pDM_Odm->Adapter; u32 CurrentChannel, RfLoopReg; u8 n; - u32 Reg88c, Regc08, Reg874, Regc50; + u32 Reg88c, Regc08, Reg874, Regc50, val32; u8 initial_gain = 0x5a; u32 PSD_report_tmp; u32 AntA_report = 0x0, AntB_report = 0x0, AntO_report = 0x0; @@ -1489,7 +1541,11 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) bRFRegOffsetMask); RfLoopReg = ODM_GetRFReg(pDM_Odm, RF_PATH_A, 0x00, bRFRegOffsetMask); /* change to Antenna A */ - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, ODM_DPDT, Antenna_A); + val32 = rtl8723au_read32(adapter, rFPGA0_XA_RFInterfaceOE); + val32 &= ~0x300; + val32 |= 0x100; /* Enable antenna A */ + rtl8723au_write32(adapter, rFPGA0_XA_RFInterfaceOE, val32); + /* Step 1: USE IQK to transmitter single tone */ udelay(10); @@ -1504,7 +1560,9 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) odm_PHY_SaveAFERegisters(pDM_Odm, AFE_REG_8723A, AFE_Backup, 16); /* Set PSD 128 pts */ - ODM_SetBBReg(pDM_Odm, rFPGA0_PSDFunction, BIT(14) | BIT(15), 0x0); + val32 = rtl8723au_read32(adapter, rFPGA0_PSDFunction); + val32 &= ~(BIT(14) | BIT(15)); + rtl8723au_write32(adapter, rFPGA0_PSDFunction, val32); /* To SET CH1 to do */ ODM_SetRFReg(pDM_Odm, RF_PATH_A, ODM_CHANNEL, bRFRegOffsetMask, 0x01); @@ -1564,7 +1622,10 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) PSD_report_tmp = 0x0; - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, Antenna_B); /* change to Antenna B */ + val32 = rtl8723au_read32(adapter, rFPGA0_XA_RFInterfaceOE); + val32 &= ~0x300; + val32 |= 0x200; /* Enable antenna B */ + rtl8723au_write32(adapter, rFPGA0_XA_RFInterfaceOE, val32); udelay(10); for (n = 0; n < 2; n++) { @@ -1575,7 +1636,9 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) /* change to open case */ /* change to Ant A and B all open case */ - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, 0); + val32 = rtl8723au_read32(adapter, rFPGA0_XA_RFInterfaceOE); + val32 &= ~0x300; + rtl8723au_write32(adapter, rFPGA0_XA_RFInterfaceOE, val32); udelay(10); for (n = 0; n < 2; n++) { @@ -1589,11 +1652,18 @@ bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode) PSD_report_tmp = 0x0; /* 1 Return to antanna A */ - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, Antenna_A); + val32 = rtl8723au_read32(adapter, rFPGA0_XA_RFInterfaceOE); + val32 &= ~0x300; + val32 |= 0x100; /* Enable antenna A */ + rtl8723au_write32(adapter, rFPGA0_XA_RFInterfaceOE, val32); rtl8723au_write32(adapter, rFPGA0_AnalogParameter4, Reg88c); rtl8723au_write32(adapter, rOFDM0_TRMuxPar, Regc08); rtl8723au_write32(adapter, rFPGA0_XCD_RFInterfaceSW, Reg874); - ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, 0x7F, 0x40); + val32 = rtl8723au_read32(adapter, rOFDM0_XAAGCCore1); + val32 &= ~0x7f; + val32 |= 0x40; + rtl8723au_write32(adapter, rOFDM0_XAAGCCore1, val32); + rtl8723au_write32(adapter, rOFDM0_XAAGCCore1, Regc50); ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, CurrentChannel); -- cgit v1.2.3 From 6725e52d22a4d99ea752fa0d0422a3a544545b03 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Thu, 5 Mar 2015 14:24:50 -0500 Subject: staging: rtl8723au: Eliminate ODM_SetBBReg() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 33 ++++++++++++++--------- drivers/staging/rtl8723au/hal/odm_interface.c | 12 --------- drivers/staging/rtl8723au/include/odm_interface.h | 1 - 3 files changed, 20 insertions(+), 26 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 7a01a8a7340a..428b2b308f27 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -909,13 +909,12 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) if (pDM_PSTable->initialize == 0) { pDM_PSTable->Reg874 = - (rtl8723au_read32(adapter, 0x874) & 0x1CC000) >> 14; + rtl8723au_read32(adapter, 0x874) & 0x1CC000; pDM_PSTable->RegC70 = - (rtl8723au_read32(adapter, 0xc70) & BIT(3)) >>3; + rtl8723au_read32(adapter, 0xc70) & BIT(3); pDM_PSTable->Reg85C = - (rtl8723au_read32(adapter, 0x85c) & 0xFF000000) >> 24; - pDM_PSTable->RegA74 = - (rtl8723au_read32(adapter, 0xa74) & 0xF000) >> 12; + rtl8723au_read32(adapter, 0x85c) & 0xFF000000; + pDM_PSTable->RegA74 = rtl8723au_read32(adapter, 0xa74) & 0xF000; pDM_PSTable->initialize = 1; } @@ -983,14 +982,22 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) val32 |= BIT(28); rtl8723au_write32(adapter, 0x818, val32); } else { - ODM_SetBBReg(pDM_Odm, 0x874, 0x1CC000, - pDM_PSTable->Reg874); - ODM_SetBBReg(pDM_Odm, 0xc70, BIT(3), - pDM_PSTable->RegC70); - ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, - pDM_PSTable->Reg85C); - ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, - pDM_PSTable->RegA74); + val32 = rtl8723au_read32(adapter, 0x874); + val32 |= pDM_PSTable->Reg874; + rtl8723au_write32(adapter, 0x874, val32); + + val32 = rtl8723au_read32(adapter, 0xc70); + val32 |= pDM_PSTable->RegC70; + rtl8723au_write32(adapter, 0xc70, val32); + + val32 = rtl8723au_read32(adapter, 0x85c); + val32 |= pDM_PSTable->Reg85C; + rtl8723au_write32(adapter, 0x85c, val32); + + val32 = rtl8723au_read32(adapter, 0xa74); + val32 |= pDM_PSTable->RegA74; + rtl8723au_write32(adapter, 0xa74, val32); + val32 = rtl8723au_read32(adapter, 0x818); val32 &= ~BIT(28); rtl8723au_write32(adapter, 0x818, val32); diff --git a/drivers/staging/rtl8723au/hal/odm_interface.c b/drivers/staging/rtl8723au/hal/odm_interface.c index e005bfa38944..d8f67902708e 100644 --- a/drivers/staging/rtl8723au/hal/odm_interface.c +++ b/drivers/staging/rtl8723au/hal/odm_interface.c @@ -23,18 +23,6 @@ /* */ #include -void ODM_SetBBReg( - struct dm_odm_t *pDM_Odm, - u32 RegAddr, - u32 BitMask, - u32 Data - ) -{ - struct rtw_adapter *Adapter = pDM_Odm->Adapter; - - PHY_SetBBReg(Adapter, RegAddr, BitMask, Data); -} - void ODM_SetRFReg( struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath, diff --git a/drivers/staging/rtl8723au/include/odm_interface.h b/drivers/staging/rtl8723au/include/odm_interface.h index b1d505dc9776..1d3bf03b59ea 100644 --- a/drivers/staging/rtl8723au/include/odm_interface.h +++ b/drivers/staging/rtl8723au/include/odm_interface.h @@ -54,7 +54,6 @@ typedef void (*RT_WORKITEM_CALL_BACK)(struct work_struct *pContext); /* =========== EXtern Function Prototype */ /* */ -void ODM_SetBBReg(struct dm_odm_t *pDM_Odm, u32 RegAddr, u32 BitMask, u32 Data); void ODM_SetRFReg(struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath, u32 RegAddr, u32 BitMask, u32 Data); u32 ODM_GetRFReg(struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath, -- cgit v1.2.3 From de904bf0e4610a7651f3eb0c8b7b63e2ae32b805 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Wed, 4 Mar 2015 11:31:01 +0100 Subject: staging: rts5208: Convert non-returned local variable to boolean when relevant This patch was produced using Coccinelle. A simplified version of the semantic patch is: @r exists@ identifier f; local idexpression u8 x; identifier xname; @@ f(...) { ...when any ( x@xname = 1; | x@xname = 0; ) ...when any } @bad exists@ identifier r.f; local idexpression u8 r.x expression e1 != {0, 1}, e2; @@ f(...) { ...when any ( x = e1; | x + e2 ) ...when any } @depends on !bad@ identifier r.f; local idexpression u8 r.x; identifier r.xname; @@ f(...) { ... ++ bool xname; - int xname; <... ( x = - 1 + true | x = - -1 + false ) ...> } Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/ms.c | 14 +++--- drivers/staging/rts5208/rtsx_chip.c | 56 ++++++++++++----------- drivers/staging/rts5208/rtsx_scsi.c | 38 +++++++++------- drivers/staging/rts5208/sd.c | 88 +++++++++++++++++++------------------ 4 files changed, 105 insertions(+), 91 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c index a47a19135d49..050bc4709c36 100644 --- a/drivers/staging/rts5208/ms.c +++ b/drivers/staging/rts5208/ms.c @@ -1560,7 +1560,8 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, u16 log_blk, u8 start_page, u8 end_page) { struct ms_info *ms_card = &(chip->ms_card); - int retval, rty_cnt, uncorrect_flag = 0; + bool uncorrect_flag = false; + int retval, rty_cnt; u8 extra[MS_EXTRA_SIZE], val, i, j, data[16]; dev_dbg(rtsx_dev(chip), "Copy page from 0x%x to 0x%x, logical block is 0x%x\n", @@ -1642,10 +1643,10 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, if (val & INT_REG_ERR) { retval = ms_read_status_reg(chip); if (retval != STATUS_SUCCESS) { - uncorrect_flag = 1; + uncorrect_flag = true; dev_dbg(rtsx_dev(chip), "Uncorrectable error\n"); } else { - uncorrect_flag = 0; + uncorrect_flag = false; } retval = ms_transfer_tpc(chip, @@ -2187,7 +2188,8 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) { struct ms_info *ms_card = &(chip->ms_card); struct zone_entry *segment; - int retval, table_size, disable_cnt, defect_flag, i; + bool defect_flag; + int retval, table_size, disable_cnt, i; u16 start, end, phy_blk, log_blk, tmp_blk; u8 extra[MS_EXTRA_SIZE], us1, us2; @@ -2236,10 +2238,10 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) for (phy_blk = start; phy_blk < end; phy_blk++) { if (disable_cnt) { - defect_flag = 0; + defect_flag = false; for (i = 0; i < segment->disable_count; i++) { if (phy_blk == segment->defect_list[i]) { - defect_flag = 1; + defect_flag = true; break; } } diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c index 9593d8132938..35fa19d8b7a2 100644 --- a/drivers/staging/rts5208/rtsx_chip.c +++ b/drivers/staging/rts5208/rtsx_chip.c @@ -153,22 +153,22 @@ static int rtsx_pre_handle_sdio_old(struct rtsx_chip *chip) static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip) { u8 tmp; - int sw_bypass_sd = 0; + bool sw_bypass_sd = false; int retval; if (chip->driver_first_load) { if (CHECK_PID(chip, 0x5288)) { RTSX_READ_REG(chip, 0xFE5A, &tmp); if (tmp & 0x08) - sw_bypass_sd = 1; + sw_bypass_sd = true; } else if (CHECK_PID(chip, 0x5208)) { RTSX_READ_REG(chip, 0xFE70, &tmp); if (tmp & 0x80) - sw_bypass_sd = 1; + sw_bypass_sd = true; } } else { if (chip->sdio_in_charge) - sw_bypass_sd = 1; + sw_bypass_sd = true; } dev_dbg(rtsx_dev(chip), "chip->sdio_in_charge = %d\n", chip->sdio_in_charge); @@ -501,13 +501,14 @@ nextcard: static inline int check_sd_speed_prior(u32 sd_speed_prior) { - int i, fake_para = 0; + bool fake_para = false; + int i; for (i = 0; i < 4; i++) { u8 tmp = (u8)(sd_speed_prior >> (i*8)); if ((tmp < 0x01) || (tmp > 0x04)) { - fake_para = 1; + fake_para = true; break; } } @@ -517,13 +518,14 @@ static inline int check_sd_speed_prior(u32 sd_speed_prior) static inline int check_sd_current_prior(u32 sd_current_prior) { - int i, fake_para = 0; + bool fake_para = false; + int i; for (i = 0; i < 4; i++) { u8 tmp = (u8)(sd_current_prior >> (i*8)); if (tmp > 0x03) { - fake_para = 1; + fake_para = true; break; } } @@ -784,31 +786,31 @@ static inline void rtsx_blink_led(struct rtsx_chip *chip) static void rtsx_monitor_aspm_config(struct rtsx_chip *chip) { - int maybe_support_aspm, reg_changed; + bool reg_changed, maybe_support_aspm; u32 tmp = 0; u8 reg0 = 0, reg1 = 0; - maybe_support_aspm = 0; - reg_changed = 0; + maybe_support_aspm = false; + reg_changed = false; rtsx_read_config_byte(chip, LCTLR, ®0); if (chip->aspm_level[0] != reg0) { - reg_changed = 1; + reg_changed = true; chip->aspm_level[0] = reg0; } if (CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip)) { rtsx_read_cfg_dw(chip, 1, 0xC0, &tmp); reg1 = (u8)tmp; if (chip->aspm_level[1] != reg1) { - reg_changed = 1; + reg_changed = true; chip->aspm_level[1] = reg1; } if ((reg0 & 0x03) && (reg1 & 0x03)) - maybe_support_aspm = 1; + maybe_support_aspm = true; } else { if (reg0 & 0x03) - maybe_support_aspm = 1; + maybe_support_aspm = true; } if (reg_changed) { @@ -835,7 +837,7 @@ void rtsx_polling_func(struct rtsx_chip *chip) #ifdef SUPPORT_SD_LOCK struct sd_info *sd_card = &chip->sd_card; #endif - int ss_allowed; + bool ss_allowed; if (rtsx_chk_stat(chip, RTSX_STAT_SUSPEND)) return; @@ -887,21 +889,21 @@ void rtsx_polling_func(struct rtsx_chip *chip) rtsx_init_cards(chip); if (chip->ss_en) { - ss_allowed = 1; + ss_allowed = true; if (CHECK_PID(chip, 0x5288)) { - ss_allowed = 0; + ss_allowed = false; } else { if (CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip)) { u32 val; rtsx_read_cfg_dw(chip, 1, 0x04, &val); if (val & 0x07) - ss_allowed = 0; + ss_allowed = false; } } } else { - ss_allowed = 0; + ss_allowed = false; } if (ss_allowed && !chip->sd_io) { @@ -1358,7 +1360,8 @@ int rtsx_read_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, int rtsx_write_phy_register(struct rtsx_chip *chip, u8 addr, u16 val) { - int i, finished = 0; + bool finished = false; + int i; u8 tmp; RTSX_WRITE_REG(chip, PHYDATA0, 0xFF, (u8)val); @@ -1369,7 +1372,7 @@ int rtsx_write_phy_register(struct rtsx_chip *chip, u8 addr, u16 val) for (i = 0; i < 100000; i++) { RTSX_READ_REG(chip, PHYRWCTL, &tmp); if (!(tmp & 0x80)) { - finished = 1; + finished = true; break; } } @@ -1382,7 +1385,8 @@ int rtsx_write_phy_register(struct rtsx_chip *chip, u8 addr, u16 val) int rtsx_read_phy_register(struct rtsx_chip *chip, u8 addr, u16 *val) { - int i, finished = 0; + bool finished = false; + int i; u16 data = 0; u8 tmp; @@ -1392,7 +1396,7 @@ int rtsx_read_phy_register(struct rtsx_chip *chip, u8 addr, u16 *val) for (i = 0; i < 100000; i++) { RTSX_READ_REG(chip, PHYRWCTL, &tmp); if (!(tmp & 0x80)) { - finished = 1; + finished = true; break; } } @@ -1615,7 +1619,7 @@ void rtsx_exit_ss(struct rtsx_chip *chip) int rtsx_pre_handle_interrupt(struct rtsx_chip *chip) { u32 status, int_enable; - int exit_ss = 0; + bool exit_ss = false; #ifdef SUPPORT_OCP u32 ocp_int = 0; @@ -1625,7 +1629,7 @@ int rtsx_pre_handle_interrupt(struct rtsx_chip *chip) if (chip->ss_en) { chip->ss_counter = 0; if (rtsx_get_stat(chip) == RTSX_STAT_SS) { - exit_ss = 1; + exit_ss = true; rtsx_exit_L1(chip); rtsx_set_stat(chip, RTSX_STAT_RUN); } diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c index 426458345534..a00ba217ebae 100644 --- a/drivers/staging/rts5208/rtsx_scsi.c +++ b/drivers/staging/rts5208/rtsx_scsi.c @@ -39,7 +39,8 @@ void scsi_show_command(struct rtsx_chip *chip) { struct scsi_cmnd *srb = chip->srb; char *what = NULL; - int unknown_cmd = 0, len; + bool unknown_cmd = false; + int len; switch (srb->cmnd[0]) { case TEST_UNIT_READY: @@ -310,7 +311,8 @@ void scsi_show_command(struct rtsx_chip *chip) what = "Realtek's vendor command"; break; default: - what = "(unknown command)"; unknown_cmd = 1; + what = "(unknown command)"; + unknown_cmd = true; break; } @@ -485,7 +487,7 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip *chip) unsigned char sendbytes; unsigned char *buf; u8 card = get_lun_card(chip, lun); - int pro_formatter_flag = 0; + bool pro_formatter_flag = false; unsigned char inquiry_buf[] = { QULIFIRE|DRCT_ACCESS_DEV, RMB_DISC|0x0D, @@ -520,7 +522,7 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (chip->mspro_formatter_enable) #endif if (!card || (card == MS_CARD)) - pro_formatter_flag = 1; + pro_formatter_flag = true; if (pro_formatter_flag) { if (scsi_bufflen(srb) < 56) @@ -663,7 +665,7 @@ static void ms_mode_sense(struct rtsx_chip *chip, u8 cmd, struct ms_info *ms_card = &(chip->ms_card); int sys_info_offset; int data_size = buf_len; - int support_format = 0; + bool support_format = false; int i = 0; if (cmd == MODE_SENSE) { @@ -684,10 +686,10 @@ static void ms_mode_sense(struct rtsx_chip *chip, u8 cmd, /* Medium Type Code */ if (check_card_ready(chip, lun)) { if (CHK_MSXC(ms_card)) { - support_format = 1; + support_format = true; buf[i++] = 0x40; } else if (CHK_MSPRO(ms_card)) { - support_format = 1; + support_format = true; buf[i++] = 0x20; } else { buf[i++] = 0x10; @@ -755,7 +757,7 @@ static int mode_sense(struct scsi_cmnd *srb, struct rtsx_chip *chip) unsigned int lun = SCSI_LUN(srb); unsigned int dataSize; int status; - int pro_formatter_flag; + bool pro_formatter_flag; unsigned char pageCode, *buf; u8 card = get_lun_card(chip, lun); @@ -767,20 +769,20 @@ static int mode_sense(struct scsi_cmnd *srb, struct rtsx_chip *chip) } #endif - pro_formatter_flag = 0; + pro_formatter_flag = false; dataSize = 8; #ifdef SUPPORT_MAGIC_GATE if ((chip->lun2card[lun] & MS_CARD)) { if (!card || (card == MS_CARD)) { dataSize = 108; if (chip->mspro_formatter_enable) - pro_formatter_flag = 1; + pro_formatter_flag = true; } } #else if (card == MS_CARD) { if (chip->mspro_formatter_enable) { - pro_formatter_flag = 1; + pro_formatter_flag = true; dataSize = 108; } } @@ -2295,7 +2297,8 @@ Exit: static int read_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) { int retval; - u8 func, func_max; + bool func_max; + u8 func; u16 addr, len; u8 *buf; @@ -2315,9 +2318,9 @@ static int read_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) __func__, func, addr, len); if (CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip)) - func_max = 1; + func_max = true; else - func_max = 0; + func_max = false; if (func > func_max) { set_sense_type(chip, SCSI_LUN(srb), @@ -2349,7 +2352,8 @@ static int read_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) static int write_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) { int retval; - u8 func, func_max; + bool func_max; + u8 func; u16 addr, len; u8 *buf; @@ -2369,9 +2373,9 @@ static int write_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) __func__, func, addr); if (CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip)) - func_max = 1; + func_max = true; else - func_max = 0; + func_max = false; if (func > func_max) { set_sense_type(chip, SCSI_LUN(srb), diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index c28a92773f05..62bf570d59d4 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -791,7 +791,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) u16 SD_VP_CTL, SD_DCMPS_CTL; u8 val; int retval; - int ddr_rx = 0; + bool ddr_rx = false; dev_dbg(rtsx_dev(chip), "sd_change_phase (sample_point = %d, tune_dir = %d)\n", sample_point, tune_dir); @@ -800,7 +800,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) SD_VP_CTL = SD_VPRX_CTL; SD_DCMPS_CTL = SD_DCMPS_RX_CTL; if (CHK_SD_DDR50(sd_card)) - ddr_rx = 1; + ddr_rx = true; } else { SD_VP_CTL = SD_VPTX_CTL; SD_DCMPS_CTL = SD_DCMPS_TX_CTL; @@ -1121,7 +1121,7 @@ static int sd_check_switch(struct rtsx_chip *chip, { int retval; int i; - int switch_good = 0; + bool switch_good = false; for (i = 0; i < 3; i++) { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { @@ -1137,7 +1137,7 @@ static int sd_check_switch(struct rtsx_chip *chip, retval = sd_check_switch_mode(chip, SD_SWITCH_MODE, func_group, func_to_switch, bus_width); if (retval == STATUS_SUCCESS) { - switch_good = 1; + switch_good = true; break; } @@ -1524,7 +1524,8 @@ static u8 sd_search_final_phase(struct rtsx_chip *chip, u32 phase_map, struct sd_info *sd_card = &(chip->sd_card); struct timing_phase_path path[MAX_PHASE + 1]; int i, j, cont_path_cnt; - int new_block, max_len, final_path_idx; + bool new_block; + int max_len, final_path_idx; u8 final_phase = 0xFF; if (phase_map == 0xFFFFFFFF) { @@ -1537,12 +1538,12 @@ static u8 sd_search_final_phase(struct rtsx_chip *chip, u32 phase_map, } cont_path_cnt = 0; - new_block = 1; + new_block = true; j = 0; for (i = 0; i < MAX_PHASE + 1; i++) { if (phase_map & (1 << i)) { if (new_block) { - new_block = 0; + new_block = false; j = cont_path_cnt++; path[j].start = i; path[j].end = i; @@ -1550,7 +1551,7 @@ static u8 sd_search_final_phase(struct rtsx_chip *chip, u32 phase_map, path[j].end = i; } } else { - new_block = 1; + new_block = true; if (cont_path_cnt) { int idx = cont_path_cnt - 1; @@ -2141,14 +2142,15 @@ static int sd_check_wp_state(struct rtsx_chip *chip) static int reset_sd(struct rtsx_chip *chip) { struct sd_info *sd_card = &(chip->sd_card); - int retval, i = 0, j = 0, k = 0, hi_cap_flow = 0; - int sd_dont_switch = 0; - int support_1v8 = 0; - int try_sdio = 1; + bool hi_cap_flow = false; + int retval, i = 0, j = 0, k = 0; + bool sd_dont_switch = false; + bool support_1v8 = false; + bool try_sdio = true; u8 rsp[16]; u8 switch_bus_width; u32 voltage = 0; - int sd20_mode = 0; + bool sd20_mode = false; SET_SD(sd_card); @@ -2157,7 +2159,7 @@ Switch_Fail: i = 0; j = 0; k = 0; - hi_cap_flow = 0; + hi_cap_flow = false; #ifdef SUPPORT_SD_LOCK if (sd_card->sd_lock_status & SD_UNLOCK_POW_ON) @@ -2217,7 +2219,7 @@ RTY_SD_RST: SD_RSP_TYPE_R7, rsp, 5); if (retval == STATUS_SUCCESS) { if ((rsp[4] == 0xAA) && ((rsp[3] & 0x0f) == 0x01)) { - hi_cap_flow = 1; + hi_cap_flow = true; voltage = SUPPORT_VOLTAGE | 0x40000000; } } @@ -2272,10 +2274,10 @@ RTY_SD_RST: else CLR_SD_HCXC(sd_card); - support_1v8 = 0; + support_1v8 = false; } else { CLR_SD_HCXC(sd_card); - support_1v8 = 0; + support_1v8 = false; } dev_dbg(rtsx_dev(chip), "support_1v8 = %d\n", support_1v8); @@ -2361,7 +2363,7 @@ SD_UNLOCK_ENTRY: TRACE_RET(chip, STATUS_FAIL); if (!(sd_card->raw_csd[4] & 0x40)) - sd_dont_switch = 1; + sd_dont_switch = true; if (!sd_dont_switch) { if (sd20_mode) { @@ -2378,16 +2380,16 @@ SD_UNLOCK_ENTRY: retval = sd_switch_function(chip, switch_bus_width); if (retval != STATUS_SUCCESS) { sd_init_power(chip); - sd_dont_switch = 1; - try_sdio = 0; + sd_dont_switch = true; + try_sdio = false; goto Switch_Fail; } } else { if (support_1v8) { sd_init_power(chip); - sd_dont_switch = 1; - try_sdio = 0; + sd_dont_switch = true; + try_sdio = false; goto Switch_Fail; } @@ -2433,8 +2435,8 @@ SD_UNLOCK_ENTRY: if (retval != STATUS_SUCCESS) TRACE_RET(chip, STATUS_FAIL); - try_sdio = 0; - sd20_mode = 1; + try_sdio = false; + sd20_mode = true; goto Switch_Fail; } } @@ -2458,8 +2460,8 @@ SD_UNLOCK_ENTRY: if (retval != STATUS_SUCCESS) TRACE_RET(chip, STATUS_FAIL); - try_sdio = 0; - sd20_mode = 1; + try_sdio = false; + sd20_mode = true; goto Switch_Fail; } } @@ -3702,7 +3704,7 @@ int sd_execute_no_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) unsigned int lun = SCSI_LUN(srb); int retval, rsp_len; u8 cmd_idx, rsp_type; - u8 standby = 0, acmd = 0; + bool standby = false, acmd = false; u32 arg; if (!sd_card->sd_pass_thru_en) { @@ -3722,10 +3724,10 @@ int sd_execute_no_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) cmd_idx = srb->cmnd[2] & 0x3F; if (srb->cmnd[1] & 0x02) - standby = 1; + standby = true; if (srb->cmnd[1] & 0x01) - acmd = 1; + acmd = true; arg = ((u32)srb->cmnd[3] << 24) | ((u32)srb->cmnd[4] << 16) | ((u32)srb->cmnd[5] << 8) | srb->cmnd[6]; @@ -3812,9 +3814,10 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) struct sd_info *sd_card = &(chip->sd_card); unsigned int lun = SCSI_LUN(srb); int retval, rsp_len, i; - int cmd13_checkbit = 0, read_err = 0; + int cmd13_checkbit = 0; + bool read_err = false; u8 cmd_idx, rsp_type, bus_width; - u8 send_cmd12 = 0, standby = 0, acmd = 0; + bool standby = false, send_cmd12 = false, acmd = false; u32 data_len; if (!sd_card->sd_pass_thru_en) { @@ -3834,13 +3837,13 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) cmd_idx = srb->cmnd[2] & 0x3F; if (srb->cmnd[1] & 0x04) - send_cmd12 = 1; + send_cmd12 = true; if (srb->cmnd[1] & 0x02) - standby = 1; + standby = true; if (srb->cmnd[1] & 0x01) - acmd = 1; + acmd = true; data_len = ((u32)srb->cmnd[7] << 16) | ((u32)srb->cmnd[8] << 8) | srb->cmnd[9]; @@ -3915,7 +3918,7 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = sd_read_data(chip, SD_TM_NORMAL_READ, cmd, 5, byte_cnt, blk_cnt, bus_width, buf, data_len, 2000); if (retval != STATUS_SUCCESS) { - read_err = 1; + read_err = true; kfree(buf); rtsx_clear_sd_error(chip); TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); @@ -3964,7 +3967,7 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) scsi_bufflen(srb), scsi_sg_count(srb), DMA_FROM_DEVICE, 10000); if (retval < 0) { - read_err = 1; + read_err = true; rtsx_clear_sd_error(chip); TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); } @@ -4041,9 +4044,10 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) struct sd_info *sd_card = &(chip->sd_card); unsigned int lun = SCSI_LUN(srb); int retval, rsp_len, i; - int cmd13_checkbit = 0, write_err = 0; + int cmd13_checkbit = 0; + bool write_err = false; u8 cmd_idx, rsp_type; - u8 send_cmd12 = 0, standby = 0, acmd = 0; + bool standby = false, send_cmd12 = false, acmd = false; u32 data_len, arg; #ifdef SUPPORT_SD_LOCK int lock_cmd_fail = 0; @@ -4068,13 +4072,13 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) cmd_idx = srb->cmnd[2] & 0x3F; if (srb->cmnd[1] & 0x04) - send_cmd12 = 1; + send_cmd12 = true; if (srb->cmnd[1] & 0x02) - standby = 1; + standby = true; if (srb->cmnd[1] & 0x01) - acmd = 1; + acmd = true; data_len = ((u32)srb->cmnd[7] << 16) | ((u32)srb->cmnd[8] << 8) | srb->cmnd[9]; @@ -4247,7 +4251,7 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) } if (retval < 0) { - write_err = 1; + write_err = true; rtsx_clear_sd_error(chip); TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); } -- cgit v1.2.3 From 11201769d17ffe4b826035315aa03715938ae4b2 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Wed, 4 Mar 2015 11:31:53 +0100 Subject: staging: rts5208: Convert variable from int to bool and propagate the change to function parameters This patch convert local variables declared as int into booleans. It also propagates the conversion when these variables were used as function parameters. Coccinelle was used to generate this patch. Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/ms.c | 9 ++++---- drivers/staging/rts5208/ms.h | 2 +- drivers/staging/rts5208/rtsx_scsi.c | 7 +++--- drivers/staging/rts5208/sd.c | 44 ++++++++++++++++++------------------- drivers/staging/rts5208/sd.h | 2 +- 5 files changed, 32 insertions(+), 32 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c index 050bc4709c36..7638f802a878 100644 --- a/drivers/staging/rts5208/ms.c +++ b/drivers/staging/rts5208/ms.c @@ -107,7 +107,7 @@ static int ms_transfer_tpc(struct rtsx_chip *chip, u8 trans_mode, } static int ms_transfer_data(struct rtsx_chip *chip, u8 trans_mode, - u8 tpc, u16 sec_cnt, u8 cfg, int mode_2k, + u8 tpc, u16 sec_cnt, u8 cfg, bool mode_2k, int use_sg, void *buf, int buf_len) { int retval; @@ -2524,7 +2524,8 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb, u16 sector_cnt) { struct ms_info *ms_card = &(chip->ms_card); - int retval, mode_2k = 0; + bool mode_2k = false; + int retval; u16 count; u8 val, trans_mode, rw_tpc, rw_cmd; @@ -2549,7 +2550,7 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb, rw_tpc = PRO_WRITE_QUAD_DATA; rw_cmd = PRO_WRITE_2K_DATA; } - mode_2k = 1; + mode_2k = true; } } else { if (srb->sc_data_direction == DMA_FROM_DEVICE) { @@ -2782,7 +2783,7 @@ void mspro_polling_format_status(struct rtsx_chip *chip) } int mspro_format(struct scsi_cmnd *srb, struct rtsx_chip *chip, - int short_data_len, int quick_format) + int short_data_len, bool quick_format) { struct ms_info *ms_card = &(chip->ms_card); int retval, i; diff --git a/drivers/staging/rts5208/ms.h b/drivers/staging/rts5208/ms.h index 26c5b03d535e..d919170f2720 100644 --- a/drivers/staging/rts5208/ms.h +++ b/drivers/staging/rts5208/ms.h @@ -205,7 +205,7 @@ int reset_ms_card(struct rtsx_chip *chip); int ms_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 start_sector, u16 sector_cnt); int mspro_format(struct scsi_cmnd *srb, struct rtsx_chip *chip, - int short_data_len, int quick_format); + int short_data_len, bool quick_format); void ms_free_l2p_tbl(struct rtsx_chip *chip); void ms_cleanup_work(struct rtsx_chip *chip); int ms_power_off_card3v3(struct rtsx_chip *chip); diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c index a00ba217ebae..98f102b78e6d 100644 --- a/drivers/staging/rts5208/rtsx_scsi.c +++ b/drivers/staging/rts5208/rtsx_scsi.c @@ -2799,7 +2799,8 @@ static int ms_format_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip) { struct ms_info *ms_card = &(chip->ms_card); unsigned int lun = SCSI_LUN(srb); - int retval, quick_format; + bool quick_format; + int retval; if (get_lun_card(chip, lun) != MS_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT); @@ -2828,9 +2829,9 @@ static int ms_format_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip) rtsx_set_stat(chip, RTSX_STAT_RUN); if (srb->cmnd[8] & 0x01) - quick_format = 0; + quick_format = false; else - quick_format = 1; + quick_format = true; if (!(chip->card_ready & MS_CARD)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index 62bf570d59d4..a03cbe93722a 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -2606,7 +2606,7 @@ static int mmc_test_switch_bus(struct rtsx_chip *chip, u8 width) } -static int mmc_switch_timing_bus(struct rtsx_chip *chip, int switch_ddr) +static int mmc_switch_timing_bus(struct rtsx_chip *chip, bool switch_ddr) { struct sd_info *sd_card = &(chip->sd_card); int retval; @@ -2729,7 +2729,7 @@ static int reset_mmc(struct rtsx_chip *chip) { struct sd_info *sd_card = &(chip->sd_card); int retval, i = 0, j = 0, k = 0; - int switch_ddr = 1; + bool switch_ddr = true; u8 rsp[16]; u8 spec_ver = 0; u32 temp; @@ -2860,7 +2860,7 @@ MMC_UNLOCK_ENTRY: if (retval != STATUS_SUCCESS) TRACE_RET(chip, STATUS_FAIL); - switch_ddr = 0; + switch_ddr = false; TRACE_GOTO(chip, Switch_Fail); } @@ -2872,7 +2872,7 @@ MMC_UNLOCK_ENTRY: if (retval != STATUS_SUCCESS) TRACE_RET(chip, STATUS_FAIL); - switch_ddr = 0; + switch_ddr = false; TRACE_GOTO(chip, Switch_Fail); } } @@ -3419,7 +3419,7 @@ int soft_reset_sd_card(struct rtsx_chip *chip) } int ext_sd_send_cmd_get_rsp(struct rtsx_chip *chip, u8 cmd_idx, - u32 arg, u8 rsp_type, u8 *rsp, int rsp_len, int special_check) + u32 arg, u8 rsp_type, u8 *rsp, int rsp_len, bool special_check) { int retval; int timeout = 100; @@ -3513,7 +3513,7 @@ RTY_SEND_CMD: if ((cmd_idx == SELECT_CARD) || (cmd_idx == APP_CMD) || (cmd_idx == SEND_STATUS) || (cmd_idx == STOP_TRANSMISSION)) { - if ((cmd_idx != STOP_TRANSMISSION) && (special_check == 0)) { + if ((cmd_idx != STOP_TRANSMISSION) && !special_check) { if (ptr[1] & 0x80) TRACE_RET(chip, STATUS_FAIL); } @@ -3773,13 +3773,13 @@ int sd_execute_no_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (acmd) { retval = ext_sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, - SD_RSP_TYPE_R1, NULL, 0, 0); + SD_RSP_TYPE_R1, NULL, 0, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Cmd_Failed); } retval = ext_sd_send_cmd_get_rsp(chip, cmd_idx, arg, rsp_type, - sd_card->rsp, rsp_len, 0); + sd_card->rsp, rsp_len, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Cmd_Failed); @@ -3814,8 +3814,7 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) struct sd_info *sd_card = &(chip->sd_card); unsigned int lun = SCSI_LUN(srb); int retval, rsp_len, i; - int cmd13_checkbit = 0; - bool read_err = false; + bool read_err = false, cmd13_checkbit = false; u8 cmd_idx, rsp_type, bus_width; bool standby = false, send_cmd12 = false, acmd = false; u32 data_len; @@ -3877,7 +3876,7 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (data_len < 512) { retval = ext_sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, data_len, - SD_RSP_TYPE_R1, NULL, 0, 0); + SD_RSP_TYPE_R1, NULL, 0, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); } @@ -3891,7 +3890,7 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (acmd) { retval = ext_sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, - SD_RSP_TYPE_R1, NULL, 0, 0); + SD_RSP_TYPE_R1, NULL, 0, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); } @@ -3988,14 +3987,14 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (send_cmd12) { retval = ext_sd_send_cmd_get_rsp(chip, STOP_TRANSMISSION, - 0, SD_RSP_TYPE_R1b, NULL, 0, 0); + 0, SD_RSP_TYPE_R1b, NULL, 0, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); } if (data_len < 512) { retval = ext_sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, - SD_RSP_TYPE_R1, NULL, 0, 0); + SD_RSP_TYPE_R1, NULL, 0, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); @@ -4009,7 +4008,7 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) } if ((srb->cmnd[1] & 0x02) || (srb->cmnd[1] & 0x04)) - cmd13_checkbit = 1; + cmd13_checkbit = true; for (i = 0; i < 3; i++) { retval = ext_sd_send_cmd_get_rsp(chip, SEND_STATUS, @@ -4044,8 +4043,7 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) struct sd_info *sd_card = &(chip->sd_card); unsigned int lun = SCSI_LUN(srb); int retval, rsp_len, i; - int cmd13_checkbit = 0; - bool write_err = false; + bool write_err = false, cmd13_checkbit = false; u8 cmd_idx, rsp_type; bool standby = false, send_cmd12 = false, acmd = false; u32 data_len, arg; @@ -4126,7 +4124,7 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (data_len < 512) { retval = ext_sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, data_len, - SD_RSP_TYPE_R1, NULL, 0, 0); + SD_RSP_TYPE_R1, NULL, 0, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); } @@ -4140,13 +4138,13 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (acmd) { retval = ext_sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, - SD_RSP_TYPE_R1, NULL, 0, 0); + SD_RSP_TYPE_R1, NULL, 0, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); } retval = ext_sd_send_cmd_get_rsp(chip, cmd_idx, arg, rsp_type, - sd_card->rsp, rsp_len, 0); + sd_card->rsp, rsp_len, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); @@ -4285,14 +4283,14 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (send_cmd12) { retval = ext_sd_send_cmd_get_rsp(chip, STOP_TRANSMISSION, - 0, SD_RSP_TYPE_R1b, NULL, 0, 0); + 0, SD_RSP_TYPE_R1b, NULL, 0, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); } if (data_len < 512) { retval = ext_sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, - SD_RSP_TYPE_R1, NULL, 0, 0); + SD_RSP_TYPE_R1, NULL, 0, false); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); @@ -4306,7 +4304,7 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) } if ((srb->cmnd[1] & 0x02) || (srb->cmnd[1] & 0x04)) - cmd13_checkbit = 1; + cmd13_checkbit = true; for (i = 0; i < 3; i++) { retval = ext_sd_send_cmd_get_rsp(chip, SEND_STATUS, diff --git a/drivers/staging/rts5208/sd.h b/drivers/staging/rts5208/sd.h index 735b2d0f5a78..60b79280fb5f 100644 --- a/drivers/staging/rts5208/sd.h +++ b/drivers/staging/rts5208/sd.h @@ -287,7 +287,7 @@ int release_sd_card(struct rtsx_chip *chip); #ifdef SUPPORT_CPRM int soft_reset_sd_card(struct rtsx_chip *chip); int ext_sd_send_cmd_get_rsp(struct rtsx_chip *chip, u8 cmd_idx, - u32 arg, u8 rsp_type, u8 *rsp, int rsp_len, int special_check); + u32 arg, u8 rsp_type, u8 *rsp, int rsp_len, bool special_check); int ext_sd_get_rsp(struct rtsx_chip *chip, int len, u8 *rsp, u8 rsp_type); int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip); -- cgit v1.2.3 From 31c889653c10ddaf1d2b4a47740e07fa4f10f375 Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Thu, 5 Mar 2015 19:29:09 -0600 Subject: staging: fsl-mc: Added Freescale Management Complex APIs APIs to access the Management Complex (MC) hardware module of Freescale LS2 SoCs. This patch includes APIs to check the MC firmware version and to manipulate DPRC objects in the MC. Signed-off-by: J. German Rivera Signed-off-by: Stuart Yoder Acked-by: Alexander Graf Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/TODO | 12 + drivers/staging/fsl-mc/bus/dpmng-cmd.h | 47 ++ drivers/staging/fsl-mc/bus/dpmng.c | 78 +++ drivers/staging/fsl-mc/bus/dprc-cmd.h | 84 +++ drivers/staging/fsl-mc/bus/dprc.c | 913 ++++++++++++++++++++++++++++++++ drivers/staging/fsl-mc/bus/mc-sys.c | 283 ++++++++++ drivers/staging/fsl-mc/include/dpmng.h | 80 +++ drivers/staging/fsl-mc/include/dprc.h | 801 ++++++++++++++++++++++++++++ drivers/staging/fsl-mc/include/mc-cmd.h | 113 ++++ drivers/staging/fsl-mc/include/mc-sys.h | 70 +++ 10 files changed, 2481 insertions(+) create mode 100644 drivers/staging/fsl-mc/TODO create mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h create mode 100644 drivers/staging/fsl-mc/bus/dpmng.c create mode 100644 drivers/staging/fsl-mc/bus/dprc-cmd.h create mode 100644 drivers/staging/fsl-mc/bus/dprc.c create mode 100644 drivers/staging/fsl-mc/bus/mc-sys.c create mode 100644 drivers/staging/fsl-mc/include/dpmng.h create mode 100644 drivers/staging/fsl-mc/include/dprc.h create mode 100644 drivers/staging/fsl-mc/include/mc-cmd.h create mode 100644 drivers/staging/fsl-mc/include/mc-sys.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/TODO b/drivers/staging/fsl-mc/TODO new file mode 100644 index 000000000000..49ebfd90438f --- /dev/null +++ b/drivers/staging/fsl-mc/TODO @@ -0,0 +1,12 @@ +* Add README file (with ASCII art) describing relationships between + DPAA2 objects and how combine them to make a NIC, an LS2 switch, etc. + Also, define all acronyms used. + +* Decide if multiple root fsl-mc buses will be supported per Linux instance, + and if so add support for this. + +* Add at least one device driver for a DPAA2 object (child device of the + fsl-mc bus). + +Please send any patches to Greg Kroah-Hartman , +devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org diff --git a/drivers/staging/fsl-mc/bus/dpmng-cmd.h b/drivers/staging/fsl-mc/bus/dpmng-cmd.h new file mode 100644 index 000000000000..ba8cfa9635dd --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dpmng-cmd.h @@ -0,0 +1,47 @@ +/* Copyright 2013-2014 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*************************************************************************//* + dpmng-cmd.h + + defines portal commands + + *//**************************************************************************/ + +#ifndef __FSL_DPMNG_CMD_H +#define __FSL_DPMNG_CMD_H + +/* Command IDs */ +#define DPMNG_CMDID_GET_CONT_ID 0x830 +#define DPMNG_CMDID_GET_VERSION 0x831 + +#endif /* __FSL_DPMNG_CMD_H */ diff --git a/drivers/staging/fsl-mc/bus/dpmng.c b/drivers/staging/fsl-mc/bus/dpmng.c new file mode 100644 index 000000000000..58328e8118e9 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dpmng.c @@ -0,0 +1,78 @@ +/* Copyright 2013-2014 Freescale Semiconductor Inc. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the above-listed copyright holders nor the +* names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* +* ALTERNATIVELY, this software may be distributed under the terms of the +* GNU General Public License ("GPL") as published by the Free Software +* Foundation, either version 2 of that License or (at your option) any +* later version. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ +#include "../include/mc-sys.h" +#include "../include/mc-cmd.h" +#include "../include/dpmng.h" +#include "dpmng-cmd.h" + +int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION, + MC_CMD_PRI_LOW, 0); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + mc_ver_info->revision = mc_dec(cmd.params[0], 0, 32); + mc_ver_info->major = mc_dec(cmd.params[0], 32, 32); + mc_ver_info->minor = mc_dec(cmd.params[1], 0, 32); + + return 0; +} + +int dpmng_get_container_id(struct fsl_mc_io *mc_io, int *container_id) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_CONT_ID, + MC_CMD_PRI_LOW, 0); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *container_id = mc_dec(cmd.params[0], 0, 32); + + return 0; +} + diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h b/drivers/staging/fsl-mc/bus/dprc-cmd.h new file mode 100644 index 000000000000..09202489c2b2 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h @@ -0,0 +1,84 @@ +/* Copyright 2013-2014 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*************************************************************************//* + dprc-cmd.h + + defines dprc portal commands + + *//**************************************************************************/ + +#ifndef _FSL_DPRC_CMD_H +#define _FSL_DPRC_CMD_H + +/* DPRC Version */ +#define DPRC_VER_MAJOR 3 +#define DPRC_VER_MINOR 0 + +/* Command IDs */ +#define DPRC_CMDID_CLOSE 0x800 +#define DPRC_CMDID_OPEN 0x805 +#define DPRC_CMDID_CREATE 0x905 + +#define DPRC_CMDID_GET_ATTR 0x004 +#define DPRC_CMDID_RESET_CONT 0x005 + +#define DPRC_CMDID_SET_IRQ 0x010 +#define DPRC_CMDID_GET_IRQ 0x011 +#define DPRC_CMDID_SET_IRQ_ENABLE 0x012 +#define DPRC_CMDID_GET_IRQ_ENABLE 0x013 +#define DPRC_CMDID_SET_IRQ_MASK 0x014 +#define DPRC_CMDID_GET_IRQ_MASK 0x015 +#define DPRC_CMDID_GET_IRQ_STATUS 0x016 +#define DPRC_CMDID_CLEAR_IRQ_STATUS 0x017 + +#define DPRC_CMDID_CREATE_CONT 0x151 +#define DPRC_CMDID_DESTROY_CONT 0x152 +#define DPRC_CMDID_SET_RES_QUOTA 0x155 +#define DPRC_CMDID_GET_RES_QUOTA 0x156 +#define DPRC_CMDID_ASSIGN 0x157 +#define DPRC_CMDID_UNASSIGN 0x158 +#define DPRC_CMDID_GET_OBJ_COUNT 0x159 +#define DPRC_CMDID_GET_OBJ 0x15A +#define DPRC_CMDID_GET_RES_COUNT 0x15B +#define DPRC_CMDID_GET_RES_IDS 0x15C +#define DPRC_CMDID_GET_OBJ_REG 0x15E + +#define DPRC_CMDID_CONNECT 0x167 +#define DPRC_CMDID_DISCONNECT 0x168 +#define DPRC_CMDID_GET_POOL 0x169 +#define DPRC_CMDID_GET_POOL_COUNT 0x16A +#define DPRC_CMDID_GET_PORTAL_PADDR 0x16B + +#define DPRC_CMDID_GET_CONNECTION 0x16C + +#endif /* _FSL_DPRC_CMD_H */ diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/staging/fsl-mc/bus/dprc.c new file mode 100644 index 000000000000..19b26e630b62 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dprc.c @@ -0,0 +1,913 @@ +/* Copyright 2013-2014 Freescale Semiconductor Inc. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the above-listed copyright holders nor the +* names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* +* ALTERNATIVELY, this software may be distributed under the terms of the +* GNU General Public License ("GPL") as published by the Free Software +* Foundation, either version 2 of that License or (at your option) any +* later version. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ +#include "../include/mc-sys.h" +#include "../include/mc-cmd.h" +#include "../include/dprc.h" +#include "dprc-cmd.h" + +int dprc_open(struct fsl_mc_io *mc_io, int container_id, uint16_t *token) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, MC_CMD_PRI_LOW, + 0); + cmd.params[0] |= mc_enc(0, 32, container_id); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *token = MC_CMD_HDR_READ_TOKEN(cmd.header); + + return 0; +} +EXPORT_SYMBOL(dprc_open); + +int dprc_close(struct fsl_mc_io *mc_io, uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLOSE, MC_CMD_PRI_HIGH, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} +EXPORT_SYMBOL(dprc_close); + +int dprc_create_container(struct fsl_mc_io *mc_io, + uint16_t token, + struct dprc_cfg *cfg, + int *child_container_id, + uint64_t *child_portal_paddr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.params[0] |= mc_enc(32, 16, cfg->icid); + cmd.params[0] |= mc_enc(0, 32, cfg->options); + cmd.params[1] |= mc_enc(32, 32, cfg->portal_id); + + cmd.header = mc_encode_cmd_header(DPRC_CMDID_CREATE_CONT, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *child_container_id = mc_dec(cmd.params[1], 0, 32); + *child_portal_paddr = mc_dec(cmd.params[2], 0, 64); + + return 0; +} + +int dprc_destroy_container(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_DESTROY_CONT, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, child_container_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_reset_container(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_RESET_CONT, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, child_container_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_get_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + int *type, + uint64_t *irq_paddr, + uint32_t *irq_val, + int *user_irq_id) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ, + MC_CMD_PRI_LOW, + token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *irq_val = mc_dec(cmd.params[0], 0, 32); + *irq_paddr = mc_dec(cmd.params[1], 0, 64); + *user_irq_id = mc_dec(cmd.params[2], 0, 32); + *type = mc_dec(cmd.params[2], 32, 32); + + return 0; +} + +int dprc_set_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint64_t irq_paddr, + uint32_t irq_val, + int user_irq_id) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ, + MC_CMD_PRI_LOW, + token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + cmd.params[0] |= mc_enc(0, 32, irq_val); + cmd.params[1] |= mc_enc(0, 64, irq_paddr); + cmd.params[2] |= mc_enc(0, 32, user_irq_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_get_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t *en) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_ENABLE, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *en = mc_dec(cmd.params[0], 0, 8); + + return 0; +} + +int dprc_set_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t en) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_ENABLE, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 8, en); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_get_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *mask) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_MASK, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *mask = mc_dec(cmd.params[0], 0, 32); + + return 0; +} + +int dprc_set_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t mask) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_MASK, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, mask); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_get_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *status) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_STATUS, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *status = mc_dec(cmd.params[0], 0, 32); + + return 0; +} + +int dprc_clear_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t status) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLEAR_IRQ_STATUS, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, status); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_get_attributes(struct fsl_mc_io *mc_io, + uint16_t token, + struct dprc_attributes *attr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_ATTR, + MC_CMD_PRI_LOW, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + attr->container_id = mc_dec(cmd.params[0], 0, 32); + attr->icid = mc_dec(cmd.params[0], 32, 16); + attr->options = mc_dec(cmd.params[1], 0, 32); + attr->portal_id = mc_dec(cmd.params[1], 32, 32); + attr->version.major = mc_dec(cmd.params[2], 0, 16); + attr->version.minor = mc_dec(cmd.params[2], 16, 16); + + return 0; +} + +int dprc_set_res_quota(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id, + char *type, + uint16_t quota) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_RES_QUOTA, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, child_container_id); + cmd.params[0] |= mc_enc(32, 16, quota); + cmd.params[1] |= mc_enc(0, 8, type[0]); + cmd.params[1] |= mc_enc(8, 8, type[1]); + cmd.params[1] |= mc_enc(16, 8, type[2]); + cmd.params[1] |= mc_enc(24, 8, type[3]); + cmd.params[1] |= mc_enc(32, 8, type[4]); + cmd.params[1] |= mc_enc(40, 8, type[5]); + cmd.params[1] |= mc_enc(48, 8, type[6]); + cmd.params[1] |= mc_enc(56, 8, type[7]); + cmd.params[2] |= mc_enc(0, 8, type[8]); + cmd.params[2] |= mc_enc(8, 8, type[9]); + cmd.params[2] |= mc_enc(16, 8, type[10]); + cmd.params[2] |= mc_enc(24, 8, type[11]); + cmd.params[2] |= mc_enc(32, 8, type[12]); + cmd.params[2] |= mc_enc(40, 8, type[13]); + cmd.params[2] |= mc_enc(48, 8, type[14]); + cmd.params[2] |= mc_enc(56, 8, '\0'); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_get_res_quota(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id, + char *type, + uint16_t *quota) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_QUOTA, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, child_container_id); + cmd.params[1] |= mc_enc(0, 8, type[0]); + cmd.params[1] |= mc_enc(8, 8, type[1]); + cmd.params[1] |= mc_enc(16, 8, type[2]); + cmd.params[1] |= mc_enc(24, 8, type[3]); + cmd.params[1] |= mc_enc(32, 8, type[4]); + cmd.params[1] |= mc_enc(40, 8, type[5]); + cmd.params[1] |= mc_enc(48, 8, type[6]); + cmd.params[1] |= mc_enc(56, 8, type[7]); + cmd.params[2] |= mc_enc(0, 8, type[8]); + cmd.params[2] |= mc_enc(8, 8, type[9]); + cmd.params[2] |= mc_enc(16, 8, type[10]); + cmd.params[2] |= mc_enc(24, 8, type[11]); + cmd.params[2] |= mc_enc(32, 8, type[12]); + cmd.params[2] |= mc_enc(40, 8, type[13]); + cmd.params[2] |= mc_enc(48, 8, type[14]); + cmd.params[2] |= mc_enc(56, 8, '\0'); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *quota = mc_dec(cmd.params[0], 32, 16); + + return 0; +} + +int dprc_assign(struct fsl_mc_io *mc_io, + uint16_t token, + int container_id, + struct dprc_res_req *res_req) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_ASSIGN, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, container_id); + cmd.params[0] |= mc_enc(32, 32, res_req->options); + cmd.params[1] |= mc_enc(0, 32, res_req->num); + cmd.params[1] |= mc_enc(32, 32, res_req->id_base_align); + cmd.params[2] |= mc_enc(0, 8, res_req->type[0]); + cmd.params[2] |= mc_enc(8, 8, res_req->type[1]); + cmd.params[2] |= mc_enc(16, 8, res_req->type[2]); + cmd.params[2] |= mc_enc(24, 8, res_req->type[3]); + cmd.params[2] |= mc_enc(32, 8, res_req->type[4]); + cmd.params[2] |= mc_enc(40, 8, res_req->type[5]); + cmd.params[2] |= mc_enc(48, 8, res_req->type[6]); + cmd.params[2] |= mc_enc(56, 8, res_req->type[7]); + cmd.params[3] |= mc_enc(0, 8, res_req->type[8]); + cmd.params[3] |= mc_enc(8, 8, res_req->type[9]); + cmd.params[3] |= mc_enc(16, 8, res_req->type[10]); + cmd.params[3] |= mc_enc(24, 8, res_req->type[11]); + cmd.params[3] |= mc_enc(32, 8, res_req->type[12]); + cmd.params[3] |= mc_enc(40, 8, res_req->type[13]); + cmd.params[3] |= mc_enc(48, 8, res_req->type[14]); + cmd.params[3] |= mc_enc(56, 8, res_req->type[15]); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_unassign(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id, + struct dprc_res_req *res_req) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_UNASSIGN, + MC_CMD_PRI_LOW, + token); + cmd.params[0] |= mc_enc(0, 32, child_container_id); + cmd.params[0] |= mc_enc(32, 32, res_req->options); + cmd.params[1] |= mc_enc(0, 32, res_req->num); + cmd.params[1] |= mc_enc(32, 32, res_req->id_base_align); + cmd.params[2] |= mc_enc(0, 8, res_req->type[0]); + cmd.params[2] |= mc_enc(8, 8, res_req->type[1]); + cmd.params[2] |= mc_enc(16, 8, res_req->type[2]); + cmd.params[2] |= mc_enc(24, 8, res_req->type[3]); + cmd.params[2] |= mc_enc(32, 8, res_req->type[4]); + cmd.params[2] |= mc_enc(40, 8, res_req->type[5]); + cmd.params[2] |= mc_enc(48, 8, res_req->type[6]); + cmd.params[2] |= mc_enc(56, 8, res_req->type[7]); + cmd.params[3] |= mc_enc(0, 8, res_req->type[8]); + cmd.params[3] |= mc_enc(8, 8, res_req->type[9]); + cmd.params[3] |= mc_enc(16, 8, res_req->type[10]); + cmd.params[3] |= mc_enc(24, 8, res_req->type[11]); + cmd.params[3] |= mc_enc(32, 8, res_req->type[12]); + cmd.params[3] |= mc_enc(40, 8, res_req->type[13]); + cmd.params[3] |= mc_enc(48, 8, res_req->type[14]); + cmd.params[3] |= mc_enc(56, 8, res_req->type[15]); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_get_pool_count(struct fsl_mc_io *mc_io, + uint16_t token, + int *pool_count) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_POOL_COUNT, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *pool_count = mc_dec(cmd.params[0], 0, 32); + + return 0; +} + +int dprc_get_pool(struct fsl_mc_io *mc_io, + uint16_t token, + int pool_index, + char *type) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_POOL, + MC_CMD_PRI_LOW, + token); + cmd.params[0] |= mc_enc(0, 32, pool_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + type[0] = mc_dec(cmd.params[1], 0, 8); + type[1] = mc_dec(cmd.params[1], 8, 8); + type[2] = mc_dec(cmd.params[1], 16, 8); + type[3] = mc_dec(cmd.params[1], 24, 8); + type[4] = mc_dec(cmd.params[1], 32, 8); + type[5] = mc_dec(cmd.params[1], 40, 8); + type[6] = mc_dec(cmd.params[1], 48, 8); + type[7] = mc_dec(cmd.params[1], 56, 8); + type[8] = mc_dec(cmd.params[2], 0, 8); + type[9] = mc_dec(cmd.params[2], 8, 8); + type[10] = mc_dec(cmd.params[2], 16, 8); + type[11] = mc_dec(cmd.params[2], 24, 8); + type[12] = mc_dec(cmd.params[2], 32, 8); + type[13] = mc_dec(cmd.params[2], 40, 8); + type[14] = mc_dec(cmd.params[2], 48, 8); + type[15] = '\0'; + + return 0; +} + +int dprc_get_obj_count(struct fsl_mc_io *mc_io, uint16_t token, int *obj_count) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_COUNT, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *obj_count = mc_dec(cmd.params[0], 32, 32); + + return 0; +} +EXPORT_SYMBOL(dprc_get_obj_count); + +int dprc_get_obj(struct fsl_mc_io *mc_io, + uint16_t token, + int obj_index, + struct dprc_obj_desc *obj_desc) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ, + MC_CMD_PRI_LOW, + token); + cmd.params[0] |= mc_enc(0, 32, obj_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + obj_desc->id = mc_dec(cmd.params[0], 32, 32); + obj_desc->vendor = mc_dec(cmd.params[1], 0, 16); + obj_desc->irq_count = mc_dec(cmd.params[1], 16, 8); + obj_desc->region_count = mc_dec(cmd.params[1], 24, 8); + obj_desc->state = mc_dec(cmd.params[1], 32, 32); + obj_desc->ver_major = mc_dec(cmd.params[2], 0, 16); + obj_desc->ver_minor = mc_dec(cmd.params[2], 16, 16); + obj_desc->type[0] = mc_dec(cmd.params[3], 0, 8); + obj_desc->type[1] = mc_dec(cmd.params[3], 8, 8); + obj_desc->type[2] = mc_dec(cmd.params[3], 16, 8); + obj_desc->type[3] = mc_dec(cmd.params[3], 24, 8); + obj_desc->type[4] = mc_dec(cmd.params[3], 32, 8); + obj_desc->type[5] = mc_dec(cmd.params[3], 40, 8); + obj_desc->type[6] = mc_dec(cmd.params[3], 48, 8); + obj_desc->type[7] = mc_dec(cmd.params[3], 56, 8); + obj_desc->type[8] = mc_dec(cmd.params[4], 0, 8); + obj_desc->type[9] = mc_dec(cmd.params[4], 8, 8); + obj_desc->type[10] = mc_dec(cmd.params[4], 16, 8); + obj_desc->type[11] = mc_dec(cmd.params[4], 24, 8); + obj_desc->type[12] = mc_dec(cmd.params[4], 32, 8); + obj_desc->type[13] = mc_dec(cmd.params[4], 40, 8); + obj_desc->type[14] = mc_dec(cmd.params[4], 48, 8); + obj_desc->type[15] = '\0'; + + return 0; +} +EXPORT_SYMBOL(dprc_get_obj); + +int dprc_get_res_count(struct fsl_mc_io *mc_io, + uint16_t token, + char *type, + int *res_count) +{ + struct mc_command cmd = { 0 }; + int err; + + *res_count = 0; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT, + MC_CMD_PRI_LOW, token); + cmd.params[1] |= mc_enc(0, 8, type[0]); + cmd.params[1] |= mc_enc(8, 8, type[1]); + cmd.params[1] |= mc_enc(16, 8, type[2]); + cmd.params[1] |= mc_enc(24, 8, type[3]); + cmd.params[1] |= mc_enc(32, 8, type[4]); + cmd.params[1] |= mc_enc(40, 8, type[5]); + cmd.params[1] |= mc_enc(48, 8, type[6]); + cmd.params[1] |= mc_enc(56, 8, type[7]); + cmd.params[2] |= mc_enc(0, 8, type[8]); + cmd.params[2] |= mc_enc(8, 8, type[9]); + cmd.params[2] |= mc_enc(16, 8, type[10]); + cmd.params[2] |= mc_enc(24, 8, type[11]); + cmd.params[2] |= mc_enc(32, 8, type[12]); + cmd.params[2] |= mc_enc(40, 8, type[13]); + cmd.params[2] |= mc_enc(48, 8, type[14]); + cmd.params[2] |= mc_enc(56, 8, '\0'); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *res_count = mc_dec(cmd.params[0], 0, 32); + + return 0; +} +EXPORT_SYMBOL(dprc_get_res_count); + +int dprc_get_res_ids(struct fsl_mc_io *mc_io, + uint16_t token, + char *type, + struct dprc_res_ids_range_desc *range_desc) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_IDS, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(42, 7, range_desc->iter_status); + cmd.params[1] |= mc_enc(0, 32, range_desc->base_id); + cmd.params[1] |= mc_enc(32, 32, range_desc->last_id); + cmd.params[2] |= mc_enc(0, 8, type[0]); + cmd.params[2] |= mc_enc(8, 8, type[1]); + cmd.params[2] |= mc_enc(16, 8, type[2]); + cmd.params[2] |= mc_enc(24, 8, type[3]); + cmd.params[2] |= mc_enc(32, 8, type[4]); + cmd.params[2] |= mc_enc(40, 8, type[5]); + cmd.params[2] |= mc_enc(48, 8, type[6]); + cmd.params[2] |= mc_enc(56, 8, type[7]); + cmd.params[3] |= mc_enc(0, 8, type[8]); + cmd.params[3] |= mc_enc(8, 8, type[9]); + cmd.params[3] |= mc_enc(16, 8, type[10]); + cmd.params[3] |= mc_enc(24, 8, type[11]); + cmd.params[3] |= mc_enc(32, 8, type[12]); + cmd.params[3] |= mc_enc(40, 8, type[13]); + cmd.params[3] |= mc_enc(48, 8, type[14]); + cmd.params[3] |= mc_enc(56, 8, '\0'); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + range_desc->iter_status = mc_dec(cmd.params[0], 42, 7); + range_desc->base_id = mc_dec(cmd.params[1], 0, 32); + range_desc->last_id = mc_dec(cmd.params[1], 32, 32); + + return 0; +} +EXPORT_SYMBOL(dprc_get_res_ids); + +int dprc_get_portal_paddr(struct fsl_mc_io *mc_io, + uint16_t token, + int portal_id, + uint64_t *portal_addr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_PORTAL_PADDR, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, portal_id); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *portal_addr = mc_dec(cmd.params[1], 0, 64); + + return 0; +} +EXPORT_SYMBOL(dprc_get_portal_paddr); + +int dprc_get_obj_region(struct fsl_mc_io *mc_io, + uint16_t token, + char *obj_type, + int obj_id, + uint8_t region_index, + struct dprc_region_desc *region_desc) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_REG, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, obj_id); + cmd.params[0] |= mc_enc(48, 8, region_index); + cmd.params[3] |= mc_enc(0, 8, obj_type[0]); + cmd.params[3] |= mc_enc(8, 8, obj_type[1]); + cmd.params[3] |= mc_enc(16, 8, obj_type[2]); + cmd.params[3] |= mc_enc(24, 8, obj_type[3]); + cmd.params[3] |= mc_enc(32, 8, obj_type[4]); + cmd.params[3] |= mc_enc(40, 8, obj_type[5]); + cmd.params[3] |= mc_enc(48, 8, obj_type[6]); + cmd.params[3] |= mc_enc(56, 8, obj_type[7]); + cmd.params[4] |= mc_enc(0, 8, obj_type[8]); + cmd.params[4] |= mc_enc(8, 8, obj_type[9]); + cmd.params[4] |= mc_enc(16, 8, obj_type[10]); + cmd.params[4] |= mc_enc(24, 8, obj_type[11]); + cmd.params[4] |= mc_enc(32, 8, obj_type[12]); + cmd.params[4] |= mc_enc(40, 8, obj_type[13]); + cmd.params[4] |= mc_enc(48, 8, obj_type[14]); + cmd.params[4] |= mc_enc(56, 8, '\0'); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + region_desc->base_paddr = mc_dec(cmd.params[1], 0, 64); + region_desc->size = mc_dec(cmd.params[2], 0, 32); + + return 0; +} +EXPORT_SYMBOL(dprc_get_obj_region); + +int dprc_connect(struct fsl_mc_io *mc_io, + uint16_t token, + const struct dprc_endpoint *endpoint1, + const struct dprc_endpoint *endpoint2) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_CONNECT, + MC_CMD_PRI_LOW, + token); + cmd.params[0] |= mc_enc(0, 32, endpoint1->id); + cmd.params[0] |= mc_enc(32, 32, endpoint1->interface_id); + cmd.params[1] |= mc_enc(0, 32, endpoint2->id); + cmd.params[1] |= mc_enc(32, 32, endpoint2->interface_id); + cmd.params[2] |= mc_enc(0, 8, endpoint1->type[0]); + cmd.params[2] |= mc_enc(8, 8, endpoint1->type[1]); + cmd.params[2] |= mc_enc(16, 8, endpoint1->type[2]); + cmd.params[2] |= mc_enc(24, 8, endpoint1->type[3]); + cmd.params[2] |= mc_enc(32, 8, endpoint1->type[4]); + cmd.params[2] |= mc_enc(40, 8, endpoint1->type[5]); + cmd.params[2] |= mc_enc(48, 8, endpoint1->type[6]); + cmd.params[2] |= mc_enc(56, 8, endpoint1->type[7]); + cmd.params[3] |= mc_enc(0, 8, endpoint1->type[8]); + cmd.params[3] |= mc_enc(8, 8, endpoint1->type[9]); + cmd.params[3] |= mc_enc(16, 8, endpoint1->type[10]); + cmd.params[3] |= mc_enc(24, 8, endpoint1->type[11]); + cmd.params[3] |= mc_enc(32, 8, endpoint1->type[12]); + cmd.params[3] |= mc_enc(40, 8, endpoint1->type[13]); + cmd.params[3] |= mc_enc(48, 8, endpoint1->type[14]); + cmd.params[3] |= mc_enc(56, 8, endpoint1->type[15]); + cmd.params[5] |= mc_enc(0, 8, endpoint2->type[0]); + cmd.params[5] |= mc_enc(8, 8, endpoint2->type[1]); + cmd.params[5] |= mc_enc(16, 8, endpoint2->type[2]); + cmd.params[5] |= mc_enc(24, 8, endpoint2->type[3]); + cmd.params[5] |= mc_enc(32, 8, endpoint2->type[4]); + cmd.params[5] |= mc_enc(40, 8, endpoint2->type[5]); + cmd.params[5] |= mc_enc(48, 8, endpoint2->type[6]); + cmd.params[5] |= mc_enc(56, 8, endpoint2->type[7]); + cmd.params[6] |= mc_enc(0, 8, endpoint2->type[8]); + cmd.params[6] |= mc_enc(8, 8, endpoint2->type[9]); + cmd.params[6] |= mc_enc(16, 8, endpoint2->type[10]); + cmd.params[6] |= mc_enc(24, 8, endpoint2->type[11]); + cmd.params[6] |= mc_enc(32, 8, endpoint2->type[12]); + cmd.params[6] |= mc_enc(40, 8, endpoint2->type[13]); + cmd.params[6] |= mc_enc(48, 8, endpoint2->type[14]); + cmd.params[6] |= mc_enc(56, 8, endpoint2->type[15]); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_disconnect(struct fsl_mc_io *mc_io, + uint16_t token, + const struct dprc_endpoint *endpoint) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_DISCONNECT, + MC_CMD_PRI_LOW, + token); + cmd.params[0] |= mc_enc(0, 32, endpoint->id); + cmd.params[0] |= mc_enc(32, 32, endpoint->interface_id); + cmd.params[1] |= mc_enc(0, 8, endpoint->type[0]); + cmd.params[1] |= mc_enc(8, 8, endpoint->type[1]); + cmd.params[1] |= mc_enc(16, 8, endpoint->type[2]); + cmd.params[1] |= mc_enc(24, 8, endpoint->type[3]); + cmd.params[1] |= mc_enc(32, 8, endpoint->type[4]); + cmd.params[1] |= mc_enc(40, 8, endpoint->type[5]); + cmd.params[1] |= mc_enc(48, 8, endpoint->type[6]); + cmd.params[1] |= mc_enc(56, 8, endpoint->type[7]); + cmd.params[2] |= mc_enc(0, 8, endpoint->type[8]); + cmd.params[2] |= mc_enc(8, 8, endpoint->type[9]); + cmd.params[2] |= mc_enc(16, 8, endpoint->type[10]); + cmd.params[2] |= mc_enc(24, 8, endpoint->type[11]); + cmd.params[2] |= mc_enc(32, 8, endpoint->type[12]); + cmd.params[2] |= mc_enc(40, 8, endpoint->type[13]); + cmd.params[2] |= mc_enc(48, 8, endpoint->type[14]); + cmd.params[2] |= mc_enc(56, 8, endpoint->type[15]); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dprc_get_connection(struct fsl_mc_io *mc_io, + uint16_t token, + const struct dprc_endpoint *endpoint1, + struct dprc_endpoint *endpoint2, + int *state) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONNECTION, + MC_CMD_PRI_LOW, + token); + cmd.params[0] |= mc_enc(0, 32, endpoint1->id); + cmd.params[0] |= mc_enc(32, 32, endpoint1->interface_id); + cmd.params[1] |= mc_enc(0, 8, endpoint1->type[0]); + cmd.params[1] |= mc_enc(8, 8, endpoint1->type[1]); + cmd.params[1] |= mc_enc(16, 8, endpoint1->type[2]); + cmd.params[1] |= mc_enc(24, 8, endpoint1->type[3]); + cmd.params[1] |= mc_enc(32, 8, endpoint1->type[4]); + cmd.params[1] |= mc_enc(40, 8, endpoint1->type[5]); + cmd.params[1] |= mc_enc(48, 8, endpoint1->type[6]); + cmd.params[1] |= mc_enc(56, 8, endpoint1->type[7]); + cmd.params[2] |= mc_enc(0, 8, endpoint1->type[8]); + cmd.params[2] |= mc_enc(8, 8, endpoint1->type[9]); + cmd.params[2] |= mc_enc(16, 8, endpoint1->type[10]); + cmd.params[2] |= mc_enc(24, 8, endpoint1->type[11]); + cmd.params[2] |= mc_enc(32, 8, endpoint1->type[12]); + cmd.params[2] |= mc_enc(40, 8, endpoint1->type[13]); + cmd.params[2] |= mc_enc(48, 8, endpoint1->type[14]); + cmd.params[2] |= mc_enc(56, 8, endpoint1->type[15]); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + endpoint2->id = mc_dec(cmd.params[3], 0, 32); + endpoint2->interface_id = mc_dec(cmd.params[3], 32, 32); + endpoint2->type[0] = mc_dec(cmd.params[4], 0, 8); + endpoint2->type[1] = mc_dec(cmd.params[4], 8, 8); + endpoint2->type[2] = mc_dec(cmd.params[4], 16, 8); + endpoint2->type[3] = mc_dec(cmd.params[4], 24, 8); + endpoint2->type[4] = mc_dec(cmd.params[4], 32, 8); + endpoint2->type[5] = mc_dec(cmd.params[4], 40, 8); + endpoint2->type[6] = mc_dec(cmd.params[4], 48, 8); + endpoint2->type[7] = mc_dec(cmd.params[4], 56, 8); + endpoint2->type[8] = mc_dec(cmd.params[5], 0, 8); + endpoint2->type[9] = mc_dec(cmd.params[5], 8, 8); + endpoint2->type[10] = mc_dec(cmd.params[5], 16, 8); + endpoint2->type[11] = mc_dec(cmd.params[5], 24, 8); + endpoint2->type[12] = mc_dec(cmd.params[5], 32, 8); + endpoint2->type[13] = mc_dec(cmd.params[5], 40, 8); + endpoint2->type[14] = mc_dec(cmd.params[5], 48, 8); + endpoint2->type[15] = mc_dec(cmd.params[5], 56, 8); + *state = mc_dec(cmd.params[6], 0, 32); + + return 0; +} diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c new file mode 100644 index 000000000000..a07064a9bc9a --- /dev/null +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -0,0 +1,283 @@ +/* Copyright 2013-2014 Freescale Semiconductor Inc. + * + * I/O services to send MC commands to the MC hardware + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "../include/mc-sys.h" +#include "../include/mc-cmd.h" +#include +#include +#include +#include + +/** + * Timeout in jiffies to wait for the completion of an MC command + */ +#define MC_CMD_COMPLETION_TIMEOUT_JIFFIES (HZ / 2) /* 500 ms */ + +/* + * usleep_range() min and max values used to throttle down polling + * iterations while waiting for MC command completion + */ +#define MC_CMD_COMPLETION_POLLING_MIN_SLEEP_USECS 10 +#define MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS 500 + +#define MC_CMD_HDR_READ_CMDID(_hdr) \ + ((uint16_t)mc_dec((_hdr), MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S)) + +/** + * Creates an MC I/O object + * + * @dev: device to be associated with the MC I/O object + * @mc_portal_phys_addr: physical address of the MC portal to use + * @mc_portal_size: size in bytes of the MC portal + * @flags: flags for the new MC I/O object + * @new_mc_io: Area to return pointer to newly created MC I/O object + * + * Returns '0' on Success; Error code otherwise. + */ +int __must_check fsl_create_mc_io(struct device *dev, + phys_addr_t mc_portal_phys_addr, + uint32_t mc_portal_size, + uint32_t flags, struct fsl_mc_io **new_mc_io) +{ + struct fsl_mc_io *mc_io; + void __iomem *mc_portal_virt_addr; + struct resource *res; + + mc_io = devm_kzalloc(dev, sizeof(*mc_io), GFP_KERNEL); + if (!mc_io) + return -ENOMEM; + + mc_io->dev = dev; + mc_io->flags = flags; + mc_io->portal_phys_addr = mc_portal_phys_addr; + mc_io->portal_size = mc_portal_size; + res = devm_request_mem_region(dev, + mc_portal_phys_addr, + mc_portal_size, + "mc_portal"); + if (!res) { + dev_err(dev, + "devm_request_mem_region failed for MC portal %#llx\n", + mc_portal_phys_addr); + return -EBUSY; + } + + mc_portal_virt_addr = devm_ioremap_nocache(dev, + mc_portal_phys_addr, + mc_portal_size); + if (!mc_portal_virt_addr) { + dev_err(dev, + "devm_ioremap_nocache failed for MC portal %#llx\n", + mc_portal_phys_addr); + return -ENXIO; + } + + mc_io->portal_virt_addr = mc_portal_virt_addr; + *new_mc_io = mc_io; + return 0; +} +EXPORT_SYMBOL_GPL(fsl_create_mc_io); + +/** + * Destroys an MC I/O object + * + * @mc_io: MC I/O object to destroy + */ +void fsl_destroy_mc_io(struct fsl_mc_io *mc_io) +{ + devm_iounmap(mc_io->dev, mc_io->portal_virt_addr); + devm_release_mem_region(mc_io->dev, + mc_io->portal_phys_addr, + mc_io->portal_size); + + mc_io->portal_virt_addr = NULL; + devm_kfree(mc_io->dev, mc_io); +} +EXPORT_SYMBOL_GPL(fsl_destroy_mc_io); + +static int mc_status_to_error(enum mc_cmd_status status) +{ + static const int mc_status_to_error_map[] = { + [MC_CMD_STATUS_OK] = 0, + [MC_CMD_STATUS_AUTH_ERR] = -EACCES, + [MC_CMD_STATUS_NO_PRIVILEGE] = -EPERM, + [MC_CMD_STATUS_DMA_ERR] = -EIO, + [MC_CMD_STATUS_CONFIG_ERR] = -ENXIO, + [MC_CMD_STATUS_TIMEOUT] = -ETIMEDOUT, + [MC_CMD_STATUS_NO_RESOURCE] = -ENAVAIL, + [MC_CMD_STATUS_NO_MEMORY] = -ENOMEM, + [MC_CMD_STATUS_BUSY] = -EBUSY, + [MC_CMD_STATUS_UNSUPPORTED_OP] = -ENOTSUPP, + [MC_CMD_STATUS_INVALID_STATE] = -ENODEV, + }; + + if (WARN_ON((u32)status >= ARRAY_SIZE(mc_status_to_error_map))) + return -EINVAL; + + return mc_status_to_error_map[status]; +} + +static const char *mc_status_to_string(enum mc_cmd_status status) +{ + static const char *const status_strings[] = { + [MC_CMD_STATUS_OK] = "Command completed successfully", + [MC_CMD_STATUS_READY] = "Command ready to be processed", + [MC_CMD_STATUS_AUTH_ERR] = "Authentication error", + [MC_CMD_STATUS_NO_PRIVILEGE] = "No privilege", + [MC_CMD_STATUS_DMA_ERR] = "DMA or I/O error", + [MC_CMD_STATUS_CONFIG_ERR] = "Configuration error", + [MC_CMD_STATUS_TIMEOUT] = "Operation timed out", + [MC_CMD_STATUS_NO_RESOURCE] = "No resources", + [MC_CMD_STATUS_NO_MEMORY] = "No memory available", + [MC_CMD_STATUS_BUSY] = "Device is busy", + [MC_CMD_STATUS_UNSUPPORTED_OP] = "Unsupported operation", + [MC_CMD_STATUS_INVALID_STATE] = "Invalid state" + }; + + if ((unsigned int)status >= ARRAY_SIZE(status_strings)) + return "Unknown MC error"; + + return status_strings[status]; +} + +/** + * mc_write_command - writes a command to a Management Complex (MC) portal + * + * @portal: pointer to an MC portal + * @cmd: pointer to a filled command + */ +static inline void mc_write_command(struct mc_command __iomem *portal, + struct mc_command *cmd) +{ + int i; + + /* copy command parameters into the portal */ + for (i = 0; i < MC_CMD_NUM_OF_PARAMS; i++) + writeq(cmd->params[i], &portal->params[i]); + + /* submit the command by writing the header */ + writeq(cmd->header, &portal->header); +} + +/** + * mc_read_response - reads the response for the last MC command from a + * Management Complex (MC) portal + * + * @portal: pointer to an MC portal + * @resp: pointer to command response buffer + * + * Returns MC_CMD_STATUS_OK on Success; Error code otherwise. + */ +static inline enum mc_cmd_status mc_read_response(struct mc_command __iomem * + portal, + struct mc_command *resp) +{ + int i; + enum mc_cmd_status status; + + /* Copy command response header from MC portal: */ + resp->header = readq(&portal->header); + status = MC_CMD_HDR_READ_STATUS(resp->header); + if (status != MC_CMD_STATUS_OK) + return status; + + /* Copy command response data from MC portal: */ + for (i = 0; i < MC_CMD_NUM_OF_PARAMS; i++) + resp->params[i] = readq(&portal->params[i]); + + return status; +} + +/** + * Sends an command to the MC device using the given MC I/O object + * + * @mc_io: MC I/O object to be used + * @cmd: command to be sent + * + * Returns '0' on Success; Error code otherwise. + * + * NOTE: This function cannot be invoked from from atomic contexts. + */ +int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd) +{ + enum mc_cmd_status status; + unsigned long jiffies_until_timeout = + jiffies + MC_CMD_COMPLETION_TIMEOUT_JIFFIES; + + /* + * Send command to the MC hardware: + */ + mc_write_command(mc_io->portal_virt_addr, cmd); + + /* + * Wait for response from the MC hardware: + */ + for (;;) { + status = mc_read_response(mc_io->portal_virt_addr, cmd); + if (status != MC_CMD_STATUS_READY) + break; + + /* + * TODO: When MC command completion interrupts are supported + * call wait function here instead of usleep_range() + */ + usleep_range(MC_CMD_COMPLETION_POLLING_MIN_SLEEP_USECS, + MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS); + + if (time_after_eq(jiffies, jiffies_until_timeout)) { + pr_debug("MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)\n", + mc_io->portal_phys_addr, + (unsigned int) + MC_CMD_HDR_READ_TOKEN(cmd->header), + (unsigned int) + MC_CMD_HDR_READ_CMDID(cmd->header)); + + return -ETIMEDOUT; + } + } + + if (status != MC_CMD_STATUS_OK) { + pr_debug("MC command failed: portal: %#llx, obj handle: %#x, command: %#x, status: %s (%#x)\n", + mc_io->portal_phys_addr, + (unsigned int)MC_CMD_HDR_READ_TOKEN(cmd->header), + (unsigned int)MC_CMD_HDR_READ_CMDID(cmd->header), + mc_status_to_string(status), + (unsigned int)status); + + return mc_status_to_error(status); + } + + return 0; +} +EXPORT_SYMBOL(mc_send_command); diff --git a/drivers/staging/fsl-mc/include/dpmng.h b/drivers/staging/fsl-mc/include/dpmng.h new file mode 100644 index 000000000000..0fc0a57490bb --- /dev/null +++ b/drivers/staging/fsl-mc/include/dpmng.h @@ -0,0 +1,80 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __FSL_DPMNG_H +#define __FSL_DPMNG_H + +/* Management Complex General API + * Contains general API for the Management Complex firmware + */ + +struct fsl_mc_io; + +/** + * Management Complex firmware version information + */ +#define MC_VER_MAJOR 5 +#define MC_VER_MINOR 0 + +/** + * struct mc_versoin + * @major: Major version number: incremented on API compatibility changes + * @minor: Minor version number: incremented on API additions (that are + * backward compatible); reset when major version is incremented + * @revision: Internal revision number: incremented on implementation changes + * and/or bug fixes that have no impact on API + */ +struct mc_version { + uint32_t major; + uint32_t minor; + uint32_t revision; +}; + +/** + * mc_get_version() - Retrieves the Management Complex firmware + * version information + * @mc_io: Pointer to opaque I/O object + * @mc_ver_info: Returned version information structure + * + * Return: '0' on Success; Error code otherwise. + */ +int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info); + +/** + * dpmng_get_container_id() - Get container ID associated with a given portal. + * @mc_io: Pointer to MC portal's I/O object + * @container_id: Requested container ID + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmng_get_container_id(struct fsl_mc_io *mc_io, int *container_id); + +#endif /* __FSL_DPMNG_H */ diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h new file mode 100644 index 000000000000..f1862a78a409 --- /dev/null +++ b/drivers/staging/fsl-mc/include/dprc.h @@ -0,0 +1,801 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _FSL_DPRC_H +#define _FSL_DPRC_H + +/* Data Path Resource Container API + * Contains DPRC API for managing and querying DPAA resources + */ + +struct fsl_mc_io; + +/** + * Set this value as the icid value in dprc_cfg structure when creating a + * container, in case the ICID is not selected by the user and should be + * allocated by the DPRC from the pool of ICIDs. + */ +#define DPRC_GET_ICID_FROM_POOL (uint16_t)(~(0)) + +/** + * Set this value as the portal_id value in dprc_cfg structure when creating a + * container, in case the portal ID is not specifically selected by the + * user and should be allocated by the DPRC from the pool of portal ids. + */ +#define DPRC_GET_PORTAL_ID_FROM_POOL (int)(~(0)) + +/** + * dprc_open() - Open DPRC object for use + * @mc_io: Pointer to MC portal's I/O object + * @container_id: Container ID to open + * @token: Returned token of DPRC object + * + * Return: '0' on Success; Error code otherwise. + * + * @warning Required before any operation on the object. + */ +int dprc_open(struct fsl_mc_io *mc_io, int container_id, uint16_t *token); + +/** + * dprc_close() - Close the control session of the object + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * + * After this function is called, no further operations are + * allowed on the object without opening a new control session. + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_close(struct fsl_mc_io *mc_io, uint16_t token); + +/** + * Container general options + * + * These options may be selected at container creation by the container creator + * and can be retrieved using dprc_get_attributes() + */ + +/* Spawn Policy Option allowed - Indicates that the new container is allowed + * to spawn and have its own child containers. + */ +#define DPRC_CFG_OPT_SPAWN_ALLOWED 0x00000001 + +/* General Container allocation policy - Indicates that the new container is + * allowed to allocate requested resources from its parent container; if not + * set, the container is only allowed to use resources in its own pools; Note + * that this is a container's global policy, but the parent container may + * override it and set specific quota per resource type. + */ +#define DPRC_CFG_OPT_ALLOC_ALLOWED 0x00000002 + +/* Object initialization allowed - software context associated with this + * container is allowed to invoke object initialization operations. + */ +#define DPRC_CFG_OPT_OBJ_CREATE_ALLOWED 0x00000004 + +/* Topology change allowed - software context associated with this + * container is allowed to invoke topology operations, such as attach/detach + * of network objects. + */ +#define DPRC_CFG_OPT_TOPOLOGY_CHANGES_ALLOWED 0x00000008 + +/* IOMMU bypass - indicates whether objects of this container are permitted + * to bypass the IOMMU. + */ +#define DPRC_CFG_OPT_IOMMU_BYPASS 0x00000010 + +/* AIOP - Indicates that container belongs to AIOP. */ +#define DPRC_CFG_OPT_AIOP 0x00000020 + +/** + * struct dprc_cfg - Container configuration options + * @icid: Container's ICID; if set to 'DPRC_GET_ICID_FROM_POOL', a free + * ICID value is allocated by the DPRC + * @portal_id: Portal ID; if set to 'DPRC_GET_PORTAL_ID_FROM_POOL', a free + * portal ID is allocated by the DPRC + * @options: Combination of 'DPRC_CFG_OPT_' options + */ +struct dprc_cfg { + uint16_t icid; + int portal_id; + uint64_t options; +}; + +/** + * dprc_create_container() - Create child container + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @cfg: Child container configuration + * @child_container_id: Returned child container ID + * @child_portal_paddr: Returned base physical address of the + * child portal + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_create_container(struct fsl_mc_io *mc_io, + uint16_t token, + struct dprc_cfg *cfg, + int *child_container_id, + uint64_t *child_portal_paddr); + +/** + * dprc_destroy_container() - Destroy child container. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @child_container_id: ID of the container to destroy + * + * This function terminates the child container, so following this call the + * child container ID becomes invalid. + * + * Notes: + * - All resources and objects of the destroyed container are returned to the + * parent container or destroyed if were created be the destroyed container. + * - This function destroy all the child containers of the specified + * container prior to destroying the container itself. + * + * warning: Only the parent container is allowed to destroy a child policy + * Container 0 can't be destroyed + * + * Return: '0' on Success; Error code otherwise. + * + */ +int dprc_destroy_container(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id); + +/** + * dprc_reset_container - Reset child container. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @child_container_id: ID of the container to reset + * + * In case a software context crashes or becomes non-responsive, the parent + * may wish to reset its resources container before the software context is + * restarted. + * + * This routine informs all objects assigned to the child container that the + * container is being reset, so they may perform any cleanup operations that are + * needed. All objects handles that were owned by the child container shall be + * closed. + * + * Note that such request may be submitted even if the child software context + * has not crashed, but the resulting object cleanup operations will not be + * aware of that. + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_reset_container(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id); + +/* IRQ */ + +/* Number of dprc's IRQs */ +#define DPRC_NUM_OF_IRQS 1 + +/* Object irq events */ + +/* IRQ event - Indicates that a new object assigned to the container */ +#define DPRC_IRQ_EVENT_OBJ_ADDED 0x00000001 +/* IRQ event - Indicates that an object was unassigned from the container */ +#define DPRC_IRQ_EVENT_OBJ_REMOVED 0x00000002 +/* IRQ event - Indicates that resources assigned to the container */ +#define DPRC_IRQ_EVENT_RES_ADDED 0x00000004 +/* IRQ event - Indicates that resources unassigned from the container */ +#define DPRC_IRQ_EVENT_RES_REMOVED 0x00000008 +/* IRQ event - Indicates that one of the descendant containers that opened by + * this container is destroyed + */ +#define DPRC_IRQ_EVENT_CONTAINER_DESTROYED 0x00000010 + +/* IRQ event - Indicates that on one of the container's opened object is + * destroyed + */ +#define DPRC_IRQ_EVENT_OBJ_DESTROYED 0x00000020 + +/* Irq event - Indicates that object is created at the container */ +#define DPRC_IRQ_EVENT_OBJ_CREATED 0x00000040 + +/** + * dprc_set_irq() - Set IRQ information for the DPRC to trigger an interrupt. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @irq_index: Identifies the interrupt index to configure + * @irq_addr: Address that must be written to + * signal a message-based interrupt + * @irq_val: Value to write into irq_addr address + * @user_irq_id: Returned a user defined number associated with this IRQ + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_set_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint64_t irq_addr, + uint32_t irq_val, + int user_irq_id); + +/** + * dprc_get_irq() - Get IRQ information from the DPRC. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @irq_index: The interrupt index to configure + * @type: Returned interrupt type: 0 represents message interrupt + * type (both irq_addr and irq_val are valid) + * @irq_addr: Returned address that must be written to + * signal the message-based interrupt + * @irq_val: Value to write into irq_addr address + * @user_irq_id: A user defined number associated with this IRQ + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + int *type, + uint64_t *irq_addr, + uint32_t *irq_val, + int *user_irq_id); + +/** + * dprc_set_irq_enable() - Set overall interrupt state. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @irq_index: The interrupt index to configure + * @en: Interrupt state - enable = 1, disable = 0 + * + * Allows GPP software to control when interrupts are generated. + * Each interrupt can have up to 32 causes. The enable/disable control's the + * overall interrupt state. if the interrupt is disabled no causes will cause + * an interrupt. + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_set_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t en); + +/** + * dprc_get_irq_enable() - Get overall interrupt state. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @irq_index: The interrupt index to configure + * @en: Returned interrupt state - enable = 1, disable = 0 + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t *en); + +/** + * dprc_set_irq_mask() - Set interrupt mask. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @irq_index: The interrupt index to configure + * @mask: event mask to trigger interrupt; + * each bit: + * 0 = ignore event + * 1 = consider event for asserting irq + * + * Every interrupt can have up to 32 causes and the interrupt model supports + * masking/unmasking each cause independently + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_set_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t mask); + +/** + * dprc_get_irq_mask() - Get interrupt mask. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @irq_index: The interrupt index to configure + * @mask: Returned event mask to trigger interrupt + * + * Every interrupt can have up to 32 causes and the interrupt model supports + * masking/unmasking each cause independently + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *mask); + +/** + * dprc_get_irq_status() - Get the current status of any pending interrupts. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @irq_index: The interrupt index to configure + * @status: Returned interrupts status - one bit per cause: + * 0 = no interrupt pending + * 1 = interrupt pending + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *status); + +/** + * dprc_clear_irq_status() - Clear a pending interrupt's status + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @irq_index: The interrupt index to configure + * @status: bits to clear (W1C) - one bit per cause: + * 0 = don't change + * 1 = clear status bit + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_clear_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t status); + +/** + * struct dprc_attributes - Container attributes + * @container_id: Container's ID + * @icid: Container's ICID + * @portal_id: Container's portal ID + * @options: Container's options as set at container's creation + * @version: DPRC version + */ +struct dprc_attributes { + int container_id; + uint16_t icid; + int portal_id; + uint64_t options; + /** + * struct version - DPRC version + * @major: DPRC major version + * @minor: DPRC minor version + */ + struct { + uint16_t major; + uint16_t minor; + } version; +}; + +/** + * dprc_get_attributes() - Obtains container attributes + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @attributes Returned container attributes + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_attributes(struct fsl_mc_io *mc_io, + uint16_t token, + struct dprc_attributes *attributes); + +/** + * dprc_set_res_quota() - Set allocation policy for a specific resource/object + * type in a child container + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @child_container_id: ID of the child container + * @type: Resource/object type + * @quota: Sets the maximum number of resources of the selected type + * that the child container is allowed to allocate from its parent; + * when quota is set to -1, the policy is the same as container's + * general policy. + * + * Allocation policy determines whether or not a container may allocate + * resources from its parent. Each container has a 'global' allocation policy + * that is set when the container is created. + * + * This function sets allocation policy for a specific resource type. + * The default policy for all resource types matches the container's 'global' + * allocation policy. + * + * Return: '0' on Success; Error code otherwise. + * + * @warning Only the parent container is allowed to change a child policy. + */ +int dprc_set_res_quota(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id, + char *type, + uint16_t quota); + +/** + * dprc_get_res_quota() - Gets the allocation policy of a specific + * resource/object type in a child container + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @child_container_id; ID of the child container + * @type: resource/object type + * @quota: Returnes the maximum number of resources of the selected type + * that the child container is allowed to allocate from the parent; + * when quota is set to -1, the policy is the same as container's + * general policy. + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_res_quota(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id, + char *type, + uint16_t *quota); + +/* Resource request options */ + +/* Explicit resource ID request - The requested objects/resources + * are explicit and sequential (in case of resources). + * The base ID is given at res_req at base_align field + */ +#define DPRC_RES_REQ_OPT_EXPLICIT 0x00000001 + +/* Aligned resources request - Relevant only for resources + * request (and not objects). Indicates that resources base ID should be + * sequential and aligned to the value given at dprc_res_req base_align field + */ +#define DPRC_RES_REQ_OPT_ALIGNED 0x00000002 + +/* Plugged Flag - Relevant only for object assignment request. + * Indicates that after all objects assigned. An interrupt will be invoked at + * the relevant GPP. The assigned object will be marked as plugged. + * plugged objects can't be assigned from their container + */ +#define DPRC_RES_REQ_OPT_PLUGGED 0x00000004 + +/** + * struct dprc_res_req - Resource request descriptor, to be used in assignment + * or un-assignment of resources and objects. + * @type: Resource/object type: Represent as a NULL terminated string. + * This string may received by using dprc_get_pool() to get resource + * type and dprc_get_obj() to get object type; + * Note: it is not possible to assign/un-assign DPRC objects + * @num: Number of resources + * @options: Request options: combination of DPRC_RES_REQ_OPT_ options + * @id_base_align: In case of explicit assignment (DPRC_RES_REQ_OPT_EXPLICIT + * is set at option), this field represents the required base ID + * for resource allocation; In case of aligned assignment + * (DPRC_RES_REQ_OPT_ALIGNED is set at option), this field + * indicates the required alignment for the resource ID(s) - + * use 0 if there is no alignment or explicit ID requirements + */ +struct dprc_res_req { + char type[16]; + uint32_t num; + uint32_t options; + int id_base_align; +}; + +/** + * dprc_assign() - Assigns objects or resource to a child container. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @container_id: ID of the child container + * @res_req: Describes the type and amount of resources to + * assign to the given container + * + * Assignment is usually done by a parent (this DPRC) to one of its child + * containers. + * + * According to the DPRC allocation policy, the assigned resources may be taken + * (allocated) from the container's ancestors, if not enough resources are + * available in the container itself. + * + * The type of assignment depends on the dprc_res_req options, as follows: + * - DPRC_RES_REQ_OPT_EXPLICIT: indicates that assigned resources should have + * the explicit base ID specified at the id_base_align field of res_req. + * - DPRC_RES_REQ_OPT_ALIGNED: indicates that the assigned resources should be + * aligned to the value given at id_base_align field of res_req. + * - DPRC_RES_REQ_OPT_PLUGGED: Relevant only for object assignment, + * and indicates that the object must be set to the plugged state. + * + * A container may use this function with its own ID in order to change a + * object state to plugged or unplugged. + * + * If IRQ information has been set in the child DPRC, it will signal an + * interrupt following every change in its object assignment. + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_assign(struct fsl_mc_io *mc_io, + uint16_t token, + int container_id, + struct dprc_res_req *res_req); + +/** + * dprc_unassign() - Un-assigns objects or resources from a child container + * and moves them into this (parent) DPRC. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @child_container_id: ID of the child container + * @res_req: Describes the type and amount of resources to un-assign from + * the child container + * + * Un-assignment of objects can succeed only if the object is not in the + * plugged or opened state. + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_unassign(struct fsl_mc_io *mc_io, + uint16_t token, + int child_container_id, + struct dprc_res_req *res_req); + +/** + * dprc_get_pool_count() - Get the number of dprc's pools + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @pool_count: Returned number of resource pools in the dprc + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_pool_count(struct fsl_mc_io *mc_io, + uint16_t token, + int *pool_count); + +/** + * dprc_get_pool() - Get the type (string) of a certain dprc's pool + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @pool_index; Index of the pool to be queried (< pool_count) + * @type: The type of the pool + * + * The pool types retrieved one by one by incrementing + * pool_index up to (not including) the value of pool_count returned + * from dprc_get_pool_count(). dprc_get_pool_count() must + * be called prior to dprc_get_pool(). + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_pool(struct fsl_mc_io *mc_io, + uint16_t token, + int pool_index, + char *type); + +/** + * dprc_get_obj_count() - Obtains the number of objects in the DPRC + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @obj_count: Number of objects assigned to the DPRC + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_obj_count(struct fsl_mc_io *mc_io, uint16_t token, int *obj_count); + +/* Objects Attributes Flags */ + +/* Opened state - Indicates that an object is open by at least one owner */ +#define DPRC_OBJ_STATE_OPEN 0x00000001 +/* Plugged state - Indicates that the object is plugged */ +#define DPRC_OBJ_STATE_PLUGGED 0x00000002 + +/** + * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj() + * @type: Type of object: NULL terminated string + * @id: ID of logical object resource + * @vendor: Object vendor identifier + * @ver_major: Major version number + * @ver_minor: Minor version number + * @irq_count: Number of interrupts supported by the object + * @region_count: Number of mappable regions supported by the object + * @state: Object state: combination of DPRC_OBJ_STATE_ states + */ +struct dprc_obj_desc { + char type[16]; + int id; + uint16_t vendor; + uint16_t ver_major; + uint16_t ver_minor; + uint8_t irq_count; + uint8_t region_count; + uint32_t state; +}; + +/** + * dprc_get_obj() - Get general information on an object + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @obj_index: Index of the object to be queried (< obj_count) + * @obj_desc: Returns the requested object descriptor + * + * The object descriptors are retrieved one by one by incrementing + * obj_index up to (not including) the value of obj_count returned + * from dprc_get_obj_count(). dprc_get_obj_count() must + * be called prior to dprc_get_obj(). + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_obj(struct fsl_mc_io *mc_io, + uint16_t token, + int obj_index, + struct dprc_obj_desc *obj_desc); + +/** + * dprc_get_res_count() - Obtains the number of free resources that are assigned + * to this container, by pool type + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @type: pool type + * @res_count: Returned number of free resources of the given + * resource type that are assigned to this DPRC + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_res_count(struct fsl_mc_io *mc_io, + uint16_t token, + char *type, + int *res_count); + +/** + * enum dprc_iter_status - Iteration status + * @DPRC_ITER_STATUS_FIRST: Perform first iteration + * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed + * @DPRC_ITER_STATUS_LAST: Indicates last iteration + */ +enum dprc_iter_status { + DPRC_ITER_STATUS_FIRST = 0, + DPRC_ITER_STATUS_MORE = 1, + DPRC_ITER_STATUS_LAST = 2 +}; + +/** + * struct dprc_res_ids_range_desc - Resource ID range descriptor + * @base_id: Base resource ID of this range + * @last_id: Last resource ID of this range + * @iter_status: Iteration status - should be set to DPRC_ITER_STATUS_FIRST at + * first iteration; while the returned marker is DPRC_ITER_STATUS_MORE, + * additional iterations are needed, until the returned marker is + * DPRC_ITER_STATUS_LAST + */ +struct dprc_res_ids_range_desc { + int base_id; + int last_id; + enum dprc_iter_status iter_status; +}; + +/** + * dprc_get_res_ids() - Obtains IDs of free resources in the container + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @type: pool type + * @range_desc: range descriptor + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_res_ids(struct fsl_mc_io *mc_io, + uint16_t token, + char *type, + struct dprc_res_ids_range_desc *range_desc); + +/** + * dprc_get_portal_paddr() - Get the physical address of MC portals + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @portal_id: MC portal ID + * @portal_addr: The physical address of the MC portal ID + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_portal_paddr(struct fsl_mc_io *mc_io, + uint16_t token, + int portal_id, + uint64_t *portal_addr); + +/** + * struct dprc_region_desc - Mappable region descriptor + * @base_paddr: Region base physical address + * @size: Region size (in bytes) + */ +struct dprc_region_desc { + uint64_t base_paddr; + uint32_t size; +}; + +/** + * dprc_get_obj_region() - Get region information for a specified object. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @obj_type; Object type as returned in dprc_get_obj() + * @obj_id: Unique object instance as returned in dprc_get_obj() + * @region_index: The specific region to query + * @region_desc: Returns the requested region descriptor + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_get_obj_region(struct fsl_mc_io *mc_io, + uint16_t token, + char *obj_type, + int obj_id, + uint8_t region_index, + struct dprc_region_desc *region_desc); + +/** + * struct dprc_endpoint - Endpoint description for link connect/disconnect + * operations + * @type: Endpoint object type: NULL terminated string + * @id: Endpoint object ID + * @interface_id: Interface ID; should be set for endpoints with multiple + * interfaces ("dpsw", "dpdmux"); for others, always set to 0 + */ +struct dprc_endpoint { + char type[16]; + int id; + int interface_id; +}; + +/** + * dprc_connect() - Connect two endpoints to create a network link between them + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @endpoint1: Endpoint 1 configuration parameters + * @endpoint2: Endpoint 2 configuration parameters + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_connect(struct fsl_mc_io *mc_io, + uint16_t token, + const struct dprc_endpoint *endpoint1, + const struct dprc_endpoint *endpoint2); + +/** + * dprc_disconnect() - Disconnect one endpoint to remove its network connection + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPRC object + * @endpoint: Endpoint configuration parameters + * + * Return: '0' on Success; Error code otherwise. + */ +int dprc_disconnect(struct fsl_mc_io *mc_io, + uint16_t token, + const struct dprc_endpoint *endpoint); + +/** +* dprc_get_connection() - Get connected endpoint and link status if connection +* exists. +* @mc_io Pointer to MC portal's I/O object +* @token Token of DPRC object +* @endpoint1 Endpoint 1 configuration parameters +* @endpoint2 Returned endpoint 2 configuration parameters +* @state: Returned link state: 1 - link is up, 0 - link is down +* +* Return: '0' on Success; -ENAVAIL if connection does not exist. +*/ +int dprc_get_connection(struct fsl_mc_io *mc_io, + uint16_t token, + const struct dprc_endpoint *endpoint1, + struct dprc_endpoint *endpoint2, + int *state); + +#endif /* _FSL_DPRC_H */ + diff --git a/drivers/staging/fsl-mc/include/mc-cmd.h b/drivers/staging/fsl-mc/include/mc-cmd.h new file mode 100644 index 000000000000..32501e020054 --- /dev/null +++ b/drivers/staging/fsl-mc/include/mc-cmd.h @@ -0,0 +1,113 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __FSL_MC_CMD_H +#define __FSL_MC_CMD_H + +#define MC_CMD_NUM_OF_PARAMS 7 + +#define MAKE_UMASK64(_width) \ + ((uint64_t)((_width) < 64 ? ((uint64_t)1 << (_width)) - 1 : -1)) + +static inline uint64_t mc_enc(int lsoffset, int width, uint64_t val) +{ + return (uint64_t)(((uint64_t)val & MAKE_UMASK64(width)) << lsoffset); +} + +static inline uint64_t mc_dec(uint64_t val, int lsoffset, int width) +{ + return (uint64_t)((val >> lsoffset) & MAKE_UMASK64(width)); +} + +struct mc_command { + uint64_t header; + uint64_t params[MC_CMD_NUM_OF_PARAMS]; +}; + +enum mc_cmd_status { + MC_CMD_STATUS_OK = 0x0, /* Completed successfully */ + MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */ + MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */ + MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */ + MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */ + MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */ + MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */ + MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */ + MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */ + MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */ + MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */ + MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */ +}; + +#define MC_CMD_HDR_CMDID_O 52 /* Command ID field offset */ +#define MC_CMD_HDR_CMDID_S 12 /* Command ID field size */ +#define MC_CMD_HDR_TOKEN_O 38 /* Token field offset */ +#define MC_CMD_HDR_TOKEN_S 10 /* Token field size */ +#define MC_CMD_HDR_STATUS_O 16 /* Status field offset */ +#define MC_CMD_HDR_STATUS_S 8 /* Status field size*/ +#define MC_CMD_HDR_PRI_O 15 /* Priority field offset */ +#define MC_CMD_HDR_PRI_S 1 /* Priority field size */ + +#define MC_CMD_HDR_READ_STATUS(_hdr) \ + ((enum mc_cmd_status)mc_dec((_hdr), \ + MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S)) + +#define MC_CMD_HDR_READ_TOKEN(_hdr) \ + ((uint16_t)mc_dec((_hdr), MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S)) + +#define MC_CMD_PRI_LOW 0 /* Low Priority command indication */ +#define MC_CMD_PRI_HIGH 1 /* High Priority command indication */ + +#define MC_EXT_OP(_ext, _param, _offset, _width, _type, _arg) \ + ((_ext)[_param] |= mc_enc((_offset), (_width), _arg)) + +#define MC_CMD_OP(_cmd, _param, _offset, _width, _type, _arg) \ + ((_cmd).params[_param] |= mc_enc((_offset), (_width), _arg)) + +#define MC_RSP_OP(_cmd, _param, _offset, _width, _type, _arg) \ + (_arg = (_type)mc_dec(_cmd.params[_param], (_offset), (_width))) + +static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id, + uint8_t priority, + uint16_t token) +{ + uint64_t hdr; + + hdr = mc_enc(MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S, cmd_id); + hdr |= mc_enc(MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S, token); + hdr |= mc_enc(MC_CMD_HDR_PRI_O, MC_CMD_HDR_PRI_S, priority); + hdr |= mc_enc(MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S, + MC_CMD_STATUS_READY); + + return hdr; +} + +#endif /* __FSL_MC_CMD_H */ diff --git a/drivers/staging/fsl-mc/include/mc-sys.h b/drivers/staging/fsl-mc/include/mc-sys.h new file mode 100644 index 000000000000..abfd6a233ada --- /dev/null +++ b/drivers/staging/fsl-mc/include/mc-sys.h @@ -0,0 +1,70 @@ +/* Copyright 2013-2014 Freescale Semiconductor Inc. + * + * Interface of the I/O services to send MC commands to the MC hardware + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _FSL_MC_SYS_H +#define _FSL_MC_SYS_H + +#include +#include +#include +#include + +struct mc_command; + +/** + * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command() + * @dev: device associated with this Mc I/O object + * @flags: flags for mc_send_command() + * @portal_size: MC command portal size in bytes + * @portal_phys_addr: MC command portal physical address + * @portal_virt_addr: MC command portal virtual address + */ +struct fsl_mc_io { + struct device *dev; + uint32_t flags; + uint32_t portal_size; + phys_addr_t portal_phys_addr; + void __iomem *portal_virt_addr; +}; + +int __must_check fsl_create_mc_io(struct device *dev, + phys_addr_t mc_portal_phys_addr, + uint32_t mc_portal_size, + uint32_t flags, struct fsl_mc_io **new_mc_io); + +void fsl_destroy_mc_io(struct fsl_mc_io *mc_io); + +int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); + +#endif /* _FSL_MC_SYS_H */ -- cgit v1.2.3 From bbf9d17d987544bd784fa0a6b99d756b0492e715 Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Thu, 5 Mar 2015 19:29:10 -0600 Subject: staging: fsl-mc: Freescale Management Complex (fsl-mc) bus driver Platform device driver that sets up the basic bus infrastructure for the fsl-mc bus type, including support for adding/removing fsl-mc devices, register/unregister of fsl-mc drivers, and bus match support to bind devices to drivers. Signed-off-by: J. German Rivera Signed-off-by: Stuart Yoder Acked-by: Alexander Graf Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/fsl-mc/Kconfig | 1 + drivers/staging/fsl-mc/Makefile | 2 + drivers/staging/fsl-mc/bus/Kconfig | 24 + drivers/staging/fsl-mc/bus/Makefile | 14 + drivers/staging/fsl-mc/bus/mc-bus.c | 755 ++++++++++++++++++++++++++++ drivers/staging/fsl-mc/include/mc-private.h | 67 +++ drivers/staging/fsl-mc/include/mc.h | 136 +++++ 9 files changed, 1002 insertions(+) create mode 100644 drivers/staging/fsl-mc/Kconfig create mode 100644 drivers/staging/fsl-mc/Makefile create mode 100644 drivers/staging/fsl-mc/bus/Kconfig create mode 100644 drivers/staging/fsl-mc/bus/Makefile create mode 100644 drivers/staging/fsl-mc/bus/mc-bus.c create mode 100644 drivers/staging/fsl-mc/include/mc-private.h create mode 100644 drivers/staging/fsl-mc/include/mc.h (limited to 'drivers/staging') diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 5da70fddd036..bfacf69f68f4 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -110,4 +110,6 @@ source "drivers/staging/fbtft/Kconfig" source "drivers/staging/i2o/Kconfig" +source "drivers/staging/fsl-mc/Kconfig" + endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 0b922ae30356..2bbd1bf04c55 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -47,3 +47,4 @@ obj-$(CONFIG_UNISYSSPAR) += unisys/ obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/ obj-$(CONFIG_FB_TFT) += fbtft/ obj-$(CONFIG_I2O) += i2o/ +obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/ diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig new file mode 100644 index 000000000000..32df07b15e09 --- /dev/null +++ b/drivers/staging/fsl-mc/Kconfig @@ -0,0 +1 @@ +source "drivers/staging/fsl-mc/bus/Kconfig" diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile new file mode 100644 index 000000000000..9c6a00128c65 --- /dev/null +++ b/drivers/staging/fsl-mc/Makefile @@ -0,0 +1,2 @@ +# Freescale Management Complex (MC) bus drivers +obj-$(CONFIG_FSL_MC_BUS) += bus/ diff --git a/drivers/staging/fsl-mc/bus/Kconfig b/drivers/staging/fsl-mc/bus/Kconfig new file mode 100644 index 000000000000..0d779d9ccbd8 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/Kconfig @@ -0,0 +1,24 @@ +# +# Freescale Management Complex (MC) bus drivers +# +# Copyright (C) 2014 Freescale Semiconductor, Inc. +# +# This file is released under the GPLv2 +# + +config FSL_MC_BUS + tristate "Freescale Management Complex (MC) bus driver" + depends on OF && ARM64 + help + Driver to enable the bus infrastructure for the Freescale + QorIQ Management Complex (fsl-mc). The fsl-mc is a hardware + module of the QorIQ LS2 SoCs, that does resource management + for hardware building-blocks in the SoC that can be used + to dynamically create networking hardware objects such as + network interfaces (NICs), crypto accelerator instances, + or L2 switches. + + Only enable this option when building the kernel for + Freescale QorQIQ LS2xxxx SoCs. + + diff --git a/drivers/staging/fsl-mc/bus/Makefile b/drivers/staging/fsl-mc/bus/Makefile new file mode 100644 index 000000000000..decd3390215d --- /dev/null +++ b/drivers/staging/fsl-mc/bus/Makefile @@ -0,0 +1,14 @@ +# +# Freescale Management Complex (MC) bus drivers +# +# Copyright (C) 2014 Freescale Semiconductor, Inc. +# +# This file is released under the GPLv2 +# +obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o + +mc-bus-driver-objs := mc-bus.o \ + mc-sys.o \ + dprc.o \ + dpmng.o + diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c new file mode 100644 index 000000000000..ce1de52bf030 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -0,0 +1,755 @@ +/* + * Freescale Management Complex (MC) bus driver + * + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Author: German Rivera + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include "../include/mc-private.h" +#include +#include +#include +#include +#include +#include +#include "../include/dpmng.h" +#include "../include/mc-sys.h" +#include "dprc-cmd.h" + +static struct kmem_cache *mc_dev_cache; + +/** + * fsl_mc_bus_match - device to driver matching callback + * @dev: the MC object device structure to match against + * @drv: the device driver to search for matching MC object device id + * structures + * + * Returns 1 on success, 0 otherwise. + */ +static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv) +{ + const struct fsl_mc_device_match_id *id; + struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); + struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(drv); + bool found = false; + + if (WARN_ON(!fsl_mc_bus_type.dev_root)) + goto out; + + if (!mc_drv->match_id_table) + goto out; + + /* + * If the object is not 'plugged' don't match. + * Only exception is the root DPRC, which is a special case. + */ + if ((mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED) == 0 && + &mc_dev->dev != fsl_mc_bus_type.dev_root) + goto out; + + /* + * Traverse the match_id table of the given driver, trying to find + * a matching for the given MC object device. + */ + for (id = mc_drv->match_id_table; id->vendor != 0x0; id++) { + if (id->vendor == mc_dev->obj_desc.vendor && + strcmp(id->obj_type, mc_dev->obj_desc.type) == 0 && + id->ver_major == mc_dev->obj_desc.ver_major && + id->ver_minor == mc_dev->obj_desc.ver_minor) { + found = true; + break; + } + } + +out: + dev_dbg(dev, "%smatched\n", found ? "" : "not "); + return found; +} + +/** + * fsl_mc_bus_uevent - callback invoked when a device is added + */ +static int fsl_mc_bus_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + pr_debug("%s invoked\n", __func__); + return 0; +} + +struct bus_type fsl_mc_bus_type = { + .name = "fsl-mc", + .match = fsl_mc_bus_match, + .uevent = fsl_mc_bus_uevent, +}; +EXPORT_SYMBOL_GPL(fsl_mc_bus_type); + +static int fsl_mc_driver_probe(struct device *dev) +{ + struct fsl_mc_driver *mc_drv; + struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); + int error; + + if (WARN_ON(!dev->driver)) + return -EINVAL; + + mc_drv = to_fsl_mc_driver(dev->driver); + if (WARN_ON(!mc_drv->probe)) + return -EINVAL; + + error = mc_drv->probe(mc_dev); + if (error < 0) { + dev_err(dev, "MC object device probe callback failed: %d\n", + error); + return error; + } + + return 0; +} + +static int fsl_mc_driver_remove(struct device *dev) +{ + struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver); + struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); + int error; + + if (WARN_ON(!dev->driver)) + return -EINVAL; + + error = mc_drv->remove(mc_dev); + if (error < 0) { + dev_err(dev, + "MC object device remove callback failed: %d\n", + error); + return error; + } + + return 0; +} + +static void fsl_mc_driver_shutdown(struct device *dev) +{ + struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver); + struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); + + mc_drv->shutdown(mc_dev); +} + +/** + * __fsl_mc_driver_register - registers a child device driver with the + * MC bus + * + * This function is implicitly invoked from the registration function of + * fsl_mc device drivers, which is generated by the + * module_fsl_mc_driver() macro. + */ +int __fsl_mc_driver_register(struct fsl_mc_driver *mc_driver, + struct module *owner) +{ + int error; + + mc_driver->driver.owner = owner; + mc_driver->driver.bus = &fsl_mc_bus_type; + + if (mc_driver->probe) + mc_driver->driver.probe = fsl_mc_driver_probe; + + if (mc_driver->remove) + mc_driver->driver.remove = fsl_mc_driver_remove; + + if (mc_driver->shutdown) + mc_driver->driver.shutdown = fsl_mc_driver_shutdown; + + error = driver_register(&mc_driver->driver); + if (error < 0) { + pr_err("driver_register() failed for %s: %d\n", + mc_driver->driver.name, error); + return error; + } + + pr_info("MC object device driver %s registered\n", + mc_driver->driver.name); + return 0; +} +EXPORT_SYMBOL_GPL(__fsl_mc_driver_register); + +/** + * fsl_mc_driver_unregister - unregisters a device driver from the + * MC bus + */ +void fsl_mc_driver_unregister(struct fsl_mc_driver *mc_driver) +{ + driver_unregister(&mc_driver->driver); +} +EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister); + +static int get_dprc_icid(struct fsl_mc_io *mc_io, + int container_id, uint16_t *icid) +{ + uint16_t dprc_handle; + struct dprc_attributes attr; + int error; + + error = dprc_open(mc_io, container_id, &dprc_handle); + if (error < 0) { + pr_err("dprc_open() failed: %d\n", error); + return error; + } + + memset(&attr, 0, sizeof(attr)); + error = dprc_get_attributes(mc_io, dprc_handle, &attr); + if (error < 0) { + pr_err("dprc_get_attributes() failed: %d\n", error); + goto common_cleanup; + } + + *icid = attr.icid; + error = 0; + +common_cleanup: + (void)dprc_close(mc_io, dprc_handle); + return error; +} + +static int translate_mc_addr(uint64_t mc_addr, phys_addr_t *phys_addr) +{ + int i; + struct fsl_mc *mc = dev_get_drvdata(fsl_mc_bus_type.dev_root->parent); + + if (mc->num_translation_ranges == 0) { + /* + * Do identity mapping: + */ + *phys_addr = mc_addr; + return 0; + } + + for (i = 0; i < mc->num_translation_ranges; i++) { + struct fsl_mc_addr_translation_range *range = + &mc->translation_ranges[i]; + + if (mc_addr >= range->start_mc_addr && + mc_addr < range->end_mc_addr) { + *phys_addr = range->start_phys_addr + + (mc_addr - range->start_mc_addr); + return 0; + } + } + + return -EFAULT; +} + +static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev, + struct fsl_mc_device *mc_bus_dev) +{ + int i; + int error; + struct resource *regions; + struct dprc_obj_desc *obj_desc = &mc_dev->obj_desc; + struct device *parent_dev = mc_dev->dev.parent; + + regions = kmalloc_array(obj_desc->region_count, + sizeof(regions[0]), GFP_KERNEL); + if (!regions) + return -ENOMEM; + + for (i = 0; i < obj_desc->region_count; i++) { + struct dprc_region_desc region_desc; + + error = dprc_get_obj_region(mc_bus_dev->mc_io, + mc_bus_dev->mc_handle, + obj_desc->type, + obj_desc->id, i, ®ion_desc); + if (error < 0) { + dev_err(parent_dev, + "dprc_get_obj_region() failed: %d\n", error); + goto error_cleanup_regions; + } + + WARN_ON(region_desc.base_paddr == 0x0); + WARN_ON(region_desc.size == 0); + error = translate_mc_addr(region_desc.base_paddr, + ®ions[i].start); + if (error < 0) { + dev_err(parent_dev, + "Invalid MC address: %#llx\n", + region_desc.base_paddr); + goto error_cleanup_regions; + } + + regions[i].end = regions[i].start + region_desc.size - 1; + regions[i].name = "fsl-mc object MMIO region"; + regions[i].flags = IORESOURCE_IO; + } + + mc_dev->regions = regions; + return 0; + +error_cleanup_regions: + kfree(regions); + return error; +} + +/** + * Add a newly discovered MC object device to be visible in Linux + */ +int fsl_mc_device_add(struct dprc_obj_desc *obj_desc, + struct fsl_mc_io *mc_io, + struct device *parent_dev, + struct fsl_mc_device **new_mc_dev) +{ + int error; + struct fsl_mc_device *mc_dev = NULL; + struct fsl_mc_bus *mc_bus = NULL; + struct fsl_mc_device *parent_mc_dev; + + if (parent_dev->bus == &fsl_mc_bus_type) + parent_mc_dev = to_fsl_mc_device(parent_dev); + else + parent_mc_dev = NULL; + + if (strcmp(obj_desc->type, "dprc") == 0) { + /* + * Allocate an MC bus device object: + */ + mc_bus = devm_kzalloc(parent_dev, sizeof(*mc_bus), GFP_KERNEL); + if (!mc_bus) + return -ENOMEM; + + mc_dev = &mc_bus->mc_dev; + } else { + /* + * Allocate a regular fsl_mc_device object: + */ + mc_dev = kmem_cache_zalloc(mc_dev_cache, GFP_KERNEL); + if (!mc_dev) + return -ENOMEM; + } + + mc_dev->obj_desc = *obj_desc; + mc_dev->mc_io = mc_io; + device_initialize(&mc_dev->dev); + mc_dev->dev.parent = parent_dev; + mc_dev->dev.bus = &fsl_mc_bus_type; + dev_set_name(&mc_dev->dev, "%s.%x", obj_desc->type, obj_desc->id); + + if (strcmp(obj_desc->type, "dprc") == 0) { + struct fsl_mc_io *mc_io2; + + mc_dev->flags |= FSL_MC_IS_DPRC; + + /* + * To get the DPRC's ICID, we need to open the DPRC + * in get_dprc_icid(). For child DPRCs, we do so using the + * parent DPRC's MC portal instead of the child DPRC's MC + * portal, in case the child DPRC is already opened with + * its own portal (e.g., the DPRC used by AIOP). + * + * NOTE: There cannot be more than one active open for a + * given MC object, using the same MC portal. + */ + if (parent_mc_dev) { + /* + * device being added is a child DPRC device + */ + mc_io2 = parent_mc_dev->mc_io; + } else { + /* + * device being added is the root DPRC device + */ + if (WARN_ON(!mc_io)) { + error = -EINVAL; + goto error_cleanup_dev; + } + + mc_io2 = mc_io; + + if (!fsl_mc_bus_type.dev_root) + fsl_mc_bus_type.dev_root = &mc_dev->dev; + } + + error = get_dprc_icid(mc_io2, obj_desc->id, &mc_dev->icid); + if (error < 0) + goto error_cleanup_dev; + } else { + /* + * A non-DPRC MC object device has to be a child of another + * MC object (specifically a DPRC object) + */ + mc_dev->icid = parent_mc_dev->icid; + mc_dev->dma_mask = FSL_MC_DEFAULT_DMA_MASK; + mc_dev->dev.dma_mask = &mc_dev->dma_mask; + } + + /* + * Get MMIO regions for the device from the MC: + * + * NOTE: the root DPRC is a special case as its MMIO region is + * obtained from the device tree + */ + if (parent_mc_dev && obj_desc->region_count != 0) { + error = fsl_mc_device_get_mmio_regions(mc_dev, + parent_mc_dev); + if (error < 0) + goto error_cleanup_dev; + } + + /* + * The device-specific probe callback will get invoked by device_add() + */ + error = device_add(&mc_dev->dev); + if (error < 0) { + dev_err(parent_dev, + "device_add() failed for device %s: %d\n", + dev_name(&mc_dev->dev), error); + goto error_cleanup_dev; + } + + (void)get_device(&mc_dev->dev); + dev_dbg(parent_dev, "Added MC object device %s\n", + dev_name(&mc_dev->dev)); + + *new_mc_dev = mc_dev; + return 0; + +error_cleanup_dev: + kfree(mc_dev->regions); + if (mc_bus) + devm_kfree(parent_dev, mc_bus); + else + kmem_cache_free(mc_dev_cache, mc_dev); + + return error; +} +EXPORT_SYMBOL_GPL(fsl_mc_device_add); + +/** + * fsl_mc_device_remove - Remove a MC object device from being visible to + * Linux + * + * @mc_dev: Pointer to a MC object device object + */ +void fsl_mc_device_remove(struct fsl_mc_device *mc_dev) +{ + struct fsl_mc_bus *mc_bus = NULL; + + kfree(mc_dev->regions); + + /* + * The device-specific remove callback will get invoked by device_del() + */ + device_del(&mc_dev->dev); + put_device(&mc_dev->dev); + + if (strcmp(mc_dev->obj_desc.type, "dprc") == 0) { + struct fsl_mc_io *mc_io = mc_dev->mc_io; + + mc_bus = to_fsl_mc_bus(mc_dev); + fsl_destroy_mc_io(mc_io); + if (&mc_dev->dev == fsl_mc_bus_type.dev_root) + fsl_mc_bus_type.dev_root = NULL; + } + + mc_dev->mc_io = NULL; + if (mc_bus) + devm_kfree(mc_dev->dev.parent, mc_bus); + else + kmem_cache_free(mc_dev_cache, mc_dev); +} +EXPORT_SYMBOL_GPL(fsl_mc_device_remove); + +static int parse_mc_ranges(struct device *dev, + int *paddr_cells, + int *mc_addr_cells, + int *mc_size_cells, + const __be32 **ranges_start, + uint8_t *num_ranges) +{ + const __be32 *prop; + int range_tuple_cell_count; + int ranges_len; + int tuple_len; + struct device_node *mc_node = dev->of_node; + + *ranges_start = of_get_property(mc_node, "ranges", &ranges_len); + if (!(*ranges_start) || !ranges_len) { + dev_warn(dev, + "missing or empty ranges property for device tree node '%s'\n", + mc_node->name); + + *num_ranges = 0; + return 0; + } + + *paddr_cells = of_n_addr_cells(mc_node); + + prop = of_get_property(mc_node, "#address-cells", NULL); + if (prop) + *mc_addr_cells = be32_to_cpup(prop); + else + *mc_addr_cells = *paddr_cells; + + prop = of_get_property(mc_node, "#size-cells", NULL); + if (prop) + *mc_size_cells = be32_to_cpup(prop); + else + *mc_size_cells = of_n_size_cells(mc_node); + + range_tuple_cell_count = *paddr_cells + *mc_addr_cells + + *mc_size_cells; + + tuple_len = range_tuple_cell_count * sizeof(__be32); + if (ranges_len % tuple_len != 0) { + dev_err(dev, "malformed ranges property '%s'\n", mc_node->name); + return -EINVAL; + } + + *num_ranges = ranges_len / tuple_len; + return 0; +} + +static int get_mc_addr_translation_ranges(struct device *dev, + struct fsl_mc_addr_translation_range + **ranges, + uint8_t *num_ranges) +{ + int error; + int paddr_cells; + int mc_addr_cells; + int mc_size_cells; + int i; + const __be32 *ranges_start; + const __be32 *cell; + + error = parse_mc_ranges(dev, + &paddr_cells, + &mc_addr_cells, + &mc_size_cells, + &ranges_start, + num_ranges); + if (error < 0) + return error; + + if (!(*num_ranges)) { + /* + * Missing or empty ranges property ("ranges;") for the + * 'fsl,qoriq-mc' node. In this case, identity mapping + * will be used. + */ + *ranges = NULL; + return 0; + } + + *ranges = devm_kcalloc(dev, *num_ranges, + sizeof(struct fsl_mc_addr_translation_range), + GFP_KERNEL); + if (!(*ranges)) + return -ENOMEM; + + cell = ranges_start; + for (i = 0; i < *num_ranges; ++i) { + struct fsl_mc_addr_translation_range *range = &(*ranges)[i]; + + range->start_mc_addr = of_read_number(cell, mc_addr_cells); + cell += mc_addr_cells; + range->start_phys_addr = of_read_number(cell, paddr_cells); + cell += paddr_cells; + range->end_mc_addr = range->start_mc_addr + + of_read_number(cell, mc_size_cells); + + cell += mc_size_cells; + } + + return 0; +} + +/** + * fsl_mc_bus_probe - callback invoked when the root MC bus is being + * added + */ +static int fsl_mc_bus_probe(struct platform_device *pdev) +{ + struct dprc_obj_desc obj_desc; + int error; + struct fsl_mc *mc; + struct fsl_mc_device *mc_bus_dev = NULL; + struct fsl_mc_io *mc_io = NULL; + int container_id; + phys_addr_t mc_portal_phys_addr; + uint32_t mc_portal_size; + struct mc_version mc_version; + struct resource res; + + dev_info(&pdev->dev, "Root MC bus device probed"); + + mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL); + if (!mc) + return -ENOMEM; + + platform_set_drvdata(pdev, mc); + + /* + * Get physical address of MC portal for the root DPRC: + */ + error = of_address_to_resource(pdev->dev.of_node, 0, &res); + if (error < 0) { + dev_err(&pdev->dev, + "of_address_to_resource() failed for %s\n", + pdev->dev.of_node->full_name); + return error; + } + + mc_portal_phys_addr = res.start; + mc_portal_size = resource_size(&res); + error = fsl_create_mc_io(&pdev->dev, mc_portal_phys_addr, + mc_portal_size, 0, &mc_io); + if (error < 0) + return error; + + error = mc_get_version(mc_io, &mc_version); + if (error != 0) { + dev_err(&pdev->dev, + "mc_get_version() failed with error %d\n", error); + goto error_cleanup_mc_io; + } + + dev_info(&pdev->dev, + "Freescale Management Complex Firmware version: %u.%u.%u\n", + mc_version.major, mc_version.minor, mc_version.revision); + + if (mc_version.major < MC_VER_MAJOR) { + dev_err(&pdev->dev, + "ERROR: MC firmware version not supported by driver (driver version: %u.%u)\n", + MC_VER_MAJOR, MC_VER_MINOR); + error = -ENOTSUPP; + goto error_cleanup_mc_io; + } + + if (mc_version.major > MC_VER_MAJOR) { + dev_warn(&pdev->dev, + "WARNING: driver may not support newer MC firmware features (driver version: %u.%u)\n", + MC_VER_MAJOR, MC_VER_MINOR); + } + + error = get_mc_addr_translation_ranges(&pdev->dev, + &mc->translation_ranges, + &mc->num_translation_ranges); + if (error < 0) + goto error_cleanup_mc_io; + + error = dpmng_get_container_id(mc_io, &container_id); + if (error < 0) { + dev_err(&pdev->dev, + "dpmng_get_container_id() failed: %d\n", error); + goto error_cleanup_mc_io; + } + + obj_desc.vendor = FSL_MC_VENDOR_FREESCALE; + strcpy(obj_desc.type, "dprc"); + obj_desc.id = container_id; + obj_desc.ver_major = DPRC_VER_MAJOR; + obj_desc.ver_minor = DPRC_VER_MINOR; + obj_desc.region_count = 0; + + error = fsl_mc_device_add(&obj_desc, mc_io, &pdev->dev, &mc_bus_dev); + if (error < 0) + goto error_cleanup_mc_io; + + mc->root_mc_bus_dev = mc_bus_dev; + return 0; + +error_cleanup_mc_io: + fsl_destroy_mc_io(mc_io); + return error; +} + +/** + * fsl_mc_bus_remove - callback invoked when the root MC bus is being + * removed + */ +static int fsl_mc_bus_remove(struct platform_device *pdev) +{ + struct fsl_mc *mc = platform_get_drvdata(pdev); + + if (WARN_ON(&mc->root_mc_bus_dev->dev != fsl_mc_bus_type.dev_root)) + return -EINVAL; + + fsl_mc_device_remove(mc->root_mc_bus_dev); + dev_info(&pdev->dev, "Root MC bus device removed"); + return 0; +} + +static const struct of_device_id fsl_mc_bus_match_table[] = { + {.compatible = "fsl,qoriq-mc",}, + {}, +}; + +MODULE_DEVICE_TABLE(of, fsl_mc_bus_match_table); + +static struct platform_driver fsl_mc_bus_driver = { + .driver = { + .name = "fsl_mc_bus", + .owner = THIS_MODULE, + .pm = NULL, + .of_match_table = fsl_mc_bus_match_table, + }, + .probe = fsl_mc_bus_probe, + .remove = fsl_mc_bus_remove, +}; + +static int __init fsl_mc_bus_driver_init(void) +{ + int error; + + mc_dev_cache = kmem_cache_create("fsl_mc_device", + sizeof(struct fsl_mc_device), 0, 0, + NULL); + if (!mc_dev_cache) { + pr_err("Could not create fsl_mc_device cache\n"); + return -ENOMEM; + } + + error = bus_register(&fsl_mc_bus_type); + if (error < 0) { + pr_err("fsl-mc bus type registration failed: %d\n", error); + goto error_cleanup_cache; + } + + pr_info("fsl-mc bus type registered\n"); + + error = platform_driver_register(&fsl_mc_bus_driver); + if (error < 0) { + pr_err("platform_driver_register() failed: %d\n", error); + goto error_cleanup_bus; + } + + return 0; + +error_cleanup_bus: + bus_unregister(&fsl_mc_bus_type); + +error_cleanup_cache: + kmem_cache_destroy(mc_dev_cache); + return error; +} + +postcore_initcall(fsl_mc_bus_driver_init); + +static void __exit fsl_mc_bus_driver_exit(void) +{ + if (WARN_ON(!mc_dev_cache)) + return; + + platform_driver_unregister(&fsl_mc_bus_driver); + bus_unregister(&fsl_mc_bus_type); + kmem_cache_destroy(mc_dev_cache); + pr_info("MC bus unregistered\n"); +} + +module_exit(fsl_mc_bus_driver_exit); + +MODULE_AUTHOR("Freescale Semiconductor Inc."); +MODULE_DESCRIPTION("Freescale Management Complex (MC) bus driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/fsl-mc/include/mc-private.h b/drivers/staging/fsl-mc/include/mc-private.h new file mode 100644 index 000000000000..5c957c452fdd --- /dev/null +++ b/drivers/staging/fsl-mc/include/mc-private.h @@ -0,0 +1,67 @@ +/* + * Freescale Management Complex (MC) bus private declarations + * + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Author: German Rivera + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ +#ifndef _FSL_MC_PRIVATE_H_ +#define _FSL_MC_PRIVATE_H_ + +#include "../include/mc.h" +#include +#include + +#define FSL_MC_DEVICE_MATCH(_mc_dev, _obj_desc) \ + (strcmp((_mc_dev)->obj_desc.type, (_obj_desc)->type) == 0 && \ + (_mc_dev)->obj_desc.id == (_obj_desc)->id) + +/** + * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device + * @root_mc_bus_dev: MC object device representing the root DPRC + * @addr_translation_ranges: array of bus to system address translation ranges + */ +struct fsl_mc { + struct fsl_mc_device *root_mc_bus_dev; + uint8_t num_translation_ranges; + struct fsl_mc_addr_translation_range *translation_ranges; +}; + +/** + * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC + * @mc_dev: fsl-mc device for the bus device itself. + * @scan_mutex: Serializes bus scanning + */ +struct fsl_mc_bus { + struct fsl_mc_device mc_dev; + struct mutex scan_mutex; /* serializes bus scanning */ +}; + +#define to_fsl_mc_bus(_mc_dev) \ + container_of(_mc_dev, struct fsl_mc_bus, mc_dev) + +/** + * struct fsl_mc_addr_translation_range - bus to system address translation + * range + * @start_mc_addr: Start MC address of the range being translated + * @end_mc_addr: MC address of the first byte after the range (last MC + * address of the range is end_mc_addr - 1) + * @start_phys_addr: system physical address corresponding to start_mc_addr + */ +struct fsl_mc_addr_translation_range { + uint64_t start_mc_addr; + uint64_t end_mc_addr; + phys_addr_t start_phys_addr; +}; + +int __must_check fsl_mc_device_add(struct dprc_obj_desc *obj_desc, + struct fsl_mc_io *mc_io, + struct device *parent_dev, + struct fsl_mc_device **new_mc_dev); + +void fsl_mc_device_remove(struct fsl_mc_device *mc_dev); + +#endif /* _FSL_MC_PRIVATE_H_ */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h new file mode 100644 index 000000000000..5cd237b31704 --- /dev/null +++ b/drivers/staging/fsl-mc/include/mc.h @@ -0,0 +1,136 @@ +/* + * Freescale Management Complex (MC) bus public interface + * + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Author: German Rivera + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ +#ifndef _FSL_MC_H_ +#define _FSL_MC_H_ + +#include +#include +#include +#include "../include/dprc.h" + +#define FSL_MC_VENDOR_FREESCALE 0x1957 + +struct fsl_mc_device; +struct fsl_mc_io; + +/** + * struct fsl_mc_driver - MC object device driver object + * @driver: Generic device driver + * @match_id_table: table of supported device matching Ids + * @probe: Function called when a device is added + * @remove: Function called when a device is removed + * @shutdown: Function called at shutdown time to quiesce the device + * @suspend: Function called when a device is stopped + * @resume: Function called when a device is resumed + * + * Generic DPAA device driver object for device drivers that are registered + * with a DPRC bus. This structure is to be embedded in each device-specific + * driver structure. + */ +struct fsl_mc_driver { + struct device_driver driver; + const struct fsl_mc_device_match_id *match_id_table; + int (*probe)(struct fsl_mc_device *dev); + int (*remove)(struct fsl_mc_device *dev); + void (*shutdown)(struct fsl_mc_device *dev); + int (*suspend)(struct fsl_mc_device *dev, pm_message_t state); + int (*resume)(struct fsl_mc_device *dev); +}; + +#define to_fsl_mc_driver(_drv) \ + container_of(_drv, struct fsl_mc_driver, driver) + +/** + * struct fsl_mc_device_match_id - MC object device Id entry for driver matching + * @vendor: vendor ID + * @obj_type: MC object type + * @ver_major: MC object version major number + * @ver_minor: MC object version minor number + * + * Type of entries in the "device Id" table for MC object devices supported by + * a MC object device driver. The last entry of the table has vendor set to 0x0 + */ +struct fsl_mc_device_match_id { + uint16_t vendor; + const char obj_type[16]; + uint32_t ver_major; + uint32_t ver_minor; +}; + +/** + * Bit masks for a MC object device (struct fsl_mc_device) flags + */ +#define FSL_MC_IS_DPRC 0x0001 + +/** + * Default DMA mask for devices on a fsl-mc bus + */ +#define FSL_MC_DEFAULT_DMA_MASK (~0ULL) + +/** + * struct fsl_mc_device - MC object device object + * @dev: Linux driver model device object + * @dma_mask: Default DMA mask + * @flags: MC object device flags + * @icid: Isolation context ID for the device + * @mc_handle: MC handle for the corresponding MC object opened + * @mc_io: Pointer to MC IO object assigned to this device or + * NULL if none. + * @obj_desc: MC description of the DPAA device + * @regions: pointer to array of MMIO region entries + * + * Generic device object for MC object devices that are "attached" to a + * MC bus. + * + * NOTES: + * - For a non-DPRC object its icid is the same as its parent DPRC's icid. + * - The SMMU notifier callback gets invoked after device_add() has been + * called for an MC object device, but before the device-specific probe + * callback gets called. + */ +struct fsl_mc_device { + struct device dev; + uint64_t dma_mask; + uint16_t flags; + uint16_t icid; + uint16_t mc_handle; + struct fsl_mc_io *mc_io; + struct dprc_obj_desc obj_desc; + struct resource *regions; +}; + +#define to_fsl_mc_device(_dev) \ + container_of(_dev, struct fsl_mc_device, dev) + +/* + * module_fsl_mc_driver() - Helper macro for drivers that don't do + * anything special in module init/exit. This eliminates a lot of + * boilerplate. Each module may only use this macro once, and + * calling it replaces module_init() and module_exit() + */ +#define module_fsl_mc_driver(__fsl_mc_driver) \ + module_driver(__fsl_mc_driver, fsl_mc_driver_register, \ + fsl_mc_driver_unregister) + +/* + * Macro to avoid include chaining to get THIS_MODULE + */ +#define fsl_mc_driver_register(drv) \ + __fsl_mc_driver_register(drv, THIS_MODULE) + +int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver, + struct module *owner); + +void fsl_mc_driver_unregister(struct fsl_mc_driver *driver); + +extern struct bus_type fsl_mc_bus_type; + +#endif /* _FSL_MC_H_ */ -- cgit v1.2.3 From f2f2726b62f59424782516fd6d0d164892493ada Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Thu, 5 Mar 2015 19:29:11 -0600 Subject: staging: fsl-mc: Device driver for FSL-MC DPRC devices A DPRC (Data Path Resource Container) is an isolation device that contains a set of DPAA networking devices to be assigned to an isolation domain (e.g., a virtual machine). Signed-off-by: J. German Rivera Signed-off-by: Stuart Yoder Acked-by: Alexander Graf Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/Makefile | 3 +- drivers/staging/fsl-mc/bus/dprc-driver.c | 384 ++++++++++++++++++++++++++++ drivers/staging/fsl-mc/bus/mc-bus.c | 8 + drivers/staging/fsl-mc/include/mc-private.h | 10 + 4 files changed, 404 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/fsl-mc/bus/dprc-driver.c (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/Makefile b/drivers/staging/fsl-mc/bus/Makefile index decd3390215d..424e58e1ea7e 100644 --- a/drivers/staging/fsl-mc/bus/Makefile +++ b/drivers/staging/fsl-mc/bus/Makefile @@ -10,5 +10,6 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o mc-bus-driver-objs := mc-bus.o \ mc-sys.o \ dprc.o \ - dpmng.o + dpmng.o \ + dprc-driver.o diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c new file mode 100644 index 000000000000..f5d1deb77c95 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -0,0 +1,384 @@ +/* + * Freescale data path resource container (DPRC) driver + * + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Author: German Rivera + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include "../include/mc-private.h" +#include "../include/mc-sys.h" +#include +#include +#include "dprc-cmd.h" + +struct dprc_child_objs { + int child_count; + struct dprc_obj_desc *child_array; +}; + +static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) +{ + int i; + struct dprc_child_objs *objs; + struct fsl_mc_device *mc_dev; + + WARN_ON(!dev); + WARN_ON(!data); + mc_dev = to_fsl_mc_device(dev); + objs = data; + + for (i = 0; i < objs->child_count; i++) { + struct dprc_obj_desc *obj_desc = &objs->child_array[i]; + + if (strlen(obj_desc->type) != 0 && + FSL_MC_DEVICE_MATCH(mc_dev, obj_desc)) + break; + } + + if (i == objs->child_count) + fsl_mc_device_remove(mc_dev); + + return 0; +} + +static int __fsl_mc_device_remove(struct device *dev, void *data) +{ + WARN_ON(!dev); + WARN_ON(data); + fsl_mc_device_remove(to_fsl_mc_device(dev)); + return 0; +} + +/** + * dprc_remove_devices - Removes devices for objects removed from a DPRC + * + * @mc_bus_dev: pointer to the fsl-mc device that represents a DPRC object + * @obj_desc_array: array of object descriptors for child objects currently + * present in the DPRC in the MC. + * @num_child_objects_in_mc: number of entries in obj_desc_array + * + * Synchronizes the state of the Linux bus driver with the actual state of + * the MC by removing devices that represent MC objects that have + * been dynamically removed in the physical DPRC. + */ +static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, + struct dprc_obj_desc *obj_desc_array, + int num_child_objects_in_mc) +{ + if (num_child_objects_in_mc != 0) { + /* + * Remove child objects that are in the DPRC in Linux, + * but not in the MC: + */ + struct dprc_child_objs objs; + + objs.child_count = num_child_objects_in_mc; + objs.child_array = obj_desc_array; + device_for_each_child(&mc_bus_dev->dev, &objs, + __fsl_mc_device_remove_if_not_in_mc); + } else { + /* + * There are no child objects for this DPRC in the MC. + * So, remove all the child devices from Linux: + */ + device_for_each_child(&mc_bus_dev->dev, NULL, + __fsl_mc_device_remove); + } +} + +static int __fsl_mc_device_match(struct device *dev, void *data) +{ + struct dprc_obj_desc *obj_desc = data; + struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); + + return FSL_MC_DEVICE_MATCH(mc_dev, obj_desc); +} + +static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc + *obj_desc, + struct fsl_mc_device + *mc_bus_dev) +{ + struct device *dev; + + dev = device_find_child(&mc_bus_dev->dev, obj_desc, + __fsl_mc_device_match); + + return dev ? to_fsl_mc_device(dev) : NULL; +} + +/** + * dprc_add_new_devices - Adds devices to the logical bus for a DPRC + * + * @mc_bus_dev: pointer to the fsl-mc device that represents a DPRC object + * @obj_desc_array: array of device descriptors for child devices currently + * present in the physical DPRC. + * @num_child_objects_in_mc: number of entries in obj_desc_array + * + * Synchronizes the state of the Linux bus driver with the actual + * state of the MC by adding objects that have been newly discovered + * in the physical DPRC. + */ +static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, + struct dprc_obj_desc *obj_desc_array, + int num_child_objects_in_mc) +{ + int error; + int i; + + for (i = 0; i < num_child_objects_in_mc; i++) { + struct fsl_mc_device *child_dev; + struct fsl_mc_io *mc_io = NULL; + struct dprc_obj_desc *obj_desc = &obj_desc_array[i]; + + if (strlen(obj_desc->type) == 0) + continue; + + /* + * Check if device is already known to Linux: + */ + child_dev = fsl_mc_device_lookup(obj_desc, mc_bus_dev); + if (child_dev) + continue; + + error = fsl_mc_device_add(obj_desc, mc_io, &mc_bus_dev->dev, + &child_dev); + if (error < 0) { + if (mc_io) + fsl_destroy_mc_io(mc_io); + + continue; + } + } +} + +/** + * dprc_scan_objects - Discover objects in a DPRC + * + * @mc_bus_dev: pointer to the fsl-mc device that represents a DPRC object + * + * Detects objects added and removed from a DPRC and synchronizes the + * state of the Linux bus driver, MC by adding and removing + * devices accordingly. + */ +int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev) +{ + int num_child_objects; + int dprc_get_obj_failures; + int error; + struct dprc_obj_desc *child_obj_desc_array = NULL; + + error = dprc_get_obj_count(mc_bus_dev->mc_io, + mc_bus_dev->mc_handle, + &num_child_objects); + if (error < 0) { + dev_err(&mc_bus_dev->dev, "dprc_get_obj_count() failed: %d\n", + error); + return error; + } + + if (num_child_objects != 0) { + int i; + + child_obj_desc_array = + devm_kmalloc_array(&mc_bus_dev->dev, num_child_objects, + sizeof(*child_obj_desc_array), + GFP_KERNEL); + if (!child_obj_desc_array) + return -ENOMEM; + + /* + * Discover objects currently present in the physical DPRC: + */ + dprc_get_obj_failures = 0; + for (i = 0; i < num_child_objects; i++) { + struct dprc_obj_desc *obj_desc = + &child_obj_desc_array[i]; + + error = dprc_get_obj(mc_bus_dev->mc_io, + mc_bus_dev->mc_handle, + i, obj_desc); + if (error < 0) { + dev_err(&mc_bus_dev->dev, + "dprc_get_obj(i=%d) failed: %d\n", + i, error); + /* + * Mark the obj entry as "invalid", by using the + * empty string as obj type: + */ + obj_desc->type[0] = '\0'; + obj_desc->id = error; + dprc_get_obj_failures++; + continue; + } + + dev_dbg(&mc_bus_dev->dev, + "Discovered object: type %s, id %d\n", + obj_desc->type, obj_desc->id); + } + + if (dprc_get_obj_failures != 0) { + dev_err(&mc_bus_dev->dev, + "%d out of %d devices could not be retrieved\n", + dprc_get_obj_failures, num_child_objects); + } + } + + dprc_remove_devices(mc_bus_dev, child_obj_desc_array, + num_child_objects); + + dprc_add_new_devices(mc_bus_dev, child_obj_desc_array, + num_child_objects); + + if (child_obj_desc_array) + devm_kfree(&mc_bus_dev->dev, child_obj_desc_array); + + return 0; +} +EXPORT_SYMBOL_GPL(dprc_scan_objects); + +/** + * dprc_scan_container - Scans a physical DPRC and synchronizes Linux bus state + * + * @mc_bus_dev: pointer to the fsl-mc device that represents a DPRC object + * + * Scans the physical DPRC and synchronizes the state of the Linux + * bus driver with the actual state of the MC by adding and removing + * devices as appropriate. + */ +int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) +{ + int error; + struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); + + /* + * Discover objects in the DPRC: + */ + mutex_lock(&mc_bus->scan_mutex); + error = dprc_scan_objects(mc_bus_dev); + mutex_unlock(&mc_bus->scan_mutex); + return error; +} +EXPORT_SYMBOL_GPL(dprc_scan_container); + +/** + * dprc_probe - callback invoked when a DPRC is being bound to this driver + * + * @mc_dev: Pointer to fsl-mc device representing a DPRC + * + * It opens the physical DPRC in the MC. + * It scans the DPRC to discover the MC objects contained in it. + */ +static int dprc_probe(struct fsl_mc_device *mc_dev) +{ + int error; + size_t region_size; + struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev); + + if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0)) + return -EINVAL; + + if (!mc_dev->mc_io) { + /* + * This is a child DPRC: + */ + if (WARN_ON(mc_dev->obj_desc.region_count == 0)) + return -EINVAL; + + region_size = mc_dev->regions[0].end - + mc_dev->regions[0].start + 1; + + error = fsl_create_mc_io(&mc_dev->dev, + mc_dev->regions[0].start, + region_size, + 0, &mc_dev->mc_io); + if (error < 0) + return error; + } + + error = dprc_open(mc_dev->mc_io, mc_dev->obj_desc.id, + &mc_dev->mc_handle); + if (error < 0) { + dev_err(&mc_dev->dev, "dprc_open() failed: %d\n", error); + goto error_cleanup_mc_io; + } + + mutex_init(&mc_bus->scan_mutex); + + /* + * Discover MC objects in DPRC object: + */ + error = dprc_scan_container(mc_dev); + if (error < 0) + goto error_cleanup_open; + + dev_info(&mc_dev->dev, "DPRC device bound to driver"); + return 0; + +error_cleanup_open: + (void)dprc_close(mc_dev->mc_io, mc_dev->mc_handle); + +error_cleanup_mc_io: + fsl_destroy_mc_io(mc_dev->mc_io); + return error; +} + +/** + * dprc_remove - callback invoked when a DPRC is being unbound from this driver + * + * @mc_dev: Pointer to fsl-mc device representing the DPRC + * + * It removes the DPRC's child objects from Linux (not from the MC) and + * closes the DPRC device in the MC. + */ +static int dprc_remove(struct fsl_mc_device *mc_dev) +{ + int error; + + if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0)) + return -EINVAL; + if (WARN_ON(!mc_dev->mc_io)) + return -EINVAL; + + device_for_each_child(&mc_dev->dev, NULL, __fsl_mc_device_remove); + error = dprc_close(mc_dev->mc_io, mc_dev->mc_handle); + if (error < 0) + dev_err(&mc_dev->dev, "dprc_close() failed: %d\n", error); + + dev_info(&mc_dev->dev, "DPRC device unbound from driver"); + return 0; +} + +static const struct fsl_mc_device_match_id match_id_table[] = { + { + .vendor = FSL_MC_VENDOR_FREESCALE, + .obj_type = "dprc", + .ver_major = DPRC_VER_MAJOR, + .ver_minor = DPRC_VER_MINOR}, + {.vendor = 0x0}, +}; + +static struct fsl_mc_driver dprc_driver = { + .driver = { + .name = FSL_MC_DPRC_DRIVER_NAME, + .owner = THIS_MODULE, + .pm = NULL, + }, + .match_id_table = match_id_table, + .probe = dprc_probe, + .remove = dprc_remove, +}; + +int __init dprc_driver_init(void) +{ + return fsl_mc_driver_register(&dprc_driver); +} + +void __exit dprc_driver_exit(void) +{ + fsl_mc_driver_unregister(&dprc_driver); +} diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index ce1de52bf030..72551e3c23b6 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -725,8 +725,15 @@ static int __init fsl_mc_bus_driver_init(void) goto error_cleanup_bus; } + error = dprc_driver_init(); + if (error < 0) + goto error_cleanup_driver; + return 0; +error_cleanup_driver: + platform_driver_unregister(&fsl_mc_bus_driver); + error_cleanup_bus: bus_unregister(&fsl_mc_bus_type); @@ -742,6 +749,7 @@ static void __exit fsl_mc_bus_driver_exit(void) if (WARN_ON(!mc_dev_cache)) return; + dprc_driver_exit(); platform_driver_unregister(&fsl_mc_bus_driver); bus_unregister(&fsl_mc_bus_type); kmem_cache_destroy(mc_dev_cache); diff --git a/drivers/staging/fsl-mc/include/mc-private.h b/drivers/staging/fsl-mc/include/mc-private.h index 5c957c452fdd..197544447404 100644 --- a/drivers/staging/fsl-mc/include/mc-private.h +++ b/drivers/staging/fsl-mc/include/mc-private.h @@ -15,6 +15,8 @@ #include #include +#define FSL_MC_DPRC_DRIVER_NAME "fsl_mc_dprc" + #define FSL_MC_DEVICE_MATCH(_mc_dev, _obj_desc) \ (strcmp((_mc_dev)->obj_desc.type, (_obj_desc)->type) == 0 && \ (_mc_dev)->obj_desc.id == (_obj_desc)->id) @@ -64,4 +66,12 @@ int __must_check fsl_mc_device_add(struct dprc_obj_desc *obj_desc, void fsl_mc_device_remove(struct fsl_mc_device *mc_dev); +int dprc_scan_container(struct fsl_mc_device *mc_bus_dev); + +int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev); + +int __init dprc_driver_init(void); + +void __exit dprc_driver_exit(void); + #endif /* _FSL_MC_PRIVATE_H_ */ -- cgit v1.2.3 From 197f4d6a4a00915b29fa7ec71f8010b9c763e676 Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Thu, 5 Mar 2015 19:35:25 -0600 Subject: staging: fsl-mc: fsl-mc object allocator driver The fsl-mc object allocator driver manages "allocatable" fsl-mc objects such as DPBPs, DPMCPs and DPCONs. It provides services to other fsl-mc drivers to allocate/deallocate these types of objects. Signed-off-by: J. German Rivera Signed-off-by: Stuart Yoder Acked-by: Alexander Graf Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/Makefile | 6 +- drivers/staging/fsl-mc/bus/dpbp.c | 358 +++++++++++++++++ drivers/staging/fsl-mc/bus/dpmcp-cmd.h | 136 +++++++ drivers/staging/fsl-mc/bus/dpmcp.c | 308 +++++++++++++++ drivers/staging/fsl-mc/bus/dpmcp.h | 311 +++++++++++++++ drivers/staging/fsl-mc/bus/dprc-driver.c | 104 ++++- drivers/staging/fsl-mc/bus/mc-allocator.c | 569 ++++++++++++++++++++++++++++ drivers/staging/fsl-mc/bus/mc-bus.c | 2 +- drivers/staging/fsl-mc/bus/mc-sys.c | 4 + drivers/staging/fsl-mc/include/dpbp-cmd.h | 60 +++ drivers/staging/fsl-mc/include/dpbp.h | 330 ++++++++++++++++ drivers/staging/fsl-mc/include/dpcon-cmd.h | 62 +++ drivers/staging/fsl-mc/include/mc-private.h | 61 ++- drivers/staging/fsl-mc/include/mc-sys.h | 6 + drivers/staging/fsl-mc/include/mc.h | 65 ++++ 15 files changed, 2366 insertions(+), 16 deletions(-) create mode 100644 drivers/staging/fsl-mc/bus/dpbp.c create mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h create mode 100644 drivers/staging/fsl-mc/bus/dpmcp.c create mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h create mode 100644 drivers/staging/fsl-mc/bus/mc-allocator.c create mode 100644 drivers/staging/fsl-mc/include/dpbp-cmd.h create mode 100644 drivers/staging/fsl-mc/include/dpbp.h create mode 100644 drivers/staging/fsl-mc/include/dpcon-cmd.h (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/Makefile b/drivers/staging/fsl-mc/bus/Makefile index 424e58e1ea7e..bd09fc8cf650 100644 --- a/drivers/staging/fsl-mc/bus/Makefile +++ b/drivers/staging/fsl-mc/bus/Makefile @@ -5,7 +5,8 @@ # # This file is released under the GPLv2 # -obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o +obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o \ + mc-allocator-driver.o mc-bus-driver-objs := mc-bus.o \ mc-sys.o \ @@ -13,3 +14,6 @@ mc-bus-driver-objs := mc-bus.o \ dpmng.o \ dprc-driver.o +mc-allocator-driver-objs := mc-allocator.o \ + dpmcp.o \ + dpbp.o diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c new file mode 100644 index 000000000000..d99ab6d0bbb1 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -0,0 +1,358 @@ +/* Copyright 2013-2014 Freescale Semiconductor Inc. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the above-listed copyright holders nor the +* names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* +* ALTERNATIVELY, this software may be distributed under the terms of the +* GNU General Public License ("GPL") as published by the Free Software +* Foundation, either version 2 of that License or (at your option) any +* later version. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ +#include "../include/mc-sys.h" +#include "../include/mc-cmd.h" +#include "../include/dpbp.h" +#include "../include/dpbp-cmd.h" + +int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN, + MC_CMD_PRI_LOW, 0); + cmd.params[0] |= mc_enc(0, 32, dpbp_id); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *token = MC_CMD_HDR_READ_TOKEN(cmd.header); + + return err; +} +EXPORT_SYMBOL(dpbp_open); + +int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, MC_CMD_PRI_HIGH, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} +EXPORT_SYMBOL(dpbp_close); + +int dpbp_create(struct fsl_mc_io *mc_io, + const struct dpbp_cfg *cfg, + uint16_t *token) +{ + struct mc_command cmd = { 0 }; + int err; + + (void)(cfg); /* unused */ + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_CREATE, + MC_CMD_PRI_LOW, 0); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *token = MC_CMD_HDR_READ_TOKEN(cmd.header); + + return 0; +} + +int dpbp_destroy(struct fsl_mc_io *mc_io, uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_DESTROY, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, MC_CMD_PRI_LOW, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} +EXPORT_SYMBOL(dpbp_enable); + +int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} +EXPORT_SYMBOL(dpbp_disable); + +int dpbp_is_enabled(struct fsl_mc_io *mc_io, uint16_t token, int *en) +{ + struct mc_command cmd = { 0 }; + int err; + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, MC_CMD_PRI_LOW, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *en = (int)mc_dec(cmd.params[0], 0, 1); + + return 0; +} + +int dpbp_reset(struct fsl_mc_io *mc_io, uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_set_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint64_t irq_paddr, + uint32_t irq_val, + int user_irq_id) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 8, irq_index); + cmd.params[0] |= mc_enc(32, 32, irq_val); + cmd.params[1] |= mc_enc(0, 64, irq_paddr); + cmd.params[2] |= mc_enc(0, 32, user_irq_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_get_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + int *type, + uint64_t *irq_paddr, + uint32_t *irq_val, + int *user_irq_id) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *irq_val = (uint32_t)mc_dec(cmd.params[0], 0, 32); + *irq_paddr = (uint64_t)mc_dec(cmd.params[1], 0, 64); + *user_irq_id = (int)mc_dec(cmd.params[2], 0, 32); + *type = (int)mc_dec(cmd.params[2], 32, 32); + return 0; +} + +int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t en) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ_ENABLE, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 8, en); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t *en) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_ENABLE, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *en = (uint8_t)mc_dec(cmd.params[0], 0, 8); + return 0; +} + +int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t mask) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ_MASK, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, mask); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *mask) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_MASK, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *mask = (uint32_t)mc_dec(cmd.params[0], 0, 32); + return 0; +} + +int dpbp_get_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *status) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_STATUS, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *status = (uint32_t)mc_dec(cmd.params[0], 0, 32); + return 0; +} + +int dpbp_clear_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t status) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLEAR_IRQ_STATUS, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, status); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_get_attributes(struct fsl_mc_io *mc_io, + uint16_t token, + struct dpbp_attr *attr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + attr->bpid = (uint16_t)mc_dec(cmd.params[0], 16, 16); + attr->id = (int)mc_dec(cmd.params[0], 32, 32); + attr->version.major = (uint16_t)mc_dec(cmd.params[1], 0, 16); + attr->version.minor = (uint16_t)mc_dec(cmd.params[1], 16, 16); + return 0; +} +EXPORT_SYMBOL(dpbp_get_attributes); diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h new file mode 100644 index 000000000000..57f326b60b76 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h @@ -0,0 +1,136 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _FSL_DPMCP_CMD_H +#define _FSL_DPMCP_CMD_H + +/* DPMCP Version */ +#define DPMCP_VER_MAJOR 2 +#define DPMCP_VER_MINOR 0 + +/* Command IDs */ +#define DPMCP_CMDID_CLOSE 0x800 +#define DPMCP_CMDID_OPEN 0x80b +#define DPMCP_CMDID_CREATE 0x90b +#define DPMCP_CMDID_DESTROY 0x900 + +#define DPMCP_CMDID_GET_ATTR 0x004 +#define DPMCP_CMDID_RESET 0x005 + +#define DPMCP_CMDID_SET_IRQ 0x010 +#define DPMCP_CMDID_GET_IRQ 0x011 +#define DPMCP_CMDID_SET_IRQ_ENABLE 0x012 +#define DPMCP_CMDID_GET_IRQ_ENABLE 0x013 +#define DPMCP_CMDID_SET_IRQ_MASK 0x014 +#define DPMCP_CMDID_GET_IRQ_MASK 0x015 +#define DPMCP_CMDID_GET_IRQ_STATUS 0x016 +#define DPMCP_CMDID_CLEAR_IRQ_STATUS 0x017 + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_CMD_CREATE(cmd, cfg) \ + MC_CMD_OP(cmd, 0, 0, 32, int, cfg->portal_id) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_CMD_SET_IRQ(cmd, irq_index, irq_addr, irq_val, user_irq_id) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 8, uint8_t, irq_index);\ + MC_CMD_OP(cmd, 0, 32, 32, uint32_t, irq_val);\ + MC_CMD_OP(cmd, 1, 0, 64, uint64_t, irq_addr); \ + MC_CMD_OP(cmd, 2, 0, 32, int, user_irq_id); \ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_CMD_GET_IRQ(cmd, irq_index) \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_RSP_GET_IRQ(cmd, type, irq_addr, irq_val, user_irq_id) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, irq_val); \ + MC_RSP_OP(cmd, 1, 0, 64, uint64_t, irq_addr); \ + MC_RSP_OP(cmd, 2, 0, 32, int, user_irq_id); \ + MC_RSP_OP(cmd, 2, 32, 32, int, type); \ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_CMD_SET_IRQ_ENABLE(cmd, irq_index, en) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 8, uint8_t, en); \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_CMD_GET_IRQ_ENABLE(cmd, irq_index) \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_RSP_GET_IRQ_ENABLE(cmd, en) \ + MC_RSP_OP(cmd, 0, 0, 8, uint8_t, en) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_CMD_SET_IRQ_MASK(cmd, irq_index, mask) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 32, uint32_t, mask);\ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_CMD_GET_IRQ_MASK(cmd, irq_index) \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_RSP_GET_IRQ_MASK(cmd, mask) \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, mask) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_CMD_GET_IRQ_STATUS(cmd, irq_index) \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_RSP_GET_IRQ_STATUS(cmd, status) \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, status) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_CMD_CLEAR_IRQ_STATUS(cmd, irq_index, status) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 32, uint32_t, status); \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMCP_RSP_GET_ATTRIBUTES(cmd, attr) \ +do { \ + MC_RSP_OP(cmd, 0, 32, 32, int, attr->id);\ + MC_RSP_OP(cmd, 1, 0, 16, uint16_t, attr->version.major);\ + MC_RSP_OP(cmd, 1, 16, 16, uint16_t, attr->version.minor);\ +} while (0) + +#endif /* _FSL_DPMCP_CMD_H */ diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/staging/fsl-mc/bus/dpmcp.c new file mode 100644 index 000000000000..6b9da5b7fd00 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dpmcp.c @@ -0,0 +1,308 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "../include/mc-sys.h" +#include "../include/mc-cmd.h" +#include "dpmcp.h" +#include "dpmcp-cmd.h" + +int dpmcp_open(struct fsl_mc_io *mc_io, int dpmcp_id, uint16_t *token) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_OPEN, + MC_CMD_PRI_LOW, 0); + cmd.params[0] |= mc_enc(0, 32, dpmcp_id); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *token = MC_CMD_HDR_READ_TOKEN(cmd.header); + + return err; +} + +int dpmcp_close(struct fsl_mc_io *mc_io, uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CLOSE, MC_CMD_PRI_HIGH, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpmcp_create(struct fsl_mc_io *mc_io, + const struct dpmcp_cfg *cfg, + uint16_t *token) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CREATE, + MC_CMD_PRI_LOW, 0); + cmd.params[0] |= mc_enc(0, 32, cfg->portal_id); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *token = MC_CMD_HDR_READ_TOKEN(cmd.header); + + return 0; +} + +int dpmcp_destroy(struct fsl_mc_io *mc_io, uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_DESTROY, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpmcp_reset(struct fsl_mc_io *mc_io, uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_RESET, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpmcp_set_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint64_t irq_addr, + uint32_t irq_val, + int user_irq_id) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_SET_IRQ, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 8, irq_index); + cmd.params[0] |= mc_enc(32, 32, irq_val); + cmd.params[1] |= mc_enc(0, 64, irq_addr); + cmd.params[2] |= mc_enc(0, 32, user_irq_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpmcp_get_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + int *type, + uint64_t *irq_addr, + uint32_t *irq_val, + int *user_irq_id) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_IRQ, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *irq_val = (uint32_t)mc_dec(cmd.params[0], 0, 32); + *irq_addr = (uint64_t)mc_dec(cmd.params[1], 0, 64); + *user_irq_id = (int)mc_dec(cmd.params[2], 0, 32); + *type = (int)mc_dec(cmd.params[2], 32, 32); + return 0; +} + +int dpmcp_set_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t en) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_SET_IRQ_ENABLE, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 8, en); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpmcp_get_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t *en) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_IRQ_ENABLE, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *en = (uint8_t)mc_dec(cmd.params[0], 0, 8); + return 0; +} + +int dpmcp_set_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t mask) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_SET_IRQ_MASK, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, mask); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpmcp_get_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *mask) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_IRQ_MASK, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *mask = (uint32_t)mc_dec(cmd.params[0], 0, 32); + return 0; +} + +int dpmcp_get_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *status) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_IRQ_STATUS, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *status = (uint32_t)mc_dec(cmd.params[0], 0, 32); + return 0; +} + +int dpmcp_clear_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t status) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CLEAR_IRQ_STATUS, + MC_CMD_PRI_LOW, token); + cmd.params[0] |= mc_enc(0, 32, status); + cmd.params[0] |= mc_enc(32, 8, irq_index); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpmcp_get_attributes(struct fsl_mc_io *mc_io, + uint16_t token, + struct dpmcp_attr *attr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_ATTR, + MC_CMD_PRI_LOW, token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + attr->id = (int)mc_dec(cmd.params[0], 32, 32); + attr->version.major = (uint16_t)mc_dec(cmd.params[1], 0, 16); + attr->version.minor = (uint16_t)mc_dec(cmd.params[1], 16, 16); + return 0; +} diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h b/drivers/staging/fsl-mc/bus/dpmcp.h new file mode 100644 index 000000000000..5e7c21952ce5 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/dpmcp.h @@ -0,0 +1,311 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __FSL_DPMCP_H +#define __FSL_DPMCP_H + +/* Data Path Management Command Portal API + * Contains initialization APIs and runtime control APIs for DPMCP + */ + +struct fsl_mc_io; + +/** + * dpmcp_open() - Open a control session for the specified object. + * @mc_io: Pointer to MC portal's I/O object + * @dpmcp_id: DPMCP unique ID + * @token: Returned token; use in subsequent API calls + * + * This function can be used to open a control session for an + * already created object; an object may have been declared in + * the DPL or by calling the dpmcp_create function. + * This function returns a unique authentication token, + * associated with the specific object ID and the specific MC + * portal; this token must be used in all subsequent commands for + * this specific object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_open(struct fsl_mc_io *mc_io, int dpmcp_id, uint16_t *token); + +/* Get portal ID from pool */ +#define DPMCP_GET_PORTAL_ID_FROM_POOL (-1) + +/** + * dpmcp_close() - Close the control session of the object + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * + * After this function is called, no further operations are + * allowed on the object without opening a new control session. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_close(struct fsl_mc_io *mc_io, uint16_t token); + +/** + * struct dpmcp_cfg() - Structure representing DPMCP configuration + * @portal_id: Portal ID; 'DPMCP_GET_PORTAL_ID_FROM_POOL' to get the portal ID + * from pool + */ +struct dpmcp_cfg { + int portal_id; +}; + +/** + * dpmcp_create() - Create the DPMCP object. + * @mc_io: Pointer to MC portal's I/O object + * @cfg: Configuration structure + * @token: Returned token; use in subsequent API calls + * + * Create the DPMCP object, allocate required resources and + * perform required initialization. + * + * The object can be created either by declaring it in the + * DPL file, or by calling this function. + * This function returns a unique authentication token, + * associated with the specific object ID and the specific MC + * portal; this token must be used in all subsequent calls to + * this specific object. For objects that are created using the + * DPL file, call dpmcp_open function to get an authentication + * token first. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_create(struct fsl_mc_io *mc_io, + const struct dpmcp_cfg *cfg, + uint16_t *token); + +/** + * dpmcp_destroy() - Destroy the DPMCP object and release all its resources. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * + * Return: '0' on Success; error code otherwise. + */ +int dpmcp_destroy(struct fsl_mc_io *mc_io, uint16_t token); + +/** + * dpmcp_reset() - Reset the DPMCP, returns the object to initial state. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_reset(struct fsl_mc_io *mc_io, uint16_t token); + +/* IRQ */ +/*! + * @name dpmcp IRQ Index and Events + */ +#define DPMCP_IRQ_INDEX 0 +/*!< Irq index */ +#define DPMCP_IRQ_EVENT_CMD_DONE 0x00000001 +/*!< irq event - Indicates that the link state changed */ +/* @} */ + +/** + * dpmcp_set_irq() - Set IRQ information for the DPMCP to trigger an interrupt. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * @irq_index: Identifies the interrupt index to configure + * @irq_addr: Address that must be written to + * signal a message-based interrupt + * @irq_val: Value to write into irq_addr address + * @user_irq_id: A user defined number associated with this IRQ + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_set_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint64_t irq_addr, + uint32_t irq_val, + int user_irq_id); + +/** + * dpmcp_get_irq() - Get IRQ information from the DPMCP. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * @irq_index: The interrupt index to configure + * @type: Interrupt type: 0 represents message interrupt + * type (both irq_addr and irq_val are valid) + * @irq_addr: Returned address that must be written to + * signal the message-based interrupt + * @irq_val: Value to write into irq_addr address + * @user_irq_id: A user defined number associated with this IRQ + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_get_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + int *type, + uint64_t *irq_addr, + uint32_t *irq_val, + int *user_irq_id); + +/** + * dpmcp_set_irq_enable() - Set overall interrupt state. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * @irq_index: The interrupt index to configure + * @en: Interrupt state - enable = 1, disable = 0 + * + * Allows GPP software to control when interrupts are generated. + * Each interrupt can have up to 32 causes. The enable/disable control's the + * overall interrupt state. if the interrupt is disabled no causes will cause + * an interrupt. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_set_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t en); + +/** + * dpmcp_get_irq_enable() - Get overall interrupt state + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * @irq_index: The interrupt index to configure + * @en: Returned interrupt state - enable = 1, disable = 0 + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_get_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t *en); + +/** + * dpmcp_set_irq_mask() - Set interrupt mask. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * @irq_index: The interrupt index to configure + * @mask: Event mask to trigger interrupt; + * each bit: + * 0 = ignore event + * 1 = consider event for asserting IRQ + * + * Every interrupt can have up to 32 causes and the interrupt model supports + * masking/unmasking each cause independently + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_set_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t mask); + +/** + * dpmcp_get_irq_mask() - Get interrupt mask. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * @irq_index: The interrupt index to configure + * @mask: Returned event mask to trigger interrupt + * + * Every interrupt can have up to 32 causes and the interrupt model supports + * masking/unmasking each cause independently + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_get_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *mask); + +/** + * dpmcp_get_irq_status() - Get the current status of any pending interrupts. + * + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * @irq_index: The interrupt index to configure + * @status: Returned interrupts status - one bit per cause: + * 0 = no interrupt pending + * 1 = interrupt pending + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_get_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *status); + +/** + * dpmcp_clear_irq_status() - Clear a pending interrupt's status + * + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * @irq_index: The interrupt index to configure + * @status: Bits to clear (W1C) - one bit per cause: + * 0 = don't change + * 1 = clear status bit + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_clear_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t status); + +/** + * struct dpmcp_attr - Structure representing DPMCP attributes + * @id: DPMCP object ID + * @version: DPMCP version + */ +struct dpmcp_attr { + int id; + /** + * struct version - Structure representing DPMCP version + * @major: DPMCP major version + * @minor: DPMCP minor version + */ + struct { + uint16_t major; + uint16_t minor; + } version; +}; + +/** + * dpmcp_get_attributes - Retrieve DPMCP attributes. + * + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPMCP object + * @attr: Returned object's attributes + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmcp_get_attributes(struct fsl_mc_io *mc_io, + uint16_t token, + struct dpmcp_attr *attr); + +#endif /* __FSL_DPMCP_H */ diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index f5d1deb77c95..65de1d758a56 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -156,6 +156,85 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, } } +static void dprc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev) +{ + int pool_type; + struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); + + for (pool_type = 0; pool_type < FSL_MC_NUM_POOL_TYPES; pool_type++) { + struct fsl_mc_resource_pool *res_pool = + &mc_bus->resource_pools[pool_type]; + + res_pool->type = pool_type; + res_pool->max_count = 0; + res_pool->free_count = 0; + res_pool->mc_bus = mc_bus; + INIT_LIST_HEAD(&res_pool->free_list); + mutex_init(&res_pool->mutex); + } +} + +static void dprc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev, + enum fsl_mc_pool_type pool_type) +{ + struct fsl_mc_resource *resource; + struct fsl_mc_resource *next; + struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); + struct fsl_mc_resource_pool *res_pool = + &mc_bus->resource_pools[pool_type]; + int free_count = 0; + + WARN_ON(res_pool->type != pool_type); + WARN_ON(res_pool->free_count != res_pool->max_count); + + list_for_each_entry_safe(resource, next, &res_pool->free_list, node) { + free_count++; + WARN_ON(resource->type != res_pool->type); + WARN_ON(resource->parent_pool != res_pool); + devm_kfree(&mc_bus_dev->dev, resource); + } + + WARN_ON(free_count != res_pool->free_count); +} + +static void dprc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev) +{ + int pool_type; + + for (pool_type = 0; pool_type < FSL_MC_NUM_POOL_TYPES; pool_type++) + dprc_cleanup_resource_pool(mc_bus_dev, pool_type); +} + +static void reorder_obj_desc_array(struct dprc_obj_desc *obj_desc_array, + int num_devs) +{ + struct dprc_obj_desc tmp; + struct dprc_obj_desc *top_cursor = &obj_desc_array[0]; + struct dprc_obj_desc *bottom_cursor = &obj_desc_array[num_devs - 1]; + + /* + * Reorder entries in obj_desc_array so that all allocatable devices + * are placed before all non-allocatable devices: + * + * Loop Invariant: everything before top_cursor is allocatable and + * everything after bottom_cursor is non-allocatable. + */ + while (top_cursor < bottom_cursor) { + if (FSL_MC_IS_ALLOCATABLE(top_cursor->type)) { + top_cursor++; + } else { + if (FSL_MC_IS_ALLOCATABLE(bottom_cursor->type)) { + tmp = *bottom_cursor; + *bottom_cursor = *top_cursor; + *top_cursor = tmp; + top_cursor++; + } + + bottom_cursor--; + } + } +} + /** * dprc_scan_objects - Discover objects in a DPRC * @@ -164,6 +243,14 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, * Detects objects added and removed from a DPRC and synchronizes the * state of the Linux bus driver, MC by adding and removing * devices accordingly. + * Two types of devices can be found in a DPRC: allocatable objects (e.g., + * dpbp, dpmcp) and non-allocatable devices (e.g., dprc, dpni). + * All allocatable devices needed to be probed before all non-allocatable + * devices, to ensure that device drivers for non-allocatable + * devices can allocate any type of allocatable devices. + * That is, we need to ensure that the corresponding resource pools are + * populated before they can get allocation requests from probe callbacks + * of the device drivers for the non-allocatable devices. */ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev) { @@ -226,6 +313,8 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev) "%d out of %d devices could not be retrieved\n", dprc_get_obj_failures, num_child_objects); } + + reorder_obj_desc_array(child_obj_desc_array, num_child_objects); } dprc_remove_devices(mc_bus_dev, child_obj_desc_array, @@ -255,12 +344,20 @@ int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) int error; struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); + dprc_init_all_resource_pools(mc_bus_dev); + /* * Discover objects in the DPRC: */ mutex_lock(&mc_bus->scan_mutex); error = dprc_scan_objects(mc_bus_dev); mutex_unlock(&mc_bus->scan_mutex); + if (error < 0) + goto error; + + return 0; +error: + dprc_cleanup_all_resource_pools(mc_bus_dev); return error; } EXPORT_SYMBOL_GPL(dprc_scan_container); @@ -272,6 +369,8 @@ EXPORT_SYMBOL_GPL(dprc_scan_container); * * It opens the physical DPRC in the MC. * It scans the DPRC to discover the MC objects contained in it. + * It creates the interrupt pool for the MC bus associated with the DPRC. + * It configures the interrupts for the DPRC device itself. */ static int dprc_probe(struct fsl_mc_device *mc_dev) { @@ -295,7 +394,7 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) error = fsl_create_mc_io(&mc_dev->dev, mc_dev->regions[0].start, region_size, - 0, &mc_dev->mc_io); + NULL, 0, &mc_dev->mc_io); if (error < 0) return error; } @@ -334,6 +433,8 @@ error_cleanup_mc_io: * * It removes the DPRC's child objects from Linux (not from the MC) and * closes the DPRC device in the MC. + * It tears down the interrupts that were configured for the DPRC device. + * It destroys the interrupt pool associated with this MC bus. */ static int dprc_remove(struct fsl_mc_device *mc_dev) { @@ -345,6 +446,7 @@ static int dprc_remove(struct fsl_mc_device *mc_dev) return -EINVAL; device_for_each_child(&mc_dev->dev, NULL, __fsl_mc_device_remove); + dprc_cleanup_all_resource_pools(mc_dev); error = dprc_close(mc_dev->mc_io, mc_dev->mc_handle); if (error < 0) dev_err(&mc_dev->dev, "dprc_close() failed: %d\n", error); diff --git a/drivers/staging/fsl-mc/bus/mc-allocator.c b/drivers/staging/fsl-mc/bus/mc-allocator.c new file mode 100644 index 000000000000..cc4a7d316990 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/mc-allocator.c @@ -0,0 +1,569 @@ +/* + * Freescale MC object device allocator driver + * + * Copyright (C) 2013 Freescale Semiconductor, Inc. + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include "../include/mc-private.h" +#include "../include/mc-sys.h" +#include +#include "../include/dpbp-cmd.h" +#include "../include/dpcon-cmd.h" +#include "dpmcp-cmd.h" +#include "dpmcp.h" + +/** + * fsl_mc_resource_pool_add_device - add allocatable device to a resource + * pool of a given MC bus + * + * @mc_bus: pointer to the MC bus + * @pool_type: MC bus pool type + * @mc_dev: Pointer to allocatable MC object device + * + * It adds an allocatable MC object device to a container's resource pool of + * the given resource type + */ +static int __must_check fsl_mc_resource_pool_add_device(struct fsl_mc_bus + *mc_bus, + enum fsl_mc_pool_type + pool_type, + struct fsl_mc_device + *mc_dev) +{ + struct fsl_mc_resource_pool *res_pool; + struct fsl_mc_resource *resource; + struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev; + int error = -EINVAL; + bool mutex_locked = false; + + if (WARN_ON(pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)) + goto out; + if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type))) + goto out; + if (WARN_ON(mc_dev->resource)) + goto out; + + res_pool = &mc_bus->resource_pools[pool_type]; + if (WARN_ON(res_pool->type != pool_type)) + goto out; + if (WARN_ON(res_pool->mc_bus != mc_bus)) + goto out; + + mutex_lock(&res_pool->mutex); + mutex_locked = true; + + if (WARN_ON(res_pool->max_count < 0)) + goto out; + if (WARN_ON(res_pool->free_count < 0 || + res_pool->free_count > res_pool->max_count)) + goto out; + + resource = devm_kzalloc(&mc_bus_dev->dev, sizeof(*resource), + GFP_KERNEL); + if (!resource) { + error = -ENOMEM; + dev_err(&mc_bus_dev->dev, + "Failed to allocate memory for fsl_mc_resource\n"); + goto out; + } + + resource->type = pool_type; + resource->id = mc_dev->obj_desc.id; + resource->data = mc_dev; + resource->parent_pool = res_pool; + INIT_LIST_HEAD(&resource->node); + list_add_tail(&resource->node, &res_pool->free_list); + mc_dev->resource = resource; + res_pool->free_count++; + res_pool->max_count++; + error = 0; +out: + if (mutex_locked) + mutex_unlock(&res_pool->mutex); + + return error; +} + +/** + * fsl_mc_resource_pool_remove_device - remove an allocatable device from a + * resource pool + * + * @mc_dev: Pointer to allocatable MC object device + * + * It permanently removes an allocatable MC object device from the resource + * pool, the device is currently in, as long as it is in the pool's free list. + */ +static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device + *mc_dev) +{ + struct fsl_mc_device *mc_bus_dev; + struct fsl_mc_bus *mc_bus; + struct fsl_mc_resource_pool *res_pool; + struct fsl_mc_resource *resource; + int error = -EINVAL; + bool mutex_locked = false; + + if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type))) + goto out; + + resource = mc_dev->resource; + if (WARN_ON(resource->data != mc_dev)) + goto out; + + mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); + mc_bus = to_fsl_mc_bus(mc_bus_dev); + res_pool = resource->parent_pool; + if (WARN_ON(res_pool != &mc_bus->resource_pools[resource->type])) + goto out; + + mutex_lock(&res_pool->mutex); + mutex_locked = true; + + if (WARN_ON(res_pool->max_count <= 0)) + goto out; + if (WARN_ON(res_pool->free_count <= 0 || + res_pool->free_count > res_pool->max_count)) + goto out; + + /* + * If the device is currently allocated, its resource is not + * in the free list and thus, the device cannot be removed. + */ + if (list_empty(&resource->node)) { + error = -EBUSY; + dev_err(&mc_bus_dev->dev, + "Device %s cannot be removed from resource pool\n", + dev_name(&mc_dev->dev)); + goto out; + } + + list_del(&resource->node); + INIT_LIST_HEAD(&resource->node); + res_pool->free_count--; + res_pool->max_count--; + + devm_kfree(&mc_bus_dev->dev, resource); + mc_dev->resource = NULL; + error = 0; +out: + if (mutex_locked) + mutex_unlock(&res_pool->mutex); + + return error; +} + +static const char *const fsl_mc_pool_type_strings[] = { + [FSL_MC_POOL_DPMCP] = "dpmcp", + [FSL_MC_POOL_DPBP] = "dpbp", + [FSL_MC_POOL_DPCON] = "dpcon", +}; + +static int __must_check object_type_to_pool_type(const char *object_type, + enum fsl_mc_pool_type + *pool_type) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(fsl_mc_pool_type_strings); i++) { + if (strcmp(object_type, fsl_mc_pool_type_strings[i]) == 0) { + *pool_type = i; + return 0; + } + } + + return -EINVAL; +} + +int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, + enum fsl_mc_pool_type pool_type, + struct fsl_mc_resource **new_resource) +{ + struct fsl_mc_resource_pool *res_pool; + struct fsl_mc_resource *resource; + struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev; + int error = -EINVAL; + bool mutex_locked = false; + + BUILD_BUG_ON(ARRAY_SIZE(fsl_mc_pool_type_strings) != + FSL_MC_NUM_POOL_TYPES); + + *new_resource = NULL; + if (WARN_ON(pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)) + goto error; + + res_pool = &mc_bus->resource_pools[pool_type]; + if (WARN_ON(res_pool->mc_bus != mc_bus)) + goto error; + + mutex_lock(&res_pool->mutex); + mutex_locked = true; + resource = list_first_entry_or_null(&res_pool->free_list, + struct fsl_mc_resource, node); + + if (!resource) { + WARN_ON(res_pool->free_count != 0); + error = -ENXIO; + dev_err(&mc_bus_dev->dev, + "No more resources of type %s left\n", + fsl_mc_pool_type_strings[pool_type]); + goto error; + } + + if (WARN_ON(resource->type != pool_type)) + goto error; + if (WARN_ON(resource->parent_pool != res_pool)) + goto error; + if (WARN_ON(res_pool->free_count <= 0 || + res_pool->free_count > res_pool->max_count)) + goto error; + + list_del(&resource->node); + INIT_LIST_HEAD(&resource->node); + + res_pool->free_count--; + mutex_unlock(&res_pool->mutex); + *new_resource = resource; + return 0; +error: + if (mutex_locked) + mutex_unlock(&res_pool->mutex); + + return error; +} +EXPORT_SYMBOL_GPL(fsl_mc_resource_allocate); + +void fsl_mc_resource_free(struct fsl_mc_resource *resource) +{ + struct fsl_mc_resource_pool *res_pool; + bool mutex_locked = false; + + res_pool = resource->parent_pool; + if (WARN_ON(resource->type != res_pool->type)) + goto out; + + mutex_lock(&res_pool->mutex); + mutex_locked = true; + if (WARN_ON(res_pool->free_count < 0 || + res_pool->free_count >= res_pool->max_count)) + goto out; + + if (WARN_ON(!list_empty(&resource->node))) + goto out; + + list_add_tail(&resource->node, &res_pool->free_list); + res_pool->free_count++; +out: + if (mutex_locked) + mutex_unlock(&res_pool->mutex); +} +EXPORT_SYMBOL_GPL(fsl_mc_resource_free); + +/** + * fsl_mc_portal_allocate - Allocates an MC portal + * + * @mc_dev: MC device for which the MC portal is to be allocated + * @mc_io_flags: Flags for the fsl_mc_io object that wraps the allocated + * MC portal. + * @new_mc_io: Pointer to area where the pointer to the fsl_mc_io object + * that wraps the allocated MC portal is to be returned + * + * This function allocates an MC portal from the device's parent DPRC, + * from the corresponding MC bus' pool of MC portals and wraps + * it in a new fsl_mc_io object. If 'mc_dev' is a DPRC itself, the + * portal is allocated from its own MC bus. + */ +int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev, + uint16_t mc_io_flags, + struct fsl_mc_io **new_mc_io) +{ + struct fsl_mc_device *mc_bus_dev; + struct fsl_mc_bus *mc_bus; + phys_addr_t mc_portal_phys_addr; + size_t mc_portal_size; + struct fsl_mc_device *mc_adev; + int error = -EINVAL; + struct fsl_mc_resource *resource = NULL; + struct fsl_mc_io *mc_io = NULL; + + if (mc_dev->flags & FSL_MC_IS_DPRC) { + mc_bus_dev = mc_dev; + } else { + if (WARN_ON(mc_dev->dev.parent->bus != &fsl_mc_bus_type)) + return error; + + mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); + } + + mc_bus = to_fsl_mc_bus(mc_bus_dev); + *new_mc_io = NULL; + error = fsl_mc_resource_allocate(mc_bus, FSL_MC_POOL_DPMCP, &resource); + if (error < 0) + return error; + + mc_adev = resource->data; + if (WARN_ON(!mc_adev)) + goto error_cleanup_resource; + + if (WARN_ON(mc_adev->obj_desc.region_count == 0)) + goto error_cleanup_resource; + + mc_portal_phys_addr = mc_adev->regions[0].start; + mc_portal_size = mc_adev->regions[0].end - + mc_adev->regions[0].start + 1; + + if (WARN_ON(mc_portal_size != mc_bus_dev->mc_io->portal_size)) + goto error_cleanup_resource; + + error = fsl_create_mc_io(&mc_bus_dev->dev, + mc_portal_phys_addr, + mc_portal_size, resource, + mc_io_flags, &mc_io); + if (error < 0) + goto error_cleanup_resource; + + *new_mc_io = mc_io; + return 0; + +error_cleanup_resource: + fsl_mc_resource_free(resource); + return error; +} +EXPORT_SYMBOL_GPL(fsl_mc_portal_allocate); + +/** + * fsl_mc_portal_free - Returns an MC portal to the pool of free MC portals + * of a given MC bus + * + * @mc_io: Pointer to the fsl_mc_io object that wraps the MC portal to free + */ +void fsl_mc_portal_free(struct fsl_mc_io *mc_io) +{ + struct fsl_mc_resource *resource; + + resource = mc_io->resource; + if (WARN_ON(resource->type != FSL_MC_POOL_DPMCP)) + return; + if (WARN_ON(!resource->data)) + return; + + fsl_destroy_mc_io(mc_io); + fsl_mc_resource_free(resource); +} +EXPORT_SYMBOL_GPL(fsl_mc_portal_free); + +/** + * fsl_mc_portal_reset - Resets the dpmcp object for a given fsl_mc_io object + * + * @mc_io: Pointer to the fsl_mc_io object that wraps the MC portal to free + */ +int fsl_mc_portal_reset(struct fsl_mc_io *mc_io) +{ + int error; + uint16_t token; + struct fsl_mc_resource *resource = mc_io->resource; + struct fsl_mc_device *mc_dev = resource->data; + + if (WARN_ON(resource->type != FSL_MC_POOL_DPMCP)) + return -EINVAL; + + if (WARN_ON(!mc_dev)) + return -EINVAL; + + error = dpmcp_open(mc_io, mc_dev->obj_desc.id, &token); + if (error < 0) { + dev_err(&mc_dev->dev, "dpmcp_open() failed: %d\n", error); + return error; + } + + error = dpmcp_reset(mc_io, token); + if (error < 0) { + dev_err(&mc_dev->dev, "dpmcp_reset() failed: %d\n", error); + return error; + } + + error = dpmcp_close(mc_io, token); + if (error < 0) { + dev_err(&mc_dev->dev, "dpmcp_close() failed: %d\n", error); + return error; + } + + return 0; +} +EXPORT_SYMBOL_GPL(fsl_mc_portal_reset); + +/** + * fsl_mc_object_allocate - Allocates a MC object device of the given + * pool type from a given MC bus + * + * @mc_dev: MC device for which the MC object device is to be allocated + * @pool_type: MC bus resource pool type + * @new_mc_dev: Pointer to area where the pointer to the allocated + * MC object device is to be returned + * + * This function allocates a MC object device from the device's parent DPRC, + * from the corresponding MC bus' pool of allocatable MC object devices of + * the given resource type. mc_dev cannot be a DPRC itself. + * + * NOTE: pool_type must be different from FSL_MC_POOL_MCP, since MC + * portals are allocated using fsl_mc_portal_allocate(), instead of + * this function. + */ +int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, + enum fsl_mc_pool_type pool_type, + struct fsl_mc_device **new_mc_adev) +{ + struct fsl_mc_device *mc_bus_dev; + struct fsl_mc_bus *mc_bus; + struct fsl_mc_device *mc_adev; + int error = -EINVAL; + struct fsl_mc_resource *resource = NULL; + + *new_mc_adev = NULL; + if (WARN_ON(mc_dev->flags & FSL_MC_IS_DPRC)) + goto error; + + if (WARN_ON(mc_dev->dev.parent->bus != &fsl_mc_bus_type)) + goto error; + + if (WARN_ON(pool_type == FSL_MC_POOL_DPMCP)) + goto error; + + mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); + mc_bus = to_fsl_mc_bus(mc_bus_dev); + error = fsl_mc_resource_allocate(mc_bus, pool_type, &resource); + if (error < 0) + goto error; + + mc_adev = resource->data; + if (WARN_ON(!mc_adev)) + goto error; + + *new_mc_adev = mc_adev; + return 0; +error: + if (resource) + fsl_mc_resource_free(resource); + + return error; +} +EXPORT_SYMBOL_GPL(fsl_mc_object_allocate); + +/** + * fsl_mc_object_free - Returns an allocatable MC object device to the + * corresponding resource pool of a given MC bus. + * + * @mc_adev: Pointer to the MC object device + */ +void fsl_mc_object_free(struct fsl_mc_device *mc_adev) +{ + struct fsl_mc_resource *resource; + + resource = mc_adev->resource; + if (WARN_ON(resource->type == FSL_MC_POOL_DPMCP)) + return; + if (WARN_ON(resource->data != mc_adev)) + return; + + fsl_mc_resource_free(resource); +} +EXPORT_SYMBOL_GPL(fsl_mc_object_free); + +/** + * fsl_mc_allocator_probe - callback invoked when an allocatable device is + * being added to the system + */ +static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev) +{ + enum fsl_mc_pool_type pool_type; + struct fsl_mc_device *mc_bus_dev; + struct fsl_mc_bus *mc_bus; + int error = -EINVAL; + + if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type))) + goto error; + + mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); + if (WARN_ON(mc_bus_dev->dev.bus != &fsl_mc_bus_type)) + goto error; + + mc_bus = to_fsl_mc_bus(mc_bus_dev); + error = object_type_to_pool_type(mc_dev->obj_desc.type, &pool_type); + if (error < 0) + goto error; + + error = fsl_mc_resource_pool_add_device(mc_bus, pool_type, mc_dev); + if (error < 0) + goto error; + + dev_info(&mc_dev->dev, + "Allocatable MC object device bound to fsl_mc_allocator driver"); + return 0; +error: + + return error; +} + +/** + * fsl_mc_allocator_remove - callback invoked when an allocatable device is + * being removed from the system + */ +static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev) +{ + int error = -EINVAL; + + if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type))) + goto out; + + error = fsl_mc_resource_pool_remove_device(mc_dev); + if (error < 0) + goto out; + + dev_info(&mc_dev->dev, + "Allocatable MC object device unbound from fsl_mc_allocator driver"); + error = 0; +out: + return error; +} + +static const struct fsl_mc_device_match_id match_id_table[] = { + { + .vendor = FSL_MC_VENDOR_FREESCALE, + .obj_type = "dpbp", + .ver_major = DPBP_VER_MAJOR, + .ver_minor = DPBP_VER_MINOR + }, + { + .vendor = FSL_MC_VENDOR_FREESCALE, + .obj_type = "dpmcp", + .ver_major = DPMCP_VER_MAJOR, + .ver_minor = DPMCP_VER_MINOR + }, + { + .vendor = FSL_MC_VENDOR_FREESCALE, + .obj_type = "dpcon", + .ver_major = DPCON_VER_MAJOR, + .ver_minor = DPCON_VER_MINOR + }, + {.vendor = 0x0}, +}; + +static struct fsl_mc_driver fsl_mc_allocator_driver = { + .driver = { + .name = "fsl_mc_allocator", + .owner = THIS_MODULE, + .pm = NULL, + }, + .match_id_table = match_id_table, + .probe = fsl_mc_allocator_probe, + .remove = fsl_mc_allocator_remove, +}; + +module_fsl_mc_driver(fsl_mc_allocator_driver); + +MODULE_AUTHOR("Freescale Semiconductor Inc."); +MODULE_DESCRIPTION("Freescale's MC object device allocator"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index 72551e3c23b6..b4e90221a802 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -604,7 +604,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) mc_portal_phys_addr = res.start; mc_portal_size = resource_size(&res); error = fsl_create_mc_io(&pdev->dev, mc_portal_phys_addr, - mc_portal_size, 0, &mc_io); + mc_portal_size, NULL, 0, &mc_io); if (error < 0) return error; diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c index a07064a9bc9a..5737f599f0ef 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -60,6 +60,8 @@ * @dev: device to be associated with the MC I/O object * @mc_portal_phys_addr: physical address of the MC portal to use * @mc_portal_size: size in bytes of the MC portal + * @resource: Pointer to MC bus object allocator resource associated + * with this MC I/O object or NULL if none. * @flags: flags for the new MC I/O object * @new_mc_io: Area to return pointer to newly created MC I/O object * @@ -68,6 +70,7 @@ int __must_check fsl_create_mc_io(struct device *dev, phys_addr_t mc_portal_phys_addr, uint32_t mc_portal_size, + struct fsl_mc_resource *resource, uint32_t flags, struct fsl_mc_io **new_mc_io) { struct fsl_mc_io *mc_io; @@ -82,6 +85,7 @@ int __must_check fsl_create_mc_io(struct device *dev, mc_io->flags = flags; mc_io->portal_phys_addr = mc_portal_phys_addr; mc_io->portal_size = mc_portal_size; + mc_io->resource = resource; res = devm_request_mem_region(dev, mc_portal_phys_addr, mc_portal_size, diff --git a/drivers/staging/fsl-mc/include/dpbp-cmd.h b/drivers/staging/fsl-mc/include/dpbp-cmd.h new file mode 100644 index 000000000000..1fd70a215194 --- /dev/null +++ b/drivers/staging/fsl-mc/include/dpbp-cmd.h @@ -0,0 +1,60 @@ +/* Copyright 2013-2014 Freescale Semiconductor Inc. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the above-listed copyright holders nor the +* names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* +* ALTERNATIVELY, this software may be distributed under the terms of the +* GNU General Public License ("GPL") as published by the Free Software +* Foundation, either version 2 of that License or (at your option) any +* later version. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef _FSL_DPBP_CMD_H +#define _FSL_DPBP_CMD_H + +/* DPBP Version */ +#define DPBP_VER_MAJOR 2 +#define DPBP_VER_MINOR 0 + +/* Command IDs */ +#define DPBP_CMDID_CLOSE 0x800 +#define DPBP_CMDID_OPEN 0x804 +#define DPBP_CMDID_CREATE 0x904 +#define DPBP_CMDID_DESTROY 0x900 + +#define DPBP_CMDID_ENABLE 0x002 +#define DPBP_CMDID_DISABLE 0x003 +#define DPBP_CMDID_GET_ATTR 0x004 +#define DPBP_CMDID_RESET 0x005 +#define DPBP_CMDID_IS_ENABLED 0x006 + +#define DPBP_CMDID_SET_IRQ 0x010 +#define DPBP_CMDID_GET_IRQ 0x011 +#define DPBP_CMDID_SET_IRQ_ENABLE 0x012 +#define DPBP_CMDID_GET_IRQ_ENABLE 0x013 +#define DPBP_CMDID_SET_IRQ_MASK 0x014 +#define DPBP_CMDID_GET_IRQ_MASK 0x015 +#define DPBP_CMDID_GET_IRQ_STATUS 0x016 +#define DPBP_CMDID_CLEAR_IRQ_STATUS 0x017 + +#endif /* _FSL_DPBP_CMD_H */ diff --git a/drivers/staging/fsl-mc/include/dpbp.h b/drivers/staging/fsl-mc/include/dpbp.h new file mode 100644 index 000000000000..5f3c8e74d2ad --- /dev/null +++ b/drivers/staging/fsl-mc/include/dpbp.h @@ -0,0 +1,330 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __FSL_DPBP_H +#define __FSL_DPBP_H + +/* Data Path Buffer Pool API + * Contains initialization APIs and runtime control APIs for DPBP + */ + +struct fsl_mc_io; + +/** + * dpbp_open() - Open a control session for the specified object. + * @mc_io: Pointer to MC portal's I/O object + * @dpbp_id: DPBP unique ID + * @token: Returned token; use in subsequent API calls + * + * This function can be used to open a control session for an + * already created object; an object may have been declared in + * the DPL or by calling the dpbp_create function. + * This function returns a unique authentication token, + * associated with the specific object ID and the specific MC + * portal; this token must be used in all subsequent commands for + * this specific object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token); + +/** + * dpbp_close() - Close the control session of the object + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * + * After this function is called, no further operations are + * allowed on the object without opening a new control session. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token); + +/** + * struct dpbp_cfg() - Structure representing DPBP configuration + * @options: place holder + */ +struct dpbp_cfg { + uint32_t options; +}; + +/** + * dpbp_create() - Create the DPBP object. + * @mc_io: Pointer to MC portal's I/O object + * @cfg: Configuration structure + * @token: Returned token; use in subsequent API calls + * + * Create the DPBP object, allocate required resources and + * perform required initialization. + * + * The object can be created either by declaring it in the + * DPL file, or by calling this function. + * This function returns a unique authentication token, + * associated with the specific object ID and the specific MC + * portal; this token must be used in all subsequent calls to + * this specific object. For objects that are created using the + * DPL file, call dpbp_open function to get an authentication + * token first. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_create(struct fsl_mc_io *mc_io, + const struct dpbp_cfg *cfg, + uint16_t *token); + +/** + * dpbp_destroy() - Destroy the DPBP object and release all its resources. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * + * Return: '0' on Success; error code otherwise. + */ +int dpbp_destroy(struct fsl_mc_io *mc_io, uint16_t token); + +/** + * dpbp_enable() - Enable the DPBP. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token); + +/** + * dpbp_disable() - Disable the DPBP. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token); + +/** + * dpbp_is_enabled() - Check if the DPBP is enabled. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @en: Returns '1' if object is enabled; '0' otherwise + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_is_enabled(struct fsl_mc_io *mc_io, uint16_t token, int *en); + +/** + * dpbp_reset() - Reset the DPBP, returns the object to initial state. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_reset(struct fsl_mc_io *mc_io, uint16_t token); + +/** + * dpbp_set_irq() - Set IRQ information for the DPBP to trigger an interrupt. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @irq_index: Identifies the interrupt index to configure + * @irq_addr: Address that must be written to + * signal a message-based interrupt + * @irq_val: Value to write into irq_addr address + * @user_irq_id: A user defined number associated with this IRQ + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_set_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint64_t irq_addr, + uint32_t irq_val, + int user_irq_id); + +/** + * dpbp_get_irq() - Get IRQ information from the DPBP. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @irq_index: The interrupt index to configure + * @type: Interrupt type: 0 represents message interrupt + * type (both irq_addr and irq_val are valid) + * @irq_addr: Returned address that must be written to + * signal the message-based interrupt + * @irq_val: Value to write into irq_addr address + * @user_irq_id: A user defined number associated with this IRQ + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_get_irq(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + int *type, + uint64_t *irq_addr, + uint32_t *irq_val, + int *user_irq_id); + +/** + * dpbp_set_irq_enable() - Set overall interrupt state. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @irq_index: The interrupt index to configure + * @en: Interrupt state - enable = 1, disable = 0 + * + * Allows GPP software to control when interrupts are generated. + * Each interrupt can have up to 32 causes. The enable/disable control's the + * overall interrupt state. if the interrupt is disabled no causes will cause + * an interrupt. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t en); + +/** + * dpbp_get_irq_enable() - Get overall interrupt state + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @irq_index: The interrupt index to configure + * @en: Returned interrupt state - enable = 1, disable = 0 + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint8_t *en); + +/** + * dpbp_set_irq_mask() - Set interrupt mask. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @irq_index: The interrupt index to configure + * @mask: Event mask to trigger interrupt; + * each bit: + * 0 = ignore event + * 1 = consider event for asserting IRQ + * + * Every interrupt can have up to 32 causes and the interrupt model supports + * masking/unmasking each cause independently + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t mask); + +/** + * dpbp_get_irq_mask() - Get interrupt mask. + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @irq_index: The interrupt index to configure + * @mask: Returned event mask to trigger interrupt + * + * Every interrupt can have up to 32 causes and the interrupt model supports + * masking/unmasking each cause independently + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *mask); + +/** + * dpbp_get_irq_status() - Get the current status of any pending interrupts. + * + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @irq_index: The interrupt index to configure + * @status: Returned interrupts status - one bit per cause: + * 0 = no interrupt pending + * 1 = interrupt pending + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_get_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t *status); + +/** + * dpbp_clear_irq_status() - Clear a pending interrupt's status + * + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @irq_index: The interrupt index to configure + * @status: Bits to clear (W1C) - one bit per cause: + * 0 = don't change + * 1 = clear status bit + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_clear_irq_status(struct fsl_mc_io *mc_io, + uint16_t token, + uint8_t irq_index, + uint32_t status); + +/** + * struct dpbp_attr - Structure representing DPBP attributes + * @id: DPBP object ID + * @version: DPBP version + * @bpid: Hardware buffer pool ID; should be used as an argument in + * acquire/release operations on buffers + */ +struct dpbp_attr { + int id; + /** + * struct version - Structure representing DPBP version + * @major: DPBP major version + * @minor: DPBP minor version + */ + struct { + uint16_t major; + uint16_t minor; + } version; + uint16_t bpid; +}; + +/** + * dpbp_get_attributes - Retrieve DPBP attributes. + * + * @mc_io: Pointer to MC portal's I/O object + * @token: Token of DPBP object + * @attr: Returned object's attributes + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_get_attributes(struct fsl_mc_io *mc_io, + uint16_t token, + struct dpbp_attr *attr); + +/** @} */ + +#endif /* __FSL_DPBP_H */ diff --git a/drivers/staging/fsl-mc/include/dpcon-cmd.h b/drivers/staging/fsl-mc/include/dpcon-cmd.h new file mode 100644 index 000000000000..c878d33bfd86 --- /dev/null +++ b/drivers/staging/fsl-mc/include/dpcon-cmd.h @@ -0,0 +1,62 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the above-listed copyright holders nor the +* names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* +* ALTERNATIVELY, this software may be distributed under the terms of the +* GNU General Public License ("GPL") as published by the Free Software +* Foundation, either version 2 of that License or (at your option) any +* later version. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef _FSL_DPCON_CMD_H +#define _FSL_DPCON_CMD_H + +/* DPCON Version */ +#define DPCON_VER_MAJOR 2 +#define DPCON_VER_MINOR 0 + +/* Command IDs */ +#define DPCON_CMDID_CLOSE 0x800 +#define DPCON_CMDID_OPEN 0x808 +#define DPCON_CMDID_CREATE 0x908 +#define DPCON_CMDID_DESTROY 0x900 + +#define DPCON_CMDID_ENABLE 0x002 +#define DPCON_CMDID_DISABLE 0x003 +#define DPCON_CMDID_GET_ATTR 0x004 +#define DPCON_CMDID_RESET 0x005 +#define DPCON_CMDID_IS_ENABLED 0x006 + +#define DPCON_CMDID_SET_IRQ 0x010 +#define DPCON_CMDID_GET_IRQ 0x011 +#define DPCON_CMDID_SET_IRQ_ENABLE 0x012 +#define DPCON_CMDID_GET_IRQ_ENABLE 0x013 +#define DPCON_CMDID_SET_IRQ_MASK 0x014 +#define DPCON_CMDID_GET_IRQ_MASK 0x015 +#define DPCON_CMDID_GET_IRQ_STATUS 0x016 +#define DPCON_CMDID_CLEAR_IRQ_STATUS 0x017 + +#define DPCON_CMDID_SET_NOTIFICATION 0x100 + +#endif /* _FSL_DPCON_CMD_H */ diff --git a/drivers/staging/fsl-mc/include/mc-private.h b/drivers/staging/fsl-mc/include/mc-private.h index 197544447404..8e67075f43b2 100644 --- a/drivers/staging/fsl-mc/include/mc-private.h +++ b/drivers/staging/fsl-mc/include/mc-private.h @@ -21,6 +21,11 @@ (strcmp((_mc_dev)->obj_desc.type, (_obj_desc)->type) == 0 && \ (_mc_dev)->obj_desc.id == (_obj_desc)->id) +#define FSL_MC_IS_ALLOCATABLE(_obj_type) \ + (strcmp(_obj_type, "dpbp") == 0 || \ + strcmp(_obj_type, "dpmcp") == 0 || \ + strcmp(_obj_type, "dpcon") == 0) + /** * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device * @root_mc_bus_dev: MC object device representing the root DPRC @@ -32,19 +37,6 @@ struct fsl_mc { struct fsl_mc_addr_translation_range *translation_ranges; }; -/** - * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC - * @mc_dev: fsl-mc device for the bus device itself. - * @scan_mutex: Serializes bus scanning - */ -struct fsl_mc_bus { - struct fsl_mc_device mc_dev; - struct mutex scan_mutex; /* serializes bus scanning */ -}; - -#define to_fsl_mc_bus(_mc_dev) \ - container_of(_mc_dev, struct fsl_mc_bus, mc_dev) - /** * struct fsl_mc_addr_translation_range - bus to system address translation * range @@ -59,6 +51,42 @@ struct fsl_mc_addr_translation_range { phys_addr_t start_phys_addr; }; +/** + * struct fsl_mc_resource_pool - Pool of MC resources of a given + * type + * @type: type of resources in the pool + * @max_count: maximum number of resources in the pool + * @free_count: number of free resources in the pool + * @mutex: mutex to serialize access to the pool's free list + * @free_list: anchor node of list of free resources in the pool + * @mc_bus: pointer to the MC bus that owns this resource pool + */ +struct fsl_mc_resource_pool { + enum fsl_mc_pool_type type; + int16_t max_count; + int16_t free_count; + struct mutex mutex; /* serializes access to free_list */ + struct list_head free_list; + struct fsl_mc_bus *mc_bus; +}; + +/** + * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC + * @mc_dev: fsl-mc device for the bus device itself. + * @resource_pools: array of resource pools (one pool per resource type) + * for this MC bus. These resources represent allocatable entities + * from the physical DPRC. + * @scan_mutex: Serializes bus scanning + */ +struct fsl_mc_bus { + struct fsl_mc_device mc_dev; + struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; + struct mutex scan_mutex; /* serializes bus scanning */ +}; + +#define to_fsl_mc_bus(_mc_dev) \ + container_of(_mc_dev, struct fsl_mc_bus, mc_dev) + int __must_check fsl_mc_device_add(struct dprc_obj_desc *obj_desc, struct fsl_mc_io *mc_io, struct device *parent_dev, @@ -74,4 +102,11 @@ int __init dprc_driver_init(void); void __exit dprc_driver_exit(void); +int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, + enum fsl_mc_pool_type pool_type, + struct fsl_mc_resource + **new_resource); + +void fsl_mc_resource_free(struct fsl_mc_resource *resource); + #endif /* _FSL_MC_PRIVATE_H_ */ diff --git a/drivers/staging/fsl-mc/include/mc-sys.h b/drivers/staging/fsl-mc/include/mc-sys.h index abfd6a233ada..cb3b5a296615 100644 --- a/drivers/staging/fsl-mc/include/mc-sys.h +++ b/drivers/staging/fsl-mc/include/mc-sys.h @@ -40,6 +40,7 @@ #include #include +struct fsl_mc_resource; struct mc_command; /** @@ -49,6 +50,9 @@ struct mc_command; * @portal_size: MC command portal size in bytes * @portal_phys_addr: MC command portal physical address * @portal_virt_addr: MC command portal virtual address + * @resource: generic resource associated with the MC portal if + * the MC portal came from a resource pool, or NULL if the MC portal + * is permanently bound to a device (e.g., a DPRC) */ struct fsl_mc_io { struct device *dev; @@ -56,11 +60,13 @@ struct fsl_mc_io { uint32_t portal_size; phys_addr_t portal_phys_addr; void __iomem *portal_virt_addr; + struct fsl_mc_resource *resource; }; int __must_check fsl_create_mc_io(struct device *dev, phys_addr_t mc_portal_phys_addr, uint32_t mc_portal_size, + struct fsl_mc_resource *resource, uint32_t flags, struct fsl_mc_io **new_mc_io); void fsl_destroy_mc_io(struct fsl_mc_io *mc_io); diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 5cd237b31704..fa02ef0529e7 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -65,6 +65,44 @@ struct fsl_mc_device_match_id { uint32_t ver_minor; }; +/** + * enum fsl_mc_pool_type - Types of allocatable MC bus resources + * + * Entries in these enum are used as indices in the array of resource + * pools of an fsl_mc_bus object. + */ +enum fsl_mc_pool_type { + FSL_MC_POOL_DPMCP = 0x0, /* corresponds to "dpmcp" in the MC */ + FSL_MC_POOL_DPBP, /* corresponds to "dpbp" in the MC */ + FSL_MC_POOL_DPCON, /* corresponds to "dpcon" in the MC */ + + /* + * NOTE: New resource pool types must be added before this entry + */ + FSL_MC_NUM_POOL_TYPES +}; + +/** + * struct fsl_mc_resource - MC generic resource + * @type: type of resource + * @id: unique MC resource Id within the resources of the same type + * @data: pointer to resource-specific data if the resource is currently + * allocated, or NULL if the resource is not currently allocated. + * @parent_pool: pointer to the parent resource pool from which this + * resource is allocated from. + * @node: Node in the free list of the corresponding resource pool + * + * NOTE: This structure is to be embedded as a field of specific + * MC resource structures. + */ +struct fsl_mc_resource { + enum fsl_mc_pool_type type; + int32_t id; + void *data; + struct fsl_mc_resource_pool *parent_pool; + struct list_head node; +}; + /** * Bit masks for a MC object device (struct fsl_mc_device) flags */ @@ -86,6 +124,7 @@ struct fsl_mc_device_match_id { * NULL if none. * @obj_desc: MC description of the DPAA device * @regions: pointer to array of MMIO region entries + * @resource: generic resource associated with this MC object device, if any. * * Generic device object for MC object devices that are "attached" to a * MC bus. @@ -95,6 +134,17 @@ struct fsl_mc_device_match_id { * - The SMMU notifier callback gets invoked after device_add() has been * called for an MC object device, but before the device-specific probe * callback gets called. + * - DP_OBJ_DPRC objects are the only MC objects that have built-in MC + * portals. For all other MC objects, their device drivers are responsible for + * allocating MC portals for them by calling fsl_mc_portal_allocate(). + * - Some types of MC objects (e.g., DP_OBJ_DPBP, DP_OBJ_DPCON) are + * treated as resources that can be allocated/deallocated from the + * corresponding resource pool in the object's parent DPRC, using the + * fsl_mc_object_allocate()/fsl_mc_object_free() functions. These MC objects + * are known as "allocatable" objects. For them, the corresponding + * fsl_mc_device's 'resource' points to the associated resource object. + * For MC objects that are not allocatable (e.g., DP_OBJ_DPRC, DP_OBJ_DPNI), + * 'resource' is NULL. */ struct fsl_mc_device { struct device dev; @@ -105,6 +155,7 @@ struct fsl_mc_device { struct fsl_mc_io *mc_io; struct dprc_obj_desc obj_desc; struct resource *regions; + struct fsl_mc_resource *resource; }; #define to_fsl_mc_device(_dev) \ @@ -131,6 +182,20 @@ int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver, void fsl_mc_driver_unregister(struct fsl_mc_driver *driver); +int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev, + uint16_t mc_io_flags, + struct fsl_mc_io **new_mc_io); + +void fsl_mc_portal_free(struct fsl_mc_io *mc_io); + +int fsl_mc_portal_reset(struct fsl_mc_io *mc_io); + +int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, + enum fsl_mc_pool_type pool_type, + struct fsl_mc_device **new_mc_adev); + +void fsl_mc_object_free(struct fsl_mc_device *mc_adev); + extern struct bus_type fsl_mc_bus_type; #endif /* _FSL_MC_H_ */ -- cgit v1.2.3 From b5c4437872de508073355e927b1fcdba4980cba7 Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Sat, 14 Feb 2015 20:32:43 -0800 Subject: Staging: iio: meter: ade7854-i2c: code style improvements Code reformatting based on checkpatch.pl with --strict: Alignment should match open paranthesis cases corrected Signed-off-by: Tolga Ceylan Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7854-i2c.c | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index 5d0671a198fe..5e6fbe4c976a 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -16,8 +16,8 @@ #include "ade7854.h" static int ade7854_i2c_write_reg_8(struct device *dev, - u16 reg_address, - u8 value) + u16 reg_address, + u8 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -35,8 +35,8 @@ static int ade7854_i2c_write_reg_8(struct device *dev, } static int ade7854_i2c_write_reg_16(struct device *dev, - u16 reg_address, - u16 value) + u16 reg_address, + u16 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -55,8 +55,8 @@ static int ade7854_i2c_write_reg_16(struct device *dev, } static int ade7854_i2c_write_reg_24(struct device *dev, - u16 reg_address, - u32 value) + u16 reg_address, + u32 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -76,8 +76,8 @@ static int ade7854_i2c_write_reg_24(struct device *dev, } static int ade7854_i2c_write_reg_32(struct device *dev, - u16 reg_address, - u32 value) + u16 reg_address, + u32 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -98,8 +98,8 @@ static int ade7854_i2c_write_reg_32(struct device *dev, } static int ade7854_i2c_read_reg_8(struct device *dev, - u16 reg_address, - u8 *val) + u16 reg_address, + u8 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); @@ -124,8 +124,8 @@ out: } static int ade7854_i2c_read_reg_16(struct device *dev, - u16 reg_address, - u16 *val) + u16 reg_address, + u16 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); @@ -150,8 +150,8 @@ out: } static int ade7854_i2c_read_reg_24(struct device *dev, - u16 reg_address, - u32 *val) + u16 reg_address, + u32 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); @@ -176,8 +176,8 @@ out: } static int ade7854_i2c_read_reg_32(struct device *dev, - u16 reg_address, - u32 *val) + u16 reg_address, + u32 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); @@ -203,7 +203,7 @@ out: } static int ade7854_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { int ret; struct ade7854_state *st; -- cgit v1.2.3 From 21bd23ea128d083bf8a4fd570a66a128d58465b5 Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Sat, 14 Feb 2015 20:32:45 -0800 Subject: Staging: iio: meter: ade7854-i2c: code style improvements Code reformatting based on checkpatch.pl with --strict: Comparison to NULL rewritten as !indio_dev Signed-off-by: Tolga Ceylan Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7854-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index 5e6fbe4c976a..4e7a3829ea55 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -210,7 +210,7 @@ static int ade7854_i2c_probe(struct i2c_client *client, struct iio_dev *indio_dev; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st)); - if (indio_dev == NULL) + if (!indio_dev) return -ENOMEM; st = iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); -- cgit v1.2.3 From c312530589ed9524fc7cc921105dc9b67ea32d6a Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Mon, 9 Feb 2015 19:11:33 +0000 Subject: staging: vt6655: vnt_tx_packet fix dma_idx selection. There is still a problem that dma_idx is causing packets to go onto the wrong tx path. Protect dma_idx fully with the present first lock and use pTDInfo->byFlags TD_FLAGS_NETIF_SKB to set MACvTransmit. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 4324282afe49..f5c5872b587e 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1187,12 +1187,14 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; PSTxDesc head_td; - u32 dma_idx = TYPE_AC0DMA; + u32 dma_idx; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - if (!ieee80211_is_data(hdr->frame_control)) + if (ieee80211_is_data(hdr->frame_control)) + dma_idx = TYPE_AC0DMA; + else dma_idx = TYPE_TXDMA0; if (AVAIL_TD(priv, dma_idx) < 1) { @@ -1206,6 +1208,9 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) head_td->pTDInfo->skb = skb; + if (dma_idx == TYPE_AC0DMA) + head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; + priv->iTDUsed[dma_idx]++; /* Take ownership */ @@ -1234,13 +1239,10 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->skb_dma); - if (dma_idx == TYPE_AC0DMA) { - head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; - + if (head_td->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) MACvTransmitAC0(priv->PortOffset); - } else { + else MACvTransmit0(priv->PortOffset); - } spin_unlock_irqrestore(&priv->lock, flags); -- cgit v1.2.3 From 163fe301b9f78b6de57d0014eafe504fd20c0cd4 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 7 Mar 2015 16:36:37 +0000 Subject: staging: vt6656: vnt_rf_setpower: fix missing rate RATE_12M When the driver sets this rate a power of zero value is set causing data flow stoppage until another rate is tried. Signed-off-by: Malcolm Priestley Cc: # v3.17+ Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index c42cde59f598..c4286ccac320 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -640,6 +640,7 @@ int vnt_rf_setpower(struct vnt_private *priv, u32 rate, u32 channel) break; case RATE_6M: case RATE_9M: + case RATE_12M: case RATE_18M: case RATE_24M: case RATE_36M: -- cgit v1.2.3 From 40c8790bcb7ac74f3038153cd09310e220c6a1df Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 7 Mar 2015 17:04:54 +0000 Subject: vt6655: RFbSetPower fix missing rate RATE_12M When the driver sets this rate a power of zero value is set causing data flow stoppage until another rate is tried. Signed-off-by: Malcolm Priestley Cc: Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index 941b2adca95a..7626f635f160 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -794,6 +794,7 @@ bool RFbSetPower( break; case RATE_6M: case RATE_9M: + case RATE_12M: case RATE_18M: byPwr = priv->abyOFDMPwrTbl[uCH]; if (priv->byRFType == RF_UW2452) -- cgit v1.2.3 From 1f51d5801859e0b382dcc8f06875811d63ec8953 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sat, 7 Mar 2015 17:04:55 +0000 Subject: vt6655: Fix late setting of byRFType. byRFType is not set prior to registration of mac80211 causing unpredictable operation after channel scans. With byRFType unset all channels are enabled this causes tx power to be set to values not present its eeprom. Move setting of this variable to vt6655_probe. byRFType must have a mask set. byRevId not used by driver and is removed. Signed-off-by: Malcolm Priestley Cc: # v3.19+ Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index f5c5872b587e..03b2a90b9ac0 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -330,16 +330,6 @@ static void device_init_registers(struct vnt_private *pDevice) /* zonetype initial */ pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; - /* Get RFType */ - pDevice->byRFType = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RFTYPE); - - /* force change RevID for VT3253 emu */ - if ((pDevice->byRFType & RF_EMU) != 0) - pDevice->byRevId = 0x80; - - pDevice->byRFType &= RF_MASK; - pr_debug("pDevice->byRFType = %x\n", pDevice->byRFType); - if (!pDevice->bZoneRegExist) pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; @@ -1780,6 +1770,12 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) MACvInitialize(priv->PortOffset); MACvReadEtherAddress(priv->PortOffset, priv->abyCurrentNetAddr); + /* Get RFType */ + priv->byRFType = SROMbyReadEmbedded(priv->PortOffset, EEP_OFS_RFTYPE); + priv->byRFType &= RF_MASK; + + dev_dbg(&pcid->dev, "RF Type = %x\n", priv->byRFType); + device_get_options(priv); device_set_options(priv); /* Mask out the options cannot be set to the chip */ -- cgit v1.2.3 From b62a569e4ae2361bac6f601e75aa973d42d7c47d Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Sat, 7 Mar 2015 23:20:01 +0530 Subject: Staging: iio: Change data type to u16 to avoid unnecessary typecast In the adis16220_read16bit() function we earlier used a s16 value 'val' which is used by the adis_read_reg_16 function to read data and takes a u16 value as a parameter. So, this patch changes the data type of 'val' from s16 to u16. It is safe to remove the extra sign extension, since the user of the function uses it to read a 10 unsigned value which will lead to the same result in both cases. Further this patch removes the unnecessary typecast for the simplification of code. In addition to this, initialization of 'val' to 0 is also dropped. This is due to the fact that not initializing helps the compiler provide useful warnings if the code gets changed to return an otherwise uninitialized result. Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/adis16220_core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index d478f5130a0f..0396f24f4558 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c @@ -28,16 +28,15 @@ static ssize_t adis16220_read_16bit(struct device *dev, struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct adis16220_state *st = iio_priv(indio_dev); ssize_t ret; - s16 val = 0; + u16 val; /* Take the iio_dev status lock */ mutex_lock(&indio_dev->mlock); - ret = adis_read_reg_16(&st->adis, this_attr->address, - (u16 *)&val); + ret = adis_read_reg_16(&st->adis, this_attr->address, &val); mutex_unlock(&indio_dev->mlock); if (ret) return ret; - return sprintf(buf, "%d\n", val); + return sprintf(buf, "%u\n", val); } static ssize_t adis16220_write_16bit(struct device *dev, -- cgit v1.2.3 From acd3f6cf0579ef993bbfc50b84592fc8019f7887 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Sat, 7 Mar 2015 23:30:27 +0530 Subject: staging: rtl8188eu: Remove unneeded parentheses This patch removes unneeded parentheses from a if statement for better readability. This issue is identified by checkpatch.pl Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 4f2f736598f2..509fc05ebea8 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -1297,7 +1297,7 @@ int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps) if (!(pmlmeinfo->HT_enable)) return _FAIL; - if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK)) + if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK) return _FAIL; bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40) ? 6 : 5; -- cgit v1.2.3 From 6019ee4095d9a40927060d33e79344a3f34b8a96 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sun, 8 Mar 2015 00:02:34 +0300 Subject: Staging: dgap: Remove unused variable This patch removes variable that was used to store only the return value of a function call. The issue was detected and resolved using the following coccinelle script: @@ expression ret; identifier f; @@ -ret = +return f(...); -return ret; Signed-off-by: Haneen Mohammed Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgap/dgap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index d4d98a78f3ac..cea5b26032d9 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -1361,7 +1361,6 @@ static uint dgap_get_custom_baud(struct channel_t *ch) { u8 __iomem *vaddr; ulong offset; - uint value; if (!ch || ch->magic != DGAP_CHANNEL_MAGIC) return 0; @@ -1384,8 +1383,7 @@ static uint dgap_get_custom_baud(struct channel_t *ch) offset = (ioread16(vaddr + ECS_SEG) << 4) + (ch->ch_portnum * 0x28) + LINE_SPEED; - value = readw(vaddr + offset); - return value; + return readw(vaddr + offset); } /* -- cgit v1.2.3 From f7d63547ea7fe7e4a666aa97e095855e5064b70e Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sun, 8 Mar 2015 00:03:51 +0300 Subject: Staging: speakup: Remove unused variable This patch removes variable that was used to store only the return value of a function call. The issue was detected and resolved using the following coccinelle script: @@ expression ret; identifier f; @@ -ret = +return f(...); -return ret; Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/kobjects.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 3708bc13ae86..0211df60004a 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -840,12 +840,10 @@ static ssize_t message_show(struct kobject *kobj, static ssize_t message_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { - ssize_t retval = 0; struct msg_group_t *group = spk_find_msg_group(attr->attr.name); BUG_ON(!group); - retval = message_store_helper(buf, count, group); - return retval; + return message_store_helper(buf, count, group); } /* -- cgit v1.2.3 From a3d81a379b0933f3a2e9ceba6cb770ceb4865c18 Mon Sep 17 00:00:00 2001 From: Darshana Padmadas Date: Sun, 8 Mar 2015 23:33:39 +0530 Subject: drivers: staging: dgnc: Replace min with min_t This patch replaces min with min_t and eliminates the following warning found by checkpatch.pl: WARNING: min() should probably be min_t(uint, n, 12) Signed-off-by: Darshana Padmadas Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_neo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index c9a8a9825cfb..1268aa945e9c 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -1203,7 +1203,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) * IBM pSeries platform. * 15 bytes max appears to be the magic number. */ - n = min((uint) n, (uint) 12); + n = min_t(uint, n, 12); /* * Since we are grabbing the linestatus register, which -- cgit v1.2.3 From d009f0d7ae38bf1fdc0ff1a914a6dee538059869 Mon Sep 17 00:00:00 2001 From: Darshana Padmadas Date: Sun, 8 Mar 2015 23:33:40 +0530 Subject: staging: rtl8192e: Replace min with min_t This patch replaces min with min_t and eliminates the following warnings found by checkpatch.pl: WARNING: min() should probably be min_t Signed-off-by: Darshana Padmadas Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 10 +++++----- drivers/staging/rtl8192e/rtllib_wx.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index d640420f0076..e8261aec919f 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1904,7 +1904,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, info_element->data[2] == 0x4c && info_element->data[3] == 0x033) { - tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htcap_len != 0) { network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ? @@ -1928,7 +1928,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, info_element->data[1] == 0x90 && info_element->data[2] == 0x4c && info_element->data[3] == 0x034) { - tmp_htinfo_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htinfo_len = min_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htinfo_len != 0) { network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; if (tmp_htinfo_len) { @@ -1949,7 +1949,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, info_element->data[1] == 0xe0 && info_element->data[2] == 0x4c && info_element->data[3] == 0x02) { - ht_realtek_agg_len = min(info_element->len, (u8)MAX_IE_LEN); + ht_realtek_agg_len = min_t(u8, info_element->len, MAX_IE_LEN); memcpy(ht_realtek_agg_buf, info_element->data, info_element->len); } if (ht_realtek_agg_len >= 5) { @@ -2079,7 +2079,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, case MFIE_TYPE_HT_CAP: RTLLIB_DEBUG_SCAN("MFIE_TYPE_HT_CAP: %d bytes\n", info_element->len); - tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htcap_len != 0) { network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ? @@ -2106,7 +2106,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, case MFIE_TYPE_HT_INFO: RTLLIB_DEBUG_SCAN("MFIE_TYPE_HT_INFO: %d bytes\n", info_element->len); - tmp_htinfo_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htinfo_len = min_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htinfo_len) { network->bssht.bdHTSpecVer = HT_SPEC_VER_IEEE; network->bssht.bdHTInfoLen = tmp_htinfo_len > diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 309cda0c0e67..2e665eddc100 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -74,7 +74,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, iwe.cmd = SIOCGIWESSID; iwe.u.data.flags = 1; if (network->ssid_len > 0) { - iwe.u.data.length = min(network->ssid_len, (u8)32); + iwe.u.data.length = min_t(u8, network->ssid_len, 32); start = iwe_stream_add_point_rsl(info, start, stop, &iwe, network->ssid); } else if (network->hidden_ssid_len == 0) { @@ -82,7 +82,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, start = iwe_stream_add_point_rsl(info, start, stop, &iwe, ""); } else { - iwe.u.data.length = min(network->hidden_ssid_len, (u8)32); + iwe.u.data.length = min_t(u8, network->hidden_ssid_len, 32); start = iwe_stream_add_point_rsl(info, start, stop, &iwe, network->hidden_ssid); } -- cgit v1.2.3 From a6a93bc03b3b1542f8871c4d631f2f6af60a0409 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sat, 7 Mar 2015 23:15:39 +0200 Subject: Staging: rtl8192u: Added #include instead of The following patch fixes the checkpatch.pl warning: WARNING: Use #include instead of #include Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index f470cb601c89..32177c62e440 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include "ieee80211.h" -- cgit v1.2.3 From 9a4ed8c50668158135f5fe1ba8aa709656fde951 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sat, 7 Mar 2015 23:26:36 +0200 Subject: Staging: rtl8192u: Added #include instead of The following patch fixes the checkpatch.pl warning: WARNING: Use #include instead of #include Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index 6201712e9c7d..e815c81b45dc 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include "ieee80211.h" -- cgit v1.2.3 From a429238b9afc35c90ad1c8cc584ff5b0023c1a59 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Sat, 7 Mar 2015 23:33:25 +0200 Subject: Staging: rtl8192u: Replace #include The following patch fixes the checkpatch.pl warning: WARNING: Use #include instead of #include Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index f651a187d6db..0a17f84bb809 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include "ieee80211.h" -- cgit v1.2.3 From dce34aee0088fbe89c05cb8e1a21d5bed4fedc5b Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 9 Mar 2015 12:02:47 +0530 Subject: drivers: staging: rtl8188eu: core: Removed unnecessary parentheses Parentheses around the right side of an assignment statement are unnecessary and hence removed. Coccinelle was used to produce the patch: @rule1@ identifier x,y; constant c; @@ ( x = -( y << c -) ; | x = -( y >> c -) ; | x = -( y + c -) ; | x = -( y - c -) ; ) Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c b/drivers/staging/rtl8188eu/core/rtw_security.c index f8981f56bafe..cc66997da262 100644 --- a/drivers/staging/rtl8188eu/core/rtw_security.c +++ b/drivers/staging/rtl8188eu/core/rtw_security.c @@ -1122,7 +1122,7 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) num_blocks = plen / 16; /* Find start of payload */ - payload_index = (hdrlen + 8); + payload_index = hdrlen + 8; /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); @@ -1366,7 +1366,7 @@ static int aes_decipher(u8 *key, uint hdrlen, num_blocks = (plen-8) / 16; /* Find start of payload */ - payload_index = (hdrlen + 8); + payload_index = hdrlen + 8; /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); -- cgit v1.2.3 From 69e2b47fa082dffad06643c85be2d36f4ef6ab9c Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 9 Mar 2015 12:02:48 +0530 Subject: drivers: staging: rtl8712: Removed unnecessary parentheses Parentheses around the right side of an assignment statement are unnecessary and hence removed. Coccinelle was used to produce the patch: @rule1@ identifier x,y; constant c; @@ ( x = -( y << c -) ; | x = -( y >> c -) ; | x = -( y + c -) ; | x = -( y - c -) ; ) Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index 4d5a2889b775..a178c232b44a 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -1086,7 +1086,7 @@ static sint aes_cipher(u8 *key, uint hdrlen, payload_remainder = plen % 16; num_blocks = plen / 16; /* Find start of payload */ - payload_index = (hdrlen + 8); + payload_index = hdrlen + 8; /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); bitwise_xor(aes_out, mic_header1, chain_buffer); @@ -1292,7 +1292,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, payload_remainder = (plen - 8) % 16; num_blocks = (plen - 8) / 16; /* Find start of payload */ - payload_index = (hdrlen + 8); + payload_index = hdrlen + 8; /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); bitwise_xor(aes_out, mic_header1, chain_buffer); -- cgit v1.2.3 From 143ff119553af104ab5c151401bbef11136cfacd Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 9 Mar 2015 12:02:49 +0530 Subject: drivers: staging: rtl8723au: core: Removed unnecessary parentheses Parentheses around the right side of an assignment statement are unnecessary and hence removed. Coccinelle was used to produce the patch: @rule1@ identifier x,y; constant c; @@ ( x = -( y << c -) ; | x = -( y >> c -) ; | x = -( y + c -) ; | x = -( y - c -) ; ) Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 715a47414bdd..0610d5f1bdc4 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -1193,7 +1193,7 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) num_blocks = plen / 16; /* Find start of payload */ - payload_index = (hdrlen + 8); + payload_index = hdrlen + 8; /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); @@ -1466,7 +1466,7 @@ static int aes_decipher(u8 *key, uint hdrlen, num_blocks = (plen-8) / 16; /* Find start of payload */ - payload_index = (hdrlen + 8); + payload_index = hdrlen + 8; /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); -- cgit v1.2.3 From c89ca085a5b287acd3bbf35d4cb6be392ae0798f Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 9 Mar 2015 12:02:50 +0530 Subject: drivers: staging: rtl8723au: hal: Removed unnecessary parentheses Parentheses around the right side of an assignment statement are unnecessary and hence removed. Coccinelle was used to produce the patch: @rule1@ identifier x,y; constant c; @@ ( x = -( y << c -) ; | x = -( y >> c -) ; | x = -( y + c -) ; | x = -( y - c -) ; ) Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c index ba373744ece9..3f9ec9e00e16 100644 --- a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c +++ b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c @@ -222,7 +222,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_92C(struct rtw_adapter *Adapter) } if (CCK_index > (CCK_TABLE_SIZE-1)) - CCK_index = (CCK_TABLE_SIZE-1); + CCK_index = CCK_TABLE_SIZE-1; else if (CCK_index < 0) CCK_index = 0; } -- cgit v1.2.3 From 8d0514d5631d8ded3fe42c3a16727039b576f18c Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Mon, 9 Mar 2015 14:24:42 +0530 Subject: Staging rtl8172: Remove unnecessary typecast Using addressof and then casting to the original type is unneeded. So these casts can be removed. Issue detected via Coccinelle script. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c index 324da34383ea..0a1c6313e781 100644 --- a/drivers/staging/rtl8712/hal_init.c +++ b/drivers/staging/rtl8712/hal_init.c @@ -92,7 +92,7 @@ static u32 rtl871x_open_fw(struct _adapter *padapter, const u8 **ppmappedfw) static void fill_fwpriv(struct _adapter *padapter, struct fw_priv *pfwpriv) { - struct dvobj_priv *pdvobj = (struct dvobj_priv *)&padapter->dvobjpriv; + struct dvobj_priv *pdvobj = &padapter->dvobjpriv; struct registry_priv *pregpriv = &padapter->registrypriv; memset(pfwpriv, 0, sizeof(struct fw_priv)); -- cgit v1.2.3 From cc5797d28b1418872864da7e9a0c52841b2e9177 Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 9 Mar 2015 16:11:20 +0530 Subject: drivers: staging: iio: meter: Removed unnecessary variable Variable ret is used only to store the return value. Hence ret is removed and the return statement modified. Coccinelle was used to detect such removable variables: @rule1@ identifier ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7854-spi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7854-spi.c b/drivers/staging/iio/meter/ade7854-spi.c index 94f73bbbc0fd..9b255a5f62c3 100644 --- a/drivers/staging/iio/meter/ade7854-spi.c +++ b/drivers/staging/iio/meter/ade7854-spi.c @@ -274,7 +274,6 @@ error_ret: static int ade7854_spi_probe(struct spi_device *spi) { - int ret; struct ade7854_state *st; struct iio_dev *indio_dev; @@ -294,10 +293,7 @@ static int ade7854_spi_probe(struct spi_device *spi) st->irq = spi->irq; st->spi = spi; - - ret = ade7854_probe(indio_dev, &spi->dev); - - return ret; + return ade7854_probe(indio_dev, &spi->dev); } static int ade7854_spi_remove(struct spi_device *spi) -- cgit v1.2.3 From 07f83131e5b5d309dc8dd41911b66d3ce4c99323 Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 9 Mar 2015 16:11:19 +0530 Subject: drivers: staging: iio: meter: Removed unnecessary variable Variable ret is used only to store the return value. Hence ret is removed and the return statement modified. Coccinelle was used to detect such removable variables: @rule1@ identifier ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7854-i2c.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index 4e7a3829ea55..07cfe28b24e2 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -205,7 +205,6 @@ out: static int ade7854_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { - int ret; struct ade7854_state *st; struct iio_dev *indio_dev; @@ -225,9 +224,7 @@ static int ade7854_i2c_probe(struct i2c_client *client, st->i2c = client; st->irq = client->irq; - ret = ade7854_probe(indio_dev, &client->dev); - - return ret; + return ade7854_probe(indio_dev, &client->dev); } static int ade7854_i2c_remove(struct i2c_client *client) -- cgit v1.2.3 From 9d9f5a2dac916013d9b0560e176a7619f7bf958d Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 9 Mar 2015 16:11:18 +0530 Subject: drivers: staging: iio: meter: Removed unnecessary variable Variable ret is used only to store the error code to be returned. Hence use of ret is removed and the return statement modified. Coccinelle was used to prepare the patch: @rule1@ identifier ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7758_ring.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c index 3792b5761645..9725a04c0c92 100644 --- a/drivers/staging/iio/meter/ade7758_ring.c +++ b/drivers/staging/iio/meter/ade7758_ring.c @@ -120,8 +120,7 @@ int ade7758_configure_ring(struct iio_dev *indio_dev) buffer = iio_kfifo_allocate(); if (!buffer) { - ret = -ENOMEM; - return ret; + return -ENOMEM; } iio_device_attach_buffer(indio_dev, buffer); -- cgit v1.2.3 From 90a9de83578fb7890a2f5a96dd393621f165ba5a Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 9 Mar 2015 16:11:17 +0530 Subject: drivers: staging: iio: meter: Removed unnecessary variable Variable len is used only to store the return value. Hence len is removed and the return statement modified. Coccinelle was used to detect such removable variables: @rule1@ identifier ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7758_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c index 7e287dae7b44..652aa1069b06 100644 --- a/drivers/staging/iio/meter/ade7758_core.c +++ b/drivers/staging/iio/meter/ade7758_core.c @@ -485,7 +485,7 @@ static ssize_t ade7758_read_frequency(struct device *dev, struct device_attribute *attr, char *buf) { - int ret, len = 0; + int ret; u8 t; int sps; @@ -498,8 +498,7 @@ static ssize_t ade7758_read_frequency(struct device *dev, t = (t >> 5) & 0x3; sps = 26040 / (1 << t); - len = sprintf(buf, "%d SPS\n", sps); - return len; + return sprintf(buf, "%d SPS\n", sps); } static ssize_t ade7758_write_frequency(struct device *dev, -- cgit v1.2.3 From 3194e14db920138f4a0a19a03cb4c26db9969445 Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Mon, 9 Mar 2015 16:11:16 +0530 Subject: drivers: staging: iio: accel: Removed unnecessary variable Variable len is used only to store the return value. Hence len is removed and the return statement modified. Coccinelle was used to detect such removable variables: @rule1@ identifier ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Tina Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/sca3000_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c index 31fb2182c198..b614f272b5f4 100644 --- a/drivers/staging/iio/accel/sca3000_core.c +++ b/drivers/staging/iio/accel/sca3000_core.c @@ -870,7 +870,7 @@ static ssize_t sca3000_query_free_fall_mode(struct device *dev, struct device_attribute *attr, char *buf) { - int ret, len; + int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct sca3000_state *st = iio_priv(indio_dev); int val; @@ -881,9 +881,7 @@ static ssize_t sca3000_query_free_fall_mode(struct device *dev, mutex_unlock(&st->lock); if (ret < 0) return ret; - len = sprintf(buf, "%d\n", - !!(val & SCA3000_FREE_FALL_DETECT)); - return len; + return sprintf(buf, "%d\n", !!(val & SCA3000_FREE_FALL_DETECT)); } /** -- cgit v1.2.3 From 6706bbd843477600a72132c884bc5658d628aa8c Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 9 Mar 2015 02:27:43 +0200 Subject: Staging: rtl8192u: Remove unnecessary macro definition This patch removes the IEEE80211_PRINT_STR macro definition because it appears only in the header file and it doesn't serve any purpose in this context. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 27 -------------------------- 1 file changed, 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index b44aa17d30a7..7e81ae108fa8 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -606,33 +606,6 @@ do { if (ieee80211_debug_level & (level)) \ #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) #define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a) -#ifdef CONFIG_IEEE80211_DEBUG -/* Added by Annie, 2005-11-22. */ -#define MAX_STR_LEN 64 -/* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/ -#define PRINTABLE(_ch) (_ch>'!' && _ch<'~') -#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ - if((_Comp) & level) \ - { \ - int __i; \ - u8 buffer[MAX_STR_LEN]; \ - int length = (_Len\n", _Len, buffer); \ - } -#else -#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) do {} while (0) -#endif - -#include #include /* ARPHRD_ETHER */ #ifndef WIRELESS_SPY -- cgit v1.2.3 From 95763859c0205417cf94966f87c3839e54a8005d Mon Sep 17 00:00:00 2001 From: Roberta Dobrescu Date: Thu, 26 Feb 2015 10:49:23 +0200 Subject: staging: iio: Documentation: iio_event_monitor: Include linux/iio/types.h By adding this line and installing the kernel headers with make headers_install, iio_event_monitor can be compiled without any hacks. Signed-off-by: Roberta Dobrescu Signed-off-by: Jonathan Cameron --- drivers/staging/iio/Documentation/iio_event_monitor.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/Documentation/iio_event_monitor.c b/drivers/staging/iio/Documentation/iio_event_monitor.c index 72c96aa6e992..019a6e5cdcd8 100644 --- a/drivers/staging/iio/Documentation/iio_event_monitor.c +++ b/drivers/staging/iio/Documentation/iio_event_monitor.c @@ -28,6 +28,7 @@ #include #include "iio_utils.h" #include +#include static const char * const iio_chan_type_name_spec[] = { [IIO_VOLTAGE] = "voltage", -- cgit v1.2.3 From bdcb31d048074d82ed7c50ed45f737d7637f1224 Mon Sep 17 00:00:00 2001 From: Roberta Dobrescu Date: Thu, 26 Feb 2015 10:49:24 +0200 Subject: staging: iio: Documentation: Introduce iio_utils.c This patch removes inline functions from iio_utils.h in order to clean the code. iio_utils.c contains the implementation of the functions used by iio_event_monitor.c, lsiio.c or generic_buffer.c and iio_utils.h contains the declarations of these functions. Since iio_utils.h is modified, generic_buffer.c and iio_event_monitor.c must include stdlib.h. Signed-off-by: Roberta Dobrescu Signed-off-by: Jonathan Cameron --- drivers/staging/iio/Documentation/generic_buffer.c | 1 + .../staging/iio/Documentation/iio_event_monitor.c | 1 + drivers/staging/iio/Documentation/iio_utils.c | 651 ++++++++++++++++++++ drivers/staging/iio/Documentation/iio_utils.h | 664 +-------------------- 4 files changed, 679 insertions(+), 638 deletions(-) create mode 100644 drivers/staging/iio/Documentation/iio_utils.c (limited to 'drivers/staging') diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index de4647e2495e..01266c2556da 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -21,6 +21,7 @@ #define _GNU_SOURCE #include +#include #include #include #include diff --git a/drivers/staging/iio/Documentation/iio_event_monitor.c b/drivers/staging/iio/Documentation/iio_event_monitor.c index 019a6e5cdcd8..f19cff19900e 100644 --- a/drivers/staging/iio/Documentation/iio_event_monitor.c +++ b/drivers/staging/iio/Documentation/iio_event_monitor.c @@ -19,6 +19,7 @@ #define _GNU_SOURCE #include +#include #include #include #include diff --git a/drivers/staging/iio/Documentation/iio_utils.c b/drivers/staging/iio/Documentation/iio_utils.c new file mode 100644 index 000000000000..aea928210187 --- /dev/null +++ b/drivers/staging/iio/Documentation/iio_utils.c @@ -0,0 +1,651 @@ +/* IIO - useful set of util functionality + * + * Copyright (c) 2008 Jonathan Cameron + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "iio_utils.h" + +const char *iio_dir = "/sys/bus/iio/devices/"; + +/** + * iioutils_break_up_name() - extract generic name from full channel name + * @full_name: the full channel name + * @generic_name: the output generic channel name + **/ +int iioutils_break_up_name(const char *full_name, + char **generic_name) +{ + char *current; + char *w, *r; + char *working; + + current = strdup(full_name); + working = strtok(current, "_\0"); + w = working; + r = working; + + while (*r != '\0') { + if (!isdigit(*r)) { + *w = *r; + w++; + } + r++; + } + *w = '\0'; + *generic_name = strdup(working); + free(current); + + return 0; +} + +/** + * iioutils_get_type() - find and process _type attribute data + * @is_signed: output whether channel is signed + * @bytes: output how many bytes the channel storage occupies + * @mask: output a bit mask for the raw data + * @be: big endian + * @device_dir: the iio device directory + * @name: the channel name + * @generic_name: the channel type name + **/ +int iioutils_get_type(unsigned *is_signed, + unsigned *bytes, + unsigned *bits_used, + unsigned *shift, + uint64_t *mask, + unsigned *be, + const char *device_dir, + const char *name, + const char *generic_name) +{ + FILE *sysfsfp; + int ret; + DIR *dp; + char *scan_el_dir, *builtname, *builtname_generic, *filename = 0; + char signchar, endianchar; + unsigned padint; + const struct dirent *ent; + + ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); + if (ret < 0) { + ret = -ENOMEM; + goto error_ret; + } + ret = asprintf(&builtname, FORMAT_TYPE_FILE, name); + if (ret < 0) { + ret = -ENOMEM; + goto error_free_scan_el_dir; + } + ret = asprintf(&builtname_generic, FORMAT_TYPE_FILE, generic_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_free_builtname; + } + + dp = opendir(scan_el_dir); + if (dp == NULL) { + ret = -errno; + goto error_free_builtname_generic; + } + while (ent = readdir(dp), ent != NULL) + /* + * Do we allow devices to override a generic name with + * a specific one? + */ + if ((strcmp(builtname, ent->d_name) == 0) || + (strcmp(builtname_generic, ent->d_name) == 0)) { + ret = asprintf(&filename, + "%s/%s", scan_el_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_closedir; + } + sysfsfp = fopen(filename, "r"); + if (sysfsfp == NULL) { + printf("failed to open %s\n", filename); + ret = -errno; + goto error_free_filename; + } + + ret = fscanf(sysfsfp, + "%ce:%c%u/%u>>%u", + &endianchar, + &signchar, + bits_used, + &padint, shift); + if (ret < 0) { + printf("failed to pass scan type description\n"); + ret = -errno; + goto error_close_sysfsfp; + } + *be = (endianchar == 'b'); + *bytes = padint / 8; + if (*bits_used == 64) + *mask = ~0; + else + *mask = (1 << *bits_used) - 1; + if (signchar == 's') + *is_signed = 1; + else + *is_signed = 0; + fclose(sysfsfp); + free(filename); + + filename = 0; + sysfsfp = 0; + } +error_close_sysfsfp: + if (sysfsfp) + fclose(sysfsfp); +error_free_filename: + if (filename) + free(filename); +error_closedir: + closedir(dp); +error_free_builtname_generic: + free(builtname_generic); +error_free_builtname: + free(builtname); +error_free_scan_el_dir: + free(scan_el_dir); +error_ret: + return ret; +} + +int iioutils_get_param_float(float *output, + const char *param_name, + const char *device_dir, + const char *name, + const char *generic_name) +{ + FILE *sysfsfp; + int ret; + DIR *dp; + char *builtname, *builtname_generic; + char *filename = NULL; + const struct dirent *ent; + + ret = asprintf(&builtname, "%s_%s", name, param_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_ret; + } + ret = asprintf(&builtname_generic, + "%s_%s", generic_name, param_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_free_builtname; + } + dp = opendir(device_dir); + if (dp == NULL) { + ret = -errno; + goto error_free_builtname_generic; + } + while (ent = readdir(dp), ent != NULL) + if ((strcmp(builtname, ent->d_name) == 0) || + (strcmp(builtname_generic, ent->d_name) == 0)) { + ret = asprintf(&filename, + "%s/%s", device_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_closedir; + } + sysfsfp = fopen(filename, "r"); + if (!sysfsfp) { + ret = -errno; + goto error_free_filename; + } + fscanf(sysfsfp, "%f", output); + break; + } +error_free_filename: + if (filename) + free(filename); +error_closedir: + closedir(dp); +error_free_builtname_generic: + free(builtname_generic); +error_free_builtname: + free(builtname); +error_ret: + return ret; +} + +/** + * bsort_channel_array_by_index() - reorder so that the array is in index order + * + **/ + +void bsort_channel_array_by_index(struct iio_channel_info **ci_array, + int cnt) +{ + + struct iio_channel_info temp; + int x, y; + + for (x = 0; x < cnt; x++) + for (y = 0; y < (cnt - 1); y++) + if ((*ci_array)[y].index > (*ci_array)[y+1].index) { + temp = (*ci_array)[y + 1]; + (*ci_array)[y + 1] = (*ci_array)[y]; + (*ci_array)[y] = temp; + } +} + +/** + * build_channel_array() - function to figure out what channels are present + * @device_dir: the IIO device directory in sysfs + * @ + **/ +int build_channel_array(const char *device_dir, + struct iio_channel_info **ci_array, + int *counter) +{ + DIR *dp; + FILE *sysfsfp; + int count, i; + struct iio_channel_info *current; + int ret; + const struct dirent *ent; + char *scan_el_dir; + char *filename; + + *counter = 0; + ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); + if (ret < 0) { + ret = -ENOMEM; + goto error_ret; + } + dp = opendir(scan_el_dir); + if (dp == NULL) { + ret = -errno; + goto error_free_name; + } + while (ent = readdir(dp), ent != NULL) + if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), + "_en") == 0) { + ret = asprintf(&filename, + "%s/%s", scan_el_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_close_dir; + } + sysfsfp = fopen(filename, "r"); + if (sysfsfp == NULL) { + ret = -errno; + free(filename); + goto error_close_dir; + } + fscanf(sysfsfp, "%i", &ret); + if (ret == 1) + (*counter)++; + fclose(sysfsfp); + free(filename); + } + *ci_array = malloc(sizeof(**ci_array) * (*counter)); + if (*ci_array == NULL) { + ret = -ENOMEM; + goto error_close_dir; + } + seekdir(dp, 0); + count = 0; + while (ent = readdir(dp), ent != NULL) { + if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), + "_en") == 0) { + int current_enabled = 0; + + current = &(*ci_array)[count++]; + ret = asprintf(&filename, + "%s/%s", scan_el_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + /* decrement count to avoid freeing name */ + count--; + goto error_cleanup_array; + } + sysfsfp = fopen(filename, "r"); + if (sysfsfp == NULL) { + free(filename); + ret = -errno; + goto error_cleanup_array; + } + fscanf(sysfsfp, "%i", ¤t_enabled); + fclose(sysfsfp); + + if (!current_enabled) { + free(filename); + count--; + continue; + } + + current->scale = 1.0; + current->offset = 0; + current->name = strndup(ent->d_name, + strlen(ent->d_name) - + strlen("_en")); + if (current->name == NULL) { + free(filename); + ret = -ENOMEM; + goto error_cleanup_array; + } + /* Get the generic and specific name elements */ + ret = iioutils_break_up_name(current->name, + ¤t->generic_name); + if (ret) { + free(filename); + goto error_cleanup_array; + } + ret = asprintf(&filename, + "%s/%s_index", + scan_el_dir, + current->name); + if (ret < 0) { + free(filename); + ret = -ENOMEM; + goto error_cleanup_array; + } + sysfsfp = fopen(filename, "r"); + fscanf(sysfsfp, "%u", ¤t->index); + fclose(sysfsfp); + free(filename); + /* Find the scale */ + ret = iioutils_get_param_float(¤t->scale, + "scale", + device_dir, + current->name, + current->generic_name); + if (ret < 0) + goto error_cleanup_array; + ret = iioutils_get_param_float(¤t->offset, + "offset", + device_dir, + current->name, + current->generic_name); + if (ret < 0) + goto error_cleanup_array; + ret = iioutils_get_type(¤t->is_signed, + ¤t->bytes, + ¤t->bits_used, + ¤t->shift, + ¤t->mask, + ¤t->be, + device_dir, + current->name, + current->generic_name); + } + } + + closedir(dp); + /* reorder so that the array is in index order */ + bsort_channel_array_by_index(ci_array, *counter); + + return 0; + +error_cleanup_array: + for (i = count - 1; i >= 0; i--) + free((*ci_array)[i].name); + free(*ci_array); +error_close_dir: + closedir(dp); +error_free_name: + free(scan_el_dir); +error_ret: + return ret; +} + +/** + * find_type_by_name() - function to match top level types by name + * @name: top level type instance name + * @type: the type of top level instance being sort + * + * Typical types this is used for are device and trigger. + **/ +int find_type_by_name(const char *name, const char *type) +{ + const struct dirent *ent; + int number, numstrlen; + + FILE *nameFile; + DIR *dp; + char thisname[IIO_MAX_NAME_LENGTH]; + char *filename; + + dp = opendir(iio_dir); + if (dp == NULL) { + printf("No industrialio devices available\n"); + return -ENODEV; + } + + while (ent = readdir(dp), ent != NULL) { + if (strcmp(ent->d_name, ".") != 0 && + strcmp(ent->d_name, "..") != 0 && + strlen(ent->d_name) > strlen(type) && + strncmp(ent->d_name, type, strlen(type)) == 0) { + numstrlen = sscanf(ent->d_name + strlen(type), + "%d", + &number); + /* verify the next character is not a colon */ + if (strncmp(ent->d_name + strlen(type) + numstrlen, + ":", + 1) != 0) { + filename = malloc(strlen(iio_dir) + + strlen(type) + + numstrlen + + 6); + if (filename == NULL) { + closedir(dp); + return -ENOMEM; + } + sprintf(filename, "%s%s%d/name", + iio_dir, + type, + number); + nameFile = fopen(filename, "r"); + if (!nameFile) { + free(filename); + continue; + } + free(filename); + fscanf(nameFile, "%s", thisname); + fclose(nameFile); + if (strcmp(name, thisname) == 0) { + closedir(dp); + return number; + } + } + } + } + closedir(dp); + return -ENODEV; +} + +int _write_sysfs_int(char *filename, char *basedir, int val, int verify) +{ + int ret = 0; + FILE *sysfsfp; + int test; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) + return -ENOMEM; + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "w"); + if (sysfsfp == NULL) { + printf("failed to open %s\n", temp); + ret = -errno; + goto error_free; + } + fprintf(sysfsfp, "%d", val); + fclose(sysfsfp); + if (verify) { + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + printf("failed to open %s\n", temp); + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%d", &test); + fclose(sysfsfp); + if (test != val) { + printf("Possible failure in int write %d to %s%s\n", + val, + basedir, + filename); + ret = -1; + } + } +error_free: + free(temp); + return ret; +} + +int write_sysfs_int(char *filename, char *basedir, int val) +{ + return _write_sysfs_int(filename, basedir, val, 0); +} + +int write_sysfs_int_and_verify(char *filename, char *basedir, int val) +{ + return _write_sysfs_int(filename, basedir, val, 1); +} + +int _write_sysfs_string(char *filename, char *basedir, char *val, int verify) +{ + int ret = 0; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed\n"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "w"); + if (sysfsfp == NULL) { + printf("Could not open %s\n", temp); + ret = -errno; + goto error_free; + } + fprintf(sysfsfp, "%s", val); + fclose(sysfsfp); + if (verify) { + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + printf("could not open file to verify\n"); + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%s", temp); + fclose(sysfsfp); + if (strcmp(temp, val) != 0) { + printf("Possible failure in string write of %s " + "Should be %s " + "written to %s\%s\n", + temp, + val, + basedir, + filename); + ret = -1; + } + } +error_free: + free(temp); + + return ret; +} + +/** + * write_sysfs_string_and_verify() - string write, readback and verify + * @filename: name of file to write to + * @basedir: the sysfs directory in which the file is to be found + * @val: the string to write + **/ +int write_sysfs_string_and_verify(char *filename, char *basedir, char *val) +{ + return _write_sysfs_string(filename, basedir, val, 1); +} + +int write_sysfs_string(char *filename, char *basedir, char *val) +{ + return _write_sysfs_string(filename, basedir, val, 0); +} + +int read_sysfs_posint(char *filename, char *basedir) +{ + int ret; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%d\n", &ret); + fclose(sysfsfp); +error_free: + free(temp); + return ret; +} + +int read_sysfs_float(char *filename, char *basedir, float *val) +{ + int ret = 0; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%f\n", val); + fclose(sysfsfp); +error_free: + free(temp); + return ret; +} + +int read_sysfs_string(const char *filename, const char *basedir, char *str) +{ + int ret = 0; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%s\n", str); + fclose(sysfsfp); +error_free: + free(temp); + return ret; +} diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 568eff06f803..1bc837b2d769 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -1,3 +1,6 @@ +#ifndef _IIO_UTILS_H_ +#define _IIO_UTILS_H_ + /* IIO - useful set of util functionality * * Copyright (c) 2008 Jonathan Cameron @@ -7,13 +10,7 @@ * the Free Software Foundation. */ -#include -#include -#include -#include #include -#include -#include /* Made up value to limit allocation sizes */ #define IIO_MAX_NAME_LENGTH 30 @@ -21,38 +18,7 @@ #define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements" #define FORMAT_TYPE_FILE "%s_type" -const char *iio_dir = "/sys/bus/iio/devices/"; - -/** - * iioutils_break_up_name() - extract generic name from full channel name - * @full_name: the full channel name - * @generic_name: the output generic channel name - **/ -inline int iioutils_break_up_name(const char *full_name, - char **generic_name) -{ - char *current; - char *w, *r; - char *working; - - current = strdup(full_name); - working = strtok(current, "_\0"); - w = working; - r = working; - - while (*r != '\0') { - if (!isdigit(*r)) { - *w = *r; - w++; - } - r++; - } - *w = '\0'; - *generic_name = strdup(working); - free(current); - - return 0; -} +extern const char *iio_dir; /** * struct iio_channel_info - information about a given channel @@ -81,603 +47,25 @@ struct iio_channel_info { unsigned location; }; -/** - * iioutils_get_type() - find and process _type attribute data - * @is_signed: output whether channel is signed - * @bytes: output how many bytes the channel storage occupies - * @mask: output a bit mask for the raw data - * @be: big endian - * @device_dir: the iio device directory - * @name: the channel name - * @generic_name: the channel type name - **/ -inline int iioutils_get_type(unsigned *is_signed, - unsigned *bytes, - unsigned *bits_used, - unsigned *shift, - uint64_t *mask, - unsigned *be, - const char *device_dir, - const char *name, - const char *generic_name) -{ - FILE *sysfsfp; - int ret; - DIR *dp; - char *scan_el_dir, *builtname, *builtname_generic, *filename = 0; - char signchar, endianchar; - unsigned padint; - const struct dirent *ent; - - ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } - ret = asprintf(&builtname, FORMAT_TYPE_FILE, name); - if (ret < 0) { - ret = -ENOMEM; - goto error_free_scan_el_dir; - } - ret = asprintf(&builtname_generic, FORMAT_TYPE_FILE, generic_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_free_builtname; - } - - dp = opendir(scan_el_dir); - if (dp == NULL) { - ret = -errno; - goto error_free_builtname_generic; - } - while (ent = readdir(dp), ent != NULL) - /* - * Do we allow devices to override a generic name with - * a specific one? - */ - if ((strcmp(builtname, ent->d_name) == 0) || - (strcmp(builtname_generic, ent->d_name) == 0)) { - ret = asprintf(&filename, - "%s/%s", scan_el_dir, ent->d_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_closedir; - } - sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { - printf("failed to open %s\n", filename); - ret = -errno; - goto error_free_filename; - } - - ret = fscanf(sysfsfp, - "%ce:%c%u/%u>>%u", - &endianchar, - &signchar, - bits_used, - &padint, shift); - if (ret < 0) { - printf("failed to pass scan type description\n"); - ret = -errno; - goto error_close_sysfsfp; - } - *be = (endianchar == 'b'); - *bytes = padint / 8; - if (*bits_used == 64) - *mask = ~0; - else - *mask = (1 << *bits_used) - 1; - if (signchar == 's') - *is_signed = 1; - else - *is_signed = 0; - fclose(sysfsfp); - free(filename); - - filename = 0; - sysfsfp = 0; - } -error_close_sysfsfp: - if (sysfsfp) - fclose(sysfsfp); -error_free_filename: - if (filename) - free(filename); -error_closedir: - closedir(dp); -error_free_builtname_generic: - free(builtname_generic); -error_free_builtname: - free(builtname); -error_free_scan_el_dir: - free(scan_el_dir); -error_ret: - return ret; -} - -inline int iioutils_get_param_float(float *output, - const char *param_name, - const char *device_dir, - const char *name, - const char *generic_name) -{ - FILE *sysfsfp; - int ret; - DIR *dp; - char *builtname, *builtname_generic; - char *filename = NULL; - const struct dirent *ent; - - ret = asprintf(&builtname, "%s_%s", name, param_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } - ret = asprintf(&builtname_generic, - "%s_%s", generic_name, param_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_free_builtname; - } - dp = opendir(device_dir); - if (dp == NULL) { - ret = -errno; - goto error_free_builtname_generic; - } - while (ent = readdir(dp), ent != NULL) - if ((strcmp(builtname, ent->d_name) == 0) || - (strcmp(builtname_generic, ent->d_name) == 0)) { - ret = asprintf(&filename, - "%s/%s", device_dir, ent->d_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_closedir; - } - sysfsfp = fopen(filename, "r"); - if (!sysfsfp) { - ret = -errno; - goto error_free_filename; - } - fscanf(sysfsfp, "%f", output); - break; - } -error_free_filename: - if (filename) - free(filename); -error_closedir: - closedir(dp); -error_free_builtname_generic: - free(builtname_generic); -error_free_builtname: - free(builtname); -error_ret: - return ret; -} - -/** - * bsort_channel_array_by_index() - reorder so that the array is in index order - * - **/ - -inline void bsort_channel_array_by_index(struct iio_channel_info **ci_array, - int cnt) -{ - - struct iio_channel_info temp; - int x, y; - - for (x = 0; x < cnt; x++) - for (y = 0; y < (cnt - 1); y++) - if ((*ci_array)[y].index > (*ci_array)[y+1].index) { - temp = (*ci_array)[y + 1]; - (*ci_array)[y + 1] = (*ci_array)[y]; - (*ci_array)[y] = temp; - } -} - -/** - * build_channel_array() - function to figure out what channels are present - * @device_dir: the IIO device directory in sysfs - * @ - **/ -inline int build_channel_array(const char *device_dir, - struct iio_channel_info **ci_array, - int *counter) -{ - DIR *dp; - FILE *sysfsfp; - int count, i; - struct iio_channel_info *current; - int ret; - const struct dirent *ent; - char *scan_el_dir; - char *filename; - - *counter = 0; - ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } - dp = opendir(scan_el_dir); - if (dp == NULL) { - ret = -errno; - goto error_free_name; - } - while (ent = readdir(dp), ent != NULL) - if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), - "_en") == 0) { - ret = asprintf(&filename, - "%s/%s", scan_el_dir, ent->d_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_close_dir; - } - sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { - ret = -errno; - free(filename); - goto error_close_dir; - } - fscanf(sysfsfp, "%i", &ret); - if (ret == 1) - (*counter)++; - fclose(sysfsfp); - free(filename); - } - *ci_array = malloc(sizeof(**ci_array) * (*counter)); - if (*ci_array == NULL) { - ret = -ENOMEM; - goto error_close_dir; - } - seekdir(dp, 0); - count = 0; - while (ent = readdir(dp), ent != NULL) { - if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), - "_en") == 0) { - int current_enabled = 0; - - current = &(*ci_array)[count++]; - ret = asprintf(&filename, - "%s/%s", scan_el_dir, ent->d_name); - if (ret < 0) { - ret = -ENOMEM; - /* decrement count to avoid freeing name */ - count--; - goto error_cleanup_array; - } - sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { - free(filename); - ret = -errno; - goto error_cleanup_array; - } - fscanf(sysfsfp, "%i", ¤t_enabled); - fclose(sysfsfp); - - if (!current_enabled) { - free(filename); - count--; - continue; - } - - current->scale = 1.0; - current->offset = 0; - current->name = strndup(ent->d_name, - strlen(ent->d_name) - - strlen("_en")); - if (current->name == NULL) { - free(filename); - ret = -ENOMEM; - goto error_cleanup_array; - } - /* Get the generic and specific name elements */ - ret = iioutils_break_up_name(current->name, - ¤t->generic_name); - if (ret) { - free(filename); - goto error_cleanup_array; - } - ret = asprintf(&filename, - "%s/%s_index", - scan_el_dir, - current->name); - if (ret < 0) { - free(filename); - ret = -ENOMEM; - goto error_cleanup_array; - } - sysfsfp = fopen(filename, "r"); - fscanf(sysfsfp, "%u", ¤t->index); - fclose(sysfsfp); - free(filename); - /* Find the scale */ - ret = iioutils_get_param_float(¤t->scale, - "scale", - device_dir, - current->name, - current->generic_name); - if (ret < 0) - goto error_cleanup_array; - ret = iioutils_get_param_float(¤t->offset, - "offset", - device_dir, - current->name, - current->generic_name); - if (ret < 0) - goto error_cleanup_array; - ret = iioutils_get_type(¤t->is_signed, - ¤t->bytes, - ¤t->bits_used, - ¤t->shift, - ¤t->mask, - ¤t->be, - device_dir, - current->name, - current->generic_name); - } - } - - closedir(dp); - /* reorder so that the array is in index order */ - bsort_channel_array_by_index(ci_array, *counter); - - return 0; - -error_cleanup_array: - for (i = count - 1; i >= 0; i--) - free((*ci_array)[i].name); - free(*ci_array); -error_close_dir: - closedir(dp); -error_free_name: - free(scan_el_dir); -error_ret: - return ret; -} - -/** - * find_type_by_name() - function to match top level types by name - * @name: top level type instance name - * @type: the type of top level instance being sort - * - * Typical types this is used for are device and trigger. - **/ -inline int find_type_by_name(const char *name, const char *type) -{ - const struct dirent *ent; - int number, numstrlen; - - FILE *nameFile; - DIR *dp; - char thisname[IIO_MAX_NAME_LENGTH]; - char *filename; - - dp = opendir(iio_dir); - if (dp == NULL) { - printf("No industrialio devices available\n"); - return -ENODEV; - } - - while (ent = readdir(dp), ent != NULL) { - if (strcmp(ent->d_name, ".") != 0 && - strcmp(ent->d_name, "..") != 0 && - strlen(ent->d_name) > strlen(type) && - strncmp(ent->d_name, type, strlen(type)) == 0) { - numstrlen = sscanf(ent->d_name + strlen(type), - "%d", - &number); - /* verify the next character is not a colon */ - if (strncmp(ent->d_name + strlen(type) + numstrlen, - ":", - 1) != 0) { - filename = malloc(strlen(iio_dir) - + strlen(type) - + numstrlen - + 6); - if (filename == NULL) { - closedir(dp); - return -ENOMEM; - } - sprintf(filename, "%s%s%d/name", - iio_dir, - type, - number); - nameFile = fopen(filename, "r"); - if (!nameFile) { - free(filename); - continue; - } - free(filename); - fscanf(nameFile, "%s", thisname); - fclose(nameFile); - if (strcmp(name, thisname) == 0) { - closedir(dp); - return number; - } - } - } - } - closedir(dp); - return -ENODEV; -} - -inline int _write_sysfs_int(char *filename, char *basedir, int val, int verify) -{ - int ret = 0; - FILE *sysfsfp; - int test; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) - return -ENOMEM; - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "w"); - if (sysfsfp == NULL) { - printf("failed to open %s\n", temp); - ret = -errno; - goto error_free; - } - fprintf(sysfsfp, "%d", val); - fclose(sysfsfp); - if (verify) { - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - printf("failed to open %s\n", temp); - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%d", &test); - fclose(sysfsfp); - if (test != val) { - printf("Possible failure in int write %d to %s%s\n", - val, - basedir, - filename); - ret = -1; - } - } -error_free: - free(temp); - return ret; -} - -int write_sysfs_int(char *filename, char *basedir, int val) -{ - return _write_sysfs_int(filename, basedir, val, 0); -} - -int write_sysfs_int_and_verify(char *filename, char *basedir, int val) -{ - return _write_sysfs_int(filename, basedir, val, 1); -} - -int _write_sysfs_string(char *filename, char *basedir, char *val, int verify) -{ - int ret = 0; - FILE *sysfsfp; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) { - printf("Memory allocation failed\n"); - return -ENOMEM; - } - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "w"); - if (sysfsfp == NULL) { - printf("Could not open %s\n", temp); - ret = -errno; - goto error_free; - } - fprintf(sysfsfp, "%s", val); - fclose(sysfsfp); - if (verify) { - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - printf("could not open file to verify\n"); - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%s", temp); - fclose(sysfsfp); - if (strcmp(temp, val) != 0) { - printf("Possible failure in string write of %s " - "Should be %s " - "written to %s\%s\n", - temp, - val, - basedir, - filename); - ret = -1; - } - } -error_free: - free(temp); - - return ret; -} - -/** - * write_sysfs_string_and_verify() - string write, readback and verify - * @filename: name of file to write to - * @basedir: the sysfs directory in which the file is to be found - * @val: the string to write - **/ -int write_sysfs_string_and_verify(char *filename, char *basedir, char *val) -{ - return _write_sysfs_string(filename, basedir, val, 1); -} - -int write_sysfs_string(char *filename, char *basedir, char *val) -{ - return _write_sysfs_string(filename, basedir, val, 0); -} - -int read_sysfs_posint(char *filename, char *basedir) -{ - int ret; - FILE *sysfsfp; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) { - printf("Memory allocation failed"); - return -ENOMEM; - } - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%d\n", &ret); - fclose(sysfsfp); -error_free: - free(temp); - return ret; -} - -int read_sysfs_float(char *filename, char *basedir, float *val) -{ - int ret = 0; - FILE *sysfsfp; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) { - printf("Memory allocation failed"); - return -ENOMEM; - } - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%f\n", val); - fclose(sysfsfp); -error_free: - free(temp); - return ret; -} - -int read_sysfs_string(const char *filename, const char *basedir, char *str) -{ - int ret = 0; - FILE *sysfsfp; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) { - printf("Memory allocation failed"); - return -ENOMEM; - } - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%s\n", str); - fclose(sysfsfp); -error_free: - free(temp); - return ret; -} +int iioutils_break_up_name(const char *full_name, char **generic_name); +int iioutils_get_type(unsigned *is_signed, unsigned *bytes, + unsigned *bits_used, unsigned *shift, + uint64_t *mask, unsigned *be, + const char *device_dir, const char *name, + const char *generic_name); +int iioutils_get_param_float(float *output, const char *param_name, + const char *device_dir, const char *name, + const char *generic_name); +void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt); +int build_channel_array(const char *device_dir, + struct iio_channel_info **ci_array, int *counter); +int find_type_by_name(const char *name, const char *type); +int write_sysfs_int(char *filename, char *basedir, int val); +int write_sysfs_int_and_verify(char *filename, char *basedir, int val); +int write_sysfs_string_and_verify(char *filename, char *basedir, char *val); +int write_sysfs_string(char *filename, char *basedir, char *val); +int read_sysfs_posint(char *filename, char *basedir); +int read_sysfs_float(char *filename, char *basedir, float *val); +int read_sysfs_string(const char *filename, const char *basedir, char *str); + +#endif /* _IIO_UTILS_H_ */ -- cgit v1.2.3 From 817020cfb3a2649064a1e14e083934234e2c208d Mon Sep 17 00:00:00 2001 From: Roberta Dobrescu Date: Thu, 26 Feb 2015 10:49:25 +0200 Subject: iio: Move iio userspace applications out of staging This patch moves iio userspace applications out of staging, to tools/iio/ and adds a Makefile in order to compile them easily. It also adds tools/iio/ to MAINTAINERS file. Signed-off-by: Roberta Dobrescu Signed-off-by: Jonathan Cameron --- drivers/staging/iio/Documentation/generic_buffer.c | 361 ------------ .../staging/iio/Documentation/iio_event_monitor.c | 310 ---------- drivers/staging/iio/Documentation/iio_utils.c | 651 --------------------- drivers/staging/iio/Documentation/iio_utils.h | 71 --- drivers/staging/iio/Documentation/lsiio.c | 163 ------ 5 files changed, 1556 deletions(-) delete mode 100644 drivers/staging/iio/Documentation/generic_buffer.c delete mode 100644 drivers/staging/iio/Documentation/iio_event_monitor.c delete mode 100644 drivers/staging/iio/Documentation/iio_utils.c delete mode 100644 drivers/staging/iio/Documentation/iio_utils.h delete mode 100644 drivers/staging/iio/Documentation/lsiio.c (limited to 'drivers/staging') diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c deleted file mode 100644 index 01266c2556da..000000000000 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ /dev/null @@ -1,361 +0,0 @@ -/* Industrialio buffer test code. - * - * Copyright (c) 2008 Jonathan Cameron - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * This program is primarily intended as an example application. - * Reads the current buffer setup from sysfs and starts a short capture - * from the specified device, pretty printing the result after appropriate - * conversion. - * - * Command line parameters - * generic_buffer -n -t - * If trigger name is not specified the program assumes you want a dataready - * trigger associated with the device and goes looking for it. - * - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "iio_utils.h" - -/** - * size_from_channelarray() - calculate the storage size of a scan - * @channels: the channel info array - * @num_channels: number of channels - * - * Has the side effect of filling the channels[i].location values used - * in processing the buffer output. - **/ -int size_from_channelarray(struct iio_channel_info *channels, int num_channels) -{ - int bytes = 0; - int i = 0; - - while (i < num_channels) { - if (bytes % channels[i].bytes == 0) - channels[i].location = bytes; - else - channels[i].location = bytes - bytes%channels[i].bytes - + channels[i].bytes; - bytes = channels[i].location + channels[i].bytes; - i++; - } - return bytes; -} - -void print2byte(int input, struct iio_channel_info *info) -{ - /* First swap if incorrect endian */ - if (info->be) - input = be16toh((uint16_t)input); - else - input = le16toh((uint16_t)input); - - /* - * Shift before conversion to avoid sign extension - * of left aligned data - */ - input = input >> info->shift; - if (info->is_signed) { - int16_t val = input; - - val &= (1 << info->bits_used) - 1; - val = (int16_t)(val << (16 - info->bits_used)) >> - (16 - info->bits_used); - printf("%05f ", ((float)val + info->offset)*info->scale); - } else { - uint16_t val = input; - - val &= (1 << info->bits_used) - 1; - printf("%05f ", ((float)val + info->offset)*info->scale); - } -} -/** - * process_scan() - print out the values in SI units - * @data: pointer to the start of the scan - * @channels: information about the channels. Note - * size_from_channelarray must have been called first to fill the - * location offsets. - * @num_channels: number of channels - **/ -void process_scan(char *data, - struct iio_channel_info *channels, - int num_channels) -{ - int k; - - for (k = 0; k < num_channels; k++) - switch (channels[k].bytes) { - /* only a few cases implemented so far */ - case 2: - print2byte(*(uint16_t *)(data + channels[k].location), - &channels[k]); - break; - case 4: - if (!channels[k].is_signed) { - uint32_t val = *(uint32_t *) - (data + channels[k].location); - printf("%05f ", ((float)val + - channels[k].offset)* - channels[k].scale); - - } - break; - case 8: - if (channels[k].is_signed) { - int64_t val = *(int64_t *) - (data + - channels[k].location); - if ((val >> channels[k].bits_used) & 1) - val = (val & channels[k].mask) | - ~channels[k].mask; - /* special case for timestamp */ - if (channels[k].scale == 1.0f && - channels[k].offset == 0.0f) - printf("%" PRId64 " ", val); - else - printf("%05f ", ((float)val + - channels[k].offset)* - channels[k].scale); - } - break; - default: - break; - } - printf("\n"); -} - -int main(int argc, char **argv) -{ - unsigned long num_loops = 2; - unsigned long timedelay = 1000000; - unsigned long buf_len = 128; - - int ret, c, i, j, toread; - int fp; - - int num_channels; - char *trigger_name = NULL, *device_name = NULL; - char *dev_dir_name, *buf_dir_name; - - int datardytrigger = 1; - char *data; - ssize_t read_size; - int dev_num, trig_num; - char *buffer_access; - int scan_size; - int noevents = 0; - int notrigger = 0; - char *dummy; - - struct iio_channel_info *channels; - - while ((c = getopt(argc, argv, "l:w:c:et:n:g")) != -1) { - switch (c) { - case 'n': - device_name = optarg; - break; - case 't': - trigger_name = optarg; - datardytrigger = 0; - break; - case 'e': - noevents = 1; - break; - case 'c': - num_loops = strtoul(optarg, &dummy, 10); - break; - case 'w': - timedelay = strtoul(optarg, &dummy, 10); - break; - case 'l': - buf_len = strtoul(optarg, &dummy, 10); - break; - case 'g': - notrigger = 1; - break; - case '?': - return -1; - } - } - - if (device_name == NULL) - return -1; - - /* Find the device requested */ - dev_num = find_type_by_name(device_name, "iio:device"); - if (dev_num < 0) { - printf("Failed to find the %s\n", device_name); - ret = -ENODEV; - goto error_ret; - } - printf("iio device number being used is %d\n", dev_num); - - asprintf(&dev_dir_name, "%siio:device%d", iio_dir, dev_num); - - if (!notrigger) { - if (trigger_name == NULL) { - /* - * Build the trigger name. If it is device associated - * its name is _dev[n] where n matches - * the device number found above. - */ - ret = asprintf(&trigger_name, - "%s-dev%d", device_name, dev_num); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } - } - - /* Verify the trigger exists */ - trig_num = find_type_by_name(trigger_name, "trigger"); - if (trig_num < 0) { - printf("Failed to find the trigger %s\n", trigger_name); - ret = -ENODEV; - goto error_free_triggername; - } - printf("iio trigger number being used is %d\n", trig_num); - } else - printf("trigger-less mode selected\n"); - - /* - * Parse the files in scan_elements to identify what channels are - * present - */ - ret = build_channel_array(dev_dir_name, &channels, &num_channels); - if (ret) { - printf("Problem reading scan element information\n"); - printf("diag %s\n", dev_dir_name); - goto error_free_triggername; - } - - /* - * Construct the directory name for the associated buffer. - * As we know that the lis3l02dq has only one buffer this may - * be built rather than found. - */ - ret = asprintf(&buf_dir_name, - "%siio:device%d/buffer", iio_dir, dev_num); - if (ret < 0) { - ret = -ENOMEM; - goto error_free_triggername; - } - - if (!notrigger) { - printf("%s %s\n", dev_dir_name, trigger_name); - /* Set the device trigger to be the data ready trigger found - * above */ - ret = write_sysfs_string_and_verify("trigger/current_trigger", - dev_dir_name, - trigger_name); - if (ret < 0) { - printf("Failed to write current_trigger file\n"); - goto error_free_buf_dir_name; - } - } - - /* Setup ring buffer parameters */ - ret = write_sysfs_int("length", buf_dir_name, buf_len); - if (ret < 0) - goto error_free_buf_dir_name; - - /* Enable the buffer */ - ret = write_sysfs_int("enable", buf_dir_name, 1); - if (ret < 0) - goto error_free_buf_dir_name; - scan_size = size_from_channelarray(channels, num_channels); - data = malloc(scan_size*buf_len); - if (!data) { - ret = -ENOMEM; - goto error_free_buf_dir_name; - } - - ret = asprintf(&buffer_access, "/dev/iio:device%d", dev_num); - if (ret < 0) { - ret = -ENOMEM; - goto error_free_data; - } - - /* Attempt to open non blocking the access dev */ - fp = open(buffer_access, O_RDONLY | O_NONBLOCK); - if (fp == -1) { /* If it isn't there make the node */ - printf("Failed to open %s\n", buffer_access); - ret = -errno; - goto error_free_buffer_access; - } - - /* Wait for events 10 times */ - for (j = 0; j < num_loops; j++) { - if (!noevents) { - struct pollfd pfd = { - .fd = fp, - .events = POLLIN, - }; - - poll(&pfd, 1, -1); - toread = buf_len; - - } else { - usleep(timedelay); - toread = 64; - } - - read_size = read(fp, - data, - toread*scan_size); - if (read_size < 0) { - if (errno == -EAGAIN) { - printf("nothing available\n"); - continue; - } else - break; - } - for (i = 0; i < read_size/scan_size; i++) - process_scan(data + scan_size*i, - channels, - num_channels); - } - - /* Stop the buffer */ - ret = write_sysfs_int("enable", buf_dir_name, 0); - if (ret < 0) - goto error_close_buffer_access; - - if (!notrigger) - /* Disconnect the trigger - just write a dummy name. */ - write_sysfs_string("trigger/current_trigger", - dev_dir_name, "NULL"); - -error_close_buffer_access: - close(fp); -error_free_data: - free(data); -error_free_buffer_access: - free(buffer_access); -error_free_buf_dir_name: - free(buf_dir_name); -error_free_triggername: - if (datardytrigger) - free(trigger_name); -error_ret: - return ret; -} diff --git a/drivers/staging/iio/Documentation/iio_event_monitor.c b/drivers/staging/iio/Documentation/iio_event_monitor.c deleted file mode 100644 index f19cff19900e..000000000000 --- a/drivers/staging/iio/Documentation/iio_event_monitor.c +++ /dev/null @@ -1,310 +0,0 @@ -/* Industrialio event test code. - * - * Copyright (c) 2011-2012 Lars-Peter Clausen - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * This program is primarily intended as an example application. - * Reads the current buffer setup from sysfs and starts a short capture - * from the specified device, pretty printing the result after appropriate - * conversion. - * - * Usage: - * iio_event_monitor - * - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "iio_utils.h" -#include -#include - -static const char * const iio_chan_type_name_spec[] = { - [IIO_VOLTAGE] = "voltage", - [IIO_CURRENT] = "current", - [IIO_POWER] = "power", - [IIO_ACCEL] = "accel", - [IIO_ANGL_VEL] = "anglvel", - [IIO_MAGN] = "magn", - [IIO_LIGHT] = "illuminance", - [IIO_INTENSITY] = "intensity", - [IIO_PROXIMITY] = "proximity", - [IIO_TEMP] = "temp", - [IIO_INCLI] = "incli", - [IIO_ROT] = "rot", - [IIO_ANGL] = "angl", - [IIO_TIMESTAMP] = "timestamp", - [IIO_CAPACITANCE] = "capacitance", - [IIO_ALTVOLTAGE] = "altvoltage", - [IIO_CCT] = "cct", - [IIO_PRESSURE] = "pressure", - [IIO_HUMIDITYRELATIVE] = "humidityrelative", - [IIO_ACTIVITY] = "activity", - [IIO_STEPS] = "steps", -}; - -static const char * const iio_ev_type_text[] = { - [IIO_EV_TYPE_THRESH] = "thresh", - [IIO_EV_TYPE_MAG] = "mag", - [IIO_EV_TYPE_ROC] = "roc", - [IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive", - [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive", - [IIO_EV_TYPE_CHANGE] = "change", -}; - -static const char * const iio_ev_dir_text[] = { - [IIO_EV_DIR_EITHER] = "either", - [IIO_EV_DIR_RISING] = "rising", - [IIO_EV_DIR_FALLING] = "falling" -}; - -static const char * const iio_modifier_names[] = { - [IIO_MOD_X] = "x", - [IIO_MOD_Y] = "y", - [IIO_MOD_Z] = "z", - [IIO_MOD_X_AND_Y] = "x&y", - [IIO_MOD_X_AND_Z] = "x&z", - [IIO_MOD_Y_AND_Z] = "y&z", - [IIO_MOD_X_AND_Y_AND_Z] = "x&y&z", - [IIO_MOD_X_OR_Y] = "x|y", - [IIO_MOD_X_OR_Z] = "x|z", - [IIO_MOD_Y_OR_Z] = "y|z", - [IIO_MOD_X_OR_Y_OR_Z] = "x|y|z", - [IIO_MOD_LIGHT_BOTH] = "both", - [IIO_MOD_LIGHT_IR] = "ir", - [IIO_MOD_ROOT_SUM_SQUARED_X_Y] = "sqrt(x^2+y^2)", - [IIO_MOD_SUM_SQUARED_X_Y_Z] = "x^2+y^2+z^2", - [IIO_MOD_LIGHT_CLEAR] = "clear", - [IIO_MOD_LIGHT_RED] = "red", - [IIO_MOD_LIGHT_GREEN] = "green", - [IIO_MOD_LIGHT_BLUE] = "blue", - [IIO_MOD_QUATERNION] = "quaternion", - [IIO_MOD_TEMP_AMBIENT] = "ambient", - [IIO_MOD_TEMP_OBJECT] = "object", - [IIO_MOD_NORTH_MAGN] = "from_north_magnetic", - [IIO_MOD_NORTH_TRUE] = "from_north_true", - [IIO_MOD_NORTH_MAGN_TILT_COMP] = "from_north_magnetic_tilt_comp", - [IIO_MOD_NORTH_TRUE_TILT_COMP] = "from_north_true_tilt_comp", - [IIO_MOD_RUNNING] = "running", - [IIO_MOD_JOGGING] = "jogging", - [IIO_MOD_WALKING] = "walking", - [IIO_MOD_STILL] = "still", -}; - -static bool event_is_known(struct iio_event_data *event) -{ - enum iio_chan_type type = IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event->id); - enum iio_modifier mod = IIO_EVENT_CODE_EXTRACT_MODIFIER(event->id); - enum iio_event_type ev_type = IIO_EVENT_CODE_EXTRACT_TYPE(event->id); - enum iio_event_direction dir = IIO_EVENT_CODE_EXTRACT_DIR(event->id); - - switch (type) { - case IIO_VOLTAGE: - case IIO_CURRENT: - case IIO_POWER: - case IIO_ACCEL: - case IIO_ANGL_VEL: - case IIO_MAGN: - case IIO_LIGHT: - case IIO_INTENSITY: - case IIO_PROXIMITY: - case IIO_TEMP: - case IIO_INCLI: - case IIO_ROT: - case IIO_ANGL: - case IIO_TIMESTAMP: - case IIO_CAPACITANCE: - case IIO_ALTVOLTAGE: - case IIO_CCT: - case IIO_PRESSURE: - case IIO_HUMIDITYRELATIVE: - case IIO_ACTIVITY: - case IIO_STEPS: - break; - default: - return false; - } - - switch (mod) { - case IIO_NO_MOD: - case IIO_MOD_X: - case IIO_MOD_Y: - case IIO_MOD_Z: - case IIO_MOD_X_AND_Y: - case IIO_MOD_X_AND_Z: - case IIO_MOD_Y_AND_Z: - case IIO_MOD_X_AND_Y_AND_Z: - case IIO_MOD_X_OR_Y: - case IIO_MOD_X_OR_Z: - case IIO_MOD_Y_OR_Z: - case IIO_MOD_X_OR_Y_OR_Z: - case IIO_MOD_LIGHT_BOTH: - case IIO_MOD_LIGHT_IR: - case IIO_MOD_ROOT_SUM_SQUARED_X_Y: - case IIO_MOD_SUM_SQUARED_X_Y_Z: - case IIO_MOD_LIGHT_CLEAR: - case IIO_MOD_LIGHT_RED: - case IIO_MOD_LIGHT_GREEN: - case IIO_MOD_LIGHT_BLUE: - case IIO_MOD_QUATERNION: - case IIO_MOD_TEMP_AMBIENT: - case IIO_MOD_TEMP_OBJECT: - case IIO_MOD_NORTH_MAGN: - case IIO_MOD_NORTH_TRUE: - case IIO_MOD_NORTH_MAGN_TILT_COMP: - case IIO_MOD_NORTH_TRUE_TILT_COMP: - case IIO_MOD_RUNNING: - case IIO_MOD_JOGGING: - case IIO_MOD_WALKING: - case IIO_MOD_STILL: - break; - default: - return false; - } - - switch (ev_type) { - case IIO_EV_TYPE_THRESH: - case IIO_EV_TYPE_MAG: - case IIO_EV_TYPE_ROC: - case IIO_EV_TYPE_THRESH_ADAPTIVE: - case IIO_EV_TYPE_MAG_ADAPTIVE: - case IIO_EV_TYPE_CHANGE: - break; - default: - return false; - } - - switch (dir) { - case IIO_EV_DIR_EITHER: - case IIO_EV_DIR_RISING: - case IIO_EV_DIR_FALLING: - case IIO_EV_DIR_NONE: - break; - default: - return false; - } - - return true; -} - -static void print_event(struct iio_event_data *event) -{ - enum iio_chan_type type = IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event->id); - enum iio_modifier mod = IIO_EVENT_CODE_EXTRACT_MODIFIER(event->id); - enum iio_event_type ev_type = IIO_EVENT_CODE_EXTRACT_TYPE(event->id); - enum iio_event_direction dir = IIO_EVENT_CODE_EXTRACT_DIR(event->id); - int chan = IIO_EVENT_CODE_EXTRACT_CHAN(event->id); - int chan2 = IIO_EVENT_CODE_EXTRACT_CHAN2(event->id); - bool diff = IIO_EVENT_CODE_EXTRACT_DIFF(event->id); - - if (!event_is_known(event)) { - printf("Unknown event: time: %lld, id: %llx\n", - event->timestamp, event->id); - return; - } - - printf("Event: time: %lld, ", event->timestamp); - - if (mod != IIO_NO_MOD) { - printf("type: %s(%s), ", - iio_chan_type_name_spec[type], - iio_modifier_names[mod]); - } else { - printf("type: %s, ", - iio_chan_type_name_spec[type]); - } - - if (diff && chan >= 0 && chan2 >= 0) - printf("channel: %d-%d, ", chan, chan2); - else if (chan >= 0) - printf("channel: %d, ", chan); - - printf("evtype: %s", iio_ev_type_text[ev_type]); - - if (dir != IIO_EV_DIR_NONE) - printf(", direction: %s", iio_ev_dir_text[dir]); - printf("\n"); -} - -int main(int argc, char **argv) -{ - struct iio_event_data event; - const char *device_name; - char *chrdev_name; - int ret; - int dev_num; - int fd, event_fd; - - if (argc <= 1) { - printf("Usage: %s \n", argv[0]); - return -1; - } - - device_name = argv[1]; - - dev_num = find_type_by_name(device_name, "iio:device"); - if (dev_num >= 0) { - printf("Found IIO device with name %s with device number %d\n", - device_name, dev_num); - ret = asprintf(&chrdev_name, "/dev/iio:device%d", dev_num); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } - } else { - /* If we can't find a IIO device by name assume device_name is a - IIO chrdev */ - chrdev_name = strdup(device_name); - } - - fd = open(chrdev_name, 0); - if (fd == -1) { - fprintf(stdout, "Failed to open %s\n", chrdev_name); - ret = -errno; - goto error_free_chrdev_name; - } - - ret = ioctl(fd, IIO_GET_EVENT_FD_IOCTL, &event_fd); - - close(fd); - - if (ret == -1 || event_fd == -1) { - fprintf(stdout, "Failed to retrieve event fd\n"); - ret = -errno; - goto error_free_chrdev_name; - } - - while (true) { - ret = read(event_fd, &event, sizeof(event)); - if (ret == -1) { - if (errno == EAGAIN) { - printf("nothing available\n"); - continue; - } else { - perror("Failed to read event from device"); - ret = -errno; - break; - } - } - - print_event(&event); - } - - close(event_fd); -error_free_chrdev_name: - free(chrdev_name); -error_ret: - return ret; -} diff --git a/drivers/staging/iio/Documentation/iio_utils.c b/drivers/staging/iio/Documentation/iio_utils.c deleted file mode 100644 index aea928210187..000000000000 --- a/drivers/staging/iio/Documentation/iio_utils.c +++ /dev/null @@ -1,651 +0,0 @@ -/* IIO - useful set of util functionality - * - * Copyright (c) 2008 Jonathan Cameron - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "iio_utils.h" - -const char *iio_dir = "/sys/bus/iio/devices/"; - -/** - * iioutils_break_up_name() - extract generic name from full channel name - * @full_name: the full channel name - * @generic_name: the output generic channel name - **/ -int iioutils_break_up_name(const char *full_name, - char **generic_name) -{ - char *current; - char *w, *r; - char *working; - - current = strdup(full_name); - working = strtok(current, "_\0"); - w = working; - r = working; - - while (*r != '\0') { - if (!isdigit(*r)) { - *w = *r; - w++; - } - r++; - } - *w = '\0'; - *generic_name = strdup(working); - free(current); - - return 0; -} - -/** - * iioutils_get_type() - find and process _type attribute data - * @is_signed: output whether channel is signed - * @bytes: output how many bytes the channel storage occupies - * @mask: output a bit mask for the raw data - * @be: big endian - * @device_dir: the iio device directory - * @name: the channel name - * @generic_name: the channel type name - **/ -int iioutils_get_type(unsigned *is_signed, - unsigned *bytes, - unsigned *bits_used, - unsigned *shift, - uint64_t *mask, - unsigned *be, - const char *device_dir, - const char *name, - const char *generic_name) -{ - FILE *sysfsfp; - int ret; - DIR *dp; - char *scan_el_dir, *builtname, *builtname_generic, *filename = 0; - char signchar, endianchar; - unsigned padint; - const struct dirent *ent; - - ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } - ret = asprintf(&builtname, FORMAT_TYPE_FILE, name); - if (ret < 0) { - ret = -ENOMEM; - goto error_free_scan_el_dir; - } - ret = asprintf(&builtname_generic, FORMAT_TYPE_FILE, generic_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_free_builtname; - } - - dp = opendir(scan_el_dir); - if (dp == NULL) { - ret = -errno; - goto error_free_builtname_generic; - } - while (ent = readdir(dp), ent != NULL) - /* - * Do we allow devices to override a generic name with - * a specific one? - */ - if ((strcmp(builtname, ent->d_name) == 0) || - (strcmp(builtname_generic, ent->d_name) == 0)) { - ret = asprintf(&filename, - "%s/%s", scan_el_dir, ent->d_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_closedir; - } - sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { - printf("failed to open %s\n", filename); - ret = -errno; - goto error_free_filename; - } - - ret = fscanf(sysfsfp, - "%ce:%c%u/%u>>%u", - &endianchar, - &signchar, - bits_used, - &padint, shift); - if (ret < 0) { - printf("failed to pass scan type description\n"); - ret = -errno; - goto error_close_sysfsfp; - } - *be = (endianchar == 'b'); - *bytes = padint / 8; - if (*bits_used == 64) - *mask = ~0; - else - *mask = (1 << *bits_used) - 1; - if (signchar == 's') - *is_signed = 1; - else - *is_signed = 0; - fclose(sysfsfp); - free(filename); - - filename = 0; - sysfsfp = 0; - } -error_close_sysfsfp: - if (sysfsfp) - fclose(sysfsfp); -error_free_filename: - if (filename) - free(filename); -error_closedir: - closedir(dp); -error_free_builtname_generic: - free(builtname_generic); -error_free_builtname: - free(builtname); -error_free_scan_el_dir: - free(scan_el_dir); -error_ret: - return ret; -} - -int iioutils_get_param_float(float *output, - const char *param_name, - const char *device_dir, - const char *name, - const char *generic_name) -{ - FILE *sysfsfp; - int ret; - DIR *dp; - char *builtname, *builtname_generic; - char *filename = NULL; - const struct dirent *ent; - - ret = asprintf(&builtname, "%s_%s", name, param_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } - ret = asprintf(&builtname_generic, - "%s_%s", generic_name, param_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_free_builtname; - } - dp = opendir(device_dir); - if (dp == NULL) { - ret = -errno; - goto error_free_builtname_generic; - } - while (ent = readdir(dp), ent != NULL) - if ((strcmp(builtname, ent->d_name) == 0) || - (strcmp(builtname_generic, ent->d_name) == 0)) { - ret = asprintf(&filename, - "%s/%s", device_dir, ent->d_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_closedir; - } - sysfsfp = fopen(filename, "r"); - if (!sysfsfp) { - ret = -errno; - goto error_free_filename; - } - fscanf(sysfsfp, "%f", output); - break; - } -error_free_filename: - if (filename) - free(filename); -error_closedir: - closedir(dp); -error_free_builtname_generic: - free(builtname_generic); -error_free_builtname: - free(builtname); -error_ret: - return ret; -} - -/** - * bsort_channel_array_by_index() - reorder so that the array is in index order - * - **/ - -void bsort_channel_array_by_index(struct iio_channel_info **ci_array, - int cnt) -{ - - struct iio_channel_info temp; - int x, y; - - for (x = 0; x < cnt; x++) - for (y = 0; y < (cnt - 1); y++) - if ((*ci_array)[y].index > (*ci_array)[y+1].index) { - temp = (*ci_array)[y + 1]; - (*ci_array)[y + 1] = (*ci_array)[y]; - (*ci_array)[y] = temp; - } -} - -/** - * build_channel_array() - function to figure out what channels are present - * @device_dir: the IIO device directory in sysfs - * @ - **/ -int build_channel_array(const char *device_dir, - struct iio_channel_info **ci_array, - int *counter) -{ - DIR *dp; - FILE *sysfsfp; - int count, i; - struct iio_channel_info *current; - int ret; - const struct dirent *ent; - char *scan_el_dir; - char *filename; - - *counter = 0; - ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } - dp = opendir(scan_el_dir); - if (dp == NULL) { - ret = -errno; - goto error_free_name; - } - while (ent = readdir(dp), ent != NULL) - if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), - "_en") == 0) { - ret = asprintf(&filename, - "%s/%s", scan_el_dir, ent->d_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_close_dir; - } - sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { - ret = -errno; - free(filename); - goto error_close_dir; - } - fscanf(sysfsfp, "%i", &ret); - if (ret == 1) - (*counter)++; - fclose(sysfsfp); - free(filename); - } - *ci_array = malloc(sizeof(**ci_array) * (*counter)); - if (*ci_array == NULL) { - ret = -ENOMEM; - goto error_close_dir; - } - seekdir(dp, 0); - count = 0; - while (ent = readdir(dp), ent != NULL) { - if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), - "_en") == 0) { - int current_enabled = 0; - - current = &(*ci_array)[count++]; - ret = asprintf(&filename, - "%s/%s", scan_el_dir, ent->d_name); - if (ret < 0) { - ret = -ENOMEM; - /* decrement count to avoid freeing name */ - count--; - goto error_cleanup_array; - } - sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { - free(filename); - ret = -errno; - goto error_cleanup_array; - } - fscanf(sysfsfp, "%i", ¤t_enabled); - fclose(sysfsfp); - - if (!current_enabled) { - free(filename); - count--; - continue; - } - - current->scale = 1.0; - current->offset = 0; - current->name = strndup(ent->d_name, - strlen(ent->d_name) - - strlen("_en")); - if (current->name == NULL) { - free(filename); - ret = -ENOMEM; - goto error_cleanup_array; - } - /* Get the generic and specific name elements */ - ret = iioutils_break_up_name(current->name, - ¤t->generic_name); - if (ret) { - free(filename); - goto error_cleanup_array; - } - ret = asprintf(&filename, - "%s/%s_index", - scan_el_dir, - current->name); - if (ret < 0) { - free(filename); - ret = -ENOMEM; - goto error_cleanup_array; - } - sysfsfp = fopen(filename, "r"); - fscanf(sysfsfp, "%u", ¤t->index); - fclose(sysfsfp); - free(filename); - /* Find the scale */ - ret = iioutils_get_param_float(¤t->scale, - "scale", - device_dir, - current->name, - current->generic_name); - if (ret < 0) - goto error_cleanup_array; - ret = iioutils_get_param_float(¤t->offset, - "offset", - device_dir, - current->name, - current->generic_name); - if (ret < 0) - goto error_cleanup_array; - ret = iioutils_get_type(¤t->is_signed, - ¤t->bytes, - ¤t->bits_used, - ¤t->shift, - ¤t->mask, - ¤t->be, - device_dir, - current->name, - current->generic_name); - } - } - - closedir(dp); - /* reorder so that the array is in index order */ - bsort_channel_array_by_index(ci_array, *counter); - - return 0; - -error_cleanup_array: - for (i = count - 1; i >= 0; i--) - free((*ci_array)[i].name); - free(*ci_array); -error_close_dir: - closedir(dp); -error_free_name: - free(scan_el_dir); -error_ret: - return ret; -} - -/** - * find_type_by_name() - function to match top level types by name - * @name: top level type instance name - * @type: the type of top level instance being sort - * - * Typical types this is used for are device and trigger. - **/ -int find_type_by_name(const char *name, const char *type) -{ - const struct dirent *ent; - int number, numstrlen; - - FILE *nameFile; - DIR *dp; - char thisname[IIO_MAX_NAME_LENGTH]; - char *filename; - - dp = opendir(iio_dir); - if (dp == NULL) { - printf("No industrialio devices available\n"); - return -ENODEV; - } - - while (ent = readdir(dp), ent != NULL) { - if (strcmp(ent->d_name, ".") != 0 && - strcmp(ent->d_name, "..") != 0 && - strlen(ent->d_name) > strlen(type) && - strncmp(ent->d_name, type, strlen(type)) == 0) { - numstrlen = sscanf(ent->d_name + strlen(type), - "%d", - &number); - /* verify the next character is not a colon */ - if (strncmp(ent->d_name + strlen(type) + numstrlen, - ":", - 1) != 0) { - filename = malloc(strlen(iio_dir) - + strlen(type) - + numstrlen - + 6); - if (filename == NULL) { - closedir(dp); - return -ENOMEM; - } - sprintf(filename, "%s%s%d/name", - iio_dir, - type, - number); - nameFile = fopen(filename, "r"); - if (!nameFile) { - free(filename); - continue; - } - free(filename); - fscanf(nameFile, "%s", thisname); - fclose(nameFile); - if (strcmp(name, thisname) == 0) { - closedir(dp); - return number; - } - } - } - } - closedir(dp); - return -ENODEV; -} - -int _write_sysfs_int(char *filename, char *basedir, int val, int verify) -{ - int ret = 0; - FILE *sysfsfp; - int test; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) - return -ENOMEM; - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "w"); - if (sysfsfp == NULL) { - printf("failed to open %s\n", temp); - ret = -errno; - goto error_free; - } - fprintf(sysfsfp, "%d", val); - fclose(sysfsfp); - if (verify) { - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - printf("failed to open %s\n", temp); - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%d", &test); - fclose(sysfsfp); - if (test != val) { - printf("Possible failure in int write %d to %s%s\n", - val, - basedir, - filename); - ret = -1; - } - } -error_free: - free(temp); - return ret; -} - -int write_sysfs_int(char *filename, char *basedir, int val) -{ - return _write_sysfs_int(filename, basedir, val, 0); -} - -int write_sysfs_int_and_verify(char *filename, char *basedir, int val) -{ - return _write_sysfs_int(filename, basedir, val, 1); -} - -int _write_sysfs_string(char *filename, char *basedir, char *val, int verify) -{ - int ret = 0; - FILE *sysfsfp; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) { - printf("Memory allocation failed\n"); - return -ENOMEM; - } - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "w"); - if (sysfsfp == NULL) { - printf("Could not open %s\n", temp); - ret = -errno; - goto error_free; - } - fprintf(sysfsfp, "%s", val); - fclose(sysfsfp); - if (verify) { - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - printf("could not open file to verify\n"); - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%s", temp); - fclose(sysfsfp); - if (strcmp(temp, val) != 0) { - printf("Possible failure in string write of %s " - "Should be %s " - "written to %s\%s\n", - temp, - val, - basedir, - filename); - ret = -1; - } - } -error_free: - free(temp); - - return ret; -} - -/** - * write_sysfs_string_and_verify() - string write, readback and verify - * @filename: name of file to write to - * @basedir: the sysfs directory in which the file is to be found - * @val: the string to write - **/ -int write_sysfs_string_and_verify(char *filename, char *basedir, char *val) -{ - return _write_sysfs_string(filename, basedir, val, 1); -} - -int write_sysfs_string(char *filename, char *basedir, char *val) -{ - return _write_sysfs_string(filename, basedir, val, 0); -} - -int read_sysfs_posint(char *filename, char *basedir) -{ - int ret; - FILE *sysfsfp; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) { - printf("Memory allocation failed"); - return -ENOMEM; - } - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%d\n", &ret); - fclose(sysfsfp); -error_free: - free(temp); - return ret; -} - -int read_sysfs_float(char *filename, char *basedir, float *val) -{ - int ret = 0; - FILE *sysfsfp; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) { - printf("Memory allocation failed"); - return -ENOMEM; - } - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%f\n", val); - fclose(sysfsfp); -error_free: - free(temp); - return ret; -} - -int read_sysfs_string(const char *filename, const char *basedir, char *str) -{ - int ret = 0; - FILE *sysfsfp; - char *temp = malloc(strlen(basedir) + strlen(filename) + 2); - - if (temp == NULL) { - printf("Memory allocation failed"); - return -ENOMEM; - } - sprintf(temp, "%s/%s", basedir, filename); - sysfsfp = fopen(temp, "r"); - if (sysfsfp == NULL) { - ret = -errno; - goto error_free; - } - fscanf(sysfsfp, "%s\n", str); - fclose(sysfsfp); -error_free: - free(temp); - return ret; -} diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h deleted file mode 100644 index 1bc837b2d769..000000000000 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _IIO_UTILS_H_ -#define _IIO_UTILS_H_ - -/* IIO - useful set of util functionality - * - * Copyright (c) 2008 Jonathan Cameron - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ - -#include - -/* Made up value to limit allocation sizes */ -#define IIO_MAX_NAME_LENGTH 30 - -#define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements" -#define FORMAT_TYPE_FILE "%s_type" - -extern const char *iio_dir; - -/** - * struct iio_channel_info - information about a given channel - * @name: channel name - * @generic_name: general name for channel type - * @scale: scale factor to be applied for conversion to si units - * @offset: offset to be applied for conversion to si units - * @index: the channel index in the buffer output - * @bytes: number of bytes occupied in buffer output - * @mask: a bit mask for the raw output - * @is_signed: is the raw value stored signed - * @enabled: is this channel enabled - **/ -struct iio_channel_info { - char *name; - char *generic_name; - float scale; - float offset; - unsigned index; - unsigned bytes; - unsigned bits_used; - unsigned shift; - uint64_t mask; - unsigned be; - unsigned is_signed; - unsigned location; -}; - -int iioutils_break_up_name(const char *full_name, char **generic_name); -int iioutils_get_type(unsigned *is_signed, unsigned *bytes, - unsigned *bits_used, unsigned *shift, - uint64_t *mask, unsigned *be, - const char *device_dir, const char *name, - const char *generic_name); -int iioutils_get_param_float(float *output, const char *param_name, - const char *device_dir, const char *name, - const char *generic_name); -void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt); -int build_channel_array(const char *device_dir, - struct iio_channel_info **ci_array, int *counter); -int find_type_by_name(const char *name, const char *type); -int write_sysfs_int(char *filename, char *basedir, int val); -int write_sysfs_int_and_verify(char *filename, char *basedir, int val); -int write_sysfs_string_and_verify(char *filename, char *basedir, char *val); -int write_sysfs_string(char *filename, char *basedir, char *val); -int read_sysfs_posint(char *filename, char *basedir); -int read_sysfs_float(char *filename, char *basedir, float *val); -int read_sysfs_string(const char *filename, const char *basedir, char *str); - -#endif /* _IIO_UTILS_H_ */ diff --git a/drivers/staging/iio/Documentation/lsiio.c b/drivers/staging/iio/Documentation/lsiio.c deleted file mode 100644 index 98a0de098130..000000000000 --- a/drivers/staging/iio/Documentation/lsiio.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Industrial I/O utilities - lsiio.c - * - * Copyright (c) 2010 Manuel Stahl - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "iio_utils.h" - - -static enum verbosity { - VERBLEVEL_DEFAULT, /* 0 gives lspci behaviour */ - VERBLEVEL_SENSORS, /* 1 lists sensors */ -} verblevel = VERBLEVEL_DEFAULT; - -const char *type_device = "iio:device"; -const char *type_trigger = "trigger"; - - -static inline int check_prefix(const char *str, const char *prefix) -{ - return strlen(str) > strlen(prefix) && - strncmp(str, prefix, strlen(prefix)) == 0; -} - -static inline int check_postfix(const char *str, const char *postfix) -{ - return strlen(str) > strlen(postfix) && - strcmp(str + strlen(str) - strlen(postfix), postfix) == 0; -} - -static int dump_channels(const char *dev_dir_name) -{ - DIR *dp; - const struct dirent *ent; - - dp = opendir(dev_dir_name); - if (dp == NULL) - return -errno; - while (ent = readdir(dp), ent != NULL) - if (check_prefix(ent->d_name, "in_") && - check_postfix(ent->d_name, "_raw")) { - printf(" %-10s\n", ent->d_name); - } - - return 0; -} - -static int dump_one_device(const char *dev_dir_name) -{ - char name[IIO_MAX_NAME_LENGTH]; - int dev_idx; - int retval; - - retval = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_device), - "%i", &dev_idx); - if (retval != 1) - return -EINVAL; - read_sysfs_string("name", dev_dir_name, name); - printf("Device %03d: %s\n", dev_idx, name); - - if (verblevel >= VERBLEVEL_SENSORS) - return dump_channels(dev_dir_name); - return 0; -} - -static int dump_one_trigger(const char *dev_dir_name) -{ - char name[IIO_MAX_NAME_LENGTH]; - int dev_idx; - int retval; - - retval = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_trigger), - "%i", &dev_idx); - if (retval != 1) - return -EINVAL; - read_sysfs_string("name", dev_dir_name, name); - printf("Trigger %03d: %s\n", dev_idx, name); - return 0; -} - -static void dump_devices(void) -{ - const struct dirent *ent; - int number, numstrlen; - - FILE *nameFile; - DIR *dp; - char thisname[IIO_MAX_NAME_LENGTH]; - char *filename; - - dp = opendir(iio_dir); - if (dp == NULL) { - printf("No industrial I/O devices available\n"); - return; - } - - while (ent = readdir(dp), ent != NULL) { - if (check_prefix(ent->d_name, type_device)) { - char *dev_dir_name; - - asprintf(&dev_dir_name, "%s%s", iio_dir, ent->d_name); - dump_one_device(dev_dir_name); - free(dev_dir_name); - if (verblevel >= VERBLEVEL_SENSORS) - printf("\n"); - } - } - rewinddir(dp); - while (ent = readdir(dp), ent != NULL) { - if (check_prefix(ent->d_name, type_trigger)) { - char *dev_dir_name; - - asprintf(&dev_dir_name, "%s%s", iio_dir, ent->d_name); - dump_one_trigger(dev_dir_name); - free(dev_dir_name); - } - } - closedir(dp); -} - -int main(int argc, char **argv) -{ - int c, err = 0; - - while ((c = getopt(argc, argv, "d:D:v")) != EOF) { - switch (c) { - case 'v': - verblevel++; - break; - - case '?': - default: - err++; - break; - } - } - if (err || argc > optind) { - fprintf(stderr, "Usage: lsiio [options]...\n" - "List industrial I/O devices\n" - " -v, --verbose\n" - " Increase verbosity (may be given multiple times)\n" - ); - exit(1); - } - - dump_devices(); - - return 0; -} -- cgit v1.2.3 From e936351a611bca2ebd37634d81d168e6585e3634 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 14:15:35 +0530 Subject: staging: sm750fb: wrong type for print mention correct format specifier while printing. fixes all the build warnings about incorrect argument type while printing. since this is a framebuffer device and it should follow what the framebuffer layer is suggesting in struct fb_fix_screeninfo at smem_start and mmio_start, so accordingly changed the datatypes of vidmem_start, vidreg_start, vidmem_size and vidreg_size. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 24 ++++++++++++------------ drivers/staging/sm750fb/sm750.h | 8 ++++---- drivers/staging/sm750fb/sm750_hw.c | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 520c69e3ab74..753869e3686d 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -530,20 +530,20 @@ static int lynxfb_ops_mmap(struct fb_info * info, struct vm_area_struct * vma) if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) return -EINVAL; off = vma->vm_pgoff << PAGE_SHIFT; - printk("lynxfb mmap pgoff: %x\n", vma->vm_pgoff); - printk("lynxfb mmap off 1: %x\n", off); + printk("lynxfb mmap pgoff: %lx\n", vma->vm_pgoff); + printk("lynxfb mmap off 1: %lx\n", off); /* frame buffer memory */ start = info->fix.smem_start; len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len); - printk("lynxfb mmap start 1: %x\n", start); + printk("lynxfb mmap start 1: %lx\n", start); printk("lynxfb mmap len 1: %x\n", len); if (off >= len) { /* memory mapped io */ off -= len; - printk("lynxfb mmap off 2: %x\n", off); + printk("lynxfb mmap off 2: %lx\n", off); if (info->var.accel_flags) { printk("lynxfb mmap accel flags true"); return -EINVAL; @@ -551,28 +551,28 @@ static int lynxfb_ops_mmap(struct fb_info * info, struct vm_area_struct * vma) start = info->fix.mmio_start; len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); - printk("lynxfb mmap start 2: %x\n", start); + printk("lynxfb mmap start 2: %lx\n", start); printk("lynxfb mmap len 2: %x\n", len); } start &= PAGE_MASK; - printk("lynxfb mmap start 3: %x\n", start); - printk("lynxfb mmap vm start: %x\n", vma->vm_start); - printk("lynxfb mmap vm end: %x\n", vma->vm_end); + printk("lynxfb mmap start 3: %lx\n", start); + printk("lynxfb mmap vm start: %lx\n", vma->vm_start); + printk("lynxfb mmap vm end: %lx\n", vma->vm_end); printk("lynxfb mmap len: %x\n", len); - printk("lynxfb mmap off: %x\n", off); + printk("lynxfb mmap off: %lx\n", off); if ((vma->vm_end - vma->vm_start + off) > len) { return -EINVAL; } off += start; - printk("lynxfb mmap off 3: %x\n", off); + printk("lynxfb mmap off 3: %lx\n", off); vma->vm_pgoff = off >> PAGE_SHIFT; /* This is an IO map - tell maydump to skip this VMA */ vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); fb_pgprotect(file, vma, off); - printk("lynxfb mmap off 4: %x\n", off); - printk("lynxfb mmap pgprot: %x\n", vma->vm_page_prot); + printk("lynxfb mmap off 4: %lx\n", off); + printk("lynxfb mmap pgprot: %lx\n", (unsigned long) pgprot_val(vma->vm_page_prot)); if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index 711676c58839..d39968c2d5c1 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -59,10 +59,10 @@ struct lynx_share{ }mtrr; #endif /* all smi graphic adaptor got below attributes */ - resource_size_t vidmem_start; - resource_size_t vidreg_start; - resource_size_t vidmem_size; - resource_size_t vidreg_size; + unsigned long vidmem_start; + unsigned long vidreg_start; + __u32 vidmem_size; + __u32 vidreg_size; volatile unsigned char __iomem * pvReg; unsigned char __iomem * pvMem; /* locks*/ diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index cd971bd41637..ec2d49959072 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -36,7 +36,7 @@ int hw_sm750_map(struct lynx_share* share,struct pci_dev* pdev) share->vidreg_start = pci_resource_start(pdev,1); share->vidreg_size = MB(2); - pr_info("mmio phyAddr = %x\n",share->vidreg_start); + pr_info("mmio phyAddr = %lx\n", share->vidreg_start); /* reserve the vidreg space of smi adaptor * if you do this, u need to add release region code @@ -73,7 +73,7 @@ int hw_sm750_map(struct lynx_share* share,struct pci_dev* pdev) * @hw_sm750_getVMSize function can be safe. * */ share->vidmem_size = hw_sm750_getVMSize(share); - pr_info("video memory phyAddr = %x, size = %d bytes\n", + pr_info("video memory phyAddr = %lx, size = %u bytes\n", share->vidmem_start,share->vidmem_size); /* reserve the vidmem space of smi adaptor */ -- cgit v1.2.3 From c97df7c2c0692ebed4eff9abaf61a8e12cc250ed Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 14:15:36 +0530 Subject: staging: sm750fb: remove pragma optimize remove use of #pragma optimize which will usually be ignored by the compiler. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_swi2c.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c index b53407bb2042..cae6b9bc6472 100644 --- a/drivers/staging/sm750fb/ddk750_swi2c.c +++ b/drivers/staging/sm750fb/ddk750_swi2c.c @@ -217,8 +217,6 @@ static unsigned char swI2CReadSDA(void) return 0; } -#pragma optimize( "", off ) - /* * This function sends ACK signal */ @@ -356,7 +354,6 @@ unsigned char swI2CReadByte(unsigned char ack) return data; } -#pragma optimize( "", on ) /* * This function initializes GPIO port for SW I2C communication. -- cgit v1.2.3 From 62fa8e1014f0ca6abd4ec0e9cfcaeb6e6601bbb6 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 14:15:37 +0530 Subject: staging: sm750fb: correctly define SM750LE_REVISION_ID check if it is already defined before defining SM750LE_REVISION_ID again and at the same time mention correct data type. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.h | 4 +++- drivers/staging/sm750fb/sm750_hw.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.h b/drivers/staging/sm750fb/ddk750_chip.h index 1c7887512b69..d761b722556f 100644 --- a/drivers/staging/sm750fb/ddk750_chip.h +++ b/drivers/staging/sm750fb/ddk750_chip.h @@ -1,7 +1,9 @@ #ifndef DDK750_CHIP_H__ #define DDK750_CHIP_H__ #define DEFAULT_INPUT_CLOCK 14318181 /* Default reference clock */ -#define SM750LE_REVISION_ID (char)0xfe +#ifndef SM750LE_REVISION_ID +#define SM750LE_REVISION_ID ((unsigned char)0xfe) +#endif /* This is all the chips recognized by this library */ typedef enum _logical_chip_type_t diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index ec2d49959072..a2b7fe219594 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -277,7 +277,7 @@ int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc,struct fb_var_screeninfo* v case 16: break; case 32: - if(share->revid == (unsigned char)SM750LE_REVISION_ID){ + if (share->revid == SM750LE_REVISION_ID) { pr_debug("750le do not support 32bpp\n"); return -EINVAL; } -- cgit v1.2.3 From 848f2fce7b2713d853eaa7f32b31bb9ffe89e2ce Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 14:15:38 +0530 Subject: staging: sm750fb: fix undeclared function kbuild test robot reported that for microblaze-allyesconfig chan_to_field() and lynxfb_ops_set_par() were not defined. These two functions were defined under CONFIG_PM, so for any archtecture if CONFIG_PM is not defined we will have this error. while moving the lynxfb_suspend() function some very obvious checkpatch errors, like space after comma, space after if, space before opening brace, were taken care of. Reported-by: kbuild test robot Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 110 +++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 57 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 753869e3686d..476dc5c02dc2 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -303,62 +303,6 @@ static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, return ret; } - - - -#ifdef CONFIG_PM -static int lynxfb_suspend(struct pci_dev * pdev,pm_message_t mesg) -{ - struct fb_info * info; - struct lynx_share * share; - int ret; - - - if(mesg.event == pdev->dev.power.power_state.event) - return 0; - - ret = 0; - share = pci_get_drvdata(pdev); - switch (mesg.event) { - case PM_EVENT_FREEZE: - case PM_EVENT_PRETHAW: - pdev->dev.power.power_state = mesg; - return 0; - } - - console_lock(); - if (mesg.event & PM_EVENT_SLEEP) { - info = share->fbinfo[0]; - if(info) - fb_set_suspend(info, 1);/* 1 means do suspend*/ - - info = share->fbinfo[1]; - if(info) - fb_set_suspend(info, 1);/* 1 means do suspend*/ - - ret = pci_save_state(pdev); - if(ret){ - pr_err("error:%d occured in pci_save_state\n",ret); - return ret; - } - - /* set chip to sleep mode */ - if(share->suspend) - (*share->suspend)(share); - - pci_disable_device(pdev); - ret = pci_set_power_state(pdev,pci_choose_state(pdev,mesg)); - if(ret){ - pr_err("error:%d occured in pci_set_power_state\n",ret); - return ret; - } - } - - pdev->dev.power.power_state = mesg; - console_unlock(); - return ret; -} - static int lynxfb_ops_set_par(struct fb_info * info) { struct lynxfb_par * par; @@ -369,7 +313,6 @@ static int lynxfb_ops_set_par(struct fb_info * info) struct fb_fix_screeninfo * fix; int ret; unsigned int line_length; - if(!info) return -EINVAL; @@ -441,6 +384,7 @@ static int lynxfb_ops_set_par(struct fb_info * info) ret = output->proc_setMode(output,var,fix); return ret; } + static inline unsigned int chan_to_field(unsigned int chan,struct fb_bitfield * bf) { chan &= 0xffff; @@ -448,6 +392,58 @@ static inline unsigned int chan_to_field(unsigned int chan,struct fb_bitfield * return chan << bf->offset; } +#ifdef CONFIG_PM +static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg) +{ + struct fb_info *info; + struct lynx_share *share; + int ret; + + if (mesg.event == pdev->dev.power.power_state.event) + return 0; + + ret = 0; + share = pci_get_drvdata(pdev); + switch (mesg.event) { + case PM_EVENT_FREEZE: + case PM_EVENT_PRETHAW: + pdev->dev.power.power_state = mesg; + return 0; + } + + console_lock(); + if (mesg.event & PM_EVENT_SLEEP) { + info = share->fbinfo[0]; + if (info) + /* 1 means do suspend*/ + fb_set_suspend(info, 1); + info = share->fbinfo[1]; + if (info) + /* 1 means do suspend*/ + fb_set_suspend(info, 1); + + ret = pci_save_state(pdev); + if (ret) { + pr_err("error:%d occurred in pci_save_state\n", ret); + return ret; + } + + /* set chip to sleep mode*/ + if (share->suspend) + (*share->suspend)(share); + + pci_disable_device(pdev); + ret = pci_set_power_state(pdev, pci_choose_state(pdev, mesg)); + if (ret) { + pr_err("error:%d occurred in pci_set_power_state\n", ret); + return ret; + } + } + + pdev->dev.power.power_state = mesg; + console_unlock(); + return ret; +} static int lynxfb_resume(struct pci_dev* pdev) { -- cgit v1.2.3 From 5c7784b9d64027145ce4dee2b488c8c11af732cc Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 14:15:39 +0530 Subject: staging: sm750fb: fix build failure for powerpc-allyesconfig build failed with an error of g_option undeclared. we will get this error on all architecture if MODULE is not defined. fixed the declaration of g_option. Reported-by: Stephen Rothwell Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 476dc5c02dc2..8c260ee5597d 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -54,9 +54,7 @@ static const char * g_fbmode[] = {NULL,NULL}; static const char * g_def_fbmode = "800x600-16@60"; static char * g_settings = NULL; static int g_dualview = 0; -#ifdef MODULE static char * g_option = NULL; -#endif /* if not use spin_lock,system will die if user load driver * and immediatly unload driver frequently (dual)*/ -- cgit v1.2.3 From 4933b29bd4e007a0544c97ea47fa0a091c5fec53 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 22:46:52 +0530 Subject: staging: sm750fb: remove unused functions removed the functions which were not used anywhere. it has been build tested also confirmed with git grep that there is no other reference of these functions. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_display.c | 11 ------ drivers/staging/sm750fb/ddk750_swi2c.c | 8 ---- drivers/staging/sm750fb/sm750.c | 65 -------------------------------- 3 files changed, 84 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 57192e5b4730..a282a9492cc0 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -201,17 +201,6 @@ static void waitNextVerticalSync(int ctrl,int delay) } } -static void swPanelPowerSequence_sm750le(int disp,int delay) -{ - unsigned int reg; - reg = PEEK32(DISPLAY_CONTROL_750LE); - if(disp) - reg |= 0xf; - else - reg &= ~0xf; - POKE32(DISPLAY_CONTROL_750LE,reg); -} - static void swPanelPowerSequence(int disp,int delay) { unsigned int reg; diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c index cae6b9bc6472..1249759eb347 100644 --- a/drivers/staging/sm750fb/ddk750_swi2c.c +++ b/drivers/staging/sm750fb/ddk750_swi2c.c @@ -79,14 +79,6 @@ static unsigned long g_i2cDataGPIOMuxReg = GPIO_MUX; static unsigned long g_i2cDataGPIODataReg = GPIO_DATA; static unsigned long g_i2cDataGPIODataDirReg = GPIO_DATA_DIRECTION; -static unsigned char peekIO(unsigned short port,unsigned short index) -{ -#if defined(__i386__) || defined( __x86_64__) - outb_p(index,port); - return inb_p(port+1); -#endif -} - /* * This function puts a delay between command */ diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 8c260ee5597d..87029b61ce83 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -510,69 +510,6 @@ static int lynxfb_resume(struct pci_dev* pdev) } #endif -static int lynxfb_ops_mmap(struct fb_info * info, struct vm_area_struct * vma) -{ - unsigned long off; - unsigned long start; - u32 len; - struct file *file; - - file = vma->vm_file; - - if (!info) - return -ENODEV; - if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) - return -EINVAL; - off = vma->vm_pgoff << PAGE_SHIFT; - printk("lynxfb mmap pgoff: %lx\n", vma->vm_pgoff); - printk("lynxfb mmap off 1: %lx\n", off); - - /* frame buffer memory */ - start = info->fix.smem_start; - len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len); - - printk("lynxfb mmap start 1: %lx\n", start); - printk("lynxfb mmap len 1: %x\n", len); - - if (off >= len) { - /* memory mapped io */ - off -= len; - printk("lynxfb mmap off 2: %lx\n", off); - if (info->var.accel_flags) { - printk("lynxfb mmap accel flags true"); - return -EINVAL; - } - start = info->fix.mmio_start; - len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); - - printk("lynxfb mmap start 2: %lx\n", start); - printk("lynxfb mmap len 2: %x\n", len); - } - start &= PAGE_MASK; - printk("lynxfb mmap start 3: %lx\n", start); - printk("lynxfb mmap vm start: %lx\n", vma->vm_start); - printk("lynxfb mmap vm end: %lx\n", vma->vm_end); - printk("lynxfb mmap len: %x\n", len); - printk("lynxfb mmap off: %lx\n", off); - if ((vma->vm_end - vma->vm_start + off) > len) - { - return -EINVAL; - } - off += start; - printk("lynxfb mmap off 3: %lx\n", off); - vma->vm_pgoff = off >> PAGE_SHIFT; - /* This is an IO map - tell maydump to skip this VMA */ - vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; - vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); - fb_pgprotect(file, vma, off); - printk("lynxfb mmap off 4: %lx\n", off); - printk("lynxfb mmap pgprot: %lx\n", (unsigned long) pgprot_val(vma->vm_page_prot)); - if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, - vma->vm_end - vma->vm_start, vma->vm_page_prot)) - return -EAGAIN; - return 0; -} - static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* info) { struct lynxfb_par * par; @@ -824,8 +761,6 @@ static struct fb_ops lynxfb_ops={ .fb_set_par = lynxfb_ops_set_par, .fb_setcolreg = lynxfb_ops_setcolreg, .fb_blank = lynxfb_ops_blank, - /*.fb_mmap = lynxfb_ops_mmap,*/ - /* will be hooked by hardware */ .fb_fillrect = cfb_fillrect, .fb_imageblit = cfb_imageblit, .fb_copyarea = cfb_copyarea, -- cgit v1.2.3 From 041d3a42e7d823e89b593d47338d6840b38cbcd3 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 22:46:53 +0530 Subject: staging: sm750fb: remove unused variables removed some variables which were only declared but were never used. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_cursor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 480615cb6650..fca441e9c2dd 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -99,7 +99,6 @@ void hw_cursor_setData(struct lynx_cursor * cursor, u8 color,mask,opr; u16 data; u16 * pbuffer,*pstart; - static ulong odd = 0; /* in byte*/ pitch = cursor->w >> 3; @@ -188,7 +187,7 @@ void hw_cursor_setData2(struct lynx_cursor * cursor, u16 rop,const u8* pcol,const u8* pmsk) { int i,j,count,pitch,offset; - u8 color,mask,opr; + u8 color, mask; u16 data; u16 * pbuffer,*pstart; -- cgit v1.2.3 From 54a1a05fe270f87e755732a47f693de870d0ffec Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 22:46:54 +0530 Subject: staging: sm750fb: correct function return hw_cursor_setData2() is a function with void return type but it was returning an integer. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_cursor.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index fca441e9c2dd..6cceef107c37 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -248,6 +248,4 @@ void hw_cursor_setData2(struct lynx_cursor * cursor, } } - return 0; - } -- cgit v1.2.3 From 06a1bf813607ceb836d2b4b7c415a187253ea4ad Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 22:46:56 +0530 Subject: staging: sm750fb: fix mixed declarations we were getting build warning about mixed declaration. the variable is now declared at the beginning of the block. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 87029b61ce83..021b863dda95 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -1175,6 +1175,7 @@ ALLOC_FB: else { struct lynxfb_par * par; + int errno; pr_info("framebuffer #%d alloc okay\n",fbidx); share->fbinfo[fbidx] = info[fbidx]; par = info[fbidx]->par; @@ -1191,7 +1192,7 @@ ALLOC_FB: /* register frame buffer*/ pr_info("Ready to register framebuffer #%d.\n",fbidx); - int errno = register_framebuffer(info[fbidx]); + errno = register_framebuffer(info[fbidx]); if (errno < 0) { pr_err("Failed to register fb_info #%d. err %d\n",fbidx, errno); if(fbidx == 0) -- cgit v1.2.3 From 0fa96e39279988bde14cb6cf6cd0440185f2dae4 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 22:46:57 +0530 Subject: staging: sm750fb: correct integer comparison fixed the build warning about comparison of pointer and integer. end of string was being compared to NULL. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 021b863dda95..5532a28e6030 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -1000,7 +1000,7 @@ static void sm750fb_setup(struct lynx_share * share,char * src) goto NO_PARAM; } - while((opt = strsep(&src,":")) != NULL && *opt != NULL){ + while((opt = strsep(&src,":")) != NULL && *opt != 0){ pr_err("opt=%s\n",opt); pr_err("src=%s\n",src); -- cgit v1.2.3 From a99e334da16ce81163db0e47ec22469a79a91b72 Mon Sep 17 00:00:00 2001 From: Madhusudhanan Ravindran Date: Tue, 10 Mar 2015 23:07:39 +0530 Subject: staging: sm750fb: Use kzalloc rather than kmalloc followed by memset with 0 The semantic patch that makes this change is available in scriptcoccinelle/api/alloc/kzalloc-simple.cocci. Signed-off-by: Madhusudhanan Ravindran Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 5532a28e6030..aa0888c232b9 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -1278,11 +1278,10 @@ static int __init lynxfb_setup(char * options) pr_info("options:%s\n",options); len = strlen(options) + 1; - g_settings = kmalloc(len,GFP_KERNEL); + g_settings = kzalloc(len, GFP_KERNEL); if(!g_settings) return -ENOMEM; - memset(g_settings,0,len); tmp = g_settings; /* Notes: -- cgit v1.2.3 From f8b0dced35e60a857e893648308e056915ffed4a Mon Sep 17 00:00:00 2001 From: Lorenzo Stoakes Date: Tue, 10 Mar 2015 15:25:47 +0000 Subject: staging: sm750fb: Cleanup the type of mmio750 This patch assigns the more appropriate void* type to the mmio750 variable eliminating an unnecessary volatile qualifier in the process. Additionally it updates parameter types as necessary where those parameters interact with mmio750, removes unnecessary casts and updates the type of the lynx_share->pvReg field which is passed to the ddk750_set_mmio method. As a consequence, this patch fixes the following sparse warning:- drivers/staging/sm750fb/ddk750_help.c:12:17: warning: incorrect type in assignment (different address spaces) Signed-off-by: Lorenzo Stoakes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.h | 4 +++- drivers/staging/sm750fb/ddk750_help.c | 4 ++-- drivers/staging/sm750fb/ddk750_help.h | 10 +++++----- drivers/staging/sm750fb/sm750.h | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.h b/drivers/staging/sm750fb/ddk750_chip.h index d761b722556f..04cb0d559245 100644 --- a/drivers/staging/sm750fb/ddk750_chip.h +++ b/drivers/staging/sm750fb/ddk750_chip.h @@ -5,6 +5,8 @@ #define SM750LE_REVISION_ID ((unsigned char)0xfe) #endif +#include + /* This is all the chips recognized by this library */ typedef enum _logical_chip_type_t { @@ -72,7 +74,7 @@ logical_chip_type_t getChipType(void); unsigned int calcPllValue(unsigned int request,pll_value_t *pll); unsigned int calcPllValue2(unsigned int,pll_value_t *); unsigned int formatPllReg(pll_value_t *pPLL); -void ddk750_set_mmio(volatile unsigned char *,unsigned short,char); +void ddk750_set_mmio(void __iomem *,unsigned short,char); unsigned int ddk750_getVMSize(void); int ddk750_initHw(initchip_param_t *); unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL); diff --git a/drivers/staging/sm750fb/ddk750_help.c b/drivers/staging/sm750fb/ddk750_help.c index cc00d2b32436..c68ff3b5751a 100644 --- a/drivers/staging/sm750fb/ddk750_help.c +++ b/drivers/staging/sm750fb/ddk750_help.c @@ -2,12 +2,12 @@ //#include "ddk750_chip.h" #include "ddk750_help.h" -volatile unsigned char __iomem * mmio750 = NULL; +void __iomem * mmio750 = NULL; char revId750 = 0; unsigned short devId750 = 0; /* after driver mapped io registers, use this function first */ -void ddk750_set_mmio(volatile unsigned char * addr,unsigned short devId,char revId) +void ddk750_set_mmio(void __iomem * addr,unsigned short devId,char revId) { mmio750 = addr; devId750 = devId; diff --git a/drivers/staging/sm750fb/ddk750_help.h b/drivers/staging/sm750fb/ddk750_help.h index 4fc93b5d41c7..07c8264fac95 100644 --- a/drivers/staging/sm750fb/ddk750_help.h +++ b/drivers/staging/sm750fb/ddk750_help.h @@ -12,14 +12,14 @@ #if 0 /* if 718 big endian turned on,be aware that don't use this driver for general use,only for ppc big-endian */ #warning "big endian on target cpu and enable nature big endian support of 718 capability !" -#define PEEK32(addr) __raw_readl((void __iomem *)(mmio750)+(addr)) -#define POKE32(addr,data) __raw_writel((data),(void __iomem*)(mmio750)+(addr)) +#define PEEK32(addr) __raw_readl(mmio750 + addr) +#define POKE32(addr,data) __raw_writel(data, mmio750 + addr) #else /* software control endianess */ -#define PEEK32(addr) readl((addr)+mmio750) -#define POKE32(addr,data) writel((data),(addr)+mmio750) +#define PEEK32(addr) readl(addr + mmio750) +#define POKE32(addr,data) writel(data, addr + mmio750) #endif -extern volatile unsigned char __iomem * mmio750; +extern void __iomem * mmio750; extern char revId750; extern unsigned short devId750; #else diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index d39968c2d5c1..53611163fe91 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -63,7 +63,7 @@ struct lynx_share{ unsigned long vidreg_start; __u32 vidmem_size; __u32 vidreg_size; - volatile unsigned char __iomem * pvReg; + void __iomem * pvReg; unsigned char __iomem * pvMem; /* locks*/ spinlock_t slock; -- cgit v1.2.3 From 3009de604831e6dd908c39c05fd063bd668edb0e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 10 Mar 2015 21:20:52 +0100 Subject: Staging: sm750fb: fix build warning with proc_panDisplay Change the options to the proc_panDisplay function pointer to match the function pointer that we want to assign to it, in order to remove the build warning. Cc: Sudip Mukherjee Cc: Teddy Wang Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org --- drivers/staging/sm750fb/sm750.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index 53611163fe91..efe999acbe46 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -120,8 +120,9 @@ struct lynxfb_crtc{ int(*proc_setColReg)(struct lynxfb_crtc*,ushort,ushort,ushort,ushort); void (*clear)(struct lynxfb_crtc*); /* pan display */ - int(*proc_panDisplay)(struct lynxfb_crtc*, struct fb_var_screeninfo*, - struct fb_info*); + int (*proc_panDisplay)(struct lynxfb_crtc *, + const struct fb_var_screeninfo *, + const struct fb_info *); /* cursor information */ struct lynx_cursor cursor; }; -- cgit v1.2.3 From bf2fbc2a12b42a1d3fd38b1da24cd4250df4f3ab Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 10 Mar 2015 21:29:38 +0100 Subject: Staging: sm750fb: fix build warning with lynx_accel Change the return value of lynx_accel to be void, to fix the build warning, and due to the fact that the function can't seem to fail at all, and no one cares if it does or not. Cc: Sudip Mukherjee Cc: Teddy Wang Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org --- drivers/staging/sm750fb/sm750.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index efe999acbe46..0847d2bd95c8 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -23,7 +23,7 @@ struct lynx_accel{ volatile unsigned char __iomem * dpPortBase; /* function fointers */ - int (*de_init)(struct lynx_accel *); + void (*de_init)(struct lynx_accel *); int (*de_wait)(void);/* see if hardware ready to work */ -- cgit v1.2.3 From 7c6f3fdc488296ea00ded8024dcfd7de13d2ca67 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 10 Mar 2015 22:03:01 +0100 Subject: Staging: sm750fb: fix hw_imageblit parameters Fix up hw_imageblit() so that the function paramaters match up with what the driver expects them to be when using it as a function pointer. Cc: Sudip Mukherjee Cc: Teddy Wang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_accel.c | 29 ++++++++++++++--------------- drivers/staging/sm750fb/sm750_accel.h | 29 ++++++++++++++--------------- 2 files changed, 28 insertions(+), 30 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index ee211deb9975..6521c3b3bcdc 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -395,21 +395,20 @@ static unsigned int deGetTransparency(struct lynx_accel * accel) return de_ctrl; } -int hw_imageblit( -struct lynx_accel * accel, -unsigned char *pSrcbuf, /* pointer to start of source buffer in system memory */ -int srcDelta, /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */ -unsigned int startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */ -unsigned int dBase, /* Address of destination: offset in frame buffer */ -unsigned int dPitch, /* Pitch value of destination surface in BYTE */ -unsigned int bytePerPixel, /* Color depth of destination surface */ -unsigned int dx, -unsigned int dy, /* Starting coordinate of destination surface */ -unsigned int width, -unsigned int height, /* width and height of rectange in pixel value */ -unsigned int fColor, /* Foreground color (corresponding to a 1 in the monochrome data */ -unsigned int bColor, /* Background color (corresponding to a 0 in the monochrome data */ -unsigned int rop2) /* ROP value */ +int hw_imageblit(struct lynx_accel *accel, + const char *pSrcbuf, /* pointer to start of source buffer in system memory */ + u32 srcDelta, /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */ + u32 startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */ + u32 dBase, /* Address of destination: offset in frame buffer */ + u32 dPitch, /* Pitch value of destination surface in BYTE */ + u32 bytePerPixel, /* Color depth of destination surface */ + u32 dx, + u32 dy, /* Starting coordinate of destination surface */ + u32 width, + u32 height, /* width and height of rectange in pixel value */ + u32 fColor, /* Foreground color (corresponding to a 1 in the monochrome data */ + u32 bColor, /* Background color (corresponding to a 0 in the monochrome data */ + u32 rop2) /* ROP value */ { unsigned int ulBytesPerScan; unsigned int ul4BytesPerScan; diff --git a/drivers/staging/sm750fb/sm750_accel.h b/drivers/staging/sm750fb/sm750_accel.h index 575f4a7e38d4..3ee0bd89257b 100644 --- a/drivers/staging/sm750fb/sm750_accel.h +++ b/drivers/staging/sm750fb/sm750_accel.h @@ -258,19 +258,18 @@ unsigned int width, unsigned int height, /* width and height of rectangle in pixel value */ unsigned int rop2); -int hw_imageblit( -struct lynx_accel * accel, -unsigned char *pSrcbuf, /* pointer to start of source buffer in system memory */ -int srcDelta, /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */ -unsigned int startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */ -unsigned int dBase, /* Address of destination: offset in frame buffer */ -unsigned int dPitch, /* Pitch value of destination surface in BYTE */ -unsigned int bytePerPixel, /* Color depth of destination surface */ -unsigned int dx, -unsigned int dy, /* Starting coordinate of destination surface */ -unsigned int width, -unsigned int height, /* width and height of rectange in pixel value */ -unsigned int fColor, /* Foreground color (corresponding to a 1 in the monochrome data */ -unsigned int bColor, /* Background color (corresponding to a 0 in the monochrome data */ -unsigned int rop2); +int hw_imageblit(struct lynx_accel *accel, + const char *pSrcbuf, /* pointer to start of source buffer in system memory */ + u32 srcDelta, /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */ + u32 startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */ + u32 dBase, /* Address of destination: offset in frame buffer */ + u32 dPitch, /* Pitch value of destination surface in BYTE */ + u32 bytePerPixel, /* Color depth of destination surface */ + u32 dx, + u32 dy, /* Starting coordinate of destination surface */ + u32 width, + u32 height, /* width and height of rectange in pixel value */ + u32 fColor, /* Foreground color (corresponding to a 1 in the monochrome data */ + u32 bColor, /* Background color (corresponding to a 0 in the monochrome data */ + u32 rop2); #endif -- cgit v1.2.3 From e74ac550298ec4635cc32e99f966568a808fd370 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 10 Mar 2015 22:08:38 +0100 Subject: Staging: sm750fb: provide error path for hw_sm750le_setBLANK() This provides a default path for the switch statement in hw_sm750le_setBLANK() so that the compiler will not correctly complain about undefined values being sent to the hardware. Instead, properly error out if the blank command is unknown by the driver. Cc: Sudip Mukherjee Cc: Teddy Wang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index a2b7fe219594..c44a50b0c489 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -472,6 +472,8 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output,int blank){ dpms = CRT_DISPLAY_CTRL_DPMS_3; crtdb = CRT_DISPLAY_CTRL_BLANK_ON; break; + default: + return -EINVAL; } if(output->paths & sm750_crt){ -- cgit v1.2.3 From fd933bae1474fa172693b712012cbb4a2d31fc30 Mon Sep 17 00:00:00 2001 From: Cass May Date: Sun, 15 Feb 2015 23:40:17 +0000 Subject: dgnc: Remove superfluous EXTRA_CFLAGS variable Clean up Makefile by removing unnecessary definition of DG_NAME. Signed-off-by: Cass May Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile index b69f7b6b1143..84cc98d55879 100644 --- a/drivers/staging/dgnc/Makefile +++ b/drivers/staging/dgnc/Makefile @@ -1,4 +1,4 @@ -EXTRA_CFLAGS += -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\" +EXTRA_CFLAGS += -DDG_PART=\"40002369_F\" obj-$(CONFIG_DGNC) += dgnc.o -- cgit v1.2.3 From f11cc568758f23088c1f7a8369100c59e4c07bd6 Mon Sep 17 00:00:00 2001 From: Cass May Date: Sun, 15 Feb 2015 23:40:18 +0000 Subject: dgnc: Move DG_PART definition from Makefile to dgnc_driver.h Avoid deprecated usage of EXTRA_CFLAGS by moving definition of DG_PART into dgnc_driver.h Signed-off-by: Cass May Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/Makefile | 2 -- drivers/staging/dgnc/dgnc_driver.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile index 84cc98d55879..995c874f40eb 100644 --- a/drivers/staging/dgnc/Makefile +++ b/drivers/staging/dgnc/Makefile @@ -1,5 +1,3 @@ -EXTRA_CFLAGS += -DDG_PART=\"40002369_F\" - obj-$(CONFIG_DGNC) += dgnc.o dgnc-objs := dgnc_cls.o dgnc_driver.o\ diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 734bdc2be446..a860705dd01b 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -46,6 +46,7 @@ #define PROCSTR "dgnc" /* /proc entries */ #define DEVSTR "/dev/dg/dgnc" /* /dev entries */ #define DRVSTR "dgnc" /* Driver name string */ +#define DG_PART "40002369_F" /* RPM part number */ #define TRC_TO_CONSOLE 1 -- cgit v1.2.3 From 85c748dfcb715e6a73588c61be874ad64fb66409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Mon, 9 Mar 2015 01:49:44 +0200 Subject: dgnc: Remove redundant blank lines in dgnc_cls.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are a lot double of blank lines in dgnc_cls.c thus remove them to make the file follow the CodingStyle. Also, remove one blank line at the end of dgnc_cls.c. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index bedc5221b6fc..2adf3d771742 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -92,14 +92,12 @@ struct board_ops dgnc_cls_ops = { .send_immediate_char = cls_send_immediate_char }; - static inline void cls_set_cts_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -136,14 +134,12 @@ static inline void cls_set_cts_flow_control(struct channel_t *ch) } - static inline void cls_set_ixon_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -184,14 +180,12 @@ static inline void cls_set_ixon_flow_control(struct channel_t *ch) } - static inline void cls_set_no_output_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -230,14 +224,12 @@ static inline void cls_set_no_output_flow_control(struct channel_t *ch) } - static inline void cls_set_rts_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -266,20 +258,17 @@ static inline void cls_set_rts_flow_control(struct channel_t *ch) UART_16654_FCR_TXTRIGGER_16 | UART_FCR_CLEAR_RCVR), &ch->ch_cls_uart->isr_fcr); - ch->ch_r_watermark = 4; ch->ch_r_tlevel = 8; } - static inline void cls_set_ixoff_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -316,14 +305,12 @@ static inline void cls_set_ixoff_flow_control(struct channel_t *ch) } - static inline void cls_set_no_input_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -357,7 +344,6 @@ static inline void cls_set_no_input_flow_control(struct channel_t *ch) } - /* * cls_clear_break. * Determines whether its time to shut off break condition. @@ -393,7 +379,6 @@ static inline void cls_clear_break(struct channel_t *ch, int force) spin_unlock_irqrestore(&ch->ch_lock, flags); } - /* Parse the ISR register for the specific port */ static inline void cls_parse_isr(struct dgnc_board *brd, uint port) { @@ -457,7 +442,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, uint port) } } - /* * cls_param() * Send any/all changes to the line to the UART. @@ -711,7 +695,6 @@ static void cls_param(struct tty_struct *tty) cls_parse_modem(ch, readb(&ch->ch_cls_uart->msr)); } - /* * Our board poller function. */ @@ -784,7 +767,6 @@ static void cls_tasklet(unsigned long data) } - /* * cls_intr() * @@ -834,7 +816,6 @@ static irqreturn_t cls_intr(int irq, void *voidbrd) return IRQ_HANDLED; } - static void cls_disable_receiver(struct channel_t *ch) { unsigned char tmp = readb(&ch->ch_cls_uart->ier); @@ -843,7 +824,6 @@ static void cls_disable_receiver(struct channel_t *ch) writeb(tmp, &ch->ch_cls_uart->ier); } - static void cls_enable_receiver(struct channel_t *ch) { unsigned char tmp = readb(&ch->ch_cls_uart->ier); @@ -852,7 +832,6 @@ static void cls_enable_receiver(struct channel_t *ch) writeb(tmp, &ch->ch_cls_uart->ier); } - static void cls_copy_data_from_uart_to_queue(struct channel_t *ch) { int qleft = 0; @@ -942,7 +921,6 @@ static void cls_copy_data_from_uart_to_queue(struct channel_t *ch) spin_unlock_irqrestore(&ch->ch_lock, flags); } - /* * This function basically goes to sleep for secs, or until * it gets signalled that the port has fully drained. @@ -978,7 +956,6 @@ static int cls_drain(struct tty_struct *tty, uint seconds) ((un->un_flags & UN_EMPTY) == 0)); } - /* Channel lock MUST be held before calling this function! */ static void cls_flush_uart_write(struct channel_t *ch) { @@ -992,7 +969,6 @@ static void cls_flush_uart_write(struct channel_t *ch) ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); } - /* Channel lock MUST be held before calling this function! */ static void cls_flush_uart_read(struct channel_t *ch) { @@ -1013,7 +989,6 @@ static void cls_flush_uart_read(struct channel_t *ch) udelay(10); } - static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) { ushort head; @@ -1097,7 +1072,6 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) spin_unlock_irqrestore(&ch->ch_lock, flags); } - static void cls_parse_modem(struct channel_t *ch, unsigned char signals) { unsigned char msignals = signals; @@ -1162,7 +1136,6 @@ static void cls_parse_modem(struct channel_t *ch, unsigned char signals) spin_unlock_irqrestore(&ch->ch_lock, flags); } - /* Make the UART raise any of the output signals we want up */ static void cls_assert_modem_signals(struct channel_t *ch) { @@ -1182,7 +1155,6 @@ static void cls_assert_modem_signals(struct channel_t *ch) udelay(10); } - static void cls_send_start_character(struct channel_t *ch) { if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) @@ -1194,7 +1166,6 @@ static void cls_send_start_character(struct channel_t *ch) } } - static void cls_send_stop_character(struct channel_t *ch) { if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) @@ -1206,7 +1177,6 @@ static void cls_send_stop_character(struct channel_t *ch) } } - /* Inits UART */ static void cls_uart_init(struct channel_t *ch) { @@ -1244,7 +1214,6 @@ static void cls_uart_init(struct channel_t *ch) readb(&ch->ch_cls_uart->msr); } - /* * Turns off UART. */ @@ -1253,7 +1222,6 @@ static void cls_uart_off(struct channel_t *ch) writeb(0, &ch->ch_cls_uart->ier); } - /* * cls_get_uarts_bytes_left. * Returns 0 is nothing left in the FIFO, returns 1 otherwise. @@ -1283,7 +1251,6 @@ static uint cls_get_uart_bytes_left(struct channel_t *ch) return left; } - /* * cls_send_break. * Starts sending a break thru the UART. @@ -1326,7 +1293,6 @@ static void cls_send_break(struct channel_t *ch, int msecs) } } - /* * cls_send_immediate_char. * Sends a specific character as soon as possible to the UART, @@ -1348,7 +1314,6 @@ static void cls_vpd(struct dgnc_board *brd) u8 __iomem *re_map_vpdbase;/* Remapped memory of the card */ int i = 0; - vpdbase = pci_resource_start(brd->pdev, 3); /* No VPD */ @@ -1370,4 +1335,3 @@ static void cls_vpd(struct dgnc_board *brd) if (re_map_vpdbase) iounmap(re_map_vpdbase); } - -- cgit v1.2.3 From e9210a03090b62d19716cacd2efc824a9d01898c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Mon, 9 Mar 2015 01:49:45 +0200 Subject: dgnc: Make all lines under 80 characters in dgnc_cls.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the lines are over 80 characters so fix that by moving the comments before the struct definition and before #define's. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.h | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h index 032e4a469b9a..2ca27323ec20 100644 --- a/drivers/staging/dgnc/dgnc_cls.h +++ b/drivers/staging/dgnc/dgnc_cls.h @@ -35,15 +35,25 @@ * U = Unused. * ************************************************************************/ +/* + * txrx : WR RHR/THR - Holding reg + * ier : WR IER - Interrupt Enable Reg + * isr_fcr : WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg + * lcr : WR LCR - Line Control Reg + * mcr : WR MCR - Modem Control Reg + * lsr : WR LSR - Line Status Reg + * msr : WR MSG - Modem Status Reg + * spr : WR SPR - Scratch pad Reg + */ struct cls_uart_struct { - u8 txrx; /* WR RHR/THR - Holding Reg */ - u8 ier; /* WR IER - Interrupt Enable Reg */ - u8 isr_fcr; /* WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg */ - u8 lcr; /* WR LCR - Line Control Reg */ - u8 mcr; /* WR MCR - Modem Control Reg */ - u8 lsr; /* WR LSR - Line Status Reg */ - u8 msr; /* WR MSR - Modem Status Reg */ - u8 spr; /* WR SPR - Scratch Pad Reg */ + u8 txrx; + u8 ier; + u8 isr_fcr; + u8 lcr; + u8 mcr; + u8 lsr; + u8 msr; + u8 spr; }; /* Where to read the interrupt register (8bits) */ @@ -61,8 +71,11 @@ struct cls_uart_struct { #define UART_16654_FCR_RXTRIGGER_56 0x80 #define UART_16654_FCR_RXTRIGGER_60 0xC0 -#define UART_IIR_CTSRTS 0x20 /* Received CTS/RTS change of state */ -#define UART_IIR_RDI_TIMEOUT 0x0C /* Receiver data TIMEOUT */ +/* Received CTS/RTS change of state */ +#define UART_IIR_CTSRTS 0x20 + +/* Receiver data TIMEOUT */ +#define UART_IIR_RDI_TIMEOUT 0x0C /* * These are the EXTENDED definitions for the Exar 654's Interrupt @@ -74,8 +87,11 @@ struct cls_uart_struct { #define UART_EXAR654_EFR_RTSDTR 0x40 /* Auto RTS/DTR Flow Control Enable */ #define UART_EXAR654_EFR_CTSDSR 0x80 /* Auto CTS/DSR Flow COntrol Enable */ -#define UART_EXAR654_XOFF_DETECT 0x1 /* Indicates whether chip saw an incoming XOFF char */ -#define UART_EXAR654_XON_DETECT 0x2 /* Indicates whether chip saw an incoming XON char */ +/* Indicates whether chip saw an incoming XOFF char */ +#define UART_EXAR654_XOFF_DETECT 0x1 + +/* Indicates whether chip saw an incoming XON char */ +#define UART_EXAR654_XON_DETECT 0x2 #define UART_EXAR654_IER_XOFF 0x20 /* Xoff Interrupt Enable */ #define UART_EXAR654_IER_RTSDTR 0x40 /* Output Interrupt Enable */ -- cgit v1.2.3 From 65da04c1cada486a8619d5d53336059e5bd6d8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Mon, 9 Mar 2015 01:49:46 +0200 Subject: dgnc: Make all lines under 80 characters in dgnc_driver.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the lines are over 80 characters in dgnc_driver.c so fix them by moving the comments closer to the code, tidying the comments to make them smaller, and remove a redundant space after +. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index fa1ee79ef88e..55b5e6b8f1b3 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -60,7 +60,8 @@ static void dgnc_init_globals(void); static int dgnc_found_board(struct pci_dev *pdev, int id); static void dgnc_cleanup_board(struct dgnc_board *brd); static void dgnc_poll_handler(ulong dummy); -static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); +static int dgnc_init_one(struct pci_dev *pdev, + const struct pci_device_id *ent); static void dgnc_do_remap(struct dgnc_board *brd); /* @@ -92,8 +93,8 @@ static struct class *dgnc_class; * Poller stuff */ static DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */ -static ulong dgnc_poll_time; /* Time of next poll */ -static uint dgnc_poll_stop; /* Used to tell poller to stop */ +static ulong dgnc_poll_time; /* Time of next poll */ +static uint dgnc_poll_stop; /* Used to tell poller to stop */ static struct timer_list dgnc_poll_timer; @@ -214,7 +215,7 @@ static int __init dgnc_init_module(void) * If something went wrong in the scan, bail out of driver. */ if (rc < 0) { - /* Only unregister the pci driver if it was actually registered. */ + /* Only unregister if it was actually registered. */ if (dgnc_NumBoards) pci_unregister_driver(&dgnc_driver); else @@ -551,7 +552,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) if (brd->re_map_membase) { - /* After remap is complete, we need to read and store the dvid */ + /* Read and store the dvid after remapping */ brd->dvid = readb(brd->re_map_membase + 0x8D); /* Get and store the board VPD, if it exists */ @@ -708,7 +709,7 @@ static void dgnc_poll_handler(ulong dummy) spin_lock_irqsave(&brd->bd_lock, flags); - /* If board is in a failed state, don't bother scheduling a tasklet */ + /* If board is in a failed state don't schedule a tasklet */ if (brd->state == BOARD_FAILED) { spin_unlock_irqrestore(&brd->bd_lock, flags); continue; @@ -729,7 +730,7 @@ static void dgnc_poll_handler(ulong dummy) new_time = dgnc_poll_time - jiffies; if ((ulong) new_time >= 2 * dgnc_poll_tick) - dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick); + dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick); setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0); dgnc_poll_timer.expires = dgnc_poll_time; -- cgit v1.2.3 From cb1185a4ae29367d00b0ae19413d64303c8c0e51 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 10 Mar 2015 10:39:42 +0300 Subject: staging: dgnc: off by one in dgnc_mgmt_ioctl() "dgnc_NumBoards" is the number of initialized elements in the dgnc_Board[] array so the comparison should be ">=" instead of ">" so we don't read invalid data. We can remove the special handling of the empty array now that we've fixed this bug. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_mgmt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c index 5544a8e7f4bc..b89bd59d8da8 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.c +++ b/drivers/staging/dgnc/dgnc_mgmt.c @@ -153,8 +153,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (copy_from_user(&brd, uarg, sizeof(int))) return -EFAULT; - if ((brd < 0) || (brd > dgnc_NumBoards) || - (dgnc_NumBoards == 0)) + if (brd < 0 || brd >= dgnc_NumBoards) return -ENODEV; memset(&di, 0, sizeof(di)); -- cgit v1.2.3 From 2e363be0aa776f8ec19484e9c5e2d2beb68d7702 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:31:04 +0530 Subject: staging: dgnc: Use kcalloc instead of kzalloc. This patch uses kcalloc instead of kzalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index 55b5e6b8f1b3..b322985f7b6c 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -409,7 +409,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) return -ENOMEM; /* make a temporary message buffer for the boot messages */ - brd->msgbuf_head = kzalloc(sizeof(u8) * 8192, GFP_KERNEL); + brd->msgbuf_head = kcalloc(8192, sizeof(u8), GFP_KERNEL); brd->msgbuf = brd->msgbuf_head; if (!brd->msgbuf) { -- cgit v1.2.3 From d7f355d7b05da2d4064c929deeede178ce0b3051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Tue, 10 Mar 2015 21:29:18 +0200 Subject: dgnc: Remove unneeded dgnc_state array of strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dgnc_state array of strings is never used anywhere and it seems pretty useless anyway since the board state enum names speak for themselves. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 8 -------- drivers/staging/dgnc/dgnc_driver.h | 1 - 2 files changed, 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index b322985f7b6c..c3fe00d961d6 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -140,14 +140,6 @@ static struct pci_driver dgnc_driver = { .id_table = dgnc_pci_tbl, }; - -char *dgnc_state_text[] = { - "Board Failed", - "Board Found", - "Board READY", -}; - - /************************************************************************ * * Driver load/unload functions diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index a860705dd01b..d647da15dcde 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -404,6 +404,5 @@ extern int dgnc_poll_tick; /* Poll interval - 20 ms */ extern spinlock_t dgnc_global_lock; /* Driver global spinlock */ extern uint dgnc_NumBoards; /* Total number of boards */ extern struct dgnc_board *dgnc_Board[MAXBOARDS]; /* Array of board structs */ -extern char *dgnc_state_text[]; /* Array of state text */ #endif -- cgit v1.2.3 From 1f2e089f68a931c22d8132b1284478cfa2357fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Tue, 10 Mar 2015 21:29:20 +0200 Subject: dgnc: clean up comments at start of files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove FSF address because it's known in the past that it has changed. Also, remove the pointless "do not change the coding style" comments because it's one of the reasons why it's in staging and it's quite contradictory to what it says in TODO. Also, they contain wrong e-mails of people which are responsible for these drivers - see TODO or MAINTAINERS for that. We can preserve the original copyright at the top of the most files because it shows who originally made them. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.c | 16 ---------------- drivers/staging/dgnc/dgnc_cls.h | 7 ------- drivers/staging/dgnc/dgnc_driver.c | 16 ---------------- drivers/staging/dgnc/dgnc_driver.h | 6 ------ drivers/staging/dgnc/dgnc_kcompat.h | 6 ------ drivers/staging/dgnc/dgnc_mgmt.c | 16 ---------------- drivers/staging/dgnc/dgnc_mgmt.h | 6 ------ drivers/staging/dgnc/dgnc_neo.c | 16 ---------------- drivers/staging/dgnc/dgnc_neo.h | 7 ------- drivers/staging/dgnc/dgnc_pci.h | 6 ------ drivers/staging/dgnc/dgnc_sysfs.c | 16 ---------------- drivers/staging/dgnc/dgnc_sysfs.h | 6 ------ drivers/staging/dgnc/dgnc_tty.c | 15 --------------- drivers/staging/dgnc/dgnc_tty.h | 6 ------ drivers/staging/dgnc/dgnc_types.h | 6 ------ drivers/staging/dgnc/digi.h | 6 ------ drivers/staging/dgnc/dpacompat.h | 6 ------ 17 files changed, 163 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 2adf3d771742..634d3ea44365 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ #include diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h index 2ca27323ec20..2398514e10ec 100644 --- a/drivers/staging/dgnc/dgnc_cls.h +++ b/drivers/staging/dgnc/dgnc_cls.h @@ -11,13 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - * */ #ifndef __DGNC_CLS_H diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index c3fe00d961d6..d705e6877eab 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index d647da15dcde..15c4d95cfe07 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -12,12 +12,6 @@ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - * ************************************************************************* * * Driver includes diff --git a/drivers/staging/dgnc/dgnc_kcompat.h b/drivers/staging/dgnc/dgnc_kcompat.h index 566cad0d33e7..22060385321a 100644 --- a/drivers/staging/dgnc/dgnc_kcompat.h +++ b/drivers/staging/dgnc/dgnc_kcompat.h @@ -12,12 +12,6 @@ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - * ************************************************************************* * * This file is intended to contain all the kernel "differences" between the diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c index b89bd59d8da8..57814061f6db 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.c +++ b/drivers/staging/dgnc/dgnc_mgmt.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ /************************************************************************ diff --git a/drivers/staging/dgnc/dgnc_mgmt.h b/drivers/staging/dgnc/dgnc_mgmt.h index 567f687b18dd..708abe9594d4 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.h +++ b/drivers/staging/dgnc/dgnc_mgmt.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DGNC_MGMT_H diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 1268aa945e9c..f81df79dc249 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ diff --git a/drivers/staging/dgnc/dgnc_neo.h b/drivers/staging/dgnc/dgnc_neo.h index 1a4abb128693..d7e764a307b9 100644 --- a/drivers/staging/dgnc/dgnc_neo.h +++ b/drivers/staging/dgnc/dgnc_neo.h @@ -11,13 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - * */ #ifndef __DGNC_NEO_H diff --git a/drivers/staging/dgnc/dgnc_pci.h b/drivers/staging/dgnc/dgnc_pci.h index 5b6f76d98aa7..617d40d1ec19 100644 --- a/drivers/staging/dgnc/dgnc_pci.h +++ b/drivers/staging/dgnc/dgnc_pci.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DGNC_PCI_H diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c index a72e35326da4..2df889e29e53 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ b/drivers/staging/dgnc/dgnc_sysfs.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ diff --git a/drivers/staging/dgnc/dgnc_sysfs.h b/drivers/staging/dgnc/dgnc_sysfs.h index 68c0de5898a4..2758914f69d2 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.h +++ b/drivers/staging/dgnc/dgnc_sysfs.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DGNC_SYSFS_H diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 817934269520..d78e5bff36c6 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -11,21 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. */ /************************************************************************ diff --git a/drivers/staging/dgnc/dgnc_tty.h b/drivers/staging/dgnc/dgnc_tty.h index 3975f0407143..21d3369b875c 100644 --- a/drivers/staging/dgnc/dgnc_tty.h +++ b/drivers/staging/dgnc/dgnc_tty.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DGNC_TTY_H diff --git a/drivers/staging/dgnc/dgnc_types.h b/drivers/staging/dgnc/dgnc_types.h index 3aafcedbb0d9..2853d164e51e 100644 --- a/drivers/staging/dgnc/dgnc_types.h +++ b/drivers/staging/dgnc/dgnc_types.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DGNC_TYPES_H diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h index d6e0b9f6b24a..554fbeb2add3 100644 --- a/drivers/staging/dgnc/digi.h +++ b/drivers/staging/dgnc/digi.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DIGI_H diff --git a/drivers/staging/dgnc/dpacompat.h b/drivers/staging/dgnc/dpacompat.h index 33cb394524b8..f41a0e164d2f 100644 --- a/drivers/staging/dgnc/dpacompat.h +++ b/drivers/staging/dgnc/dpacompat.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ -- cgit v1.2.3 From 9f9de64c09ab0224fa945ed5250d62c157fc7a65 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Wed, 11 Mar 2015 15:21:59 +0100 Subject: Staging: dgnc: dgnc_driver: Add a missing call to dgnc_tty_uninit This function is called on the previous and the next failure branches. This patch adds the call on the branch where it seems to be missing. Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index d705e6877eab..ec7c155e50a5 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -558,6 +558,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) rc = dgnc_finalize_board_init(brd); if (rc < 0) { + dgnc_tty_uninit(brd); pr_err(DRVSTR ": Can't finalize board init (%d)\n", rc); brd->state = BOARD_FAILED; brd->dpastatus = BD_NOFEP; -- cgit v1.2.3 From 64e784c4574d9015eee0b97cbf66c2eafcd38feb Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Wed, 11 Mar 2015 17:02:12 +0530 Subject: Staging: dgnc: Remove redundant parentheses This patch removes the redundant parentheses inorder to make code simplified. While doing this, the precedence order of the operation is taken into consideration to keep the logic of the code intact. Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_neo.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index f81df79dc249..12e61cab647b 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -103,7 +103,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) /* Turn on auto CTS flow control */ #if 1 - ier |= (UART_17158_IER_CTSDSR); + ier |= UART_17158_IER_CTSDSR; #else ier &= ~(UART_17158_IER_CTSDSR); #endif @@ -111,7 +111,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) efr |= (UART_17158_EFR_ECB | UART_17158_EFR_CTSDSR); /* Turn off auto Xon flow control */ - efr &= ~(UART_17158_EFR_IXON); + efr &= ~UART_17158_EFR_IXON; /* Why? Becuz Exar's spec says we have to zero it out before setting it */ writeb(0, &ch->ch_neo_uart->efr); @@ -139,15 +139,15 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch) /* Turn on auto RTS flow control */ #if 1 - ier |= (UART_17158_IER_RTSDTR); + ier |= UART_17158_IER_RTSDTR; #else ier &= ~(UART_17158_IER_RTSDTR); #endif efr |= (UART_17158_EFR_ECB | UART_17158_EFR_RTSDTR); /* Turn off auto Xoff flow control */ - ier &= ~(UART_17158_IER_XOFF); - efr &= ~(UART_17158_EFR_IXOFF); + ier &= ~UART_17158_IER_XOFF; + efr &= ~UART_17158_EFR_IXOFF; /* Why? Becuz Exar's spec says we have to zero it out before setting it */ writeb(0, &ch->ch_neo_uart->efr); @@ -169,7 +169,7 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch) * RTS/DTR# output pin (MCR bit-0 or 1 to logic 1 after * it is enabled. */ - ch->ch_mostat |= (UART_MCR_RTS); + ch->ch_mostat |= UART_MCR_RTS; neo_pci_posting_flush(ch->ch_bd); } @@ -181,8 +181,8 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch) unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto CTS flow control */ - ier &= ~(UART_17158_IER_CTSDSR); - efr &= ~(UART_17158_EFR_CTSDSR); + ier &= ~UART_17158_IER_CTSDSR; + efr &= ~UART_17158_EFR_CTSDSR; /* Turn on auto Xon flow control */ efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXON); @@ -218,11 +218,11 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch) unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto RTS flow control */ - ier &= ~(UART_17158_IER_RTSDTR); - efr &= ~(UART_17158_EFR_RTSDTR); + ier &= ~UART_17158_IER_RTSDTR; + efr &= ~UART_17158_EFR_RTSDTR; /* Turn on auto Xoff flow control */ - ier |= (UART_17158_IER_XOFF); + ier |= UART_17158_IER_XOFF; efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXOFF); /* Why? Becuz Exar's spec says we have to zero it out before setting it */ @@ -256,11 +256,11 @@ static inline void neo_set_no_input_flow_control(struct channel_t *ch) unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto RTS flow control */ - ier &= ~(UART_17158_IER_RTSDTR); - efr &= ~(UART_17158_EFR_RTSDTR); + ier &= ~UART_17158_IER_RTSDTR; + efr &= ~UART_17158_EFR_RTSDTR; /* Turn off auto Xoff flow control */ - ier &= ~(UART_17158_IER_XOFF); + ier &= ~UART_17158_IER_XOFF; if (ch->ch_c_iflag & IXON) efr &= ~(UART_17158_EFR_IXOFF); else @@ -296,12 +296,12 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch) unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto CTS flow control */ - ier &= ~(UART_17158_IER_CTSDSR); - efr &= ~(UART_17158_EFR_CTSDSR); + ier &= ~UART_17158_IER_CTSDSR; + efr &= ~UART_17158_EFR_CTSDSR; /* Turn off auto Xon flow control */ if (ch->ch_c_iflag & IXOFF) - efr &= ~(UART_17158_EFR_IXON); + efr &= ~UART_17158_EFR_IXON; else efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXON); -- cgit v1.2.3 From f6a14cf04fdb17de8a96c59518909216f6892e19 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Wed, 11 Mar 2015 15:22:00 +0100 Subject: Staging: dgnc: Use goto for error handling This patch introduces goto statments for error handling and in cases where a lock needs to be released. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr) @candidates exists@ identifier f, label; statement s; position p1, p2, p3; @@ f@p1(...) { ...when any if@p2(...) { ...when any s return@p3 ...; } ...when any } @good1 exists@ identifier candidates.f, candidates.label; statement candidates.s; position candidates.p1, candidates.p2; @@ f@p1(...) { ...when any if(...) { ...when any s return ...; } ...when any if@p2(...) {...} ...when any } @depends on good1@ identifier candidates.f, candidates.label; position candidates.p1, candidates.p3; @@ f@p1(...) { ...when any * return@p3 ...; } Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.c | 19 +++++++------------ drivers/staging/dgnc/dgnc_driver.c | 14 +++----------- drivers/staging/dgnc/dgnc_neo.c | 30 ++++++++++++------------------ 3 files changed, 22 insertions(+), 41 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 634d3ea44365..66397d66ee0e 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -988,22 +988,16 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) spin_lock_irqsave(&ch->ch_lock, flags); /* No data to write to the UART */ - if (ch->ch_w_tail == ch->ch_w_head) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (ch->ch_w_tail == ch->ch_w_head) + goto exit_unlock; /* If port is "stopped", don't send any data to the UART */ if ((ch->ch_flags & CH_FORCED_STOP) || - (ch->ch_flags & CH_BREAK_SENDING)) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + (ch->ch_flags & CH_BREAK_SENDING)) + goto exit_unlock; - if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) + goto exit_unlock; n = 32; @@ -1053,6 +1047,7 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) if (len_written > 0) ch->ch_flags &= ~(CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); +exit_unlock: spin_unlock_irqrestore(&ch->ch_lock, flags); } diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index ec7c155e50a5..9ae9014dd144 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -549,30 +549,19 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) rc = dgnc_tty_register(brd); if (rc < 0) { - dgnc_tty_uninit(brd); pr_err(DRVSTR ": Can't register tty devices (%d)\n", rc); - brd->state = BOARD_FAILED; - brd->dpastatus = BD_NOFEP; goto failed; } rc = dgnc_finalize_board_init(brd); if (rc < 0) { - dgnc_tty_uninit(brd); pr_err(DRVSTR ": Can't finalize board init (%d)\n", rc); - brd->state = BOARD_FAILED; - brd->dpastatus = BD_NOFEP; - goto failed; } rc = dgnc_tty_init(brd); if (rc < 0) { - dgnc_tty_uninit(brd); pr_err(DRVSTR ": Can't init tty devices (%d)\n", rc); - brd->state = BOARD_FAILED; - brd->dpastatus = BD_NOFEP; - goto failed; } @@ -606,6 +595,9 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) return 0; failed: + dgnc_tty_uninit(brd); + brd->state = BOARD_FAILED; + brd->dpastatus = BD_NOFEP; return -ENXIO; diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 12e61cab647b..41105be24229 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -1420,16 +1420,13 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) spin_lock_irqsave(&ch->ch_lock, flags); /* No data to write to the UART */ - if (ch->ch_w_tail == ch->ch_w_head) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (ch->ch_w_tail == ch->ch_w_head) + goto exit_unlock; /* If port is "stopped", don't send any data to the UART */ - if ((ch->ch_flags & CH_FORCED_STOP) || (ch->ch_flags & CH_BREAK_SENDING)) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if ((ch->ch_flags & CH_FORCED_STOP) || + (ch->ch_flags & CH_BREAK_SENDING)) + goto exit_unlock; /* * If FIFOs are disabled. Send data directly to txrx register @@ -1470,27 +1467,23 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) ch->ch_w_tail &= WQUEUEMASK; ch->ch_txcount++; } - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; + + goto exit_unlock; } /* * We have to do it this way, because of the EXAR TXFIFO count bug. */ if ((ch->ch_bd->dvid & 0xf0) < UART_XR17E158_DVID) { - if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) + goto exit_unlock; len_written = 0; n = readb(&ch->ch_neo_uart->tfifo); - if ((unsigned int) n > ch->ch_t_tlevel) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if ((unsigned int) n > ch->ch_t_tlevel) + goto exit_unlock; n = UART_17158_TX_FIFOSIZE - ch->ch_t_tlevel; } else { @@ -1554,6 +1547,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) ch->ch_flags &= ~(CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); } +exit_unlock: spin_unlock_irqrestore(&ch->ch_lock, flags); } -- cgit v1.2.3 From c84a083b995b0bde61640b6576f9c80584915b7a Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Wed, 11 Mar 2015 15:22:01 +0100 Subject: Staging: dgnc: Use goto for spinlock release before return spin_unlock_irqrestore() is called at several different places before exiting. This patch uses a goto statement to factorize these calls. Coccinelle was used to generate this patch. Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_tty.c | 48 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index d78e5bff36c6..8445f84ddaa3 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -492,7 +492,7 @@ void dgnc_input(struct channel_t *ch) { struct dgnc_board *bd; struct tty_struct *tp; - struct tty_ldisc *ld; + struct tty_ldisc *ld = NULL; uint rmask; ushort head; ushort tail; @@ -524,10 +524,8 @@ void dgnc_input(struct channel_t *ch) tail = ch->ch_r_tail & rmask; data_len = (head - tail) & rmask; - if (data_len == 0) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (data_len == 0) + goto exit_unlock; /* * If the device is not open, or CREAD is off, @@ -541,17 +539,14 @@ void dgnc_input(struct channel_t *ch) /* Force queue flow control to be released, if needed */ dgnc_check_queue_flow_control(ch); - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; + goto exit_unlock; } /* * If we are throttled, simply don't read any data. */ - if (ch->ch_flags & CH_FORCED_STOPI) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (ch->ch_flags & CH_FORCED_STOPI) + goto exit_unlock; flip_len = TTY_FLIPBUF_SIZE; @@ -589,12 +584,8 @@ void dgnc_input(struct channel_t *ch) } } - if (len <= 0) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - if (ld) - tty_ldisc_deref(ld); - return; - } + if (len <= 0) + goto exit_unlock; /* * The tty layer in the kernel has changed in 2.6.16+. @@ -662,6 +653,12 @@ void dgnc_input(struct channel_t *ch) if (ld) tty_ldisc_deref(ld); + return; + +exit_unlock: + if (ld) + tty_ldisc_deref(ld); + spin_unlock_irqrestore(&ch->ch_lock, flags); } @@ -1758,10 +1755,8 @@ static int dgnc_tty_write(struct tty_struct *tty, /* * Bail if no space left. */ - if (count <= 0) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return 0; - } + if (count <= 0) + goto exit_retry; /* * Output the printer ON string, if we are in terminal mode, but @@ -1788,10 +1783,8 @@ static int dgnc_tty_write(struct tty_struct *tty, /* * If there is nothing left to copy, or I can't handle any more data, leave. */ - if (count <= 0) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return 0; - } + if (count <= 0) + goto exit_retry; if (from_user) { @@ -1877,6 +1870,11 @@ static int dgnc_tty_write(struct tty_struct *tty, } return count; + +exit_retry: + + spin_unlock_irqrestore(&ch->ch_lock, flags); + return 0; } -- cgit v1.2.3 From 91ca9ed7975529ebb48d14b958fcbe41d0f6a438 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 13 Mar 2015 09:54:57 +0100 Subject: Staging: lustre: fix space issue in workitem.c This patch fixes a space issue in the workitem.c file Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/workitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index c4afaeaf8310..48009b775845 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -442,7 +442,7 @@ cfs_wi_startup(void) } void -cfs_wi_shutdown (void) +cfs_wi_shutdown(void) { struct cfs_wi_sched *sched; -- cgit v1.2.3 From 7aa5d5097dbae28ea1edbe95689f26412ce68c65 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 9 Mar 2015 23:08:00 +0200 Subject: Staging: rtl8192u: Use __packed instead of __attribute__((packed)) This patch fixed the following checkpatch.pl warning: "WARNING: __packed is preferred over __attribute__((packed))". Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 60 +++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 7e81ae108fa8..b6b862a2639f 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -634,7 +634,7 @@ struct ieee80211_snap_hdr { u8 ctrl; /* always 0x03 */ u8 oui[P80211_OUI_LEN]; /* organizational universal id */ -} __attribute__ ((packed)); +} __packed; #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) @@ -969,7 +969,7 @@ struct ieee80211_security { u8 keys[WEP_KEYS][SCM_KEY_LEN]; u8 level; u16 flags; -} __attribute__ ((packed)); +} __packed; /* @@ -1024,14 +1024,14 @@ struct ieee80211_hdr { __le16 frame_ctl; __le16 duration_id; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_1addr { __le16 frame_ctl; __le16 duration_id; u8 addr1[ETH_ALEN]; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_2addr { __le16 frame_ctl; @@ -1039,7 +1039,7 @@ struct ieee80211_hdr_2addr { u8 addr1[ETH_ALEN]; u8 addr2[ETH_ALEN]; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_3addr { __le16 frame_ctl; @@ -1049,7 +1049,7 @@ struct ieee80211_hdr_3addr { u8 addr3[ETH_ALEN]; __le16 seq_ctl; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_4addr { __le16 frame_ctl; @@ -1060,7 +1060,7 @@ struct ieee80211_hdr_4addr { __le16 seq_ctl; u8 addr4[ETH_ALEN]; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_3addrqos { __le16 frame_ctl; @@ -1071,7 +1071,7 @@ struct ieee80211_hdr_3addrqos { __le16 seq_ctl; u8 payload[0]; __le16 qos_ctl; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_4addrqos { __le16 frame_ctl; @@ -1083,13 +1083,13 @@ struct ieee80211_hdr_4addrqos { u8 addr4[ETH_ALEN]; u8 payload[0]; __le16 qos_ctl; -} __attribute__ ((packed)); +} __packed; struct ieee80211_info_element { u8 id; u8 len; u8 data[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_authentication { struct ieee80211_hdr_3addr header; @@ -1098,18 +1098,18 @@ struct ieee80211_authentication { __le16 status; /*challenge*/ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_disassoc { struct ieee80211_hdr_3addr header; __le16 reason; -} __attribute__ ((packed)); +} __packed; struct ieee80211_probe_request { struct ieee80211_hdr_3addr header; /* SSID, supported rates */ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_probe_response { struct ieee80211_hdr_3addr header; @@ -1119,7 +1119,7 @@ struct ieee80211_probe_response { /* SSID, supported rates, FH params, DS params, * CF params, IBSS params, TIM (if beacon), RSN */ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; /* Alias beacon for probe_response */ #define ieee80211_beacon ieee80211_probe_response @@ -1130,7 +1130,7 @@ struct ieee80211_assoc_request_frame { __le16 listen_interval; /* SSID, supported rates, RSN */ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_reassoc_request_frame { struct ieee80211_hdr_3addr header; @@ -1139,7 +1139,7 @@ struct ieee80211_reassoc_request_frame { u8 current_ap[ETH_ALEN]; /* SSID, supported rates, RSN */ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_assoc_response_frame { struct ieee80211_hdr_3addr header; @@ -1147,7 +1147,7 @@ struct ieee80211_assoc_response_frame { __le16 status; __le16 aid; struct ieee80211_info_element info_element[0]; /* supported rates */ -} __attribute__ ((packed)); +} __packed; struct ieee80211_txb { u8 nr_frags; @@ -1164,7 +1164,7 @@ struct ieee80211_txb { struct ieee80211_drv_agg_txb { u8 nr_drv_agg_frames; struct sk_buff *tx_agg_frames[MAX_TX_AGG_COUNT]; -}__attribute__((packed)); +} __packed; #define MAX_SUBFRAME_COUNT 64 struct ieee80211_rxb { @@ -1172,7 +1172,7 @@ struct ieee80211_rxb { struct sk_buff *subframes[MAX_SUBFRAME_COUNT]; u8 dst[ETH_ALEN]; u8 src[ETH_ALEN]; -}__attribute__((packed)); +} __packed; typedef union _frameqos { u16 shortdata; @@ -1240,19 +1240,19 @@ struct ieee80211_qos_information_element { u8 qui_subtype; u8 version; u8 ac_info; -} __attribute__ ((packed)); +} __packed; struct ieee80211_qos_ac_parameter { u8 aci_aifsn; u8 ecw_min_max; __le16 tx_op_limit; -} __attribute__ ((packed)); +} __packed; struct ieee80211_qos_parameter_info { struct ieee80211_qos_information_element info_element; u8 reserved; struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_qos_parameters { __le16 cw_min[QOS_QUEUE_NUM]; @@ -1260,7 +1260,7 @@ struct ieee80211_qos_parameters { u8 aifs[QOS_QUEUE_NUM]; u8 flag[QOS_QUEUE_NUM]; __le16 tx_op_limit[QOS_QUEUE_NUM]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_qos_data { struct ieee80211_qos_parameters parameters; @@ -1273,7 +1273,7 @@ struct ieee80211_qos_data { struct ieee80211_tim_parameters { u8 tim_count; u8 tim_period; -} __attribute__ ((packed)); +} __packed; //#else struct ieee80211_wmm_ac_param { @@ -1286,7 +1286,7 @@ struct ieee80211_wmm_ts_info { u8 ac_dir_tid; u8 ac_up_psb; u8 reserved; -} __attribute__ ((packed)); +} __packed; struct ieee80211_wmm_tspec_elem { struct ieee80211_wmm_ts_info ts_info; @@ -1305,7 +1305,7 @@ struct ieee80211_wmm_tspec_elem { u32 min_phy_rate; u16 surp_band_allow; u16 medium_time; -}__attribute__((packed)); +} __packed; enum eap_type { EAP_PACKET = 0, EAPOL_START, @@ -1344,7 +1344,7 @@ struct eapol { u8 version; u8 type; u16 length; -} __attribute__ ((packed)); +} __packed; struct ieee80211_softmac_stats{ unsigned int rx_ass_ok; @@ -1374,7 +1374,7 @@ struct ieee80211_softmac_stats{ struct ieee80211_info_element_hdr { u8 id; u8 len; -} __attribute__ ((packed)); +} __packed; /* * These are the data types that can make up management packets @@ -1387,7 +1387,7 @@ struct ieee80211_info_element_hdr { u16 listen_interval; struct { u16 association_id:14, reserved:2; - } __attribute__ ((packed)); + } __packed; u32 time_stamp[2]; u16 reason; u16 status; @@ -1448,7 +1448,7 @@ struct ether_header { u8 ether_dhost[ETHER_ADDR_LEN]; u8 ether_shost[ETHER_ADDR_LEN]; u16 ether_type; -} __attribute__((packed)); +} __packed; #ifndef ETHERTYPE_PAE #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ -- cgit v1.2.3 From 2dc9215d7c94f7f9f34ccf8b1710ad73d82f6216 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Thu, 12 Mar 2015 08:44:02 +0100 Subject: power_supply: Move run-time configuration to separate structure Add new structure 'power_supply_config' for holding run-time initialization data like of_node, supplies and private driver data. The power_supply_register() function is changed so all power supply drivers need updating. When registering the power supply this new 'power_supply_config' should be used instead of directly initializing 'struct power_supply'. This allows changing the ownership of power_supply structure from driver to the power supply core in next patches. When a driver does not use of_node or supplies then it should use NULL as config. If driver uses of_node or supplies then it should allocate config on stack and initialize it with proper values. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Bartlomiej Zolnierkiewicz Acked-by: Pavel Machek [for the nvec part] Reviewed-by: Marc Dietrich [for drivers/platform/x86/compal-laptop.c] Reviewed-by: Darren Hart [for drivers/hid/*] Reviewed-by: Jiri Kosina Signed-off-by: Sebastian Reichel --- drivers/staging/nvec/nvec_power.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c index 6a1459d4f8fb..4bfa84672818 100644 --- a/drivers/staging/nvec/nvec_power.c +++ b/drivers/staging/nvec/nvec_power.c @@ -334,8 +334,6 @@ static struct power_supply nvec_bat_psy = { static struct power_supply nvec_psy = { .name = "ac", .type = POWER_SUPPLY_TYPE_MAINS, - .supplied_to = nvec_power_supplied_to, - .num_supplicants = ARRAY_SIZE(nvec_power_supplied_to), .properties = nvec_power_props, .num_properties = ARRAY_SIZE(nvec_power_props), .get_property = nvec_power_get_property, @@ -376,6 +374,7 @@ static int nvec_power_probe(struct platform_device *pdev) struct power_supply *psy; struct nvec_power *power; struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); + struct power_supply_config psy_cfg = {}; power = devm_kzalloc(&pdev->dev, sizeof(struct nvec_power), GFP_NOWAIT); if (power == NULL) @@ -387,6 +386,8 @@ static int nvec_power_probe(struct platform_device *pdev) switch (pdev->id) { case AC: psy = &nvec_psy; + psy_cfg.supplied_to = nvec_power_supplied_to; + psy_cfg.num_supplicants = ARRAY_SIZE(nvec_power_supplied_to); power->notifier.notifier_call = nvec_power_notifier; @@ -407,7 +408,7 @@ static int nvec_power_probe(struct platform_device *pdev) if (pdev->id == BAT) get_bat_mfg_data(power); - return power_supply_register(&pdev->dev, psy); + return power_supply_register(&pdev->dev, psy, &psy_cfg); } static int nvec_power_remove(struct platform_device *pdev) -- cgit v1.2.3 From 297d716f6260cc9421d971b124ca196b957ee458 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Thu, 12 Mar 2015 08:44:11 +0100 Subject: power_supply: Change ownership from driver to core Change the ownership of power_supply structure from each driver implementing the class to the power supply core. The patch changes power_supply_register() function thus all drivers implementing power supply class are adjusted. Each driver provides the implementation of power supply. However it should not be the owner of power supply class instance because it is exposed by core to other subsystems with power_supply_get_by_name(). These other subsystems have no knowledge when the driver will unregister the power supply. This leads to several issues when driver is unbound - mostly because user of power supply accesses freed memory. Instead let the core own the instance of struct 'power_supply'. Other users of this power supply will still access valid memory because it will be freed when device reference count reaches 0. Currently this means "it will leak" but power_supply_put() call in next patches will solve it. This solves invalid memory references in following race condition scenario: Thread 1: charger manager Thread 2: power supply driver, used by charger manager THREAD 1 (charger manager) THREAD 2 (power supply driver) ========================== ============================== psy = power_supply_get_by_name() Driver unbind, .remove power_supply_unregister() Device fully removed psy->get_property() The 'get_property' call is executed in invalid context because the driver was unbound and struct 'power_supply' memory was freed. This could be observed easily with charger manager driver (here compiled with max17040 fuel gauge): $ cat /sys/devices/virtual/power_supply/cm-battery/capacity & $ echo "1-0036" > /sys/bus/i2c/drivers/max17040/unbind [ 55.725123] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 55.732584] pgd = d98d4000 [ 55.734060] [00000000] *pgd=5afa2831, *pte=00000000, *ppte=00000000 [ 55.740318] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM [ 55.746210] Modules linked in: [ 55.749259] CPU: 1 PID: 2936 Comm: cat Tainted: G W 3.19.0-rc1-next-20141226-00048-gf79f475f3c44-dirty #1496 [ 55.760190] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 55.766270] task: d9b76f00 ti: daf54000 task.ti: daf54000 [ 55.771647] PC is at 0x0 [ 55.774182] LR is at charger_get_property+0x2f4/0x36c [ 55.779201] pc : [<00000000>] lr : [] psr: 60000013 [ 55.779201] sp : daf55e90 ip : 00000003 fp : 00000000 [ 55.790657] r10: 00000000 r9 : c06e2878 r8 : d9b26c68 [ 55.795865] r7 : dad81610 r6 : daec7410 r5 : daf55ebc r4 : 00000000 [ 55.802367] r3 : 00000000 r2 : daf55ebc r1 : 0000002a r0 : d9b26c68 [ 55.808879] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 55.815994] Control: 10c5387d Table: 598d406a DAC: 00000015 [ 55.821723] Process cat (pid: 2936, stack limit = 0xdaf54210) [ 55.827451] Stack: (0xdaf55e90 to 0xdaf56000) [ 55.831795] 5e80: 60000013 c01459c4 0000002a c06f8ef8 [ 55.839956] 5ea0: db651000 c06f8ef8 daebac00 c04cb668 daebac08 c0346864 00000000 c01459c4 [ 55.848115] 5ec0: d99eaa80 c06f8ef8 00000fff 00001000 db651000 c027f25c c027f240 d99eaa80 [ 55.856274] 5ee0: d9a06c00 c0146218 daf55f18 00001000 d99eaa80 db4c18c0 00000001 00000001 [ 55.864468] 5f00: daf55f80 c0144c78 c0144c54 c0107f90 00015000 d99eaab0 00000000 00000000 [ 55.872603] 5f20: 000051c7 00000000 db4c18c0 c04a9370 00015000 00001000 daf55f80 00001000 [ 55.880763] 5f40: daf54000 00015000 00000000 c00e53dc db4c18c0 c00e548c 0000000d 00008124 [ 55.888937] 5f60: 00000001 00000000 00000000 db4c18c0 db4c18c0 00001000 00015000 c00e5550 [ 55.897099] 5f80: 00000000 00000000 00001000 00001000 00015000 00000003 00000003 c000f364 [ 55.905239] 5fa0: 00000000 c000f1a0 00001000 00015000 00000003 00015000 00001000 0001333c [ 55.913399] 5fc0: 00001000 00015000 00000003 00000003 00000002 00000000 00000000 00000000 [ 55.921560] 5fe0: 7fffe000 be999850 0000a225 b6f3c19c 60000010 00000003 00000000 00000000 [ 55.929744] [] (charger_get_property) from [] (power_supply_show_property+0x48/0x20c) [ 55.939286] [] (power_supply_show_property) from [] (dev_attr_show+0x1c/0x48) [ 55.948130] [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x84/0x104) [ 55.956298] [] (sysfs_kf_seq_show) from [] (kernfs_seq_show+0x24/0x28) [ 55.964536] [] (kernfs_seq_show) from [] (seq_read+0x1b0/0x484) [ 55.972172] [] (seq_read) from [] (__vfs_read+0x18/0x4c) [ 55.979188] [] (__vfs_read) from [] (vfs_read+0x7c/0x100) [ 55.986304] [] (vfs_read) from [] (SyS_read+0x40/0x8c) [ 55.993164] [] (SyS_read) from [] (ret_fast_syscall+0x0/0x48) [ 56.000626] Code: bad PC value [ 56.011652] ---[ end trace 7b64343fbdae8ef1 ]--- Signed-off-by: Krzysztof Kozlowski Reviewed-by: Bartlomiej Zolnierkiewicz [for the nvec part] Reviewed-by: Marc Dietrich [for compal-laptop.c] Acked-by: Darren Hart [for the mfd part] Acked-by: Lee Jones [for the hid part] Acked-by: Jiri Kosina [for the acpi part] Acked-by: Rafael J. Wysocki Signed-off-by: Sebastian Reichel --- drivers/staging/nvec/nvec_power.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c index 4bfa84672818..30b66c3c9b73 100644 --- a/drivers/staging/nvec/nvec_power.c +++ b/drivers/staging/nvec/nvec_power.c @@ -82,8 +82,8 @@ struct bat_response { }; }; -static struct power_supply nvec_bat_psy; -static struct power_supply nvec_psy; +static struct power_supply *nvec_bat_psy; +static struct power_supply *nvec_psy; static int nvec_power_notifier(struct notifier_block *nb, unsigned long event_type, void *data) @@ -98,7 +98,7 @@ static int nvec_power_notifier(struct notifier_block *nb, if (res->sub_type == 0) { if (power->on != res->plu) { power->on = res->plu; - power_supply_changed(&nvec_psy); + power_supply_changed(nvec_psy); } return NOTIFY_STOP; } @@ -167,7 +167,7 @@ static int nvec_power_bat_notifier(struct notifier_block *nb, } power->bat_cap = res->plc[1]; if (status_changed) - power_supply_changed(&nvec_bat_psy); + power_supply_changed(nvec_bat_psy); break; case VOLTAGE: power->bat_voltage_now = res->plu * 1000; @@ -225,7 +225,7 @@ static int nvec_power_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { - struct nvec_power *power = dev_get_drvdata(psy->dev->parent); + struct nvec_power *power = dev_get_drvdata(psy->dev.parent); switch (psp) { case POWER_SUPPLY_PROP_ONLINE: @@ -241,7 +241,7 @@ static int nvec_battery_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { - struct nvec_power *power = dev_get_drvdata(psy->dev->parent); + struct nvec_power *power = dev_get_drvdata(psy->dev.parent); switch (psp) { case POWER_SUPPLY_PROP_STATUS: @@ -323,7 +323,7 @@ static char *nvec_power_supplied_to[] = { "battery", }; -static struct power_supply nvec_bat_psy = { +static const struct power_supply_desc nvec_bat_psy_desc = { .name = "battery", .type = POWER_SUPPLY_TYPE_BATTERY, .properties = nvec_battery_props, @@ -331,7 +331,7 @@ static struct power_supply nvec_bat_psy = { .get_property = nvec_battery_get_property, }; -static struct power_supply nvec_psy = { +static const struct power_supply_desc nvec_psy_desc = { .name = "ac", .type = POWER_SUPPLY_TYPE_MAINS, .properties = nvec_power_props, @@ -371,7 +371,8 @@ static void nvec_power_poll(struct work_struct *work) static int nvec_power_probe(struct platform_device *pdev) { - struct power_supply *psy; + struct power_supply **psy; + const struct power_supply_desc *psy_desc; struct nvec_power *power; struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); struct power_supply_config psy_cfg = {}; @@ -386,6 +387,7 @@ static int nvec_power_probe(struct platform_device *pdev) switch (pdev->id) { case AC: psy = &nvec_psy; + psy_desc = &nvec_psy_desc; psy_cfg.supplied_to = nvec_power_supplied_to; psy_cfg.num_supplicants = ARRAY_SIZE(nvec_power_supplied_to); @@ -396,6 +398,7 @@ static int nvec_power_probe(struct platform_device *pdev) break; case BAT: psy = &nvec_bat_psy; + psy_desc = &nvec_bat_psy_desc; power->notifier.notifier_call = nvec_power_bat_notifier; break; @@ -408,7 +411,9 @@ static int nvec_power_probe(struct platform_device *pdev) if (pdev->id == BAT) get_bat_mfg_data(power); - return power_supply_register(&pdev->dev, psy, &psy_cfg); + *psy = power_supply_register(&pdev->dev, psy_desc, &psy_cfg); + + return PTR_ERR_OR_ZERO(*psy); } static int nvec_power_remove(struct platform_device *pdev) @@ -419,10 +424,10 @@ static int nvec_power_remove(struct platform_device *pdev) nvec_unregister_notifier(power->nvec, &power->notifier); switch (pdev->id) { case AC: - power_supply_unregister(&nvec_psy); + power_supply_unregister(nvec_psy); break; case BAT: - power_supply_unregister(&nvec_bat_psy); + power_supply_unregister(nvec_bat_psy); } return 0; -- cgit v1.2.3 From 8d09f48adfd282157f6afc94d2502b44156cb12f Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Sat, 28 Feb 2015 21:54:42 +0100 Subject: staging: iio: hmc5843: Set iio name property in sysfs Without this change file name for hmc5843 is empty in /sys/bus/iio/devices/iio\:device*/name With this change name is reported correctly: cat /sys/bus/iio/devices/iio\:device*/name hmc5843 Signed-off-by: Marek Belisko Signed-off-by: Jonathan Cameron --- drivers/staging/iio/magnetometer/hmc5843_core.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c index fd171d8b38fb..90cc18b703cf 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_core.c +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c @@ -592,6 +592,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap, mutex_init(&data->lock); indio_dev->dev.parent = dev; + indio_dev->name = dev->driver->name; indio_dev->info = &hmc5843_info; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = data->variant->channels; -- cgit v1.2.3 From ed170dedd1ddd316c5cd17fec3dd7937981e2fb7 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Mon, 9 Mar 2015 12:15:53 +0200 Subject: staging: iio: dummy: Fix undefined symbol build error CONFIG_SIMPLE_DUMMY_BUFFER compiles in iio_simple_dummy_buffer.c file which uses functions from industrialio-trigger.c. So, CONFIG_SIMPLE_DUMMY_BUFFER needs to select IIO_TRIGGER in order to avoid build error like this: > ERROR: "iio_trigger_notify_done" [drivers/staging/iio/iio_dummy.ko] undefined! > ERROR: "iio_triggered_buffer_postenable" [drivers/staging/iio/iio_dummy.ko] undefined! > ERROR: "iio_triggered_buffer_predisable" [drivers/staging/iio/iio_dummy.ko] undefined! > ERROR: "iio_alloc_pollfunc" [drivers/staging/iio/iio_dummy.ko] undefined! > ERROR: "iio_dealloc_pollfunc" [drivers/staging/iio/iio_dummy.ko] undefined! Cc: Arnd Bergmann Reported-by: kbuild test robot Signed-off-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/staging/iio/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index 24183028bd71..6d5b38d69578 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig @@ -38,6 +38,7 @@ config IIO_SIMPLE_DUMMY_EVENTS config IIO_SIMPLE_DUMMY_BUFFER bool "Buffered capture support" select IIO_BUFFER + select IIO_TRIGGER select IIO_KFIFO_BUF help Add buffered data capture to the simple dummy driver. -- cgit v1.2.3 From 6aa39ba7e50a10676408f943cce82d666fa8b638 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:38:52 +0530 Subject: staging: unisys: Use kcalloc instead of kzalloc. This patch uses kcalloc instead of kzalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorutil/procobjecttree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c index 0ba75547b2c5..e4e954ed57ef 100644 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ b/drivers/staging/unisys/visorutil/procobjecttree.c @@ -154,7 +154,7 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot, type->nProperties++; while (type->name[type->nNames] != NULL) type->nNames++; - type->procDirs = kzalloc((type->nNames + 1) * + type->procDirs = kcalloc((type->nNames + 1), sizeof(struct proc_dir_entry *), GFP_KERNEL | __GFP_NORETRY); if (type->procDirs == NULL) @@ -242,12 +242,12 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, goto Away; } obj->procDirPropertyContexts = - kzalloc((type->nProperties + 1) * + kcalloc((type->nProperties + 1), sizeof(struct proc_dir_entry_context), GFP_KERNEL | __GFP_NORETRY); if (obj->procDirPropertyContexts == NULL) goto Away; - obj->procDirProperties = kzalloc((type->nProperties + 1) * + obj->procDirProperties = kcalloc((type->nProperties + 1), sizeof(struct proc_dir_entry *), GFP_KERNEL | __GFP_NORETRY); if (obj->procDirProperties == NULL) -- cgit v1.2.3 From 5869066a57d39c9aa5c6204dc89ba8c7e2abdf56 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:37:28 +0530 Subject: staging: media: Use kcalloc instead of kzalloc This patch uses kcalloc instead of kzalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 116251b4e317..fd8de766dd5c 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -1792,7 +1792,7 @@ static int bcm2048_get_rds_data(struct bcm2048_device *bdev, char *data) goto unlock; } - data_buffer = kzalloc(BCM2048_MAX_RDS_RADIO_TEXT*5, GFP_KERNEL); + data_buffer = kcalloc(BCM2048_MAX_RDS_RADIO_TEXT, 5, GFP_KERNEL); if (!data_buffer) { err = -ENOMEM; goto unlock; -- cgit v1.2.3 From 9ac04a878802a121caef6cc924931281b7091f03 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:35:57 +0530 Subject: staging: media: Use kcalloc instead of kzalloc. This patch uses kcalloc instead of kzalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c index a350a20955f1..57426199ad7a 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c @@ -226,8 +226,8 @@ static int vpfe_enable_clock(struct vpfe_device *vpfe_dev) if (!vpfe_cfg->num_clocks) return 0; - vpfe_dev->clks = kzalloc(vpfe_cfg->num_clocks * - sizeof(struct clock *), GFP_KERNEL); + vpfe_dev->clks = kcalloc(vpfe_cfg->num_clocks, + sizeof(struct clock *), GFP_KERNEL); if (vpfe_dev->clks == NULL) return -ENOMEM; @@ -346,7 +346,8 @@ static int register_i2c_devices(struct vpfe_device *vpfe_dev) i2c_adap = i2c_get_adapter(1); num_subdevs = vpfe_cfg->num_subdevs; vpfe_dev->sd = - kzalloc(sizeof(struct v4l2_subdev *)*num_subdevs, GFP_KERNEL); + kcalloc(num_subdevs, sizeof(struct v4l2_subdev *), + GFP_KERNEL); if (vpfe_dev->sd == NULL) return -ENOMEM; -- cgit v1.2.3 From 3637d77f5f3ce080e9a2c4f1435f7ce0f5a4ef48 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:34:29 +0530 Subject: staging: iio: Use kcalloc instead of kzalloc This patch uses kcalloc instead of kzalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/lis3l02dq_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index 1fd90090a633..e6101bbc7fbd 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -118,7 +118,7 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev, int scan_count = bitmap_weight(indio_dev->active_scan_mask, indio_dev->masklength); - rx_array = kzalloc(4 * scan_count, GFP_KERNEL); + rx_array = kcalloc(4, scan_count, GFP_KERNEL); if (rx_array == NULL) return -ENOMEM; ret = lis3l02dq_read_all(indio_dev, rx_array); -- cgit v1.2.3 From 7e026b647b27d3dc170bd335d5e9c4a6f45323ff Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:32:50 +0530 Subject: staging: iio: Use kcalloc instead of kzalloc. This patch uses kcalloc instead of kzalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/adc/ad7280a.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index 4d4870787eed..e7d45ee2fac6 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -547,8 +547,9 @@ static int ad7280_attr_init(struct ad7280_state *st) { int dev, ch, cnt; - st->iio_attr = kzalloc(sizeof(*st->iio_attr) * (st->slave_num + 1) * - AD7280A_CELLS_PER_DEV * 2, GFP_KERNEL); + st->iio_attr = kcalloc(2, sizeof(*st->iio_attr) * + (st->slave_num + 1) * AD7280A_CELLS_PER_DEV, + GFP_KERNEL); if (st->iio_attr == NULL) return -ENOMEM; -- cgit v1.2.3 From 7f39902654c59d02b32b1b0900304d10c2f212d1 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:29:27 +0530 Subject: staging: rtl8188eu: Use kcalloc instead of kzalloc This patch uses kcalloc instead of kzalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c index bc275b2a7d37..06d1e654483e 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c @@ -42,7 +42,7 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) _rtw_init_queue(&precvpriv->free_recv_buf_queue); precvpriv->pallocated_recv_buf = - kzalloc(NR_RECVBUFF * sizeof(struct recv_buf), GFP_KERNEL); + kcalloc(NR_RECVBUFF, sizeof(struct recv_buf), GFP_KERNEL); if (precvpriv->pallocated_recv_buf == NULL) { res = _FAIL; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, -- cgit v1.2.3 From 0507a1e52b7d55c9fa6fe952c90383487c0eb669 Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:27:27 +0530 Subject: staging: rtl8188eu: Use kcalloc instead of kzalloc. This patch uses kcalloc instead of kzalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index 7a71df167464..7ed60abf4d49 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -1634,7 +1634,8 @@ void rtw_alloc_hwxmits(struct adapter *padapter) pxmitpriv->hwxmit_entry = HWXMIT_ENTRY; - pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL); + pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry, + sizeof(struct hw_xmit), GFP_KERNEL); hwxmits = pxmitpriv->hwxmits; -- cgit v1.2.3 From d272f9ddce1b77271e3ab449c99257b3fc1fb3be Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:58:07 +0530 Subject: staging: rtl8192e: Use kzalloc instead of kmalloc. This patch uses kzalloc instead of kmalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 16aef7cf23b9..c246ef40c69e 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -3421,12 +3421,11 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL); + new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); if (new_crypt == NULL) { ret = -ENOMEM; goto done; } - memset(new_crypt, 0, sizeof(struct lib80211_crypt_data)); new_crypt->ops = ops; if (new_crypt->ops) new_crypt->priv = -- cgit v1.2.3 From a774fe09237adc329c9fda5ec877dccebfd2589e Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:56:58 +0530 Subject: staging: rtl8192u: Use kzalloc instead of kmalloc. This patch uses kzalloc instead of kmalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 878086af9445..d93e5fd4c46e 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -3025,12 +3025,11 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, ieee80211_crypt_delayed_deinit(ieee, crypt); - new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL); + new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); if (new_crypt == NULL) { ret = -ENOMEM; goto done; } - memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); new_crypt->ops = ops; if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) new_crypt->priv = -- cgit v1.2.3 From d0edf4bcfa67702e821acb8592bc9b33a328f13a Mon Sep 17 00:00:00 2001 From: Navya Sri Nizamkari Date: Tue, 10 Mar 2015 17:55:40 +0530 Subject: staging: wlan-ng: Use kzalloc instead of kmalloc. This patch uses kzalloc instead of kmalloc function. A coccinelle script was used to make this change. Signed-off-by: Navya Sri Nizamkari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x_usb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index c85b1b55fdb3..e109a7fd422f 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -619,11 +619,10 @@ static hfa384x_usbctlx_t *usbctlx_alloc(void) { hfa384x_usbctlx_t *ctlx; - ctlx = kmalloc(sizeof(*ctlx), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); - if (ctlx != NULL) { - memset(ctlx, 0, sizeof(*ctlx)); + ctlx = kzalloc(sizeof(*ctlx), + in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); + if (ctlx != NULL) init_completion(&ctlx->done); - } return ctlx; } -- cgit v1.2.3 From 5b4ac54fd5aaa93922010c596292e6802c8420f6 Mon Sep 17 00:00:00 2001 From: Himani Agrawal Date: Mon, 9 Mar 2015 19:39:50 +0530 Subject: staging: vt6655: Fixes the checkpatch.pl warning warning fixed: WARNING: line over 80 characters The function call containing several variables is broken to make it fit in 80 characters. Signed-off-by: Himani Agrawal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/baseband.c | 48 ++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 565ba189afb2..b0ea38f1911c 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -2021,14 +2021,20 @@ bool BBbVT3253Init(struct vnt_private *priv) if (byRFType == RF_RFMD2959) { if (byLocalID <= REV_ID_VT3253_A1) { for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253InitTab_RFMD[ii][0], byVT3253InitTab_RFMD[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253InitTab_RFMD[ii][0], + byVT3253InitTab_RFMD[ii][1]); } else { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_RFMD[ii][0], byVT3253B0_RFMD[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_RFMD[ii][0], + byVT3253B0_RFMD[ii][1]); for (ii = 0; ii < CB_VT3253B0_AGC_FOR_RFMD2959; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC4_RFMD2959[ii][0], byVT3253B0_AGC4_RFMD2959[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_AGC4_RFMD2959[ii][0], + byVT3253B0_AGC4_RFMD2959[ii][1]); VNSvOutPortD(dwIoBase + MAC_REG_ITRTMSET, 0x23); MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0)); @@ -2043,10 +2049,13 @@ bool BBbVT3253Init(struct vnt_private *priv) priv->ldBmThreshold[3] = 0; } else if ((byRFType == RF_AIROHA) || (byRFType == RF_AL2230S)) { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_AIROHA2230[ii][0], + byVT3253B0_AIROHA2230[ii][1]); for (ii = 0; ii < CB_VT3253B0_AGC; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); priv->abyBBVGA[0] = 0x1C; priv->abyBBVGA[1] = 0x10; @@ -2058,10 +2067,14 @@ bool BBbVT3253Init(struct vnt_private *priv) priv->ldBmThreshold[3] = 0; } else if (byRFType == RF_UW2451) { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_UW2451[ii][0], byVT3253B0_UW2451[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_UW2451[ii][0], + byVT3253B0_UW2451[ii][1]); for (ii = 0; ii < CB_VT3253B0_AGC; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_AGC[ii][0], + byVT3253B0_AGC[ii][1]); VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23); MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0)); @@ -2076,7 +2089,9 @@ bool BBbVT3253Init(struct vnt_private *priv) priv->ldBmThreshold[3] = 0; } else if (byRFType == RF_UW2452) { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_UW2451[ii][0], byVT3253B0_UW2451[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_UW2451[ii][0], + byVT3253B0_UW2451[ii][1]); /* Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) */ /*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/ @@ -2097,7 +2112,8 @@ bool BBbVT3253Init(struct vnt_private *priv) bResult &= BBbWriteEmbedded(priv, 0xb0, 0x58); for (ii = 0; ii < CB_VT3253B0_AGC; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); priv->abyBBVGA[0] = 0x14; priv->abyBBVGA[1] = 0x0A; @@ -2111,10 +2127,13 @@ bool BBbVT3253Init(struct vnt_private *priv) } else if (byRFType == RF_VT3226) { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_AIROHA2230[ii][0], + byVT3253B0_AIROHA2230[ii][1]); for (ii = 0; ii < CB_VT3253B0_AGC; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); priv->abyBBVGA[0] = 0x1C; priv->abyBBVGA[1] = 0x10; @@ -2129,7 +2148,9 @@ bool BBbVT3253Init(struct vnt_private *priv) /* {{ RobertYu: 20050104 */ } else if (byRFType == RF_AIROHA7230) { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_AIROHA2230[ii][0], + byVT3253B0_AIROHA2230[ii][1]); /* {{ RobertYu:20050223, request by JerryChung */ @@ -2142,7 +2163,8 @@ bool BBbVT3253Init(struct vnt_private *priv) /* }} */ for (ii = 0; ii < CB_VT3253B0_AGC; ii++) - bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); + bResult &= BBbWriteEmbedded(priv, + byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); priv->abyBBVGA[0] = 0x1C; priv->abyBBVGA[1] = 0x10; -- cgit v1.2.3 From 1ce7948fe18230ae096cdb78211715309de9889c Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Mon, 9 Mar 2015 19:18:24 +0530 Subject: Staging: rtl8188eu: Remove redundant local variable This patch removes a redundant variable "val" and adds inline return statements. It also adds a default case to the switch statement which returns 0 to keep the logic intact. It also removes a redundant variable "inx" and adds inline return statements. This issue is identified by the following coccinelle script. @@ expression ret; identifier f; @@ -ret = +return f(...); -return ret; Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 81 +++++++++----------------- 1 file changed, 28 insertions(+), 53 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 509fc05ebea8..9e9645b453f1 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -136,47 +136,34 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen static unsigned char ratetbl_val_2wifirate(unsigned char rate) { - unsigned char val = 0; - switch (rate & 0x7f) { case 0: - val = IEEE80211_CCK_RATE_1MB; - break; + return IEEE80211_CCK_RATE_1MB; case 1: - val = IEEE80211_CCK_RATE_2MB; - break; + return IEEE80211_CCK_RATE_2MB; case 2: - val = IEEE80211_CCK_RATE_5MB; - break; + return IEEE80211_CCK_RATE_5MB; case 3: - val = IEEE80211_CCK_RATE_11MB; - break; + return IEEE80211_CCK_RATE_11MB; case 4: - val = IEEE80211_OFDM_RATE_6MB; - break; + return IEEE80211_OFDM_RATE_6MB; case 5: - val = IEEE80211_OFDM_RATE_9MB; - break; + return IEEE80211_OFDM_RATE_9MB; case 6: - val = IEEE80211_OFDM_RATE_12MB; - break; + return IEEE80211_OFDM_RATE_12MB; case 7: - val = IEEE80211_OFDM_RATE_18MB; - break; + return IEEE80211_OFDM_RATE_18MB; case 8: - val = IEEE80211_OFDM_RATE_24MB; - break; + return IEEE80211_OFDM_RATE_24MB; case 9: - val = IEEE80211_OFDM_RATE_36MB; - break; + return IEEE80211_OFDM_RATE_36MB; case 10: - val = IEEE80211_OFDM_RATE_48MB; - break; + return IEEE80211_OFDM_RATE_48MB; case 11: - val = IEEE80211_OFDM_RATE_54MB; - break; + return IEEE80211_OFDM_RATE_54MB; + default: + return 0; } - return val; } static int is_basicrate(struct adapter *padapter, unsigned char rate) @@ -1209,48 +1196,36 @@ unsigned int is_ap_in_wep(struct adapter *padapter) static int wifirate2_ratetbl_inx(unsigned char rate) { - int inx = 0; rate = rate & 0x7f; switch (rate) { case 54*2: - inx = 11; - break; + return 11; case 48*2: - inx = 10; - break; + return 10; case 36*2: - inx = 9; - break; + return 9; case 24*2: - inx = 8; - break; + return 8; case 18*2: - inx = 7; - break; + return 7; case 12*2: - inx = 6; - break; + return 6; case 9*2: - inx = 5; - break; + return 5; case 6*2: - inx = 4; - break; + return 4; case 11*2: - inx = 3; - break; + return 3; case 11: - inx = 2; - break; + return 2; case 2*2: - inx = 1; - break; + return 1; case 1*2: - inx = 0; - break; + return 0; + default: + return 0; } - return inx; } unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz) -- cgit v1.2.3 From 22e7f1e25b0a52da91cf9fedf3f02887dc7e4742 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Mon, 9 Mar 2015 19:18:25 +0530 Subject: Staging: rtl8188eu: Remove unneeded return statement This patch removes unnecessary return statement from a void function and hence make it more compatible. This issue is identified by checkpatch.pl Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 9e9645b453f1..4ba05b97e487 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -763,7 +763,6 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) else pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; } - return; } void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) @@ -784,7 +783,6 @@ void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) pmlmeinfo->HT_info_enable = 1; memcpy(&(pmlmeinfo->HT_info), pIE->data, pIE->Length); - return; } void HTOnAssocRsp(struct adapter *padapter) -- cgit v1.2.3 From 5b2965b63371d345b572b49f07227a17ae5504d3 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 9 Mar 2015 20:38:48 +0200 Subject: Staging: rtl8192u: Add function to improve code quality This patch introduces a new function for the authentication response error check in the ieee80211_rx_frame_softmac() function to fix the indentation problem. It also adds the iotAction variable in the new function to fix the "more than 80 characters per line" warning. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 129 +++++++++++---------- 1 file changed, 67 insertions(+), 62 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index d93e5fd4c46e..13e7618ac7ca 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -1920,6 +1920,66 @@ static void ieee80211_process_action(struct ieee80211_device *ieee, return; } + +void ieee80211_check_auth_response(struct ieee80211_device *ieee, + struct sk_buff *skb) +{ + /* default support N mode, disable halfNmode */ + bool bSupportNmode = true, bHalfSupportNmode = false; + u16 errcode; + u8 *challenge; + int chlen = 0; + u32 iotAction; + + errcode = auth_parse(skb, &challenge, &chlen); + if (!errcode) { + if (ieee->open_wep || !challenge) { + ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; + ieee->softmac_stats.rx_auth_rs_ok++; + iotAction = ieee->pHTInfo->IOTAction; + if (!(iotAction & HT_IOT_ACT_PURE_N_MODE)) { + if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { + /* WEP or TKIP encryption */ + if (IsHTHalfNmodeAPs(ieee)) { + bSupportNmode = true; + bHalfSupportNmode = true; + } else { + bSupportNmode = false; + bHalfSupportNmode = false; + } + printk("==========>to link with AP using SEC(%d, %d)", + bSupportNmode, + bHalfSupportNmode); + } + } + /* Dummy wirless mode setting- avoid encryption issue */ + if (bSupportNmode) { + /* N mode setting */ + ieee->SetWirelessMode(ieee->dev, + ieee->current_network.mode); + } else { + /* b/g mode setting - TODO */ + ieee->SetWirelessMode(ieee->dev, IEEE_G); + } + + if (ieee->current_network.mode == IEEE_N_24G && + bHalfSupportNmode == true) { + printk("===============>entern half N mode\n"); + ieee->bHalfWirelessN24GMode = true; + } else + ieee->bHalfWirelessN24GMode = false; + + ieee80211_associate_step2(ieee); + } else { + ieee80211_auth_challenge(ieee, challenge, chlen); + } + } else { + ieee->softmac_stats.rx_auth_rs_err++; + IEEE80211_DEBUG_MGMT("Auth response status code 0x%x", errcode); + ieee80211_associate_abort(ieee); + } +} + inline int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats, u16 type, @@ -1927,12 +1987,9 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, { struct ieee80211_hdr_3addr *header = (struct ieee80211_hdr_3addr *) skb->data; u16 errcode; - u8 *challenge; - int chlen=0; int aid; struct ieee80211_assoc_response_frame *assoc_resp; // struct ieee80211_info_element *info_element; - bool bSupportNmode = true, bHalfSupportNmode = false; //default support N mode, disable halfNmode if(!ieee->proto_started) return 0; @@ -2014,67 +2071,15 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, case IEEE80211_STYPE_AUTH: if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){ - if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && - ieee->iw_mode == IW_MODE_INFRA){ - - IEEE80211_DEBUG_MGMT("Received authentication response"); - - errcode = auth_parse(skb, &challenge, &chlen); - if (!errcode) { - if(ieee->open_wep || !challenge){ - ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; - ieee->softmac_stats.rx_auth_rs_ok++; - if(!(ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE)) - { - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) - { - // WEP or TKIP encryption - if(IsHTHalfNmodeAPs(ieee)) - { - bSupportNmode = true; - bHalfSupportNmode = true; - } - else - { - bSupportNmode = false; - bHalfSupportNmode = false; - } - printk("==========>to link with AP using SEC(%d, %d)", bSupportNmode, bHalfSupportNmode); - } - } - /* Dummy wirless mode setting to avoid encryption issue */ - if(bSupportNmode) { - //N mode setting - ieee->SetWirelessMode(ieee->dev, \ - ieee->current_network.mode); - }else{ - //b/g mode setting - /*TODO*/ - ieee->SetWirelessMode(ieee->dev, IEEE_G); - } - - if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode == true) - { - printk("===============>entern half N mode\n"); - ieee->bHalfWirelessN24GMode = true; - } - else - ieee->bHalfWirelessN24GMode = false; - - ieee80211_associate_step2(ieee); - }else{ - ieee80211_auth_challenge(ieee, challenge, chlen); - } - }else{ - ieee->softmac_stats.rx_auth_rs_err++; - IEEE80211_DEBUG_MGMT("Authentication response status code 0x%x",errcode); - ieee80211_associate_abort(ieee); - } + if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING + && ieee->iw_mode == IW_MODE_INFRA) { - }else if (ieee->iw_mode == IW_MODE_MASTER){ - ieee80211_rx_auth_rq(ieee, skb); - } + IEEE80211_DEBUG_MGMT("Received auth response"); + ieee80211_check_auth_response(ieee, skb); + } else if (ieee->iw_mode == IW_MODE_MASTER) { + ieee80211_rx_auth_rq(ieee, skb); } + } break; case IEEE80211_STYPE_PROBE_REQ: -- cgit v1.2.3 From b4e3e6eec877078e394c3c10cf37dae046e6f334 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 9 Mar 2015 20:39:24 +0200 Subject: Staging: rtl8192u: Replace printk() with netdev_dbg() This patch replaces the printk() function with netdev_dbg() in order to fix the following: "WARNING: printk() should include KERN_ facility level" and "WARNING: line over 80 characters". Issue found by checkpatch.pl Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 13e7618ac7ca..9d57c655ecde 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -1947,9 +1947,9 @@ void ieee80211_check_auth_response(struct ieee80211_device *ieee, bSupportNmode = false; bHalfSupportNmode = false; } - printk("==========>to link with AP using SEC(%d, %d)", - bSupportNmode, - bHalfSupportNmode); + netdev_dbg(ieee->dev, "SEC(%d, %d)\n", + bSupportNmode, + bHalfSupportNmode); } } /* Dummy wirless mode setting- avoid encryption issue */ @@ -1964,7 +1964,7 @@ void ieee80211_check_auth_response(struct ieee80211_device *ieee, if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode == true) { - printk("===============>entern half N mode\n"); + netdev_dbg(ieee->dev, "enter half N mode\n"); ieee->bHalfWirelessN24GMode = true; } else ieee->bHalfWirelessN24GMode = false; -- cgit v1.2.3 From b6ee3824259e6902553c7dc7159c7763963b80fc Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 13 Mar 2015 20:48:53 +0300 Subject: Staging: lustre: Remove parentheses around right side an assignment Parentheses are not needed around the right hand side of an assignment. This patch remove parenthese of such occurenses. Issue was detected and solved using the following coccinelle script: @rule1@ identifier x, y, z; expression E1, E2; @@ ( x = (y == z); | x = (E1 == E2); | x = -( ... -) ; ) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 ++-- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 4 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 2 +- drivers/staging/lustre/lustre/libcfs/debug.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/lloop.c | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 2 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 4 ++-- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c | 2 +- drivers/staging/lustre/lustre/osc/osc_io.c | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 109f44c18dd9..2f2f71c4c052 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2972,7 +2972,7 @@ kiblnd_start_schedulers(struct kib_sched_info *sched) } else { LASSERT(sched->ibs_nthreads <= sched->ibs_nthreads_max); /* increase one thread if there is new interface */ - nthrs = (sched->ibs_nthreads < sched->ibs_nthreads_max); + nthrs = sched->ibs_nthreads < sched->ibs_nthreads_max; } for (i = 0; i < nthrs; i++) { diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index f815bb81fb5e..7586b7e4040b 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -722,7 +722,7 @@ ksocknal_match_peerip(ksock_interface_t *iface, __u32 *ips, int nips) if (ips[i] == 0) continue; - this_xor = (ips[i] ^ iface->ksni_ipaddr); + this_xor = ips[i] ^ iface->ksni_ipaddr; this_netmatch = ((this_xor & iface->ksni_netmask) == 0) ? 1 : 0; if (!(best < 0 || @@ -809,7 +809,7 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips) continue; k = ksocknal_match_peerip(iface, peerips, n_peerips); - xor = (ip ^ peerips[k]); + xor = ip ^ peerips[k]; this_netmatch = ((xor & iface->ksni_netmask) == 0) ? 1 : 0; if (!(best_iface == NULL || diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 92760fe94184..fa7ad883bda9 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -1374,9 +1374,9 @@ ksocknal_sched_cansleep(ksock_sched_t *sched) spin_lock_bh(&sched->kss_lock); - rc = (!ksocknal_data.ksnd_shuttingdown && + rc = !ksocknal_data.ksnd_shuttingdown && list_empty(&sched->kss_rx_conns) && - list_empty(&sched->kss_tx_conns)); + list_empty(&sched->kss_tx_conns); spin_unlock_bh(&sched->kss_lock); return rc; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index e0a8157b4e84..08a91f5d91b1 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -152,7 +152,7 @@ void ldlm_handle_bl_callback(struct ldlm_namespace *ns, if (lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK) lock->l_flags |= LDLM_FL_CANCEL; - do_ast = (!lock->l_readers && !lock->l_writers); + do_ast = !lock->l_readers && !lock->l_writers; unlock_res_and_lock(lock); if (do_ast) { diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 53226b8fff63..4f713183145b 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -307,7 +307,7 @@ int ldlm_blocking_ast_nocheck(struct ldlm_lock *lock) int do_ast; lock->l_flags |= LDLM_FL_CBPENDING; - do_ast = (!lock->l_readers && !lock->l_writers); + do_ast = !lock->l_readers && !lock->l_writers; unlock_res_and_lock(lock); if (do_ast) { diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 54352368ac14..021c92fa0333 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -409,7 +409,7 @@ int libcfs_debug_init(unsigned long bufsize) if (max > cfs_trace_max_debug_mb() || max < num_possible_cpus()) { max = TCD_MAX_PAGES; } else { - max = (max / num_possible_cpus()); + max = max / num_possible_cpus(); max <<= (20 - PAGE_CACHE_SHIFT); } rc = cfs_tracefile_init(max); diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 0fd113d58da0..6dab3baa8063 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -161,7 +161,7 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp, op_data->op_lease_handle = och->och_lease_handle; op_data->op_attr.ia_valid |= ATTR_SIZE | ATTR_BLOCKS; } - epoch_close = (op_data->op_flags & MF_EPOCH_CLOSE); + epoch_close = op_data->op_flags & MF_EPOCH_CLOSE; rc = md_close(md_exp, op_data, och->och_mod, &req); if (rc == -EAGAIN) { /* This close must have the epoch closed. */ diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index cec9254e52fa..413a8408e3f5 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -348,7 +348,7 @@ static void loop_make_request(struct request_queue *q, struct bio *old_bio) old_bio->bi_iter.bi_size); spin_lock_irq(&lo->lo_lock); - inactive = (lo->lo_state != LLOOP_BOUND); + inactive = lo->lo_state != LLOOP_BOUND; spin_unlock_irq(&lo->lo_lock); if (inactive) goto err; diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 8884a439c351..991d20c5065d 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -750,7 +750,7 @@ int ll_readahead(const struct lu_env *env, struct cl_io *io, /* Note: we only trim the RPC, instead of extending the RPC * to the boundary, so to avoid reading too much pages during * random reading. */ - rpc_boundary = ((end + 1) & (~(PTLRPC_MAX_BRW_PAGES - 1))); + rpc_boundary = (end + 1) & (~(PTLRPC_MAX_BRW_PAGES - 1)); if (rpc_boundary > 0) rpc_boundary--; diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 219852a14cc6..b2ed52f20afb 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -1667,8 +1667,8 @@ static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, u64 fm_start, int i, j; if (fm_end - fm_start > lsm->lsm_stripe_size * lsm->lsm_stripe_count) { - last_stripe = (start_stripe < 1 ? lsm->lsm_stripe_count - 1 : - start_stripe - 1); + last_stripe = start_stripe < 1 ? lsm->lsm_stripe_count - 1 : + start_stripe - 1; *stripe_count = lsm->lsm_stripe_count; } else { for (j = 0, i = start_stripe; j < lsm->lsm_stripe_count; diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 6d440b465860..01858b0af01c 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -1221,7 +1221,7 @@ int class_connected_export(struct obd_export *exp) if (exp) { int connected; spin_lock(&exp->exp_lock); - connected = (exp->exp_conn_cnt > 0); + connected = exp->exp_conn_cnt > 0; spin_unlock(&exp->exp_lock); return connected; } diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index c86598d52d53..4b62d25764ad 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -206,7 +206,7 @@ static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, CERROR("Refusing to set max dirty pages to %u, which is more than 90%% of available RAM; setting to %lu\n", obd_max_dirty_pages, ((totalram_pages / 10) * 9)); - obd_max_dirty_pages = ((totalram_pages / 10) * 9); + obd_max_dirty_pages = (totalram_pages / 10) * 9; } else if (obd_max_dirty_pages < 4 << (20 - PAGE_CACHE_SHIFT)) { obd_max_dirty_pages = 4 << (20 - PAGE_CACHE_SHIFT); } diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index fad4c135f928..3c7300b0651d 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -417,7 +417,7 @@ static int osc_io_setattr_start(const struct lu_env *env, if (ia_valid & ATTR_SIZE) { attr->cat_size = attr->cat_kms = size; - cl_valid = (CAT_SIZE | CAT_KMS); + cl_valid = CAT_SIZE | CAT_KMS; } if (ia_valid & ATTR_MTIME_SET) { attr->cat_mtime = lvb->lvb_mtime; -- cgit v1.2.3 From 5a2ca43fa54f561c252c2ceb986daa49e258ab13 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Sat, 14 Mar 2015 01:03:10 +0530 Subject: Staging: lustre: Iterate list using list_for_each_entry Code using doubly linked list is iterated generally using list_empty and list_entry functions, but it can be better written using list_for_each_entry macro. This patch replaces the while loop containing list_empty and list_entry with list_for_each_entry and list_for_each_entry_safe. list_for_each_entry is a macro which is used to iterate over a list of given type. So while loop used to iterate over a list can be replaced with list_for_each_entry macro. However, if list_del is used in the loop, then list_for_each_entry_safe is a better choice. This transformation is done by using the following coccinelle script. @ rule1 @ expression E1; identifier I1, I2; type T; iterator name list_for_each_entry; @@ - while (list_empty(&E1) == 0) + list_for_each_entry (I1, &E1, I2) { ...when != T *I1; - I1 = list_entry(E1.next, T, I2); ...when != list_del(...); when != list_del_init(...); } @ rule2 @ expression E1; identifier I1, I2; type T; iterator name list_for_each_entry_safe; @@ T *I1; + T *tmp; ... - while (list_empty(&E1) == 0) + list_for_each_entry_safe (I1, tmp, &E1, I2) { ...when != T *I1; - I1 = list_entry(E1.next, T, I2); ... } Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 6 ++---- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 14 ++++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 2f2f71c4c052..1422d5668bf8 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -1893,13 +1893,11 @@ kiblnd_destroy_pmr_pool(kib_pool_t *pool) { kib_pmr_pool_t *ppo = container_of(pool, kib_pmr_pool_t, ppo_pool); kib_phys_mr_t *pmr; + kib_phys_mr_t *tmp; LASSERT(pool->po_allocated == 0); - while (!list_empty(&pool->po_free_list)) { - pmr = list_entry(pool->po_free_list.next, - kib_phys_mr_t, pmr_list); - + list_for_each_entry_safe(pmr, tmp, &pool->po_free_list, pmr_list) { LASSERT(pmr->pmr_mr == NULL); list_del(&pmr->pmr_list); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index c762dbe10693..2e156a995e55 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -1936,14 +1936,13 @@ kiblnd_handle_early_rxs(kib_conn_t *conn) { unsigned long flags; kib_rx_t *rx; + kib_rx_t *tmp; LASSERT(!in_interrupt()); LASSERT(conn->ibc_state >= IBLND_CONN_ESTABLISHED); write_lock_irqsave(&kiblnd_data.kib_global_lock, flags); - while (!list_empty(&conn->ibc_early_rxs)) { - rx = list_entry(conn->ibc_early_rxs.next, - kib_rx_t, rx_list); + list_for_each_entry_safe(rx, tmp, &conn->ibc_early_rxs, rx_list) { list_del(&rx->rx_list); write_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags); @@ -2074,6 +2073,7 @@ kiblnd_connreq_done(kib_conn_t *conn, int status) { kib_peer_t *peer = conn->ibc_peer; kib_tx_t *tx; + kib_tx_t *tmp; struct list_head txs; unsigned long flags; int active; @@ -2150,8 +2150,7 @@ kiblnd_connreq_done(kib_conn_t *conn, int status) /* Schedule blocked txs */ spin_lock(&conn->ibc_lock); - while (!list_empty(&txs)) { - tx = list_entry(txs.next, kib_tx_t, tx_list); + list_for_each_entry_safe(tx, tmp, &txs, tx_list) { list_del(&tx->tx_list); kiblnd_queue_tx_locked(tx, conn); @@ -3027,6 +3026,7 @@ kiblnd_check_conns(int idx) struct list_head *ptmp; kib_peer_t *peer; kib_conn_t *conn; + kib_conn_t *tmp; struct list_head *ctmp; unsigned long flags; @@ -3080,9 +3080,7 @@ kiblnd_check_conns(int idx) /* Handle timeout by closing the whole * connection. We can only be sure RDMA activity * has ceased once the QP has been modified. */ - while (!list_empty(&closes)) { - conn = list_entry(closes.next, - kib_conn_t, ibc_connd_list); + list_for_each_entry_safe(conn, tmp, &closes, ibc_connd_list) { list_del(&conn->ibc_connd_list); kiblnd_close_conn(conn, -ETIMEDOUT); kiblnd_conn_decref(conn); -- cgit v1.2.3 From ed0ed4ea7755559ee04aab8695cb91610f5e539a Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Wed, 11 Mar 2015 17:02:15 +0530 Subject: Staging: lustre: Use setup_timer to combine initialization The function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields. So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script. @@ expression E1, E2, E3; type T; @@ - init_timer(&E1); ... ( - E1.function = E2; ... - E1.data = (T)E3; + setup_timer(&E1, E2, (T)E3); | - E1.data = (T)E3; ... - E1.function = E2; + setup_timer(&E1, E2, (T)E3); | - E1.function = E2; + setup_timer(&E1, E2, 0); ) Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/super25.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index 7c1e02a031ba..a494f6271fa0 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c @@ -152,9 +152,7 @@ static int __init init_lustre_lite(void) do_gettimeofday(&tv); cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]); - - init_timer(&ll_capa_timer); - ll_capa_timer.function = ll_capa_timer_callback; + setup_timer(&ll_capa_timer, ll_capa_timer_callback, 0); rc = ll_capa_thread_start(); if (rc != 0) goto out_proc; -- cgit v1.2.3 From 717842fee57b5f1a51d967615aa751625174fc3f Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Tue, 10 Mar 2015 17:56:12 +0530 Subject: Staging: lustre: Remove space to improve code style. Remove space to improve code style and follow kernel conventions. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/dcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 3078dd93dc28..fe1fd05423e9 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -128,7 +128,7 @@ static int find_cbdata(struct inode *inode) rc = md_find_cbdata(sbi->ll_md_exp, ll_inode2fid(inode), return_if_equal, NULL); if (rc != 0) - return rc; + return rc; lsm = ccc_inode_lsm_get(inode); if (lsm == NULL) -- cgit v1.2.3 From 975da35f0f6e33d9a86e5d3ee3c89cb5942d872a Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 18:53:54 +0200 Subject: staging: fwserial: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., -( e -) ,...); Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fwserial/fwserial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index 73deae3cd9eb..fdb2418c5f88 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -1186,7 +1186,7 @@ static void fwtty_unthrottle(struct tty_struct *tty) { struct fwtty_port *port = tty->driver_data; - fwtty_dbg(port, "CRTSCTS: %d\n", (C_CRTSCTS(tty) != 0)); + fwtty_dbg(port, "CRTSCTS: %d\n", C_CRTSCTS(tty) != 0); fwtty_profile_fifo(port, port->stats.unthrottle); -- cgit v1.2.3 From bb3a4dc3af68b92ad5d5cc0020268daae554db93 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 18:54:51 +0200 Subject: staging: media: lirc: lirc_imon.c: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., & -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_imon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 2e883e9457db..335b98a54237 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -337,11 +337,11 @@ static int send_packet(struct imon_context *context) context->tx_urb->actual_length = 0; init_completion(&context->tx.finished); - atomic_set(&(context->tx.busy), 1); + atomic_set(&context->tx.busy, 1); retval = usb_submit_urb(context->tx_urb, GFP_KERNEL); if (retval) { - atomic_set(&(context->tx.busy), 0); + atomic_set(&context->tx.busy, 0); dev_err(&context->usbdev->dev, "error submitting urb(%d)\n", retval); } else { -- cgit v1.2.3 From 505942151da6310df05213413d4ebd10bd5fd450 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 18:55:27 +0200 Subject: staging: media: lirc: remove unnecessary cast on function argument Removes pointer to pointer cast on a function argument. Issue detected and resolved using the following coccinelle script: @@ expression e; type t; identifier f; @@ f(..., -(t *) e ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_parallel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_parallel.c b/drivers/staging/media/lirc/lirc_parallel.c index 19c5c21babf5..df556442d9a6 100644 --- a/drivers/staging/media/lirc/lirc_parallel.c +++ b/drivers/staging/media/lirc/lirc_parallel.c @@ -336,7 +336,7 @@ static ssize_t lirc_read(struct file *filep, char __user *buf, size_t n, set_current_state(TASK_INTERRUPTIBLE); while (count < n) { if (rptr != wptr) { - if (copy_to_user(buf+count, (char *) &rbuf[rptr], + if (copy_to_user(buf+count, &rbuf[rptr], sizeof(int))) { result = -EFAULT; break; -- cgit v1.2.3 From 028b242d1b91e95869a084c43ce3497203f84e5c Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 18:56:37 +0200 Subject: staging: media: lirc: fix multiple issues with function arguments Handles the following issues: Removing extra parentheses around function arguments, Removing unnecessary pointer to pointer casts. Issues detected and resolved using the following coccinelle script: @@ expression e; type t; identifier f; @@ f(..., -(t *) e ,...) @@ expression e; identifier f; @@ f(..., & -( e -) ,...) @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_sasem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index 9944af1ba4d3..b9c53e2d5d29 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -331,11 +331,11 @@ static int send_packet(struct sasem_context *context) context->tx_urb->actual_length = 0; init_completion(&context->tx.finished); - atomic_set(&(context->tx.busy), 1); + atomic_set(&context->tx.busy, 1); retval = usb_submit_urb(context->tx_urb, GFP_KERNEL); if (retval) { - atomic_set(&(context->tx.busy), 0); + atomic_set(&context->tx.busy, 0); dev_err(&context->dev->dev, "error submitting urb (%d)\n", retval); } else { @@ -387,7 +387,7 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, goto exit; } - data_buf = memdup_user((void const __user *)buf, n_bytes); + data_buf = memdup_user(buf, n_bytes); if (IS_ERR(data_buf)) { retval = PTR_ERR(data_buf); data_buf = NULL; -- cgit v1.2.3 From 805184c451cdb225ffbdf83ba010160d74b3a471 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 18:57:25 +0200 Subject: staging: media: lirc: remove pointer to pointer cast on function arguments Removes pointer to pointer cast on function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; type t; identifier f; @@ f(..., -(t *) e ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 9f55a83d5ab2..56df8d751765 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -784,7 +784,7 @@ static int lirc_serial_probe(struct platform_device *dev) result = devm_request_irq(&dev->dev, irq, lirc_irq_handler, (share_irq ? IRQF_SHARED : 0), - LIRC_DRIVER_NAME, (void *)&hardware); + LIRC_DRIVER_NAME, &hardware); if (result < 0) { if (result == -EBUSY) dev_err(&dev->dev, "IRQ %d busy\n", irq); -- cgit v1.2.3 From a511536f4b8815308d178740902826de9c628f59 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 18:58:00 +0200 Subject: staging: mt29f_spinand: remove pointer to pointer cast in function argument Removes unnecessary pointer to pointer cast on function arguments. It is worth noting that buf is already a u8 pointer. Issue detected and resolved using the following coccinelle script: @@ expression e; type t; identifier f; @@ f(..., -(t *) e ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt29f_spinand/mt29f_spinand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c index 3b191fce45ec..7285c64bac24 100644 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c @@ -770,7 +770,7 @@ static void spinand_cmdfunc(struct mtd_info *mtd, unsigned int command, break; case NAND_CMD_READID: state->buf_ptr = 0; - spinand_read_id(info->spi, (u8 *)state->buf); + spinand_read_id(info->spi, state->buf); break; case NAND_CMD_PARAM: state->buf_ptr = 0; -- cgit v1.2.3 From 08a02cb8834d8a09502358b08929897e3ffb6abf Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:00:53 +0200 Subject: staging: ft1000: adjust function arguments Handles the following issues: Removing extra parentheses around function arguments, Removing unnecessary pointer to pointer cast. Issues detected and resolved using the following coccinelle script: @@ expression e; type t; identifier f; @@ f(..., -(t *) e ,...) @@ expression e; identifier f; @@ f(..., & -( e -) ,...) @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c index 06b0e9cfb9b1..cbf59abd1825 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c @@ -713,10 +713,10 @@ int card_download(struct net_device *dev, const u8 *pFileStart, /* Get buffer for provisioning data */ pbuffer = - kmalloc((usHdrLength + sizeof(struct pseudo_hdr)), + kmalloc(usHdrLength + sizeof(struct pseudo_hdr), GFP_ATOMIC); if (pbuffer) { - memcpy(pbuffer, (void *)pUcFile, + memcpy(pbuffer, pUcFile, (u32) (usHdrLength + sizeof(struct pseudo_hdr))); /* link provisioning data */ -- cgit v1.2.3 From 562b11b3a9304cfd55fa06f932f45879018c9792 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:01:41 +0200 Subject: staging: ft1000: ft1000-pcmcia: adjust function arguments Handles the following issues: Removing extra parentheses around function arguments, Removing unnecessary pointer to potinter cast. Issues were detected using the following coccinelle script: @@ expression e; type t; identifier f; @@ f(..., -(t *) e ,...) @@ expression e; identifier f; @@ f(..., & -( e -) ,...) @@ expression e; identifier f; @@ f(..., -( e -) ,...) Parentheses removal were left to the script. However, handling pointer casts were done manually because not all replacements generated by the script were suitable. In general, the following cases were discarded: pointer casts in macros, pointer casts on function arguments in the form of: (...,( *)&,...) since both cases generated compilation warnings. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index bc959ff9a942..e4559caed02b 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -327,7 +327,7 @@ static void ft1000_reset_asic(struct net_device *dev) */ if (info->AsicID == MAGNEMITE_ID) { ft1000_write_reg(dev, FT1000_REG_RESET, - (DSP_RESET_BIT | ASIC_RESET_BIT)); + DSP_RESET_BIT | ASIC_RESET_BIT); } mdelay(1); if (info->AsicID == ELECTRABUZZ_ID) { @@ -387,7 +387,7 @@ static int ft1000_reset_card(struct net_device *dev) } else { pr_debug("resetting ASIC and DSP\n"); ft1000_write_reg(dev, FT1000_REG_RESET, - (DSP_RESET_BIT | ASIC_RESET_BIT)); + DSP_RESET_BIT | ASIC_RESET_BIT); } /* Copy DSP session record into info block if this is not a coldstart */ @@ -1127,7 +1127,9 @@ static void ft1000_proc_drvmsg(struct net_device *dev) info->DSPInfoBlk[8] = 0x7200; info->DSPInfoBlk[9] = htons(info->DSPInfoBlklen); - ft1000_send_cmd(dev, (u16 *)info->DSPInfoBlk, (u16)(info->DSPInfoBlklen+4), 0); + ft1000_send_cmd(dev, info->DSPInfoBlk, + (u16)(info->DSPInfoBlklen+4), + 0); } break; -- cgit v1.2.3 From cb53b00de93d4a165b31781e9d4598415e3c07a4 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:02:29 +0200 Subject: staging: ft1000: ft1000-usb: adjust function arguments Handles the following issues: Removing extra parentheses around function arguments, Removing unnecessary pointer to pointer cast. Issues were detected using the following coccinelle script: @@ expression e; type t; identifier f; @@ f(..., -(t *) e ,...) @@ expression e; identifier f; @@ f(..., & -( e -) ,...) @@ expression e; identifier f; @@ f(..., -( e -) ,...) Parentheses removal were left to the script. However, handling pointer casts were done manually because not all replacements generated by the script were suitable. In general, the following cases were discarded: pointer casts in macros, pointer casts on function arguments in the form of: (...,( *)&,...) since both cases generated compilation warnings. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index 0f776d0bf0e4..71385231d72c 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -190,7 +190,7 @@ int ft1000_create_dev(struct ft1000_usb *dev) tmp->dent = dir; tmp->file = file; tmp->int_number = dev->CardNumber; - list_add(&(tmp->list), &(dev->nodes.list)); + list_add(&tmp->list, &dev->nodes.list); pr_debug("registered debugfs directory \"%s\"\n", dev->DeviceName); @@ -477,14 +477,14 @@ static long ft1000_ioctl(struct file *file, unsigned int command, /* Connect Message */ pr_debug("IOCTL_FT1000_CONNECT\n"); ConnectionMsg[79] = 0xfc; - result = card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); + result = card_send_command(ft1000dev, ConnectionMsg, 0x4c); break; case IOCTL_DISCONNECT: /* Disconnect Message */ pr_debug("IOCTL_FT1000_DISCONNECT\n"); ConnectionMsg[79] = 0xfd; - result = card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); + result = card_send_command(ft1000dev, ConnectionMsg, 0x4c); break; case IOCTL_GET_DSP_STAT_CMD: /* pr_debug("IOCTL_FT1000_GET_DSP_STAT\n"); */ @@ -642,7 +642,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, } pmsg++; ppseudo_hdr = (struct pseudo_hdr *)pmsg; - result = card_send_command(ft1000dev, (unsigned short *)dpram_data, total_len+2); + result = card_send_command(ft1000dev, dpram_data, total_len+2); ft1000dev->app_info[app_index].nTxMsg++; -- cgit v1.2.3 From 6e2fef9d3260e169c17fc5eea842ff4c64c23e5c Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:03:18 +0200 Subject: staging: ft1000: ft1000-usb: ft1000_download.c: adjust function arguments Handles the following issues: Removing extra parentheses around function arguments, Removing unnecessary pointer to pointer cast. Issues were detected using the following coccinelle script: @@ expression e; type t; identifier f; @@ f(..., -(t *) e ,...) @@ expression e; identifier f; @@ f(..., & -( e -) ,...) @@ expression e; identifier f; @@ f(..., -( e -) ,...) Parentheses removal were left to the script. However, handling pointer casts were done manually because not all replacements generated by the script were suitable. In general, the following cases were discarded: pointer casts in macros, pointer casts on function arguments in the form of: (...,( *)&,...) since both cases generated compilation warnings. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_download.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index e8126325877b..800450ff5222 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c @@ -230,7 +230,7 @@ static u16 get_handshake_usb(struct ft1000_usb *ft1000dev, u16 expected_value) while (loopcnt < 100) { if (ft1000dev->usbboot == 2) { status = ft1000_read_dpram32(ft1000dev, 0, - (u8 *)&(ft1000dev->tempbuf[0]), 64); + (u8 *)&ft1000dev->tempbuf[0], 64); for (temp = 0; temp < 16; temp++) { pr_debug("tempbuf %d = 0x%x\n", temp, ft1000dev->tempbuf[temp]); @@ -538,7 +538,7 @@ static int write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile, usb_sndbulkpipe(ft1000dev->dev, ft1000dev->bulk_out_endpointAddr), ft1000dev->tx_buf, byte_length, usb_dnld_complete, - (void *)ft1000dev); + ft1000dev); usb_submit_urb(ft1000dev->tx_urb, GFP_ATOMIC); @@ -704,7 +704,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, case REQUEST_CODE_SEGMENT: status = request_code_segment(ft1000dev, &s_file, &c_file, - (const u8 *)boot_end, + boot_end, true); break; default: @@ -799,7 +799,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, status = request_code_segment(ft1000dev, &s_file, &c_file, - (const u8 *)code_end, + code_end, false); break; @@ -971,11 +971,11 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, /* Get buffer for provisioning data */ pbuffer = - kmalloc((pseudo_header_len + - sizeof(struct pseudo_hdr)), + kmalloc(pseudo_header_len + + sizeof(struct pseudo_hdr), GFP_ATOMIC); if (pbuffer) { - memcpy(pbuffer, (void *)c_file, + memcpy(pbuffer, c_file, (u32) (pseudo_header_len + sizeof(struct pseudo_hdr))); -- cgit v1.2.3 From 2f4a748f59924118129306d0e89af7a35b77365e Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:04:09 +0200 Subject: staging: ft1000: ft1000-usb: ft1000_hw.c: adjust function arguments Handles the following issues: Removing extra parentheses around function arguments, Removing unnecessary pointer to pointer casts. Issues were detected using the following coccinelle script: @@ expression e; type t; identifier f; @@ f(..., -(t *) e ,...) @@ expression e; identifier f; @@ f(..., & -( e -) ,...) @@ expression e; identifier f; @@ f(..., -( e -) ,...) Parentheses removal were left to the script. However, there were some cases that were handled manually. In addition, handling pointer casts were done manually too because not all replacements generated by the script were suitable. When pointer casts on function arguments were in the form: (...,( *)&,...) the replacements were discarded due to compilation warnings. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index f0ac43838461..26207781abcb 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -339,7 +339,7 @@ int card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, commandbuf = kmalloc(size + 2, GFP_KERNEL); if (!commandbuf) return -ENOMEM; - memcpy((void *)commandbuf + 2, (void *)ptempbuffer, size); + memcpy((void *)commandbuf + 2, ptempbuffer, size); if (temp & 0x0100) usleep_range(900, 1100); @@ -429,7 +429,7 @@ static void ft1000_reset_asic(struct net_device *dev) /* Let's use the register provided by the Magnemite ASIC to reset the * ASIC and DSP. */ - ft1000_write_register(ft1000dev, (DSP_RESET_BIT | ASIC_RESET_BIT), + ft1000_write_register(ft1000dev, DSP_RESET_BIT | ASIC_RESET_BIT, FT1000_REG_RESET); mdelay(1); @@ -542,7 +542,7 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 *packet, u16 len) hdr.portdest ^ hdr.portsrc ^ hdr.sh_str_id ^ hdr.control; memcpy(&pFt1000Dev->tx_buf[0], &hdr, sizeof(hdr)); - memcpy(&(pFt1000Dev->tx_buf[sizeof(struct pseudo_hdr)]), packet, len); + memcpy(&pFt1000Dev->tx_buf[sizeof(struct pseudo_hdr)], packet, len); netif_stop_queue(netdev); @@ -551,7 +551,7 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 *packet, u16 len) usb_sndbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_out_endpointAddr), pFt1000Dev->tx_buf, count, - ft1000_usb_transmit_complete, (void *)pFt1000Dev); + ft1000_usb_transmit_complete, pFt1000Dev); t = (u8 *)pFt1000Dev->tx_urb->transfer_buffer; @@ -606,7 +606,7 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) goto err; } - ft1000_copy_down_pkt(dev, (pdata + ENET_HEADER_SIZE - 2), + ft1000_copy_down_pkt(dev, pdata + ENET_HEADER_SIZE - 2, skb->len - ENET_HEADER_SIZE + 2); err: @@ -1558,19 +1558,19 @@ int ft1000_poll(void *dev_id) /* Reset ASIC and DSP */ status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, - (u8 *)&(info->DSP_TIME[0]), + (u8 *)&info->DSP_TIME[0], FT1000_MAG_DSP_TIMER0_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1, - (u8 *)&(info->DSP_TIME[1]), + (u8 *)&info->DSP_TIME[1], FT1000_MAG_DSP_TIMER1_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2, - (u8 *)&(info->DSP_TIME[2]), + (u8 *)&info->DSP_TIME[2], FT1000_MAG_DSP_TIMER2_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, - (u8 *)&(info->DSP_TIME[3]), + (u8 *)&info->DSP_TIME[3], FT1000_MAG_DSP_TIMER3_INDX); info->CardReady = 0; info->DrvErrNum = DSP_CONDRESET_INFO; -- cgit v1.2.3 From 6b38452785f3aef3f293389451d260bdc85c7955 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:04:35 +0200 Subject: staging: fbtft: fb_agm1264k-fl.c: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c index 7aa9e8c0763d..578fdbe352d1 100644 --- a/drivers/staging/fbtft/fb_agm1264k-fl.c +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c @@ -390,7 +390,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) /* select right side (sc1) * set addr */ - write_reg(par, 0x01, (1 << 6)); + write_reg(par, 0x01, 1 << 6); write_reg(par, 0x01, (0x17 << 3) | (u8)y); /* write bitmap */ -- cgit v1.2.3 From 721bc827d4a9a45cf9da04445d6897957c9caa06 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:05:27 +0200 Subject: staging: fbtft: fb_hx8340bn.c: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_hx8340bn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_hx8340bn.c b/drivers/staging/fbtft/fb_hx8340bn.c index 26a987a68b07..072b7551d534 100644 --- a/drivers/staging/fbtft/fb_hx8340bn.c +++ b/drivers/staging/fbtft/fb_hx8340bn.c @@ -129,7 +129,7 @@ static int set_var(struct fbtft_par *par) #define MV (1 << 5) switch (par->info->var.rotate) { case 0: - write_reg(par, 0x36, (par->bgr << 3)); + write_reg(par, 0x36, par->bgr << 3); break; case 270: write_reg(par, 0x36, MX | MV | (par->bgr << 3)); -- cgit v1.2.3 From 53ce1c05cc116116a9a8ca821136767f18b9b27b Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:05:52 +0200 Subject: staging: fbtft: fb_hx8353d.c: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_hx8353d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_hx8353d.c b/drivers/staging/fbtft/fb_hx8353d.c index c9512dc5f4d3..ca52465715d2 100644 --- a/drivers/staging/fbtft/fb_hx8353d.c +++ b/drivers/staging/fbtft/fb_hx8353d.c @@ -112,7 +112,7 @@ static int set_var(struct fbtft_par *par) write_reg(par, 0x36, my | mv | (par->bgr << 3)); break; case 180: - write_reg(par, 0x36, (par->bgr << 3)); + write_reg(par, 0x36, par->bgr << 3); break; case 90: write_reg(par, 0x36, mx | mv | (par->bgr << 3)); -- cgit v1.2.3 From 6e686d777df8ef8f01a61c98cc94667054778c10 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:06:24 +0200 Subject: staging: fbtft: fb_s6d02a1.c: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_s6d02a1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_s6d02a1.c b/drivers/staging/fbtft/fb_s6d02a1.c index e412a42443e5..c87aa253064d 100644 --- a/drivers/staging/fbtft/fb_s6d02a1.c +++ b/drivers/staging/fbtft/fb_s6d02a1.c @@ -136,7 +136,7 @@ static int set_var(struct fbtft_par *par) write_reg(par, 0x36, MY | MV | (par->bgr << 3)); break; case 180: - write_reg(par, 0x36, (par->bgr << 3)); + write_reg(par, 0x36, par->bgr << 3); break; case 90: write_reg(par, 0x36, MX | MV | (par->bgr << 3)); -- cgit v1.2.3 From 0401b42d8bf8c929c77bd9e77615284d154a3174 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:07:01 +0200 Subject: staging: fbtft: fb_st7735r.c: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_st7735r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_st7735r.c b/drivers/staging/fbtft/fb_st7735r.c index 078f502884bd..eb3af1d712d0 100644 --- a/drivers/staging/fbtft/fb_st7735r.c +++ b/drivers/staging/fbtft/fb_st7735r.c @@ -130,7 +130,7 @@ static int set_var(struct fbtft_par *par) write_reg(par, 0x36, MY | MV | (par->bgr << 3)); break; case 180: - write_reg(par, 0x36, (par->bgr << 3)); + write_reg(par, 0x36, par->bgr << 3); break; case 90: write_reg(par, 0x36, MX | MV | (par->bgr << 3)); -- cgit v1.2.3 From 248d828514bf7016d13f11b7b82f26b6949718c5 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:08:15 +0200 Subject: staging: fbtft: fbtft-io.c: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c index e19b814c3327..a6f091fb975c 100644 --- a/drivers/staging/fbtft/fbtft-io.c +++ b/drivers/staging/fbtft/fbtft-io.c @@ -154,14 +154,14 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) for (i = 0; i < 8; i++) { if ((data & 1) != (prev_data & 1)) gpio_set_value(par->gpio.db[i], - (data & 1)); + data & 1); data >>= 1; prev_data >>= 1; } } #else for (i = 0; i < 8; i++) { - gpio_set_value(par->gpio.db[i], (data & 1)); + gpio_set_value(par->gpio.db[i], data & 1); data >>= 1; } #endif @@ -204,14 +204,14 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len) for (i = 0; i < 16; i++) { if ((data & 1) != (prev_data & 1)) gpio_set_value(par->gpio.db[i], - (data & 1)); + data & 1); data >>= 1; prev_data >>= 1; } } #else for (i = 0; i < 16; i++) { - gpio_set_value(par->gpio.db[i], (data & 1)); + gpio_set_value(par->gpio.db[i], data & 1); data >>= 1; } #endif -- cgit v1.2.3 From b30367c0866c1b669f266f1a13f17de7b0b8c120 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:08:40 +0200 Subject: staging: fbtft: fbtft_device.c: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index dc48bcc9510e..1afeebb95c54 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1126,14 +1126,14 @@ static int write_gpio16_wr_slow(struct fbtft_par *par, void *buf, size_t len) for (i = 0; i < 16; i++) { if ((data & 1) != (prev_data & 1)) gpio_set_value(par->gpio.db[i], - (data & 1)); + data & 1); data >>= 1; prev_data >>= 1; } } #else for (i = 0; i < 16; i++) { - gpio_set_value(par->gpio.db[i], (data & 1)); + gpio_set_value(par->gpio.db[i], data & 1); data >>= 1; } #endif -- cgit v1.2.3 From d7d3e898581dce3b87af46b200592fcded82e2cf Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 10 Mar 2015 19:09:10 +0200 Subject: staging: goldfish: remove extra parentheses around function arguments Removes extra parentheses around function arguments. Issue detected and resolved using the following coccinelle script: @@ expression e; identifier f; @@ f(..., -( e -) ,...) Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/goldfish/goldfish_audio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/goldfish/goldfish_audio.c b/drivers/staging/goldfish/goldfish_audio.c index f200359c4443..c7f8f1c77401 100644 --- a/drivers/staging/goldfish/goldfish_audio.c +++ b/drivers/staging/goldfish/goldfish_audio.c @@ -125,8 +125,8 @@ static ssize_t goldfish_audio_read(struct file *fp, char __user *buf, length = (count > READ_BUFFER_SIZE ? READ_BUFFER_SIZE : count); AUDIO_WRITE(data, AUDIO_START_READ, length); - wait_event_interruptible(data->wait, (data->buffer_status & - AUDIO_INT_READ_BUFFER_FULL)); + wait_event_interruptible(data->wait, data->buffer_status & + AUDIO_INT_READ_BUFFER_FULL); length = AUDIO_READ(data, AUDIO_READ_BUFFER_AVAILABLE); @@ -154,9 +154,9 @@ static ssize_t goldfish_audio_write(struct file *fp, const char __user *buf, if (copy > WRITE_BUFFER_SIZE) copy = WRITE_BUFFER_SIZE; - wait_event_interruptible(data->wait, (data->buffer_status & + wait_event_interruptible(data->wait, data->buffer_status & (AUDIO_INT_WRITE_BUFFER_1_EMPTY | - AUDIO_INT_WRITE_BUFFER_2_EMPTY))); + AUDIO_INT_WRITE_BUFFER_2_EMPTY)); if ((data->buffer_status & AUDIO_INT_WRITE_BUFFER_1_EMPTY) != 0) kbuf = data->write_buffer1; -- cgit v1.2.3 From d6b0d6de1d2821dc0dd44b33fbe2b41e5ecac430 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Wed, 11 Mar 2015 04:35:04 +0200 Subject: staging: sm750: Fix switch-case indentation Remove switch cases indentation in order to follow the Linux coding style. Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 158 ++++++++++++++++++++-------------------- 1 file changed, 79 insertions(+), 79 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index aa0888c232b9..23d67b3e5e2f 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -334,41 +334,41 @@ static int lynxfb_ops_set_par(struct fb_info * info) * */ switch(var->bits_per_pixel){ - case 8: - fix->visual = FB_VISUAL_PSEUDOCOLOR; - var->red.offset = 0; - var->red.length = 8; - var->green.offset = 0; - var->green.length = 8; - var->blue.offset = 0; - var->blue.length = 8; - var->transp.length = 0; - var->transp.offset = 0; - break; - case 16: - var->red.offset = 11; - var->red.length = 5; - var->green.offset = 5; - var->green.length = 6; - var->blue.offset = 0; - var->blue.length = 5; - var->transp.length = 0; - var->transp.offset = 0; - fix->visual = FB_VISUAL_TRUECOLOR; - break; - case 24: - case 32: - var->red.offset = 16; - var->red.length = 8; - var->green.offset = 8; - var->green.length = 8; - var->blue.offset = 0 ; - var->blue.length = 8; - fix->visual = FB_VISUAL_TRUECOLOR; - break; - default: - ret = -EINVAL; - break; + case 8: + fix->visual = FB_VISUAL_PSEUDOCOLOR; + var->red.offset = 0; + var->red.length = 8; + var->green.offset = 0; + var->green.length = 8; + var->blue.offset = 0; + var->blue.length = 8; + var->transp.length = 0; + var->transp.offset = 0; + break; + case 16: + var->red.offset = 11; + var->red.length = 5; + var->green.offset = 5; + var->green.length = 6; + var->blue.offset = 0; + var->blue.length = 5; + var->transp.length = 0; + var->transp.offset = 0; + fix->visual = FB_VISUAL_TRUECOLOR; + break; + case 24: + case 32: + var->red.offset = 16; + var->red.length = 8; + var->green.offset = 8; + var->green.length = 8; + var->blue.offset = 0 ; + var->blue.length = 8; + fix->visual = FB_VISUAL_TRUECOLOR; + break; + default: + ret = -EINVAL; + break; } var->height = var->width = -1; var->accel_flags = 0;/*FB_ACCELF_TEXT;*/ @@ -533,53 +533,53 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* in switch(var->bits_per_pixel){ - case 8: - case 16: - case 24: /* support 24 bpp for only lynx712/722/720 */ - case 32: - break; - default: - pr_err("bpp %d not supported\n",var->bits_per_pixel); - ret = -EINVAL; - goto exit; + case 8: + case 16: + case 24: /* support 24 bpp for only lynx712/722/720 */ + case 32: + break; + default: + pr_err("bpp %d not supported\n",var->bits_per_pixel); + ret = -EINVAL; + goto exit; } switch(var->bits_per_pixel){ - case 8: - info->fix.visual = FB_VISUAL_PSEUDOCOLOR; - var->red.offset = 0; - var->red.length = 8; - var->green.offset = 0; - var->green.length = 8; - var->blue.offset = 0; - var->blue.length = 8; - var->transp.length = 0; - var->transp.offset = 0; - break; - case 16: - var->red.offset = 11; - var->red.length = 5; - var->green.offset = 5; - var->green.length = 6; - var->blue.offset = 0; - var->blue.length = 5; - var->transp.length = 0; - var->transp.offset = 0; - info->fix.visual = FB_VISUAL_TRUECOLOR; - break; - case 24: - case 32: - var->red.offset = 16; - var->red.length = 8; - var->green.offset = 8; - var->green.length = 8; - var->blue.offset = 0 ; - var->blue.length = 8; - info->fix.visual = FB_VISUAL_TRUECOLOR; - break; - default: - ret = -EINVAL; - break; + case 8: + info->fix.visual = FB_VISUAL_PSEUDOCOLOR; + var->red.offset = 0; + var->red.length = 8; + var->green.offset = 0; + var->green.length = 8; + var->blue.offset = 0; + var->blue.length = 8; + var->transp.length = 0; + var->transp.offset = 0; + break; + case 16: + var->red.offset = 11; + var->red.length = 5; + var->green.offset = 5; + var->green.length = 6; + var->blue.offset = 0; + var->blue.length = 5; + var->transp.length = 0; + var->transp.offset = 0; + info->fix.visual = FB_VISUAL_TRUECOLOR; + break; + case 24: + case 32: + var->red.offset = 16; + var->red.length = 8; + var->green.offset = 8; + var->green.length = 8; + var->blue.offset = 0 ; + var->blue.length = 8; + info->fix.visual = FB_VISUAL_TRUECOLOR; + break; + default: + ret = -EINVAL; + break; } var->height = var->width = -1; var->accel_flags = 0;/*FB_ACCELF_TEXT;*/ -- cgit v1.2.3 From 6fa7db83e4f9ef5cd820b7c8aba06cd068035641 Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Thu, 12 Mar 2015 01:11:00 +0900 Subject: staging: sm750fb: Add void to function definition with no arguments Found by checkpatch.pl - ERROR: Bad function definition A function with no arguments allows for variadic arguments. Add void in between the empty parentheses to indicate that the function takes no arguments. changes made using coccinelle script: @@ type T; identifier f; @@ T f( +void ) { ... } Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 6 +++--- drivers/staging/sm750fb/ddk750_display.c | 2 +- drivers/staging/sm750fb/ddk750_dvi.c | 4 ++-- drivers/staging/sm750fb/ddk750_power.c | 2 +- drivers/staging/sm750fb/ddk750_sii164.c | 14 +++++++------- drivers/staging/sm750fb/sm750_hw.c | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index b71169ed063c..3c772073ebe8 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -11,7 +11,7 @@ typedef struct _pllcalparam{ pllcalparam; -logical_chip_type_t getChipType() +logical_chip_type_t getChipType(void) { unsigned short physicalID; char physicalRev; @@ -91,7 +91,7 @@ unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL) } -unsigned int getChipClock() +unsigned int getChipClock(void) { pll_value_t pll; #if 1 @@ -232,7 +232,7 @@ void setMasterClock(unsigned int frequency) } -unsigned int ddk750_getVMSize() +unsigned int ddk750_getVMSize(void) { unsigned int reg; unsigned int data; diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index a282a9492cc0..c84196ac055d 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -273,7 +273,7 @@ void ddk750_setLogicalDispOut(disp_output_t output) } -int ddk750_initDVIDisp() +int ddk750_initDVIDisp(void) { /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are not zeroed, then set the failure flag. If it is zeroe, it might mean diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index 1c083e7dc710..f5932bbf13e8 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -62,7 +62,7 @@ int dviInit( * Output: * Vendor ID */ -unsigned short dviGetVendorID() +unsigned short dviGetVendorID(void) { dvi_ctrl_device_t *pCurrentDviCtrl; @@ -82,7 +82,7 @@ unsigned short dviGetVendorID() * Output: * Device ID */ -unsigned short dviGetDeviceID() +unsigned short dviGetDeviceID(void) { dvi_ctrl_device_t *pCurrentDviCtrl; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 98dfcbde1eb6..cbb97676b33c 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -15,7 +15,7 @@ void ddk750_setDPMS(DPMS_t state) } } -unsigned int getPowerMode() +unsigned int getPowerMode(void) { if(getChipType() == SM750LE) return 0; diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index faf825093e7f..3d224d6a74ff 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -34,7 +34,7 @@ static char *gDviCtrlChipName = "Silicon Image SiI 164"; * Output: * Vendor ID */ -unsigned short sii164GetVendorID() +unsigned short sii164GetVendorID(void) { unsigned short vendorID; @@ -51,7 +51,7 @@ unsigned short sii164GetVendorID() * Output: * Device ID */ -unsigned short sii164GetDeviceID() +unsigned short sii164GetDeviceID(void) { unsigned short deviceID; @@ -264,7 +264,7 @@ long sii164InitChip( * sii164ResetChip * This function resets the DVI Controller Chip. */ -void sii164ResetChip() +void sii164ResetChip(void) { /* Power down */ sii164SetPower(0); @@ -277,7 +277,7 @@ void sii164ResetChip() * This function returns a char string name of the current DVI Controller chip. * It's convenient for application need to display the chip name. */ -char *sii164GetChipString() +char *sii164GetChipString(void) { return gDviCtrlChipName; } @@ -375,7 +375,7 @@ void sii164EnableHotPlugDetection( * 0 - Not Connected * 1 - Connected */ -unsigned char sii164IsConnected() +unsigned char sii164IsConnected(void) { unsigned char hotPlugValue; @@ -394,7 +394,7 @@ unsigned char sii164IsConnected() * 0 - No interrupt * 1 - Interrupt occurs */ -unsigned char sii164CheckInterrupt() +unsigned char sii164CheckInterrupt(void) { unsigned char detectReg; @@ -409,7 +409,7 @@ unsigned char sii164CheckInterrupt() * sii164ClearInterrupt * Clear the hot plug interrupt. */ -void sii164ClearInterrupt() +void sii164ClearInterrupt(void) { unsigned char detectReg; diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index c44a50b0c489..3050847fa1c6 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -581,7 +581,7 @@ void hw_sm750_initAccel(struct lynx_share * share) share->accel.de_init(&share->accel); } -int hw_sm750le_deWait() +int hw_sm750le_deWait(void) { int i=0x10000000; while(i--){ @@ -598,7 +598,7 @@ int hw_sm750le_deWait() } -int hw_sm750_deWait() +int hw_sm750_deWait(void) { int i=0x10000000; while(i--){ -- cgit v1.2.3 From b30edfcd04b5ffdb6b36a5b36a37d911222b9d37 Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Thu, 12 Mar 2015 13:26:21 +0900 Subject: staging: sm750fb: remove intialization of static ints static ints are initialized to 0 by the compiler. Explicit initialization is not necessary. Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL changes made using coccinelle script: @@ type T; identifier var; @@ static T var - =0 ; Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 23d67b3e5e2f..a7b1b9c50239 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -46,14 +46,14 @@ typedef int (*PROC_SPEC_INITHW)(struct lynx_share*,struct pci_dev*); /* common var for all device */ static int g_hwcursor = 1; -static int g_noaccel = 0; +static int g_noaccel; #ifdef CONFIG_MTRR -static int g_nomtrr = 0; +static int g_nomtrr; #endif static const char * g_fbmode[] = {NULL,NULL}; static const char * g_def_fbmode = "800x600-16@60"; static char * g_settings = NULL; -static int g_dualview = 0; +static int g_dualview; static char * g_option = NULL; /* if not use spin_lock,system will die if user load driver -- cgit v1.2.3 From d2a6037738be69a51e6cbd09d348c949f0936fcd Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Thu, 12 Mar 2015 21:48:45 +0530 Subject: Staging: sm750fb: Add space after ',' This patch adds space after ',' for the better readability of code. This issue is detected by checkpatch.pl Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_hw.c | 130 ++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 3050847fa1c6..9f0d06da12fb 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -24,16 +24,16 @@ #include "ddk750.h" #include "sm750_accel.h" -int hw_sm750_map(struct lynx_share* share,struct pci_dev* pdev) +int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) { int ret; struct sm750_share * spec_share; - spec_share = container_of(share,struct sm750_share,share); + spec_share = container_of(share, struct sm750_share,share); ret = 0; - share->vidreg_start = pci_resource_start(pdev,1); + share->vidreg_start = pci_resource_start(pdev, 1); share->vidreg_size = MB(2); pr_info("mmio phyAddr = %lx\n", share->vidreg_start); @@ -44,29 +44,29 @@ int hw_sm750_map(struct lynx_share* share,struct pci_dev* pdev) * successfully * */ - if((ret = pci_request_region(pdev,1,"sm750fb"))) + if((ret = pci_request_region(pdev, 1, "sm750fb"))) { pr_err("Can not request PCI regions.\n"); goto exit; } /* now map mmio and vidmem*/ - share->pvReg = ioremap_nocache(share->vidreg_start,share->vidreg_size); + share->pvReg = ioremap_nocache(share->vidreg_start, share->vidreg_size); if(!share->pvReg){ pr_err("mmio failed\n"); ret = -EFAULT; goto exit; }else{ - pr_info("mmio virtual addr = %p\n",share->pvReg); + pr_info("mmio virtual addr = %p\n", share->pvReg); } share->accel.dprBase = share->pvReg + DE_BASE_ADDR_TYPE1; share->accel.dpPortBase = share->pvReg + DE_PORT_ADDR_TYPE1; - ddk750_set_mmio(share->pvReg,share->devid,share->revid); + ddk750_set_mmio(share->pvReg,share->devid, share->revid); - share->vidmem_start = pci_resource_start(pdev,0); + share->vidmem_start = pci_resource_start(pdev, 0); /* don't use pdev_resource[x].end - resource[x].start to * calculate the resource size,its only the maximum available * size but not the actual size,use @@ -74,7 +74,7 @@ int hw_sm750_map(struct lynx_share* share,struct pci_dev* pdev) * */ share->vidmem_size = hw_sm750_getVMSize(share); pr_info("video memory phyAddr = %lx, size = %u bytes\n", - share->vidmem_start,share->vidmem_size); + share->vidmem_start, share->vidmem_size); /* reserve the vidmem space of smi adaptor */ #if 0 @@ -93,7 +93,7 @@ int hw_sm750_map(struct lynx_share* share,struct pci_dev* pdev) ret = -EFAULT; goto exit; }else{ - pr_info("video memory vaddr = %p\n",share->pvMem); + pr_info("video memory vaddr = %p\n", share->pvMem); } exit: return ret; @@ -101,12 +101,12 @@ exit: -int hw_sm750_inithw(struct lynx_share* share,struct pci_dev * pdev) +int hw_sm750_inithw(struct lynx_share* share, struct pci_dev * pdev) { struct sm750_share * spec_share; struct init_status * parm; - spec_share = container_of(share,struct sm750_share,share); + spec_share = container_of(share, struct sm750_share,share); parm = &spec_share->state.initParm; if(parm->chip_clk == 0) parm->chip_clk = (getChipType() == SM750LE)? @@ -122,7 +122,7 @@ int hw_sm750_inithw(struct lynx_share* share,struct pci_dev * pdev) /* for sm718,open pci burst */ if(share->devid == 0x718){ POKE32(SYSTEM_CTRL, - FIELD_SET(PEEK32(SYSTEM_CTRL),SYSTEM_CTRL,PCI_BURST,ON)); + FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PCI_BURST, ON)); } /* sm750 use sii164, it can be setup with default value @@ -138,22 +138,22 @@ int hw_sm750_inithw(struct lynx_share* share,struct pci_dev * pdev) POKE32(MISC_CTRL, FIELD_SET(PEEK32(MISC_CTRL), MISC_CTRL, - DAC_POWER,OFF)); + DAC_POWER, OFF)); /* shut off dpms */ POKE32(SYSTEM_CTRL, FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, - DPMS,VNHN)); + DPMS, VNHN)); }else{ POKE32(MISC_CTRL, FIELD_SET(PEEK32(MISC_CTRL), MISC_CTRL, - DAC_POWER,ON)); + DAC_POWER, ON)); /* turn on dpms */ POKE32(SYSTEM_CTRL, FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, - DPMS,VPHP)); + DPMS, VPHP)); } switch (spec_share->state.pnltype){ @@ -211,7 +211,7 @@ resource_size_t hw_sm750_getVMSize(struct lynx_share * share) -int hw_sm750_output_checkMode(struct lynxfb_output* output,struct fb_var_screeninfo* var) +int hw_sm750_output_checkMode(struct lynxfb_output* output, struct fb_var_screeninfo* var) { return 0; @@ -219,7 +219,7 @@ int hw_sm750_output_checkMode(struct lynxfb_output* output,struct fb_var_screeni int hw_sm750_output_setMode(struct lynxfb_output* output, - struct fb_var_screeninfo* var,struct fb_fix_screeninfo* fix) + struct fb_var_screeninfo* var, struct fb_fix_screeninfo* fix) { int ret; disp_output_t dispSet; @@ -252,7 +252,7 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, u32 reg; reg = PEEK32(DISPLAY_CONTROL_750LE); reg |= 0xf; - POKE32(DISPLAY_CONTROL_750LE,reg); + POKE32(DISPLAY_CONTROL_750LE, reg); } pr_info("ddk setlogicdispout done \n"); @@ -265,12 +265,12 @@ void hw_sm750_output_clear(struct lynxfb_output* output) return; } -int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc,struct fb_var_screeninfo* var) +int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc, struct fb_var_screeninfo* var) { struct lynx_share * share; - share = container_of(crtc,struct lynxfb_par,crtc)->share; + share = container_of(crtc, struct lynxfb_par,crtc)->share; switch (var->bits_per_pixel){ case 8: @@ -307,7 +307,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, ret = 0; - par = container_of(crtc,struct lynxfb_par,crtc); + par = container_of(crtc, struct lynxfb_par, crtc); share = par->share; #if 1 if(!share->accel_off){ @@ -324,7 +324,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, fmt = 2; break; } - hw_set2dformat(&share->accel,fmt); + hw_set2dformat(&share->accel, fmt); } #endif @@ -349,8 +349,8 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, else clock = SECONDARY_PLL; - pr_debug("Request pixel clock = %lu\n",modparm.pixel_clock); - ret = ddk750_setModeTiming(&modparm,clock); + pr_debug("Request pixel clock = %lu\n", modparm.pixel_clock); + ret = ddk750_setModeTiming(&modparm, clock); if(ret){ pr_err("Set mode timing failed\n"); goto exit; @@ -359,54 +359,54 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, if(crtc->channel != sm750_secondary){ /* set pitch, offset ,width,start address ,etc... */ POKE32(PANEL_FB_ADDRESS, - FIELD_SET(0,PANEL_FB_ADDRESS,STATUS,CURRENT)| - FIELD_SET(0,PANEL_FB_ADDRESS,EXT,LOCAL)| - FIELD_VALUE(0,PANEL_FB_ADDRESS,ADDRESS,crtc->oScreen)); + FIELD_SET(0, PANEL_FB_ADDRESS, STATUS, CURRENT)| + FIELD_SET(0, PANEL_FB_ADDRESS, EXT, LOCAL)| + FIELD_VALUE(0, PANEL_FB_ADDRESS, ADDRESS, crtc->oScreen)); reg = var->xres * (var->bits_per_pixel >> 3); /* crtc->channel is not equal to par->index on numeric,be aware of that */ reg = PADDING(crtc->line_pad,reg); POKE32(PANEL_FB_WIDTH, - FIELD_VALUE(0,PANEL_FB_WIDTH,WIDTH,reg)| - FIELD_VALUE(0,PANEL_FB_WIDTH,OFFSET,fix->line_length)); + FIELD_VALUE(0, PANEL_FB_WIDTH, WIDTH, reg)| + FIELD_VALUE(0, PANEL_FB_WIDTH, OFFSET, fix->line_length)); POKE32(PANEL_WINDOW_WIDTH, - FIELD_VALUE(0,PANEL_WINDOW_WIDTH,WIDTH,var->xres -1)| - FIELD_VALUE(0,PANEL_WINDOW_WIDTH,X,var->xoffset)); + FIELD_VALUE(0, PANEL_WINDOW_WIDTH, WIDTH, var->xres -1)| + FIELD_VALUE(0, PANEL_WINDOW_WIDTH, X, var->xoffset)); POKE32(PANEL_WINDOW_HEIGHT, - FIELD_VALUE(0,PANEL_WINDOW_HEIGHT,HEIGHT,var->yres_virtual - 1)| - FIELD_VALUE(0,PANEL_WINDOW_HEIGHT,Y,var->yoffset)); + FIELD_VALUE(0, PANEL_WINDOW_HEIGHT, HEIGHT, var->yres_virtual - 1)| + FIELD_VALUE(0, PANEL_WINDOW_HEIGHT, Y, var->yoffset)); - POKE32(PANEL_PLANE_TL,0); + POKE32(PANEL_PLANE_TL, 0); POKE32(PANEL_PLANE_BR, - FIELD_VALUE(0,PANEL_PLANE_BR,BOTTOM,var->yres - 1)| - FIELD_VALUE(0,PANEL_PLANE_BR,RIGHT,var->xres - 1)); + FIELD_VALUE(0, PANEL_PLANE_BR, BOTTOM, var->yres - 1)| + FIELD_VALUE(0, PANEL_PLANE_BR,RIGHT, var->xres - 1)); /* set pixel format */ reg = PEEK32(PANEL_DISPLAY_CTRL); POKE32(PANEL_DISPLAY_CTRL, FIELD_VALUE(reg, - PANEL_DISPLAY_CTRL,FORMAT, + PANEL_DISPLAY_CTRL, FORMAT, (var->bits_per_pixel >> 4) )); }else{ /* not implemented now */ - POKE32(CRT_FB_ADDRESS,crtc->oScreen); + POKE32(CRT_FB_ADDRESS, crtc->oScreen); reg = var->xres * (var->bits_per_pixel >> 3); /* crtc->channel is not equal to par->index on numeric,be aware of that */ - reg = PADDING(crtc->line_pad,reg); + reg = PADDING(crtc->line_pad, reg); POKE32(CRT_FB_WIDTH, - FIELD_VALUE(0,CRT_FB_WIDTH,WIDTH,reg)| - FIELD_VALUE(0,CRT_FB_WIDTH,OFFSET,fix->line_length)); + FIELD_VALUE(0, CRT_FB_WIDTH, WIDTH, reg)| + FIELD_VALUE(0, CRT_FB_WIDTH, OFFSET, fix->line_length)); /* SET PIXEL FORMAT */ reg = PEEK32(CRT_DISPLAY_CTRL); - reg = FIELD_VALUE(reg,CRT_DISPLAY_CTRL,FORMAT,var->bits_per_pixel >> 4); - POKE32(CRT_DISPLAY_CTRL,reg); + reg = FIELD_VALUE(reg, CRT_DISPLAY_CTRL, FORMAT, var->bits_per_pixel >> 4); + POKE32(CRT_DISPLAY_CTRL, reg); } @@ -421,15 +421,15 @@ void hw_sm750_crtc_clear(struct lynxfb_crtc* crtc) return; } -int hw_sm750_setColReg(struct lynxfb_crtc* crtc,ushort index, - ushort red,ushort green,ushort blue) +int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, + ushort red, ushort green, ushort blue) { static unsigned int add[]={PANEL_PALETTE_RAM,CRT_PALETTE_RAM}; - POKE32(add[crtc->channel] + index*4 ,(red<<16)|(green<<8)|blue); + POKE32(add[crtc->channel] + index*4, (red<<16)|(green<<8)|blue); return 0; } -int hw_sm750le_setBLANK(struct lynxfb_output * output,int blank){ +int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ int dpms,crtdb; switch(blank) @@ -477,15 +477,15 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output,int blank){ } if(output->paths & sm750_crt){ - POKE32(CRT_DISPLAY_CTRL,FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL),CRT_DISPLAY_CTRL,DPMS,dpms)); - POKE32(CRT_DISPLAY_CTRL,FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL),CRT_DISPLAY_CTRL,BLANK,crtdb)); + POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, DPMS, dpms)); + POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } return 0; } int hw_sm750_setBLANK(struct lynxfb_output* output,int blank) { - unsigned int dpms,pps,crtdb; + unsigned int dpms, pps, crtdb; dpms = pps = crtdb = 0; @@ -540,12 +540,12 @@ int hw_sm750_setBLANK(struct lynxfb_output* output,int blank) if(output->paths & sm750_crt){ - POKE32(SYSTEM_CTRL,FIELD_VALUE(PEEK32(SYSTEM_CTRL),SYSTEM_CTRL,DPMS,dpms)); - POKE32(CRT_DISPLAY_CTRL,FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL),CRT_DISPLAY_CTRL,BLANK,crtdb)); + POKE32(SYSTEM_CTRL,FIELD_VALUE(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, DPMS, dpms)); + POKE32(CRT_DISPLAY_CTRL,FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL,BLANK, crtdb)); } if(output->paths & sm750_panel){ - POKE32(PANEL_DISPLAY_CTRL,FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL),PANEL_DISPLAY_CTRL,DATA,pps)); + POKE32(PANEL_DISPLAY_CTRL, FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, DATA, pps)); } return 0; @@ -559,22 +559,22 @@ void hw_sm750_initAccel(struct lynx_share * share) if(getChipType() == SM750LE){ reg = PEEK32(DE_STATE1); - reg = FIELD_SET(reg,DE_STATE1,DE_ABORT,ON); + reg = FIELD_SET(reg, DE_STATE1, DE_ABORT,ON); POKE32(DE_STATE1,reg); reg = PEEK32(DE_STATE1); - reg = FIELD_SET(reg,DE_STATE1,DE_ABORT,OFF); - POKE32(DE_STATE1,reg); + reg = FIELD_SET(reg, DE_STATE1, DE_ABORT,OFF); + POKE32(DE_STATE1, reg); }else{ /* engine reset */ reg = PEEK32(SYSTEM_CTRL); - reg = FIELD_SET(reg,SYSTEM_CTRL,DE_ABORT,ON); - POKE32(SYSTEM_CTRL,reg); + reg = FIELD_SET(reg, SYSTEM_CTRL, DE_ABORT,ON); + POKE32(SYSTEM_CTRL, reg); reg = PEEK32(SYSTEM_CTRL); - reg = FIELD_SET(reg,SYSTEM_CTRL,DE_ABORT,OFF); - POKE32(SYSTEM_CTRL,reg); + reg = FIELD_SET(reg, SYSTEM_CTRL, DE_ABORT,OFF); + POKE32(SYSTEM_CTRL, reg); } /* call 2d init */ @@ -586,9 +586,9 @@ int hw_sm750le_deWait(void) int i=0x10000000; while(i--){ unsigned int dwVal = PEEK32(DE_STATE2); - if((FIELD_GET(dwVal,DE_STATE2,DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && - (FIELD_GET(dwVal,DE_STATE2,DE_FIFO) == DE_STATE2_DE_FIFO_EMPTY) && - (FIELD_GET(dwVal,DE_STATE2,DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) + if((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && + (FIELD_GET(dwVal, DE_STATE2, DE_FIFO) == DE_STATE2_DE_FIFO_EMPTY) && + (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) { return 0; } -- cgit v1.2.3 From 6946edd07a98e74fa7eedc465dc37a615830a311 Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Sat, 14 Mar 2015 21:55:11 +0900 Subject: staging: sm750fb: remove parantheses from return statements found by checkpatch.pl :ERROR: return is not a function, parentheses are not required changes made using coccinelle script: @@ expression e,e1; @@ ( return (e / e1); | return -( e -) ; ) Signed-off-by: Supriya Karanth Acked-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 2 +- drivers/staging/sm750fb/ddk750_swi2c.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 3c772073ebe8..33add64569b0 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -633,7 +633,7 @@ unsigned int formatPllReg(pll_value_t *pPLL) | FIELD_VALUE(0, PANEL_PLL_CTRL, N, pPLL->N) | FIELD_VALUE(0, PANEL_PLL_CTRL, M, pPLL->M); - return(ulPllReg); + return ulPllReg; } diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c index 1249759eb347..8557cce2f420 100644 --- a/drivers/staging/sm750fb/ddk750_swi2c.c +++ b/drivers/staging/sm750fb/ddk750_swi2c.c @@ -304,7 +304,7 @@ long swI2CWriteByte(unsigned char data) if (i<0xff) return 0; else - return (-1); + return -1; } /* @@ -408,10 +408,10 @@ long swI2CInit( /* Return 0 if the GPIO pins to be used is out of range. The range is only from [0..63] */ if ((i2cClkGPIO > 31) || (i2cDataGPIO > 31)) - return (-1); + return -1; if (getChipType() == SM750LE) - return( swI2CInit_SM750LE(i2cClkGPIO, i2cDataGPIO) ); + return swI2CInit_SM750LE(i2cClkGPIO, i2cDataGPIO); /* Initialize the GPIO pin for the i2c Clock Register */ g_i2cClkGPIOMuxReg = GPIO_MUX; -- cgit v1.2.3 From 81906c357a37bd82ca041bbdde9c663ea656f300 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Wed, 11 Mar 2015 17:02:13 +0530 Subject: Staging: comedi: Use function setup_timer for combining initialization The function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields. So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script. @@ expression E1, E2, E3; type T; @@ - init_timer(&E1); ... ( - E1.function = E2; ... - E1.data = (T)E3; + setup_timer(&E1, E2, (T)E3); | - E1.data = (T)E3; ... - E1.function = E2; + setup_timer(&E1, E2, (T)E3); | - E1.function = E2; + setup_timer(&E1, E2, 0); ) Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das16.c | 5 ++--- drivers/staging/comedi/drivers/jr3_pci.c | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index be6277ae4abc..f66db97b9d4f 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -935,9 +935,8 @@ static void das16_alloc_dma(struct comedi_device *dev, unsigned int dma_chan) devpriv->dma = comedi_isadma_alloc(dev, 2, dma_chan, dma_chan, DAS16_DMA_SIZE, COMEDI_ISADMA_READ); if (devpriv->dma) { - init_timer(&devpriv->timer); - devpriv->timer.function = das16_timer_interrupt; - devpriv->timer.data = (unsigned long)dev; + setup_timer(&devpriv->timer, das16_timer_interrupt, + (unsigned long)dev); } } diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index 81fab2dfafa4..282c37f759d8 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -706,8 +706,6 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, if (!devpriv) return -ENOMEM; - init_timer(&devpriv->timer); - ret = comedi_pci_enable(dev); if (ret) return ret; @@ -775,8 +773,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, spriv->next_time_max = jiffies + msecs_to_jiffies(2000); } - devpriv->timer.data = (unsigned long)dev; - devpriv->timer.function = jr3_pci_poll_dev; + setup_timer(&devpriv->timer, jr3_pci_poll_dev, (unsigned long)dev); devpriv->timer.expires = jiffies + msecs_to_jiffies(1000); add_timer(&devpriv->timer); -- cgit v1.2.3 From f0dff42124d3d312c236c5b934edeac477c818f7 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 13 Mar 2015 14:29:30 +0300 Subject: Staging: comedi: Remove parentheses around right side assignment Parentheses are not needed around the right hand side of an assignment. This patch remove parenthese of such occurences. Issue was detected and solved using the following coccinelle script: @rule1@ identifier x, y, z; expression E1, E2; @@ ( x = (y == z); | x = (E1 == E2); | x = -( ... -) ; ) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3501.c | 4 ++-- drivers/staging/comedi/drivers/ni_mio_common.c | 8 ++++---- drivers/staging/comedi/drivers/serial2002.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index b8f336681788..babbdffefa88 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -270,7 +270,7 @@ static irqreturn_t apci3501_interrupt(int irq, void *d) /* Disable Interrupt */ ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = (ul_Command1 & 0xFFFFF9FDul); + ul_Command1 = ul_Command1 & 0xFFFFF9FDul; outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); ui_Timer_AOWatchdog = inl(dev->iobase + APCI3501_TIMER_IRQ_REG) & 0x1; @@ -282,7 +282,7 @@ static irqreturn_t apci3501_interrupt(int irq, void *d) /* Enable Interrupt Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); ul_Command1 = inl(dev->iobase + APCI3501_TIMER_CTRL_REG); - ul_Command1 = ((ul_Command1 & 0xFFFFF9FDul) | 1 << 1); + ul_Command1 = (ul_Command1 & 0xFFFFF9FDul) | 1 << 1; outl(ul_Command1, dev->iobase + APCI3501_TIMER_CTRL_REG); inl(dev->iobase + APCI3501_TIMER_STATUS_REG); diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 42fdedd6943c..ecfd0544cf40 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -1360,7 +1360,7 @@ static void get_last_sample_611x(struct comedi_device *dev) /* Check if there's a single sample stuck in the FIFO */ if (ni_readb(dev, XXX_Status) & 0x80) { dl = ni_readl(dev, ADC_FIFO_Data_611x); - data = (dl & 0xffff); + data = dl & 0xffff; comedi_buf_write_samples(s, &data, 1); } } @@ -1871,7 +1871,7 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev, chan = CR_CHAN(list[0]); range = CR_RANGE(list[0]); range_code = ni_gainlkup[board->gainlkup][range]; - dither = ((list[0] & CR_ALT_FILTER) != 0); + dither = (list[0] & CR_ALT_FILTER) != 0; bypass_bits = MSeries_AI_Bypass_Config_FIFO_Bit; bypass_bits |= chan; bypass_bits |= @@ -1895,7 +1895,7 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev, chan = CR_CHAN(list[i]); aref = CR_AREF(list[i]); range = CR_RANGE(list[i]); - dither = ((list[i] & CR_ALT_FILTER) != 0); + dither = (list[i] & CR_ALT_FILTER) != 0; range_code = ni_gainlkup[board->gainlkup][range]; devpriv->ai_offset[i] = 0; @@ -2021,7 +2021,7 @@ static void ni_load_channelgain_list(struct comedi_device *dev, chan = CR_CHAN(list[i]); aref = CR_AREF(list[i]); range = CR_RANGE(list[i]); - dither = ((list[i] & CR_ALT_FILTER) != 0); + dither = (list[i] & CR_ALT_FILTER) != 0; /* fix the external/internal range differences */ range = ni_gainlkup[board->gainlkup][range]; diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index 482a2a8a4a57..ad35ed6e93f0 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -143,8 +143,8 @@ static void serial2002_tty_read_poll_wait(struct file *f, int timeout) break; } do_gettimeofday(&now); - elapsed = (1000000 * (now.tv_sec - start.tv_sec) + - now.tv_usec - start.tv_usec); + elapsed = 1000000 * (now.tv_sec - start.tv_sec) + + now.tv_usec - start.tv_usec; if (elapsed > timeout) break; set_current_state(TASK_INTERRUPTIBLE); -- cgit v1.2.3 From 192b3ffc4cd47e021b5160507dd885516f345b7d Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Fri, 13 Mar 2015 21:00:20 +0900 Subject: staging: comedi: remove break after return Remove "break" statement after a "return" statement as it does not get executed. Deadcode found by coccinelle --debug option Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index ecfd0544cf40..ada050eb359c 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3811,8 +3811,6 @@ static int ni_serial_insn_config(struct comedi_device *dev, Clock_and_FOUT_Register); return 1; - break; - case INSN_CONFIG_BIDIRECTIONAL_DATA: if (devpriv->serial_interval_ns == 0) -- cgit v1.2.3 From 2f1758d606e96e19caf9ced2b617b5d555d86f6e Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Sat, 14 Mar 2015 15:49:30 +0530 Subject: Staging: skein: Remove do-while(0) from single statement macros Remove unneeded do-while(0) loop from single statement macros. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/skein/skein_block.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c index 9bd69ce3be00..b0cd9357348f 100644 --- a/drivers/staging/skein/skein_block.c +++ b/drivers/staging/skein/skein_block.c @@ -68,9 +68,7 @@ do { \ #if SKEIN_UNROLL_256 == 0 #define R256(p0, p1, p2, p3, ROT, r_num) /* fully unrolled */ \ -do { \ - ROUND256(p0, p1, p2, p3, ROT, r_num); \ -} while (0) + ROUND256(p0, p1, p2, p3, ROT, r_num) #define I256(R) \ do { \ @@ -152,9 +150,7 @@ do { \ #if SKEIN_UNROLL_512 == 0 #define R512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num) /* unrolled */ \ -do { \ - ROUND512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num); \ -} while (0) + ROUND512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num) #define I512(R) \ do { \ -- cgit v1.2.3 From 6501c8e7d86cca5fab74f873810cbc573273d1b4 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 6 Mar 2015 16:23:35 +0530 Subject: Staging: rtl8712: Eliminate use of _cancel_timer_ex Use timer API function del_timer_sync instead of driver specific function _cancel_timer_ex as besides deactivating a timer, it ensures that the timer is stopped on all CPUs before the driver exists. Also, definition of function _cancel_timer_ex is removed as it is no longer needed after this change. This is done using Coccinelle and semantic patch used for this is as follows: @@ expression x; @@ - _cancel_timer_ex (&x); + del_timer_sync (&x); Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/os_intfs.c | 13 ++- drivers/staging/rtl8712/osdep_service.h | 5 - drivers/staging/rtl8712/rtl8712_led.c | 146 +++++++++++++++--------------- drivers/staging/rtl8712/rtl871x_mlme.c | 2 +- drivers/staging/rtl8712/rtl871x_pwrctrl.c | 2 +- drivers/staging/rtl8712/rtl871x_sta_mgt.c | 2 +- 6 files changed, 82 insertions(+), 88 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index ebfb29ed779a..78815b6170c7 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -263,13 +263,12 @@ static void start_drv_timers(struct _adapter *padapter) void r8712_stop_drv_timers(struct _adapter *padapter) { - _cancel_timer_ex(&padapter->mlmepriv.assoc_timer); - _cancel_timer_ex(&padapter->securitypriv.tkip_timer); - _cancel_timer_ex(&padapter->mlmepriv.scan_to_timer); - _cancel_timer_ex(&padapter->mlmepriv.dhcp_timer); - _cancel_timer_ex(&padapter->mlmepriv.wdg_timer); - _cancel_timer_ex(&padapter->mlmepriv.sitesurveyctrl. - sitesurvey_ctrl_timer); + del_timer_sync(&padapter->mlmepriv.assoc_timer); + del_timer_sync(&padapter->securitypriv.tkip_timer); + del_timer_sync(&padapter->mlmepriv.scan_to_timer); + del_timer_sync(&padapter->mlmepriv.dhcp_timer); + del_timer_sync(&padapter->mlmepriv.wdg_timer); + del_timer_sync(&padapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer); } static u8 init_default_value(struct _adapter *padapter) diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h index c6dc3629f4d2..33be7788945a 100644 --- a/drivers/staging/rtl8712/osdep_service.h +++ b/drivers/staging/rtl8712/osdep_service.h @@ -92,11 +92,6 @@ static inline void sleep_schedulable(int ms) schedule_timeout(delta); } -static inline unsigned char _cancel_timer_ex(struct timer_list *ptimer) -{ - return del_timer(ptimer); -} - static inline void flush_signals_thread(void) { if (signal_pending(current)) diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c index 6085689f0976..f1d47a0676c3 100644 --- a/drivers/staging/rtl8712/rtl8712_led.c +++ b/drivers/staging/rtl8712/rtl8712_led.c @@ -108,7 +108,7 @@ static void InitLed871x(struct _adapter *padapter, struct LED_871x *pLed, */ static void DeInitLed871x(struct LED_871x *pLed) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); /* We should reset bLedBlinkInProgress if we cancel * the LedControlTimer, */ pLed->bLedBlinkInProgress = false; @@ -898,11 +898,11 @@ static void SwLedControlMode1(struct _adapter *padapter, IS_LED_WPS_BLINKING(pLed)) return; if (pLed->bLedLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } pLed->bLedNoLinkBlinkInProgress = true; @@ -921,11 +921,11 @@ static void SwLedControlMode1(struct _adapter *padapter, IS_LED_WPS_BLINKING(pLed)) return; if (pLed->bLedNoLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } pLed->bLedLinkBlinkInProgress = true; @@ -946,15 +946,15 @@ static void SwLedControlMode1(struct _adapter *padapter, if (IS_LED_WPS_BLINKING(pLed)) return; if (pLed->bLedNoLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } if (pLed->bLedLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } pLed->bLedScanBlinkInProgress = true; @@ -975,11 +975,11 @@ static void SwLedControlMode1(struct _adapter *padapter, IS_LED_WPS_BLINKING(pLed)) return; if (pLed->bLedNoLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } if (pLed->bLedLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } pLed->bLedBlinkInProgress = true; @@ -998,19 +998,19 @@ static void SwLedControlMode1(struct _adapter *padapter, case LED_CTL_START_WPS_BOTTON: if (pLed->bLedWPSBlinkInProgress == false) { if (pLed->bLedNoLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } if (pLed->bLedLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } pLed->bLedWPSBlinkInProgress = true; @@ -1025,23 +1025,23 @@ static void SwLedControlMode1(struct _adapter *padapter, break; case LED_CTL_STOP_WPS: if (pLed->bLedNoLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } if (pLed->bLedLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } if (pLed->bLedWPSBlinkInProgress) - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); else pLed->bLedWPSBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_WPS_STOP; @@ -1057,7 +1057,7 @@ static void SwLedControlMode1(struct _adapter *padapter, break; case LED_CTL_STOP_WPS_FAIL: if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } pLed->bLedNoLinkBlinkInProgress = true; @@ -1073,23 +1073,23 @@ static void SwLedControlMode1(struct _adapter *padapter, pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; if (pLed->bLedNoLinkBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } if (pLed->bLedLinkBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } if (pLed->bLedBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } mod_timer(&pLed->BlinkTimer, @@ -1116,7 +1116,7 @@ static void SwLedControlMode2(struct _adapter *padapter, return; if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } pLed->bLedScanBlinkInProgress = true; @@ -1154,11 +1154,11 @@ static void SwLedControlMode2(struct _adapter *padapter, pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; if (pLed->bLedBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1170,11 +1170,11 @@ static void SwLedControlMode2(struct _adapter *padapter, case LED_CTL_START_WPS_BOTTON: if (pLed->bLedWPSBlinkInProgress == false) { if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } pLed->bLedWPSBlinkInProgress = true; @@ -1214,15 +1214,15 @@ static void SwLedControlMode2(struct _adapter *padapter, pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; if (pLed->bLedBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } mod_timer(&pLed->BlinkTimer, @@ -1248,7 +1248,7 @@ static void SwLedControlMode3(struct _adapter *padapter, if (IS_LED_WPS_BLINKING(pLed)) return; if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } pLed->bLedScanBlinkInProgress = true; @@ -1286,11 +1286,11 @@ static void SwLedControlMode3(struct _adapter *padapter, pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; if (pLed->bLedBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } mod_timer(&pLed->BlinkTimer, @@ -1300,11 +1300,11 @@ static void SwLedControlMode3(struct _adapter *padapter, case LED_CTL_START_WPS_BOTTON: if (pLed->bLedWPSBlinkInProgress == false) { if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } pLed->bLedWPSBlinkInProgress = true; @@ -1319,7 +1319,7 @@ static void SwLedControlMode3(struct _adapter *padapter, break; case LED_CTL_STOP_WPS: if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; } else pLed->bLedWPSBlinkInProgress = true; @@ -1336,7 +1336,7 @@ static void SwLedControlMode3(struct _adapter *padapter, break; case LED_CTL_STOP_WPS_FAIL: if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } pLed->CurrLedState = LED_OFF; @@ -1357,15 +1357,15 @@ static void SwLedControlMode3(struct _adapter *padapter, pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; if (pLed->bLedBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } mod_timer(&pLed->BlinkTimer, @@ -1388,7 +1388,7 @@ static void SwLedControlMode4(struct _adapter *padapter, case LED_CTL_START_TO_LINK: if (pLed1->bLedWPSBlinkInProgress) { pLed1->bLedWPSBlinkInProgress = false; - _cancel_timer_ex(&(pLed1->BlinkTimer)); + del_timer_sync(&pLed1->BlinkTimer); pLed1->BlinkingLedState = LED_OFF; pLed1->CurrLedState = LED_OFF; if (pLed1->bLedOn) @@ -1400,11 +1400,11 @@ static void SwLedControlMode4(struct _adapter *padapter, IS_LED_WPS_BLINKING(pLed)) return; if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedNoLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } pLed->bLedStartToLinkBlinkInProgress = true; @@ -1426,7 +1426,7 @@ static void SwLedControlMode4(struct _adapter *padapter, if (LedAction == LED_CTL_LINK) { if (pLed1->bLedWPSBlinkInProgress) { pLed1->bLedWPSBlinkInProgress = false; - _cancel_timer_ex(&(pLed1->BlinkTimer)); + del_timer_sync(&pLed1->BlinkTimer); pLed1->BlinkingLedState = LED_OFF; pLed1->CurrLedState = LED_OFF; if (pLed1->bLedOn) @@ -1439,7 +1439,7 @@ static void SwLedControlMode4(struct _adapter *padapter, IS_LED_WPS_BLINKING(pLed)) return; if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } pLed->bLedNoLinkBlinkInProgress = true; @@ -1460,11 +1460,11 @@ static void SwLedControlMode4(struct _adapter *padapter, if (IS_LED_WPS_BLINKING(pLed)) return; if (pLed->bLedNoLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } pLed->bLedScanBlinkInProgress = true; @@ -1485,7 +1485,7 @@ static void SwLedControlMode4(struct _adapter *padapter, IS_LED_WPS_BLINKING(pLed)) return; if (pLed->bLedNoLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } pLed->bLedBlinkInProgress = true; @@ -1503,7 +1503,7 @@ static void SwLedControlMode4(struct _adapter *padapter, case LED_CTL_START_WPS_BOTTON: if (pLed1->bLedWPSBlinkInProgress) { pLed1->bLedWPSBlinkInProgress = false; - _cancel_timer_ex(&(pLed1->BlinkTimer)); + del_timer_sync(&(pLed1->BlinkTimer)); pLed1->BlinkingLedState = LED_OFF; pLed1->CurrLedState = LED_OFF; if (pLed1->bLedOn) @@ -1512,15 +1512,15 @@ static void SwLedControlMode4(struct _adapter *padapter, } if (pLed->bLedWPSBlinkInProgress == false) { if (pLed->bLedNoLinkBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } pLed->bLedWPSBlinkInProgress = true; @@ -1538,7 +1538,7 @@ static void SwLedControlMode4(struct _adapter *padapter, break; case LED_CTL_STOP_WPS: /*WPS connect success*/ if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } pLed->bLedNoLinkBlinkInProgress = true; @@ -1552,7 +1552,7 @@ static void SwLedControlMode4(struct _adapter *padapter, break; case LED_CTL_STOP_WPS_FAIL: /*WPS authentication fail*/ if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } pLed->bLedNoLinkBlinkInProgress = true; @@ -1565,7 +1565,7 @@ static void SwLedControlMode4(struct _adapter *padapter, msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); /*LED1 settings*/ if (pLed1->bLedWPSBlinkInProgress) - _cancel_timer_ex(&(pLed1->BlinkTimer)); + del_timer_sync(&pLed1->BlinkTimer); else pLed1->bLedWPSBlinkInProgress = true; pLed1->CurrLedState = LED_BLINK_WPS_STOP; @@ -1578,7 +1578,7 @@ static void SwLedControlMode4(struct _adapter *padapter, break; case LED_CTL_STOP_WPS_FAIL_OVERLAP: /*WPS session overlap*/ if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } pLed->bLedNoLinkBlinkInProgress = true; @@ -1591,7 +1591,7 @@ static void SwLedControlMode4(struct _adapter *padapter, msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); /*LED1 settings*/ if (pLed1->bLedWPSBlinkInProgress) - _cancel_timer_ex(&(pLed1->BlinkTimer)); + del_timer_sync(&pLed1->BlinkTimer); else pLed1->bLedWPSBlinkInProgress = true; pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP; @@ -1607,31 +1607,31 @@ static void SwLedControlMode4(struct _adapter *padapter, pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; if (pLed->bLedNoLinkBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } if (pLed->bLedLinkBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } if (pLed->bLedBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } if (pLed->bLedScanBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } if (pLed->bLedStartToLinkBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedStartToLinkBlinkInProgress = false; } if (pLed1->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed1->BlinkTimer)); + del_timer_sync(&pLed1->BlinkTimer); pLed1->bLedWPSBlinkInProgress = false; } pLed1->BlinkingLedState = LED_UNKNOWN; @@ -1671,7 +1671,7 @@ static void SwLedControlMode5(struct _adapter *padapter, ; /* dummy branch */ else if (pLed->bLedScanBlinkInProgress == false) { if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } pLed->bLedScanBlinkInProgress = true; @@ -1705,7 +1705,7 @@ static void SwLedControlMode5(struct _adapter *padapter, pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; if (pLed->bLedBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } SwLedOff(padapter, pLed); @@ -1756,7 +1756,7 @@ static void SwLedControlMode6(struct _adapter *padapter, case LED_CTL_START_WPS_BOTTON: if (pLed->bLedWPSBlinkInProgress == false) { if (pLed->bLedBlinkInProgress == true) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } pLed->bLedWPSBlinkInProgress = true; @@ -1772,7 +1772,7 @@ static void SwLedControlMode6(struct _adapter *padapter, case LED_CTL_STOP_WPS_FAIL: case LED_CTL_STOP_WPS: if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } pLed->CurrLedState = LED_ON; @@ -1784,11 +1784,11 @@ static void SwLedControlMode6(struct _adapter *padapter, pLed->CurrLedState = LED_OFF; pLed->BlinkingLedState = LED_OFF; if (pLed->bLedBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } if (pLed->bLedWPSBlinkInProgress) { - _cancel_timer_ex(&(pLed->BlinkTimer)); + del_timer_sync(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; } SwLedOff(padapter, pLed); diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index bb784844d26f..8faa46150f09 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -698,7 +698,7 @@ void r8712_ind_disconnect(struct _adapter *padapter) } if (padapter->pwrctrlpriv.pwr_mode != padapter->registrypriv.power_mgnt) { - _cancel_timer_ex(&pmlmepriv->dhcp_timer); + del_timer_sync(&pmlmepriv->dhcp_timer); r8712_set_ps_mode(padapter, padapter->registrypriv.power_mgnt, padapter->registrypriv.smart_ps); } diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c b/drivers/staging/rtl8712/rtl871x_pwrctrl.c index ea732ee99bbe..aaa584435c87 100644 --- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c +++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c @@ -103,7 +103,7 @@ void r8712_cpwm_int_hdl(struct _adapter *padapter, if (pwrpriv->cpwm_tog == ((preportpwrstate->state) & 0x80)) return; - _cancel_timer_ex(&padapter->pwrctrlpriv. rpwm_check_timer); + del_timer_sync(&padapter->pwrctrlpriv.rpwm_check_timer); _enter_pwrlock(&pwrpriv->lock); pwrpriv->cpwm = (preportpwrstate->state) & 0xf; if (pwrpriv->cpwm >= PS_STATE_S2) { diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c index 1752121ff494..7bb96c47f188 100644 --- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c +++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c @@ -198,7 +198,7 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta) * cancel reordering_ctrl_timer */ for (i = 0; i < 16; i++) { preorder_ctrl = &psta->recvreorder_ctrl[i]; - _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); + del_timer_sync(&preorder_ctrl->reordering_ctrl_timer); } spin_lock(&(pfree_sta_queue->lock)); /* insert into free_sta_queue; 20061114 */ -- cgit v1.2.3 From 382d020f4459cd77237c5463098935fd64afdab3 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 6 Mar 2015 16:23:51 +0530 Subject: Staging: rtl8712: Eliminate use of _cancel_timer Use timer API function del_timer_sync instead of driver specific function _cancel_timer as besides deactivating a timer, it also ensures that the timer is stopped on all CPUs before the driver exists. Also, variables timer_cancelled and bool are removed as they are no longer needed. @a@ expression x; identifier y; @@ - _cancel_timer (&x, &y); + del_timer_sync (&x); @@type T; identifier a.y;@@ - T y; ...when != y Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/osdep_service.h | 6 ------ drivers/staging/rtl8712/rtl871x_cmd.c | 3 +-- drivers/staging/rtl8712/rtl871x_mlme.c | 8 ++------ drivers/staging/rtl8712/rtl871x_xmit.c | 3 +-- 4 files changed, 4 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h index 33be7788945a..0a7f58c59df5 100644 --- a/drivers/staging/rtl8712/osdep_service.h +++ b/drivers/staging/rtl8712/osdep_service.h @@ -60,12 +60,6 @@ struct __queue { #define LIST_CONTAINOR(ptr, type, member) \ ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member))) -static inline void _cancel_timer(struct timer_list *ptimer, u8 *bcancelled) -{ - del_timer(ptimer); - *bcancelled = true; /*true ==1; false==0*/ -} - #ifndef BIT #define BIT(x) (1 << (x)) #endif diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index d105ade43f67..1a1c38f885d6 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -900,7 +900,6 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter, struct cmd_obj *pcmd) { unsigned long irqL; - u8 timer_cancelled; struct sta_info *psta = NULL; struct wlan_network *pwlan = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -911,7 +910,7 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter, if (pcmd->res != H2C_SUCCESS) mod_timer(&pmlmepriv->assoc_timer, jiffies + msecs_to_jiffies(1)); - _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); + del_timer_sync(&pmlmepriv->assoc_timer); #ifdef __BIG_ENDIAN /* endian_convert */ pnetwork->Length = le32_to_cpu(pnetwork->Length); diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 8faa46150f09..ef8a10e568b5 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -582,9 +582,7 @@ void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf) spin_lock_irqsave(&pmlmepriv->lock, irqL); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) { - u8 timer_cancelled; - - _cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled); + del_timer_sync(&pmlmepriv->scan_to_timer); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } @@ -717,7 +715,6 @@ void r8712_ind_disconnect(struct _adapter *padapter) void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) { unsigned long irqL = 0, irqL2; - u8 timer_cancelled; struct sta_info *ptarget_sta = NULL, *pcur_sta = NULL; struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; @@ -911,8 +908,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) r8712_indicate_connect(adapter); - _cancel_timer(&pmlmepriv->assoc_timer, - &timer_cancelled); + del_timer_sync(&pmlmepriv->assoc_timer); } else goto ignore_joinbss_callback; } else { diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c index a28af03c9d8a..2e4fa88951ad 100644 --- a/drivers/staging/rtl8712/rtl871x_xmit.c +++ b/drivers/staging/rtl8712/rtl871x_xmit.c @@ -203,13 +203,12 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, pattrib->ether_type = ntohs(etherhdr.h_proto); { - u8 bool; /*If driver xmit ARP packet, driver can set ps mode to initial * setting. It stands for getting DHCP or fix IP.*/ if (pattrib->ether_type == 0x0806) { if (padapter->pwrctrlpriv.pwr_mode != padapter->registrypriv.power_mgnt) { - _cancel_timer(&(pmlmepriv->dhcp_timer), &bool); + del_timer_sync(&pmlmepriv->dhcp_timer); r8712_set_ps_mode(padapter, padapter->registrypriv. power_mgnt, padapter->registrypriv.smart_ps); } -- cgit v1.2.3 From 819ef638151f89199c6c3ce42418f40be90ff23a Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Thu, 12 Mar 2015 01:08:32 +0300 Subject: Staging: rtl8712: remove else after return statement else after return generally is not useful. This patch removes else after return statement. Issue addressed by checkpatch.pl. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_mlme.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index ef8a10e568b5..9b13de1437a1 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -1597,17 +1597,15 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie, iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid); if (iEntry < 0) return ielength; - else { - if (authmode == _WPA2_IE_ID_) { - out_ie[ielength] = 1; - ielength++; - out_ie[ielength] = 0; /*PMKID count = 0x0100*/ - ielength++; - memcpy(&out_ie[ielength], - &psecuritypriv->PMKIDList[iEntry].PMKID, 16); - ielength += 16; - out_ie[13] += 18;/*PMKID length = 2+16*/ - } + if (authmode == _WPA2_IE_ID_) { + out_ie[ielength] = 1; + ielength++; + out_ie[ielength] = 0; /*PMKID count = 0x0100*/ + ielength++; + memcpy(&out_ie[ielength], + &psecuritypriv->PMKIDList[iEntry].PMKID, 16); + ielength += 16; + out_ie[13] += 18;/*PMKID length = 2+16*/ } return ielength; } -- cgit v1.2.3 From 66faa441a6f5753dd3e7add3e1640819ba9ec1c2 Mon Sep 17 00:00:00 2001 From: Matteo Semenzato Date: Wed, 11 Mar 2015 14:31:14 +0100 Subject: Staging: rtl8712: fix potential null pointer dereference Check if kmalloc succeded before using the pointer in memcpy. Signed-off-by: Matteo Semenzato Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_mlme.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 9b13de1437a1..fb2b195b90af 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -725,6 +725,8 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) if (sizeof(struct list_head) == 4 * sizeof(u32)) { pnetwork = kmalloc(sizeof(struct wlan_network), GFP_ATOMIC); + if (!pnetwork) + return; memcpy((u8 *)pnetwork+16, (u8 *)pbuf + 8, sizeof(struct wlan_network) - 16); } else -- cgit v1.2.3 From 58662d9f1ea9de4ef98348f556d676eeaaf6be49 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Fri, 6 Mar 2015 14:14:58 +0200 Subject: Staging: rtl8712: Replace __constant_cpu_to_le16 This fixes the following checkpatch.pl warning: WARNING: __constant_cpu_to_le16 should be cpu_to_le16 Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/wifi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h index 6b1e1fa59cbd..17f513122f48 100644 --- a/drivers/staging/rtl8712/wifi.h +++ b/drivers/staging/rtl8712/wifi.h @@ -243,9 +243,9 @@ enum WIFI_REG_DOMAIN { #define SetFrameType(pbuf, type) \ do { \ - *(unsigned short *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | \ + *(unsigned short *)(pbuf) &= cpu_to_le16(~(BIT(3) | \ BIT(2))); \ - *(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \ + *(unsigned short *)(pbuf) |= cpu_to_le16(type); \ } while (0) #define GetFrameSubType(pbuf) (cpu_to_le16(*(unsigned short *)(pbuf)) & \ -- cgit v1.2.3 From 6465144c3d19ca1c2f5fb1dd12d0a6496254c85c Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 6 Mar 2015 18:52:28 +0530 Subject: Staging: rtl8192u: Convert use of __constant_ to Using functions of the form __constant_ isn't preferred outside of include/uapi/ as using the function without __constant_ is identical when the argument is a constant. So, this patch replaces __constant_htons with htons. This is done using Coccinelle and semantic patch used for this is as follows: @@identifier x;@@ ( - __constant_htons(x) + htons(x) | - __constant_htonl(x) + htonl(x) | - __constant_ntohs(x) + htons(x) | - __constant_ntohl(x) + htonl(x) ) Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index d2c2fb82f2fc..bd745109aaee 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -55,7 +55,7 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, skb_pull(skb, ieee80211_get_hdrlen(fc)); skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = __constant_htons(ETH_P_80211_RAW); + skb->protocol = htons(ETH_P_80211_RAW); memset(skb->cb, 0, sizeof(skb->cb)); netif_rx(skb); } -- cgit v1.2.3 From ca67dfefd852c5fba5aac232e20a0e52bfadf693 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Fri, 6 Mar 2015 16:08:10 +0200 Subject: Staging: rtl8192u: Added #include instead of The following patch fixes the checkpatch.pl warning: WARNING: Use #include instead of Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index bd745109aaee..dc1aa3f71a8f 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include "ieee80211.h" -- cgit v1.2.3 From 8236589b7c1d78068661dd9e0e052f8897b45d41 Mon Sep 17 00:00:00 2001 From: Dilek Uzulmez Date: Fri, 6 Mar 2015 16:18:31 +0200 Subject: Staging: rtl8192u: Fix do not use // c99 comments. This patch fixes checkpatch.pl issues with "do not use // C99 comments" errors in ieee80211_rx.c Signed-off-by: Dilek Uzulmez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index dc1aa3f71a8f..0a90450a295d 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -221,8 +221,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, rx_stats->len = skb->len; ieee80211_rx_mgt(ieee,(struct ieee80211_hdr_4addr *)skb->data,rx_stats); - //if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) - if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))//use ADDR1 to perform address matching for Management frames + /* if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) */ + if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))/* use ADDR1 to perform address matching for Management frames */ { dev_kfree_skb_any(skb); return 0; -- cgit v1.2.3 From c3bb45456bcea2c5239836e457685b6f5ac554b1 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Wed, 11 Mar 2015 02:51:35 +0200 Subject: Staging: rtl8192u: Review phrase and fix spelling errors This patch removes some serious spelling errors and adds small improvements to the phrases in order to make them easier to understand. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 9d57c655ecde..dca5fa7f32ae 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -2122,20 +2122,20 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, return 0; } -/* following are for a simpler TX queue management. - * Instead of using netif_[stop/wake]_queue the driver - * will uses these two function (plus a reset one), that - * will internally uses the kernel netif_* and takes - * care of the ieee802.11 fragmentation. - * So the driver receives a fragment per time and might - * call the stop function when it want without take care - * to have enought room to TX an entire packet. - * This might be useful if each fragment need it's own - * descriptor, thus just keep a total free memory > than - * the max fragmentation treshold is not enought.. If the - * ieee802.11 stack passed a TXB struct then you needed +/* The following are for a simpler TX queue management. + * Instead of using netif_[stop/wake]_queue, the driver + * will use these two functions (plus a reset one) that + * will internally call the kernel netif_* and take care + * of the ieee802.11 fragmentation. + * So, the driver receives a fragment at a time and might + * call the stop function when it wants, without taking + * care to have enough room to TX an entire packet. + * This might be useful if each fragment needs its own + * descriptor. Thus, just keeping a total free memory > than + * the max fragmentation threshold is not enough. If the + * ieee802.11 stack passed a TXB struct, then you would need * to keep N free descriptors where - * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD + * N = MAX_PACKET_SIZE / MIN_FRAG_THRESHOLD. * In this way you need just one and the 802.11 stack * will take care of buffering fragments and pass them to * to the driver later, when it wakes the queue. -- cgit v1.2.3 From acc6539fe6293373ded751162e77c10f532336c6 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Wed, 11 Mar 2015 17:02:16 +0530 Subject: Staging: rtl8192u: Combine initialization using setup_timer The function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields. So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script. @@ expression E1, E2, E3; type T; @@ - init_timer(&E1); ... ( - E1.function = E2; ... - E1.data = (T)E3; + setup_timer(&E1, E2, (T)E3); | - E1.data = (T)E3; ... - E1.function = E2; + setup_timer(&E1, E2, (T)E3); | - E1.function = E2; + setup_timer(&E1, E2, 0); ) Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192u/ieee80211/ieee80211_module.c | 5 +- .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c | 55 +++++++--------------- drivers/staging/rtl8192u/r8192U_core.c | 5 +- drivers/staging/rtl8192u/r8192U_dm.c | 6 +-- 4 files changed, 24 insertions(+), 47 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 9a607253823c..31233d895ee9 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -133,9 +133,8 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ INIT_LIST_HEAD(&ieee->crypt_deinit_list); - init_timer(&ieee->crypt_deinit_timer); - ieee->crypt_deinit_timer.data = (unsigned long)ieee; - ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; + setup_timer(&ieee->crypt_deinit_timer, + ieee80211_crypt_deinit_handler, (unsigned long)ieee); spin_lock_init(&ieee->lock); spin_lock_init(&ieee->wpax_suitlist_lock); diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index acaa723817e7..0345f1caea54 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -156,26 +156,16 @@ void TSInitialize(struct ieee80211_device *ieee) pTxTS->num = count; // The timers for the operation of Traffic Stream and Block Ack. // DLS related timer will be add here in the future!! - init_timer(&pTxTS->TsCommonInfo.SetupTimer); - pTxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pTxTS; - pTxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut; - - init_timer(&pTxTS->TsCommonInfo.InactTimer); - pTxTS->TsCommonInfo.InactTimer.data = (unsigned long)pTxTS; - pTxTS->TsCommonInfo.InactTimer.function = TsInactTimeout; - - init_timer(&pTxTS->TsAddBaTimer); - pTxTS->TsAddBaTimer.data = (unsigned long)pTxTS; - pTxTS->TsAddBaTimer.function = TsAddBaProcess; - - init_timer(&pTxTS->TxPendingBARecord.Timer); - pTxTS->TxPendingBARecord.Timer.data = (unsigned long)pTxTS; - pTxTS->TxPendingBARecord.Timer.function = BaSetupTimeOut; - - init_timer(&pTxTS->TxAdmittedBARecord.Timer); - pTxTS->TxAdmittedBARecord.Timer.data = (unsigned long)pTxTS; - pTxTS->TxAdmittedBARecord.Timer.function = TxBaInactTimeout; - + setup_timer(&pTxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut, + (unsigned long)pTxTS); + setup_timer(&pTxTS->TsCommonInfo.InactTimer, TsInactTimeout, + (unsigned long)pTxTS); + setup_timer(&pTxTS->TsAddBaTimer, TsAddBaProcess, + (unsigned long)pTxTS); + setup_timer(&pTxTS->TxPendingBARecord.Timer, BaSetupTimeOut, + (unsigned long)pTxTS); + setup_timer(&pTxTS->TxAdmittedBARecord.Timer, + TxBaInactTimeout, (unsigned long)pTxTS); ResetTxTsEntry(pTxTS); list_add_tail(&pTxTS->TsCommonInfo.List, &ieee->Tx_TS_Unused_List); pTxTS++; @@ -189,23 +179,14 @@ void TSInitialize(struct ieee80211_device *ieee) { pRxTS->num = count; INIT_LIST_HEAD(&pRxTS->RxPendingPktList); - - init_timer(&pRxTS->TsCommonInfo.SetupTimer); - pRxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pRxTS; - pRxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut; - - init_timer(&pRxTS->TsCommonInfo.InactTimer); - pRxTS->TsCommonInfo.InactTimer.data = (unsigned long)pRxTS; - pRxTS->TsCommonInfo.InactTimer.function = TsInactTimeout; - - init_timer(&pRxTS->RxAdmittedBARecord.Timer); - pRxTS->RxAdmittedBARecord.Timer.data = (unsigned long)pRxTS; - pRxTS->RxAdmittedBARecord.Timer.function = RxBaInactTimeout; - - init_timer(&pRxTS->RxPktPendingTimer); - pRxTS->RxPktPendingTimer.data = (unsigned long)pRxTS; - pRxTS->RxPktPendingTimer.function = RxPktPendingTimeout; - + setup_timer(&pRxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut, + (unsigned long)pRxTS); + setup_timer(&pRxTS->TsCommonInfo.InactTimer, TsInactTimeout, + (unsigned long)pRxTS); + setup_timer(&pRxTS->RxAdmittedBARecord.Timer, + RxBaInactTimeout, (unsigned long)pRxTS); + setup_timer(&pRxTS->RxPktPendingTimer, RxPktPendingTimeout, + (unsigned long)pRxTS); ResetRxTsEntry(pRxTS); list_add_tail(&pRxTS->TsCommonInfo.List, &ieee->Rx_TS_Unused_List); pRxTS++; diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 8f7a3219eff1..b6cd7ea744ad 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2549,9 +2549,8 @@ static short rtl8192_init(struct net_device *dev) rtl8192_read_eeprom_info(dev); rtl8192_get_channel_map(dev); init_hal_dm(dev); - init_timer(&priv->watch_dog_timer); - priv->watch_dog_timer.data = (unsigned long)dev; - priv->watch_dog_timer.function = watch_dog_timer_callback; + setup_timer(&priv->watch_dog_timer, watch_dog_timer_callback, + (unsigned long)dev); if (rtl8192_usb_initendpoints(dev) != 0) { DMESG("Endopoints initialization failed"); return -ENOMEM; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 16cafcdb26c6..4c62cb8f0065 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2681,10 +2681,8 @@ static void dm_init_fsync(struct net_device *dev) priv->ieee80211->fsync_seconddiff_ratethreshold = 200; priv->ieee80211->fsync_state = Default_Fsync; priv->framesyncMonitor = 1; /* current default 0xc38 monitor on */ - - init_timer(&priv->fsync_timer); - priv->fsync_timer.data = (unsigned long)dev; - priv->fsync_timer.function = dm_fsync_timer_callback; + setup_timer(&priv->fsync_timer, dm_fsync_timer_callback, + (unsigned long)dev); } static void dm_deInit_fsync(struct net_device *dev) -- cgit v1.2.3 From 6c14378eca6f2f66438799e76845c3f2bbdafb57 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 12 Mar 2015 04:21:29 +0200 Subject: Staging: rtl8192u: Remove unnecessary variable This patch detects the cases in which a variable is not modified through the code and it is used as a return value. The variable is detected and removed by coccinelle using the following semantic patch: @@ type T; expression expr; identifier r; constant c; @@ -T r = expr; ... when != r when strict -return r; +return expr; Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index c322881d853b..69b0e3054186 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -471,12 +471,10 @@ static bool HTIOTActIsDisableMCS15(struct ieee80211_device *ieee) static bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device *ieee, u8 *PeerMacAddr) { - bool retValue = false; - #ifdef TODO // Apply for 819u only #endif - return retValue; + return false; } /******************************************************************************************************************** @@ -488,11 +486,8 @@ static bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device *ieee, * *****************************************************************************************************************/ static u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device *ieee, u8 *PeerMacAddr) -{ - u8 retValue = false; // default enable EDCA Turbo mode. - // Set specific EDCA parameter for different AP in DM handler. - - return retValue; +{ /* default enable EDCA Turbo mode. */ + return false; } /******************************************************************************************************************** -- cgit v1.2.3 From d064f3b03cc1670359e59ff8d24c4719f50c3b63 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 12 Mar 2015 04:30:04 +0200 Subject: Staging: rtl8192u: Remove unnecessary struct and typedef This patch removes the _bss_ht struct and the associated type definition because it is not used and it also introduces the warning: "WARNING: do not add new typedefs". Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index b6b862a2639f..0f53c6a97578 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -1457,24 +1457,6 @@ struct ether_header { #define ETHERTYPE_IP 0x0800 /* IP protocol */ #endif -typedef struct _bss_ht{ - - bool support_ht; - - // HT related elements - u8 ht_cap_buf[32]; - u16 ht_cap_len; - u8 ht_info_buf[32]; - u16 ht_info_len; - - HT_SPEC_VER ht_spec_ver; - //HT_CAPABILITY_ELE bdHTCapEle; - //HT_INFORMATION_ELE bdHTInfoEle; - - bool aggregation; - bool long_slot_time; -}bss_ht, *pbss_ht; - typedef enum _erp_t{ ERP_NonERPpresent = 0x01, ERP_UseProtection = 0x02, -- cgit v1.2.3 From 2a7089dbd1e8a9bec3d39efcb11c2eda6d5a95c0 Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Fri, 13 Mar 2015 16:58:42 +0900 Subject: staging: rtl8192u: remove break after return Remove "break" statement after a "return" statement as it does not get executed. Found by checkpatch.pl - break is not useful after a goto or return Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index dca5fa7f32ae..5f9ba77fa126 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -2115,7 +2115,6 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, break; default: return -1; - break; } //dev_kfree_skb_any(skb); -- cgit v1.2.3 From a0886f7303310525f032debdff85877356c9a7ab Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 13 Mar 2015 21:21:31 +0200 Subject: Staging: rtl8192u: Bool tests don't need comparisons This patch removes explicit true/false comparations to bool variables. Warning found by coccinelle: "WARNING: Comparison to bool" Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c | 5 ++--- drivers/staging/rtl8192u/r8192U_core.c | 2 +- drivers/staging/rtl8192u/r819xU_firmware.c | 6 +++--- drivers/staging/rtl8192u/r819xU_phy.c | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index 0345f1caea54..ea92fdebe5a7 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -269,7 +269,7 @@ static PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee, //for(dir = DIR_UP; dir <= DIR_BI_DIR; dir++) for(dir = 0; dir <= DIR_BI_DIR; dir++) { - if(search_dir[dir] ==false ) + if (!search_dir[dir]) continue; list_for_each_entry(pRet, psearch_list, List){ // IEEE80211_DEBUG(IEEE80211_DL_TS, "ADD:%pM, TID:%d, dir:%d\n", pRet->Addr, pRet->TSpec.f.TSInfo.field.ucTSID, pRet->TSpec.f.TSInfo.field.ucDirection); @@ -381,8 +381,7 @@ bool GetTs( } else { - if(bAddNewTs == false) - { + if (!bAddNewTs) { IEEE80211_DEBUG(IEEE80211_DL_TS, "add new TS failed(tid:%d)\n", UP); return false; } diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index b6cd7ea744ad..c6ff2f0a4dd8 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2823,7 +2823,7 @@ static bool rtl8192_adapter_start(struct net_device *dev) } dm_initialize_txpower_tracking(dev); - if (priv->bDcut == true) { + if (priv->bDcut) { u32 i, TempCCk; u32 tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord); for (i = 0; i < TxBBGainTableLength; i++) { diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index e208c899bc5e..d27b1e24ca4a 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -281,7 +281,7 @@ bool init_firmware(struct net_device *dev) if (rst_opt == OPT_SYSTEM_RESET) release_firmware(fw_entry); - if (rt_status != true) + if (!rt_status) goto download_firmware_fail; switch (init_step) { @@ -304,7 +304,7 @@ bool init_firmware(struct net_device *dev) /* Check Put Code OK and Turn On CPU */ rt_status = CPUcheck_maincodeok_turnonCPU(dev); - if (rt_status != true) { + if (!rt_status) { RT_TRACE(COMP_ERR, "CPUcheck_maincodeok_turnonCPU fail!\n"); goto download_firmware_fail; } @@ -318,7 +318,7 @@ bool init_firmware(struct net_device *dev) mdelay(1); rt_status = CPUcheck_firmware_ready(dev); - if (rt_status != true) { + if (!rt_status) { RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n",rt_status); goto download_firmware_fail; } diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 084e04fd15f8..3451ec75756c 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1099,7 +1099,7 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, if (eRFPowerState == priv->ieee80211->eRFPowerState) return false; - if (priv->SetRFPowerStateInProgress == true) + if (priv->SetRFPowerStateInProgress) return false; priv->SetRFPowerStateInProgress = true; -- cgit v1.2.3 From 2060f31ae58ea5510c432fed8a32bdef33ac4cd7 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 13 Mar 2015 20:50:52 +0300 Subject: Staging: rtl8192u: Remove parentheses around right side an assignment Parentheses are not needed around the right hand side of an assignment. This patch remove parenthese of such occurenses. Issue was detected and solved using the following coccinelle script: @rule1@ identifier x, y, z; expression E1, E2; @@ ( x = (y == z); | x = (E1 == E2); | x = -( ... -) ; ) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 4 ++-- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 12 ++++++------ drivers/staging/rtl8192u/r8192U_dm.c | 6 +++--- drivers/staging/rtl8192u/r819xU_phy.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 32177c62e440..788704b800c4 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -130,8 +130,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, (WLAN_FC_GET_STYPE(fc) & 0x08)); */ /* fixed by David :2006.9.6 */ - qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && - (WLAN_FC_GET_STYPE(fc) & 0x80)); + qc_included = (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && + (WLAN_FC_GET_STYPE(fc) & 0x80); aad_len = 22; if (a4_included) aad_len += 6; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 5f9ba77fa126..66b158714822 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -877,7 +877,7 @@ static struct sk_buff *ieee80211_assoc_resp(struct ieee80211_device *ieee, crypt = ieee->crypt[ieee->tx_keyidx]; else crypt = NULL; - encrypt = (crypt && crypt->ops); + encrypt = crypt && crypt->ops; if (encrypt) assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index c6ff2f0a4dd8..c3c06f1f0d55 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2078,10 +2078,10 @@ static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev) case RF_8225: case RF_8256: case RF_PSEUDO_11N: - ret = (WIRELESS_MODE_N_24G|WIRELESS_MODE_G|WIRELESS_MODE_B); + ret = WIRELESS_MODE_N_24G|WIRELESS_MODE_G|WIRELESS_MODE_B; break; case RF_8258: - ret = (WIRELESS_MODE_A|WIRELESS_MODE_N_5G); + ret = WIRELESS_MODE_A|WIRELESS_MODE_N_5G; break; default: ret = WIRELESS_MODE_B; @@ -2687,7 +2687,7 @@ static bool rtl8192_adapter_start(struct net_device *dev) read_nic_dword(dev, CPU_GEN, &dwRegRead); if (priv->LoopbackMode == RTL819xU_NO_LOOPBACK) - dwRegRead = ((dwRegRead & CPU_GEN_NO_LOOPBACK_MSK) | CPU_GEN_NO_LOOPBACK_SET); + dwRegRead = (dwRegRead & CPU_GEN_NO_LOOPBACK_MSK) | CPU_GEN_NO_LOOPBACK_SET; else if (priv->LoopbackMode == RTL819xU_MAC_LOOPBACK) dwRegRead |= CPU_CCK_LOOPBACK; else @@ -3643,7 +3643,7 @@ static u8 HwRateToMRate90(bool bIsHT, u8 rate) ret_rate = MGN_MCS15; break; case DESC90_RATEMCS32: - ret_rate = (0x80|0x20); + ret_rate = 0x80|0x20; break; default: @@ -4228,9 +4228,9 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, praddr = hdr->addr1; /* Check if the received packet is acceptable. */ - bpacket_match_bssid = ((IEEE80211_FTYPE_CTL != type) && + bpacket_match_bssid = (IEEE80211_FTYPE_CTL != type) && (eqMacAddr(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3)) - && (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV)); + && (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV); bpacket_toself = bpacket_match_bssid & (eqMacAddr(praddr, priv->ieee80211->dev->dev_addr)); if (WLAN_FC_GET_FRAMETYPE(fc) == IEEE80211_STYPE_BEACON) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 4c62cb8f0065..8669162a4a7d 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -717,7 +717,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) if (tmpCCK40Mindex >= CCK_Table_length) tmpCCK40Mindex = CCK_Table_length-1; } else { - tmpval = ((u8)tmpRegA - priv->ThermalMeter[0]); + tmpval = (u8)tmpRegA - priv->ThermalMeter[0]; if (tmpval >= 6) /* higher temperature */ tmpOFDMindex = tmpCCK20Mindex = 0; /* max to +6dB */ @@ -2270,10 +2270,10 @@ static void dm_check_edca_turbo( /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */ dm_init_edca_turbo(dev); u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; - u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| + u4bAcParam = (((u32)(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| (((u32)(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)| (((u32)(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)| - ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); + ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET); /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/ write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 3451ec75756c..a64c9fcfc46d 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -823,8 +823,8 @@ static void rtl8192_BB_Config_ParaFile(struct net_device *dev) write_nic_byte_E(dev, 0x5e, 0x00); if (priv->card_8192_version == (u8)VERSION_819xU_A) { /* Antenna gain offset from B/C/D to A */ - reg_u32 = (priv->AntennaTxPwDiff[1]<<4 | - priv->AntennaTxPwDiff[0]); + reg_u32 = priv->AntennaTxPwDiff[1]<<4 | + priv->AntennaTxPwDiff[0]; rtl8192_setBBreg(dev, rFPGA0_TxGainStage, (bXBTxAGC|bXCTxAGC), reg_u32); -- cgit v1.2.3 From f883c4ca5e6948de4fd461ca4a4fbb15aff8bbff Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Sun, 15 Mar 2015 12:42:52 +0900 Subject: staging: rtl8192u: remove return from end of void function This patch removes the return statement at the end of a void function as it is not necessary. found by checkpatch.pl: WARNING: void function return statements are not generally useful changes made using coccinelle script: @@ @@ ... when != if (...) return; when != if (...) { ... return;} -return; Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index c3c06f1f0d55..f6096568ffea 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -827,7 +827,6 @@ void rtl8192_rtx_disable(struct net_device *dev) netdev_warn(dev, "skb_queue not empty\n"); skb_queue_purge(&priv->skb_queue); - return; } inline u16 ieeerate2rtlrate(int rate) @@ -966,8 +965,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, ret = rtl8192_tx(dev, skb); spin_unlock_irqrestore(&priv->tx_lock, flags); - - return; } /* This is a rough attempt to TX a frame @@ -2067,7 +2064,6 @@ static void rtl8192_refresh_supportrate(struct r8192_priv *priv) memcpy(ieee->Regdot11HTOperationalRateSet, ieee->RegHTSuppRateSet, 16); else memset(ieee->Regdot11HTOperationalRateSet, 0, 16); - return; } static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev) @@ -2507,7 +2503,6 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) //we need init DIG RATR table here again. RT_TRACE(COMP_EPROM, "<===========%s()\n", __func__); - return; } static short rtl8192_get_channel_map(struct net_device *dev) -- cgit v1.2.3 From d40b62babcaea44a5f4fc3ab44f495c9dde8eee2 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 10 Mar 2015 15:14:58 +0530 Subject: staging: rtl8192e: remove unused functions removed some functions which were not being used anywhere. build tested and also verified by git grep that there is no other reference to these functions. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_HTProc.c | 154 ------------------------------ drivers/staging/rtl8192e/rtllib.h | 3 - 2 files changed, 157 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 165975ad4ce5..6157536e404a 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -117,160 +117,6 @@ void HTUpdateDefaultSetting(struct rtllib_device *ieee) pHTInfo->RxReorderPendingTime = 30; } -void HTDebugHTCapability(u8 *CapIE, u8 *TitleString) -{ - - static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; - struct ht_capab_ele *pCapELE; - - if (!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) { - RTLLIB_DEBUG(RTLLIB_DL_HT, "EWC IE in %s()\n", __func__); - pCapELE = (struct ht_capab_ele *)(&CapIE[4]); - } else - pCapELE = (struct ht_capab_ele *)(&CapIE[0]); - - RTLLIB_DEBUG(RTLLIB_DL_HT, ". Called by %s\n", - TitleString); - - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupported Channel Width = %s\n", - (pCapELE->ChlWidth) ? "20MHz" : "20/40MHz"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport Short GI for 20M = %s\n", - (pCapELE->ShortGI20Mhz) ? "YES" : "NO"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport Short GI for 40M = %s\n", - (pCapELE->ShortGI40Mhz) ? "YES" : "NO"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport TX STBC = %s\n", - (pCapELE->TxSTBC) ? "YES" : "NO"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMax AMSDU Size = %s\n", - (pCapELE->MaxAMSDUSize) ? "3839" : "7935"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport CCK in 20/40 mode = %s\n", - (pCapELE->DssCCk) ? "YES" : "NO"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMax AMPDU Factor = %d\n", - pCapELE->MaxRxAMPDUFactor); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMPDU Density = %d\n", - pCapELE->MPDUDensity); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMCS Rate Set = [%x][%x][%x][%x][%x]\n", - pCapELE->MCS[0], pCapELE->MCS[1], pCapELE->MCS[2], - pCapELE->MCS[3], pCapELE->MCS[4]); - return; - -} - -void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString) -{ - - static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; - struct ht_info_ele *pHTInfoEle; - - if (!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo))) { - RTLLIB_DEBUG(RTLLIB_DL_HT, "EWC IE in %s()\n", __func__); - pHTInfoEle = (struct ht_info_ele *)(&InfoIE[4]); - } else - pHTInfoEle = (struct ht_info_ele *)(&InfoIE[0]); - - - RTLLIB_DEBUG(RTLLIB_DL_HT, ". " - "Called by %s\n", TitleString); - - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tPrimary channel = %d\n", - pHTInfoEle->ControlChl); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSenondary channel ="); - switch (pHTInfoEle->ExtChlOffset) { - case 0: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Not Present\n"); - break; - case 1: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Upper channel\n"); - break; - case 2: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Reserved. Eooro!!!\n"); - break; - case 3: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Lower Channel\n"); - break; - } - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tRecommended channel width = %s\n", - (pHTInfoEle->RecommemdedTxWidth) ? "20Mhz" : "40Mhz"); - - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tOperation mode for protection = "); - switch (pHTInfoEle->OptMode) { - case 0: - RTLLIB_DEBUG(RTLLIB_DL_HT, "No Protection\n"); - break; - case 1: - RTLLIB_DEBUG(RTLLIB_DL_HT, "HT non-member protection mode\n"); - break; - case 2: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Suggest to open protection\n"); - break; - case 3: - RTLLIB_DEBUG(RTLLIB_DL_HT, "HT mixed mode\n"); - break; - } - - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tBasic MCS Rate Set = [%x][%x][%x][%x]" - "[%x]\n", pHTInfoEle->BasicMSC[0], pHTInfoEle->BasicMSC[1], - pHTInfoEle->BasicMSC[2], pHTInfoEle->BasicMSC[3], - pHTInfoEle->BasicMSC[4]); -} - -static bool IsHTHalfNmode40Bandwidth(struct rtllib_device *ieee) -{ - bool retValue = false; - struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; - - if (pHTInfo->bCurrentHTSupport == false) - retValue = false; - else if (pHTInfo->bRegBW40MHz == false) - retValue = false; - else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) - retValue = false; - else if (((struct ht_capab_ele *)(pHTInfo->PeerHTCapBuf))->ChlWidth) - retValue = true; - else - retValue = false; - - return retValue; -} - -static bool IsHTHalfNmodeSGI(struct rtllib_device *ieee, bool is40MHz) -{ - bool retValue = false; - struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; - - if (pHTInfo->bCurrentHTSupport == false) - retValue = false; - else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) - retValue = false; - else if (is40MHz) { - if (((struct ht_capab_ele *) - (pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) - retValue = true; - else - retValue = false; - } else { - if (((struct ht_capab_ele *) - (pHTInfo->PeerHTCapBuf))->ShortGI20Mhz) - retValue = true; - else - retValue = false; - } - - return retValue; -} - -u16 HTHalfMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate) -{ - - u8 is40MHz; - u8 isShortGI; - - is40MHz = (IsHTHalfNmode40Bandwidth(ieee)) ? 1 : 0; - isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz)) ? 1 : 0; - - return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)]; -} - - u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate) { struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index cef2dc27103f..94ef8d34469b 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -2882,8 +2882,6 @@ extern int rtllib_wx_get_rts(struct rtllib_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); #define MAX_RECEIVE_BUFFER_SIZE 9100 -extern void HTDebugHTCapability(u8 *CapIE, u8 *TitleString); -extern void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString); void HTSetConnectBwMode(struct rtllib_device *ieee, enum ht_channel_width Bandwidth, @@ -2910,7 +2908,6 @@ extern u16 MCS_DATA_RATE[2][2][77] ; extern u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame); extern void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo); extern bool IsHTHalfNmodeAPs(struct rtllib_device *ieee); -extern u16 HTHalfMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate); extern u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate); extern u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate); extern int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb); -- cgit v1.2.3 From 453ce99c26923a51740c0a4e19a75c4641b17a10 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Wed, 11 Mar 2015 03:06:30 +0200 Subject: Staging: rtl8192e: Remove unnecessary macro This patch removes the RTLLIB_PRINT_STR macro definition because it's only defined in the header and it's never referenced. It also removes PRINTABLE and MAX_STR_LEN, which were defined as helpers for the first one. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 94ef8d34469b..a62ec2224b16 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -784,26 +784,6 @@ do { \ #define RTLLIB_DEBUG_RX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_RX, f, ## a) #define RTLLIB_DEBUG_QOS(f, a...) RTLLIB_DEBUG(RTLLIB_DL_QOS, f, ## a) -/* Added by Annie, 2005-11-22. */ -#define MAX_STR_LEN 64 -/* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. */ -#define PRINTABLE(_ch) (_ch > '!' && _ch < '~') -#define RTLLIB_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ - if ((_Comp) & level) { \ - int __i; \ - u8 struct buffer[MAX_STR_LEN]; \ - int length = (_Len < MAX_STR_LEN) ? _Len : (MAX_STR_LEN-1) ;\ - memset(struct buffer, 0, MAX_STR_LEN); \ - memcpy(struct buffer, (u8 *)_Ptr, length); \ - for (__i = 0; __i < MAX_STR_LEN; __i++) { \ - if (!PRINTABLE(struct buffer[__i])) \ - struct buffer[__i] = '?'; \ - } \ - struct buffer[length] = '\0'; \ - printk(KERN_INFO "Rtl819x: "); \ - printk(_TitleString); \ - printk(": %d, <%s>\n", _Len, struct buffer); \ - } #ifndef ETH_P_PAE #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ #define ETH_P_IP 0x0800 /* Internet Protocol packet */ -- cgit v1.2.3 From 8b9733c1ad884548ba6417fee239e54693719f41 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 11 Mar 2015 13:51:36 +0530 Subject: Staging: rtl8192e: Eliminate use of MSECS macro Use msecs_to_jiffies instead of driver specific macro MSECS. This is done using Coccinelle and semantic patch used for this is as follows: @@expression t;@@ - MSECS(t) + msecs_to_jiffies(t) Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 13 +++++++------ drivers/staging/rtl8192e/rtl819x_BAProc.c | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 6 +++--- drivers/staging/rtl8192e/rtllib.h | 1 - drivers/staging/rtl8192e/rtllib_rx.c | 2 +- drivers/staging/rtl8192e/rtllib_softmac.c | 15 +++++++++------ 9 files changed, 29 insertions(+), 26 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 2e28744b9aab..6cb032660129 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -108,7 +108,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) u32 CPU_status = 0; unsigned long timeout; - timeout = jiffies + MSECS(200); + timeout = jiffies + msecs_to_jiffies(200); while (time_before(jiffies, timeout)) { CPU_status = read_nic_dword(dev, CPU_GEN); if (CPU_status & CPU_GEN_PUT_CODE_OK) @@ -128,7 +128,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) (u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff)); mdelay(1); - timeout = jiffies + MSECS(200); + timeout = jiffies + msecs_to_jiffies(200); while (time_before(jiffies, timeout)) { CPU_status = read_nic_dword(dev, CPU_GEN); if (CPU_status&CPU_GEN_BOOT_RDY) @@ -156,7 +156,7 @@ static bool CPUcheck_firmware_ready(struct net_device *dev) u32 CPU_status = 0; unsigned long timeout; - timeout = jiffies + MSECS(20); + timeout = jiffies + msecs_to_jiffies(20); while (time_before(jiffies, timeout)) { CPU_status = read_nic_dword(dev, CPU_GEN); if (CPU_status&CPU_GEN_FIRM_RDY) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index a603acc22d92..90ed03a4476b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1793,7 +1793,7 @@ void watch_dog_timer_callback(unsigned long data) queue_delayed_work_rsl(priv->priv_wq, &priv->watch_dog_wq, 0); mod_timer(&priv->watch_dog_timer, jiffies + - MSECS(RTLLIB_WATCH_DOG_TIME)); + msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME)); } /**************************************************************************** @@ -3106,7 +3106,7 @@ void check_rfctrl_gpio_timer(unsigned long data) queue_delayed_work_rsl(priv->priv_wq, &priv->gpio_change_rf_wq, 0); mod_timer(&priv->gpio_polling_timer, jiffies + - MSECS(RTLLIB_WATCH_DOG_TIME)); + msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME)); } /*************************************************************************** diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index bdb9274486dc..91794aea56eb 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -2665,14 +2665,14 @@ void dm_fsync_timer_callback(unsigned long data) if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); priv->fsync_timer.expires = jiffies + - MSECS(priv->rtllib->fsync_time_interval * + msecs_to_jiffies(priv->rtllib->fsync_time_interval * priv->rtllib->fsync_multiple_timeinterval); add_timer(&priv->fsync_timer); } else { if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); priv->fsync_timer.expires = jiffies + - MSECS(priv->rtllib->fsync_time_interval); + msecs_to_jiffies(priv->rtllib->fsync_time_interval); add_timer(&priv->fsync_timer); } } else { @@ -2762,7 +2762,7 @@ static void dm_StartSWFsync(struct net_device *dev) if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); priv->fsync_timer.expires = jiffies + - MSECS(priv->rtllib->fsync_time_interval); + msecs_to_jiffies(priv->rtllib->fsync_time_interval); add_timer(&priv->fsync_timer); write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 4856b76292f9..cbd2405df91b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -67,7 +67,8 @@ void rtl8192_hw_wakeup(struct net_device *dev) RT_TRACE(COMP_DBG, "rtl8192_hw_wakeup(): RF Change in " "progress!\n"); queue_delayed_work_rsl(priv->rtllib->wq, - &priv->rtllib->hw_wakeup_wq, MSECS(10)); + &priv->rtllib->hw_wakeup_wq, + msecs_to_jiffies(10)); return; } spin_unlock_irqrestore(&priv->rf_ps_lock, flags); @@ -95,18 +96,18 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time) spin_lock_irqsave(&priv->ps_lock, flags); - time -= MSECS(8+16+7); + time -= msecs_to_jiffies(8 + 16 + 7); - if ((time - jiffies) <= MSECS(MIN_SLEEP_TIME)) { + if ((time - jiffies) <= msecs_to_jiffies(MIN_SLEEP_TIME)) { spin_unlock_irqrestore(&priv->ps_lock, flags); printk(KERN_INFO "too short to sleep::%lld < %ld\n", - time - jiffies, MSECS(MIN_SLEEP_TIME)); + time - jiffies, msecs_to_jiffies(MIN_SLEEP_TIME)); return; } - if ((time - jiffies) > MSECS(MAX_SLEEP_TIME)) { + if ((time - jiffies) > msecs_to_jiffies(MAX_SLEEP_TIME)) { printk(KERN_INFO "========>too long to sleep:%lld > %ld\n", - time - jiffies, MSECS(MAX_SLEEP_TIME)); + time - jiffies, msecs_to_jiffies(MAX_SLEEP_TIME)); spin_unlock_irqrestore(&priv->ps_lock, flags); return; } diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 0415e02b4eff..03e2a827a2cd 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -26,7 +26,7 @@ static void ActivateBAEntry(struct rtllib_device *ieee, struct ba_record *pBA, { pBA->bValid = true; if (Time != 0) - mod_timer(&pBA->Timer, jiffies + MSECS(Time)); + mod_timer(&pBA->Timer, jiffies + msecs_to_jiffies(Time)); } static void DeActivateBAEntry(struct rtllib_device *ieee, struct ba_record *pBA) diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 294847d1a903..c51f7e0650ee 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -91,7 +91,7 @@ static void RxPktPendingTimeout(unsigned long data) if (bPktInBuf && (pRxTs->RxTimeoutIndicateSeq == 0xffff)) { pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq; mod_timer(&pRxTs->RxPktPendingTimer, jiffies + - MSECS(ieee->pHTInfo->RxReorderPendingTime)); + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); } @@ -223,7 +223,7 @@ static void AdmitTS(struct rtllib_device *ieee, if (InactTime != 0) mod_timer(&pTsCommonInfo->InactTimer, jiffies + - MSECS(InactTime)); + msecs_to_jiffies(InactTime)); } static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee, @@ -542,7 +542,7 @@ void TsStartAddBaProcess(struct rtllib_device *ieee, struct tx_ts_record *pTxTS) RTLLIB_DEBUG(RTLLIB_DL_BA, "TsStartAddBaProcess(): " "Delayed Start ADDBA after 60 sec!!\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies + - MSECS(TS_ADDBA_DELAY)); + msecs_to_jiffies(TS_ADDBA_DELAY)); } else { RTLLIB_DEBUG(RTLLIB_DL_BA, "TsStartAddBaProcess(): " "Immediately Start ADDBA now!!\n"); diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index a62ec2224b16..8095ec2c4a63 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -525,7 +525,6 @@ struct ieee_param { #define IW_QUAL_NOISE_UPDATED 0x4 #endif -#define MSECS(t) msecs_to_jiffies(t) #define msleep_interruptible_rsl msleep_interruptible #define RTLLIB_DATA_LEN 2304 diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index e8261aec919f..c1085a5907a2 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -717,7 +717,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, __func__); pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq; mod_timer(&pTS->RxPktPendingTimer, jiffies + - MSECS(pHTInfo->RxReorderPendingTime)); + msecs_to_jiffies(pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); } diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index c246ef40c69e..bee4b4398f2f 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -401,7 +401,7 @@ static void rtllib_send_beacon(struct rtllib_device *ieee) if (ieee->beacon_txing && ieee->ieee_up) mod_timer(&ieee->beacon_timer, jiffies + - (MSECS(ieee->current_network.beacon_interval - 5))); + (msecs_to_jiffies(ieee->current_network.beacon_interval - 5))); } @@ -639,7 +639,7 @@ static void rtllib_softmac_scan_wq(void *data) rtllib_send_probe_requests(ieee, 0); queue_delayed_work_rsl(ieee->wq, &ieee->softmac_scan_wq, - MSECS(RTLLIB_SOFTMAC_SCAN_TIME)); + msecs_to_jiffies(RTLLIB_SOFTMAC_SCAN_TIME)); up(&ieee->scan_sem); return; @@ -2008,9 +2008,11 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) if (dtim & (RTLLIB_DTIM_UCAST & ieee->ps)) return 2; - if (!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))) + if (!time_after(jiffies, + ieee->dev->trans_start + msecs_to_jiffies(timeout))) return 0; - if (!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))) + if (!time_after(jiffies, + ieee->last_rx_ps_time + msecs_to_jiffies(timeout))) return 0; if ((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE) && (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) @@ -2060,7 +2062,7 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) } *time = ieee->current_network.last_dtim_sta_time - + MSECS(ieee->current_network.beacon_interval * + + msecs_to_jiffies(ieee->current_network.beacon_interval * LPSAwakeIntvl_tmp); } } @@ -2808,7 +2810,8 @@ static void rtllib_start_ibss_wq(void *data) inline void rtllib_start_ibss(struct rtllib_device *ieee) { - queue_delayed_work_rsl(ieee->wq, &ieee->start_ibss_wq, MSECS(150)); + queue_delayed_work_rsl(ieee->wq, &ieee->start_ibss_wq, + msecs_to_jiffies(150)); } /* this is called only in user context, with wx_sem held */ -- cgit v1.2.3 From e623d0f3f92960a826ae30dc861165f21752cdc8 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 12 Mar 2015 04:22:38 +0200 Subject: Staging: rtl8192e: Remove unnecessary variables This patch removes unnecessary intermediary variables in return lines and uses actual values. Found by coccinelle using this semantic patch: @@ type T; expression expr; identifier r; @@ -T r = expr; ... when != r when strict -return r; +return expr; Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl819x_HTProc.c | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 6cb032660129..fa9c08101fff 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -36,7 +36,6 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buffer_len) { struct r8192_priv *priv = rtllib_priv(dev); - bool rt_status = true; u16 frag_threshold; u16 frag_length, frag_offset = 0; int i; @@ -99,7 +98,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, write_nic_byte(dev, TPPoll, TPPoll_CQ); - return rt_status; + return true; } static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 90ed03a4476b..51c21da98f60 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -3059,7 +3059,6 @@ bool NicIFEnableNIC(struct net_device *dev) } bool NicIFDisableNIC(struct net_device *dev) { - bool status = true; struct r8192_priv *priv = rtllib_priv(dev); u8 tmp_state = 0; @@ -3074,7 +3073,7 @@ bool NicIFDisableNIC(struct net_device *dev) priv->ops->stop_adapter(dev, false); RT_TRACE(COMP_PS, "<=========%s()\n", __func__); - return status; + return true; } static int __init rtl8192_pci_module_init(void) diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 6157536e404a..1af4191feb4f 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -232,9 +232,7 @@ static u8 HTIOTActIsDisableMCS14(struct rtllib_device *ieee, u8 *PeerMacAddr) static bool HTIOTActIsDisableMCS15(struct rtllib_device *ieee) { - bool retValue = false; - - return retValue; + return false; } static bool HTIOTActIsDisableMCSTwoSpatialStream(struct rtllib_device *ieee) -- cgit v1.2.3 From 26049b11cb4dbe92243c9db5fd35ce7711d9b6bc Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Fri, 13 Mar 2015 16:58:41 +0900 Subject: staging: rtl8192e: remove break after return Remove "break" statement after a "return" statement as it does not get executed. Found by checkpatch.pl - break is not useful after a goto or return Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 1 - drivers/staging/rtl8192e/rtllib_softmac.c | 1 - 2 files changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index cd3c662eba2b..a369a1f28ee5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -920,7 +920,6 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip); return false; - break; } diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index bee4b4398f2f..392bdf513ae2 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2452,7 +2452,6 @@ inline int rtllib_rx_frame_softmac(struct rtllib_device *ieee, break; default: return -1; - break; } return 0; } -- cgit v1.2.3 From 44acc6b524d77c86ccfc18fb036dfb2b70a905c0 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 13 Mar 2015 21:19:24 +0200 Subject: Staging: rtl8192e: Bool tests don't need comparisons This patch removes comparisons to true/false values on bool variables. Warning found by coccinelle: "WARNING: Comparison to bool". Signed-off-by: Cristina Opriceana Acked-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index c233a1c1bb31..9e65c326dbdc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -67,7 +67,7 @@ static int r8192_wx_set_rate(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -87,7 +87,7 @@ static int r8192_wx_set_rts(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -115,7 +115,7 @@ static int r8192_wx_set_power(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) { + if (priv->bHwRadioOff) { RT_TRACE(COMP_ERR, "%s():Hw is Radio Off, we can't set " "Power,return\n", __func__); return 0; @@ -145,7 +145,7 @@ static int r8192_wx_set_rawtx(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); int ret; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -308,7 +308,7 @@ static int r8192_wx_set_debugflag(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); u8 c = *extra; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; printk(KERN_INFO "=====>%s(), *extra:%x, debugflag:%x\n", __func__, @@ -329,7 +329,7 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, enum rt_rf_power_state rtState; int ret; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; rtState = priv->rtllib->eRFPowerState; down(&priv->wx_sem); @@ -470,7 +470,7 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, return 0; } - if (priv->bHwRadioOff == true) { + if (priv->bHwRadioOff) { printk(KERN_INFO "================>%s(): hwradio off\n", __func__); return 0; @@ -552,7 +552,7 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a, if (!priv->up) return -ENETDOWN; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; @@ -572,7 +572,7 @@ static int r8192_wx_set_essid(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); int ret; - if (priv->bHwRadioOff == true) { + if (priv->bHwRadioOff) { printk(KERN_INFO "=========>%s():hw radio off,or Rf state is " "eRfOff, return\n", __func__); return 0; @@ -638,7 +638,7 @@ static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -665,7 +665,7 @@ static int r8192_wx_set_frag(struct net_device *dev, { struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; if (wrqu->frag.disabled) @@ -704,7 +704,7 @@ static int r8192_wx_set_wap(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -754,7 +754,7 @@ static int r8192_wx_set_enc(struct net_device *dev, {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} }; int i; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; if (!priv->up) @@ -843,7 +843,7 @@ static int r8192_wx_set_scan_type(struct net_device *dev, int *parms = (int *)p; int mode = parms[0]; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; priv->rtllib->active_scan = mode; @@ -861,7 +861,7 @@ static int r8192_wx_set_retry(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); int err = 0; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -944,7 +944,7 @@ static int r8192_wx_set_sens(struct net_device *dev, short err = 0; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -971,7 +971,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -1052,7 +1052,7 @@ static int r8192_wx_set_auth(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -1070,7 +1070,7 @@ static int r8192_wx_set_mlme(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -1087,7 +1087,7 @@ static int r8192_wx_set_gen_ie(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); -- cgit v1.2.3 From 789fd7adf55714cba7d192c84377e6e1feaa23d0 Mon Sep 17 00:00:00 2001 From: Mike Krinkin Date: Sun, 8 Mar 2015 20:14:07 +0300 Subject: staging: rtl8188eu: use %pM specifier instead of passing direct values The patch converts code to use %pM specifier instead of pushing each byte via stack. Signed-off-by: Mike Krinkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/usb_halinit.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 122e9b37aa79..7b01d5aa6b23 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -1096,10 +1096,8 @@ static void Hal_EfuseParseMACAddr_8188EU(struct adapter *adapt, u8 *hwinfo, bool memcpy(eeprom->mac_addr, &hwinfo[EEPROM_MAC_ADDR_88EU], ETH_ALEN); } RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, - ("Hal_EfuseParseMACAddr_8188EU: Permanent Address = %02x-%02x-%02x-%02x-%02x-%02x\n", - eeprom->mac_addr[0], eeprom->mac_addr[1], - eeprom->mac_addr[2], eeprom->mac_addr[3], - eeprom->mac_addr[4], eeprom->mac_addr[5])); + ("Hal_EfuseParseMACAddr_8188EU: Permanent Address = %pM\n", + eeprom->mac_addr)); } static void -- cgit v1.2.3 From e7b1269db01bc8c795c19381b69d7524bb31ef99 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Mon, 9 Mar 2015 15:43:25 +0200 Subject: drivers: staging: rtl8188eu: core: rtw_security: Fix misspelled word This patch fixes the checkpatch.pl warning: WARNING: 'halfs' may be misspelled - perhaps 'halves'? Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_security.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c b/drivers/staging/rtl8188eu/core/rtw_security.c index cc66997da262..d870a5ce8585 100644 --- a/drivers/staging/rtl8188eu/core/rtw_security.c +++ b/drivers/staging/rtl8188eu/core/rtw_security.c @@ -854,7 +854,7 @@ static void mix_column(u8 *in, u8 *out) u8 add1b[4]; u8 add1bf7[4]; u8 rotl[4]; - u8 swap_halfs[4]; + u8 swap_halves[4]; u8 andf7[4]; u8 rotr[4]; u8 temp[4]; @@ -866,10 +866,10 @@ static void mix_column(u8 *in, u8 *out) add1b[i] = 0x00; } - swap_halfs[0] = in[2]; /* Swap halves */ - swap_halfs[1] = in[3]; - swap_halfs[2] = in[0]; - swap_halfs[3] = in[1]; + swap_halves[0] = in[2]; /* Swap halves */ + swap_halves[1] = in[3]; + swap_halves[2] = in[0]; + swap_halves[3] = in[1]; rotl[0] = in[3]; /* Rotate left 8 bits */ rotl[1] = in[0]; @@ -900,7 +900,7 @@ static void mix_column(u8 *in, u8 *out) rotr[3] = temp[0]; xor_32(add1bf7, rotr, temp); - xor_32(swap_halfs, rotl, tempb); + xor_32(swap_halves, rotl, tempb); xor_32(temp, tempb, out); } -- cgit v1.2.3 From 4d4efe3e95805982b1d8f3f54203c67ba6687338 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 11 Mar 2015 11:41:07 +0530 Subject: Staging: rtl8188eu: Eliminate use of _set_timer This patch introduces the use of API function mod_timer instead of driver specific function _set_timer as it is a more efficient and standard way to update the expire field of an active timer. Also, definition of function _set_timer is removed as it is no longer needed after this change. Here, these cases are handled using Coccinelle and semantic patch used for this is as follows: @@ expression x; expression y;@@ - _set_timer (&x, y); + mod_timer (&x, jiffies + msecs_to_jiffies (y)); Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 18 ++++--- drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 3 +- drivers/staging/rtl8188eu/core/rtw_led.c | 59 +++++++++++++++-------- drivers/staging/rtl8188eu/core/rtw_mlme.c | 15 ++++-- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 7 +-- drivers/staging/rtl8188eu/core/rtw_recv.c | 6 ++- drivers/staging/rtl8188eu/include/osdep_service.h | 5 -- drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 10 ++-- drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 5 +- drivers/staging/rtl8188eu/include/rtw_recv.h | 4 +- drivers/staging/rtl8188eu/os_dep/os_intfs.c | 6 ++- 11 files changed, 82 insertions(+), 56 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 4b4346244953..89b5e48ed68a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -325,7 +325,8 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, if (res == _SUCCESS) { pmlmepriv->scan_start_time = jiffies; - _set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT); + mod_timer(&pmlmepriv->scan_to_timer, + jiffies + msecs_to_jiffies(SCANNING_TIMEOUT)); rtw_led_control(padapter, LED_CTL_SITE_SURVEY); @@ -1234,9 +1235,11 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* need to make timeout handlerOS independent */ - _set_timer(&pmlmepriv->scan_to_timer, 1); + mod_timer(&pmlmepriv->scan_to_timer, + jiffies + msecs_to_jiffies(1)); } else if (pcmd->res != H2C_SUCCESS) { - _set_timer(&pmlmepriv->scan_to_timer, 1); + mod_timer(&pmlmepriv->scan_to_timer, + jiffies + msecs_to_jiffies(1)); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: MgntActrtw_set_802_11_bssid_LIST_SCAN Fail ************\n\n.")); } @@ -1270,10 +1273,12 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* need to make timeout handlerOS independent */ - _set_timer(&pmlmepriv->assoc_timer, 1); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(1)); } else if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("********Error:rtw_select_and_join_from_scanned_queue Wait Sema Fail ************\n")); - _set_timer(&pmlmepriv->assoc_timer, 1); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(1)); } rtw_free_cmd_obj(pcmd); @@ -1291,7 +1296,8 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n.")); - _set_timer(&pmlmepriv->assoc_timer, 1); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(1)); } del_timer_sync(&pmlmepriv->assoc_timer); diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c index 2faf6b2e8129..969150a48661 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c @@ -86,7 +86,8 @@ u8 rtw_do_join(struct adapter *padapter) select_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv); if (select_ret == _SUCCESS) { pmlmepriv->to_join = false; - _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); } else { if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) { /* submit createbss_cmd to change to a ADHOC_MASTER */ diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c b/drivers/staging/rtl8188eu/core/rtw_led.c index 1b8264b978da..e8b82b2f8423 100644 --- a/drivers/staging/rtl8188eu/core/rtw_led.c +++ b/drivers/staging/rtl8188eu/core/rtw_led.c @@ -122,14 +122,16 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); break; case LED_BLINK_NORMAL: if (pLed->bLedOn) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); break; case LED_BLINK_SCAN: pLed->BlinkTimes--; @@ -143,7 +145,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->bLedNoLinkBlinkInProgress = true; @@ -152,7 +155,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); } pLed->bLedScanBlinkInProgress = false; @@ -161,7 +165,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_BLINK_TXRX: @@ -176,7 +181,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->bLedNoLinkBlinkInProgress = true; @@ -185,7 +191,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); } pLed->BlinkTimes = 0; @@ -195,7 +202,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_BLINK_WPS: @@ -203,7 +211,8 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); break; case LED_BLINK_WPS_STOP: /* WPS success */ if (pLed->BlinkingLedState == RTW_LED_ON) @@ -218,14 +227,15 @@ static void SwLedBlink1(struct LED_871x *pLed) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); pLed->bLedWPSBlinkInProgress = false; } else { pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA)); } break; default: @@ -262,7 +272,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); } break; case LED_CTL_LINK: @@ -283,7 +294,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA)); } break; case LED_CTL_SITE_SURVEY: @@ -311,7 +323,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_CTL_TX: @@ -334,7 +347,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); } break; case LED_CTL_START_WPS: /* wait until xinpin finish */ @@ -362,7 +376,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); } break; case LED_CTL_STOP_WPS: @@ -389,11 +404,12 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct pLed->CurrLedState = LED_BLINK_WPS_STOP; if (pLed->bLedOn) { pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), - LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA)); } else { pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), 0); + mod_timer(&pLed->BlinkTimer, + jiffies + msecs_to_jiffies(0)); } break; case LED_CTL_STOP_WPS_FAIL: @@ -407,7 +423,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); + mod_timer(&pLed->BlinkTimer, jiffies + + msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); break; case LED_CTL_POWER_OFF: pLed->CurrLedState = RTW_LED_OFF; diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index d4632da50c1d..f0066791ade4 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -665,7 +665,8 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) set_fwstate(pmlmepriv, _FW_UNDER_LINKING); if (rtw_select_and_join_from_scanned_queue(pmlmepriv) == _SUCCESS) { - _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); } else { struct wlan_bssid_ex *pdev_network = &(adapter->registrypriv.dev_network); u8 *pibss = adapter->registrypriv.dev_network.MacAddress; @@ -692,7 +693,8 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) pmlmepriv->to_join = false; s_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv); if (_SUCCESS == s_ret) { - _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); } else if (s_ret == 2) { /* there is no need to wait for join */ _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); rtw_indicate_connect(adapter); @@ -1127,14 +1129,16 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) } else if (pnetwork->join_res == -4) { rtw_reset_securitypriv(adapter); - _set_timer(&pmlmepriv->assoc_timer, 1); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(1)); if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == true) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("fail! clear _FW_UNDER_LINKING ^^^fw_state=%x\n", get_fwstate(pmlmepriv))); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); } } else { /* if join_res < 0 (join fails), then try again */ - _set_timer(&pmlmepriv->assoc_timer, 1); + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(1)); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); } @@ -1449,7 +1453,8 @@ void rtw_dynamic_check_timer_handlder(void *function_context) rtw_auto_scan_handler(adapter); } exit: - _set_timer(&adapter->mlmepriv.dynamic_chk_timer, 2000); + mod_timer(&adapter->mlmepriv.dynamic_chk_timer, + jiffies + msecs_to_jiffies(2000)); } #define RTW_SCAN_RESULT_EXPIRE 2000 diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index cd12dd70dd88..e496276eb1e8 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -3972,8 +3972,8 @@ void start_clnt_join(struct adapter *padapter) /* and enable a timer */ beacon_timeout = decide_wait_for_beacon_timeout(pmlmeinfo->bcn_interval); set_link_timer(pmlmeext, beacon_timeout); - _set_timer(&padapter->mlmepriv.assoc_timer, - (REAUTH_TO * REAUTH_LIMIT) + (REASSOC_TO*REASSOC_LIMIT) + beacon_timeout); + mod_timer(&padapter->mlmepriv.assoc_timer, jiffies + + msecs_to_jiffies((REAUTH_TO * REAUTH_LIMIT) + (REASSOC_TO * REASSOC_LIMIT) + beacon_timeout)); pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE; } else if (caps&cap_IBSS) { /* adhoc client */ @@ -5406,7 +5406,8 @@ u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf) if (((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && (pmlmeinfo->HT_enable)) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { issue_action_BA(padapter, pparm->addr, RTW_WLAN_ACTION_ADDBA_REQ, (u16)pparm->tid); - _set_timer(&psta->addba_retry_timer, ADDBA_TO); + mod_timer(&psta->addba_retry_timer, + jiffies + msecs_to_jiffies(ADDBA_TO)); } else { psta->htpriv.candidate_tid_bitmap &= ~BIT(pparm->tid); } diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index bd79e9e7105a..0db421e7b084 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -1927,7 +1927,8 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, /* recv_indicatepkts_in_order(padapter, preorder_ctrl, true); */ if (recv_indicatepkts_in_order(padapter, preorder_ctrl, false)) { - _set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); + mod_timer(&preorder_ctrl->reordering_ctrl_timer, + jiffies + msecs_to_jiffies(REORDER_WAIT_TIME)); spin_unlock_bh(&ppending_recvframe_queue->lock); } else { spin_unlock_bh(&ppending_recvframe_queue->lock); @@ -1957,7 +1958,8 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext) spin_lock_bh(&ppending_recvframe_queue->lock); if (recv_indicatepkts_in_order(padapter, preorder_ctrl, true) == true) - _set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); + mod_timer(&preorder_ctrl->reordering_ctrl_timer, + jiffies + msecs_to_jiffies(REORDER_WAIT_TIME)); spin_unlock_bh(&ppending_recvframe_queue->lock); } diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index 3a274770364b..4c968acc7fd4 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -85,11 +85,6 @@ static inline void _init_timer(struct timer_list *ptimer, init_timer(ptimer); } -static inline void _set_timer(struct timer_list *ptimer, u32 delay_time) -{ - mod_timer(ptimer , (jiffies+msecs_to_jiffies(delay_time))); -} - #define RTW_TIMER_HDL_ARGS void *FunctionContext #define RTW_TIMER_HDL_NAME(name) rtw_##name##_timer_hdl #define RTW_DECLARE_TIMER_HDL(name) \ diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h index 4f05aee93c9c..51c9173af1bb 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h @@ -650,14 +650,12 @@ void link_timer_hdl(void *funtion_context); void addba_timer_hdl(void *function_context); #define set_survey_timer(mlmeext, ms) \ - do { \ - _set_timer(&(mlmeext)->survey_timer, (ms)); \ - } while (0) + mod_timer(&mlmeext->survey_timer, jiffies + \ + msecs_to_jiffies(ms)) #define set_link_timer(mlmeext, ms) \ - do { \ - _set_timer(&(mlmeext)->link_timer, (ms)); \ - } while (0) + mod_timer(&mlmeext->link_timer, jiffies + \ + msecs_to_jiffies(ms)) int cckrates_included(unsigned char *rate, int ratelen); int cckratesonly_included(unsigned char *rate, int ratelen); diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index 54dfbf07564b..aa1fd87c47fb 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -233,9 +233,8 @@ struct pwrctrl_priv { #define RTW_PWR_STATE_CHK_INTERVAL 2000 #define _rtw_set_pwr_state_check_timer(pwrctrlpriv, ms) \ - do { \ - _set_timer(&(pwrctrlpriv)->pwr_state_check_timer, (ms)); \ - } while (0) + mod_timer(&pwrctrlpriv->pwr_state_check_timer, \ + jiffies + msecs_to_jiffies(ms)) #define rtw_set_pwr_state_check_timer(pwrctrl) \ _rtw_set_pwr_state_check_timer((pwrctrl), \ diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h index f0c26ef8f66a..241a8711ffad 100644 --- a/drivers/staging/rtl8188eu/include/rtw_recv.h +++ b/drivers/staging/rtl8188eu/include/rtw_recv.h @@ -216,8 +216,8 @@ struct recv_priv { }; #define rtw_set_signal_stat_timer(recvpriv) \ - _set_timer(&(recvpriv)->signal_stat_timer, \ - (recvpriv)->signal_stat_sampling_interval) + mod_timer(&(recvpriv)->signal_stat_timer, jiffies + \ + msecs_to_jiffies((recvpriv)->signal_stat_sampling_interval)) struct sta_recv_priv { spinlock_t lock; diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index 88a909c9e457..5fe3ae5e3123 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -998,7 +998,8 @@ int _netdev_open(struct net_device *pnetdev) } padapter->net_closed = false; - _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); + mod_timer(&padapter->mlmepriv.dynamic_chk_timer, + jiffies + msecs_to_jiffies(2000)); padapter->pwrctrlpriv.bips_processing = false; rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); @@ -1052,7 +1053,8 @@ static int ips_netdrv_open(struct adapter *padapter) padapter->intf_start(padapter); rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); - _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 5000); + mod_timer(&padapter->mlmepriv.dynamic_chk_timer, + jiffies + msecs_to_jiffies(5000)); return _SUCCESS; -- cgit v1.2.3 From 28af7ea81e161eadb48051ec0e280666e925ccd8 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 11 Mar 2015 11:41:24 +0530 Subject: Staging: rtl8188eu: Eliminate use of _init_timer This patch introduces the use of API function setup_timer instead of driver specific function init_timer as it is the preferred and standard way to set and setup the timer. To be compatible with the changes, argument types of referenced functions are changed. Also, definition of function _init_timer is removed as it is no longer needed after this change. Here, these cases are handled using Coccinelle and semantic patch used for this is as follows: @@ expression x, y; identifier a, b;@@ - _init_timer (&x, y, a, b); + setup_timer (&x, a, (unsigned long)b); Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_led.c | 7 ++++--- drivers/staging/rtl8188eu/core/rtw_mlme.c | 12 ++++++------ drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 12 ++++++------ drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 8 +++++--- drivers/staging/rtl8188eu/core/rtw_recv.c | 14 ++++++++------ drivers/staging/rtl8188eu/include/osdep_service.h | 9 --------- drivers/staging/rtl8188eu/include/rtw_led.h | 2 +- drivers/staging/rtl8188eu/include/rtw_mlme.h | 6 +++--- drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 6 +++--- drivers/staging/rtl8188eu/include/rtw_recv.h | 2 +- drivers/staging/rtl8188eu/os_dep/mlme_linux.c | 18 ++++++++++++------ drivers/staging/rtl8188eu/os_dep/recv_linux.c | 5 +++-- 12 files changed, 52 insertions(+), 49 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c b/drivers/staging/rtl8188eu/core/rtw_led.c index e8b82b2f8423..94405dc44220 100644 --- a/drivers/staging/rtl8188eu/core/rtw_led.c +++ b/drivers/staging/rtl8188eu/core/rtw_led.c @@ -22,9 +22,9 @@ /* Callback function of LED BlinkTimer, */ /* it just schedules to corresponding BlinkWorkItem/led_blink_hdl */ /* */ -void BlinkTimerCallback(void *data) +void BlinkTimerCallback(unsigned long data) { - struct LED_871x *pLed = data; + struct LED_871x *pLed = (struct LED_871x *)data; struct adapter *padapter = pLed->padapter; if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped)) @@ -72,7 +72,8 @@ void InitLed871x(struct adapter *padapter, struct LED_871x *pLed) ResetLedStatus(pLed); - _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed); + setup_timer(&(pLed->BlinkTimer), BlinkTimerCallback, + (unsigned long)pLed); INIT_WORK(&(pLed->BlinkWorkItem), BlinkWorkItemCallback); } diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index f0066791ade4..bd87b7d79cb4 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -1364,9 +1364,9 @@ void rtw_cpwm_event_callback(struct adapter *padapter, u8 *pbuf) * _rtw_join_timeout_handler - Timeout/faliure handler for CMD JoinBss * @adapter: pointer to struct adapter structure */ -void _rtw_join_timeout_handler (void *function_context) +void _rtw_join_timeout_handler (unsigned long data) { - struct adapter *adapter = function_context; + struct adapter *adapter = (struct adapter *)data; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; int do_join_r; @@ -1406,9 +1406,9 @@ void _rtw_join_timeout_handler (void *function_context) * rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey * @adapter: pointer to struct adapter structure */ -void rtw_scan_timeout_handler (void *function_context) +void rtw_scan_timeout_handler (unsigned long data) { - struct adapter *adapter = function_context; + struct adapter *adapter = (struct adapter *)data; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; DBG_88E(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv)); @@ -1433,9 +1433,9 @@ static void rtw_auto_scan_handler(struct adapter *padapter) } } -void rtw_dynamic_check_timer_handlder(void *function_context) +void rtw_dynamic_check_timer_handlder(unsigned long data) { - struct adapter *adapter = (struct adapter *)function_context; + struct adapter *adapter = (struct adapter *)data; struct registry_priv *pregistrypriv = &adapter->registrypriv; if (!adapter) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index e496276eb1e8..ec808604a7a2 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -4835,9 +4835,9 @@ void linked_status_chk(struct adapter *padapter) } } -void survey_timer_hdl(void *function_context) +void survey_timer_hdl(unsigned long data) { - struct adapter *padapter = function_context; + struct adapter *padapter = (struct adapter *)data; struct cmd_obj *ph2c; struct sitesurvey_parm *psurveyPara; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; @@ -4875,9 +4875,9 @@ exit_survey_timer_hdl: return; } -void link_timer_hdl(void *function_context) +void link_timer_hdl(unsigned long data) { - struct adapter *padapter = (struct adapter *)function_context; + struct adapter *padapter = (struct adapter *)data; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -4912,9 +4912,9 @@ void link_timer_hdl(void *function_context) return; } -void addba_timer_hdl(void *function_context) +void addba_timer_hdl(unsigned long data) { - struct sta_info *psta = function_context; + struct sta_info *psta = (struct sta_info *)data; struct ht_priv *phtpriv; if (!psta) diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c index df463a29b641..ec0a8a4cdc6e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c @@ -281,9 +281,9 @@ exit: pwrpriv->ps_processing = false; } -static void pwr_state_check_handler(void *FunctionContext) +static void pwr_state_check_handler(unsigned long data) { - struct adapter *padapter = FunctionContext; + struct adapter *padapter = (struct adapter *)data; rtw_ps_cmd(padapter); } @@ -544,7 +544,9 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter) pwrctrlpriv->btcoex_rfon = false; - _init_timer(&(pwrctrlpriv->pwr_state_check_timer), padapter->pnetdev, pwr_state_check_handler, (u8 *)padapter); + setup_timer(&pwrctrlpriv->pwr_state_check_timer, + pwr_state_check_handler, + (unsigned long)padapter); } inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 0db421e7b084..258336ffff8e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -41,7 +41,7 @@ static u8 rtw_rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; -void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS); +void rtw_signal_stat_timer_hdl(unsigned long data); void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) { @@ -98,7 +98,9 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) res = rtw_hal_init_recv_priv(padapter); - _init_timer(&precvpriv->signal_stat_timer, padapter->pnetdev, RTW_TIMER_HDL_NAME(signal_stat), padapter); + setup_timer(&precvpriv->signal_stat_timer, + rtw_signal_stat_timer_hdl, + (unsigned long)padapter); precvpriv->signal_stat_sampling_interval = 1000; /* ms */ @@ -1946,9 +1948,9 @@ _err_exit: return _FAIL; } -void rtw_reordering_ctrl_timeout_handler(void *pcontext) +void rtw_reordering_ctrl_timeout_handler(unsigned long data) { - struct recv_reorder_ctrl *preorder_ctrl = pcontext; + struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)data; struct adapter *padapter = preorder_ctrl->padapter; struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; @@ -2132,9 +2134,9 @@ _recv_entry_drop: return ret; } -void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS) +void rtw_signal_stat_timer_hdl(unsigned long data) { - struct adapter *adapter = (struct adapter *)FunctionContext; + struct adapter *adapter = (struct adapter *)data; struct recv_priv *recvpriv = &adapter->recvpriv; u32 tmp_s, tmp_q; diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index 4c968acc7fd4..08c4d5d2236f 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -76,15 +76,6 @@ static inline int _enter_critical_mutex(struct mutex *pmutex, return ret; } -static inline void _init_timer(struct timer_list *ptimer, - struct net_device *nic_hdl, - void *pfunc, void *cntx) -{ - ptimer->function = pfunc; - ptimer->data = (unsigned long)cntx; - init_timer(ptimer); -} - #define RTW_TIMER_HDL_ARGS void *FunctionContext #define RTW_TIMER_HDL_NAME(name) rtw_##name##_timer_hdl #define RTW_DECLARE_TIMER_HDL(name) \ diff --git a/drivers/staging/rtl8188eu/include/rtw_led.h b/drivers/staging/rtl8188eu/include/rtw_led.h index 23f0cfe312f3..7a5303d50d49 100644 --- a/drivers/staging/rtl8188eu/include/rtw_led.h +++ b/drivers/staging/rtl8188eu/include/rtw_led.h @@ -103,7 +103,7 @@ struct led_priv { (adapt)->ledpriv.LedControlHandler((adapt), (action)); \ } while (0) -void BlinkTimerCallback(void *data); +void BlinkTimerCallback(unsigned long data); void BlinkWorkItemCallback(struct work_struct *work); void ResetLedStatus(struct LED_871x *pLed); diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme.h b/drivers/staging/rtl8188eu/include/rtw_mlme.h index 8d83f7ceda76..3f7d1e631ef9 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme.h @@ -551,10 +551,10 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter); void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter); -void _rtw_join_timeout_handler(void *function_context); -void rtw_scan_timeout_handler(void *function_context); +void _rtw_join_timeout_handler(unsigned long data); +void rtw_scan_timeout_handler(unsigned long data); -void rtw_dynamic_check_timer_handlder(void *function_context); +void rtw_dynamic_check_timer_handlder(unsigned long data); #define rtw_is_scan_deny(adapter) false #define rtw_clear_scan_deny(adapter) do {} while (0) #define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0) diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h index 51c9173af1bb..2bebf46b053a 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h @@ -645,9 +645,9 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, void linked_status_chk(struct adapter *padapter); -void survey_timer_hdl(void *function_context); -void link_timer_hdl(void *funtion_context); -void addba_timer_hdl(void *function_context); +void survey_timer_hdl(unsigned long data); +void link_timer_hdl(unsigned long data); +void addba_timer_hdl(unsigned long data); #define set_survey_timer(mlmeext, ms) \ mod_timer(&mlmeext->survey_timer, jiffies + \ diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h index 241a8711ffad..eb1ac3d03123 100644 --- a/drivers/staging/rtl8188eu/include/rtw_recv.h +++ b/drivers/staging/rtl8188eu/include/rtw_recv.h @@ -278,7 +278,7 @@ void rtw_free_recvframe_queue(struct __queue *pframequeue, struct __queue *pfree_recv_queue); u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter); -void rtw_reordering_ctrl_timeout_handler(void *pcontext); +void rtw_reordering_ctrl_timeout_handler(unsigned long data); static inline u8 *get_rxmem(struct recv_frame *precvframe) { diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c index eebb7d751777..baff1e2661d5 100644 --- a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c @@ -29,9 +29,12 @@ void rtw_init_mlme_timer(struct adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - _init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, _rtw_join_timeout_handler, padapter); - _init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, rtw_scan_timeout_handler, padapter); - _init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, rtw_dynamic_check_timer_handlder, padapter); + setup_timer(&pmlmepriv->assoc_timer, _rtw_join_timeout_handler, + (unsigned long)padapter); + setup_timer(&pmlmepriv->scan_to_timer, rtw_scan_timeout_handler, + (unsigned long)padapter); + setup_timer(&pmlmepriv->dynamic_chk_timer, + rtw_dynamic_check_timer_handlder, (unsigned long)padapter); } void rtw_os_indicate_connect(struct adapter *adapter) @@ -130,15 +133,18 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie) void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta) { - _init_timer(&psta->addba_retry_timer, padapter->pnetdev, addba_timer_hdl, psta); + setup_timer(&psta->addba_retry_timer, addba_timer_hdl, + (unsigned long)psta); } void init_mlme_ext_timer(struct adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - _init_timer(&pmlmeext->survey_timer, padapter->pnetdev, survey_timer_hdl, padapter); - _init_timer(&pmlmeext->link_timer, padapter->pnetdev, link_timer_hdl, padapter); + setup_timer(&pmlmeext->survey_timer, survey_timer_hdl, + (unsigned long)padapter); + setup_timer(&pmlmeext->link_timer, link_timer_hdl, + (unsigned long)padapter); } #ifdef CONFIG_88EU_AP_MODE diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c index 05427c489b3f..05701328dce4 100644 --- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c @@ -193,7 +193,8 @@ _recv_indicatepkt_drop: void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl) { - struct adapter *padapter = preorder_ctrl->padapter; - _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, rtw_reordering_ctrl_timeout_handler, preorder_ctrl); + setup_timer(&preorder_ctrl->reordering_ctrl_timer, + rtw_reordering_ctrl_timeout_handler, + (unsigned long)preorder_ctrl); } -- cgit v1.2.3 From 37e080787925a972b1eb866d2cd2d75badfb7a24 Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Thu, 12 Mar 2015 13:26:19 +0900 Subject: staging: rtl8188eu: remove intialization of static ints static ints are initialized to 0 by the compiler. Explicit initialization is not necessary. Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL changes made using coccinelle script: @@ type T; identifier var; @@ static T var - =0 ; Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index 5fe3ae5e3123..750c87b46365 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -38,7 +38,7 @@ MODULE_VERSION(DRIVERVERSION); #define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */ /* module param defaults */ -static int rtw_chip_version = 0x00; +static int rtw_chip_version; static int rtw_rfintfs = HWPI; static int rtw_lbkmode;/* RTL8712_AIR_TRX; */ static int rtw_network_mode = Ndis802_11IBSS;/* Ndis802_11Infrastructure; infra, ad-hoc, auto */ -- cgit v1.2.3 From e1cc3112b22715f91a07680ea315fd92521a5c2e Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Fri, 13 Mar 2015 16:58:40 +0900 Subject: staging: rtl8188eu: remove break after return Remove "break" statement after a "return" statement as it does not get executed. Found by checkpatch.pl - break is not useful after a goto or return Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/pwrseqcmd.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/pwrseqcmd.c b/drivers/staging/rtl8188eu/hal/pwrseqcmd.c index be0663e93f61..73e1f8b36b37 100644 --- a/drivers/staging/rtl8188eu/hal/pwrseqcmd.c +++ b/drivers/staging/rtl8188eu/hal/pwrseqcmd.c @@ -109,7 +109,6 @@ u8 rtl88eu_pwrseqcmdparsing(struct adapter *padapter, u8 cut_vers, u8 fab_vers, RT_TRACE(_module_hal_init_c_, _drv_info_, ("rtl88eu_pwrseqcmdparsing: PWR_CMD_END\n")); return true; - break; default: RT_TRACE(_module_hal_init_c_, _drv_err_, ("rtl88eu_pwrseqcmdparsing: Unknown CMD!!\n")); -- cgit v1.2.3 From adb3d770d20b6ce6ed985a89d6b6953e320093b1 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 13 Mar 2015 19:55:55 +0300 Subject: Staging: rtl8188eu: Remove parentheses around right side an assignment Parentheses are not needed around the right hand side of an assignment. This patch remove parenthese of such occurenses. Issue was detected and solved using the following coccinelle script: @rule1@ identifier x, y, z; expression E1, E2; @@ ( x = (y == z); | x = (E1 == E2); | x = -( ... -) ; ) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_efuse.c | 6 +++--- drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 2 +- drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 22 +++++++++++----------- drivers/staging/rtl8188eu/core/rtw_recv.c | 4 ++-- drivers/staging/rtl8188eu/core/rtw_sreset.c | 2 +- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 18 +++++++++--------- .../staging/rtl8188eu/hal/Hal8188ERateAdaptive.c | 4 ++-- drivers/staging/rtl8188eu/hal/odm_HWConfig.c | 2 +- drivers/staging/rtl8188eu/hal/phy.c | 20 ++++++++++---------- drivers/staging/rtl8188eu/hal/rf.c | 2 +- 11 files changed, 42 insertions(+), 42 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index defec6b7883d..b66746160223 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c @@ -150,12 +150,12 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) continue; } else { offset = ((rtemp8 & 0xF0) >> 1) | u1temp; - wren = (rtemp8 & 0x0F); + wren = rtemp8 & 0x0F; eFuse_Addr++; } } else { - offset = ((rtemp8 >> 4) & 0x0f); - wren = (rtemp8 & 0x0f); + offset = (rtemp8 >> 4) & 0x0f; + wren = rtemp8 & 0x0f; } if (offset < EFUSE_MAX_SECTION_88E) { diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index f2c3ca79c0c9..555efa1da676 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c @@ -663,7 +663,7 @@ int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie, /* Search required WPA or WPA2 IE and copy to sec_ie[] */ - cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_); + cnt = _TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_; sec_idx = 0; diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index bd87b7d79cb4..6c91aa58d924 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -2042,7 +2042,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fixed_ie), _HT_CAPABILITY_IE_, &len, ie_len-sizeof(struct ndis_802_11_fixed_ie)); if (p && len > 0) { pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2); - max_ampdu_sz = (pht_capie->ampdu_params_info & IEEE80211_HT_CAP_AMPDU_FACTOR); + max_ampdu_sz = pht_capie->ampdu_params_info & IEEE80211_HT_CAP_AMPDU_FACTOR; max_ampdu_sz = 1 << (max_ampdu_sz+3); /* max_ampdu_sz (kbytes); */ phtpriv->rx_ampdu_maxlen = max_ampdu_sz; } diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index ec808604a7a2..86d955fadc4b 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -1639,7 +1639,7 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr break; case RTW_WLAN_ACTION_ADDBA_RESP: /* ADDBA response */ status = get_unaligned_le16(&frame_body[3]); - tid = ((frame_body[5] >> 2) & 0x7); + tid = (frame_body[5] >> 2) & 0x7; if (status == 0) { /* successful */ DBG_88E("agg_enable for TID=%d\n", tid); psta->htpriv.agg_enable_bitmap |= 1 << tid; @@ -2491,7 +2491,7 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short /* setting IV for auth seq #3 */ if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) { - val32 = ((pmlmeinfo->iv++) | (pmlmeinfo->key_index << 30)); + val32 = (pmlmeinfo->iv++) | (pmlmeinfo->key_index << 30); le_tmp32 = cpu_to_le32(val32); pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *)&le_tmp32, &(pattrib->pktlen)); @@ -3331,7 +3331,7 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch } while (pmlmeinfo->dialogToken == 0); pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->dialogToken), &(pattrib->pktlen)); - BA_para_set = (0x1002 | ((status & 0xf) << 2)); /* immediate ack & 64 buffer size */ + BA_para_set = 0x1002 | ((status & 0xf) << 2); /* immediate ack & 64 buffer size */ le_tmp = cpu_to_le16(BA_para_set); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); @@ -4247,7 +4247,7 @@ void report_survey_event(struct adapter *padapter, if (pcmd_obj == NULL) return; - cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct survey_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); if (pevtcmd == NULL) { kfree(pcmd_obj); @@ -4299,7 +4299,7 @@ void report_surveydone_event(struct adapter *padapter) if (pcmd_obj == NULL) return; - cmdsz = (sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_KERNEL); if (pevtcmd == NULL) { kfree(pcmd_obj); @@ -4345,7 +4345,7 @@ void report_join_res(struct adapter *padapter, int res) if (pcmd_obj == NULL) return; - cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); if (pevtcmd == NULL) { kfree(pcmd_obj); @@ -4398,7 +4398,7 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi if (pcmd_obj == NULL) return; - cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_KERNEL); if (pevtcmd == NULL) { kfree(pcmd_obj); @@ -4428,7 +4428,7 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi if (psta) mac_id = (int)psta->mac_id; else - mac_id = (-1); + mac_id = -1; pdel_sta_evt->mac_id = mac_id; @@ -4453,7 +4453,7 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int if (pcmd_obj == NULL) return; - cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_KERNEL); if (pevtcmd == NULL) { kfree(pcmd_obj); @@ -5356,7 +5356,7 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) psta = rtw_get_stainfo(pstapriv, pparm->addr); if (psta) { - ctrl = (BIT(15) | ((pparm->algorithm) << 2)); + ctrl = BIT(15) | ((pparm->algorithm) << 2); DBG_88E("r871x_set_stakey_hdl(): enc_algorithm=%d\n", pparm->algorithm); @@ -5365,7 +5365,7 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) return H2C_REJECTED; } - cam_id = (psta->mac_id + 3);/* 0~3 for default key, cmd_id = macid + 3, macid = aid+1; */ + cam_id = psta->mac_id + 3;/* 0~3 for default key, cmd_id = macid + 3, macid = aid+1; */ DBG_88E("Write CAM, mac_addr =%x:%x:%x:%x:%x:%x, cam_entry=%d\n", pparm->addr[0], pparm->addr[1], pparm->addr[2], pparm->addr[3], pparm->addr[4], diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 258336ffff8e..cda725a8f9cd 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -2163,7 +2163,7 @@ void rtw_signal_stat_timer_hdl(unsigned long data) /* update value of signal_strength, rssi, signal_qual */ if (check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == false) { - tmp_s = (avg_signal_strength+(_alpha-1)*recvpriv->signal_strength); + tmp_s = avg_signal_strength+(_alpha-1)*recvpriv->signal_strength; if (tmp_s % _alpha) tmp_s = tmp_s/_alpha + 1; else @@ -2171,7 +2171,7 @@ void rtw_signal_stat_timer_hdl(unsigned long data) if (tmp_s > 100) tmp_s = 100; - tmp_q = (avg_signal_qual+(_alpha-1)*recvpriv->signal_qual); + tmp_q = avg_signal_qual+(_alpha-1)*recvpriv->signal_qual; if (tmp_q % _alpha) tmp_q = tmp_q/_alpha + 1; else diff --git a/drivers/staging/rtl8188eu/core/rtw_sreset.c b/drivers/staging/rtl8188eu/core/rtw_sreset.c index cd4e344e6ffd..e725a4708775 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sreset.c +++ b/drivers/staging/rtl8188eu/core/rtw_sreset.c @@ -47,7 +47,7 @@ u8 sreset_get_wifi_status(struct adapter *padapter) if (WIFI_STATUS_SUCCESS != psrtpriv->Wifi_Error_Status) { DBG_88E("==>%s error_status(0x%x)\n", __func__, psrtpriv->Wifi_Error_Status); - status = (psrtpriv->Wifi_Error_Status & (~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL))); + status = psrtpriv->Wifi_Error_Status & (~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL)); } DBG_88E("==> %s wifi_status(0x%x)\n", __func__, status); diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 4ba05b97e487..2b371757cbfe 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -462,14 +462,14 @@ void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key) for (j = 5; j >= 0; j--) { switch (j) { case 0: - val = (ctrl | (mac[0] << 16) | (mac[1] << 24)); + val = ctrl | (mac[0] << 16) | (mac[1] << 24); break; case 1: - val = (mac[2] | (mac[3] << 8) | (mac[4] << 16) | (mac[5] << 24)); + val = mac[2] | (mac[3] << 8) | (mac[4] << 16) | (mac[5] << 24); break; default: i = (j - 2) << 2; - val = (key[i] | (key[i+1] << 8) | (key[i+2] << 16) | (key[i+3] << 24)); + val = key[i] | (key[i+1] << 8) | (key[i+2] << 16) | (key[i+3] << 24); break; } @@ -564,7 +564,7 @@ void WMMOnAssocRsp(struct adapter *padapter) /* AIFS = AIFSN * slot time + SIFS - r2t phy delay */ AIFS = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN & 0x0f) * pmlmeinfo->slotTime + aSifsTime; - ECWMin = (pmlmeinfo->WMM_param.ac_param[i].CW & 0x0f); + ECWMin = pmlmeinfo->WMM_param.ac_param[i].CW & 0x0f; ECWMax = (pmlmeinfo->WMM_param.ac_param[i].CW & 0xf0) >> 4; TXOP = le16_to_cpu(pmlmeinfo->WMM_param.ac_param[i].TXOP_limit); @@ -741,14 +741,14 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) } else { /* modify from fw by Thomas 2010/11/17 */ if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3)) - max_AMPDU_len = (pIE->data[i] & 0x3); + max_AMPDU_len = pIE->data[i] & 0x3; else - max_AMPDU_len = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3); + max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3; if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c)) - min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c); + min_MPDU_spacing = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c; else - min_MPDU_spacing = (pIE->data[i] & 0x1c); + min_MPDU_spacing = pIE->data[i] & 0x1c; pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para = max_AMPDU_len | min_MPDU_spacing; } @@ -1256,7 +1256,7 @@ unsigned int update_MSC_rate(struct HT_caps_element *pHT_caps) { unsigned int mask = 0; - mask = ((pHT_caps->u.HT_cap_element.MCS_rate[0] << 12) | (pHT_caps->u.HT_cap_element.MCS_rate[1] << 20)); + mask = (pHT_caps->u.HT_cap_element.MCS_rate[0] << 12) | (pHT_caps->u.HT_cap_element.MCS_rate[1] << 20); return mask; } diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c index 8d63c83afee4..353ff3761a2a 100644 --- a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c +++ b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c @@ -619,7 +619,7 @@ u8 ODM_RA_GetDecisionRate_8188E(struct odm_dm_struct *dm_odm, u8 macid) if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM)) return 0; - DecisionRate = (dm_odm->RAInfo[macid].DecisionRate); + DecisionRate = dm_odm->RAInfo[macid].DecisionRate; ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" macid =%d DecisionRate = 0x%x\n", macid, DecisionRate)); return DecisionRate; @@ -631,7 +631,7 @@ u8 ODM_RA_GetHwPwrStatus_8188E(struct odm_dm_struct *dm_odm, u8 macid) if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM)) return 0; - PTStage = (dm_odm->RAInfo[macid].PTStage); + PTStage = dm_odm->RAInfo[macid].PTStage; ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("macid =%d PTStage = 0x%x\n", macid, PTStage)); return PTStage; diff --git a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c index f8fae18341fa..36afe45d1c9a 100644 --- a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c @@ -124,7 +124,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm, /* The RSSI formula should be modified according to the gain table */ /* In 88E, cck_highpwr is always set to 1 */ LNA_idx = (cck_agc_rpt & 0xE0) >> 5; - VGA_idx = (cck_agc_rpt & 0x1F); + VGA_idx = cck_agc_rpt & 0x1F; switch (LNA_idx) { case 7: if (VGA_idx <= 27) diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index f3b195e69057..6e4c3ee0399a 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -60,7 +60,7 @@ void phy_set_bb_reg(struct adapter *adapt, u32 regaddr, u32 bitmask, u32 data) if (bitmask != bMaskDWord) { /* if not "double word" write */ original_value = usb_read32(adapt, regaddr); bit_shift = cal_bit_shift(bitmask); - data = ((original_value & (~bitmask)) | (data << bit_shift)); + data = (original_value & (~bitmask)) | (data << bit_shift); } usb_write32(adapt, regaddr, data); @@ -143,7 +143,7 @@ void phy_set_rf_reg(struct adapter *adapt, enum rf_radio_path rf_path, if (bit_mask != bRFRegOffsetMask) { original_value = rf_serial_read(adapt, rf_path, reg_addr); bit_shift = cal_bit_shift(bit_mask); - data = ((original_value & (~bit_mask)) | (data << bit_shift)); + data = (original_value & (~bit_mask)) | (data << bit_shift); } rf_serial_write(adapt, rf_path, reg_addr, data); @@ -393,12 +393,12 @@ void rtl88eu_dm_txpower_track_adjust(struct odm_dm_struct *dm_odm, u8 type, if (dm_odm->BbSwingIdxOfdm <= dm_odm->BbSwingIdxOfdmBase) { *direction = 1; - pwr_value = (dm_odm->BbSwingIdxOfdmBase - - dm_odm->BbSwingIdxOfdm); + pwr_value = dm_odm->BbSwingIdxOfdmBase - + dm_odm->BbSwingIdxOfdm; } else { *direction = 2; - pwr_value = (dm_odm->BbSwingIdxOfdm - - dm_odm->BbSwingIdxOfdmBase); + pwr_value = dm_odm->BbSwingIdxOfdm - + dm_odm->BbSwingIdxOfdmBase; } } else if (type == 1) { /* For CCK adjust. */ @@ -408,12 +408,12 @@ void rtl88eu_dm_txpower_track_adjust(struct odm_dm_struct *dm_odm, u8 type, if (dm_odm->BbSwingIdxCck <= dm_odm->BbSwingIdxCckBase) { *direction = 1; - pwr_value = (dm_odm->BbSwingIdxCckBase - - dm_odm->BbSwingIdxCck); + pwr_value = dm_odm->BbSwingIdxCckBase - + dm_odm->BbSwingIdxCck; } else { *direction = 2; - pwr_value = (dm_odm->BbSwingIdxCck - - dm_odm->BbSwingIdxCckBase); + pwr_value = dm_odm->BbSwingIdxCck - + dm_odm->BbSwingIdxCckBase; } } diff --git a/drivers/staging/rtl8188eu/hal/rf.c b/drivers/staging/rtl8188eu/hal/rf.c index eea4c8a6022b..097092772a86 100644 --- a/drivers/staging/rtl8188eu/hal/rf.c +++ b/drivers/staging/rtl8188eu/hal/rf.c @@ -201,7 +201,7 @@ static void get_rx_power_val_by_reg(struct adapter *adapt, u8 channel, break; case 2: /* Better regulatory */ /* don't increase any power diff */ - write_val = ((index < 2) ? powerbase0[rf] : powerbase1[rf]); + write_val = (index < 2) ? powerbase0[rf] : powerbase1[rf]; break; case 3: /* Customer defined power diff. */ /* increase power diff defined by customer. */ -- cgit v1.2.3 From 6fe9092d6a22fcb57b5e97d85e3fbe6a00a04b13 Mon Sep 17 00:00:00 2001 From: Taiane Coelho Ramos Date: Fri, 13 Mar 2015 16:22:44 -0300 Subject: Staging: iio: ade7758: Remove braces on a single statement if This patch fixes the checkpatch.pl warning: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Taiane Coelho Ramos Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7758_ring.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c index 9725a04c0c92..ead38a50b25b 100644 --- a/drivers/staging/iio/meter/ade7758_ring.c +++ b/drivers/staging/iio/meter/ade7758_ring.c @@ -119,9 +119,8 @@ int ade7758_configure_ring(struct iio_dev *indio_dev) int ret = 0; buffer = iio_kfifo_allocate(); - if (!buffer) { + if (!buffer) return -ENOMEM; - } iio_device_attach_buffer(indio_dev, buffer); -- cgit v1.2.3 From 5db4851d47ea80ad78d85f201e13df9ea48ab67b Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 13 Mar 2015 20:47:22 +0300 Subject: Staging: iio: Remove parentheses around right side an assignment Parentheses are not needed around the right hand side of an assignment. This patch remove parenthese of such occurenses. Issue was detected and solved using the following coccinelle script: @rule1@ identifier x, y, z; expression E1, E2; @@ ( x = (y == z); | x = (E1 == E2); | x = -( ... -) ; ) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/adis16240_core.c | 2 +- drivers/staging/iio/light/tsl2x7x_core.c | 4 ++-- drivers/staging/iio/meter/ade7753.c | 2 +- drivers/staging/iio/meter/ade7754.c | 2 +- drivers/staging/iio/meter/ade7759.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c index 3f46086eab3a..e2f8affc4c15 100644 --- a/drivers/staging/iio/accel/adis16240_core.c +++ b/drivers/staging/iio/accel/adis16240_core.c @@ -46,7 +46,7 @@ static ssize_t adis16240_spi_read_signed(struct device *dev, if (val & ADIS16240_ERROR_ACTIVE) adis_check_status(st); - val = ((s16)(val << shift) >> shift); + val = (s16)(val << shift) >> shift; return sprintf(buf, "%d\n", val); } diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index 52f4e65fcdf1..010e607dd880 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -613,8 +613,8 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev) return lux_val; } - gain_trim_val = (((chip->tsl2x7x_settings.als_cal_target) - * chip->tsl2x7x_settings.als_gain_trim) / lux_val); + gain_trim_val = ((chip->tsl2x7x_settings.als_cal_target) + * chip->tsl2x7x_settings.als_gain_trim) / lux_val; if ((gain_trim_val < 250) || (gain_trim_val > 4000)) return -ERANGE; diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c index 78e8f560eeec..f828f5f3cb2c 100644 --- a/drivers/staging/iio/meter/ade7753.c +++ b/drivers/staging/iio/meter/ade7753.c @@ -411,7 +411,7 @@ static ssize_t ade7753_write_frequency(struct device *dev, mutex_lock(&indio_dev->mlock); - t = (27900 / val); + t = 27900 / val; if (t > 0) t--; diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c index 81f67318974a..e7171b532aa6 100644 --- a/drivers/staging/iio/meter/ade7754.c +++ b/drivers/staging/iio/meter/ade7754.c @@ -432,7 +432,7 @@ static ssize_t ade7754_write_frequency(struct device *dev, mutex_lock(&indio_dev->mlock); - t = (26000 / val); + t = 26000 / val; if (t > 0) t--; diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c index 694e0ce1f277..2d5f038d3b30 100644 --- a/drivers/staging/iio/meter/ade7759.c +++ b/drivers/staging/iio/meter/ade7759.c @@ -371,7 +371,7 @@ static ssize_t ade7759_write_frequency(struct device *dev, mutex_lock(&indio_dev->mlock); - t = (27900 / val); + t = 27900 / val; if (t > 0) t--; -- cgit v1.2.3 From da29461ccdf811b27a1cf53483ec2457fb4a6ae7 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 12 Mar 2015 19:10:31 +0200 Subject: Staging: iio: Simplify return logic This patch removes the conditional return of the ade77*_probe functions based on the return values of iio_device_register as the latter returns 0 or ret, the same as the checked values. Warning found by coccinelle. Signed-off-by: Cristina Opriceana Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7753.c | 6 +----- drivers/staging/iio/meter/ade7754.c | 6 +----- drivers/staging/iio/meter/ade7759.c | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c index f828f5f3cb2c..ffc7f0ddff14 100644 --- a/drivers/staging/iio/meter/ade7753.c +++ b/drivers/staging/iio/meter/ade7753.c @@ -517,11 +517,7 @@ static int ade7753_probe(struct spi_device *spi) if (ret) return ret; - ret = iio_device_register(indio_dev); - if (ret) - return ret; - - return 0; + return iio_device_register(indio_dev); } /* fixme, confirm ordering in this function */ diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c index e7171b532aa6..8dc5089772a3 100644 --- a/drivers/staging/iio/meter/ade7754.c +++ b/drivers/staging/iio/meter/ade7754.c @@ -540,11 +540,7 @@ static int ade7754_probe(struct spi_device *spi) ret = ade7754_initial_setup(indio_dev); if (ret) return ret; - ret = iio_device_register(indio_dev); - if (ret) - return ret; - - return 0; + return iio_device_register(indio_dev); } /* fixme, confirm ordering in this function */ diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c index 2d5f038d3b30..7eef8b9573fc 100644 --- a/drivers/staging/iio/meter/ade7759.c +++ b/drivers/staging/iio/meter/ade7759.c @@ -462,11 +462,7 @@ static int ade7759_probe(struct spi_device *spi) if (ret) return ret; - ret = iio_device_register(indio_dev); - if (ret) - return ret; - - return 0; + return iio_device_register(indio_dev); } /* fixme, confirm ordering in this function */ -- cgit v1.2.3 From 56cc3b629b43c0a5a3d9cb5599e92a3146eff19e Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sat, 14 Mar 2015 20:50:23 +0200 Subject: Staging: iio: Remove space after type cast This patch removes unnecessary space after type casts. Warning found by checkpatch.pl. Signed-off-by: Cristina Opriceana Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/frequency/ad9832.c | 6 +++--- drivers/staging/iio/frequency/ad9834.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c index cf68159a5848..9a16699541c2 100644 --- a/drivers/staging/iio/frequency/ad9832.c +++ b/drivers/staging/iio/frequency/ad9832.c @@ -24,8 +24,8 @@ static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout) { - unsigned long long freqreg = (u64) fout * - (u64) ((u64) 1L << AD9832_FREQ_BITS); + unsigned long long freqreg = (u64)fout * + (u64)((u64)1L << AD9832_FREQ_BITS); do_div(freqreg, mclk); return freqreg; } @@ -86,7 +86,7 @@ static ssize_t ad9832_write(struct device *dev, struct device_attribute *attr, goto error_ret; mutex_lock(&indio_dev->mlock); - switch ((u32) this_attr->address) { + switch ((u32)this_attr->address) { case AD9832_FREQ0HM: case AD9832_FREQ1HM: ret = ad9832_write_frequency(st, this_attr->address, val); diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index 5c803191c2ce..a34667306320 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -27,7 +27,7 @@ static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long fout) { - unsigned long long freqreg = (u64) fout * (u64) (1 << AD9834_FREQ_BITS); + unsigned long long freqreg = (u64)fout * (u64)(1 << AD9834_FREQ_BITS); do_div(freqreg, mclk); return freqreg; @@ -78,7 +78,7 @@ static ssize_t ad9834_write(struct device *dev, goto error_ret; mutex_lock(&indio_dev->mlock); - switch ((u32) this_attr->address) { + switch ((u32)this_attr->address) { case AD9834_REG_FREQ0: case AD9834_REG_FREQ1: ret = ad9834_write_frequency(st, this_attr->address, val); @@ -154,7 +154,7 @@ static ssize_t ad9834_store_wavetype(struct device *dev, mutex_lock(&indio_dev->mlock); - switch ((u32) this_attr->address) { + switch ((u32)this_attr->address) { case 0: if (sysfs_streq(buf, "sine")) { st->control &= ~AD9834_MODE; -- cgit v1.2.3 From 6970791fd5683a893bc11bb4722b82d899013465 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sat, 14 Mar 2015 20:50:48 +0200 Subject: Staging: iio: Remove explicit comparison to NULL This patch simplifies pointer comparison to NULL and makes code easier to read. Warning found by checkpatch.pl. Signed-off-by: Cristina Opriceana Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/frequency/ad9832.c | 2 +- drivers/staging/iio/frequency/ad9834.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c index 9a16699541c2..8ecc0bc64ee3 100644 --- a/drivers/staging/iio/frequency/ad9832.c +++ b/drivers/staging/iio/frequency/ad9832.c @@ -220,7 +220,7 @@ static int ad9832_probe(struct spi_device *spi) } indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); - if (indio_dev == NULL) { + if (!indio_dev) { ret = -ENOMEM; goto error_disable_reg; } diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index a34667306320..efea56012622 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -336,7 +336,7 @@ static int ad9834_probe(struct spi_device *spi) } indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); - if (indio_dev == NULL) { + if (!indio_dev) { ret = -ENOMEM; goto error_disable_reg; } -- cgit v1.2.3 From f1d05b5f68cbe370b13a4432be5aa11ffc226dec Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sat, 14 Mar 2015 20:51:12 +0200 Subject: Staging: iio: Prefer using the BIT macro This patch replaces bit shifting on 1 with the BIT(x) macro as it's extensively used by other function in this driver. This was done with coccinelle: @@ int g; @@ -(1 << g) +BIT(g) Signed-off-by: Cristina Opriceana Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/frequency/ad9832.c | 2 +- drivers/staging/iio/frequency/ad9832.h | 12 ++++++------ drivers/staging/iio/frequency/ad9834.c | 4 ++-- drivers/staging/iio/frequency/ad9834.h | 36 +++++++++++++++++----------------- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c index 8ecc0bc64ee3..a861fe0149b1 100644 --- a/drivers/staging/iio/frequency/ad9832.c +++ b/drivers/staging/iio/frequency/ad9832.c @@ -59,7 +59,7 @@ static int ad9832_write_frequency(struct ad9832_state *st, static int ad9832_write_phase(struct ad9832_state *st, unsigned long addr, unsigned long phase) { - if (phase > (1 << AD9832_PHASE_BITS)) + if (phase > BIT(AD9832_PHASE_BITS)) return -EINVAL; st->phase_data[0] = cpu_to_be16((AD9832_CMD_PHA8BITSW << CMD_SHIFT) | diff --git a/drivers/staging/iio/frequency/ad9832.h b/drivers/staging/iio/frequency/ad9832.h index 386f4dc8c9a1..d32323b46be6 100644 --- a/drivers/staging/iio/frequency/ad9832.h +++ b/drivers/staging/iio/frequency/ad9832.h @@ -42,13 +42,13 @@ #define AD9832_CMD_SYNCSELSRC 0x8 #define AD9832_CMD_SLEEPRESCLR 0xC -#define AD9832_FREQ (1 << 11) +#define AD9832_FREQ BIT(11) #define AD9832_PHASE(x) (((x) & 3) << 9) -#define AD9832_SYNC (1 << 13) -#define AD9832_SELSRC (1 << 12) -#define AD9832_SLEEP (1 << 13) -#define AD9832_RESET (1 << 12) -#define AD9832_CLR (1 << 11) +#define AD9832_SYNC BIT(13) +#define AD9832_SELSRC BIT(12) +#define AD9832_SLEEP BIT(13) +#define AD9832_RESET BIT(12) +#define AD9832_CLR BIT(11) #define CMD_SHIFT 12 #define ADD_SHIFT 8 #define AD9832_FREQ_BITS 32 diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index efea56012622..342c71318d3a 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -27,7 +27,7 @@ static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long fout) { - unsigned long long freqreg = (u64)fout * (u64)(1 << AD9834_FREQ_BITS); + unsigned long long freqreg = (u64)fout * (u64)BIT(AD9834_FREQ_BITS); do_div(freqreg, mclk); return freqreg; @@ -55,7 +55,7 @@ static int ad9834_write_frequency(struct ad9834_state *st, static int ad9834_write_phase(struct ad9834_state *st, unsigned long addr, unsigned long phase) { - if (phase > (1 << AD9834_PHASE_BITS)) + if (phase > BIT(AD9834_PHASE_BITS)) return -EINVAL; st->data = cpu_to_be16(addr | phase); diff --git a/drivers/staging/iio/frequency/ad9834.h b/drivers/staging/iio/frequency/ad9834.h index 8ca6e52bae6b..0a0de4c4f460 100644 --- a/drivers/staging/iio/frequency/ad9834.h +++ b/drivers/staging/iio/frequency/ad9834.h @@ -10,31 +10,31 @@ /* Registers */ -#define AD9834_REG_CMD (0 << 14) -#define AD9834_REG_FREQ0 (1 << 14) -#define AD9834_REG_FREQ1 (2 << 14) -#define AD9834_REG_PHASE0 (6 << 13) -#define AD9834_REG_PHASE1 (7 << 13) +#define AD9834_REG_CMD 0 +#define AD9834_REG_FREQ0 BIT(14) +#define AD9834_REG_FREQ1 BIT(15) +#define AD9834_REG_PHASE0 (BIT(15) | BIT(14)) +#define AD9834_REG_PHASE1 (BIT(15) | BIT(14) | BIT(13)) /* Command Control Bits */ -#define AD9834_B28 (1 << 13) -#define AD9834_HLB (1 << 12) -#define AD9834_FSEL (1 << 11) -#define AD9834_PSEL (1 << 10) -#define AD9834_PIN_SW (1 << 9) -#define AD9834_RESET (1 << 8) -#define AD9834_SLEEP1 (1 << 7) -#define AD9834_SLEEP12 (1 << 6) -#define AD9834_OPBITEN (1 << 5) -#define AD9834_SIGN_PIB (1 << 4) -#define AD9834_DIV2 (1 << 3) -#define AD9834_MODE (1 << 1) +#define AD9834_B28 BIT(13) +#define AD9834_HLB BIT(12) +#define AD9834_FSEL BIT(11) +#define AD9834_PSEL BIT(10) +#define AD9834_PIN_SW BIT(9) +#define AD9834_RESET BIT(8) +#define AD9834_SLEEP1 BIT(7) +#define AD9834_SLEEP12 BIT(6) +#define AD9834_OPBITEN BIT(5) +#define AD9834_SIGN_PIB BIT(4) +#define AD9834_DIV2 BIT(3) +#define AD9834_MODE BIT(1) #define AD9834_FREQ_BITS 28 #define AD9834_PHASE_BITS 12 -#define RES_MASK(bits) ((1 << (bits)) - 1) +#define RES_MASK(bits) (BIT(bits) - 1) /** * struct ad9834_state - driver instance specific data -- cgit v1.2.3 From 9841ebccd039cd505876fcf9e6db9ee26e8c3189 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sat, 14 Mar 2015 20:51:29 +0200 Subject: Staging: iio: Do not use multiple blank lines This patch removes unnecessary blank lines between functions. Found by checkpatch.pl: "CHECK: Please don't use multiple blank lines". Signed-off-by: Cristina Opriceana Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/frequency/ad9834.c | 1 - drivers/staging/iio/frequency/ad9834.h | 1 - 2 files changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index 342c71318d3a..f06b14de21f8 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -218,7 +218,6 @@ static ssize_t ad9834_show_out0_wavetype_available(struct device *dev, return sprintf(buf, "%s\n", str); } - static IIO_DEVICE_ATTR(out_altvoltage0_out0_wavetype_available, S_IRUGO, ad9834_show_out0_wavetype_available, NULL, 0); diff --git a/drivers/staging/iio/frequency/ad9834.h b/drivers/staging/iio/frequency/ad9834.h index 0a0de4c4f460..40fdd5da7bd0 100644 --- a/drivers/staging/iio/frequency/ad9834.h +++ b/drivers/staging/iio/frequency/ad9834.h @@ -69,7 +69,6 @@ struct ad9834_state { __be16 freq_data[2]; }; - /* * TODO: struct ad7887_platform_data needs to go into include/linux/iio */ -- cgit v1.2.3 From 01f62379a8e50a98e0c26fe7f6445e771685ce49 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sat, 14 Mar 2015 20:53:37 +0200 Subject: Staging: iio: Alignment should match open parenthesis This patch arranges multiple-line parameters in accordance with the parameter above them to improve coding style. Found by checkpatch.pl Signed-off-by: Cristina Opriceana Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/frequency/ad9834.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index f06b14de21f8..b57bf6fd8bff 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -53,7 +53,7 @@ static int ad9834_write_frequency(struct ad9834_state *st, } static int ad9834_write_phase(struct ad9834_state *st, - unsigned long addr, unsigned long phase) + unsigned long addr, unsigned long phase) { if (phase > BIT(AD9834_PHASE_BITS)) return -EINVAL; @@ -63,9 +63,9 @@ static int ad9834_write_phase(struct ad9834_state *st, } static ssize_t ad9834_write(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad9834_state *st = iio_priv(indio_dev); @@ -142,9 +142,9 @@ error_ret: } static ssize_t ad9834_store_wavetype(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad9834_state *st = iio_priv(indio_dev); @@ -179,7 +179,7 @@ static ssize_t ad9834_store_wavetype(struct device *dev, break; case 1: if (sysfs_streq(buf, "square") && - !(st->control & AD9834_MODE)) { + !(st->control & AD9834_MODE)) { st->control &= ~AD9834_MODE; st->control |= AD9834_OPBITEN; } else { @@ -200,9 +200,10 @@ static ssize_t ad9834_store_wavetype(struct device *dev, return ret ? ret : len; } -static ssize_t ad9834_show_out0_wavetype_available(struct device *dev, - struct device_attribute *attr, - char *buf) +static +ssize_t ad9834_show_out0_wavetype_available(struct device *dev, + struct device_attribute *attr, + char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad9834_state *st = iio_priv(indio_dev); @@ -221,9 +222,10 @@ static ssize_t ad9834_show_out0_wavetype_available(struct device *dev, static IIO_DEVICE_ATTR(out_altvoltage0_out0_wavetype_available, S_IRUGO, ad9834_show_out0_wavetype_available, NULL, 0); -static ssize_t ad9834_show_out1_wavetype_available(struct device *dev, - struct device_attribute *attr, - char *buf) +static +ssize_t ad9834_show_out1_wavetype_available(struct device *dev, + struct device_attribute *attr, + char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad9834_state *st = iio_priv(indio_dev); -- cgit v1.2.3 From 212db303ed21df1bee5037362f3a1098b53b5e55 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sat, 14 Mar 2015 20:54:04 +0200 Subject: Staging: iio: Use braces on all arms of if statement Add braces to improve consistency when using if statements. Found by checkpatch.pl: "CHECK: braces {} should be used on all arms of this statement". Signed-off-by: Cristina Opriceana Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/frequency/ad9834.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index b57bf6fd8bff..d02bb44fb8fc 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -111,9 +111,9 @@ static ssize_t ad9834_write(struct device *dev, break; case AD9834_FSEL: case AD9834_PSEL: - if (val == 0) + if (val == 0) { st->control &= ~(this_attr->address | AD9834_PIN_SW); - else if (val == 1) { + } else if (val == 1) { st->control |= this_attr->address; st->control &= ~AD9834_PIN_SW; } else { -- cgit v1.2.3 From dc6ed26dc32f2365647e9a156beafe3dcbde612e Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Mon, 16 Mar 2015 19:34:10 +0530 Subject: Staging: iio: use !x instead of x == NULL Functions like devm_kzalloc, kmalloc_array, devm_ioremap, usb_alloc_urb, alloc_netdev return NULL as a return value on failure. Generally, When NULL represents failure, !x is commonly used. This patch cleans up the tests on the results of these functions, thereby using !x instead of x == NULL or NULL == x. This is done via following coccinelle script: @prob_7@ identifier x; statement S; @@ ( x = devm_kzalloc(...); | x = usb_alloc_urb(...); | x = kmalloc_array(...); | x = devm_ioremap(...); | x = alloc_netdev(...); ) ... - if(NULL == x) + if(!x) S Further we have used isomorphism characteristics of coccinelle to indicate x == NULL and NULL == x are equivalent. This is done via following iso script. Expression @ is_null @ expression X; @@ X == NULL <=> NULL == X Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c index 2af8d677d4ed..3c1c8c6c4a6c 100644 --- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c +++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c @@ -183,7 +183,7 @@ static int iio_bfin_tmr_trigger_probe(struct platform_device *pdev) int ret; st = devm_kzalloc(&pdev->dev, sizeof(*st), GFP_KERNEL); - if (st == NULL) + if (!st) return -ENOMEM; st->irq = platform_get_irq(pdev, 0); -- cgit v1.2.3 From 2049f1ea88fa07e5912c67c4c623bb342b4b02af Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Wed, 11 Mar 2015 17:02:14 +0530 Subject: Staging: dgap: Use setup_timer to combine initialization The function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields. So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script. @@ expression E1, E2, E3; type T; @@ - init_timer(&E1); ... ( - E1.function = E2; ... - E1.data = (T)E3; + setup_timer(&E1, E2, (T)E3); | - E1.data = (T)E3; ... - E1.function = E2; + setup_timer(&E1, E2, (T)E3); | - E1.function = E2; + setup_timer(&E1, E2, 0); ) Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgap/dgap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index cea5b26032d9..6766d5a91a90 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -7039,8 +7039,7 @@ static int dgap_start(void) /* Start the poller */ spin_lock_irqsave(&dgap_poll_lock, flags); - init_timer(&dgap_poll_timer); - dgap_poll_timer.function = dgap_poll_handler; + setup_timer(&dgap_poll_timer, dgap_poll_handler, 0); dgap_poll_timer.data = 0; dgap_poll_time = jiffies + dgap_jiffies_from_ms(dgap_poll_tick); dgap_poll_timer.expires = dgap_poll_time; -- cgit v1.2.3 From 5900adaee8cacb6a188ca9cd888a791585f71c4d Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Thu, 12 Mar 2015 13:26:18 +0900 Subject: staging: i2o: remove intialization of static ints static ints are initialized to 0 by the compiler. Explicit initialization is not necessary. Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL changes made using coccinelle script: @@ type T; identifier var; @@ static T var - =0 ; Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/i2o_block.c | 2 +- drivers/staging/i2o/i2o_config.c | 2 +- drivers/staging/i2o/iop.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/i2o_block.c b/drivers/staging/i2o/i2o_block.c index 0a13c64ce000..77847875c38b 100644 --- a/drivers/staging/i2o/i2o_block.c +++ b/drivers/staging/i2o/i2o_block.c @@ -1028,7 +1028,7 @@ static int i2o_block_probe(struct device *dev) struct i2o_block_device *i2o_blk_dev; struct gendisk *gd; struct request_queue *queue; - static int unit = 0; + static int unit; int rc; u64 size; u32 blocksize; diff --git a/drivers/staging/i2o/i2o_config.c b/drivers/staging/i2o/i2o_config.c index 574866311b43..cd7ca5eb18ff 100644 --- a/drivers/staging/i2o/i2o_config.c +++ b/drivers/staging/i2o/i2o_config.c @@ -64,7 +64,7 @@ struct i2o_cfg_info { struct i2o_cfg_info *next; }; static struct i2o_cfg_info *open_files = NULL; -static ulong i2o_cfg_info_id = 0; +static ulong i2o_cfg_info_id; static int i2o_cfg_getiops(unsigned long arg) { diff --git a/drivers/staging/i2o/iop.c b/drivers/staging/i2o/iop.c index 52334fc8b547..6cae63c29e8d 100644 --- a/drivers/staging/i2o/iop.c +++ b/drivers/staging/i2o/iop.c @@ -1042,7 +1042,7 @@ static void i2o_iop_release(struct device *dev) */ struct i2o_controller *i2o_iop_alloc(void) { - static int unit = 0; /* 0 and 1 are NULL IOP and Local Host */ + static int unit; /* 0 and 1 are NULL IOP and Local Host */ struct i2o_controller *c; char poolname[32]; -- cgit v1.2.3 From e719bba8559708e240164c69b39ed3ea86a7fa46 Mon Sep 17 00:00:00 2001 From: Supriya Karanth Date: Thu, 12 Mar 2015 13:26:20 +0900 Subject: staging: rtl8723au: remove intialization of static ints static ints are initialized to 0 by the compiler. Explicit initialization is not necessary. Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL changes made using coccinelle script: @@ type T; identifier var; @@ static T var - =0 ; Signed-off-by: Supriya Karanth Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 2 +- drivers/staging/rtl8723au/os_dep/os_intfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 0610d5f1bdc4..045a24c81b12 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -87,7 +87,7 @@ static void arcfour_encrypt( struct arc4context *parc4ctx, } -static int bcrc32initialized = 0; +static int bcrc32initialized; static u32 crc32_table[256]; static u8 crc32_reverseBit(u8 data) diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c index 1b23eb13222b..db6a15971a21 100644 --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c @@ -34,7 +34,7 @@ MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin"); MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin"); /* module param defaults */ -static int rtw_chip_version = 0x00; +static int rtw_chip_version; static int rtw_rfintfs = HWPI; static int rtw_debug = 1; -- cgit v1.2.3 From 5cc8c56841f28a08c93a63d166530eef82f11073 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Thu, 12 Mar 2015 17:28:54 +0530 Subject: Staging: ft1000: Use module_pcmcia_driver Macro module_pcmcia_driver is used for drivers whose init and exit paths does only register and unregister to pcmcia API. So, here remove some boilerplate code by using module_pcmcia_driver. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c index 922478e1cb57..e5cc5bedf031 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c @@ -155,15 +155,4 @@ static struct pcmcia_driver ft1000_cs_driver = { .resume = ft1000_resume, }; -static int __init init_ft1000_cs(void) -{ - return pcmcia_register_driver(&ft1000_cs_driver); -} - -static void __exit exit_ft1000_cs(void) -{ - pcmcia_unregister_driver(&ft1000_cs_driver); -} - -module_init(init_ft1000_cs); -module_exit(exit_ft1000_cs); +module_pcmcia_driver(ft1000_cs_driver); -- cgit v1.2.3 From eb7403756fb68e4509cfdde3e3d7ba0576e0abf0 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Thu, 12 Mar 2015 17:36:15 +0530 Subject: Staging: rts5208: Use module_pci_driver Macro module_pci_driver is used for drivers whose init and exit paths does only register and unregister to pci API. So, here remove some boilerplate code by using module_pci_driver. Also, change driver to rtsx_driver, to avoid implicitly redefining driver_init. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/rtsx.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c index 7f2c0c38e840..c482a6ac26ba 100644 --- a/drivers/staging/rts5208/rtsx.c +++ b/drivers/staging/rts5208/rtsx.c @@ -1036,7 +1036,7 @@ static const struct pci_device_id rtsx_ids[] = { MODULE_DEVICE_TABLE(pci, rtsx_ids); /* pci_driver definition */ -static struct pci_driver driver = { +static struct pci_driver rtsx_driver = { .name = CR_DRIVER_NAME, .id_table = rtsx_ids, .probe = rtsx_probe, @@ -1048,21 +1048,4 @@ static struct pci_driver driver = { .shutdown = rtsx_shutdown, }; -static int __init rtsx_init(void) -{ - pr_info("Initializing Realtek PCIE storage driver...\n"); - - return pci_register_driver(&driver); -} - -static void __exit rtsx_exit(void) -{ - pr_info("rtsx_exit() called\n"); - - pci_unregister_driver(&driver); - - pr_info("%s module exit\n", CR_DRIVER_NAME); -} - -module_init(rtsx_init) -module_exit(rtsx_exit) +module_pci_driver(rtsx_driver); -- cgit v1.2.3 From 956ff8213b4abecb7ac9bb6330b99b2847ebd318 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Thu, 12 Mar 2015 17:29:35 +0100 Subject: Staging: rtl8192u: Simplify if condition This patch removes macro true from if condition since variable priv->ieee80211->LinkDetectInfo.bBusyTraffic is already of type bool. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index b5a26f34b864..83597051a448 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -335,7 +335,7 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, if (!priv->up) return -ENETDOWN; - if (priv->ieee80211->LinkDetectInfo.bBusyTraffic == true) + if (priv->ieee80211->LinkDetectInfo.bBusyTraffic) return -EAGAIN; if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { struct iw_scan_req *req = (struct iw_scan_req *)b; -- cgit v1.2.3 From afbd19eea3f652b082b9b6718b351de58de86323 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Fri, 13 Mar 2015 10:06:24 +0530 Subject: Staging: fbtft: Remove unnecessary print messages These print functions are called at the beginning of the function and do not indicate any abnormal condition. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_hx8340bn.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_hx8340bn.c b/drivers/staging/fbtft/fb_hx8340bn.c index 072b7551d534..53edf253ed63 100644 --- a/drivers/staging/fbtft/fb_hx8340bn.c +++ b/drivers/staging/fbtft/fb_hx8340bn.c @@ -47,8 +47,6 @@ MODULE_PARM_DESC(emulate, "Force emulation in 9-bit mode"); static int init_display(struct fbtft_par *par) { - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); - par->fbtftops.reset(par); /* BTL221722-276L startup sequence, from datasheet */ @@ -110,9 +108,6 @@ static int init_display(struct fbtft_par *par) static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) { - fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, - "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); - write_reg(par, FBTFT_CASET, 0x00, xs, 0x00, xe); write_reg(par, FBTFT_RASET, 0x00, ys, 0x00, ye); write_reg(par, FBTFT_RAMWR); @@ -120,8 +115,6 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) static int set_var(struct fbtft_par *par) { - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); - /* MADCTL - Memory data access control */ /* RGB/BGR can be set with H/W pin SRGB and MADCTL BGR bit */ #define MY (1 << 7) @@ -162,8 +155,6 @@ static int set_gamma(struct fbtft_par *par, unsigned long *curves) 0b111, 0b111, 0b111, 0b111, 0b111, 0b111, 0b0, 0b0 }; int i, j; - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); - /* apply mask */ for (i = 0; i < par->gamma.num_curves; i++) for (j = 0; j < par->gamma.num_values; j++) -- cgit v1.2.3 From 68f4b7379651b107574a5151ee700a6b361920e2 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Fri, 13 Mar 2015 22:53:11 +0530 Subject: Staging: i2o: Move assignment out of if statement Checkpatch.pl suggest to avoid assignment in if statement. This patch moves assignments out of the if statement and place it before the if statement. This is done using following coccinelle script. @@ expression E1; identifier p; statement S; @@ - if ((p = E1)) + p = E1; + if (p) S Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/bus-osm.c | 3 ++- drivers/staging/i2o/iop.c | 24 ++++++++++++++++-------- drivers/staging/i2o/pci.c | 9 ++++++--- 3 files changed, 24 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/bus-osm.c b/drivers/staging/i2o/bus-osm.c index 7aa0339aea05..43e357eeeb67 100644 --- a/drivers/staging/i2o/bus-osm.c +++ b/drivers/staging/i2o/bus-osm.c @@ -69,7 +69,8 @@ static ssize_t i2o_bus_store_scan(struct device *d, struct i2o_device *i2o_dev = to_i2o_device(d); int rc; - if ((rc = i2o_bus_scan(i2o_dev))) + rc = i2o_bus_scan(i2o_dev); + if (rc) osm_warn("bus scan failed %d\n", rc); return count; diff --git a/drivers/staging/i2o/iop.c b/drivers/staging/i2o/iop.c index 6cae63c29e8d..23bdbe4aa480 100644 --- a/drivers/staging/i2o/iop.c +++ b/drivers/staging/i2o/iop.c @@ -1096,7 +1096,8 @@ int i2o_iop_add(struct i2o_controller *c) { int rc; - if ((rc = device_add(&c->device))) { + rc = device_add(&c->device); + if (rc) { osm_err("%s: could not add controller\n", c->name); goto iop_reset; } @@ -1105,24 +1106,28 @@ int i2o_iop_add(struct i2o_controller *c) osm_info("%s: This may take a few minutes if there are many devices\n", c->name); - if ((rc = i2o_iop_activate(c))) { + rc = i2o_iop_activate(c); + if (rc) { osm_err("%s: could not activate controller\n", c->name); goto device_del; } osm_debug("%s: building sys table...\n", c->name); - if ((rc = i2o_systab_build())) + rc = i2o_systab_build(); + if (rc) goto device_del; osm_debug("%s: online controller...\n", c->name); - if ((rc = i2o_iop_online(c))) + rc = i2o_iop_online(c); + if (rc) goto device_del; osm_debug("%s: getting LCT...\n", c->name); - if ((rc = i2o_exec_lct_get(c))) + rc = i2o_exec_lct_get(c); + if (rc) goto device_del; list_add(&c->list, &i2o_controllers); @@ -1192,13 +1197,16 @@ static int __init i2o_iop_init(void) printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n"); - if ((rc = i2o_driver_init())) + rc = i2o_driver_init(); + if (rc) goto exit; - if ((rc = i2o_exec_init())) + rc = i2o_exec_init(); + if (rc) goto driver_exit; - if ((rc = i2o_pci_init())) + rc = i2o_pci_init(); + if (rc) goto exec_exit; return 0; diff --git a/drivers/staging/i2o/pci.c b/drivers/staging/i2o/pci.c index b3b8a61dd4a6..49804c9cf74f 100644 --- a/drivers/staging/i2o/pci.c +++ b/drivers/staging/i2o/pci.c @@ -329,7 +329,8 @@ static int i2o_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) return -ENODEV; } - if ((rc = pci_enable_device(pdev))) { + rc = pci_enable_device(pdev); + if (rc) { printk(KERN_WARNING "i2o: couldn't enable device %s\n", pci_name(pdev)); return rc; @@ -410,7 +411,8 @@ static int i2o_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) #endif } - if ((rc = i2o_pci_alloc(c))) { + rc = i2o_pci_alloc(c); + if (rc) { printk(KERN_ERR "%s: DMA / IO allocation for I2O controller " "failed\n", c->name); goto free_controller; @@ -422,7 +424,8 @@ static int i2o_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto free_pci; } - if ((rc = i2o_iop_add(c))) + rc = i2o_iop_add(c); + if (rc) goto uninstall; if (i960) -- cgit v1.2.3 From d19cb862948a2de32068b6775a4e0a14fa4d8ec9 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Sat, 14 Mar 2015 01:03:07 +0530 Subject: Staging: ft1000: Iterate list using list_for_each_entry Code using doubly linked list is iterated generally using list_empty and list_entry functions, but it can be better written using list_for_each_entry macro. This patch replaces the while loop containing list_empty and list_entry with list_for_each_entry and list_for_each_entry_safe. list_for_each_entry is a macro which is used to iterate over a list of given type. So while loop used to iterate over a list can be replaced with list_for_each_entry macro. However, if list_del is used in the loop, then list_for_each_entry_safe is a better choice. This transformation is done by using the following coccinelle script. @ rule1 @ expression E1; identifier I1, I2; type T; iterator name list_for_each_entry; @@ - while (list_empty(&E1) == 0) + list_for_each_entry (I1, &E1, I2) { ...when != T *I1; - I1 = list_entry(E1.next, T, I2); ...when != list_del(...); when != list_del_init(...); } @ rule2 @ expression E1; identifier I1, I2; type T; iterator name list_for_each_entry_safe; @@ T *I1; + T *tmp; ... - while (list_empty(&E1) == 0) + list_for_each_entry_safe (I1, tmp, &E1, I2) { ...when != T *I1; - I1 = list_entry(E1.next, T, I2); ... } Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 8 ++++---- drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 4 ++-- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 5 ++--- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index e4559caed02b..e5890dbcb98a 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -364,6 +364,7 @@ static int ft1000_reset_card(struct net_device *dev) int i; unsigned long flags; struct prov_record *ptr; + struct prov_record *tmp; info->CardReady = 0; info->ProgConStat = 0; @@ -373,9 +374,8 @@ static int ft1000_reset_card(struct net_device *dev) /* del_timer(&poll_timer); */ /* Make sure we free any memory reserve for provisioning */ - while (list_empty(&info->prov_list) == 0) { + list_for_each_entry_safe(ptr, tmp, &info->prov_list, list) { pr_debug("deleting provisioning record\n"); - ptr = list_entry(info->prov_list.next, struct prov_record, list); list_del(&ptr->list); kfree(ptr->pprov_data); kfree(ptr); @@ -1973,6 +1973,7 @@ void stop_ft1000_card(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); struct prov_record *ptr; + struct prov_record *tmp; /* int cnt; */ info->CardReady = 0; @@ -1981,8 +1982,7 @@ void stop_ft1000_card(struct net_device *dev) ft1000_disable_interrupts(dev); /* Make sure we free any memory reserve for provisioning */ - while (list_empty(&info->prov_list) == 0) { - ptr = list_entry(info->prov_list.next, struct prov_record, list); + list_for_each_entry_safe(ptr, tmp, &info->prov_list, list) { list_del(&ptr->list); kfree(ptr->pprov_data); kfree(ptr); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index 71385231d72c..b427825ce001 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -742,6 +742,7 @@ static int ft1000_release(struct inode *inode, struct file *file) struct ft1000_usb *ft1000dev; int i; struct dpram_blk *pdpram_blk; + struct dpram_blk *tmp; dev = file->private_data; info = netdev_priv(dev); @@ -763,9 +764,8 @@ static int ft1000_release(struct inode *inode, struct file *file) if (i == MAX_NUM_APP) return 0; - while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) { + list_for_each_entry_safe(pdpram_blk, tmp, &ft1000dev->app_info[i].app_sqlist, list) { pr_debug("Remove and free memory queue up on slow queue\n"); - pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list); list_del(&pdpram_blk->list); ft1000_free_buffer(pdpram_blk, &freercvpool); } diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 26207781abcb..e6fb066e0dd2 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -451,16 +451,15 @@ static int ft1000_reset_card(struct net_device *dev) struct ft1000_usb *ft1000dev = info->priv; u16 tempword; struct prov_record *ptr; + struct prov_record *tmp; ft1000dev->fCondResetPend = true; info->CardReady = 0; ft1000dev->fProvComplete = false; /* Make sure we free any memory reserve for provisioning */ - while (list_empty(&info->prov_list) == 0) { + list_for_each_entry_safe(ptr, tmp, &info->prov_list, list) { pr_debug("deleting provisioning record\n"); - ptr = - list_entry(info->prov_list.next, struct prov_record, list); list_del(&ptr->list); kfree(ptr->pprov_data); kfree(ptr); -- cgit v1.2.3 From ca3d253eb9676ffc1bbe616b485826f337c7a616 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Sat, 14 Mar 2015 01:03:08 +0530 Subject: Staging: emxx_udc: Iterate list using list_for_each_entry Code using doubly linked list is iterated generally using list_empty and list_entry functions, but it can be better written using list_for_each_entry macro. This patch replaces the while loop containing list_empty and list_entry with list_for_each_entry and list_for_each_entry_safe. list_for_each_entry is a macro which is used to iterate over a list of given type. So while loop used to iterate over a list can be replaced with list_for_each_entry macro. However, if list_del is used in the loop, then list_for_each_entry_safe is a better choice. This transformation is done by using the following coccinelle script. @ rule1 @ expression E1; identifier I1, I2; type T; iterator name list_for_each_entry; @@ - while (list_empty(&E1) == 0) + list_for_each_entry (I1, &E1, I2) { ...when != T *I1; - I1 = list_entry(E1.next, T, I2); ...when != list_del(...); when != list_del_init(...); } @ rule2 @ expression E1; identifier I1, I2; type T; iterator name list_for_each_entry_safe; @@ T *I1; + T *tmp; ... - while (list_empty(&E1) == 0) + list_for_each_entry_safe (I1, tmp, &E1, I2) { ...when != T *I1; - I1 = list_entry(E1.next, T, I2); ... } Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 35dc1c444340..561d47e05623 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -2229,8 +2229,7 @@ static int _nbu2ss_nuke(struct nbu2ss_udc *udc, return 0; /* called with irqs blocked */ - while (!list_empty(&ep->queue)) { - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); + list_for_each_entry(req, &ep->queue, queue) { _nbu2ss_ep_done(ep, req, status); } -- cgit v1.2.3 From 7e6eaa90413f75f200ccb3d592537373b19016dc Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Sat, 14 Mar 2015 01:03:09 +0530 Subject: Staging: gdm72xx: Iterate list using list_for_each_entry Code using doubly linked list is iterated generally using list_empty and list_entry functions, but it can be better written using list_for_each_entry macro. This patch replaces the while loop containing list_empty and list_entry with list_for_each_entry and list_for_each_entry_safe. list_for_each_entry is a macro which is used to iterate over a list of given type. So while loop used to iterate over a list can be replaced with list_for_each_entry macro. However, if list_del is used in the loop, then list_for_each_entry_safe is a better choice. This transformation is done by using the following coccinelle script. @ rule1 @ expression E1; identifier I1, I2; type T; iterator name list_for_each_entry; @@ - while (list_empty(&E1) == 0) + list_for_each_entry (I1, &E1, I2) { ...when != T *I1; - I1 = list_entry(E1.next, T, I2); ...when != list_del(...); when != list_del_init(...); } @ rule2 @ expression E1; identifier I1, I2; type T; iterator name list_for_each_entry_safe; @@ T *I1; + T *tmp; ... - while (list_empty(&E1) == 0) + list_for_each_entry_safe (I1, tmp, &E1, I2) { ...when != T *I1; - I1 = list_entry(E1.next, T, I2); ... } Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_wimax.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index 9cab54bfa6f4..32fe93bcb0e6 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -129,11 +129,11 @@ static void __gdm_wimax_event_send(struct work_struct *work) int idx; unsigned long flags; struct evt_entry *e; + struct evt_entry *tmp; spin_lock_irqsave(&wm_event.evt_lock, flags); - while (!list_empty(&wm_event.evtq)) { - e = list_entry(wm_event.evtq.next, struct evt_entry, list); + list_for_each_entry_safe(e, tmp, &wm_event.evtq, list) { spin_unlock_irqrestore(&wm_event.evt_lock, flags); if (sscanf(e->dev->name, "wm%d", &idx) == 1) -- cgit v1.2.3 From acc4b97b3b0a09fc85a3b6a7b8acb14d4c0cf5a5 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 13 Mar 2015 20:45:25 +0300 Subject: Staging: rtl8723au: Remove parentheses around right side an assignment Parentheses are not needed around the right hand side of an assignment. This patch remove parenthese of such occurenses. Issue was detected and solved using the following coccinelle script: @rule1@ identifier x, y, z; expression E1, E2; @@ ( x = (y == z); | x = (E1 == E2); | x = -( ... -) ; ) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 16 ++++++++-------- drivers/staging/rtl8723au/core/rtw_recv.c | 4 ++-- drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 2 +- drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 12 ++++++------ drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c | 4 ++-- drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c | 4 ++-- drivers/staging/rtl8723au/hal/rtl8723au_recv.c | 4 ++-- drivers/staging/rtl8723au/hal/usb_halinit.c | 4 ++-- 8 files changed, 25 insertions(+), 25 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 0e0f73c86e53..d01ca1d75254 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -3842,7 +3842,7 @@ void issue_action_BA23a(struct rtw_adapter *padapter, IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK; } else { /* immediate ack & 64 buffer size */ - BA_para_set = (0x1002 | ((status & 0xf) << 2)); + BA_para_set = 0x1002 | ((status & 0xf) << 2); } put_unaligned_le16(BA_para_set, @@ -4745,7 +4745,7 @@ void report_survey_event23a(struct rtw_adapter *padapter, if (!pcmd_obj) return; - cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct survey_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); if (!pevtcmd) { kfree(pcmd_obj); @@ -4796,7 +4796,7 @@ void report_surveydone_event23a(struct rtw_adapter *padapter) if (!pcmd_obj) return; - cmdsz = (sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); if (!pevtcmd) { kfree(pcmd_obj); @@ -4840,7 +4840,7 @@ void report_join_res23a(struct rtw_adapter *padapter, int res) if (!pcmd_obj) return; - cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); if (!pevtcmd) { kfree(pcmd_obj); @@ -4890,7 +4890,7 @@ void report_del_sta_event23a(struct rtw_adapter *padapter, if (!pcmd_obj) return; - cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); if (!pevtcmd) { kfree(pcmd_obj); @@ -4918,7 +4918,7 @@ void report_del_sta_event23a(struct rtw_adapter *padapter, if (psta) mac_id = (int)psta->mac_id; else - mac_id = (-1); + mac_id = -1; pdel_sta_evt->mac_id = mac_id; @@ -4944,7 +4944,7 @@ void report_add_sta_event23a(struct rtw_adapter *padapter, if (!pcmd_obj) return; - cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header)); + cmdsz = sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header); pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); if (!pevtcmd) { kfree(pcmd_obj); @@ -5951,7 +5951,7 @@ int set_stakey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) /* 0~3 for default key, cmd_id = macid + 3, macid = aid+1; */ - cam_id = (psta->mac_id + 3); + cam_id = psta->mac_id + 3; DBG_8723A("Write CAM, mac_addr =%x:%x:%x:%x:%x:%x, " "cam_entry =%d\n", pparm->addr[0], diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 559dddee2648..9c783002caf2 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -2334,8 +2334,8 @@ void rtw_signal_stat_timer_hdl23a(unsigned long data) /* update value of signal_strength, rssi, signal_qual */ if (!check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY)) { - tmp_s = (avg_signal_strength + (_alpha - 1) * - recvpriv->signal_strength); + tmp_s = avg_signal_strength + (_alpha - 1) * + recvpriv->signal_strength; if (tmp_s %_alpha) tmp_s = tmp_s / _alpha + 1; else diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c index e46032e0077e..7f091da0273f 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c @@ -3208,7 +3208,7 @@ bthci_CmdDisconnectPhysicalLink(struct rtw_adapter *padapter, pBtDbg->dbgHciInfo.hciCmdCntDisconnectPhyLink++; PLH = *((u8 *)pHciCmd->Data); - PhysLinkDisconnectReason = (*((u8 *)pHciCmd->Data+1)); + PhysLinkDisconnectReason = *((u8 *)pHciCmd->Data+1); RTPRINT(FIOCTL, IOCTL_BT_HCICMD, ("HCI_DISCONNECT_PHYSICAL_LINK PhyHandle = 0x%x, Reason = 0x%x\n", PLH, PhysLinkDisconnectReason)); diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index ebe33392c8d9..d3dc24b0cc46 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -428,10 +428,10 @@ hal_ReadEFuse_WiFi(struct rtw_adapter *padapter, continue; offset |= ((efuseExtHdr & 0xF0) >> 1); - wden = (efuseExtHdr & 0x0F); + wden = efuseExtHdr & 0x0F; } else { - offset = ((efuseHeader >> 4) & 0x0f); - wden = (efuseHeader & 0x0f); + offset = (efuseHeader >> 4) & 0x0f; + wden = efuseHeader & 0x0f; } if (offset < EFUSE_MAX_SECTION_8723A) { @@ -527,10 +527,10 @@ hal_ReadEFuse_BT(struct rtw_adapter *padapter, continue; offset |= ((efuseExtHdr & 0xF0) >> 1); - wden = (efuseExtHdr & 0x0F); + wden = efuseExtHdr & 0x0F; } else { - offset = ((efuseHeader >> 4) & 0x0f); - wden = (efuseHeader & 0x0f); + offset = (efuseHeader >> 4) & 0x0f; + wden = efuseHeader & 0x0f; } if (offset < EFUSE_BT_MAX_SECTION) { diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c index d34a1481b13a..38f8c3de3029 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c @@ -126,7 +126,7 @@ PHY_SetBBReg(struct rtw_adapter *Adapter, u32 RegAddr, u32 BitMask, u32 Data) if (BitMask != bMaskDWord) {/* if not "double word" write */ OriginalValue = rtl8723au_read32(Adapter, RegAddr); BitShift = phy_CalculateBitShift(BitMask); - Data = ((OriginalValue & (~BitMask)) | (Data << BitShift)); + Data = (OriginalValue & (~BitMask)) | (Data << BitShift); } rtl8723au_write32(Adapter, RegAddr, Data); @@ -389,7 +389,7 @@ PHY_SetRFReg(struct rtw_adapter *Adapter, enum RF_RADIO_PATH eRFPath, if (BitMask != bRFRegOffsetMask) { Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr); BitShift = phy_CalculateBitShift(BitMask); - Data = ((Original_Value & (~BitMask)) | (Data << BitShift)); + Data = (Original_Value & (~BitMask)) | (Data << BitShift); } phy_RFSerialWrite(Adapter, eRFPath, RegAddr, Data); diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c b/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c index 32c58c6124b0..3e3f18634ffe 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c @@ -267,8 +267,8 @@ getTxPowerWriteValByRegulatory(struct rtw_adapter *Adapter, u8 Channel, break; case 2: /* Better regulatory */ /* don't increase any power diff */ - writeVal = ((index < 2) ? powerBase0[rf] : - powerBase1[rf]); + writeVal = (index < 2) ? powerBase0[rf] : + powerBase1[rf]; break; case 3: /* Customer defined power diff. */ chnlGroup = 0; diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c index 6075b6dc1bee..aae433f0e8af 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c +++ b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c @@ -194,8 +194,8 @@ void update_recvframe_phyinfo(struct recv_frame *precvframe, bool matchbssid = false; u8 *bssid; - matchbssid = (!ieee80211_is_ctl(hdr->frame_control) && - !pattrib->icv_err && !pattrib->crc_err); + matchbssid = !ieee80211_is_ctl(hdr->frame_control) && + !pattrib->icv_err && !pattrib->crc_err; if (matchbssid) { switch (hdr->frame_control & diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index bd9c549f4a0a..0d08863d72bd 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -736,8 +736,8 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) rtl8723a_InitHalDm(Adapter); - val8 = ((WiFiNavUpperUs + HAL_8723A_NAV_UPPER_UNIT - 1) / - HAL_8723A_NAV_UPPER_UNIT); + val8 = (WiFiNavUpperUs + HAL_8723A_NAV_UPPER_UNIT - 1) / + HAL_8723A_NAV_UPPER_UNIT; rtl8723au_write8(Adapter, REG_NAV_UPPER, val8); /* 2011/03/09 MH debug only, UMC-B cut pass 2500 S5 test, but we need to fin root cause. */ -- cgit v1.2.3 From 8126e17f89259dfb6bf8ba6a2303a62702099e37 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 13 Mar 2015 20:46:57 +0300 Subject: Staging: media: Remove parentheses around right side an assignment Parentheses are not needed around the right hand side of an assignment. This patch remove parenthese of such occurenses. Issue was detected and solved using the following coccinelle script: @rule1@ identifier x, y, z; expression E1, E2; @@ ( x = (y == z); | x = (E1 == E2); | x = -( ... -) ; ) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 8 ++++---- drivers/staging/media/lirc/lirc_parallel.c | 4 ++-- drivers/staging/media/lirc/lirc_serial.c | 2 +- drivers/staging/media/mn88472/mn88472.c | 2 +- drivers/staging/media/mn88473/mn88473.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index fd8de766dd5c..25ab2e028bc6 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -1448,8 +1448,8 @@ static void bcm2048_parse_rds_pi(struct bcm2048_device *bdev) /* Block A match, only data without crc errors taken */ if (bdev->rds_info.radio_text[i] == BCM2048_RDS_BLOCK_A) { - pi = ((bdev->rds_info.radio_text[i+1] << 8) + - bdev->rds_info.radio_text[i+2]); + pi = (bdev->rds_info.radio_text[i+1] << 8) + + bdev->rds_info.radio_text[i+2]; if (!bdev->rds_info.rds_pi) { bdev->rds_info.rds_pi = pi; @@ -1503,8 +1503,8 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i) if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == BCM2048_RDS_BLOCK_B) { - rt_id = (bdev->rds_info.radio_text[i+1] & - BCM2048_RDS_BLOCK_MASK); + rt_id = bdev->rds_info.radio_text[i+1] & + BCM2048_RDS_BLOCK_MASK; rt_group_b = bdev->rds_info.radio_text[i+1] & BCM2048_RDS_GROUP_AB_MASK; rt_ab = bdev->rds_info.radio_text[i+2] & diff --git a/drivers/staging/media/lirc/lirc_parallel.c b/drivers/staging/media/lirc/lirc_parallel.c index df556442d9a6..c1408342b1d0 100644 --- a/drivers/staging/media/lirc/lirc_parallel.c +++ b/drivers/staging/media/lirc/lirc_parallel.c @@ -161,8 +161,8 @@ static unsigned int init_lirc_timer(void) || (now.tv_sec == tv.tv_sec && now.tv_usec < tv.tv_usec))); - timeelapsed = ((now.tv_sec + 1 - tv.tv_sec)*1000000 - + (now.tv_usec - tv.tv_usec)); + timeelapsed = (now.tv_sec + 1 - tv.tv_sec)*1000000 + + (now.tv_usec - tv.tv_usec); if (count >= 1000 && timeelapsed > 0) { if (default_timer == 0) { /* autodetect timer */ diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 56df8d751765..dc7984455c3a 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -838,7 +838,7 @@ static int lirc_serial_probe(struct platform_device *dev) nhigh++; msleep(40); } - sense = (nlow >= nhigh ? 1 : 0); + sense = nlow >= nhigh ? 1 : 0; dev_info(&dev->dev, "auto-detected active %s receiver\n", sense ? "low" : "high"); } else diff --git a/drivers/staging/media/mn88472/mn88472.c b/drivers/staging/media/mn88472/mn88472.c index 6eebe564e557..2a68582e7f71 100644 --- a/drivers/staging/media/mn88472/mn88472.c +++ b/drivers/staging/media/mn88472/mn88472.c @@ -276,7 +276,7 @@ static int mn88472_init(struct dvb_frontend *fe) remaining -= (dev->i2c_wr_max - 1)) { len = remaining; if (len > (dev->i2c_wr_max - 1)) - len = (dev->i2c_wr_max - 1); + len = dev->i2c_wr_max - 1; ret = regmap_bulk_write(dev->regmap[0], 0xf6, &fw->data[fw->size - remaining], len); diff --git a/drivers/staging/media/mn88473/mn88473.c b/drivers/staging/media/mn88473/mn88473.c index 197e2d0871f4..5baeb03ab3d1 100644 --- a/drivers/staging/media/mn88473/mn88473.c +++ b/drivers/staging/media/mn88473/mn88473.c @@ -243,7 +243,7 @@ static int mn88473_init(struct dvb_frontend *fe) remaining -= (dev->i2c_wr_max - 1)) { len = remaining; if (len > (dev->i2c_wr_max - 1)) - len = (dev->i2c_wr_max - 1); + len = dev->i2c_wr_max - 1; ret = regmap_bulk_write(dev->regmap[0], 0xf6, &fw->data[fw->size - remaining], len); -- cgit v1.2.3 From 964308a6b40bcea5f8a3c3af678c0a87a9b94907 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Fri, 13 Mar 2015 20:51:17 +0300 Subject: Staging: ft1000: Remove parentheses around right side an assignment Parentheses are not needed around the right hand side of an assignment. This patch remove parenthese of such occurenses. Issue was detected and solved using the following coccinelle script: @rule1@ identifier x, y, z; expression E1, E2; @@ ( x = (y == z); | x = (E1 == E2); | x = -( ... -) ; ) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 4 ++-- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 4 ++-- drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 2 +- drivers/staging/ft1000/ft1000-usb/ft1000_download.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c index cbf59abd1825..ddb74665fae9 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c @@ -276,8 +276,8 @@ u16 hdr_checksum(struct pseudo_hdr *pHdr) u16 *usPtr = (u16 *)pHdr; u16 chksum; - chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^ - usPtr[4]) ^ usPtr[5]) ^ usPtr[6]); + chksum = (((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^ + usPtr[4]) ^ usPtr[5]) ^ usPtr[6]; return chksum; } diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index e5890dbcb98a..0afe37f1255d 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -1295,9 +1295,9 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) 2) >> 8) & 0xff; } else { portid = - (ft1000_read_dpram_mag_16 + ft1000_read_dpram_mag_16 (dev, FT1000_MAG_PORT_ID, - FT1000_MAG_PORT_ID_INDX) & 0xff); + FT1000_MAG_PORT_ID_INDX) & 0xff; } pr_debug("DSP_QID = 0x%x\n", portid); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index b427825ce001..2d758fb26eac 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -301,7 +301,7 @@ static int ft1000_open(struct inode *inode, struct file *file) struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private; int i, num; - num = (MINOR(inode->i_rdev) & 0xf); + num = MINOR(inode->i_rdev) & 0xf; pr_debug("minor number=%d\n", num); info = file->private_data = netdev_priv(dev->net); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index 800450ff5222..5def347beb08 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c @@ -368,8 +368,8 @@ static u16 hdr_checksum(struct pseudo_hdr *pHdr) u16 chksum; - chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^ - usPtr[4]) ^ usPtr[5]) ^ usPtr[6]); + chksum = (((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^ + usPtr[4]) ^ usPtr[5]) ^ usPtr[6]; return chksum; } -- cgit v1.2.3 From 93275c8068b42ba0622698abe10bc860d8744451 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Mon, 16 Mar 2015 01:26:37 +0300 Subject: Staging: emuxx_udc: replace pr_* with dev_* dev_* is prefered over pr_* when appropriate dev structure is present. This patch replace pr_info and pr_warn with its dev_ counterpart. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 561d47e05623..fbf82bc735cf 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -1426,7 +1426,7 @@ static void _nbu2ss_set_test_mode(struct nbu2ss_udc *udc, u32 mode) if (mode > MAX_TEST_MODE_NUM) return; - pr_info("SET FEATURE : test mode = %d\n", mode); + dev_info(udc->dev, "SET FEATURE : test mode = %d\n", mode); data = _nbu2ss_readl(&udc->p_regs->USB_CONTROL); data &= ~TEST_FORCE_ENABLE; @@ -1885,8 +1885,8 @@ static inline void _nbu2ss_ep0_int(struct nbu2ss_udc *udc) | STG_END_INT | EP0_OUT_NULL_INT); if (status == 0) { - pr_info("--- %s Not Decode Interrupt\n", __func__); - pr_info("--- EP0_STATUS = 0x%08x\n", intr); + dev_info(udc->dev, "%s Not Decode Interrupt\n", __func__); + dev_info(udc->dev, "EP0_STATUS = 0x%08x\n", intr); return; } @@ -2406,7 +2406,7 @@ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc) udc->linux_suspended = 0; _nbu2ss_reset_controller(udc); - pr_info(" ----- VBUS OFF\n"); + dev_info(udc->dev, " ----- VBUS OFF\n"); if (udc->vbus_active == 1) { /* VBUS OFF */ @@ -2432,7 +2432,7 @@ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc) if (reg_dt == 0) return; - pr_info(" ----- VBUS ON\n"); + dev_info(udc->dev, " ----- VBUS ON\n"); if (udc->linux_suspended) return; @@ -2767,7 +2767,7 @@ static int nbu2ss_ep_queue( /* INFO("=== %s(ep%d), zero=%d\n", __func__, ep->epnum, _req->zero); */ if (udc->vbus_active == 0) { - pr_info("Can't ep_queue (VBUS OFF)\n"); + dev_info(udc->dev, "Can't ep_queue (VBUS OFF)\n"); return -ESHUTDOWN; } @@ -3091,7 +3091,7 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget) data = gpio_get_value(VBUS_VALUE); if (data == 0) { - pr_warn("VBUS LEVEL = %d\n", data); + dev_warn(&pgadget->dev, "VBUS LEVEL = %d\n", data); return -EINVAL; } -- cgit v1.2.3 From 9d877fdbf3e76162c92e2e58e6993b133ee302fe Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Mon, 16 Mar 2015 19:34:07 +0530 Subject: staging: gdm724x: use !x instead of x == NULL Functions like devm_kzalloc, kmalloc_array, devm_ioremap, usb_alloc_urb, alloc_netdev return NULL as a return value on failure. Generally, When NULL represents failure, !x is commonly used. This patch cleans up the tests on the results of these functions, thereby using !x instead of x == NULL or NULL == x. This is done via following coccinelle script: @prob_7@ identifier x; statement S; @@ ( x = devm_kzalloc(...); | x = usb_alloc_urb(...); | x = kmalloc_array(...); | x = devm_ioremap(...); | x = alloc_netdev(...); ) ... - if(NULL == x) + if(!x) S Further we have used isomorphism characteristics of coccinelle to indicate x == NULL and NULL == x are equivalent. This is done via following iso script. Expression @ is_null @ expression X; @@ X == NULL <=> NULL == X Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_lte.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 7c4a77bb94aa..a8d2cffb411c 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -889,7 +889,7 @@ int register_lte_device(struct phy_dev *phy_dev, /* Allocate netdev */ net = alloc_netdev(sizeof(struct nic), pdn_dev_name, NET_NAME_UNKNOWN, ether_setup); - if (net == NULL) { + if (!net) { pr_err("alloc_netdev failed\n"); ret = -ENOMEM; goto err; -- cgit v1.2.3 From 87e3dbc27c025b3168922c29b06775f8a8cfbce6 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Mon, 16 Mar 2015 19:34:08 +0530 Subject: Staging: gdm72xx: use !x instead of x == NULL Functions like devm_kzalloc, kmalloc_array, devm_ioremap, usb_alloc_urb, alloc_netdev return NULL as a return value on failure. Generally, When NULL represents failure, !x is commonly used. This patch cleans up the tests on the results of these functions, thereby using !x instead of x == NULL or NULL == x. This is done via following coccinelle script: @prob_7@ identifier x; statement S; @@ ( x = devm_kzalloc(...); | x = usb_alloc_urb(...); | x = kmalloc_array(...); | x = devm_ioremap(...); | x = alloc_netdev(...); ) ... - if(NULL == x) + if(!x) S Further we have used isomorphism characteristics of coccinelle to indicate x == NULL and NULL == x are equivalent. This is done via following iso script. Expression @ is_null @ expression X; @@ X == NULL <=> NULL == X Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_wimax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index 32fe93bcb0e6..61d168e82011 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -749,7 +749,7 @@ int register_wimax_device(struct phy_dev *phy_dev, struct device *pdev) dev = alloc_netdev(sizeof(*nic), "wm%d", NET_NAME_UNKNOWN, ether_setup); - if (dev == NULL) { + if (!dev) { pr_err("alloc_etherdev failed\n"); return -ENOMEM; } -- cgit v1.2.3 From 6e3f3bb8631600ffc5788a4e9476ea841feac964 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Mon, 16 Mar 2015 19:34:09 +0530 Subject: Staging: goldfish: use !x instead of x == NULL Functions like devm_kzalloc, kmalloc_array, devm_ioremap, usb_alloc_urb, alloc_netdev return NULL as a return value on failure. Generally, When NULL represents failure, !x is commonly used. This patch cleans up the tests on the results of these functions, thereby using !x instead of x == NULL or NULL == x. This is done via following coccinelle script: @prob_7@ identifier x; statement S; @@ ( x = devm_kzalloc(...); | x = usb_alloc_urb(...); | x = kmalloc_array(...); | x = devm_ioremap(...); | x = alloc_netdev(...); ) ... - if(NULL == x) + if(!x) S Further we have used isomorphism characteristics of coccinelle to indicate x == NULL and NULL == x are equivalent. This is done via following iso script. Expression @ is_null @ expression X; @@ X == NULL <=> NULL == X Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/goldfish/goldfish_audio.c | 2 +- drivers/staging/goldfish/goldfish_nand.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/goldfish/goldfish_audio.c b/drivers/staging/goldfish/goldfish_audio.c index c7f8f1c77401..81abf98025c5 100644 --- a/drivers/staging/goldfish/goldfish_audio.c +++ b/drivers/staging/goldfish/goldfish_audio.c @@ -273,7 +273,7 @@ static int goldfish_audio_probe(struct platform_device *pdev) dma_addr_t buf_addr; data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); - if (data == NULL) + if (!data) return -ENOMEM; spin_lock_init(&data->lock); init_waitqueue_head(&data->wait); diff --git a/drivers/staging/goldfish/goldfish_nand.c b/drivers/staging/goldfish/goldfish_nand.c index d68f216a7e77..213877a2c430 100644 --- a/drivers/staging/goldfish/goldfish_nand.c +++ b/drivers/staging/goldfish/goldfish_nand.c @@ -330,7 +330,7 @@ static int goldfish_nand_init_device(struct platform_device *pdev, mtd->priv = nand; name = devm_kzalloc(&pdev->dev, name_len + 1, GFP_KERNEL); - if (name == NULL) + if (!name) return -ENOMEM; mtd->name = name; @@ -383,7 +383,7 @@ static int goldfish_nand_probe(struct platform_device *pdev) return -ENODEV; base = devm_ioremap(&pdev->dev, r->start, PAGE_SIZE); - if (base == NULL) + if (!base) return -ENOMEM; version = readl(base + NAND_VERSION); @@ -399,7 +399,7 @@ static int goldfish_nand_probe(struct platform_device *pdev) nand = devm_kzalloc(&pdev->dev, sizeof(*nand) + sizeof(struct mtd_info) * num_dev, GFP_KERNEL); - if (nand == NULL) + if (!nand) return -ENOMEM; mutex_init(&nand->lock); -- cgit v1.2.3 From 4c42d979816a0bc1d87aaabc4089d857942ddfe2 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Mon, 16 Mar 2015 19:34:11 +0530 Subject: Staging: nvec: use !x instead of x == NULL Functions like devm_kzalloc, kmalloc_array, devm_ioremap, usb_alloc_urb, alloc_netdev return NULL as a return value on failure. Generally, When NULL represents failure, !x is commonly used. This patch cleans up the tests on the results of these functions, thereby using !x instead of x == NULL or NULL == x. This is done via following coccinelle script: @prob_7@ identifier x; statement S; @@ ( x = devm_kzalloc(...); | x = usb_alloc_urb(...); | x = kmalloc_array(...); | x = devm_ioremap(...); | x = alloc_netdev(...); ) ... - if(NULL == x) + if(!x) S Further we have used isomorphism characteristics of coccinelle to indicate x == NULL and NULL == x are equivalent. This is done via following iso script. Expression @ is_null @ expression X; @@ X == NULL <=> NULL == X Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec.c | 2 +- drivers/staging/nvec/nvec_paz00.c | 2 +- drivers/staging/nvec/nvec_power.c | 2 +- drivers/staging/nvec/nvec_ps2.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 5868ebb8389e..1bdc8d001e65 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -803,7 +803,7 @@ static int tegra_nvec_probe(struct platform_device *pdev) } nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL); - if (nvec == NULL) + if (!nvec) return -ENOMEM; platform_set_drvdata(pdev, nvec); diff --git a/drivers/staging/nvec/nvec_paz00.c b/drivers/staging/nvec/nvec_paz00.c index f0cea0e43c96..68146bfee2b3 100644 --- a/drivers/staging/nvec/nvec_paz00.c +++ b/drivers/staging/nvec/nvec_paz00.c @@ -51,7 +51,7 @@ static int nvec_paz00_probe(struct platform_device *pdev) int ret = 0; led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); - if (led == NULL) + if (!led) return -ENOMEM; led->cdev.max_brightness = NVEC_LED_MAX; diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c index 6a1459d4f8fb..3621b661aba8 100644 --- a/drivers/staging/nvec/nvec_power.c +++ b/drivers/staging/nvec/nvec_power.c @@ -378,7 +378,7 @@ static int nvec_power_probe(struct platform_device *pdev) struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); power = devm_kzalloc(&pdev->dev, sizeof(struct nvec_power), GFP_NOWAIT); - if (power == NULL) + if (!power) return -ENOMEM; dev_set_drvdata(&pdev->dev, power); diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index 4fd63c239454..6ebbc82323c3 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -109,7 +109,7 @@ static int nvec_mouse_probe(struct platform_device *pdev) char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 }; ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL); - if (ser_dev == NULL) + if (!ser_dev) return -ENOMEM; ser_dev->id.type = SERIO_PS_PSTHRU; -- cgit v1.2.3 From 549fb6e399bc3dfa60134c8ff6501414d423c052 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Mon, 9 Mar 2015 23:06:55 +0100 Subject: staging: unisys: fix checkpatch warnings This fixes "braces {} are not necessary for single statement blocks" in uislib. Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/uislib/uislib.c | 18 ++++++------------ drivers/staging/unisys/uislib/uisthread.c | 3 +-- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 4318f06f6e7e..d23e0df16b01 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -534,9 +534,8 @@ static int pause_device(struct controlvm_message *msg) } else { return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } - if (!virt_control_chan_func) { + if (!virt_control_chan_func) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; - } if (!virt_control_chan_func(&cmd)) { return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; @@ -593,9 +592,8 @@ static int resume_device(struct controlvm_message *msg) } else { return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } - if (!virt_control_chan_func) { + if (!virt_control_chan_func) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; - } if (!virt_control_chan_func(&cmd)) { return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; @@ -665,13 +663,11 @@ static int destroy_device(struct controlvm_message *msg, char *buf) * on which accesses the channel and you will get a "unable to handle * kernel paging request" */ - if (dev->polling) { + if (dev->polling) uislib_disable_channel_interrupts(bus_no, dev_no); - } /* unmap the channel memory for the device. */ - if (!msg->hdr.flags.test_message) { + if (!msg->hdr.flags.test_message) uislib_iounmap(dev->chanptr); - } kfree(dev); bus->device[dev_no] = NULL; } @@ -928,9 +924,8 @@ uislib_client_inject_pause_vnic(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_standby; rc = pause_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { + if (rc != CONTROLVM_RESP_SUCCESS) return -1; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vnic); @@ -1195,9 +1190,8 @@ static int process_incoming(void *v) */ if (kthread_should_stop()) break; - if (en_smart_wakeup == 0xFF) { + if (en_smart_wakeup == 0xFF) break; - } /* wait for POLLJIFFIES_NORMAL jiffies, or until * someone wakes up poll_dev_wake_q, * whichever comes first only do a wait when we have diff --git a/drivers/staging/unisys/uislib/uisthread.c b/drivers/staging/unisys/uislib/uisthread.c index bbe2a23784a5..d3c973b617ee 100644 --- a/drivers/staging/unisys/uislib/uisthread.c +++ b/drivers/staging/unisys/uislib/uisthread.c @@ -63,8 +63,7 @@ uisthread_stop(struct uisthread_info *thrinfo) if (wait_for_completion_timeout(&thrinfo->has_stopped, 60 * HZ)) stopped = 1; - if (stopped) { + if (stopped) thrinfo->id = 0; - } } EXPORT_SYMBOL_GPL(uisthread_stop); -- cgit v1.2.3 From bdbceb4de3e383a9d434899ef5ba0fe1da6c2a31 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 12 Mar 2015 15:46:29 +0300 Subject: staging: unisys: fix some debugfs output When we removed the ERRDEV() macro we made a small mistake so now it doesn't print the "Virtual PCI devices" section header. Fixes: 0aca78449b58 ('staging: unisys: remove ERRDEV macros') Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/virtpci/virtpci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index 43b573611d51..cfefdabd0fe7 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -1289,8 +1289,8 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, printparam.str_pos = &str_pos; printparam.buf = vbuf; printparam.len = &len; - if (bus_for_each_dev(&virtpci_bus_type, NULL, - (void *)&printparam, print_vbus)) + bus_for_each_dev(&virtpci_bus_type, NULL, (void *)&printparam, + print_vbus); str_pos += scnprintf(vbuf + str_pos, len - str_pos, "\n Virtual PCI devices\n"); -- cgit v1.2.3 From 9a836c0a6310e6e970ff63d030d7213c874ae7af Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Sun, 15 Mar 2015 17:38:47 +0200 Subject: staging: unisys: print MAC address via %pM This patch converts code to use %pM specifier instead of placing each byte on stack. Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/virtpci/virtpci.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index cfefdabd0fe7..3f399e60ae8d 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -1310,15 +1310,10 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, tmpvpcidev->scsi.max.cmd_per_lun); } else { str_pos += scnprintf(vbuf + str_pos, len - str_pos, - "[%d:%d] VNic:%02x:%02x:%02x:%02x:%02x:%02x num_rcv_bufs:%d mtu:%d", + "[%d:%d] VNic:%pM num_rcv_bufs:%d mtu:%d", tmpvpcidev->bus_no, tmpvpcidev->device_no, - tmpvpcidev->net.mac_addr[0], - tmpvpcidev->net.mac_addr[1], - tmpvpcidev->net.mac_addr[2], - tmpvpcidev->net.mac_addr[3], - tmpvpcidev->net.mac_addr[4], - tmpvpcidev->net.mac_addr[5], + tmpvpcidev->net.mac_addr, tmpvpcidev->net.num_rcv_bufs, tmpvpcidev->net.mtu); } -- cgit v1.2.3 From e0e982b436cd678dc80a1167a00a8104f54bb761 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Mon, 16 Mar 2015 18:41:31 +0300 Subject: Staging: rtl8712: replace memcpy with ether_addr_copy This patch replace memcpy with ethe_addr_copy to address the following warning generated by checkpatch.pl: ""Prefer ether_addr_copy over memcpy if the Ethernet addresses are __aligned(2)" Follwoing is the output of pahole for the relevant datastructures: 1- for "iwe.u.ap_addr.sa_data" and "wrqu->ap_addr.sa_data" struct sockaddr { sa_family_t sa_family; /* 0 2 */ char sa_data[14]; /* 2 14 */ /* size: 16, cachelines: 1, members: 2 */ /* last cacheline: 16 bytes */ }; struct iw_event { __u16 len; /* 0 2 */ __u16 cmd; /* 2 2 */ /* XXX 4 bytes hole, try to pack */ union iwreq_data u; /* 8 16 */ /* size: 24, cachelines: 1, members: 3 */ /* sum members: 20, holes: 1, sum holes: 4 */ /* last cacheline: 24 bytes */ }; 2- for "pnetwork->network.MacAddress" and "pcur_bss->MacAddress" struct wlan_network { struct list_head list; /* 0 16 */ int network_type; /* 16 4 */ int fixed; /* 20 4 */ unsigned int last_scanned; /* 24 4 */ int aid; /* 28 4 */ int join_res; /* 32 4 */ struct ndis_wlan_bssid_ex network; /* 36 884 */ /* --- cacheline 14 boundary (896 bytes) was 24 bytes ago --- */ /* size: 920, cachelines: 15, members: 7 */ /* last cacheline: 24 bytes */ }; struct ndis_wlan_bssid_ex { u32 Length; /* 0 4 */ unsigned char MacAddress[6]; /* 4 6 */ u8 Reserved[2]; /* 10 2 */ struct ndis_802_11_ssid Ssid; /* 12 36 */ u32 Privacy; /* 48 4 */ s32 Rssi; /* 52 4 */ enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; /* 56 4 */ struct NDIS_802_11_CONFIGURATION Configuration; /* 60 32 */ /* --- cacheline 1 boundary (64 bytes) was 28 bytes ago --- */ enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; /* 92 4 */ NDIS_802_11_RATES_EX SupportedRates; /* 96 16 */ u32 IELength; /* 112 4 */ u8 IEs[768]; /* 116 768 */ /* --- cacheline 13 boundary (832 bytes) was 52 bytes ago --- */ /* size: 884, cachelines: 14, members: 12 */ /* last cacheline: 52 bytes */ }; Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index eacba8c37cc1..81f39c315947 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -185,7 +185,7 @@ static inline char *translate_scan(struct _adapter *padapter, /* AP MAC address */ iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, pnetwork->network.MacAddress, ETH_ALEN); + ether_addr_copy(iwe.u.ap_addr.sa_data, pnetwork->network.MacAddress); start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); /* Add the ESSID */ iwe.cmd = SIOCGIWESSID; @@ -1117,7 +1117,7 @@ static int r8711_wx_get_wap(struct net_device *dev, wrqu->ap_addr.sa_family = ARPHRD_ETHER; if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE | WIFI_AP_STATE)) - memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN); + ether_addr_copy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress); else eth_zero_addr(wrqu->ap_addr.sa_data); return 0; -- cgit v1.2.3 From 70dada1a055e91802675ecd2eeb07abec8948027 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 16 Mar 2015 21:55:15 +0200 Subject: Staging: rtl8192u: Do not add new typedefs This patch removes the dig_t and DRxPathSel type definitions in order to avoid the following warning: "WARNING: Do not add new typedefs". Done with coccinelle and this script: @r@ type t; identifier id; @@ typedef struct id {...} t; @script:python get_name@ t << r.t; tdres; @@ coccinelle.tdres = t.replace("_t", ""); @r_match@ type r.t; identifier r.id; identifier get_name.tdres; @@ -typedef struct -id +tdres {...} -t ; @r_replace@ type r.t; identifier get_name.tdres; @@ -t +struct tdres Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 5 +++-- drivers/staging/rtl8192u/r8192U_dm.h | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 8669162a4a7d..402abdfc7ac5 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -36,11 +36,12 @@ static u32 edca_setting_UL[HT_IOT_PEER_MAX] = { /*------------------------Define global variable-----------------------------*/ /* Debug variable ? */ -dig_t dm_digtable; +struct dig dm_digtable; /* Store current software write register content for MAC PHY. */ u8 dm_shadow[16][256] = { {0} }; /* For Dynamic Rx Path Selection by Signal Strength */ -DRxPathSel DM_RxPathSelTable; +struct DRxPathSel DM_RxPathSelTable; + /*------------------------Define global variable-----------------------------*/ diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h index 3008f91ad4cf..091fdd1c1ff9 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -67,7 +67,7 @@ /*------------------------------Define structure----------------------------*/ /* 2007/10/04 MH Define upper and lower threshold of DIG enable or disable. */ -typedef struct _dynamic_initial_gain_threshold_ { +struct dig { u8 dig_enable_flag; u8 dig_algorithm; u8 dbg_mode; @@ -98,7 +98,7 @@ typedef struct _dynamic_initial_gain_threshold_ { bool initialgain_lowerbound_state; long rssi_val; -} dig_t; +}; typedef enum tag_dynamic_init_gain_state_definition { DM_STA_DIG_OFF = 0, @@ -163,7 +163,7 @@ typedef enum tag_dig_cck_cs_ratio_state_definition { DIG_CS_RATIO_HIGHER = 1, DIG_CS_MAX } dm_dig_cs_ratio_e; -typedef struct _Dynamic_Rx_Path_Selection_ { +struct DRxPathSel { u8 Enable; u8 DbgMode; u8 cck_method; @@ -177,7 +177,7 @@ typedef struct _Dynamic_Rx_Path_Selection_ { u8 rf_rssi[4]; u8 rf_enable_rssi_th[4]; long cck_pwdb_sta[4]; -} DRxPathSel; +}; typedef enum tag_CCK_Rx_Path_Method_Definition { CCK_Rx_Version_1 = 0, @@ -200,9 +200,9 @@ typedef struct tag_Tx_Config_Cmd_Format { /*------------------------Export global variable----------------------------*/ -extern dig_t dm_digtable; +extern struct dig dm_digtable; extern u8 dm_shadow[16][256]; -extern DRxPathSel DM_RxPathSelTable; +extern struct DRxPathSel DM_RxPathSelTable; /*------------------------Export global variable----------------------------*/ -- cgit v1.2.3 From 3962d2af9a173739c6ff41e35954dd6b6867d311 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Mon, 16 Mar 2015 21:56:13 +0200 Subject: Staging: rtl8192u: Rename struct to avoid CamelCase This patch renames struct DRxPathSel to dynamic_rx_path_sel in order to keep the notations consistent and to remove the warning: "CHECK: Avoid CamelCase". Done with coccinelle: @@ @@ struct -DRxPathSel +dynamic_rx_path_sel {...} @@ @@ struct -DRxPathSel +dynamic_rx_path_sel Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 2 +- drivers/staging/rtl8192u/r8192U_dm.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 402abdfc7ac5..12dd19e1159b 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -40,7 +40,7 @@ struct dig dm_digtable; /* Store current software write register content for MAC PHY. */ u8 dm_shadow[16][256] = { {0} }; /* For Dynamic Rx Path Selection by Signal Strength */ -struct DRxPathSel DM_RxPathSelTable; +struct dynamic_rx_path_sel DM_RxPathSelTable; /*------------------------Define global variable-----------------------------*/ diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h index 091fdd1c1ff9..6cd32eb44085 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -163,7 +163,7 @@ typedef enum tag_dig_cck_cs_ratio_state_definition { DIG_CS_RATIO_HIGHER = 1, DIG_CS_MAX } dm_dig_cs_ratio_e; -struct DRxPathSel { +struct dynamic_rx_path_sel { u8 Enable; u8 DbgMode; u8 cck_method; @@ -202,7 +202,7 @@ typedef struct tag_Tx_Config_Cmd_Format { /*------------------------Export global variable----------------------------*/ extern struct dig dm_digtable; extern u8 dm_shadow[16][256]; -extern struct DRxPathSel DM_RxPathSelTable; +extern struct dynamic_rx_path_sel DM_RxPathSelTable; /*------------------------Export global variable----------------------------*/ -- cgit v1.2.3 From dfc16973973e9730d7aab2a2497d0cdb9e4a999b Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Mon, 16 Mar 2015 20:14:56 +0300 Subject: Staging: lustre: Fix spelling mistakes This patch fix the following spelling mistakes: interoprability, SEPERATOR, defult. Issue found using checkpatch.pl. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/lproc_llite.c | 12 ++++++------ drivers/staging/lustre/lustre/obdclass/obd_mount.c | 4 ++-- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 4 ++-- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 2b8f147cfcb4..83a9b85474e1 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -727,7 +727,7 @@ static int ll_max_easize_seq_show(struct seq_file *m, void *v) } LPROC_SEQ_FOPS_RO(ll_max_easize); -static int ll_defult_easize_seq_show(struct seq_file *m, void *v) +static int ll_default_easize_seq_show(struct seq_file *m, void *v) { struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); @@ -741,7 +741,7 @@ static int ll_defult_easize_seq_show(struct seq_file *m, void *v) seq_printf(m, "%u\n", ealen); return 0; } -LPROC_SEQ_FOPS_RO(ll_defult_easize); +LPROC_SEQ_FOPS_RO(ll_default_easize); static int ll_max_cookiesize_seq_show(struct seq_file *m, void *v) { @@ -759,7 +759,7 @@ static int ll_max_cookiesize_seq_show(struct seq_file *m, void *v) } LPROC_SEQ_FOPS_RO(ll_max_cookiesize); -static int ll_defult_cookiesize_seq_show(struct seq_file *m, void *v) +static int ll_default_cookiesize_seq_show(struct seq_file *m, void *v) { struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); @@ -773,7 +773,7 @@ static int ll_defult_cookiesize_seq_show(struct seq_file *m, void *v) seq_printf(m, "%u\n", cookielen); return 0; } -LPROC_SEQ_FOPS_RO(ll_defult_cookiesize); +LPROC_SEQ_FOPS_RO(ll_default_cookiesize); static int ll_sbi_flags_seq_show(struct seq_file *m, void *v) { @@ -862,9 +862,9 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = { { "statahead_stats", &ll_statahead_stats_fops, NULL, 0 }, { "lazystatfs", &ll_lazystatfs_fops, NULL }, { "max_easize", &ll_max_easize_fops, NULL, 0 }, - { "default_easize", &ll_defult_easize_fops, NULL, 0 }, + { "default_easize", &ll_default_easize_fops, NULL, 0 }, { "max_cookiesize", &ll_max_cookiesize_fops, NULL, 0 }, - { "default_cookiesize", &ll_defult_cookiesize_fops, NULL, 0 }, + { "default_cookiesize", &ll_default_cookiesize_fops, NULL, 0 }, { "sbi_flags", &ll_sbi_flags_fops, NULL, 0 }, { "xattr_cache", &ll_xattr_cache_fops, NULL, 0 }, { NULL } diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 3c0c9109cefd..3a7404148308 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -645,10 +645,10 @@ int lustre_put_lsi(struct super_block *sb) } /*** SERVER NAME *** - * + * * FSNAME is between 1 and 8 characters (inclusive). * Excluded characters are '/' and ':' - * SEPERATOR is either ':' or '-' + * SEPARATOR is either ':' or '-' * TYPE: "OST", "MDT", etc. * INDEX: Hex representation of the index */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index f715e9a8b996..dc3f6c6f8801 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -383,12 +383,12 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) req->rq_export->exp_obd->obd_minor); } - /* In order to keep interoprability with the client (< 2.3) which + /* In order to keep interoperability with the client (< 2.3) which * doesn't have pb_jobid in ptlrpc_body, We have to shrink the * ptlrpc_body in reply buffer to ptlrpc_body_v2, otherwise, the * reply buffer on client will be overflow. * - * XXX Remove this whenever we drop the interoprability with such client. + * XXX Remove this whenever we drop the interoperability with such client. */ req->rq_replen = lustre_shrink_msg(req->rq_repmsg, 0, sizeof(struct ptlrpc_body_v2), 1); diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index eb6ff902080c..b51af9bf37b7 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -119,11 +119,11 @@ int lustre_msg_early_size(void) { static int size; if (!size) { - /* Always reply old ptlrpc_body_v2 to keep interoprability + /* Always reply old ptlrpc_body_v2 to keep interoperability * with the old client (< 2.3) which doesn't have pb_jobid * in the ptlrpc_body. * - * XXX Remove this whenever we drop interoprability with such + * XXX Remove this whenever we drop interoperability with such * client. */ __u32 pblen = sizeof(struct ptlrpc_body_v2); -- cgit v1.2.3 From 8417773bbbb4d782b1314f5d1126d1b43b26b7db Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Sat, 7 Mar 2015 19:24:26 -0500 Subject: staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_ This patch continues to further remove deprecated functions, such as any_online_cpu, for_each_cpu_mask and also cleaning up usage of NR_CPUS in a few places Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 32 ++++++++++++---------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index 1eeacefef52c..cc3ab351943e 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -204,7 +204,7 @@ cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) } tmp += rc; - for_each_cpu_mask(j, *cptab->ctb_parts[i].cpt_cpumask) { + for_each_cpu(j, cptab->ctb_parts[i].cpt_cpumask) { rc = snprintf(tmp, len, "%d ", j); len -= rc; if (len <= 0) { @@ -251,8 +251,10 @@ cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt) LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts)); return cpt == CFS_CPT_ANY ? - any_online_cpu(*cptab->ctb_cpumask) < nr_cpu_ids : - any_online_cpu(*cptab->ctb_parts[cpt].cpt_cpumask) < nr_cpu_ids; + cpumask_any_and(cptab->ctb_cpumask, + cpu_online_mask) < nr_cpu_ids : + cpumask_any_and(cptab->ctb_parts[cpt].cpt_cpumask, + cpu_online_mask) < nr_cpu_ids; } EXPORT_SYMBOL(cfs_cpt_online); @@ -356,22 +358,22 @@ cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu) LASSERT(node_isset(node, *cptab->ctb_parts[cpt].cpt_nodemask)); LASSERT(node_isset(node, *cptab->ctb_nodemask)); - for_each_cpu_mask(i, *cptab->ctb_parts[cpt].cpt_cpumask) { + for_each_cpu(i, cptab->ctb_parts[cpt].cpt_cpumask) { /* this CPT has other CPU belonging to this node? */ if (cpu_to_node(i) == node) break; } - if (i == NR_CPUS) + if (i >= nr_cpu_ids) node_clear(node, *cptab->ctb_parts[cpt].cpt_nodemask); - for_each_cpu_mask(i, *cptab->ctb_cpumask) { + for_each_cpu(i, cptab->ctb_cpumask) { /* this CPT-table has other CPU belonging to this node? */ if (cpu_to_node(i) == node) break; } - if (i == NR_CPUS) + if (i >= nr_cpu_ids) node_clear(node, *cptab->ctb_nodemask); return; @@ -383,13 +385,14 @@ cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt, cpumask_t *mask) { int i; - if (cpumask_weight(mask) == 0 || any_online_cpu(*mask) >= nr_cpu_ids) { + if (cpumask_weight(mask) == 0 || + cpumask_any_and(mask, cpu_online_mask) >= nr_cpu_ids) { CDEBUG(D_INFO, "No online CPU is found in the CPU mask for CPU partition %d\n", cpt); return 0; } - for_each_cpu_mask(i, *mask) { + for_each_cpu(i, mask) { if (!cfs_cpt_set_cpu(cptab, cpt, i)) return 0; } @@ -403,7 +406,7 @@ cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab, int cpt, cpumask_t *mask) { int i; - for_each_cpu_mask(i, *mask) + for_each_cpu(i, mask) cfs_cpt_unset_cpu(cptab, cpt, i); } EXPORT_SYMBOL(cfs_cpt_unset_cpumask); @@ -493,7 +496,7 @@ cfs_cpt_clear(struct cfs_cpt_table *cptab, int cpt) } for (; cpt <= last; cpt++) { - for_each_cpu_mask(i, *cptab->ctb_parts[cpt].cpt_cpumask) + for_each_cpu(i, cptab->ctb_parts[cpt].cpt_cpumask) cfs_cpt_unset_cpu(cptab, cpt, i); } } @@ -578,7 +581,7 @@ cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt) nodemask = cptab->ctb_parts[cpt].cpt_nodemask; } - if (any_online_cpu(*cpumask) >= nr_cpu_ids) { + if (cpumask_any_and(cpumask, cpu_online_mask) >= nr_cpu_ids) { CERROR("No online CPU found in CPU partition %d, did someone do CPU hotplug on system? You might need to reload Lustre modules to keep system working well.\n", cpt); return -EINVAL; @@ -654,7 +657,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, LASSERT(!cpumask_empty(core)); - for_each_cpu_mask(i, *core) { + for_each_cpu(i, core) { cpumask_clear_cpu(i, socket); cpumask_clear_cpu(i, node); @@ -965,7 +968,8 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) mutex_lock(&cpt_data.cpt_mutex); /* if all HTs in a core are offline, it may break affinity */ cfs_cpu_ht_siblings(cpu, cpt_data.cpt_cpumask); - warn = any_online_cpu(*cpt_data.cpt_cpumask) >= nr_cpu_ids; + warn = cpumask_any_and(cpt_data.cpt_cpumask, + cpu_online_mask) >= nr_cpu_ids; mutex_unlock(&cpt_data.cpt_mutex); CDEBUG(warn ? D_WARNING : D_INFO, "Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u action: %lx]\n", -- cgit v1.2.3 From 4a316f7916d53c9c6e482b37f556102b5cf80546 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Sat, 7 Mar 2015 19:24:27 -0500 Subject: staging/lustre/o2iblnd: Don't use cpus_weight cpus_weight and for_each_cpu_mask are deprecated, so replace them with cpumask_weight and for_each_cpu respectively. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 1422d5668bf8..b04bb2ebe337 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -638,8 +638,8 @@ kiblnd_get_completion_vector(kib_conn_t *conn, int cpt) return 0; /* hash NID to CPU id in this partition... */ - off = do_div(nid, cpus_weight(*mask)); - for_each_cpu_mask(i, *mask) { + off = do_div(nid, cpumask_weight(mask)); + for_each_cpu(i, mask) { if (off-- == 0) return i % vectors; } -- cgit v1.2.3 From aac2e54f9eb63d5cfaac1a115a939508712050da Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Sat, 7 Mar 2015 19:24:28 -0500 Subject: staging/lustre/llite: avoid nonatomic memory alloc under spinlock ll_intent_drop_lock() may sleep in memory allocation, which should not be called inside spinlock. Signed-off-by: Lai Siyao Signed-off-by: Jian Yu Reviewed-on: http://review.whamcloud.com/10674 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2272 Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/statahead.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index fe732fa0d01f..b75562c6b5de 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -706,11 +706,21 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, struct ll_inode_info *lli = ll_i2info(dir); struct ll_statahead_info *sai = NULL; struct ll_sa_entry *entry; + __u64 handle = 0; int wakeup; if (it_disposition(it, DISP_LOOKUP_NEG)) rc = -ENOENT; + if (rc == 0) { + /* release ibits lock ASAP to avoid deadlock when statahead + * thread enqueues lock on parent in readdir and another + * process enqueues lock on child with parent lock held, eg. + * unlink. */ + handle = it->d.lustre.it_lock_handle; + ll_intent_drop_lock(it); + } + spin_lock(&lli->lli_sa_lock); /* stale entry */ if (unlikely(lli->lli_sai == NULL || @@ -745,8 +755,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, * when statahead thread tries to enqueue lock on parent * for readpage and other tries to enqueue lock on child * with parent's lock held, for example: unlink. */ - entry->se_handle = it->d.lustre.it_lock_handle; - ll_intent_drop_lock(it); + entry->se_handle = handle; wakeup = sa_received_empty(sai); list_add_tail(&entry->se_list, &sai->sai_entries_received); -- cgit v1.2.3 From 834fe2e18349f024c0e565a0cdbf6bb1e0ed0ce5 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Sat, 7 Mar 2015 19:24:29 -0500 Subject: staging/lustre: Don't call blocking funcitons when !RUNNABLE Move setting of TASK_INTERRUPTIBLE just around schedule call in libcfs_sock_accept. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c index cd2fc01dea4c..f2462e7f04bc 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c @@ -543,19 +543,17 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) newsock->ops = sock->ops; - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(sk_sleep(sock->sk), &wait); - rc = sock->ops->accept(sock, newsock, O_NONBLOCK); if (rc == -EAGAIN) { /* Nothing ready, so wait for activity */ + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(sk_sleep(sock->sk), &wait); schedule(); + remove_wait_queue(sk_sleep(sock->sk), &wait); + set_current_state(TASK_RUNNING); rc = sock->ops->accept(sock, newsock, O_NONBLOCK); } - remove_wait_queue(sk_sleep(sock->sk), &wait); - set_current_state(TASK_RUNNING); - if (rc != 0) goto failed; -- cgit v1.2.3 From 9cda6856e94541fb3a507d4d123e8981e560f8b2 Mon Sep 17 00:00:00 2001 From: "Ravindran, Madhusudhanan (M.)" Date: Thu, 12 Mar 2015 17:35:52 +0000 Subject: staging: lustre: Use kmemdup rather than duplicating its implementation The semantic patch that makes this change is available in scriptcoccinelle/api/memdup.cocci. Signed-off-by: Madhusudhanan Ravindran Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/xattr_cache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index 7e2fcfeacfa5..da190f92d140 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -132,11 +132,10 @@ static int ll_xattr_cache_add(struct list_head *cache, xattr->xe_namelen); goto err_name; } - xattr->xe_value = kzalloc(xattr_val_len, GFP_NOFS); + xattr->xe_value = kmemdup(xattr_val, xattr_val_len, GFP_NOFS); if (!xattr->xe_value) goto err_value; - memcpy(xattr->xe_value, xattr_val, xattr_val_len); xattr->xe_vallen = xattr_val_len; list_add(&xattr->xe_list, cache); -- cgit v1.2.3 From d841438a44d32c132e72e5c77ed082d7f771e052 Mon Sep 17 00:00:00 2001 From: Yogeswaran Thulasidoss Date: Mon, 16 Mar 2015 08:21:50 +0530 Subject: staging: lustre: echo_client: Use kernel style spacing This patch fixes the code style space issues identified by checkpatch.pl in drivers/staging/lustre/lustre/obdecho/echo_client.c Signed-off-by: Yogeswaran Thulasidoss Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/obdecho/echo_client.c | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 566e6466f49c..d542e06d6cd3 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -1029,7 +1029,7 @@ static int cl_echo_object_put(struct echo_object *eco) static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco, u64 start, u64 end, int mode, - __u64 *cookie , __u32 enqflags) + __u64 *cookie, __u32 enqflags) { struct cl_io *io; struct cl_lock *lck; @@ -1274,11 +1274,11 @@ echo_copyout_lsm(struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob) if (nob > ulsm_nob) return -EINVAL; - if(copy_to_user (ulsm, lsm, sizeof(*ulsm))) + if (copy_to_user(ulsm, lsm, sizeof(*ulsm))) return -EFAULT; for (i = 0; i < lsm->lsm_stripe_count; i++) { - if(copy_to_user (ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i], + if (copy_to_user(ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i], sizeof(lsm->lsm_oinfo[0]))) return -EFAULT; } @@ -1292,10 +1292,10 @@ echo_copyin_lsm(struct echo_device *ed, struct lov_stripe_md *lsm, struct echo_client_obd *ec = ed->ed_ec; int i; - if(ulsm_nob < sizeof (*lsm)) + if (ulsm_nob < sizeof(*lsm)) return -EINVAL; - if(copy_from_user (lsm, ulsm, sizeof (*lsm))) + if (copy_from_user(lsm, ulsm, sizeof(*lsm))) return -EFAULT; if (lsm->lsm_stripe_count > ec->ec_nstripes || @@ -1328,7 +1328,7 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed, if ((oa->o_valid & OBD_MD_FLID) == 0 && /* no obj id */ (on_target || /* set_stripe */ ec->ec_nstripes != 0)) { /* LOV */ - CERROR ("No valid oid\n"); + CERROR("No valid oid\n"); return -EINVAL; } @@ -1341,7 +1341,7 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed, if (ulsm != NULL) { int i, idx; - rc = echo_copyin_lsm (ed, lsm, ulsm, ulsm_nob); + rc = echo_copyin_lsm(ed, lsm, ulsm, ulsm_nob); if (rc != 0) goto failed; @@ -1417,7 +1417,7 @@ static int echo_get_object(struct echo_object **ecop, struct echo_device *ed, if ((oa->o_valid & OBD_MD_FLID) == 0 || ostid_id(&oa->o_oi) == 0) { /* disallow use of object id 0 */ - CERROR ("No valid oid\n"); + CERROR("No valid oid\n"); return -EINVAL; } @@ -1467,7 +1467,7 @@ echo_get_stripe_off_id(struct lov_stripe_md *lsm, u64 *offp, u64 *idp) width = stripe_size * stripe_count; /* woffset = offset within a width; offset = whole number of widths */ - woffset = do_div (offset, width); + woffset = do_div(offset, width); stripe_index = woffset / stripe_size; @@ -1525,13 +1525,13 @@ static int echo_client_page_debug_check(struct lov_stripe_md *lsm, for (rc = delta = 0; delta < PAGE_CACHE_SIZE; delta += OBD_ECHO_BLOCK_SIZE) { stripe_off = offset + delta; stripe_id = id; - echo_get_stripe_off_id (lsm, &stripe_off, &stripe_id); + echo_get_stripe_off_id(lsm, &stripe_off, &stripe_id); rc2 = block_debug_check("test_brw", addr + delta, OBD_ECHO_BLOCK_SIZE, stripe_off, stripe_id); if (rc2 != 0) { - CERROR ("Error in echo object %#llx\n", id); + CERROR("Error in echo object %#llx\n", id); rc = rc2; } } @@ -1591,7 +1591,7 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, i < npages; i++, pgp++, off += PAGE_CACHE_SIZE) { - LASSERT (pgp->pg == NULL); /* for cleanup */ + LASSERT(pgp->pg == NULL); /* for cleanup */ rc = -ENOMEM; OBD_PAGE_ALLOC(pgp->pg, gfp_mask); @@ -1821,7 +1821,7 @@ echo_client_enqueue(struct obd_export *exp, struct obdo *oa, (nob & (~CFS_PAGE_MASK)) != 0) return -EINVAL; - rc = echo_get_object (&eco, ed, oa); + rc = echo_get_object(&eco, ed, oa); if (rc != 0) return rc; @@ -2003,7 +2003,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len, goto out; default: - CERROR ("echo_ioctl(): unrecognised ioctl %#x\n", cmd); + CERROR("echo_ioctl(): unrecognised ioctl %#x\n", cmd); rc = -ENOTTY; goto out; } @@ -2045,8 +2045,8 @@ static int echo_client_setup(const struct lu_env *env, } spin_lock_init(&ec->ec_lock); - INIT_LIST_HEAD (&ec->ec_objects); - INIT_LIST_HEAD (&ec->ec_locks); + INIT_LIST_HEAD(&ec->ec_objects); + INIT_LIST_HEAD(&ec->ec_locks); ec->ec_unique = 0; ec->ec_nstripes = 0; -- cgit v1.2.3 From d6f1170344e80dcbb0dab93d788488394637bd83 Mon Sep 17 00:00:00 2001 From: Alberto Pires de Oliveira Neto Date: Mon, 16 Mar 2015 22:21:08 -0300 Subject: staging: lustre: space prohibited between function name and open parenthesis '(' This patch fixes checkpatch.pl warning. WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Alberto Pires de Oliveira Neto Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h index 6125bbe822b5..68bec7658463 100644 --- a/drivers/staging/lustre/lustre/fld/fld_internal.h +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h @@ -142,7 +142,7 @@ extern struct lu_fld_hash fld_hash[]; int fld_client_rpc(struct obd_export *exp, struct lu_seq_range *range, __u32 fld_op); -#if defined (CONFIG_PROC_FS) +#if defined(CONFIG_PROC_FS) extern struct lprocfs_vars fld_client_proc_list[]; #endif -- cgit v1.2.3 From 0effc8eb9462b2135b44f9758b4f4455ed85e903 Mon Sep 17 00:00:00 2001 From: Alberto Pires de Oliveira Neto Date: Mon, 16 Mar 2015 22:21:09 -0300 Subject: staging: lustre: void function return statements are not generally useful. This patch fixes checkpatch.pl warning. WARNING: void function return statements are not generally useful Signed-off-by: Alberto Pires de Oliveira Neto Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_request.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 22e0d94bb0f8..6ac225e90ee0 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -326,7 +326,6 @@ static int fld_client_proc_init(struct lu_client_fld *fld) void fld_client_proc_fini(struct lu_client_fld *fld) { - return; } #endif EXPORT_SYMBOL(fld_client_proc_fini); -- cgit v1.2.3 From 636e5a658af4c3d16945a3f8b936f17a3b57e208 Mon Sep 17 00:00:00 2001 From: Alberto Pires de Oliveira Neto Date: Mon, 16 Mar 2015 22:21:10 -0300 Subject: staging: lustre: space required after that close brace '}' This patch fixes checkpatch.pl warning. WARNING: space required after that close brace '}' Signed-off-by: Alberto Pires de Oliveira Neto Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/lproc_fld.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c b/drivers/staging/lustre/lustre/fld/lproc_fld.c index 8c5a65704a37..f53fdcfae34e 100644 --- a/drivers/staging/lustre/lustre/fld/lproc_fld.c +++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c @@ -168,4 +168,5 @@ struct lprocfs_vars fld_client_proc_list[] = { { "targets", &fld_proc_targets_fops }, { "hash", &fld_proc_hash_fops }, { "cache_flush", &fld_proc_cache_flush_fops }, - { NULL }}; + { NULL } +}; -- cgit v1.2.3 From 06133e805cea48a3bb78f3cf62fbaf6e7133d957 Mon Sep 17 00:00:00 2001 From: "Mario J. Rugiero" Date: Tue, 10 Mar 2015 12:02:02 -0300 Subject: staging/lustre: clean trailing semicolons in macros Remove trailing semicolons from macros, as suggested by checkpatch. Signed-off-by: Mario J. Rugiero Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 2 +- drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | 4 ++-- drivers/staging/lustre/lustre/include/lprocfs_status.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 2e5a9e5965b1..840dd1bde293 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -196,7 +196,7 @@ do { \ .msg_fn = __func__, \ .msg_line = __LINE__, \ .msg_cdls = (cdls) }; \ - dataname.msg_mask = (mask); + dataname.msg_mask = (mask) /** * Filters out logging messages based on mask and subsystem. diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index 3d86fb5b5481..fef882530455 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -335,8 +335,8 @@ do { \ #define LASSERT_ATOMIC_ZERO(a) LASSERT_ATOMIC_EQ(a, 0) #define LASSERT_ATOMIC_POS(a) LASSERT_ATOMIC_GT(a, 0) -#define CFS_ALLOC_PTR(ptr) LIBCFS_ALLOC(ptr, sizeof(*(ptr))); -#define CFS_FREE_PTR(ptr) LIBCFS_FREE(ptr, sizeof(*(ptr))); +#define CFS_ALLOC_PTR(ptr) LIBCFS_ALLOC(ptr, sizeof(*(ptr))) +#define CFS_FREE_PTR(ptr) LIBCFS_FREE(ptr, sizeof(*(ptr))) /* * percpu partition lock diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 8a25cf6f6825..d030847e51ba 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -679,7 +679,7 @@ extern int lprocfs_seq_release(struct inode *, struct file *); } \ } while (0) #define LPROCFS_CLIMP_EXIT(obd) \ - up_read(&(obd)->u.cli.cl_sem); + up_read(&(obd)->u.cli.cl_sem) /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only @@ -723,7 +723,7 @@ static struct file_operations name##_fops = { \ return lprocfs_wr_##type(file, buffer, \ count, seq->private); \ } \ - LPROC_SEQ_FOPS(name##_##type); + LPROC_SEQ_FOPS(name##_##type) #define LPROC_SEQ_FOPS_WR_ONLY(name, type) \ static ssize_t name##_##type##_write(struct file *file, \ @@ -740,7 +740,7 @@ static struct file_operations name##_fops = { \ .open = name##_##type##_open, \ .write = name##_##type##_write, \ .release = lprocfs_single_release, \ - }; + } /* lproc_ptlrpc.c */ struct ptlrpc_request; -- cgit v1.2.3 From 70837c1292c7a04c8fd0b940be70775b79536d50 Mon Sep 17 00:00:00 2001 From: "Mario J. Rugiero" Date: Tue, 10 Mar 2015 12:02:03 -0300 Subject: staging/lustre: use __printf(...) instead of __attribute__(format(__printf, ...)) Replace uses of __attribute__(format(__printf,...)) by __printf(...), as suggested by checkpatch. Signed-off-by: Mario J. Rugiero Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 4 ++-- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 840dd1bde293..8251ac932e37 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -244,12 +244,12 @@ do { \ int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata, const char *format1, ...) - __attribute__ ((format (printf, 2, 3))); + __printf(2, 3); int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, const char *format1, va_list args, const char *format2, ...) - __attribute__ ((format (printf, 4, 5))); + __printf(4, 5); /* other external symbols that tracefile provides: */ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob, diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 2ddb2b054d8d..c8cc48f00026 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -192,7 +192,7 @@ struct lu_object_conf { */ typedef int (*lu_printer_t)(const struct lu_env *env, void *cookie, const char *format, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Operations specific for particular lu_object. diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 83bc0a9d7d4c..bac9902b56bb 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1075,7 +1075,7 @@ extern char *ldlm_it2str(int it); void _ldlm_lock_debug(struct ldlm_lock *lock, struct libcfs_debug_msg_data *data, const char *fmt, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Rate-limited version of lock printing function. diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 36396d1c94dc..e2805bd1acf1 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -1673,7 +1673,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req) void _debug_req(struct ptlrpc_request *req, struct libcfs_debug_msg_data *data, const char *fmt, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Helper that decides if we need to print request according to current debug -- cgit v1.2.3 From 4c205ab53489894c77f81fe9a0c0ff6345b83e76 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 18 Mar 2015 12:30:44 +0530 Subject: Staging: media: Use module_i2c_driver Macro module_i2c_driver is used for drivers whose init and exit paths does only register and unregister to i2c API. So, here remove some boilerplate code by using module_i2c_driver. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 25ab2e028bc6..f28ffef0d1f0 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -2717,22 +2717,7 @@ static struct i2c_driver bcm2048_i2c_driver = { .id_table = bcm2048_id, }; -/* - * Module Interface - */ -static int __init bcm2048_module_init(void) -{ - pr_info(BCM2048_DRIVER_DESC "\n"); - - return i2c_add_driver(&bcm2048_i2c_driver); -} -module_init(bcm2048_module_init); - -static void __exit bcm2048_module_exit(void) -{ - i2c_del_driver(&bcm2048_i2c_driver); -} -module_exit(bcm2048_module_exit); +module_i2c_driver(bcm2048_i2c_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR(BCM2048_DRIVER_AUTHOR); -- cgit v1.2.3 From a112eab4d5e78433a7c65b5703ad177cdabc6588 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Tue, 17 Mar 2015 08:33:51 +0300 Subject: Staging: comedi: replace pr_err with dev_err This patch replace pr_err with dev_err, when appropriate device structure is found. Issue found using the following Coccinelle script: @r exists@ identifier f, s, i; position p; @@ f(...,struct s *i,...) { <+... when != i == NULL pr_err@p(...); ...+> } @rr@ identifier r.s, fld; @@ struct s { ... struct device *fld; ... }; @@ identifier r.i, rr.fld; position r.p; @@ -pr_err@p +dev_err ( + i->fld, ...) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 2f8257cd9824..8bf57b736659 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2700,7 +2700,8 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device) mutex_unlock(&dev->mutex); comedi_device_cleanup(dev); comedi_dev_put(dev); - pr_err("ran out of minor numbers for board device files\n"); + dev_err(hardware_device, + "ran out of minor numbers for board device files\n"); return ERR_PTR(-EBUSY); } dev->minor = i; @@ -2753,7 +2754,8 @@ int comedi_alloc_subdevice_minor(struct comedi_subdevice *s) } mutex_unlock(&comedi_subdevice_minor_table_lock); if (i == COMEDI_NUM_SUBDEVICE_MINORS) { - pr_err("ran out of minor numbers for subdevice files\n"); + dev_err(dev->class_dev, + "ran out of minor numbers for subdevice files\n"); return -EBUSY; } i += COMEDI_NUM_BOARD_MINORS; -- cgit v1.2.3 From df02b50acfcec04cd50abc5f6265118d2cdacbee Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Tue, 17 Mar 2015 08:34:20 +0300 Subject: Staging: gdm724x: replace pr_err with dev_err This patch replace pr_err with dev_err, when appropriate device structre is found. Issue found using the following Coccinelle script: @r exists@ identifier f, s, i; position p; @@ f(...,struct s *i,...) { <+... when != i == NULL pr_err@p(...); ...+> } @rr@ identifier r.s, fld; @@ struct s { ... struct device *fld; ... }; @@ identifier r.i, rr.fld; position r.p; @@ -pr_err@p +dev_err ( + i->fld, ...) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_mux.c | 4 ++-- drivers/staging/gdm724x/gdm_usb.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c index d1ab996b3305..b987ba0510b7 100644 --- a/drivers/staging/gdm724x/gdm_mux.c +++ b/drivers/staging/gdm724x/gdm_mux.c @@ -608,7 +608,7 @@ static int gdm_mux_suspend(struct usb_interface *intf, pm_message_t pm_msg) rx = &mux_dev->rx; if (mux_dev->usb_state != PM_NORMAL) { - pr_err("usb suspend - invalid state\n"); + dev_err(intf->usb_dev, "usb suspend - invalid state\n"); return -1; } @@ -637,7 +637,7 @@ static int gdm_mux_resume(struct usb_interface *intf) mux_dev = tty_dev->priv_dev; if (mux_dev->usb_state != PM_SUSPEND) { - pr_err("usb resume - invalid state\n"); + dev_err(intf->usb_dev, "usb resume - invalid state\n"); return -1; } diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c index d2a3b350ba6d..d59810f78c32 100644 --- a/drivers/staging/gdm724x/gdm_usb.c +++ b/drivers/staging/gdm724x/gdm_usb.c @@ -848,7 +848,7 @@ static int gdm_usb_probe(struct usb_interface *intf, udev->usbdev = usbdev; ret = init_usb(udev); if (ret < 0) { - pr_err("init_usb func failed\n"); + dev_err(intf->usb_dev, "init_usb func failed\n"); goto err_init_usb; } udev->intf = intf; @@ -867,7 +867,7 @@ static int gdm_usb_probe(struct usb_interface *intf, ret = request_mac_address(udev); if (ret < 0) { - pr_err("request Mac address failed\n"); + dev_err(intf->usb_dev, "request Mac address failed\n"); goto err_mac_address; } @@ -928,7 +928,7 @@ static int gdm_usb_suspend(struct usb_interface *intf, pm_message_t pm_msg) udev = phy_dev->priv_dev; rx = &udev->rx; if (udev->usb_state != PM_NORMAL) { - pr_err("usb suspend - invalid state\n"); + dev_err(intf->usb_dev, "usb suspend - invalid state\n"); return -1; } @@ -961,7 +961,7 @@ static int gdm_usb_resume(struct usb_interface *intf) rx = &udev->rx; if (udev->usb_state != PM_SUSPEND) { - pr_err("usb resume - invalid state\n"); + dev_err(intf->usb_dev, "usb resume - invalid state\n"); return -1; } udev->usb_state = PM_NORMAL; -- cgit v1.2.3 From 92371df8a9b70735b63075bb1f8a7480488d748e Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Tue, 17 Mar 2015 08:35:41 +0300 Subject: Staging: iio: replace pr_err with dev_err This patch replace pr_err with dev_err, when appropriate device structre is found. Issue found using the following Coccinelle script: @r exists@ identifier f, s, i; position p; @@ f(...,struct s *i,...) { <+... when != i == NULL pr_err@p(...); ...+> } @rr@ identifier r.s, fld; @@ struct s { ... struct device *fld; ... }; @@ identifier r.i, rr.fld; position r.p; @@ -pr_err@p +dev_err ( + i->fld, ...) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index b4c14ba5fdee..1d8c5c0bdc88 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev, if (ret) return ret; if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) { - pr_err("ad2s1210: fclkin out of range\n"); + dev_err(dev, "ad2s1210: fclkin out of range\n"); return -EINVAL; } @@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev, if (ret < 0) return ret; if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) { - pr_err("ad2s1210: excitation frequency out of range\n"); + dev_err(dev, + "ad2s1210: excitation frequency out of range\n"); return -EINVAL; } mutex_lock(&st->lock); @@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev, goto error_ret; if (ret & AD2S1210_MSB_IS_HIGH) { ret = -EIO; - pr_err("ad2s1210: write control register fail\n"); + dev_err(dev, + "ad2s1210: write control register fail\n"); goto error_ret; } st->resolution @@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, ret = kstrtou8(buf, 10, &udata); if (ret || udata < 10 || udata > 16) { - pr_err("ad2s1210: resolution out of range\n"); + dev_err(dev, "ad2s1210: resolution out of range\n"); return -EINVAL; } mutex_lock(&st->lock); @@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, data = ret; if (data & AD2S1210_MSB_IS_HIGH) { ret = -EIO; - pr_err("ad2s1210: setting resolution fail\n"); + dev_err(dev, "ad2s1210: setting resolution fail\n"); goto error_ret; } st->resolution -- cgit v1.2.3 From 41f06c619a302fa386e4d784c8ceed250d4c3754 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Tue, 17 Mar 2015 08:37:36 +0300 Subject: Staging: ft1000: replace pr_err with dev_err This patch replace pr_err with dev_err, when appropriate device structure is found. Issue found using the following Coccinelle script: @r exists@ identifier f, s, i; position p; @@ f(...,struct s *i,...) { <+... when != i == NULL pr_err@p(...); ...+> } @rr@ identifier r.s, fld; @@ struct s { ... struct device *fld; ... }; @@ identifier r.i, rr.fld; position r.p; @@ -pr_err@p +dev_err ( + i->fld, ...) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index a6b55f42c07c..3b303b6b1b27 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -136,7 +136,7 @@ static int ft1000_probe(struct usb_interface *interface, ret = request_firmware(&dsp_fw, "ft3000.img", &dev->dev); if (ret < 0) { - pr_err("Error request_firmware()\n"); + dev_err(interface->usb_dev, "Error request_firmware()\n"); goto err_fw; } @@ -164,7 +164,8 @@ static int ft1000_probe(struct usb_interface *interface, pr_debug("pft1000info=%p\n", pft1000info); ret = dsp_reload(ft1000dev); if (ret) { - pr_err("Problem with DSP image loading\n"); + dev_err(interface->usb_dev, + "Problem with DSP image loading\n"); goto err_load; } -- cgit v1.2.3 From 0f362d9df4f9d003c39e16d98412d5026cd0934d Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 18 Mar 2015 12:18:38 +0530 Subject: Staging: rtl8188eu: Remove timer handler macros After the commit 28af7ea81e16 ("Staging: rtl8188eu: Eliminate use of _init_timer"), macros (RTW_TIMER_HDL_ARGS, RTW_TIMER_HDL_NAME, RTW_DECLARE_TIMER_HDL) are no longer needed. So, remove them. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/osdep_service.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index 08c4d5d2236f..515e949629e2 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -76,11 +76,6 @@ static inline int _enter_critical_mutex(struct mutex *pmutex, return ret; } -#define RTW_TIMER_HDL_ARGS void *FunctionContext -#define RTW_TIMER_HDL_NAME(name) rtw_##name##_timer_hdl -#define RTW_DECLARE_TIMER_HDL(name) \ - void RTW_TIMER_HDL_NAME(name)(RTW_TIMER_HDL_ARGS) - static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) { return netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) && -- cgit v1.2.3 From 3d719423da9fdaa4c126a91cac91c3a0679226df Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 18 Mar 2015 13:08:59 +0300 Subject: Staging: gdm724x: replace pr_* with dev_* This patch replace pr_err/pr_info with dev_err/dev_info, when appropriate device structure is found. Issue found and resolved using the following Coccinelle script. pr_err/dev_err was substituted with pr_info/dev_info in the later case. @r exists@ identifier f, s, i; position p; @@ f(...,struct s *i,...) { <+... when != i == NULL pr_err@p(...); ...+> } @rr@ identifier r.s, s2, fld; @@ struct s { ... struct s2 *fld; ... }; @rrr@ identifier rr.s2, fld2; @@ struct s2 { ... struct device fld2; ... }; @@ identifier r.i, r.s, rr.fld, rrr.fld2; position r.p; @@ -pr_err@p +dev_err ( + &i->fld->fld2, ...) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_mux.c | 4 ++-- drivers/staging/gdm724x/gdm_usb.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c index b987ba0510b7..8199b0a697bb 100644 --- a/drivers/staging/gdm724x/gdm_mux.c +++ b/drivers/staging/gdm724x/gdm_mux.c @@ -270,7 +270,7 @@ static void gdm_mux_rcv_complete(struct urb *urb) if (urb->status) { if (mux_dev->usb_state == PM_NORMAL) - pr_err("%s: urb status error %d\n", + dev_err(&urb->dev->dev, "%s: urb status error %d\n", __func__, urb->status); put_rx_struct(rx, r); } else { @@ -342,7 +342,7 @@ static void gdm_mux_send_complete(struct urb *urb) struct mux_tx *t = urb->context; if (urb->status == -ECONNRESET) { - pr_info("CONNRESET\n"); + dev_info(&urb->dev->dev, "CONNRESET\n"); free_mux_tx(t); return; } diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c index d59810f78c32..ed1a12f504e2 100644 --- a/drivers/staging/gdm724x/gdm_usb.c +++ b/drivers/staging/gdm724x/gdm_usb.c @@ -480,7 +480,7 @@ static void gdm_usb_rcv_complete(struct urb *urb) spin_unlock_irqrestore(&rx->to_host_lock, flags); } else { if (urb->status && udev->usb_state == PM_NORMAL) - pr_err("%s: urb status error %d\n", + dev_err(&urb->dev->dev, "%s: urb status error %d\n", __func__, urb->status); put_rx_struct(rx, r); @@ -557,7 +557,7 @@ static void gdm_usb_send_complete(struct urb *urb) unsigned long flags; if (urb->status == -ECONNRESET) { - pr_info("CONNRESET\n"); + dev_info(&urb->dev->dev, "CONNRESET\n"); return; } @@ -590,7 +590,8 @@ static int send_tx_packet(struct usb_device *usbdev, struct usb_tx *t, u32 len) ret = usb_submit_urb(t->urb, GFP_ATOMIC); if (ret) - pr_err("usb_submit_urb failed: %d\n", ret); + dev_err(&usbdev->dev, "usb_submit_urb failed: %d\n", + ret); usb_mark_last_busy(usbdev); -- cgit v1.2.3 From 2c9356d115c91c18a2508a266a482c47fc3659c6 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 18 Mar 2015 13:09:50 +0300 Subject: Staging: media: replace pr_* with dev_* This patch replace pr_err/pr_info with dev_err/dev_infi, when appropriate device structure is found. Issues found using the following Coccinelle script. pr_err/dev_err was substituted with pr_info/dev_info in the later case. @r exists@ identifier f, s, i; position p; @@ f(...,struct s *i,...) { <+... when != i == NULL pr_err@p(...); ...+> } @rr@ identifier r.s, s2, fld; @@ struct s { ... struct s2 *fld; ... }; @rrr@ identifier rr.s2, fld2; @@ struct s2 { ... struct device fld2; ... }; @@ identifier r.i, r.s, rr.fld, rrr.fld2; position r.p; @@ -pr_err@p +dev_err ( + &i->fld->fld2, ...) Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 2 +- drivers/staging/media/lirc/lirc_sasem.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c index ceeef18630cc..17e105e7d892 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c @@ -209,7 +209,7 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd) /* Combine all the fields to make CFG1 register of IPIPEIF */ tmp = val = get_oneshot_mode(ipipeif->input); if (tmp < 0) { - pr_err("ipipeif: links setup required"); + dev_err(&sd->devnode->dev, "ipipeif: links setup required"); return -EINVAL; } val <<= ONESHOT_SHIFT; diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index b9c53e2d5d29..0c9e08247d7f 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -172,7 +172,8 @@ static void delete_context(struct sasem_context *context) kfree(context); if (debug) - pr_info("%s: context deleted\n", __func__); + dev_info(&context->dev->dev, "%s: context deleted\n", + __func__); } static void deregister_from_lirc(struct sasem_context *context) @@ -182,10 +183,12 @@ static void deregister_from_lirc(struct sasem_context *context) retval = lirc_unregister_driver(minor); if (retval) - pr_err("%s: unable to deregister from lirc (%d)\n", + dev_err(&context->dev->dev, + "%s: unable to deregister from lirc (%d)\n", __func__, retval); else - pr_info("Deregistered Sasem driver (minor:%d)\n", minor); + dev_info(&context->dev->dev, + "Deregistered Sasem driver (minor:%d)\n", minor); } -- cgit v1.2.3 From 8ac7f9b37ebc6ae294a6ebbf8cd14d2bf3edc7b4 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 18 Mar 2015 13:12:07 +0300 Subject: Staging: iio: replace pr_* with dev_* dev_* is prefered over pr_* when appropriate device stuct is present. This patch replace pr_err and pr_warn with its dev_ counterpart. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/resolver/ad2s1210.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index 1d8c5c0bdc88..5b1daeacac7a 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -151,7 +151,7 @@ int ad2s1210_update_frequency_control_word(struct ad2s1210_state *st) fcw = (unsigned char)(st->fexcit * (1 << 15) / st->fclkin); if (fcw < AD2S1210_MIN_FCW || fcw > AD2S1210_MAX_FCW) { - pr_err("ad2s1210: FCW out of range\n"); + dev_err(&st->sdev->dev, "ad2s1210: FCW out of range\n"); return -ERANGE; } @@ -317,7 +317,7 @@ static ssize_t ad2s1210_store_control(struct device *dev, if (st->pdata->gpioin) { data = ad2s1210_read_resolution_pin(st); if (data != st->resolution) - pr_warn("ad2s1210: resolution settings not match\n"); + dev_warn(dev, "ad2s1210: resolution settings not match\n"); } else ad2s1210_set_resolution_pin(st); @@ -378,7 +378,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, if (st->pdata->gpioin) { data = ad2s1210_read_resolution_pin(st); if (data != st->resolution) - pr_warn("ad2s1210: resolution settings not match\n"); + dev_warn(dev, "ad2s1210: resolution settings not match\n"); } else ad2s1210_set_resolution_pin(st); ret = len; -- cgit v1.2.3 From 5ec293650827122df300581c17ca1d5de03bac3d Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Wed, 18 Mar 2015 14:21:08 +0100 Subject: Staging: dgnc: release the lock before testing for nullity The refactoring intrduced in c84a083b995b ("Staging: dgnc: Use goto for spinlock release before return") inverts the order in which the lock is released and ld is tested for nullity. This patch restores the execution flow. Fixes: c84a083b995b ("Staging: dgnc: Use goto for spinlock release before return") Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 8445f84ddaa3..f1c4d07a0aaa 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -656,9 +656,9 @@ void dgnc_input(struct channel_t *ch) return; exit_unlock: + spin_unlock_irqrestore(&ch->ch_lock, flags); if (ld) tty_ldisc_deref(ld); - spin_unlock_irqrestore(&ch->ch_lock, flags); } -- cgit v1.2.3 From 43550121a752311f5e096a9ac97898d878710aac Mon Sep 17 00:00:00 2001 From: Laure Millet Date: Wed, 18 Mar 2015 19:49:45 +0100 Subject: Staging: lustre: namei.c: fix missing a blank line after declarations This fixes a missing blank line after declarations. Signed-off-by: Laure Millet Signed-off-by: Maxime Lorrillere Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/namei.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 890ac190f5fa..992f3f0b5829 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -979,6 +979,7 @@ static int ll_unlink(struct inode * dir, struct dentry *dentry) struct ptlrpc_request *request = NULL; struct md_op_data *op_data; int rc; + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", dentry, dir->i_ino, dir->i_generation, dir); -- cgit v1.2.3 From 72488596426bc82eeb71bf343e8b0049af214378 Mon Sep 17 00:00:00 2001 From: Laure Millet Date: Wed, 18 Mar 2015 19:49:46 +0100 Subject: Staging: lustre: namei.c: fix "foo * bar" should be "foo *bar" This patch fixes a coding style error in a pointer declaration. Signed-off-by: Laure Millet Signed-off-by: Maxime Lorrillere Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 992f3f0b5829..477dae11375e 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -974,7 +974,7 @@ out: * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there * is any lock existing. They will recycle dentries and inodes based upon locks * too. b=20433 */ -static int ll_unlink(struct inode * dir, struct dentry *dentry) +static int ll_unlink(struct inode *dir, struct dentry *dentry) { struct ptlrpc_request *request = NULL; struct md_op_data *op_data; -- cgit v1.2.3 From 07b249fa5b1aea27d4210af671de2a21eeeaac78 Mon Sep 17 00:00:00 2001 From: Laure Millet Date: Wed, 18 Mar 2015 19:49:47 +0100 Subject: staging: lustre: namei.c: Fix trailing whitespace This patch fixes a trailing whitespace in namei.c Signed-off-by: Laure Millet Signed-off-by: Maxime Lorrillere Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 477dae11375e..b99cb86a2f84 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -1034,7 +1034,7 @@ static int ll_rmdir(struct inode *dir, struct dentry *dentry) dentry, dir->i_ino, dir->i_generation, dir); op_data = ll_prep_md_op_data(NULL, dir, NULL, - dentry->d_name.name, + dentry->d_name.name, dentry->d_name.len, S_IFDIR, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) -- cgit v1.2.3 From e65dbbb800315c0b228a2ff530f1227579c09fa6 Mon Sep 17 00:00:00 2001 From: Laure Millet Date: Wed, 18 Mar 2015 20:01:35 +0100 Subject: staging: lustre: namei.c: coding style: fix quoted string split across lines This patch fixes a quoted string split across lines. Signed-off-by: Laure Millet Signed-off-by: Maxime Lorrillere Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/namei.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index b99cb86a2f84..3fa529d26d03 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -1112,10 +1112,9 @@ static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, int err; CDEBUG(D_VFSTRACE, - "VFS Op:oldname=%pd,src_dir=%lu/%u(%p),newname=%pd," - "tgt_dir=%lu/%u(%p)\n", old_dentry, - old_dir->i_ino, old_dir->i_generation, old_dir, new_dentry, - new_dir->i_ino, new_dir->i_generation, new_dir); + "VFS Op:oldname=%pd,src_dir=%lu/%u(%p),newname=%pd,tgt_dir=%lu/%u(%p)\n", + old_dentry, old_dir->i_ino, old_dir->i_generation, old_dir, + new_dentry, new_dir->i_ino, new_dir->i_generation, new_dir); op_data = ll_prep_md_op_data(NULL, old_dir, new_dir, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); -- cgit v1.2.3 From 267d9c8a6557d30c5ff01da8b8b0c3d07d82d14c Mon Sep 17 00:00:00 2001 From: Laure Millet Date: Wed, 18 Mar 2015 20:07:26 +0100 Subject: staging: lustre: namei.c: coding style: fix 80 characters limit This patch fixes lines over 80 characters Signed-off-by: Laure Millet Signed-off-by: Maxime Lorrillere Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/namei.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 3fa529d26d03..49f1cb067ea2 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -83,7 +83,8 @@ static int ll_set_inode(struct inode *inode, void *opaque) lli->lli_fid = body->fid1; if (unlikely(!(body->valid & OBD_MD_FLTYPE))) { - CERROR("Can not initialize inode " DFID " without object type: valid = %#llx\n", + CERROR("Can not initialize inode " DFID + " without object type: valid = %#llx\n", PFID(&lli->lli_fid), body->valid); return -EINVAL; } @@ -600,7 +601,8 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, long long lookup_flags = LOOKUP_OPEN; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),file %p,open_flags %x,mode %x opened %d\n", + CDEBUG(D_VFSTRACE, + "VFS Op:name=%pd,dir=%lu/%u(%p),file %p,open_flags %x,mode %x opened %d\n", dentry, dir->i_ino, dir->i_generation, dir, file, open_flags, mode, *opened); -- cgit v1.2.3 From 0b5cf51500a62b5abcaaa9f63600e10fa95cddd8 Mon Sep 17 00:00:00 2001 From: Roberto Medina Date: Wed, 18 Mar 2015 19:22:49 +0100 Subject: staging: lustre: linux: linux-prim: fixed coding style warnings and errors Coding style fixes due to exported symbols and comment style. Signed-off-by: Roberto Medina Signed-off-by: Greg Kroah-Hartman --- .../lustre/lustre/libcfs/linux/linux-prim.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c index fde2819ff586..838f5f3bd6af 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c @@ -117,11 +117,12 @@ EXPORT_SYMBOL(cfs_timer_deadline); void cfs_enter_debugger(void) { #if defined(CONFIG_KGDB) -// BREAKPOINT(); + /* BREAKPOINT(); */ #else /* nothing */ #endif } +EXPORT_SYMBOL(cfs_enter_debugger); sigset_t @@ -138,6 +139,7 @@ cfs_block_allsigs(void) return old; } +EXPORT_SYMBOL(cfs_block_allsigs); sigset_t cfs_block_sigs(unsigned long sigs) { @@ -151,6 +153,7 @@ sigset_t cfs_block_sigs(unsigned long sigs) spin_unlock_irqrestore(¤t->sighand->siglock, flags); return old; } +EXPORT_SYMBOL(cfs_block_sigs); /* Block all signals except for the @sigs */ sigset_t cfs_block_sigsinv(unsigned long sigs) @@ -166,9 +169,10 @@ sigset_t cfs_block_sigsinv(unsigned long sigs) return old; } +EXPORT_SYMBOL(cfs_block_sigsinv); void -cfs_restore_sigs (sigset_t old) +cfs_restore_sigs(sigset_t old) { unsigned long flags; @@ -177,12 +181,14 @@ cfs_restore_sigs (sigset_t old) recalc_sigpending(); spin_unlock_irqrestore(¤t->sighand->siglock, flags); } +EXPORT_SYMBOL(cfs_restore_sigs); int cfs_signal_pending(void) { return signal_pending(current); } +EXPORT_SYMBOL(cfs_signal_pending); void cfs_clear_sigpending(void) @@ -193,25 +199,19 @@ cfs_clear_sigpending(void) clear_tsk_thread_flag(current, TIF_SIGPENDING); spin_unlock_irqrestore(¤t->sighand->siglock, flags); } +EXPORT_SYMBOL(cfs_clear_sigpending); int libcfs_arch_init(void) { return 0; } +EXPORT_SYMBOL(libcfs_arch_init); void libcfs_arch_cleanup(void) { return; } - -EXPORT_SYMBOL(libcfs_arch_init); EXPORT_SYMBOL(libcfs_arch_cleanup); -EXPORT_SYMBOL(cfs_enter_debugger); -EXPORT_SYMBOL(cfs_block_allsigs); -EXPORT_SYMBOL(cfs_block_sigs); -EXPORT_SYMBOL(cfs_block_sigsinv); -EXPORT_SYMBOL(cfs_restore_sigs); -EXPORT_SYMBOL(cfs_signal_pending); -EXPORT_SYMBOL(cfs_clear_sigpending); + -- cgit v1.2.3 From 245cbcff17a512fdaf63fe7766560f2981a6b8cf Mon Sep 17 00:00:00 2001 From: Jonathan Sid-Otmane Date: Wed, 18 Mar 2015 21:59:41 +0100 Subject: Staging: lustre: vvp_dev.c: fix spaces issues This fixes the space issues in the file vvp_dev.c Signed-off-by: Jonathan Sid-Otmane Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/vvp_dev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index 97d94fc738f2..fde41d7c5e3d 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -63,12 +63,12 @@ static struct lu_kmem_descr vvp_caches[] = { { .ckd_cache = &vvp_thread_kmem, .ckd_name = "vvp_thread_kmem", - .ckd_size = sizeof (struct vvp_thread_info), + .ckd_size = sizeof(struct vvp_thread_info), }, { .ckd_cache = &vvp_session_kmem, .ckd_name = "vvp_session_kmem", - .ckd_size = sizeof (struct vvp_session) + .ckd_size = sizeof(struct vvp_session) }, { .ckd_cache = NULL @@ -90,6 +90,7 @@ static void vvp_key_fini(const struct lu_context *ctx, struct lu_context_key *key, void *data) { struct vvp_thread_info *info = data; + OBD_SLAB_FREE_PTR(info, vvp_thread_kmem); } @@ -108,6 +109,7 @@ static void vvp_session_key_fini(const struct lu_context *ctx, struct lu_context_key *key, void *data) { struct vvp_session *session = data; + OBD_SLAB_FREE_PTR(session, vvp_session_kmem); } -- cgit v1.2.3 From 71474ccba11fa81e096844f2294bf218e32eea4f Mon Sep 17 00:00:00 2001 From: Jonathan Sid-Otmane Date: Wed, 18 Mar 2015 22:12:47 +0100 Subject: Staging: lustre: niobuf.c fic 80 char limit This fixes the charatcer limit in niobuf.c Signed-off-by: Jonathan Sid-Otmane Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index dc3f6c6f8801..2fa2585584a3 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -388,7 +388,8 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) * ptlrpc_body in reply buffer to ptlrpc_body_v2, otherwise, the * reply buffer on client will be overflow. * - * XXX Remove this whenever we drop the interoperability with such client. + * XXX Remove this whenever we drop the interoperability with + * such client. */ req->rq_replen = lustre_shrink_msg(req->rq_repmsg, 0, sizeof(struct ptlrpc_body_v2), 1); -- cgit v1.2.3 From 9f0d9bfabfd2e45eff276178717fdaa1f2d2cc95 Mon Sep 17 00:00:00 2001 From: Gauthier Voron Date: Wed, 18 Mar 2015 23:45:53 +0100 Subject: Staging: lustre: fix coding style This patch fix too large line. Signed-off-by: Gauthier Voron Signed-off-by: Hakan Metin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index 6f0256fded8e..71f32999227e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -363,8 +363,8 @@ static void enc_pools_insert(struct page ***pools, int npools, int npages) */ cur_npools = (page_pools.epp_total_pages + PAGES_PER_POOL - 1) / PAGES_PER_POOL; - end_npools = (page_pools.epp_total_pages + npages + PAGES_PER_POOL - 1) / - PAGES_PER_POOL; + end_npools = (page_pools.epp_total_pages + npages + PAGES_PER_POOL - 1) + / PAGES_PER_POOL; LASSERT(end_npools <= page_pools.epp_max_pools); np_idx = 0; -- cgit v1.2.3 From acf60c3d3d596d62272a8f584049b926c4015564 Mon Sep 17 00:00:00 2001 From: Gauthier Voron Date: Wed, 18 Mar 2015 23:46:41 +0100 Subject: Staging: lustre: fix some coding style This patch remove unnecessary bracket. Signed-off-by: Gauthier Voron Signed-off-by: Hakan Metin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index 71f32999227e..c05a8554d737 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -814,9 +814,8 @@ int bulk_sec_desc_unpack(struct lustre_msg *msg, int offset, int swabbed) return -EINVAL; } - if (swabbed) { + if (swabbed) __swab32s(&bsd->bsd_nob); - } if (unlikely(bsd->bsd_version != 0)) { CERROR("Unexpected version %u\n", bsd->bsd_version); -- cgit v1.2.3 From e6157b1b19dbebcdabe5024ad0698499d9b46270 Mon Sep 17 00:00:00 2001 From: Redha Gouicem Date: Thu, 19 Mar 2015 10:16:07 +0100 Subject: Staging: lustre: lnet: lnet: router.c: fix 80 char line limit This patch fixes lines longer than the 80 char limit. Signed-off-by: Redha Gouicem Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/router.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index c0a6aebea351..568a31f4b321 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -107,7 +107,8 @@ lnet_peers_start_down(void) } void -lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, unsigned long when) +lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, + unsigned long when) { if (time_before(when, lp->lp_timestamp)) { /* out of date information */ CDEBUG(D_NET, "Out of date\n"); @@ -1435,7 +1436,7 @@ int lnet_rtrpools_alloc(int im_a_router) { lnet_rtrbufpool_t *rtrp; - int large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; + int large_pages; int small_pages = 1; int nrb_tiny; int nrb_small; @@ -1443,6 +1444,8 @@ lnet_rtrpools_alloc(int im_a_router) int rc; int i; + large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; + if (!strcmp(forwarding, "")) { /* not set either way */ if (!im_a_router) -- cgit v1.2.3 From ec523735e4a9969e5469c93c87a25a92f619f118 Mon Sep 17 00:00:00 2001 From: Redha Gouicem Date: Thu, 19 Mar 2015 10:16:08 +0100 Subject: Staging: lustre: lnet: lnet: router.c: fix useless returns and elses This patch removes useless returns and elses. Signed-off-by: Redha Gouicem Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/router.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 568a31f4b321..8510bae4822a 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -270,7 +270,6 @@ static void lnet_shuffle_seed(void) do_gettimeofday(&tv); cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]); seeded = 1; - return; } /* NB expects LNET_LOCK held */ @@ -355,13 +354,12 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway, LIBCFS_FREE(route, sizeof(*route)); LIBCFS_FREE(rnet, sizeof(*rnet)); - if (rc == -EHOSTUNREACH) { /* gateway is not on a local net */ + if (rc == -EHOSTUNREACH) /* gateway is not on a local net */ return 0; /* ignore the route entry */ - } else { - CERROR("Error %d creating route %s %d %s\n", rc, - libcfs_net2str(net), hops, - libcfs_nid2str(gateway)); - } + CERROR("Error %d creating route %s %d %s\n", rc, + libcfs_net2str(net), hops, + libcfs_nid2str(gateway)); + return rc; } @@ -607,7 +605,6 @@ lnet_swap_pinginfo(lnet_ping_info_t *info) __swab64s(&stat->ns_nid); __swab32s(&stat->ns_status); } - return; } /** @@ -1011,7 +1008,6 @@ lnet_ping_router_locked(lnet_peer_t *rtr) } lnet_peer_decref_locked(rtr); - return; } int @@ -1084,7 +1080,6 @@ lnet_router_checker_stop(void) rc = LNetEQFree(the_lnet.ln_rc_eqh); LASSERT(rc == 0); - return; } static void @@ -1582,7 +1577,6 @@ EXPORT_SYMBOL(lnet_notify); void lnet_get_tunables(void) { - return; } #else @@ -1671,7 +1665,6 @@ lnet_router_checker(void) lnet_net_unlock(0); running = 0; /* lock only needed for the recursion check */ - return; } /* NB lnet_peers_start_down depends on me, -- cgit v1.2.3 From 7078db9dffde19f4ea82acb0c2d8a9f81531e15a Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Wed, 18 Mar 2015 15:26:05 +0200 Subject: staging: prism2sta: Replace memcpy with ether_add_copy Replace memcpy() with ether_addr_copy() since addresses are __aligned(2). The 2 structures are aligned to u16 as showed below: typedef struct hfa384x_authenticateStation_data { u8 address[ETH_ALEN]; /* 0 6 */ u16 status; /* 6 2 */ u16 algorithm; /* 8 2 */ } __packed hfa384x_authenticateStation_data_t; Total size: 10 typedef struct hfa384x_AuthRequest { u8 sta_addr[ETH_ALEN]; /* 0 6 */ u16 algorithm; /* 6 2 */ } __packed hfa384x_AuthReq_t; Total size: 8 Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2sta.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index 854571fcfee0..ddb294e7044f 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -1544,7 +1545,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev, ** authentication. */ - memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN); + ether_addr_copy(rec.address, inf->info.authreq.sta_addr); rec.status = P80211ENUM_status_unspec_failure; /* @@ -1657,8 +1658,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev, if (hw->authlist.cnt >= WLAN_AUTH_MAX) { rec.status = P80211ENUM_status_ap_full; } else { - memcpy(hw->authlist.addr[hw->authlist.cnt], - rec.address, ETH_ALEN); + ether_addr_copy(hw->authlist.addr[hw->authlist.cnt], + rec.address); hw->authlist.cnt++; added = 1; } -- cgit v1.2.3 From d5133e75171d6b503b2491b882e00365515c6a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Thu, 19 Mar 2015 22:32:30 +0200 Subject: Staging: rtl8192u: Remove unnecessary spaces Fix checkpatch.pl issues with "unnecessary whitespace before a quoted newline" in r819xU_phy.c Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_phy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index a64c9fcfc46d..e5dbaca9e518 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -898,7 +898,7 @@ void rtl8192_phy_getTxPower(struct net_device *dev) read_nic_byte(dev, rOFDM0_RxDetector3, &priv->framesync); read_nic_byte(dev, rOFDM0_RxDetector2, &tmp); priv->framesyncC34 = tmp; - RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x \n", + RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x\n", rOFDM0_RxDetector3, priv->framesync); /* Read SIFS (save the value read fome MACPHY_REG.txt) */ @@ -1742,13 +1742,13 @@ void InitialGainOperateWorkItemCallBack(struct work_struct *work) RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xa0a is %x\n", priv->initgain_backup.cca); - RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x \n", + RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x\n", initial_gain); write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain); write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain); write_nic_byte(dev, rOFDM0_XCAGCCore1, initial_gain); write_nic_byte(dev, rOFDM0_XDAGCCore1, initial_gain); - RT_TRACE(COMP_SCAN, "Write scan 0xa0a = 0x%x \n", + RT_TRACE(COMP_SCAN, "Write scan 0xa0a = 0x%x\n", POWER_DETECTION_TH); write_nic_byte(dev, 0xa0a, POWER_DETECTION_TH); break; @@ -1789,7 +1789,7 @@ void InitialGainOperateWorkItemCallBack(struct work_struct *work) rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); break; default: - RT_TRACE(COMP_SCAN, "Unknown IG Operation. \n"); + RT_TRACE(COMP_SCAN, "Unknown IG Operation.\n"); break; } } -- cgit v1.2.3 From 0822339b52f6ea3f20b602362864f2a7ab9d3f7f Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:48 +0100 Subject: staging: rtl8192e: fix coding style issues (merge broken strings) Fix checkpatch.pl warnings: - 'WARNING: quoted string split across lines' - 'WARNING: break quoted strings at a space character' Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 51 +++--- drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 28 +-- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 124 +++++++------ .../staging/rtl8192e/rtl8192e/r8192E_firmware.c | 25 +-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 201 +++++++++++---------- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 20 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 140 +++++++------- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 36 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 18 +- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 12 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 24 +-- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 35 ++-- drivers/staging/rtl8192e/rtl819x_BAProc.c | 77 ++++---- drivers/staging/rtl8192e/rtl819x_HTProc.c | 34 ++-- drivers/staging/rtl8192e/rtl819x_TSProc.c | 53 +++--- drivers/staging/rtl8192e/rtllib_crypt.c | 14 +- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 24 +-- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 62 +++---- drivers/staging/rtl8192e/rtllib_crypt_wep.c | 12 +- drivers/staging/rtl8192e/rtllib_softmac.c | 61 ++++--- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 5 +- drivers/staging/rtl8192e/rtllib_tx.c | 8 +- drivers/staging/rtl8192e/rtllib_wx.c | 7 +- 23 files changed, 560 insertions(+), 511 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 0e6bdd222e75..01d2201afc94 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -47,8 +47,8 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, 0x0e, bMask12Bits, 0x021); } else { - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): " - "unknown hardware version\n"); + RT_TRACE(COMP_ERR, + "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); } break; @@ -66,15 +66,16 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, 0x0e, bMask12Bits, 0x0e1); } else { - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): " - "unknown hardware version\n"); + RT_TRACE(COMP_ERR, + "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); } break; default: - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown " - "Bandwidth: %#X\n", Bandwidth); + RT_TRACE(COMP_ERR, + "PHY_SetRF8256Bandwidth(): unknown Bandwidth: %#X\n", + Bandwidth); break; } @@ -138,8 +139,9 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) rtStatus = rtl8192_phy_checkBBAndRF(dev, HW90_BLOCK_RF, (enum rf90_radio_path)eRFPath); if (!rtStatus) { - RT_TRACE(COMP_ERR, "PHY_RF8256_Config():Check " - "Radio[%d] Fail!!\n", eRFPath); + RT_TRACE(COMP_ERR, + "PHY_RF8256_Config():Check Radio[%d] Fail!!\n", + eRFPath); goto phy_RF8256_Config_ParaFile_Fail; } @@ -155,9 +157,10 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final " - "value: %x\n", eRFPath, - RegOffSetToBeCheck, RF3_Final_Value); + RT_TRACE(COMP_RF, + "RF %d %d register final value: %x\n", + eRFPath, RegOffSetToBeCheck, + RF3_Final_Value); RetryTimes--; } break; @@ -170,9 +173,10 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final " - "value: %x\n", eRFPath, - RegOffSetToBeCheck, RF3_Final_Value); + RT_TRACE(COMP_RF, + "RF %d %d register final value: %x\n", + eRFPath, RegOffSetToBeCheck, + RF3_Final_Value); RetryTimes--; } break; @@ -185,9 +189,10 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final " - "value: %x\n", eRFPath, - RegOffSetToBeCheck, RF3_Final_Value); + RT_TRACE(COMP_RF, + "RF %d %d register final value: %x\n", + eRFPath, RegOffSetToBeCheck, + RF3_Final_Value); RetryTimes--; } break; @@ -199,9 +204,10 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final " - "value: %x\n", eRFPath, - RegOffSetToBeCheck, RF3_Final_Value); + RT_TRACE(COMP_RF, + "RF %d %d register final value: %x\n", + eRFPath, RegOffSetToBeCheck, + RF3_Final_Value); RetryTimes--; } break; @@ -221,8 +227,9 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) } if (ret) { - RT_TRACE(COMP_ERR, "phy_RF8256_Config_ParaFile():" - "Radio[%d] Fail!!", eRFPath); + RT_TRACE(COMP_ERR, + "phy_RF8256_Config_ParaFile():Radio[%d] Fail!!", + eRFPath); goto phy_RF8256_Config_ParaFile_Fail; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c index 2b1430d66adb..43d0cfa8aae5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c @@ -332,44 +332,44 @@ u32 cmpk_message_handle_rx(struct net_device *dev, switch (element_id) { case RX_TX_FEEDBACK: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_TX_FEEDBACK\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_TX_FEEDBACK\n"); cmpk_handle_tx_feedback(dev, pcmd_buff); cmd_length = CMPK_RX_TX_FB_SIZE; break; case RX_INTERRUPT_STATUS: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_INTERRUPT_STATUS\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_INTERRUPT_STATUS\n"); cmpk_handle_interrupt_status(dev, pcmd_buff); cmd_length = sizeof(struct cmpk_intr_sta); break; case BOTH_QUERY_CONFIG: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "BOTH_QUERY_CONFIG\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():BOTH_QUERY_CONFIG\n"); cmpk_handle_query_config_rx(dev, pcmd_buff); cmd_length = CMPK_BOTH_QUERY_CONFIG_SIZE; break; case RX_TX_STATUS: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_TX_STATUS\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_TX_STATUS\n"); cmpk_handle_tx_status(dev, pcmd_buff); cmd_length = CMPK_RX_TX_STS_SIZE; break; case RX_TX_PER_PKT_FEEDBACK: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_TX_PER_PKT_FEEDBACK\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_TX_PER_PKT_FEEDBACK\n"); cmd_length = CMPK_RX_TX_FB_SIZE; break; case RX_TX_RATE_HISTORY: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_TX_HISTORY\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_TX_HISTORY\n"); cmpk_handle_tx_rate_history(dev, pcmd_buff); cmd_length = CMPK_TX_RAHIS_SIZE; break; default: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "unknown CMD Element\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():unknown CMD Element\n"); return 1; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 08735cb116c0..14bea11a7d80 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -263,9 +263,9 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val) break; default: - RT_TRACE(COMP_QOS, "SetHwReg8185(): [HW_VAR_" - "ACM_CTRL] acm set failed: eACI is " - "%d\n", eACI); + RT_TRACE(COMP_QOS, + "SetHwReg8185(): [HW_VAR_ACM_CTRL] acm set failed: eACI is %d\n", + eACI); break; } } else { @@ -287,8 +287,9 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val) } } - RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write" - " 0x%X\n", AcmCtrl); + RT_TRACE(COMP_QOS, + "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", + AcmCtrl); write_nic_byte(dev, AcmHwCtrl, AcmCtrl); break; } @@ -448,12 +449,12 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) usValue = EEPROM_Default_TxPower; *((u16 *)(&priv->EEPROMTxPowerLevelCCK[i])) = usValue; - RT_TRACE(COMP_INIT, "CCK Tx Power Level, Index" - " %d = 0x%02x\n", i, - priv->EEPROMTxPowerLevelCCK[i]); - RT_TRACE(COMP_INIT, "CCK Tx Power Level, Index" - " %d = 0x%02x\n", i+1, - priv->EEPROMTxPowerLevelCCK[i+1]); + RT_TRACE(COMP_INIT, + "CCK Tx Power Level, Index %d = 0x%02x\n", + i, priv->EEPROMTxPowerLevelCCK[i]); + RT_TRACE(COMP_INIT, + "CCK Tx Power Level, Index %d = 0x%02x\n", + i+1, priv->EEPROMTxPowerLevelCCK[i+1]); } for (i = 0; i < 14; i += 2) { if (!priv->AutoloadFailFlag) @@ -464,11 +465,12 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) usValue = EEPROM_Default_TxPower; *((u16 *)(&priv->EEPROMTxPowerLevelOFDM24G[i])) = usValue; - RT_TRACE(COMP_INIT, "OFDM 2.4G Tx Power Level," - " Index %d = 0x%02x\n", i, - priv->EEPROMTxPowerLevelOFDM24G[i]); - RT_TRACE(COMP_INIT, "OFDM 2.4G Tx Power Level," - " Index %d = 0x%02x\n", i + 1, + RT_TRACE(COMP_INIT, + "OFDM 2.4G Tx Power Level, Index %d = 0x%02x\n", + i, priv->EEPROMTxPowerLevelOFDM24G[i]); + RT_TRACE(COMP_INIT, + "OFDM 2.4G Tx Power Level, Index %d = 0x%02x\n", + i + 1, priv->EEPROMTxPowerLevelOFDM24G[i+1]); } } @@ -525,21 +527,21 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) priv->EEPROMRfCOfdmChnlTxPwLevel[2]; } for (i = 0; i < 14; i++) - RT_TRACE(COMP_INIT, "priv->TxPowerLevelCCK_A" - "[%d] = 0x%x\n", i, - priv->TxPowerLevelCCK_A[i]); + RT_TRACE(COMP_INIT, + "priv->TxPowerLevelCCK_A[%d] = 0x%x\n", + i, priv->TxPowerLevelCCK_A[i]); for (i = 0; i < 14; i++) - RT_TRACE(COMP_INIT, "priv->TxPowerLevelOFDM" - "24G_A[%d] = 0x%x\n", i, - priv->TxPowerLevelOFDM24G_A[i]); + RT_TRACE(COMP_INIT, + "priv->TxPowerLevelOFDM24G_A[%d] = 0x%x\n", + i, priv->TxPowerLevelOFDM24G_A[i]); for (i = 0; i < 14; i++) - RT_TRACE(COMP_INIT, "priv->TxPowerLevelCCK_C" - "[%d] = 0x%x\n", i, - priv->TxPowerLevelCCK_C[i]); + RT_TRACE(COMP_INIT, + "priv->TxPowerLevelCCK_C[%d] = 0x%x\n", + i, priv->TxPowerLevelCCK_C[i]); for (i = 0; i < 14; i++) - RT_TRACE(COMP_INIT, "priv->TxPowerLevelOFDM" - "24G_C[%d] = 0x%x\n", i, - priv->TxPowerLevelOFDM24G_C[i]); + RT_TRACE(COMP_INIT, + "priv->TxPowerLevelOFDM24G_C[%d] = 0x%x\n", + i, priv->TxPowerLevelOFDM24G_C[i]); priv->LegacyHTTxPowerDiff = priv->EEPROMLegacyHTTxPowerDiff; priv->AntennaTxPwDiff[0] = 0; @@ -735,8 +737,9 @@ start: else if (priv->pFirmware->firmware_status == FW_STATUS_5_READY) ulRegRead |= CPU_GEN_FIRMWARE_RESET; else - RT_TRACE(COMP_ERR, "ERROR in %s(): undefined firmware state(%d)" - "\n", __func__, priv->pFirmware->firmware_status); + RT_TRACE(COMP_ERR, + "ERROR in %s(): undefined firmware state(%d)\n", + __func__, priv->pFirmware->firmware_status); write_nic_dword(dev, CPU_GEN, ulRegRead); @@ -766,8 +769,8 @@ start: else if (priv->LoopbackMode == RTL819X_MAC_LOOPBACK) ulRegRead |= CPU_CCK_LOOPBACK; else - RT_TRACE(COMP_ERR, "Serious error: wrong loopback" - " mode setting\n"); + RT_TRACE(COMP_ERR, + "Serious error: wrong loopback mode setting\n"); write_nic_dword(dev, CPU_GEN, ulRegRead); @@ -883,15 +886,15 @@ start: __func__); MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_SW, true); } else if (priv->rtllib->RfOffReason > RF_CHANGE_BY_PS) { - RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for" - " RfOffReason(%d) ----------\n", __func__, - priv->rtllib->RfOffReason); + RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), + "%s(): Turn off RF for RfOffReason(%d) ----------\n", + __func__, priv->rtllib->RfOffReason); MgntActSet_RF_State(dev, eRfOff, priv->rtllib->RfOffReason, true); } else if (priv->rtllib->RfOffReason >= RF_CHANGE_BY_IPS) { - RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for" - " RfOffReason(%d) ----------\n", __func__, - priv->rtllib->RfOffReason); + RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), + "%s(): Turn off RF for RfOffReason(%d) ----------\n", + __func__, priv->rtllib->RfOffReason); MgntActSet_RF_State(dev, eRfOff, priv->rtllib->RfOffReason, true); } else { @@ -939,17 +942,17 @@ start: priv->CCKPresentAttentuation_difference = 0; priv->CCKPresentAttentuation = priv->CCKPresentAttentuation_20Mdefault; - RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpower" - "trackingindex_initial = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex_initial = %d\n", priv->rfa_txpowertrackingindex); - RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpower" - "trackingindex_real__initial = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex_real__initial = %d\n", priv->rfa_txpowertrackingindex_real); - RT_TRACE(COMP_POWER_TRACKING, "priv->CCKPresent" - "Attentuation_difference_initial = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation_difference_initial = %d\n", priv->CCKPresentAttentuation_difference); - RT_TRACE(COMP_POWER_TRACKING, "priv->CCKPresent" - "Attentuation_initial = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation_initial = %d\n", priv->CCKPresentAttentuation); priv->btxpower_tracking = false; } @@ -1169,8 +1172,9 @@ static u8 rtl8192_MapHwQueueToFirmwareQueue(u8 QueueID, u8 priority) QueueSelect = QSLT_HIGH; break; default: - RT_TRACE(COMP_ERR, "TransmitTCB(): Impossible Queue Selection:" - " %d\n", QueueID); + RT_TRACE(COMP_ERR, + "TransmitTCB(): Impossible Queue Selection: %d\n", + QueueID); break; } return QueueSelect; @@ -1361,9 +1365,10 @@ static u8 HwRateToMRate90(bool bIsHT, u8 rate) break; default: - RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported" - "Rate [%x], bIsHT = %d!!!\n", rate, bIsHT); - break; + RT_TRACE(COMP_RECV, + "HwRateToMRate90(): Non supportedRate [%x], bIsHT = %d!!!\n", + rate, bIsHT); + break; } } else { @@ -1421,8 +1426,9 @@ static u8 HwRateToMRate90(bool bIsHT, u8 rate) break; default: - RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported " - "Rate [%x], bIsHT = %d!!!\n", rate, bIsHT); + RT_TRACE(COMP_RECV, + "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n", + rate, bIsHT); break; } } @@ -1737,8 +1743,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, if (!rtl8192_phy_CheckIsLegalRFPath(priv->rtllib->dev, rfpath)) continue; - RT_TRACE(COMP_DBG, "Jacken -> pPreviousstats->RxMIMO" - "SignalStrength[rfpath] = %d\n", + RT_TRACE(COMP_DBG, + "Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d\n", prev_st->RxMIMOSignalStrength[rfpath]); if (priv->stats.rx_rssi_percentage[rfpath] == 0) { priv->stats.rx_rssi_percentage[rfpath] = @@ -1761,8 +1767,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, (prev_st->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH); } - RT_TRACE(COMP_DBG, "Jacken -> priv->RxStats.RxRSSI" - "Percentage[rfPath] = %d\n", + RT_TRACE(COMP_DBG, + "Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d\n", priv->stats.rx_rssi_percentage[rfpath]); } } @@ -2073,8 +2079,8 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev, pDrvInfo); if (pDrvInfo->FirstAGGR == 1 || pDrvInfo->PartAggr == 1) - RT_TRACE(COMP_RXDESC, "pDrvInfo->FirstAGGR = %d," - " pDrvInfo->PartAggr = %d\n", + RT_TRACE(COMP_RXDESC, + "pDrvInfo->FirstAGGR = %d, pDrvInfo->PartAggr = %d\n", pDrvInfo->FirstAGGR, pDrvInfo->PartAggr); skb_trim(skb, skb->len - 4/*sCrcLng*/); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index fa9c08101fff..75be672a4cd7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -83,8 +83,8 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, if (!priv->rtllib->check_nic_enough_desc(dev, tcb_desc->queue_index) || (!skb_queue_empty(&priv->rtllib->skb_waitQ[tcb_desc->queue_index])) || (priv->rtllib->queue_stop)) { - RT_TRACE(COMP_FIRMWARE, "===================> tx " - "full!\n"); + RT_TRACE(COMP_FIRMWARE, + "===================> tx full!\n"); skb_queue_tail(&priv->rtllib->skb_waitQ [tcb_desc->queue_index], skb); } else { @@ -196,8 +196,8 @@ static bool firmware_check_ready(struct net_device *dev, if (rt_status) pfirmware->firmware_status = FW_STATUS_3_TURNON_CPU; else - RT_TRACE(COMP_FIRMWARE, "CPUcheck_maincodeok_turnon" - "CPU fail!\n"); + RT_TRACE(COMP_FIRMWARE, + "CPUcheck_maincodeok_turnonCPU fail!\n"); break; @@ -209,8 +209,9 @@ static bool firmware_check_ready(struct net_device *dev, if (rt_status) pfirmware->firmware_status = FW_STATUS_5_READY; else - RT_TRACE(COMP_FIRMWARE, "CPUcheck_firmware_ready fail" - "(%d)!\n", rt_status); + RT_TRACE(COMP_FIRMWARE, + "CPUcheck_firmware_ready fail(%d)!\n", + rt_status); break; default: @@ -245,8 +246,8 @@ bool init_firmware(struct net_device *dev) rst_opt = OPT_FIRMWARE_RESET; starting_state = FW_INIT_STEP2_DATA; } else { - RT_TRACE(COMP_FIRMWARE, "PlatformInitFirmware: undefined" - " firmware state\n"); + RT_TRACE(COMP_FIRMWARE, + "PlatformInitFirmware: undefined firmware state\n"); } for (init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; @@ -265,14 +266,14 @@ bool init_firmware(struct net_device *dev) fw_name[init_step], &priv->pdev->dev); if (rc < 0) { - RT_TRACE(COMP_FIRMWARE, "request firmware fail!\n"); + RT_TRACE(COMP_FIRMWARE, + "request firmware fail!\n"); goto download_firmware_fail; } if (fw_entry->size > sizeof(pfirmware->firmware_buf[init_step])) { - RT_TRACE(COMP_FIRMWARE, "img file size " - "exceed the container struct " - "buffer fail!\n"); + RT_TRACE(COMP_FIRMWARE, + "img file size exceed the container struct buffer fail!\n"); goto download_firmware_fail; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index a369a1f28ee5..1d9b7a17cbde 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -136,8 +136,8 @@ static u32 rtl8192_phy_RFSerialRead(struct net_device *dev, } else NewOffset = Offset; } else { - RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need" - " to be 8256\n"); + RT_TRACE((COMP_PHY|COMP_ERR), + "check RF type here, need to be 8256\n"); NewOffset = Offset; } rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadAddress, @@ -192,8 +192,8 @@ static void rtl8192_phy_RFSerialWrite(struct net_device *dev, } else NewOffset = Offset; } else { - RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need to be" - " 8256\n"); + RT_TRACE((COMP_PHY|COMP_ERR), + "check RF type here, need to be 8256\n"); NewOffset = Offset; } @@ -348,8 +348,8 @@ void rtl8192_phy_configmac(struct net_device *dev) pdwArray = Rtl819XMACPHY_Array; } for (i = 0; i < dwArrayLen; i += 3) { - RT_TRACE(COMP_DBG, "The Rtl8190MACPHY_Array[0] is %x Rtl8190MAC" - "PHY_Array[1] is %x Rtl8190MACPHY_Array[2] is %x\n", + RT_TRACE(COMP_DBG, + "The Rtl8190MACPHY_Array[0] is %x Rtl8190MACPHY_Array[1] is %x Rtl8190MACPHY_Array[2] is %x\n", pdwArray[i], pdwArray[i+1], pdwArray[i+2]); if (pdwArray[i] == 0x318) pdwArray[i+2] = 0x00000800; @@ -383,8 +383,8 @@ void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType) rtl8192_setBBreg(dev, Rtl819XPHY_REGArray_Table[i], bMaskDWord, Rtl819XPHY_REGArray_Table[i+1]); - RT_TRACE(COMP_DBG, "i: %x, The Rtl819xUsbPHY_REGArray" - "[0] is %x Rtl819xUsbPHY_REGArray[1] is %x\n", + RT_TRACE(COMP_DBG, + "i: %x, The Rtl819xUsbPHY_REGArray[0] is %x Rtl819xUsbPHY_REGArray[1] is %x\n", i, Rtl819XPHY_REGArray_Table[i], Rtl819XPHY_REGArray_Table[i+1]); } @@ -393,9 +393,9 @@ void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType) rtl8192_setBBreg(dev, Rtl819XAGCTAB_Array_Table[i], bMaskDWord, Rtl819XAGCTAB_Array_Table[i+1]); - RT_TRACE(COMP_DBG, "i:%x, The rtl819XAGCTAB_Array[0] " - "is %x rtl819XAGCTAB_Array[1] is %x\n", i, - Rtl819XAGCTAB_Array_Table[i], + RT_TRACE(COMP_DBG, + "i:%x, The rtl819XAGCTAB_Array[0] is %x rtl819XAGCTAB_Array[1] is %x\n", + i, Rtl819XAGCTAB_Array_Table[i], Rtl819XAGCTAB_Array_Table[i+1]); } } @@ -511,8 +511,8 @@ bool rtl8192_phy_checkBBAndRF(struct net_device *dev, for (i = 0; i < CheckTimes; i++) { switch (CheckBlock) { case HW90_BLOCK_MAC: - RT_TRACE(COMP_ERR, "PHY_CheckBBRFOK(): Never Write " - "0x100 here!"); + RT_TRACE(COMP_ERR, + "PHY_CheckBBRFOK(): Never Write 0x100 here!"); break; case HW90_BLOCK_PHY0: @@ -541,8 +541,9 @@ bool rtl8192_phy_checkBBAndRF(struct net_device *dev, if (dwRegRead != WriteData[i]) { - RT_TRACE(COMP_ERR, "====>error=====dwRegRead: %x, " - "WriteData: %x\n", dwRegRead, WriteData[i]); + RT_TRACE(COMP_ERR, + "====>error=====dwRegRead: %x, WriteData: %x\n", + dwRegRead, WriteData[i]); ret = false; break; } @@ -570,8 +571,9 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) (enum hw90_block)eCheckItem, (enum rf90_radio_path)0); if (!rtStatus) { - RT_TRACE((COMP_ERR | COMP_PHY), "PHY_RF8256_Config():" - "Check PHY%d Fail!!\n", eCheckItem-1); + RT_TRACE((COMP_ERR | COMP_PHY), + "PHY_RF8256_Config():Check PHY%d Fail!!\n", + eCheckItem-1); return rtStatus; } } @@ -628,8 +630,8 @@ void rtl8192_phy_getTxPower(struct net_device *dev) priv->DefaultInitialGain[1] = read_nic_byte(dev, rOFDM0_XBAGCCore1); priv->DefaultInitialGain[2] = read_nic_byte(dev, rOFDM0_XCAGCCore1); priv->DefaultInitialGain[3] = read_nic_byte(dev, rOFDM0_XDAGCCore1); - RT_TRACE(COMP_INIT, "Default initial gain (c50=0x%x, c58=0x%x, " - "c60=0x%x, c68=0x%x)\n", + RT_TRACE(COMP_INIT, + "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n", priv->DefaultInitialGain[0], priv->DefaultInitialGain[1], priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]); @@ -807,8 +809,8 @@ static void rtl8192_SetTxPowerLevel(struct net_device *dev, u8 channel) case RF_8258: break; default: - RT_TRACE(COMP_ERR, "unknown rf chip ID in rtl8192_SetTxPower" - "Level()\n"); + RT_TRACE(COMP_ERR, + "unknown rf chip ID in rtl8192_SetTxPowerLevel()\n"); break; } return; @@ -822,15 +824,14 @@ static u8 rtl8192_phy_SetSwChnlCmdArray(struct sw_chnl_cmd *CmdTable, struct sw_chnl_cmd *pCmd; if (CmdTable == NULL) { - RT_TRACE(COMP_ERR, "phy_SetSwChnlCmdArray(): CmdTable cannot " - "be NULL.\n"); + RT_TRACE(COMP_ERR, + "phy_SetSwChnlCmdArray(): CmdTable cannot be NULL.\n"); return false; } if (CmdTableIdx >= CmdTableSz) { - RT_TRACE(COMP_ERR, "phy_SetSwChnlCmdArray(): Access invalid" - " index, please check size of the table, CmdTableIdx:" - "%d, CmdTableSz:%d\n", - CmdTableIdx, CmdTableSz); + RT_TRACE(COMP_ERR, + "phy_SetSwChnlCmdArray(): Access invalid index, please check size of the table, CmdTableIdx:%d, CmdTableSz:%d\n", + CmdTableIdx, CmdTableSz); return false; } @@ -883,8 +884,9 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, switch (priv->rf_chip) { case RF_8225: if (!(channel >= 1 && channel <= 14)) { - RT_TRACE(COMP_ERR, "illegal channel for Zebra " - "8225: %d\n", channel); + RT_TRACE(COMP_ERR, + "illegal channel for Zebra 8225: %d\n", + channel); return false; } rtl8192_phy_SetSwChnlCmdArray(ieee->RfDependCmd, @@ -898,8 +900,9 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, case RF_8256: if (!(channel >= 1 && channel <= 14)) { - RT_TRACE(COMP_ERR, "illegal channel for Zebra" - " 8256: %d\n", channel); + RT_TRACE(COMP_ERR, + "illegal channel for Zebra 8256: %d\n", + channel); return false; } rtl8192_phy_SetSwChnlCmdArray(ieee->RfDependCmd, @@ -1082,8 +1085,8 @@ static void CCK_Tx_Power_Track_BW_Switch_TSSI(struct net_device *dev) if (priv->CCKPresentAttentuation < 0) priv->CCKPresentAttentuation = 0; - RT_TRACE(COMP_POWER_TRACKING, "20M, priv->CCKPresent" - "Attentuation = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "20M, priv->CCKPresentAttentuation = %d\n", priv->CCKPresentAttentuation); if (priv->rtllib->current_network.channel == 14 && @@ -1104,8 +1107,8 @@ static void CCK_Tx_Power_Track_BW_Switch_TSSI(struct net_device *dev) priv->CCKPresentAttentuation_40Mdefault + priv->CCKPresentAttentuation_difference; - RT_TRACE(COMP_POWER_TRACKING, "40M, priv->CCKPresent" - "Attentuation = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "40M, priv->CCKPresentAttentuation = %d\n", priv->CCKPresentAttentuation); if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength - 1)) @@ -1145,15 +1148,15 @@ static void CCK_Tx_Power_Track_BW_Switch_ThermalMeter(struct net_device *dev) if (priv->Record_CCK_20Mindex == 0) priv->Record_CCK_20Mindex = 6; priv->CCK_index = priv->Record_CCK_20Mindex; - RT_TRACE(COMP_POWER_TRACKING, "20MHz, CCK_Tx_Power_Track_BW_" - "Switch_ThermalMeter(),CCK_index = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "20MHz, CCK_Tx_Power_Track_BW_Switch_ThermalMeter(),CCK_index = %d\n", priv->CCK_index); break; case HT_CHANNEL_WIDTH_20_40: priv->CCK_index = priv->Record_CCK_40Mindex; - RT_TRACE(COMP_POWER_TRACKING, "40MHz, CCK_Tx_Power_Track_BW_" - "Switch_ThermalMeter(), CCK_index = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "40MHz, CCK_Tx_Power_Track_BW_Switch_ThermalMeter(), CCK_index = %d\n", priv->CCK_index); break; } @@ -1176,9 +1179,10 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); u8 regBwOpMode; - RT_TRACE(COMP_SWBW, "==>rtl8192_SetBWModeWorkItem() Switch to %s " - "bandwidth\n", priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ? - "20MHz" : "40MHz"); + RT_TRACE(COMP_SWBW, + "==>rtl8192_SetBWModeWorkItem() Switch to %s bandwidth\n", + priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ? + "20MHz" : "40MHz"); if (priv->rf_chip == RF_PSEUDO_11N) { @@ -1203,8 +1207,9 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) break; default: - RT_TRACE(COMP_ERR, "SetChannelBandwidth819xUsb(): unknown " - "Bandwidth: %#X\n", priv->CurrentChannelBW); + RT_TRACE(COMP_ERR, + "SetChannelBandwidth819xUsb(): unknown Bandwidth: %#X\n", + priv->CurrentChannelBW); break; } @@ -1244,8 +1249,9 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0); break; default: - RT_TRACE(COMP_ERR, "SetChannelBandwidth819xUsb(): unknown " - "Bandwidth: %#X\n", priv->CurrentChannelBW); + RT_TRACE(COMP_ERR, + "SetChannelBandwidth819xUsb(): unknown Bandwidth: %#X\n", + priv->CurrentChannelBW); break; } @@ -1311,8 +1317,8 @@ void InitialGain819xPci(struct net_device *dev, u8 Operation) if (priv->up) { switch (Operation) { case IG_Backup: - RT_TRACE(COMP_SCAN, "IG_Backup, backup the initial" - " gain.\n"); + RT_TRACE(COMP_SCAN, + "IG_Backup, backup the initial gain.\n"); initial_gain = SCAN_RX_INITIAL_GAIN; BitMask = bMaskByte0; if (dm_digtable.dig_algorithm == @@ -1334,16 +1340,21 @@ void InitialGain819xPci(struct net_device *dev, u8 Operation) priv->initgain_backup.cca = (u8)rtl8192_QueryBBReg(dev, rCCK0_CCA, BitMask); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc50 is" - " %x\n", priv->initgain_backup.xaagccore1); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc58 is" - " %x\n", priv->initgain_backup.xbagccore1); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc60 is" - " %x\n", priv->initgain_backup.xcagccore1); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc68 is" - " %x\n", priv->initgain_backup.xdagccore1); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xa0a is" - " %x\n", priv->initgain_backup.cca); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xc50 is %x\n", + priv->initgain_backup.xaagccore1); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xc58 is %x\n", + priv->initgain_backup.xbagccore1); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xc60 is %x\n", + priv->initgain_backup.xcagccore1); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xc68 is %x\n", + priv->initgain_backup.xdagccore1); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xa0a is %x\n", + priv->initgain_backup.cca); RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x\n", initial_gain); @@ -1356,8 +1367,8 @@ void InitialGain819xPci(struct net_device *dev, u8 Operation) write_nic_byte(dev, 0xa0a, POWER_DETECTION_TH); break; case IG_Restore: - RT_TRACE(COMP_SCAN, "IG_Restore, restore the initial " - "gain.\n"); + RT_TRACE(COMP_SCAN, + "IG_Restore, restore the initial gain.\n"); BitMask = 0x7f; if (dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) @@ -1375,16 +1386,21 @@ void InitialGain819xPci(struct net_device *dev, u8 Operation) rtl8192_setBBreg(dev, rCCK0_CCA, BitMask, (u32)priv->initgain_backup.cca); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc50" - " is %x\n", priv->initgain_backup.xaagccore1); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc58" - " is %x\n", priv->initgain_backup.xbagccore1); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc60" - " is %x\n", priv->initgain_backup.xcagccore1); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc68" - " is %x\n", priv->initgain_backup.xdagccore1); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xa0a" - " is %x\n", priv->initgain_backup.cca); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xc50 is %x\n", + priv->initgain_backup.xaagccore1); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xc58 is %x\n", + priv->initgain_backup.xbagccore1); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xc60 is %x\n", + priv->initgain_backup.xcagccore1); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xc68 is %x\n", + priv->initgain_backup.xdagccore1); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xa0a is %x\n", + priv->initgain_backup.cca); rtl8192_phy_setTxPower(dev, priv->rtllib->current_network.channel); @@ -1446,8 +1462,8 @@ static bool SetRFPowerState8190(struct net_device *dev, } while (!rtstatus && (InitilizeCount > 0)); if (!rtstatus) { - RT_TRACE(COMP_ERR, "%s():Initialize Ada" - "pter fail,return\n", + RT_TRACE(COMP_ERR, + "%s():Initialize Adapter fail,return\n", __func__); priv->SetRFPowerStateInProgress = false; return false; @@ -1491,19 +1507,16 @@ static bool SetRFPowerState8190(struct net_device *dev, QueueID++; continue; } else { - RT_TRACE((COMP_POWER|COMP_RF), "eRf Off" - "/Sleep: %d times TcbBusyQueue" - "[%d] !=0 before doze!\n", + RT_TRACE((COMP_POWER|COMP_RF), + "eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 before doze!\n", (i+1), QueueID); udelay(10); i++; } if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(COMP_POWER, "\n\n\n TimeOut!! " - "SetRFPowerState8190(): eRfOff" - ": %d times TcbBusyQueue[%d] " - "!= 0 !!!\n", + RT_TRACE(COMP_POWER, + "\n\n\n TimeOut!! SetRFPowerState8190(): eRfOff: %d times TcbBusyQueue[%d] != 0 !!!\n", MAX_DOZE_WAITING_TIMES_9x, QueueID); break; @@ -1513,8 +1526,8 @@ static bool SetRFPowerState8190(struct net_device *dev, break; case eRfOff: - RT_TRACE(COMP_PS, "SetRFPowerState8190() eRfOff/" - "Sleep !\n"); + RT_TRACE(COMP_PS, + "SetRFPowerState8190() eRfOff/Sleep !\n"); for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) { ring = &priv->tx_ring[QueueID]; @@ -1523,19 +1536,16 @@ static bool SetRFPowerState8190(struct net_device *dev, QueueID++; continue; } else { - RT_TRACE(COMP_POWER, "eRf Off/Sleep: %d" - " times TcbBusyQueue[%d] !=0 b" - "efore doze!\n", (i+1), - QueueID); + RT_TRACE(COMP_POWER, + "eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 before doze!\n", + (i+1), QueueID); udelay(10); i++; } if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(COMP_POWER, "\n\n\n SetZebra: " - "RFPowerState8185B(): eRfOff:" - " %d times TcbBusyQueue[%d] " - "!= 0 !!!\n", + RT_TRACE(COMP_POWER, + "\n\n\n SetZebra: RFPowerState8185B(): eRfOff: %d times TcbBusyQueue[%d] != 0 !!!\n", MAX_DOZE_WAITING_TIMES_9x, QueueID); break; @@ -1555,8 +1565,9 @@ static bool SetRFPowerState8190(struct net_device *dev, default: bResult = false; - RT_TRACE(COMP_ERR, "SetRFPowerState8190(): unknown state" - " to set: 0x%X!!!\n", eRFPowerState); + RT_TRACE(COMP_ERR, + "SetRFPowerState8190(): unknown state to set: 0x%X!!!\n", + eRFPowerState); break; } @@ -1575,8 +1586,8 @@ static bool SetRFPowerState8190(struct net_device *dev, break; default: - RT_TRACE(COMP_ERR, "SetRFPowerState8190(): Unknown " - "RF type\n"); + RT_TRACE(COMP_ERR, + "SetRFPowerState8190(): Unknown RF type\n"); break; } } @@ -1598,8 +1609,8 @@ bool SetRFPowerState(struct net_device *dev, eRFPowerState); if (eRFPowerState == priv->rtllib->eRFPowerState && priv->bHwRfOffAction == 0) { - RT_TRACE(COMP_PS, "<--------- SetRFPowerState(): discard the " - "request for eRFPowerState(%d) is the same.\n", + RT_TRACE(COMP_PS, + "<--------- SetRFPowerState(): discard the request for eRFPowerState(%d) is the same.\n", eRFPowerState); return bResult; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 05696428e8a3..1764f1ca4258 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -86,9 +86,9 @@ void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; - RT_TRACE(COMP_DBG, "===========>%s():EntryNo is %d,KeyIndex is " - "%d,KeyType is %d,is_mesh is %d\n", __func__, EntryNo, - KeyIndex, KeyType, is_mesh); + RT_TRACE(COMP_DBG, + "===========>%s():EntryNo is %d,KeyIndex is %d,KeyType is %d,is_mesh is %d\n", + __func__, EntryNo, KeyIndex, KeyType, is_mesh); if (!is_mesh) { ieee->swcamtable[EntryNo].bused = true; ieee->swcamtable[EntryNo].key_index = KeyIndex; @@ -127,9 +127,9 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, if (EntryNo >= TOTAL_CAM_ENTRY) RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n"); - RT_TRACE(COMP_SEC, "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d," - "KeyType:%d, MacAddr %pM\n", dev, EntryNo, KeyIndex, - KeyType, MacAddr); + RT_TRACE(COMP_SEC, + "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n", + dev, EntryNo, KeyIndex, KeyType, MacAddr); if (DefaultKey) usConfig |= BIT15 | (KeyType<<2); @@ -244,8 +244,8 @@ void CamRestoreAllEntry(struct net_device *dev) (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]) ); } else { - RT_TRACE(COMP_ERR, "===>%s():ERR!! ADHOC TKIP " - ",but 0 entry is have no data\n", + RT_TRACE(COMP_ERR, + "===>%s():ERR!! ADHOC TKIP ,but 0 entry is have no data\n", __func__); return; } @@ -268,8 +268,8 @@ void CamRestoreAllEntry(struct net_device *dev) CAM_CONST_ADDR[0], 0, (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])); } else { - RT_TRACE(COMP_ERR, "===>%s():ERR!! ADHOC CCMP ," - "but 0 entry is have no data\n", + RT_TRACE(COMP_ERR, + "===>%s():ERR!! ADHOC CCMP ,but 0 entry is have no data\n", __func__); return; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 51c21da98f60..95debb676e79 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -326,8 +326,8 @@ bool MgntActSet_RF_State(struct net_device *dev, u16 RFWaitCounter = 0; unsigned long flag; - RT_TRACE((COMP_PS | COMP_RF), "===>MgntActSet_RF_State(): " - "StateToSet(%d)\n", StateToSet); + RT_TRACE((COMP_PS | COMP_RF), + "===>MgntActSet_RF_State(): StateToSet(%d)\n", StateToSet); ProtectOrNot = false; @@ -338,22 +338,19 @@ bool MgntActSet_RF_State(struct net_device *dev, if (priv->RFChangeInProgress) { spin_unlock_irqrestore(&priv->rf_ps_lock, flag); RT_TRACE((COMP_PS | COMP_RF), - "MgntActSet_RF_State(): RF Change in " - "progress! Wait to set..StateToSet" - "(%d).\n", StateToSet); + "MgntActSet_RF_State(): RF Change in progress! Wait to set..StateToSet(%d).\n", + StateToSet); while (priv->RFChangeInProgress) { RFWaitCounter++; RT_TRACE((COMP_PS | COMP_RF), - "MgntActSet_RF_State(): Wait 1" - " ms (%d times)...\n", + "MgntActSet_RF_State(): Wait 1 ms (%d times)...\n", RFWaitCounter); mdelay(1); if (RFWaitCounter > 100) { - RT_TRACE(COMP_ERR, "MgntActSet_" - "RF_State(): Wait too " - "logn to set RF\n"); + RT_TRACE(COMP_ERR, + "MgntActSet_RF_State(): Wait too logn to set RF\n"); return false; } } @@ -383,9 +380,8 @@ bool MgntActSet_RF_State(struct net_device *dev, ChangeSource >= RF_CHANGE_BY_HW) bConnectBySSID = true; } else { - RT_TRACE((COMP_PS | COMP_RF), "MgntActSet_RF_State - " - "eRfon reject pMgntInfo->RfOffReason= 0x%x," - " ChangeSource=0x%X\n", + RT_TRACE((COMP_PS | COMP_RF), + "MgntActSet_RF_State - eRfon reject pMgntInfo->RfOffReason= 0x%x, ChangeSource=0x%X\n", priv->rtllib->RfOffReason, ChangeSource); } @@ -421,8 +417,8 @@ bool MgntActSet_RF_State(struct net_device *dev, } if (bActionAllowed) { - RT_TRACE((COMP_PS | COMP_RF), "MgntActSet_RF_State(): Action is" - " allowed.... StateToSet(%d), RfOffReason(%#X)\n", + RT_TRACE((COMP_PS | COMP_RF), + "MgntActSet_RF_State(): Action is allowed.... StateToSet(%d), RfOffReason(%#X)\n", StateToSet, priv->rtllib->RfOffReason); PHY_SetRFPowerState(dev, StateToSet); if (StateToSet == eRfOn) { @@ -434,10 +430,9 @@ bool MgntActSet_RF_State(struct net_device *dev, } } } else { - RT_TRACE((COMP_PS | COMP_RF), "MgntActSet_RF_State(): " - "Action is rejected.... StateToSet(%d), ChangeSource" - "(%#X), RfOffReason(%#X)\n", StateToSet, ChangeSource, - priv->rtllib->RfOffReason); + RT_TRACE((COMP_PS | COMP_RF), + "MgntActSet_RF_State(): Action is rejected.... StateToSet(%d), ChangeSource(%#X), RfOffReason(%#X)\n", + StateToSet, ChangeSource, priv->rtllib->RfOffReason); } if (!ProtectOrNot) { @@ -460,9 +455,9 @@ static short rtl8192_get_nic_desc_num(struct net_device *dev, int prio) * between the tail and the head */ if ((prio == MGNT_QUEUE) && (skb_queue_len(&ring->queue) > 10)) - RT_TRACE(COMP_DBG, "-----[%d]---------ring->idx=%d " - "queue_len=%d---------\n", prio, ring->idx, - skb_queue_len(&ring->queue)); + RT_TRACE(COMP_DBG, + "-----[%d]---------ring->idx=%d queue_len=%d---------\n", + prio, ring->idx, skb_queue_len(&ring->queue)); return skb_queue_len(&ring->queue); } @@ -526,8 +521,9 @@ void rtl8192_update_cap(struct net_device *dev, u16 cap) if (priv->dot11CurrentPreambleMode != PREAMBLE_SHORT) { ShortPreamble = true; priv->dot11CurrentPreambleMode = PREAMBLE_SHORT; - RT_TRACE(COMP_DBG, "%s(): WLAN_CAPABILITY_SHORT_" - "PREAMBLE\n", __func__); + RT_TRACE(COMP_DBG, + "%s(): WLAN_CAPABILITY_SHORT_PREAMBLE\n", + __func__); priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, (unsigned char *)&ShortPreamble); } @@ -535,8 +531,9 @@ void rtl8192_update_cap(struct net_device *dev, u16 cap) if (priv->dot11CurrentPreambleMode != PREAMBLE_LONG) { ShortPreamble = false; priv->dot11CurrentPreambleMode = PREAMBLE_LONG; - RT_TRACE(COMP_DBG, "%s(): WLAN_CAPABILITY_LONG_" - "PREAMBLE\n", __func__); + RT_TRACE(COMP_DBG, + "%s(): WLAN_CAPABILITY_LONG_PREAMBLE\n", + __func__); priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, (unsigned char *)&ShortPreamble); } @@ -597,8 +594,8 @@ static void rtl8192_qos_activate(void *data) mutex_lock(&priv->mutex); if (priv->rtllib->state != RTLLIB_LINKED) goto success; - RT_TRACE(COMP_QOS, "qos active process with associate response " - "received\n"); + RT_TRACE(COMP_QOS, + "qos active process with associate response received\n"); for (i = 0; i < QOS_QUEUE_NUM; i++) priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i)); @@ -634,8 +631,8 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, network->qos_data.param_count; priv->rtllib->wmm_acm = network->qos_data.wmm_acm; queue_work_rsl(priv->priv_wq, &priv->qos_activate); - RT_TRACE(COMP_QOS, "QoS parameters change call " - "qos_activate\n"); + RT_TRACE(COMP_QOS, + "QoS parameters change call qos_activate\n"); } } else { memcpy(&priv->rtllib->current_network.qos_data.parameters, @@ -643,8 +640,8 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, if ((network->qos_data.active == 1) && (active_network == 1)) { queue_work_rsl(priv->priv_wq, &priv->qos_activate); - RT_TRACE(COMP_QOS, "QoS was disabled call qos_" - "activate\n"); + RT_TRACE(COMP_QOS, + "QoS was disabled call qos_activate\n"); } network->qos_data.active = 0; network->qos_data.supported = 0; @@ -909,8 +906,9 @@ void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode) } else if ((bSupportMode & WIRELESS_MODE_B)) { wireless_mode = WIRELESS_MODE_B; } else { - RT_TRACE(COMP_ERR, "%s(), No valid wireless mode " - "supported (%x)!!!\n", __func__, bSupportMode); + RT_TRACE(COMP_ERR, + "%s(), No valid wireless mode supported (%x)!!!\n", + __func__, bSupportMode); wireless_mode = WIRELESS_MODE_B; } } @@ -1025,8 +1023,9 @@ static int rtl8192_sta_down(struct net_device *dev, bool shutdownrf) spin_lock_irqsave(&priv->rf_ps_lock, flags); break; } - RT_TRACE(COMP_DBG, "===>%s():RF is in progress, need to wait " - "until rf change is done.\n", __func__); + RT_TRACE(COMP_DBG, + "===>%s():RF is in progress, need to wait until rf change is done.\n", + __func__); mdelay(1); RFInProgressTimeOut++; spin_lock_irqsave(&priv->rf_ps_lock, flags); @@ -1212,8 +1211,8 @@ static void rtl8192_init_priv_variable(struct net_device *dev) priv->AcmControl = 0; priv->pFirmware = vzalloc(sizeof(struct rt_firmware)); if (!priv->pFirmware) - printk(KERN_ERR "rtl8192e: Unable to allocate space " - "for firmware\n"); + printk(KERN_ERR + "rtl8192e: Unable to allocate space for firmware\n"); skb_queue_head_init(&priv->rx_queue); skb_queue_head_init(&priv->skb_queue); @@ -1278,14 +1277,15 @@ static short rtl8192_get_channel_map(struct net_device *dev) if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256) && (priv->rf_chip != RF_6052)) { - RT_TRACE(COMP_ERR, "%s: unknown rf chip, can't set channel " - "map\n", __func__); + RT_TRACE(COMP_ERR, + "%s: unknown rf chip, can't set channel map\n", + __func__); return -1; } if (priv->ChannelPlan >= COUNTRY_CODE_MAX) { - printk(KERN_INFO "rtl819x_init:Error channel plan! Set to " - "default.\n"); + printk(KERN_INFO + "rtl819x_init:Error channel plan! Set to default.\n"); priv->ChannelPlan = COUNTRY_CODE_FCC; } RT_TRACE(COMP_INIT, "Channel plan is %d\n", priv->ChannelPlan); @@ -1406,8 +1406,9 @@ static enum reset_type rtl819x_TxCheckStuck(struct net_device *dev) tcb_desc->nStuckCount++; bCheckFwTxCnt = true; if (tcb_desc->nStuckCount > 1) - printk(KERN_INFO "%s: QueueID=%d tcb_desc->n" - "StuckCount=%d\n", __func__, QueueID, + printk(KERN_INFO + "%s: QueueID=%d tcb_desc->nStuckCount=%d\n", + __func__, QueueID, tcb_desc->nStuckCount); } } @@ -1415,8 +1416,8 @@ static enum reset_type rtl819x_TxCheckStuck(struct net_device *dev) if (bCheckFwTxCnt) { if (priv->ops->TxCheckStuckHandler(dev)) { - RT_TRACE(COMP_RESET, "TxCheckStuck(): Fw indicates no" - " Tx condition!\n"); + RT_TRACE(COMP_RESET, + "TxCheckStuck(): Fw indicates no Tx condition!\n"); return RESET_TYPE_SILENT; } } @@ -1507,8 +1508,9 @@ RESET_START: LeisurePSLeave(dev); if (priv->up) { - RT_TRACE(COMP_ERR, "%s():the driver is not up! " - "return\n", __func__); + RT_TRACE(COMP_ERR, + "%s():the driver is not up! return\n", + __func__); up(&priv->wx_sem); return; } @@ -1517,8 +1519,9 @@ RESET_START: RT_TRACE(COMP_RESET, "%s():======>start to down the driver\n", __func__); mdelay(1000); - RT_TRACE(COMP_RESET, "%s():111111111111111111111111======>start" - " to down the driver\n", __func__); + RT_TRACE(COMP_RESET, + "%s():111111111111111111111111======>start to down the driver\n", + __func__); if (!netif_queue_stopped(dev)) netif_stop_queue(dev); @@ -1546,22 +1549,24 @@ RESET_START: dm_backup_dynamic_mechanism_state(dev); up(&priv->wx_sem); - RT_TRACE(COMP_RESET, "%s():<==========down process is " - "finished\n", __func__); + RT_TRACE(COMP_RESET, + "%s():<==========down process is finished\n", + __func__); RT_TRACE(COMP_RESET, "%s():<===========up process start\n", __func__); reset_status = _rtl8192_up(dev, true); - RT_TRACE(COMP_RESET, "%s():<===========up process is " - "finished\n", __func__); + RT_TRACE(COMP_RESET, + "%s():<===========up process is finished\n", __func__); if (reset_status == -1) { if (reset_times < 3) { reset_times++; goto RESET_START; } else { - RT_TRACE(COMP_ERR, " ERR!!! %s(): Reset " - "Failed!!\n", __func__); + RT_TRACE(COMP_ERR, + " ERR!!! %s(): Reset Failed!!\n", + __func__); } } @@ -1670,8 +1675,8 @@ void rtl819x_watchdog_wqcallback(void *data) if ((ieee->PowerSaveControl.ReturnPoint == IPS_CALLBACK_NONE) && (!ieee->bNetPromiscuousMode)) { - RT_TRACE(COMP_PS, "====================>haha: " - "IPSEnter()\n"); + RT_TRACE(COMP_PS, + "====================>haha: IPSEnter()\n"); IPSEnter(dev); } } @@ -1736,8 +1741,9 @@ void rtl819x_watchdog_wqcallback(void *data) if (ieee->eRFPowerState == eRfOff) RT_TRACE(COMP_ERR, "========>%s()\n", __func__); - printk(KERN_INFO "===>%s(): AP is power off, chan:%d," - " connect another one\n", __func__, priv->chan); + printk(KERN_INFO + "===>%s(): AP is power off, chan:%d, connect another one\n", + __func__, priv->chan); ieee->state = RTLLIB_ASSOCIATING; @@ -2007,9 +2013,9 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) u32 fwinfo_size = 0; if (priv->bdisable_nic) { - RT_TRACE(COMP_ERR, "%s: ERR!! Nic is disabled! Can't tx packet" - " len=%d qidx=%d!!!\n", __func__, skb->len, - tcb_desc->queue_index); + RT_TRACE(COMP_ERR, + "%s: ERR!! Nic is disabled! Can't tx packet len=%d qidx=%d!!!\n", + __func__, skb->len, tcb_desc->queue_index); return skb->len; } @@ -2046,8 +2052,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) pdesc = &ring->desc[idx]; if ((pdesc->OWN == 1) && (tcb_desc->queue_index != BEACON_QUEUE)) { - RT_TRACE(COMP_ERR, "No more TX desc@%d, ring->idx = %d, idx = " - "%d, skblen = 0x%x queuelen=%d", + RT_TRACE(COMP_ERR, + "No more TX desc@%d, ring->idx = %d, idx = %d, skblen = 0x%x queuelen=%d", tcb_desc->queue_index, ring->idx, idx, skb->len, skb_queue_len(&ring->queue)); spin_unlock_irqrestore(&priv->irq_th_lock, flags); @@ -2940,8 +2946,8 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, dev->watchdog_timeo = HZ * 3; if (dev_alloc_name(dev, ifname) < 0) { - RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying " - "wlan%%d...\n"); + RT_TRACE(COMP_INIT, + "Oops: devname already taken! Trying wlan%%d...\n"); dev_alloc_name(dev, ifname); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 91794aea56eb..fc40af7a4ba6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -757,8 +757,8 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) for (i = 0; i < CCK_Table_length; i++) { if (TempCCk == (u32)CCKSwingTable_Ch1_Ch13[i][0]) { priv->CCK_index = (u8) i; - RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x" - " = 0x%x, CCK_index = 0x%x\n", + RT_TRACE(COMP_POWER_TRACKING, + "Initial reg0x%x = 0x%x, CCK_index = 0x%x\n", rCCK0_TxFilter1, TempCCk, priv->CCK_index); break; @@ -803,8 +803,8 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) priv->Record_CCK_20Mindex = tmpCCK20Mindex; priv->Record_CCK_40Mindex = tmpCCK40Mindex; - RT_TRACE(COMP_POWER_TRACKING, "Record_CCK_20Mindex / Record_CCK_40" - "Mindex = %d / %d.\n", + RT_TRACE(COMP_POWER_TRACKING, + "Record_CCK_20Mindex / Record_CCK_40Mindex = %d / %d.\n", priv->Record_CCK_20Mindex, priv->Record_CCK_40Mindex); if (priv->rtllib->current_network.channel == 14 && @@ -2131,8 +2131,8 @@ static void dm_check_edca_turbo(struct net_device *dev) static int wb_tmp; if (wb_tmp == 0) { - printk(KERN_INFO "%s():iot peer is %s, bssid:" - " %pM\n", __func__, + printk(KERN_INFO + "%s():iot peer is %s, bssid: %pM\n", __func__, peername[pHTInfo->IOTPeer], priv->rtllib->current_network.bssid); wb_tmp = 1; @@ -2638,9 +2638,10 @@ void dm_fsync_timer_callback(unsigned long data) } priv->rate_record = rate_count; priv->rateCountDiffRecord = rate_count_diff; - RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rate" - "Countdiff %d bSwitchFsync %d\n", priv->rate_record, - rate_count, rate_count_diff, priv->bswitch_fsync); + RT_TRACE(COMP_HALDM, + "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", + priv->rate_record, rate_count, rate_count_diff, + priv->bswitch_fsync); if (priv->undecorated_smoothed_pwdb > priv->rtllib->fsync_rssi_threshold && bSwitchFromCountDiff) { @@ -2685,9 +2686,10 @@ void dm_fsync_timer_callback(unsigned long data) write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); } RT_TRACE(COMP_HALDM, "ContinueDiffCount %d\n", priv->ContinueDiffCount); - RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d " - "bSwitchFsync %d\n", priv->rate_record, rate_count, - rate_count_diff, priv->bswitch_fsync); + RT_TRACE(COMP_HALDM, + "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", + priv->rate_record, rate_count, rate_count_diff, + priv->bswitch_fsync); } static void dm_StartHWFsync(struct net_device *dev) @@ -2778,12 +2780,14 @@ void dm_check_fsync(struct net_device *dev) static u8 reg_c38_State = RegC38_Default; static u32 reset_cnt; - RT_TRACE(COMP_HALDM, "RSSI %d TimeInterval %d MultipleTimeInterval " - "%d\n", priv->rtllib->fsync_rssi_threshold, + RT_TRACE(COMP_HALDM, + "RSSI %d TimeInterval %d MultipleTimeInterval %d\n", + priv->rtllib->fsync_rssi_threshold, priv->rtllib->fsync_time_interval, priv->rtllib->fsync_multiple_timeinterval); - RT_TRACE(COMP_HALDM, "RateBitmap 0x%x FirstDiffRateThreshold %d Second" - "DiffRateThreshold %d\n", priv->rtllib->fsync_rate_bitmap, + RT_TRACE(COMP_HALDM, + "RateBitmap 0x%x FirstDiffRateThreshold %d SecondDiffRateThreshold %d\n", + priv->rtllib->fsync_rate_bitmap, priv->rtllib->fsync_firstdiff_ratethreshold, priv->rtllib->fsync_seconddiff_ratethreshold); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c index 2ad92eee50c2..bbbbcf73564b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c @@ -65,13 +65,15 @@ bool rtl8192_pci_findadapter(struct pci_dev *pdev, struct net_device *dev) if (DeviceID == 0x8172) { switch (RevisionID) { case HAL_HW_PCI_REVISION_ID_8192PCIE: - printk(KERN_INFO "Adapter(8192 PCI-E) is found - " - "DeviceID=%x\n", DeviceID); + printk(KERN_INFO + "Adapter(8192 PCI-E) is found - DeviceID=%x\n", + DeviceID); priv->card_8192 = NIC_8192E; break; case HAL_HW_PCI_REVISION_ID_8192SE: - printk(KERN_INFO "Adapter(8192SE) is found - " - "DeviceID=%x\n", DeviceID); + printk(KERN_INFO + "Adapter(8192SE) is found - DeviceID=%x\n", + DeviceID); priv->card_8192 = NIC_8192SE; break; default: @@ -83,9 +85,11 @@ bool rtl8192_pci_findadapter(struct pci_dev *pdev, struct net_device *dev) } if (priv->ops->nic_type != priv->card_8192) { - printk(KERN_INFO "Detect info(%x) and hardware info(%x) not match!\n", - priv->ops->nic_type, priv->card_8192); - printk(KERN_INFO "Please select proper driver before install!!!!\n"); + printk(KERN_INFO + "Detect info(%x) and hardware info(%x) not match!\n", + priv->ops->nic_type, priv->card_8192); + printk(KERN_INFO + "Please select proper driver before install!!!!\n"); return false; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index 0b4f76481bf4..bffe9c4b81b2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -35,8 +35,8 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) priv->polling_timer_on = 0; if (!netif_running(dev)) { - printk(KERN_INFO "RTL819XE:UI is open out of suspend " - "function\n"); + printk(KERN_INFO + "RTL819XE:UI is open out of suspend function\n"); goto out_pci_suspend; } @@ -59,8 +59,8 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) out_pci_suspend: printk("r8192E support WOL call??????????????????????\n"); if (priv->rtllib->bSupportRemoteWakeUp) - RT_TRACE(COMP_POWER, "r8192E support WOL call!!!!!!!" - "!!!!!!!!!!!.\n"); + RT_TRACE(COMP_POWER, + "r8192E support WOL call!!!!!!!!!!!!!!!!!!.\n"); pci_save_state(pdev); pci_disable_device(pdev); pci_enable_wake(pdev, pci_choose_state(pdev, state), @@ -101,8 +101,8 @@ int rtl8192E_resume(struct pci_dev *pdev) check_rfctrl_gpio_timer((unsigned long)dev); if (!netif_running(dev)) { - printk(KERN_INFO "RTL819XE:UI is open out of resume " - "function\n"); + printk(KERN_INFO + "RTL819XE:UI is open out of resume function\n"); goto out; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index cbd2405df91b..b5abea5346eb 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -37,8 +37,8 @@ static void rtl8192_hw_sleep_down(struct net_device *dev) spin_lock_irqsave(&priv->rf_ps_lock, flags); if (priv->RFChangeInProgress) { spin_unlock_irqrestore(&priv->rf_ps_lock, flags); - RT_TRACE(COMP_DBG, "rtl8192_hw_sleep_down(): RF Change in " - "progress!\n"); + RT_TRACE(COMP_DBG, + "rtl8192_hw_sleep_down(): RF Change in progress!\n"); return; } spin_unlock_irqrestore(&priv->rf_ps_lock, flags); @@ -64,8 +64,8 @@ void rtl8192_hw_wakeup(struct net_device *dev) spin_lock_irqsave(&priv->rf_ps_lock, flags); if (priv->RFChangeInProgress) { spin_unlock_irqrestore(&priv->rf_ps_lock, flags); - RT_TRACE(COMP_DBG, "rtl8192_hw_wakeup(): RF Change in " - "progress!\n"); + RT_TRACE(COMP_DBG, + "rtl8192_hw_wakeup(): RF Change in progress!\n"); queue_delayed_work_rsl(priv->rtllib->wq, &priv->rtllib->hw_wakeup_wq, msecs_to_jiffies(10)); @@ -240,8 +240,8 @@ static bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, priv->rtllib->sta_sleep = LPS_IS_WAKE; spin_lock_irqsave(&(priv->rtllib->mgmt_tx_lock), flags); - RT_TRACE(COMP_DBG, "LPS leave: notify AP we are awaked" - " ++++++++++ SendNullFunctionData\n"); + RT_TRACE(COMP_DBG, + "LPS leave: notify AP we are awaked ++++++++++ SendNullFunctionData\n"); rtllib_sta_ps_send_null_frame(priv->rtllib, 0); spin_unlock_irqrestore(&(priv->rtllib->mgmt_tx_lock), flags); } @@ -256,8 +256,8 @@ void LeisurePSEnter(struct net_device *dev) &(priv->rtllib->PowerSaveControl); RT_TRACE(COMP_PS, "LeisurePSEnter()...\n"); - RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdle" - "Count is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n", + RT_TRACE(COMP_PS, + "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdleCount is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n", pPSC->bLeisurePs, priv->rtllib->ps, pPSC->LpsIdleCount, RT_CHECK_FOR_HANG_PERIOD); @@ -272,8 +272,8 @@ void LeisurePSEnter(struct net_device *dev) if (priv->rtllib->ps == RTLLIB_PS_DISABLED) { - RT_TRACE(COMP_LPS, "LeisurePSEnter(): Enter " - "802.11 power save mode...\n"); + RT_TRACE(COMP_LPS, + "LeisurePSEnter(): Enter 802.11 power save mode...\n"); if (!pPSC->bFwCtrlLPS) { if (priv->rtllib->SetFwCmdHandler) @@ -302,8 +302,8 @@ void LeisurePSLeave(struct net_device *dev) if (pPSC->bLeisurePs) { if (priv->rtllib->ps != RTLLIB_PS_DISABLED) { - RT_TRACE(COMP_LPS, "LeisurePSLeave(): Busy Traffic , " - "Leave 802.11 power save..\n"); + RT_TRACE(COMP_LPS, + "LeisurePSLeave(): Busy Traffic , Leave 802.11 power save..\n"); MgntActSet_802_11_PowerSaveMode(dev, RTLLIB_PS_DISABLED); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 9e65c326dbdc..757c30994d77 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -116,8 +116,9 @@ static int r8192_wx_set_power(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); if (priv->bHwRadioOff) { - RT_TRACE(COMP_ERR, "%s():Hw is Radio Off, we can't set " - "Power,return\n", __func__); + RT_TRACE(COMP_ERR, + "%s():Hw is Radio Off, we can't set Power,return\n", + __func__); return 0; } down(&priv->wx_sem); @@ -256,8 +257,9 @@ static int r8192se_wx_set_radio(struct net_device *dev, printk(KERN_INFO "%s(): set radio ! extra is %d\n", __func__, *extra); if ((*extra != 0) && (*extra != 1)) { - RT_TRACE(COMP_ERR, "%s(): set radio an err value,must 0(radio " - "off) or 1(radio on)\n", __func__); + RT_TRACE(COMP_ERR, + "%s(): set radio an err value,must 0(radio off) or 1(radio on)\n", + __func__); up(&priv->wx_sem); return -1; } @@ -293,8 +295,9 @@ static int r8192se_wx_set_force_lps(struct net_device *dev, down(&priv->wx_sem); - printk(KERN_INFO "%s(): force LPS ! extra is %d (1 is open 0 is " - "close)\n", __func__, *extra); + printk(KERN_INFO + "%s(): force LPS ! extra is %d (1 is open 0 is close)\n", + __func__, *extra); priv->force_lps = *extra; up(&priv->wx_sem); return 0; @@ -344,8 +347,9 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, up(&priv->wx_sem); return -1; } else { - printk(KERN_INFO "=========>%s(): " - "IPSLeave\n", __func__); + printk(KERN_INFO + "=========>%s(): IPSLeave\n", + __func__); down(&priv->rtllib->ips_sem); IPSLeave(dev); up(&priv->rtllib->ips_sem); @@ -500,13 +504,15 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, if (rtState == eRfOff) { if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) { - RT_TRACE(COMP_ERR, "%s(): RF is " - "OFF.\n", __func__); + RT_TRACE(COMP_ERR, + "%s(): RF is OFF.\n", + __func__); up(&priv->wx_sem); return -1; } else { - RT_TRACE(COMP_PS, "=========>%s(): " - "IPSLeave\n", __func__); + RT_TRACE(COMP_PS, + "=========>%s(): IPSLeave\n", + __func__); down(&priv->rtllib->ips_sem); IPSLeave(dev); up(&priv->rtllib->ips_sem); @@ -573,8 +579,9 @@ static int r8192_wx_set_essid(struct net_device *dev, int ret; if (priv->bHwRadioOff) { - printk(KERN_INFO "=========>%s():hw radio off,or Rf state is " - "eRfOff, return\n", __func__); + printk(KERN_INFO + "=========>%s():hw radio off,or Rf state is eRfOff, return\n", + __func__); return 0; } down(&priv->wx_sem); diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 03e2a827a2cd..26258ea8de4a 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -83,9 +83,9 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, u8 *tag = NULL; u16 len = ieee->tx_headroom + 9; - RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, "========>%s(), frame(%d)" - " sentd to: %pM, ieee->dev:%p\n", __func__, - type, Dst, ieee->dev); + RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, + "========>%s(), frame(%d) sentd to: %pM, ieee->dev:%p\n", + __func__, type, Dst, ieee->dev); if (pBA == NULL) { RTLLIB_DEBUG(RTLLIB_DL_ERR, "pBA is NULL\n"); return NULL; @@ -148,9 +148,8 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, if (net_ratelimit()) RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, - "========>%s(), Reason" - "Code(%d) sentd to: %pM\n", __func__, - ReasonCode, dst); + "========>%s(), ReasonCode(%d) sentd to: %pM\n", + __func__, ReasonCode, dst); memset(&DelbaParamSet, 0, 2); @@ -203,8 +202,8 @@ static void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst, RT_TRACE(COMP_DBG, "====>to send ADDBAREQ!!!!!\n"); softmac_mgmt_xmit(skb, ieee); } else { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function" - " %s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "alloc skb error in function %s()\n", __func__); } } @@ -217,8 +216,8 @@ static void rtllib_send_ADDBARsp(struct rtllib_device *ieee, u8 *dst, if (skb) softmac_mgmt_xmit(skb, ieee); else - RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function" - " %s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "alloc skb error in function %s()\n", __func__); } static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst, @@ -231,8 +230,8 @@ static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst, if (skb) softmac_mgmt_xmit(skb, ieee); else - RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function" - " %s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "alloc skb error in function %s()\n", __func__); } int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) @@ -247,8 +246,9 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) struct rx_ts_record *pTS = NULL; if (skb->len < sizeof(struct rtllib_hdr_3addr) + 9) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in BAREQ(%d / " - "%d)\n", (int)skb->len, + RTLLIB_DEBUG(RTLLIB_DL_ERR, + " Invalid skb len in BAREQ(%d / %d)\n", + (int)skb->len, (int)(sizeof(struct rtllib_hdr_3addr) + 9)); return -1; } @@ -269,8 +269,8 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) (ieee->pHTInfo->bCurrentHTSupport == false) || (ieee->pHTInfo->IOTAction & HT_IOT_ACT_REJECT_ADDBA_REQ)) { rc = ADDBA_STATUS_REFUSED; - RTLLIB_DEBUG(RTLLIB_DL_ERR, "Failed to reply on ADDBA_REQ as " - "some capability is not ready(%d, %d)\n", + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); goto OnADDBAReq_Fail; @@ -285,8 +285,8 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) { rc = ADDBA_STATUS_INVALID_PARAM; - RTLLIB_DEBUG(RTLLIB_DL_ERR, "BA Policy is not correct in " - "%s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "BA Policy is not correct in %s()\n", __func__); goto OnADDBAReq_Fail; } @@ -333,8 +333,9 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) u16 ReasonCode; if (skb->len < sizeof(struct rtllib_hdr_3addr) + 9) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in BARSP(%d / " - "%d)\n", (int)skb->len, + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "Invalid skb len in BARSP(%d / %d)\n", + (int)skb->len, (int)(sizeof(struct rtllib_hdr_3addr) + 9)); return -1; } @@ -351,8 +352,8 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) if (ieee->current_network.qos_data.active == 0 || ieee->pHTInfo->bCurrentHTSupport == false || ieee->pHTInfo->bCurrentAMPDUEnable == false) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "reject to ADDBA_RSP as some capab" - "ility is not ready(%d, %d, %d)\n", + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bCurrentAMPDUEnable); @@ -374,18 +375,19 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) if (pAdmittedBA->bValid == true) { - RTLLIB_DEBUG(RTLLIB_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp." - " Drop because already admit it!\n"); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it!\n"); return -1; } else if ((pPendingBA->bValid == false) || (*pDialogToken != pPendingBA->DialogToken)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "OnADDBARsp(): Recv ADDBA Rsp. " - "BA invalid, DELBA!\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA!\n"); ReasonCode = DELBA_REASON_UNKNOWN_BA; goto OnADDBARsp_Reject; } else { - RTLLIB_DEBUG(RTLLIB_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. BA " - "is admitted! Status code:%X\n", *pStatusCode); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "OnADDBARsp(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n", + *pStatusCode); DeActivateBAEntry(ieee, pPendingBA); } @@ -432,16 +434,17 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) u8 *dst = NULL; if (skb->len < sizeof(struct rtllib_hdr_3addr) + 6) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in DELBA(%d /" - " %d)\n", (int)skb->len, + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "Invalid skb len in DELBA(%d / %d)\n", + (int)skb->len, (int)(sizeof(struct rtllib_hdr_3addr) + 6)); return -1; } if (ieee->current_network.qos_data.active == 0 || ieee->pHTInfo->bCurrentHTSupport == false) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "received DELBA while QOS or HT " - "is not supported(%d, %d)\n", + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "received DELBA while QOS or HT is not supported(%d, %d)\n", ieee->current_network. qos_data.active, ieee->pHTInfo->bCurrentHTSupport); return -1; @@ -459,8 +462,9 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) if (!GetTs(ieee, (struct ts_common_info **)&pRxTs, dst, (u8)pDelBaParamSet->field.TID, RX_DIR, false)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS for RXTS in " - "%s().dst: %pM TID:%d\n", __func__, dst, + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "can't get TS for RXTS in %s().dst: %pM TID:%d\n", + __func__, dst, (u8)pDelBaParamSet->field.TID); return -1; } @@ -471,8 +475,9 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) if (!GetTs(ieee, (struct ts_common_info **)&pTxTs, dst, (u8)pDelBaParamSet->field.TID, TX_DIR, false)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS for TXTS in " - "%s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "can't get TS for TXTS in %s()\n", + __func__); return -1; } diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 1af4191feb4f..9820dd2df5f3 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -294,8 +294,8 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap, struct ht_capab_ele *pCapELE = NULL; if ((posHTCap == NULL) || (pHT == NULL)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTCap or pHTInfo can't be " - "null in HTConstructCapabilityElement()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n"); return; } memset(posHTCap, 0, *len); @@ -331,9 +331,9 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap, pCapELE->LSigTxopProtect = 0; - RTLLIB_DEBUG(RTLLIB_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d " - "DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, - pCapELE->DssCCk); + RTLLIB_DEBUG(RTLLIB_DL_HT, + "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", + pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk); if (IsEncrypt) { pCapELE->MPDUDensity = 7; @@ -376,8 +376,8 @@ void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo, struct ht_info_ele *pHTInfoEle = (struct ht_info_ele *)posHTInfo; if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTInfo or pHTInfoEle can't be " - "null in HTConstructInfoElement()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n"); return; } @@ -416,8 +416,8 @@ void HTConstructRT2RTAggElement(struct rtllib_device *ieee, u8 *posRT2RTAgg, u8 *len) { if (posRT2RTAgg == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "posRT2RTAgg can't be null in " - "HTConstructRT2RTAggElement()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n"); return; } memset(posRT2RTAgg, 0, *len); @@ -440,8 +440,8 @@ static u8 HT_PickMCSRate(struct rtllib_device *ieee, u8 *pOperateMCS) u8 i; if (pOperateMCS == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "pOperateMCS can't be null" - " in HT_PickMCSRate()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "pOperateMCS can't be null in HT_PickMCSRate()\n"); return false; } @@ -475,8 +475,8 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, u8 availableMcsRate[16]; if (pMCSRateSet == NULL || pMCSFilter == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "pMCSRateSet or pMCSFilter can't " - "be null in HTGetHighestMCSRate()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n"); return false; } for (i = 0; i < 16; i++) @@ -541,8 +541,8 @@ void HTOnAssocRsp(struct rtllib_device *ieee) static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; if (pHTInfo->bCurrentHTSupport == false) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "<=== HTOnAssocRsp(): " - "HT_DISABLE\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "<=== HTOnAssocRsp(): HT_DISABLE\n"); return; } RTLLIB_DEBUG(RTLLIB_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n"); @@ -843,8 +843,8 @@ u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame) { if (ieee->pHTInfo->bCurrentHTSupport) { if ((IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) { - RTLLIB_DEBUG(RTLLIB_DL_HT, "HT CONTROL FILED " - "EXIST!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_HT, + "HT CONTROL FILED EXIST!!\n"); return true; } } diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index c51f7e0650ee..6a96129926b5 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -58,9 +58,9 @@ static void RxPktPendingTimeout(unsigned long data) pRxTs->RxIndicateSeq = (pRxTs->RxIndicateSeq + 1) % 4096; - RTLLIB_DEBUG(RTLLIB_DL_REORDER, "%s(): Indicate" - " SeqNum: %d\n", __func__, - pReorderEntry->SeqNum); + RTLLIB_DEBUG(RTLLIB_DL_REORDER, + "%s(): Indicate SeqNum: %d\n", + __func__, pReorderEntry->SeqNum); ieee->stats_IndicateArray[index] = pReorderEntry->prxb; index++; @@ -78,8 +78,8 @@ static void RxPktPendingTimeout(unsigned long data) pRxTs->RxTimeoutIndicateSeq = 0xffff; if (index > REORDER_WIN_SIZE) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "RxReorderIndicatePacket():" - " Rx Reorder struct buffer full!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "RxReorderIndicatePacket(): Rx Reorder struct buffer full!!\n"); spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); return; @@ -104,8 +104,8 @@ static void TsAddBaProcess(unsigned long data) TxTsRecord[num]); TsInitAddBA(ieee, pTxTs, BA_POLICY_IMMEDIATE, false); - RTLLIB_DEBUG(RTLLIB_DL_BA, "TsAddBaProcess(): ADDBA Req is " - "started!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "TsAddBaProcess(): ADDBA Req is started!!\n"); } static void ResetTsCommonInfo(struct ts_common_info *pTsCommonInfo) @@ -313,16 +313,17 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 UP = 0; if (is_multicast_ether_addr(Addr)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "ERR! get TS for Broadcast or " - "Multicast\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "ERR! get TS for Broadcast or Multicast\n"); return false; } if (ieee->current_network.qos_data.supported == 0) { UP = 0; } else { if (!IsACValid(TID)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "ERR! in %s(), TID(%d) is " - "not valid\n", __func__, TID); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "ERR! in %s(), TID(%d) is not valid\n", + __func__, TID); return false; } @@ -351,8 +352,8 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, return true; } else { if (!bAddNewTs) { - RTLLIB_DEBUG(RTLLIB_DL_TS, "add new TS failed" - "(tid:%d)\n", UP); + RTLLIB_DEBUG(RTLLIB_DL_TS, + "add new TS failed(tid:%d)\n", UP); return false; } else { union tspec_body TSpec; @@ -390,10 +391,9 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, ResetRxTsEntry(tmp); } - RTLLIB_DEBUG(RTLLIB_DL_TS, "to init current TS" - ", UP:%d, Dir:%d, addr: %pM" - " ppTs=%p\n", UP, Dir, - Addr, *ppTS); + RTLLIB_DEBUG(RTLLIB_DL_TS, + "to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n", + UP, Dir, Addr, *ppTS); pTSInfo->field.ucTrafficType = 0; pTSInfo->field.ucTSID = UP; pTSInfo->field.ucDirection = Dir; @@ -410,10 +410,9 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, return true; } else { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "ERR!!in function " - "%s() There is not enough dir=%d" - "(0=up down=1) TS record to be " - "used!!", __func__, Dir); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "ERR!!in function %s() There is not enough dir=%d(0=up down=1) TS record to be used!!", + __func__, Dir); return false; } } @@ -438,8 +437,8 @@ static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs pRxReorderEntry = (struct rx_reorder_entry *) list_entry(pRxTS->RxPendingPktList.prev, struct rx_reorder_entry, List); - RTLLIB_DEBUG(RTLLIB_DL_REORDER, "%s(): Delete SeqNum " - "%d!\n", __func__, + RTLLIB_DEBUG(RTLLIB_DL_REORDER, + "%s(): Delete SeqNum %d!\n", __func__, pRxReorderEntry->SeqNum); list_del_init(&pRxReorderEntry->List); { @@ -539,13 +538,13 @@ void TsStartAddBaProcess(struct rtllib_device *ieee, struct tx_ts_record *pTxTS) pTxTS->bAddBaReqInProgress = true; if (pTxTS->bAddBaReqDelayed) { - RTLLIB_DEBUG(RTLLIB_DL_BA, "TsStartAddBaProcess(): " - "Delayed Start ADDBA after 60 sec!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies + msecs_to_jiffies(TS_ADDBA_DELAY)); } else { - RTLLIB_DEBUG(RTLLIB_DL_BA, "TsStartAddBaProcess(): " - "Immediately Start ADDBA now!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "TsStartAddBaProcess(): Immediately Start ADDBA now!!\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies+10); } } else diff --git a/drivers/staging/rtl8192e/rtllib_crypt.c b/drivers/staging/rtl8192e/rtllib_crypt.c index 60c0cedefb86..807ba1b92447 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.c +++ b/drivers/staging/rtl8192e/rtllib_crypt.c @@ -62,8 +62,9 @@ void rtllib_crypt_deinit_handler(unsigned long data) spin_lock_irqsave(info->lock, flags); rtllib_crypt_deinit_entries(info, 0); if (!list_empty(&info->crypt_deinit_list)) { - printk(KERN_DEBUG "%s: entries remaining in delayed crypt " - "deletion list\n", info->name); + printk(KERN_DEBUG + "%s: entries remaining in delayed crypt deletion list\n", + info->name); info->crypt_deinit_timer.expires = jiffies + HZ; add_timer(&info->crypt_deinit_timer); } @@ -145,8 +146,8 @@ int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops) spin_unlock_irqrestore(&hcrypt->lock, flags); if (del_alg) { - printk(KERN_DEBUG "rtllib_crypt: unregistered algorithm " - "'%s'\n", ops->name); + printk(KERN_DEBUG "rtllib_crypt: unregistered algorithm '%s'\n", + ops->name); kfree(del_alg); } @@ -237,8 +238,9 @@ void __exit rtllib_crypto_deinit(void) struct rtllib_crypto_alg *alg = (struct rtllib_crypto_alg *) ptr; list_del(ptr); - printk(KERN_DEBUG "rtllib_crypt: unregistered algorithm " - "'%s' (deinit)\n", alg->ops->name); + printk(KERN_DEBUG + "rtllib_crypt: unregistered algorithm '%s' (deinit)\n", + alg->ops->name); kfree(alg); } diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index 01f85db98e0d..c0b8bb289e7d 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -69,8 +69,7 @@ static void *rtllib_ccmp_init(int key_idx) priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tfm)) { - pr_debug("rtllib_crypt_ccmp: could not allocate " - "crypto API aes\n"); + pr_debug("rtllib_crypt_ccmp: could not allocate crypto API aes\n"); priv->tfm = NULL; goto fail; } @@ -278,23 +277,22 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) keyidx = pos[3]; if (!(keyidx & (1 << 5))) { if (net_ratelimit()) { - pr_debug("CCMP: received packet without ExtIV" - " flag from %pM\n", hdr->addr2); + pr_debug("CCMP: received packet without ExtIV flag from %pM\n", + hdr->addr2); } key->dot11RSNAStatsCCMPFormatErrors++; return -2; } keyidx >>= 6; if (key->key_idx != keyidx) { - pr_debug("CCMP: RX tkey->key_idx=%d frame " - "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv); + pr_debug("CCMP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", + key->key_idx, keyidx, priv); return -6; } if (!key->key_set) { if (net_ratelimit()) { - pr_debug("CCMP: received packet from %pM" - " with keyid=%d that does not have a configured" - " key\n", hdr->addr2, keyidx); + pr_debug("CCMP: received packet from %pM with keyid=%d that does not have a configured key\n", + hdr->addr2, keyidx); } return -3; } @@ -341,8 +339,8 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { if (net_ratelimit()) { - pr_debug("CCMP: decrypt failed: STA=" - " %pM\n", hdr->addr2); + pr_debug("CCMP: decrypt failed: STA= %pM\n", + hdr->addr2); } key->dot11RSNAStatsCCMPDecryptErrors++; return -5; @@ -419,9 +417,7 @@ static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv) struct rtllib_ccmp_data *ccmp = priv; seq_printf(m, - "key[%d] alg=CCMP key_set=%d " - "tx_pn=%pM rx_pn=%pM " - "format_errors=%d replays=%d decrypt_errors=%d\n", + "key[%d] alg=CCMP key_set=%d tx_pn=%pM rx_pn=%pM format_errors=%d replays=%d decrypt_errors=%d\n", ccmp->key_idx, ccmp->key_set, ccmp->tx_pn, ccmp->rx_pn, ccmp->dot11RSNAStatsCCMPFormatErrors, diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index 78db2b6826f7..c93f8dc6243a 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -66,8 +66,8 @@ static void *rtllib_tkip_init(int key_idx) priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm_arc4)) { - printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate " - "crypto API arc4\n"); + printk(KERN_DEBUG + "rtllib_crypt_tkip: could not allocate crypto API arc4\n"); priv->tx_tfm_arc4 = NULL; goto fail; } @@ -75,8 +75,8 @@ static void *rtllib_tkip_init(int key_idx) priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm_michael)) { - printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate " - "crypto API michael_mic\n"); + printk(KERN_DEBUG + "rtllib_crypt_tkip: could not allocate crypto API michael_mic\n"); priv->tx_tfm_michael = NULL; goto fail; } @@ -84,8 +84,8 @@ static void *rtllib_tkip_init(int key_idx) priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm_arc4)) { - printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate " - "crypto API arc4\n"); + printk(KERN_DEBUG + "rtllib_crypt_tkip: could not allocate crypto API arc4\n"); priv->rx_tfm_arc4 = NULL; goto fail; } @@ -93,8 +93,8 @@ static void *rtllib_tkip_init(int key_idx) priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm_michael)) { - printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate " - "crypto API michael_mic\n"); + printk(KERN_DEBUG + "rtllib_crypt_tkip: could not allocate crypto API michael_mic\n"); priv->rx_tfm_michael = NULL; goto fail; } @@ -399,22 +399,24 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) keyidx = pos[3]; if (!(keyidx & (1 << 5))) { if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: received packet without ExtIV" - " flag from %pM\n", hdr->addr2); + printk(KERN_DEBUG + "TKIP: received packet without ExtIV flag from %pM\n", + hdr->addr2); } return -2; } keyidx >>= 6; if (tkey->key_idx != keyidx) { - printk(KERN_DEBUG "TKIP: RX tkey->key_idx=%d frame " - "keyidx=%d priv=%p\n", tkey->key_idx, keyidx, priv); + printk(KERN_DEBUG + "TKIP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", + tkey->key_idx, keyidx, priv); return -6; } if (!tkey->key_set) { if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: received packet from %pM" - " with keyid=%d that does not have a configured" - " key\n", hdr->addr2, keyidx); + printk(KERN_DEBUG + "TKIP: received packet from %pM with keyid=%d that does not have a configured key\n", + hdr->addr2, keyidx); } return -3; } @@ -427,10 +429,10 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) && tkey->initialized) { if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: replay detected: STA=" - " %pM previous TSC %08x%04x received " - "TSC %08x%04x\n", hdr->addr2, - tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); + printk(KERN_DEBUG + "TKIP: replay detected: STA= %pM previous TSC %08x%04x received TSC %08x%04x\n", + hdr->addr2, tkey->rx_iv32, tkey->rx_iv16, + iv32, iv16); } tkey->dot11RSNAStatsTKIPReplays++; return -4; @@ -451,8 +453,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { if (net_ratelimit()) { - printk(KERN_DEBUG ": TKIP: failed to decrypt " - "received packet from %pM\n", + printk(KERN_DEBUG + ": TKIP: failed to decrypt received packet from %pM\n", hdr->addr2); } return -7; @@ -472,8 +474,9 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) tkey->rx_phase1_done = 0; } if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: ICV error detected: STA=" - " %pM\n", hdr->addr2); + printk(KERN_DEBUG + "TKIP: ICV error detected: STA= %pM\n", + hdr->addr2); } tkey->dot11RSNAStatsTKIPICVErrors++; return -5; @@ -557,8 +560,8 @@ static int rtllib_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) hdr = (struct rtllib_hdr_4addr *) skb->data; if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { - printk(KERN_DEBUG "Invalid packet for Michael MIC add " - "(tailroom=%d hdr_len=%d skb->len=%d)\n", + printk(KERN_DEBUG + "Invalid packet for Michael MIC add (tailroom=%d hdr_len=%d skb->len=%d)\n", skb_tailroom(skb), hdr_len, skb->len); return -1; } @@ -621,8 +624,8 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, struct rtllib_hdr_4addr *hdr; hdr = (struct rtllib_hdr_4addr *) skb->data; - printk(KERN_DEBUG "%s: Michael MIC verification failed for " - "MSDU from %pM keyidx=%d\n", + printk(KERN_DEBUG + "%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n", skb->dev ? skb->dev->name : "N/A", hdr->addr2, keyidx); printk(KERN_DEBUG "%d\n", @@ -717,10 +720,7 @@ static void rtllib_tkip_print_stats(struct seq_file *m, void *priv) struct rtllib_tkip_data *tkip = priv; seq_printf(m, - "key[%d] alg=TKIP key_set=%d " - "tx_pn=%02x%02x%02x%02x%02x%02x " - "rx_pn=%02x%02x%02x%02x%02x%02x " - "replays=%d icv_errors=%d local_mic_failures=%d\n", + "key[%d] alg=TKIP key_set=%d tx_pn=%02x%02x%02x%02x%02x%02x rx_pn=%02x%02x%02x%02x%02x%02x replays=%d icv_errors=%d local_mic_failures=%d\n", tkip->key_idx, tkip->key_set, (tkip->tx_iv32 >> 24) & 0xff, (tkip->tx_iv32 >> 16) & 0xff, diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c index 75e7b02a144a..1e16d97cae03 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c @@ -44,15 +44,13 @@ static void *prism2_wep_init(int keyidx) priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm)) { - pr_debug("rtllib_crypt_wep: could not allocate " - "crypto API arc4\n"); + pr_debug("rtllib_crypt_wep: could not allocate crypto API arc4\n"); priv->tx_tfm = NULL; goto fail; } priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm)) { - pr_debug("rtllib_crypt_wep: could not allocate " - "crypto API arc4\n"); + pr_debug("rtllib_crypt_wep: could not allocate crypto API arc4\n"); priv->rx_tfm = NULL; goto fail; } @@ -108,9 +106,9 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || skb->len < hdr_len){ - printk(KERN_ERR "Error!!! headroom=%d tailroom=%d skblen=%d" - " hdr_len=%d\n", skb_headroom(skb), skb_tailroom(skb), - skb->len, hdr_len); + printk(KERN_ERR + "Error!!! headroom=%d tailroom=%d skblen=%d hdr_len=%d\n", + skb_headroom(skb), skb_tailroom(skb), skb->len, hdr_len); return -1; } len = skb->len - hdr_len; diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 392bdf513ae2..8005eed8bd55 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -277,8 +277,9 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee) /* as for the completion function, it does not need * to check it any more. * */ - printk(KERN_INFO "%s():insert to waitqueue, queue_index" - ":%d!\n", __func__, tcb_desc->queue_index); + printk(KERN_INFO + "%s():insert to waitqueue, queue_index:%d!\n", + __func__, tcb_desc->queue_index); skb_queue_tail(&ieee->skb_waitQ[tcb_desc->queue_index], skb); } else { @@ -1418,8 +1419,9 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, if (ieee->assocreq_ies) memcpy(ieee->assocreq_ies, ies, ieee->assocreq_ies_len); else { - printk(KERN_INFO "%s()Warning: can't alloc memory for assocreq" - "_ies\n", __func__); + printk(KERN_INFO + "%s()Warning: can't alloc memory for assocreq_ies\n", + __func__); ieee->assocreq_ies_len = 0; } return skb; @@ -1503,8 +1505,7 @@ static void rtllib_auth_challenge(struct rtllib_device *ieee, u8 *challenge, int *(c++) = chlen; memcpy(c, challenge, chlen); - RTLLIB_DEBUG_MGMT("Sending authentication challenge " - "response\n"); + RTLLIB_DEBUG_MGMT("Sending authentication challenge response\n"); rtllib_encrypt_fragment(ieee, skb, sizeof(struct rtllib_hdr_3addr)); @@ -1564,8 +1565,8 @@ static void rtllib_associate_complete_wq(void *data) printk(KERN_INFO "Successfully associated, ht enabled\n"); HTOnAssocRsp(ieee); } else { - printk(KERN_INFO "Successfully associated, ht not " - "enabled(%d, %d)\n", + printk(KERN_INFO + "Successfully associated, ht not enabled(%d, %d)\n", ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bEnableHT); memset(ieee->dot11HTOperationalRateSet, 0, 16); @@ -1623,8 +1624,9 @@ static void rtllib_associate_procedure_wq(void *data) ieee->current_network.channel); HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); if (ieee->eRFPowerState == eRfOff) { - RT_TRACE(COMP_DBG, "=============>%s():Rf state is eRfOff," - " schedule ipsleave wq again,return\n", __func__); + RT_TRACE(COMP_DBG, + "=============>%s():Rf state is eRfOff, schedule ipsleave wq again,return\n", + __func__); if (ieee->rtllib_ips_leave_wq != NULL) ieee->rtllib_ips_leave_wq(ieee->dev); up(&ieee->wx_sem); @@ -1719,9 +1721,9 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, IW_ESSID_MAX_SIZE); ieee->current_network.ssid_len = tmp_ssid_len; } - printk(KERN_INFO"Linking with %s,channel:%d, qos:%d, " - "myHT:%d, networkHT:%d, mode:%x cur_net.flags" - ":0x%x\n", ieee->current_network.ssid, + printk(KERN_INFO + "Linking with %s,channel:%d, qos:%d, myHT:%d, networkHT:%d, mode:%x cur_net.flags:0x%x\n", + ieee->current_network.ssid, ieee->current_network.channel, ieee->current_network.qos_data.supported, ieee->pHTInfo->bEnableHT, @@ -2083,10 +2085,9 @@ static inline void rtllib_sta_ps(struct rtllib_device *ieee) if ((ieee->ps == RTLLIB_PS_DISABLED || ieee->iw_mode != IW_MODE_INFRA || ieee->state != RTLLIB_LINKED)) { - RT_TRACE(COMP_DBG, "=====>%s(): no need to ps,wake up!! " - "ieee->ps is %d, ieee->iw_mode is %d, ieee->state" - " is %d\n", __func__, ieee->ps, ieee->iw_mode, - ieee->state); + RT_TRACE(COMP_DBG, + "=====>%s(): no need to ps,wake up!! ieee->ps is %d, ieee->iw_mode is %d, ieee->state is %d\n", + __func__, ieee->ps, ieee->iw_mode, ieee->state); spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); rtllib_sta_wakeup(ieee, 1); @@ -2201,8 +2202,8 @@ static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *sk u8 category = 0; if (act == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "error to get payload of " - "action frame\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "error to get payload of action frame\n"); return; } @@ -2287,8 +2288,9 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, memcpy(ieee->assocresp_ies, ies, ieee->assocresp_ies_len); else { - printk(KERN_INFO "%s()Warning: can't alloc " - "memory for assocresp_ies\n", __func__); + printk(KERN_INFO + "%s()Warning: can't alloc memory for assocresp_ies\n", + __func__); ieee->assocresp_ies_len = 0; } rtllib_associate_complete(ieee); @@ -2353,8 +2355,8 @@ inline int rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode) { - printk(KERN_INFO "======>enter " - "half N mode\n"); + printk(KERN_INFO + "======>enter half N mode\n"); ieee->bHalfWirelessN24GMode = true; } else @@ -2368,11 +2370,12 @@ inline int rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, } } else { ieee->softmac_stats.rx_auth_rs_err++; - RTLLIB_DEBUG_MGMT("Authentication respose" - " status code 0x%x", errcode); + RTLLIB_DEBUG_MGMT("Authentication respose status code 0x%x", + errcode); - printk(KERN_INFO "Authentication respose " - "status code 0x%x", errcode); + printk(KERN_INFO + "Authentication respose status code 0x%x", + errcode); rtllib_associate_abort(ieee); } @@ -2396,8 +2399,8 @@ inline int rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb) if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && ieee->state == RTLLIB_LINKED && (ieee->iw_mode == IW_MODE_INFRA)) { - printk(KERN_INFO "==========>received disassoc/deauth(%x) " - "frame, reason code:%x\n", + printk(KERN_INFO + "==========>received disassoc/deauth(%x) frame, reason code:%x\n", WLAN_FC_GET_STYPE(header->frame_ctl), ((struct rtllib_disassoc *)skb->data)->reason); ieee->state = RTLLIB_ASSOCIATING; diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 283ba8b20128..ea8488f5b7cb 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -575,8 +575,9 @@ int rtllib_wx_set_power(struct rtllib_device *ieee, if ((!ieee->sta_wake_up) || (!ieee->enter_sleep_state) || (!ieee->ps_is_queue_empty)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "%s(): PS mode is tried to be use " - "but driver missed a callback\n\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "%s(): PS mode is tried to be use but driver missed a callback\n\n", + __func__); return -1; } diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 4f68ffe41475..928cd4cf14bc 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -604,8 +604,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) if (ieee->iw_mode == IW_MODE_MONITOR) { txb = rtllib_alloc_txb(1, skb->len, GFP_ATOMIC); if (unlikely(!txb)) { - printk(KERN_WARNING "%s: Could not allocate " - "TXB\n", + printk(KERN_WARNING + "%s: Could not allocate TXB\n", ieee->dev->name); goto failed; } @@ -636,8 +636,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } } } else if (ETH_P_ARP == ether_type) { - printk(KERN_INFO "=================>DHCP " - "Protocol start tx ARP pkt!!\n"); + printk(KERN_INFO + "=================>DHCP Protocol start tx ARP pkt!!\n"); bdhcp = true; ieee->LPSDelayCnt = ieee->current_network.tim.tim_count; diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 2e665eddc100..5b7247effa62 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -282,8 +282,7 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee, ev = rtl819x_translate_scan(ieee, ev, stop, network, info); else - RTLLIB_DEBUG_SCAN("Not showing network '%s (" - " %pM)' due to age (%lums).\n", + RTLLIB_DEBUG_SCAN("Not showing network '%s ( %pM)' due to age (%lums).\n", escape_essid(network->ssid, network->ssid_len), network->bssid, @@ -437,8 +436,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, /* No key data - just set the default TX key index */ if (key_provided) { - RTLLIB_DEBUG_WX( - "Setting key %d to default Tx key.\n", key); + RTLLIB_DEBUG_WX("Setting key %d to default Tx key.\n", + key); ieee->crypt_info.tx_keyidx = key; sec.active_key = key; sec.flags |= SEC_ACTIVE_KEY; -- cgit v1.2.3 From dc986e3ed39830df78a24e5053b3c05acd6f0527 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:49 +0100 Subject: staging: rtl8192e: fix coding style issues (spaces before semicolon) Fix checkpatch.pl warning 'space prohibited before semicolon'. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h | 14 +++++++------- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 16 ++++++++-------- drivers/staging/rtl8192e/rtllib.h | 4 ++-- drivers/staging/rtl8192e/rtllib_rx.c | 2 +- drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c index 43d0cfa8aae5..e2ef0a3fcb83 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c @@ -46,7 +46,7 @@ bool cmpk_message_handle_tx( do { if ((buffer_len - frag_offset) > frag_threshold) { - frag_length = frag_threshold ; + frag_length = frag_threshold; bLastIniPkt = 0; } else { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 75be672a4cd7..1f7077d3966c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -50,7 +50,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, frag_threshold = pfirmware->cmdpacket_frag_thresold; do { if ((buffer_len - frag_offset) > frag_threshold) { - frag_length = frag_threshold ; + frag_length = frag_threshold; bLastIniPkt = 0; } else { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h index 019836bb36c2..d804876dd92f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h @@ -34,18 +34,18 @@ extern u32 Rtl8192PciEPHY_REGArray[PHY_REGArrayLengthPciE]; #define PHY_REG_1T2RArrayLengthPciE 296 extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE]; #define RadioA_ArrayLengthPciE 246 -extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE] ; +extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE]; #define RadioB_ArrayLengthPciE 78 -extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE] ; +extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; #define RadioC_ArrayLengthPciE 2 -extern u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE] ; +extern u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE]; #define RadioD_ArrayLengthPciE 2 -extern u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE] ; +extern u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE]; #define MACPHY_ArrayLengthPciE 18 -extern u32 Rtl8192PciEMACPHY_Array[MACPHY_ArrayLengthPciE] ; +extern u32 Rtl8192PciEMACPHY_Array[MACPHY_ArrayLengthPciE]; #define MACPHY_Array_PGLengthPciE 30 -extern u32 Rtl8192PciEMACPHY_Array_PG[MACPHY_Array_PGLengthPciE] ; +extern u32 Rtl8192PciEMACPHY_Array_PG[MACPHY_Array_PGLengthPciE]; #define AGCTAB_ArrayLengthPciE 384 -extern u32 Rtl8192PciEAGCTAB_Array[AGCTAB_ArrayLengthPciE] ; +extern u32 Rtl8192PciEAGCTAB_Array[AGCTAB_ArrayLengthPciE]; #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 1764f1ca4258..8b5f6085697e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -115,7 +115,7 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) { RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", __func__); - return ; + return; } else { down(&priv->rtllib->ips_sem); IPSLeave(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 95debb676e79..14a32a8d026c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2987,7 +2987,7 @@ err_pci_disable: static void rtl8192_pci_disconnect(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); - struct r8192_priv *priv ; + struct r8192_priv *priv; u32 i; if (dev) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 113174b52a57..113e42f00c75 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -1002,14 +1002,14 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb); u8 read_nic_io_byte(struct net_device *dev, int x); u32 read_nic_io_dword(struct net_device *dev, int x); -u16 read_nic_io_word(struct net_device *dev, int x) ; +u16 read_nic_io_word(struct net_device *dev, int x); void write_nic_io_byte(struct net_device *dev, int x, u8 y); void write_nic_io_word(struct net_device *dev, int x, u16 y); void write_nic_io_dword(struct net_device *dev, int x, u32 y); u8 read_nic_byte(struct net_device *dev, int x); u32 read_nic_dword(struct net_device *dev, int x); -u16 read_nic_word(struct net_device *dev, int x) ; +u16 read_nic_word(struct net_device *dev, int x); void write_nic_byte(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index fc40af7a4ba6..573786122a56 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1446,7 +1446,7 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14) TempVal = 0; if (!bInCH14) { TempVal = (u32)(priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[0] + - (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[1]<<8)) ; + (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[1]<<8)); rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); TempVal = (u32)(priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[2] + @@ -1455,12 +1455,12 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14) (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[5]<<24)); rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); TempVal = (u32)(priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[6] + - (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[7]<<8)) ; + (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[7]<<8)); rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); } else { TempVal = (u32)(priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[0] + - (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[1]<<8)) ; + (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[1]<<8)); rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); TempVal = (u32)(priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[2] + @@ -1469,7 +1469,7 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14) (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[5]<<24)); rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); TempVal = (u32)(priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[6] + - (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[7]<<8)) ; + (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[7]<<8)); rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); } @@ -1485,7 +1485,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH TempVal = 0; if (!bInCH14) { TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] + - (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8) ; + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8); rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter1, TempVal); @@ -1497,14 +1497,14 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter2, TempVal); TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] + - (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8) ; + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8); rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_DebugPort, TempVal); } else { TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] + - (CCKSwingTable_Ch14[priv->CCK_index][1]<<8) ; + (CCKSwingTable_Ch14[priv->CCK_index][1]<<8); rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", @@ -1517,7 +1517,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter2, TempVal); TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] + - (CCKSwingTable_Ch14[priv->CCK_index][7]<<8) ; + (CCKSwingTable_Ch14[priv->CCK_index][7]<<8); rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 8095ec2c4a63..ec822bbbb21e 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -2255,7 +2255,7 @@ struct rtllib_device { short raw_tx; /* used if IEEE_SOFTMAC_TX_QUEUE is set */ short queue_stop; - short scanning_continue ; + short scanning_continue; short proto_started; short proto_stoppping; @@ -2883,7 +2883,7 @@ extern void HT_update_self_and_peer_setting(struct rtllib_device *ieee, extern u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, u8 *pMCSFilter); extern u8 MCS_FILTER_ALL[]; -extern u16 MCS_DATA_RATE[2][2][77] ; +extern u16 MCS_DATA_RATE[2][2][77]; extern u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame); extern void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo); extern bool IsHTHalfNmodeAPs(struct rtllib_device *ieee); diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index c1085a5907a2..15f7d3479274 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1181,7 +1181,7 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, if (rxb == NULL) { printk(KERN_INFO "%s: rxb is NULL!!\n", __func__); - return ; + return; } for (i = 0; i < rxb->nr_subframes; i++) { diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 8005eed8bd55..ec9689ad64ce 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1476,7 +1476,7 @@ static void rtllib_associate_step1(struct rtllib_device *ieee, u8 *daddr) if (!skb) rtllib_associate_abort(ieee); else { - ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATING ; + ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATING; RTLLIB_DEBUG_MGMT("Sending authentication request\n"); softmac_mgmt_xmit(skb, ieee); if (!timer_pending(&ieee->associate_timer)) { -- cgit v1.2.3 From 3325721d36d4cad6a44f8dc97591ff213f1a8d8a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:50 +0100 Subject: staging: rtl8192e: fix coding style errors (macros in parentheses) Fix checkpatch.pl errors 'Macros with complex values should be enclosed in parentheses'. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_HT.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h index 13f41057461a..193c872bf081 100644 --- a/drivers/staging/rtl8192e/rtl819x_HT.h +++ b/drivers/staging/rtl8192e/rtl819x_HT.h @@ -78,7 +78,7 @@ enum chnl_op { }; #define CHHLOP_IN_PROGRESS(_pHTInfo) \ - ((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false + (((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false) /* union ht_capability { @@ -385,8 +385,8 @@ extern u8 MCS_FILTER_1SS[16]; #define LEGACY_WIRELESS_MODE IEEE_MODE_MASK #define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \ - ((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \ - (LegacyRate) : (PICK_RATE(LegacyRate, HTRate)) + (((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \ + (LegacyRate) : (PICK_RATE(LegacyRate, HTRate))) -- cgit v1.2.3 From 2729011c40ba0bde6ad5381fa84775fff7456c1a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:51 +0100 Subject: staging: rtl8192e: rtllib_wx: remove duplicate messages Some messages were reported with netdev_* macros and internal driver-specific macro. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_wx.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 5b7247effa62..5bf8ea14b805 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -425,8 +425,6 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, netdev_info(ieee->dev, "Setting key %d to all zero.\n", key); - RTLLIB_DEBUG_WX("Setting key %d to all zero.\n", - key); memset(sec.keys[key], 0, 13); (*crypt)->ops->set_key(sec.keys[key], 13, NULL, (*crypt)->priv); @@ -607,8 +605,6 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, ops = lib80211_get_crypto_ops(alg); } if (ops == NULL) { - RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n", - dev->name, ext->alg); netdev_info(dev, "========>unknown crypto alg %d\n", ext->alg); ret = -EINVAL; goto done; @@ -640,7 +636,6 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, if (ext->key_len > 0 && (*crypt)->ops->set_key && (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, (*crypt)->priv) < 0) { - RTLLIB_DEBUG_WX("%s: key setting failed\n", dev->name); netdev_info(dev, "key setting failed\n"); ret = -EINVAL; goto done; -- cgit v1.2.3 From d69d20549be9e44b928d5f857898fe7432deeaac Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:52 +0100 Subject: staging: rtl8192e: fix coding style warnings (printk -> netdev_*) Use netdev_*, dev_* or pr_* instead of printk where possible. KERN_DEBUG messages are left intact as pr_dbg has different behaviour. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 54 +++++----- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 11 +- drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 27 ++--- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 17 ++- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 12 +-- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 41 ++++---- drivers/staging/rtl8192e/rtl819x_TSProc.c | 5 +- drivers/staging/rtl8192e/rtllib.h | 4 +- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 4 +- drivers/staging/rtl8192e/rtllib_crypt_wep.c | 3 +- drivers/staging/rtl8192e/rtllib_debug.h | 2 +- drivers/staging/rtl8192e/rtllib_rx.c | 72 ++++++++----- drivers/staging/rtl8192e/rtllib_softmac.c | 137 +++++++++++++------------ drivers/staging/rtl8192e/rtllib_softmac_wx.c | 4 +- drivers/staging/rtl8192e/rtllib_tx.c | 40 ++++---- drivers/staging/rtl8192e/rtllib_wx.c | 6 +- 17 files changed, 233 insertions(+), 210 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 14bea11a7d80..170ff12c450a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -224,8 +224,8 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val) break; default: - printk(KERN_INFO "SetHwReg8185(): invalid ACI: %d !\n", - eACI); + netdev_info(dev, "SetHwReg8185(): invalid ACI: %d !\n", + eACI); break; } priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACM_CTRL, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 14a32a8d026c..bcf7a9d822e2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -476,7 +476,7 @@ void rtl8192_tx_timeout(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); schedule_work(&priv->reset_wq); - printk(KERN_INFO "TXTIMEOUT"); + netdev_info(dev, "TXTIMEOUT"); } void rtl8192_irq_enable(struct net_device *dev) @@ -1211,8 +1211,8 @@ static void rtl8192_init_priv_variable(struct net_device *dev) priv->AcmControl = 0; priv->pFirmware = vzalloc(sizeof(struct rt_firmware)); if (!priv->pFirmware) - printk(KERN_ERR - "rtl8192e: Unable to allocate space for firmware\n"); + netdev_err(dev, + "rtl8192e: Unable to allocate space for firmware\n"); skb_queue_head_init(&priv->rx_queue); skb_queue_head_init(&priv->skb_queue); @@ -1284,8 +1284,8 @@ static short rtl8192_get_channel_map(struct net_device *dev) } if (priv->ChannelPlan >= COUNTRY_CODE_MAX) { - printk(KERN_INFO - "rtl819x_init:Error channel plan! Set to default.\n"); + netdev_info(dev, + "rtl819x_init:Error channel plan! Set to default.\n"); priv->ChannelPlan = COUNTRY_CODE_FCC; } RT_TRACE(COMP_INIT, "Channel plan is %d\n", priv->ChannelPlan); @@ -1329,7 +1329,7 @@ static short rtl8192_init(struct net_device *dev) rtl8192_irq_disable(dev); if (request_irq(dev->irq, rtl8192_interrupt, IRQF_SHARED, dev->name, dev)) { - printk(KERN_ERR "Error allocating IRQ %d", dev->irq); + netdev_err(dev, "Error allocating IRQ %d", dev->irq); return -1; } else { priv->irq = dev->irq; @@ -1337,7 +1337,7 @@ static short rtl8192_init(struct net_device *dev) } if (rtl8192_pci_initdescring(dev) != 0) { - printk(KERN_ERR "Endopoints initialization failed"); + netdev_err(dev, "Endopoints initialization failed"); free_irq(dev->irq, dev); return -1; } @@ -1357,7 +1357,7 @@ short rtl8192_is_tx_queue_empty(struct net_device *dev) if ((i == TXCMD_QUEUE) || (i == HCCA_QUEUE)) continue; if (skb_queue_len(&(&priv->tx_ring[i])->queue) > 0) { - printk(KERN_INFO "===>tx queue is not empty:%d, %d\n", + netdev_info(dev, "===>tx queue is not empty:%d, %d\n", i, skb_queue_len(&(&priv->tx_ring[i])->queue)); return 0; } @@ -1406,10 +1406,10 @@ static enum reset_type rtl819x_TxCheckStuck(struct net_device *dev) tcb_desc->nStuckCount++; bCheckFwTxCnt = true; if (tcb_desc->nStuckCount > 1) - printk(KERN_INFO - "%s: QueueID=%d tcb_desc->nStuckCount=%d\n", - __func__, QueueID, - tcb_desc->nStuckCount); + netdev_info(dev, + "%s: QueueID=%d tcb_desc->nStuckCount=%d\n", + __func__, QueueID, + tcb_desc->nStuckCount); } } spin_unlock_irqrestore(&priv->irq_th_lock, flags); @@ -1456,13 +1456,13 @@ static enum reset_type rtl819x_ifcheck_resetornot(struct net_device *dev) if (TxResetType == RESET_TYPE_NORMAL || RxResetType == RESET_TYPE_NORMAL) { - printk(KERN_INFO "%s(): TxResetType is %d, RxResetType is %d\n", - __func__, TxResetType, RxResetType); + netdev_info(dev, "%s(): TxResetType is %d, RxResetType is %d\n", + __func__, TxResetType, RxResetType); return RESET_TYPE_NORMAL; } else if (TxResetType == RESET_TYPE_SILENT || RxResetType == RESET_TYPE_SILENT) { - printk(KERN_INFO "%s(): TxResetType is %d, RxResetType is %d\n", - __func__, TxResetType, RxResetType); + netdev_info(dev, "%s(): TxResetType is %d, RxResetType is %d\n", + __func__, TxResetType, RxResetType); return RESET_TYPE_SILENT; } else { return RESET_TYPE_NORESET; @@ -1534,7 +1534,7 @@ RESET_START: if (ieee->state == RTLLIB_LINKED) { SEM_DOWN_IEEE_WX(&ieee->wx_sem); - printk(KERN_INFO "ieee->state is RTLLIB_LINKED\n"); + netdev_info(dev, "ieee->state is RTLLIB_LINKED\n"); rtllib_stop_send_beacons(priv->rtllib); del_timer_sync(&ieee->associate_timer); cancel_delayed_work(&ieee->associate_retry_wq); @@ -1542,7 +1542,7 @@ RESET_START: netif_carrier_off(dev); SEM_UP_IEEE_WX(&ieee->wx_sem); } else { - printk(KERN_INFO "ieee->state is NOT LINKED\n"); + netdev_info(dev, "ieee->state is NOT LINKED\n"); rtllib_softmac_stop_protocol(priv->rtllib, 0 , true); } @@ -1741,9 +1741,9 @@ void rtl819x_watchdog_wqcallback(void *data) if (ieee->eRFPowerState == eRfOff) RT_TRACE(COMP_ERR, "========>%s()\n", __func__); - printk(KERN_INFO - "===>%s(): AP is power off, chan:%d, connect another one\n", - __func__, priv->chan); + netdev_info(dev, + "===>%s(): AP is power off, chan:%d, connect another one\n", + __func__, priv->chan); ieee->state = RTLLIB_ASSOCIATING; @@ -2875,7 +2875,8 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { - printk(KERN_INFO "Unable to obtain 32bit DMA for consistent allocations\n"); + dev_info(&pdev->dev, + "Unable to obtain 32bit DMA for consistent allocations\n"); goto err_pci_disable; } } @@ -2908,7 +2909,8 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, goto err_rel_rtllib; } - printk(KERN_INFO "Memory mapped space start: 0x%08lx\n", pmem_start); + dev_info(&pdev->dev, "Memory mapped space start: 0x%08lx\n", + pmem_start); if (!request_mem_region(pmem_start, pmem_len, DRV_NAME)) { RT_TRACE(COMP_ERR, "request_mem_region failed!"); goto err_rel_rtllib; @@ -3010,7 +3012,7 @@ static void rtl8192_pci_disconnect(struct pci_dev *pdev) rtl8192_free_tx_ring(dev, i); if (priv->irq) { - printk(KERN_INFO "Freeing irq %d\n", dev->irq); + dev_info(&pdev->dev, "Freeing irq %d\n", dev->irq); free_irq(dev->irq, dev); priv->irq = 0; } @@ -3084,8 +3086,8 @@ bool NicIFDisableNIC(struct net_device *dev) static int __init rtl8192_pci_module_init(void) { - printk(KERN_INFO "\nLinux kernel driver for RTL8192E WLAN cards\n"); - printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan Driver\n"); + pr_info("\nLinux kernel driver for RTL8192E WLAN cards\n"); + pr_info("Copyright (c) 2007-2008, Realsil Wlan Driver\n"); if (0 != pci_register_driver(&rtl8192_pci_driver)) { DMESG("No device found"); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 573786122a56..aa95e88a6931 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1420,7 +1420,8 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) TM_Trigger = 1; return; } else { - printk(KERN_INFO "===============>Schedule TxPowerTrackingWorkItem\n"); + netdev_info(dev, + "===============>Schedule TxPowerTrackingWorkItem\n"); queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0); TM_Trigger = 0; @@ -2131,10 +2132,10 @@ static void dm_check_edca_turbo(struct net_device *dev) static int wb_tmp; if (wb_tmp == 0) { - printk(KERN_INFO - "%s():iot peer is %s, bssid: %pM\n", __func__, - peername[pHTInfo->IOTPeer], - priv->rtllib->current_network.bssid); + netdev_info(dev, + "%s():iot peer is %s, bssid: %pM\n", + __func__, peername[pHTInfo->IOTPeer], + priv->rtllib->current_network.bssid); wb_tmp = 1; } } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c index bbbbcf73564b..51f53be2de17 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c @@ -65,31 +65,32 @@ bool rtl8192_pci_findadapter(struct pci_dev *pdev, struct net_device *dev) if (DeviceID == 0x8172) { switch (RevisionID) { case HAL_HW_PCI_REVISION_ID_8192PCIE: - printk(KERN_INFO - "Adapter(8192 PCI-E) is found - DeviceID=%x\n", - DeviceID); + dev_info(&pdev->dev, + "Adapter(8192 PCI-E) is found - DeviceID=%x\n", + DeviceID); priv->card_8192 = NIC_8192E; break; case HAL_HW_PCI_REVISION_ID_8192SE: - printk(KERN_INFO - "Adapter(8192SE) is found - DeviceID=%x\n", - DeviceID); + dev_info(&pdev->dev, + "Adapter(8192SE) is found - DeviceID=%x\n", + DeviceID); priv->card_8192 = NIC_8192SE; break; default: - printk(KERN_INFO "UNKNOWN nic type(%4x:%4x)\n", - pdev->vendor, pdev->device); + dev_info(&pdev->dev, + "UNKNOWN nic type(%4x:%4x)\n", + pdev->vendor, pdev->device); priv->card_8192 = NIC_UNKNOWN; return false; } } if (priv->ops->nic_type != priv->card_8192) { - printk(KERN_INFO - "Detect info(%x) and hardware info(%x) not match!\n", - priv->ops->nic_type, priv->card_8192); - printk(KERN_INFO - "Please select proper driver before install!!!!\n"); + dev_info(&pdev->dev, + "Detect info(%x) and hardware info(%x) not match!\n", + priv->ops->nic_type, priv->card_8192); + dev_info(&pdev->dev, + "Please select proper driver before install!!!!\n"); return false; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index bffe9c4b81b2..ca6ecfc8299e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -29,14 +29,14 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) struct r8192_priv *priv = rtllib_priv(dev); u32 ulRegRead; - printk(KERN_INFO "============> r8192E suspend call.\n"); + netdev_info(dev, "============> r8192E suspend call.\n"); del_timer_sync(&priv->gpio_polling_timer); cancel_delayed_work(&priv->gpio_change_rf_wq); priv->polling_timer_on = 0; if (!netif_running(dev)) { - printk(KERN_INFO - "RTL819XE:UI is open out of suspend function\n"); + netdev_info(dev, + "RTL819XE:UI is open out of suspend function\n"); goto out_pci_suspend; } @@ -57,7 +57,7 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) write_nic_byte(dev, MacBlkCtrl, 0xa); } out_pci_suspend: - printk("r8192E support WOL call??????????????????????\n"); + netdev_info(dev, "r8192E support WOL call??????????????????????\n"); if (priv->rtllib->bSupportRemoteWakeUp) RT_TRACE(COMP_POWER, "r8192E support WOL call!!!!!!!!!!!!!!!!!!.\n"); @@ -79,14 +79,13 @@ int rtl8192E_resume(struct pci_dev *pdev) int err; u32 val; - printk(KERN_INFO "================>r8192E resume call.\n"); + netdev_info(dev, "================>r8192E resume call.\n"); pci_set_power_state(pdev, PCI_D0); err = pci_enable_device(pdev); if (err) { - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", - dev->name); + netdev_err(dev, "pci_enable_device failed on resume\n"); return err; } pci_restore_state(pdev); @@ -101,8 +100,8 @@ int rtl8192E_resume(struct pci_dev *pdev) check_rfctrl_gpio_timer((unsigned long)dev); if (!netif_running(dev)) { - printk(KERN_INFO - "RTL819XE:UI is open out of resume function\n"); + netdev_info(dev, + "RTL819XE:UI is open out of resume function\n"); goto out; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index b5abea5346eb..40c3be9a5e54 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -100,14 +100,14 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time) if ((time - jiffies) <= msecs_to_jiffies(MIN_SLEEP_TIME)) { spin_unlock_irqrestore(&priv->ps_lock, flags); - printk(KERN_INFO "too short to sleep::%lld < %ld\n", - time - jiffies, msecs_to_jiffies(MIN_SLEEP_TIME)); + netdev_info(dev, "too short to sleep::%lld < %ld\n", + time - jiffies, msecs_to_jiffies(MIN_SLEEP_TIME)); return; } if ((time - jiffies) > msecs_to_jiffies(MAX_SLEEP_TIME)) { - printk(KERN_INFO "========>too long to sleep:%lld > %ld\n", - time - jiffies, msecs_to_jiffies(MAX_SLEEP_TIME)); + netdev_info(dev, "========>too long to sleep:%lld > %ld\n", + time - jiffies, msecs_to_jiffies(MAX_SLEEP_TIME)); spin_unlock_irqrestore(&priv->ps_lock, flags); return; } @@ -203,8 +203,8 @@ void rtllib_ips_leave_wq(struct net_device *dev) __func__); return; } else { - printk(KERN_INFO "=========>%s(): IPSLeave\n", - __func__); + netdev_info(dev, "=========>%s(): IPSLeave\n", + __func__); queue_work_rsl(priv->rtllib->wq, &priv->rtllib->ips_leave_wq); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 757c30994d77..d074f974fe11 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -255,7 +255,7 @@ static int r8192se_wx_set_radio(struct net_device *dev, down(&priv->wx_sem); - printk(KERN_INFO "%s(): set radio ! extra is %d\n", __func__, *extra); + netdev_info(dev, "%s(): set radio ! extra is %d\n", __func__, *extra); if ((*extra != 0) && (*extra != 1)) { RT_TRACE(COMP_ERR, "%s(): set radio an err value,must 0(radio off) or 1(radio on)\n", @@ -279,8 +279,8 @@ static int r8192se_wx_set_lps_awake_interval(struct net_device *dev, down(&priv->wx_sem); - printk(KERN_INFO "%s(): set lps awake interval ! extra is %d\n", - __func__, *extra); + netdev_info(dev, "%s(): set lps awake interval ! extra is %d\n", + __func__, *extra); pPSC->RegMaxLPSAwakeIntvl = *extra; up(&priv->wx_sem); @@ -295,9 +295,9 @@ static int r8192se_wx_set_force_lps(struct net_device *dev, down(&priv->wx_sem); - printk(KERN_INFO - "%s(): force LPS ! extra is %d (1 is open 0 is close)\n", - __func__, *extra); + netdev_info(dev, + "%s(): force LPS ! extra is %d (1 is open 0 is close)\n", + __func__, *extra); priv->force_lps = *extra; up(&priv->wx_sem); return 0; @@ -314,8 +314,8 @@ static int r8192_wx_set_debugflag(struct net_device *dev, if (priv->bHwRadioOff) return 0; - printk(KERN_INFO "=====>%s(), *extra:%x, debugflag:%x\n", __func__, - *extra, rt_global_debug_component); + netdev_info(dev, "=====>%s(), *extra:%x, debugflag:%x\n", __func__, + *extra, rt_global_debug_component); if (c > 0) rt_global_debug_component |= (1<wx_sem); return -1; } else { - printk(KERN_INFO - "=========>%s(): IPSLeave\n", - __func__); + netdev_info(dev, + "=========>%s(): IPSLeave\n", + __func__); down(&priv->rtllib->ips_sem); IPSLeave(dev); up(&priv->rtllib->ips_sem); @@ -475,8 +475,8 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, } if (priv->bHwRadioOff) { - printk(KERN_INFO "================>%s(): hwradio off\n", - __func__); + netdev_info(dev, "================>%s(): hwradio off\n", + __func__); return 0; } rtState = priv->rtllib->eRFPowerState; @@ -579,9 +579,9 @@ static int r8192_wx_set_essid(struct net_device *dev, int ret; if (priv->bHwRadioOff) { - printk(KERN_INFO - "=========>%s():hw radio off,or Rf state is eRfOff, return\n", - __func__); + netdev_info(dev, + "=========>%s():hw radio off,or Rf state is eRfOff, return\n", + __func__); return 0; } down(&priv->wx_sem); @@ -833,7 +833,8 @@ static int r8192_wx_set_enc(struct net_device *dev, set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104, zero_addr[key_idx], 0, hwkey, 0); } else { - printk(KERN_INFO "wrong type in WEP, not WEP40 and WEP104\n"); + netdev_info(dev, + "wrong type in WEP, not WEP40 and WEP104\n"); } } @@ -1155,8 +1156,10 @@ static int r8192_wx_set_PromiscuousMode(struct net_device *dev, (rtllib_EnableIntelPromiscuousMode(dev, false)) : (rtllib_DisableIntelPromiscuousMode(dev, false)); - printk(KERN_INFO "=======>%s(), on = %d, filter src sta = %d\n", - __func__, bPromiscuousOn, bFilterSourceStationFrame); + netdev_info(dev, + "=======>%s(), on = %d, filter src sta = %d\n", + __func__, bPromiscuousOn, + bFilterSourceStationFrame); } else { return -1; } diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 6a96129926b5..735ae60e5740 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -466,7 +466,7 @@ void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr) { struct ts_common_info *pTS, *pTmpTS; - printk(KERN_INFO "===========>RemovePeerTS, %pM\n", Addr); + netdev_info(ieee->dev, "===========>RemovePeerTS, %pM\n", Addr); list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) { if (memcmp(pTS->Addr, Addr, 6) == 0) { @@ -478,7 +478,8 @@ void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr) list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Admit_List, List) { if (memcmp(pTS->Addr, Addr, 6) == 0) { - printk(KERN_INFO "====>remove Tx_TS_admin_list\n"); + netdev_info(ieee->dev, + "====>remove Tx_TS_admin_list\n"); RemoveTsEntry(ieee, pTS, TX_DIR); list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Tx_TS_Unused_List); diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index ec822bbbb21e..3e437ea7b85d 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -768,8 +768,8 @@ do { \ #define RTLLIB_DL_TRACE (1<<29) #define RTLLIB_DL_DATA (1<<30) #define RTLLIB_DL_ERR (1<<31) -#define RTLLIB_ERROR(f, a...) printk(KERN_ERR "rtllib: " f, ## a) -#define RTLLIB_WARNING(f, a...) printk(KERN_WARNING "rtllib: " f, ## a) +#define RTLLIB_ERROR(f, a...) pr_err("rtllib: " f, ## a) +#define RTLLIB_WARNING(f, a...) pr_warn("rtllib: " f, ## a) #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a) #define RTLLIB_DEBUG_WX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_WX, f, ## a) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index c93f8dc6243a..ccf85309b4b6 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -505,7 +505,7 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, struct scatterlist sg[2]; if (tfm_michael == NULL) { - printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); + pr_warn("michael_mic: tfm_michael == NULL\n"); return -1; } sg_init_table(sg, 2); @@ -631,7 +631,7 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, printk(KERN_DEBUG "%d\n", memcmp(mic, skb->data + skb->len - 8, 8) != 0); if (skb->dev) { - printk(KERN_INFO "skb->dev != NULL\n"); + pr_info("skb->dev != NULL\n"); rtllib_michael_mic_failure(skb->dev, hdr, keyidx); } tkey->dot11RSNAStatsTKIPLocalMICFailures++; diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c index 1e16d97cae03..06c79fabdcd3 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c @@ -106,8 +106,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || skb->len < hdr_len){ - printk(KERN_ERR - "Error!!! headroom=%d tailroom=%d skblen=%d hdr_len=%d\n", + pr_err("Error!!! headroom=%d tailroom=%d skblen=%d hdr_len=%d\n", skb_headroom(skb), skb_tailroom(skb), skb->len, hdr_len); return -1; } diff --git a/drivers/staging/rtl8192e/rtllib_debug.h b/drivers/staging/rtl8192e/rtllib_debug.h index 7537dae89a75..90cffab4287e 100644 --- a/drivers/staging/rtl8192e/rtllib_debug.h +++ b/drivers/staging/rtl8192e/rtllib_debug.h @@ -80,7 +80,7 @@ do { \ #define assert(expr) \ do { \ if (!(expr)) { \ - printk(KERN_INFO "Assertion failed! %s,%s,%s,line=%d\n", \ + pr_info("Assertion failed! %s,%s,%s,line=%d\n", \ #expr, __FILE__, __func__, __LINE__); \ } \ } while (0); diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 15f7d3479274..9fc635395ca5 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -523,7 +523,9 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, struct rx_ts_record del_timer_sync(&pTS->RxPktPendingTimer); while (!list_empty(&pTS->RxPendingPktList)) { if (RfdCnt >= REORDER_WIN_SIZE) { - printk(KERN_INFO "-------------->%s() error! RfdCnt >= REORDER_WIN_SIZE\n", __func__); + netdev_info(ieee->dev, + "-------------->%s() error! RfdCnt >= REORDER_WIN_SIZE\n", + __func__); break; } @@ -792,13 +794,18 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, (nSubframe_Length << 8); if (skb->len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { - printk(KERN_INFO "%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\ - __func__, rxb->nr_subframes); - printk(KERN_INFO "%s: A-MSDU parse error!! Subframe Length: %d\n", __func__, - nSubframe_Length); - printk(KERN_INFO "nRemain_Length is %d and nSubframe_Length is : %d\n", skb->len, - nSubframe_Length); - printk(KERN_INFO "The Packet SeqNum is %d\n", SeqNum); + netdev_info(ieee->dev, + "%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n", + __func__, rxb->nr_subframes); + netdev_info(ieee->dev, + "%s: A-MSDU parse error!! Subframe Length: %d\n", + __func__, nSubframe_Length); + netdev_info(ieee->dev, + "nRemain_Length is %d and nSubframe_Length is : %d\n", + skb->len, nSubframe_Length); + netdev_info(ieee->dev, + "The Packet SeqNum is %d\n", + SeqNum); return 0; } @@ -858,7 +865,8 @@ static size_t rtllib_rx_get_hdrlen(struct rtllib_device *ieee, hdrlen = rtllib_get_hdrlen(fc); if (HTCCheck(ieee, skb->data)) { if (net_ratelimit()) - printk(KERN_INFO "%s: find HTCControl!\n", __func__); + netdev_info(ieee->dev, "%s: find HTCControl!\n", + __func__); hdrlen += 4; rx_stats->bContainHTC = true; } @@ -1048,7 +1056,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, keyidx = rtllib_rx_frame_decrypt(ieee, skb, crypt); if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && (keyidx < 0)) { - printk(KERN_INFO "%s: decrypt frame error\n", __func__); + netdev_info(ieee->dev, "%s: decrypt frame error\n", __func__); return -1; } @@ -1071,8 +1079,9 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, flen -= hdrlen; if (frag_skb->tail + flen > frag_skb->end) { - printk(KERN_WARNING "%s: host decrypted and reassembled frame did not fit skb\n", - __func__); + netdev_warn(ieee->dev, + "%s: host decrypted and reassembled frame did not fit skb\n", + __func__); rtllib_frag_cache_invalidate(ieee, hdr); return -1; } @@ -1108,7 +1117,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, * encrypted/authenticated */ if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) { - printk(KERN_INFO "%s: ==>decrypt msdu error\n", __func__); + netdev_info(ieee->dev, "%s: ==>decrypt msdu error\n", __func__); return -1; } @@ -1148,7 +1157,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, } if (rtllib_is_eapol_frame(ieee, skb, hdrlen)) - printk(KERN_WARNING "RX: IEEE802.1X EAPOL frame!\n"); + netdev_warn(ieee->dev, "RX: IEEE802.1X EAPOL frame!\n"); return 0; } @@ -1180,7 +1189,7 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, int i = 0; if (rxb == NULL) { - printk(KERN_INFO "%s: rxb is NULL!!\n", __func__); + netdev_info(dev, "%s: rxb is NULL!!\n", __func__); return; } @@ -1261,7 +1270,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /*Filter pkt has too small length */ hdrlen = rtllib_rx_get_hdrlen(ieee, skb, rx_stats); if (skb->len < hdrlen) { - printk(KERN_INFO "%s():ERR!!! skb->len is smaller than hdrlen\n", __func__); + netdev_info(dev, "%s():ERR!!! skb->len is smaller than hdrlen\n", + __func__); goto rx_dropped; } @@ -1404,13 +1414,16 @@ static int rtllib_rx_Monitor(struct rtllib_device *ieee, struct sk_buff *skb, size_t hdrlen = rtllib_get_hdrlen(fc); if (skb->len < hdrlen) { - printk(KERN_INFO "%s():ERR!!! skb->len is smaller than hdrlen\n", __func__); + netdev_info(ieee->dev, + "%s():ERR!!! skb->len is smaller than hdrlen\n", + __func__); return 0; } if (HTCCheck(ieee, skb->data)) { if (net_ratelimit()) - printk(KERN_INFO "%s: Find HTCControl!\n", __func__); + netdev_info(ieee->dev, "%s: Find HTCControl!\n", + __func__); hdrlen += 4; } @@ -1436,11 +1449,11 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, int ret = 0; if ((NULL == ieee) || (NULL == skb) || (NULL == rx_stats)) { - printk(KERN_INFO "%s: Input parameters NULL!\n", __func__); + pr_info("%s: Input parameters NULL!\n", __func__); goto rx_dropped; } if (skb->len < 10) { - printk(KERN_INFO "%s: SKB length < 10\n", __func__); + netdev_info(ieee->dev, "%s: SKB length < 10\n", __func__); goto rx_dropped; } @@ -1460,7 +1473,7 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, ret = rtllib_rx_Mesh(ieee, skb, rx_stats); break; default: - printk(KERN_INFO"%s: ERR iw mode!!!\n", __func__); + netdev_info(ieee->dev, "%s: ERR iw mode!!!\n", __func__); break; } @@ -1701,7 +1714,9 @@ static inline void rtllib_extract_country_ie( if (!IS_COUNTRY_IE_VALID(ieee)) { if (rtllib_act_scanning(ieee, false) && ieee->FirstIe_InScan) - printk(KERN_INFO "Received beacon ContryIE, SSID: <%s>\n", network->ssid); + netdev_info(ieee->dev, + "Received beacon ContryIE, SSID: <%s>\n", + network->ssid); Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); } } @@ -2138,8 +2153,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, } break; case MFIE_TYPE_QOS_PARAMETER: - printk(KERN_ERR - "QoS Error need to parse QOS_PARAMETER IE\n"); + netdev_err(ieee->dev, + "QoS Error need to parse QOS_PARAMETER IE\n"); break; case MFIE_TYPE_COUNTRY: @@ -2418,7 +2433,7 @@ static inline int is_beacon(__le16 fc) static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) { if (MAX_CHANNEL_NUMBER < channel) { - printk(KERN_INFO "%s(): Invalid Channel\n", __func__); + netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__); return 0; } @@ -2431,7 +2446,7 @@ static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel) { if (MAX_CHANNEL_NUMBER < channel) { - printk(KERN_INFO "%s(): Invalid Channel\n", __func__); + netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__); return 0; } if (rtllib->active_channel_map[channel] > 0) @@ -2497,8 +2512,9 @@ static inline void rtllib_process_probe_response( if (WLAN_FC_GET_STYPE(le16_to_cpu(beacon->header.frame_ctl)) == RTLLIB_STYPE_PROBE_RESP) { if (IsPassiveChannel(ieee, network->channel)) { - printk(KERN_INFO "GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", - network->channel); + netdev_info(ieee->dev, + "GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", + network->channel); goto free_network; } } diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index ec9689ad64ce..f1f19fc2305c 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -124,7 +124,7 @@ void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p) *tag++ = 0x00; *tag_p = tag; - printk(KERN_ALERT "This is enable turbo mode IE process\n"); + netdev_alert(ieee->dev, "This is enable turbo mode IE process\n"); } static void enqueue_mgmt(struct rtllib_device *ieee, struct sk_buff *skb) @@ -188,7 +188,7 @@ MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee) if (QueryRate == 0) { QueryRate = 12; - printk(KERN_INFO "No BasicRate found!!\n"); + netdev_info(ieee->dev, "No BasicRate found!!\n"); } return QueryRate; } @@ -277,7 +277,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee) /* as for the completion function, it does not need * to check it any more. * */ - printk(KERN_INFO + netdev_info(ieee->dev, "%s():insert to waitqueue, queue_index:%d!\n", __func__, tcb_desc->queue_index); skb_queue_tail(&ieee->skb_waitQ[tcb_desc->queue_index], @@ -426,7 +426,7 @@ void rtllib_EnableNetMonitorMode(struct net_device *dev, { struct rtllib_device *ieee = netdev_priv_rsl(dev); - printk(KERN_INFO "========>Enter Monitor Mode\n"); + netdev_info(dev, "========>Enter Monitor Mode\n"); ieee->AllowAllDestAddrHandler(dev, true, !bInitState); } @@ -442,7 +442,7 @@ void rtllib_DisableNetMonitorMode(struct net_device *dev, { struct rtllib_device *ieee = netdev_priv_rsl(dev); - printk(KERN_INFO "========>Exit Monitor Mode\n"); + netdev_info(dev, "========>Exit Monitor Mode\n"); ieee->AllowAllDestAddrHandler(dev, false, !bInitState); } @@ -463,7 +463,7 @@ void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, struct rtllib_device *ieee = netdev_priv_rsl(dev); - printk(KERN_INFO "========>Enter Intel Promiscuous Mode\n"); + netdev_info(dev, "========>Enter Intel Promiscuous Mode\n"); ieee->AllowAllDestAddrHandler(dev, true, !bInitState); ieee->SetHwRegHandler(dev, HW_VAR_CECHK_BSSID, @@ -486,7 +486,7 @@ void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, struct rtllib_device *ieee = netdev_priv_rsl(dev); - printk(KERN_INFO "========>Exit Intel Promiscuous Mode\n"); + netdev_info(dev, "========>Exit Intel Promiscuous Mode\n"); ieee->AllowAllDestAddrHandler(dev, false, !bInitState); ieee->SetHwRegHandler(dev, HW_VAR_CECHK_BSSID, @@ -570,7 +570,8 @@ void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh) if (ieee->state == RTLLIB_LINKED) goto out; if (ieee->sync_scan_hurryup) { - printk(KERN_INFO "============>sync_scan_hurryup out\n"); + netdev_info(ieee->dev, + "============>sync_scan_hurryup out\n"); goto out; } @@ -615,8 +616,9 @@ static void rtllib_softmac_scan_wq(void *data) down(&ieee->scan_sem); if (ieee->eRFPowerState == eRfOff) { - printk(KERN_INFO "======>%s():rf state is eRfOff, return\n", - __func__); + netdev_info(ieee->dev, + "======>%s():rf state is eRfOff, return\n", + __func__); goto out1; } @@ -1239,8 +1241,8 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, PMKCacheIdx = SecIsInPMKIDList(ieee, ieee->current_network.bssid); if (PMKCacheIdx >= 0) { wpa_ie_len += 18; - printk(KERN_INFO "[PMK cache]: WPA2 IE length: %x\n", - wpa_ie_len); + netdev_info(ieee->dev, "[PMK cache]: WPA2 IE length: %x\n", + wpa_ie_len); } len = sizeof(struct rtllib_assoc_request_frame) + 2 + beacon->ssid_len @@ -1419,9 +1421,9 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, if (ieee->assocreq_ies) memcpy(ieee->assocreq_ies, ies, ieee->assocreq_ies_len); else { - printk(KERN_INFO - "%s()Warning: can't alloc memory for assocreq_ies\n", - __func__); + netdev_info(ieee->dev, + "%s()Warning: can't alloc memory for assocreq_ies\n", + __func__); ieee->assocreq_ies_len = 0; } return skb; @@ -1544,9 +1546,9 @@ static void rtllib_associate_complete_wq(void *data) associate_complete_wq); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) (&(ieee->PowerSaveControl)); - printk(KERN_INFO "Associated successfully\n"); + netdev_info(ieee->dev, "Associated successfully\n"); if (!ieee->is_silent_reset) { - printk(KERN_INFO "normal associate\n"); + netdev_info(ieee->dev, "normal associate\n"); notify_wx_assoc_event(ieee); } @@ -1555,20 +1557,20 @@ static void rtllib_associate_complete_wq(void *data) if (rtllib_is_54g(&ieee->current_network) && (ieee->modulation & RTLLIB_OFDM_MODULATION)) { ieee->rate = 108; - printk(KERN_INFO"Using G rates:%d\n", ieee->rate); + netdev_info(ieee->dev, "Using G rates:%d\n", ieee->rate); } else { ieee->rate = 22; ieee->SetWirelessMode(ieee->dev, IEEE_B); - printk(KERN_INFO"Using B rates:%d\n", ieee->rate); + netdev_info(ieee->dev, "Using B rates:%d\n", ieee->rate); } if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) { - printk(KERN_INFO "Successfully associated, ht enabled\n"); + netdev_info(ieee->dev, "Successfully associated, ht enabled\n"); HTOnAssocRsp(ieee); } else { - printk(KERN_INFO - "Successfully associated, ht not enabled(%d, %d)\n", - ieee->pHTInfo->bCurrentHTSupport, - ieee->pHTInfo->bEnableHT); + netdev_info(ieee->dev, + "Successfully associated, ht not enabled(%d, %d)\n", + ieee->pHTInfo->bCurrentHTSupport, + ieee->pHTInfo->bEnableHT); memset(ieee->dot11HTOperationalRateSet, 0, 16); } ieee->LinkDetectInfo.SlotNum = 2 * (1 + @@ -1583,7 +1585,7 @@ static void rtllib_associate_complete_wq(void *data) ieee->link_change(ieee->dev); if (ieee->is_silent_reset) { - printk(KERN_INFO "silent reset associate\n"); + netdev_info(ieee->dev, "silent reset associate\n"); ieee->is_silent_reset = false; } @@ -1721,15 +1723,15 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, IW_ESSID_MAX_SIZE); ieee->current_network.ssid_len = tmp_ssid_len; } - printk(KERN_INFO - "Linking with %s,channel:%d, qos:%d, myHT:%d, networkHT:%d, mode:%x cur_net.flags:0x%x\n", - ieee->current_network.ssid, - ieee->current_network.channel, - ieee->current_network.qos_data.supported, - ieee->pHTInfo->bEnableHT, - ieee->current_network.bssht.bdSupportHT, - ieee->current_network.mode, - ieee->current_network.flags); + netdev_info(ieee->dev, + "Linking with %s,channel:%d, qos:%d, myHT:%d, networkHT:%d, mode:%x cur_net.flags:0x%x\n", + ieee->current_network.ssid, + ieee->current_network.channel, + ieee->current_network.qos_data.supported, + ieee->pHTInfo->bEnableHT, + ieee->current_network.bssht.bdSupportHT, + ieee->current_network.mode, + ieee->current_network.flags); if ((rtllib_act_scanning(ieee, false)) && !(ieee->softmac_features & IEEE_SOFTMAC_SCAN)) @@ -1760,11 +1762,11 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, (ieee->modulation & RTLLIB_OFDM_MODULATION)) { ieee->rate = 108; ieee->SetWirelessMode(ieee->dev, IEEE_G); - printk(KERN_INFO"Using G rates\n"); + netdev_info(ieee->dev, "Using G rates\n"); } else { ieee->rate = 22; ieee->SetWirelessMode(ieee->dev, IEEE_B); - printk(KERN_INFO"Using B rates\n"); + netdev_info(ieee->dev, "Using B rates\n"); } memset(ieee->dot11HTOperationalRateSet, 0, 16); ieee->state = RTLLIB_LINKED; @@ -1967,7 +1969,7 @@ static inline void rtllib_rx_assoc_rq(struct rtllib_device *ieee, if (assoc_rq_parse(skb, dest) != -1) rtllib_resp_to_assoc_rq(ieee, dest); - printk(KERN_INFO"New client associated: %pM\n", dest); + netdev_info(ieee->dev, "New client associated: %pM\n", dest); } void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr) @@ -2288,17 +2290,18 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, memcpy(ieee->assocresp_ies, ies, ieee->assocresp_ies_len); else { - printk(KERN_INFO - "%s()Warning: can't alloc memory for assocresp_ies\n", - __func__); + netdev_info(ieee->dev, + "%s()Warning: can't alloc memory for assocresp_ies\n", + __func__); ieee->assocresp_ies_len = 0; } rtllib_associate_complete(ieee); } else { /* aid could not been allocated */ ieee->softmac_stats.rx_ass_err++; - printk(KERN_INFO "Association response status code 0x%x\n", - errcode); + netdev_info(ieee->dev, + "Association response status code 0x%x\n", + errcode); RTLLIB_DEBUG_MGMT( "Association response status code 0x%x\n", errcode); @@ -2355,8 +2358,8 @@ inline int rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode) { - printk(KERN_INFO - "======>enter half N mode\n"); + netdev_info(ieee->dev, + "======>enter half N mode\n"); ieee->bHalfWirelessN24GMode = true; } else @@ -2373,9 +2376,9 @@ inline int rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, RTLLIB_DEBUG_MGMT("Authentication respose status code 0x%x", errcode); - printk(KERN_INFO - "Authentication respose status code 0x%x", - errcode); + netdev_info(ieee->dev, + "Authentication respose status code 0x%x", + errcode); rtllib_associate_abort(ieee); } @@ -2399,10 +2402,10 @@ inline int rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb) if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && ieee->state == RTLLIB_LINKED && (ieee->iw_mode == IW_MODE_INFRA)) { - printk(KERN_INFO - "==========>received disassoc/deauth(%x) frame, reason code:%x\n", - WLAN_FC_GET_STYPE(header->frame_ctl), - ((struct rtllib_disassoc *)skb->data)->reason); + netdev_info(ieee->dev, + "==========>received disassoc/deauth(%x) frame, reason code:%x\n", + WLAN_FC_GET_STYPE(header->frame_ctl), + ((struct rtllib_disassoc *)skb->data)->reason); ieee->state = RTLLIB_ASSOCIATING; ieee->softmac_stats.reassoc++; ieee->is_roaming = true; @@ -2692,7 +2695,7 @@ static void rtllib_start_ibss_wq(void *data) * on the semaphore */ if (!ieee->proto_started) { - printk(KERN_INFO "==========oh driver down return\n"); + netdev_info(ieee->dev, "==========oh driver down return\n"); return; } down(&ieee->wx_sem); @@ -2728,7 +2731,7 @@ static void rtllib_start_ibss_wq(void *data) /* the network definitively is not here.. create a new cell */ if (ieee->state == RTLLIB_NOLINK) { - printk(KERN_INFO "creating new IBSS cell\n"); + netdev_info(ieee->dev, "creating new IBSS cell\n"); ieee->current_network.channel = ieee->IbssStartChnl; if (!ieee->wap_set) rtllib_randomize_cell(ieee); @@ -2782,7 +2785,7 @@ static void rtllib_start_ibss_wq(void *data) ieee->current_network.capability = WLAN_CAPABILITY_IBSS; } - printk(KERN_INFO "%s(): ieee->mode = %d\n", __func__, ieee->mode); + netdev_info(ieee->dev, "%s(): ieee->mode = %d\n", __func__, ieee->mode); if ((ieee->mode == IEEE_N_24G) || (ieee->mode == IEEE_N_5G)) HTUseDefaultSetting(ieee); else @@ -3186,7 +3189,7 @@ static int rtllib_wpa_enable(struct rtllib_device *ieee, int value) { /* This is called when wpa_supplicant loads and closes the driver * interface. */ - printk(KERN_INFO "%s WPA\n", value ? "enabling" : "disabling"); + netdev_info(ieee->dev, "%s WPA\n", value ? "enabling" : "disabling"); ieee->wpa_enabled = value; memset(ieee->ap_mac_addr, 0, 6); return 0; @@ -3217,7 +3220,7 @@ static int rtllib_wpa_mlme(struct rtllib_device *ieee, int command, int reason) break; default: - printk(KERN_INFO "Unknown MLME request: %d\n", command); + netdev_info(ieee->dev, "Unknown MLME request: %d\n", command); ret = -EOPNOTSUPP; } @@ -3348,7 +3351,7 @@ static int rtllib_wpa_set_param(struct rtllib_device *ieee, u8 name, u32 value) break; default: - printk(KERN_INFO "Unknown WPA param: %d\n", name); + netdev_info(ieee->dev, "Unknown WPA param: %d\n", name); ret = -EOPNOTSUPP; } @@ -3374,8 +3377,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, if (param_len != (int) ((char *) param->u.crypt.key - (char *) param) + param->u.crypt.key_len) { - printk(KERN_INFO "Len mismatch %d, %d\n", param_len, - param->u.crypt.key_len); + netdev_info(ieee->dev, "Len mismatch %d, %d\n", param_len, + param->u.crypt.key_len); return -EINVAL; } if (is_broadcast_ether_addr(param->sta_addr)) { @@ -3415,8 +3418,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, ops = lib80211_get_crypto_ops(param->u.crypt.alg); } if (ops == NULL) { - printk(KERN_INFO "unknown crypto alg '%s'\n", - param->u.crypt.alg); + netdev_info(ieee->dev, "unknown crypto alg '%s'\n", + param->u.crypt.alg); param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; ret = -EINVAL; goto done; @@ -3450,7 +3453,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, (*crypt)->ops->set_key(param->u.crypt.key, param->u.crypt.key_len, param->u.crypt.seq, (*crypt)->priv) < 0) { - printk(KERN_INFO "key setting failed\n"); + netdev_info(ieee->dev, "key setting failed\n"); param->u.crypt.err = IEEE_CRYPT_ERR_KEY_SET_FAILED; ret = -EINVAL; goto done; @@ -3495,7 +3498,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, ieee->iw_mode != IW_MODE_INFRA && ieee->reset_port && ieee->reset_port(ieee->dev)) { - printk(KERN_INFO "reset_port failed\n"); + netdev_info(ieee->dev, "reset_port failed\n"); param->u.crypt.err = IEEE_CRYPT_ERR_CARD_CONF_FAILED; return -EINVAL; } @@ -3638,8 +3641,8 @@ int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee, struct iw_point *p, break; default: - printk(KERN_INFO "Unknown WPA supplicant request: %d\n", - param->cmd); + netdev_info(ieee->dev, "Unknown WPA supplicant request: %d\n", + param->cmd); ret = -EOPNOTSUPP; break; } @@ -3753,8 +3756,8 @@ void notify_wx_assoc_event(struct rtllib_device *ieee) ETH_ALEN); else { - printk(KERN_INFO "%s(): Tell user space disconnected\n", - __func__); + netdev_info(ieee->dev, "%s(): Tell user space disconnected\n", + __func__); eth_zero_addr(wrqu.ap_addr.sa_data); } wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index ea8488f5b7cb..9715a793fd37 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -527,8 +527,8 @@ int rtllib_wx_set_rawtx(struct rtllib_device *ieee, else ieee->raw_tx = 0; - printk(KERN_INFO"raw TX is %s\n", - ieee->raw_tx ? "enabled" : "disabled"); + netdev_info(ieee->dev, "raw TX is %s\n", + ieee->raw_tx ? "enabled" : "disabled"); if (ieee->iw_mode == IW_MODE_MONITOR) { if (prev == 0 && ieee->raw_tx) { diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 928cd4cf14bc..7c0af26f267e 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -185,7 +185,8 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (!(crypt && crypt->ops)) { - printk(KERN_INFO "=========>%s(), crypt is null\n", __func__); + netdev_info(ieee->dev, "=========>%s(), crypt is null\n", + __func__); return -1; } /* To encrypt, frame format is: @@ -202,8 +203,8 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, atomic_dec(&crypt->refcnt); if (res < 0) { - printk(KERN_INFO "%s: Encryption failed: len=%d.\n", - ieee->dev->name, frag->len); + netdev_info(ieee->dev, "%s: Encryption failed: len=%d.\n", + ieee->dev->name, frag->len); ieee->ieee_stats.tx_discards++; return -1; } @@ -311,7 +312,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee, if (pHTInfo->bCurrentAMPDUEnable) { if (!GetTs(ieee, (struct ts_common_info **)(&pTxTs), hdr->addr1, skb->priority, TX_DIR, true)) { - printk(KERN_INFO "%s: can't get TS\n", __func__); + netdev_info(ieee->dev, "%s: can't get TS\n", __func__); return; } if (pTxTs->TxAdmittedBARecord.bValid == false) { @@ -582,16 +583,15 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) IEEE_SOFTMAC_TX_QUEUE)) || ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { - printk(KERN_WARNING "%s: No xmit handler.\n", - ieee->dev->name); + netdev_warn(ieee->dev, "No xmit handler.\n"); goto success; } if (likely(ieee->raw_tx == 0)) { if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) { - printk(KERN_WARNING "%s: skb too small (%d).\n", - ieee->dev->name, skb->len); + netdev_warn(ieee->dev, "skb too small (%d).\n", + skb->len); goto success; } /* Save source and destination addresses */ @@ -604,9 +604,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) if (ieee->iw_mode == IW_MODE_MONITOR) { txb = rtllib_alloc_txb(1, skb->len, GFP_ATOMIC); if (unlikely(!txb)) { - printk(KERN_WARNING - "%s: Could not allocate TXB\n", - ieee->dev->name); + netdev_warn(ieee->dev, + "Could not allocate TXB\n"); goto failed; } @@ -636,8 +635,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } } } else if (ETH_P_ARP == ether_type) { - printk(KERN_INFO - "=================>DHCP Protocol start tx ARP pkt!!\n"); + netdev_info(ieee->dev, + "=================>DHCP Protocol start tx ARP pkt!!\n"); bdhcp = true; ieee->LPSDelayCnt = ieee->current_network.tim.tim_count; @@ -717,10 +716,11 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* in case we are a client verify acm is not set for this ac */ while (unlikely(ieee->wmm_acm & (0x01 << skb->priority))) { - printk(KERN_INFO "skb->priority = %x\n", skb->priority); + netdev_info(ieee->dev, "skb->priority = %x\n", + skb->priority); if (wme_downgrade_ac(skb)) break; - printk(KERN_INFO "converted skb->priority = %x\n", + netdev_info(ieee->dev, "converted skb->priority = %x\n", skb->priority); } qos_ctl |= skb->priority; @@ -760,8 +760,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) txb = rtllib_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC); if (unlikely(!txb)) { - printk(KERN_WARNING "%s: Could not allocate TXB\n", - ieee->dev->name); + netdev_warn(ieee->dev, "Could not allocate TXB\n"); goto failed; } txb->encrypted = encrypt; @@ -858,15 +857,14 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } } else { if (unlikely(skb->len < sizeof(struct rtllib_hdr_3addr))) { - printk(KERN_WARNING "%s: skb too small (%d).\n", - ieee->dev->name, skb->len); + netdev_warn(ieee->dev, "skb too small (%d).\n", + skb->len); goto success; } txb = rtllib_alloc_txb(1, skb->len, GFP_ATOMIC); if (!txb) { - printk(KERN_WARNING "%s: Could not allocate TXB\n", - ieee->dev->name); + netdev_warn(ieee->dev, "Could not allocate TXB\n"); goto failed; } diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 5bf8ea14b805..a1cae3748ae6 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -389,9 +389,9 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, kfree(new_crypt); new_crypt = NULL; - netdev_warn(dev, "%s: could not initialize WEP: " - "load module rtllib_crypt_wep\n", - dev->name); + netdev_warn(dev, + "%s: could not initialize WEP: load module rtllib_crypt_wep\n", + dev->name); return -EOPNOTSUPP; } *crypt = new_crypt; -- cgit v1.2.3 From 7b979cda818948e4994fd2ab4081c129cc6194a5 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:53 +0100 Subject: staging: rtl8192e: remove rtllib_endianfree.h rtllib_endianfree.h was not used (only included) Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_Qos.h | 2 - drivers/staging/rtl8192e/rtllib_endianfree.h | 122 --------------------------- 2 files changed, 124 deletions(-) delete mode 100644 drivers/staging/rtl8192e/rtllib_endianfree.h (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl819x_Qos.h b/drivers/staging/rtl8192e/rtl819x_Qos.h index 973342b8a06d..74f414129c55 100644 --- a/drivers/staging/rtl8192e/rtl819x_Qos.h +++ b/drivers/staging/rtl8192e/rtl819x_Qos.h @@ -19,8 +19,6 @@ #ifndef __INC_QOS_TYPE_H #define __INC_QOS_TYPE_H -#include "rtllib_endianfree.h" - #define BIT0 0x00000001 #define BIT1 0x00000002 #define BIT2 0x00000004 diff --git a/drivers/staging/rtl8192e/rtllib_endianfree.h b/drivers/staging/rtl8192e/rtllib_endianfree.h deleted file mode 100644 index b189fa5a45e4..000000000000 --- a/drivers/staging/rtl8192e/rtllib_endianfree.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef __INC_ENDIANFREE_H -#define __INC_ENDIANFREE_H - -/* - * Call endian free function when - * 1. Read/write packet content. - * 2. Before write integer to IO. - * 3. After read integer from IO. - */ - -#define __MACHINE_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define __MACHINE_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net, ppc */ - -#define BYTE_ORDER __MACHINE_LITTLE_ENDIAN - -#if BYTE_ORDER == __MACHINE_LITTLE_ENDIAN -#define EF1Byte(_val) ((u8)(_val)) -#define EF2Byte(_val) ((u16)(_val)) -#define EF4Byte(_val) ((u32)(_val)) - -#else -#define EF1Byte(_val) ((u8)(_val)) -#define EF2Byte(_val) \ - (((((u16)(_val))&0x00ff)<<8)|((((u16)(_val))&0xff00)>>8)) -#define EF4Byte(_val) \ - (((((u32)(_val))&0x000000ff)<<24)|\ - ((((u32)(_val))&0x0000ff00)<<8)|\ - ((((u32)(_val))&0x00ff0000)>>8)|\ - ((((u32)(_val))&0xff000000)>>24)) -#endif - -#define ReadEF1Byte(_ptr) EF1Byte(*((u8 *)(_ptr))) -#define ReadEF2Byte(_ptr) EF2Byte(*((u16 *)(_ptr))) -#define ReadEF4Byte(_ptr) EF4Byte(*((u32 *)(_ptr))) - -#define WriteEF1Byte(_ptr, _val) ((*((u8 *)(_ptr))) = EF1Byte(_val)) -#define WriteEF2Byte(_ptr, _val) ((*((u16 *)(_ptr))) = EF2Byte(_val)) -#define WriteEF4Byte(_ptr, _val) ((*((u32 *)(_ptr))) = EF4Byte(_val)) -#if BYTE_ORDER == __MACHINE_LITTLE_ENDIAN -#define H2N1BYTE(_val) ((u8)(_val)) -#define H2N2BYTE(_val) (((((u16)(_val))&0x00ff)<<8)|\ - ((((u16)(_val))&0xff00)>>8)) -#define H2N4BYTE(_val) (((((u32)(_val))&0x000000ff)<<24)|\ - ((((u32)(_val))&0x0000ff00)<<8) |\ - ((((u32)(_val))&0x00ff0000)>>8) |\ - ((((u32)(_val))&0xff000000)>>24)) -#else -#define H2N1BYTE(_val) ((u8)(_val)) -#define H2N2BYTE(_val) ((u16)(_val)) -#define H2N4BYTE(_val) ((u32)(_val)) -#endif - -#if BYTE_ORDER == __MACHINE_LITTLE_ENDIAN -#define N2H1BYTE(_val) ((u8)(_val)) -#define N2H2BYTE(_val) (((((u16)(_val))&0x00ff)<<8)|\ - ((((u16)(_val))&0xff00)>>8)) -#define N2H4BYTE(_val) (((((u32)(_val))&0x000000ff)<<24)|\ - ((((u32)(_val))&0x0000ff00)<<8) |\ - ((((u32)(_val))&0x00ff0000)>>8) |\ - ((((u32)(_val))&0xff000000)>>24)) -#else -#define N2H1BYTE(_val) ((u8)(_val)) -#define N2H2BYTE(_val) ((u16)(_val)) -#define N2H4BYTE(_val) ((u32)(_val)) -#endif - -#define BIT_LEN_MASK_32(__BitLen) (0xFFFFFFFF >> (32 - (__BitLen))) -#define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) \ - (BIT_LEN_MASK_32(__BitLen) << (__BitOffset)) - -#define LE_P4BYTE_TO_HOST_4BYTE(__pStart) (EF4Byte(*((u32 *)(__pStart)))) - -#define LE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen) \ - ( \ - (LE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset)) \ - & \ - BIT_LEN_MASK_32(__BitLen) \ - ) - -#define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \ - ( \ - LE_P4BYTE_TO_HOST_4BYTE(__pStart) \ - & \ - (~BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen)) \ - ) - -#define BIT_LEN_MASK_16(__BitLen) \ - (0xFFFF >> (16 - (__BitLen))) - -#define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) \ - (BIT_LEN_MASK_16(__BitLen) << (__BitOffset)) - -#define LE_P2BYTE_TO_HOST_2BYTE(__pStart) \ - (EF2Byte(*((u16 *)(__pStart)))) - -#define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \ - ( \ - (LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset)) \ - & \ - BIT_LEN_MASK_16(__BitLen) \ - ) - -#define BIT_LEN_MASK_8(__BitLen) \ - (0xFF >> (8 - (__BitLen))) - -#define BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) \ - (BIT_LEN_MASK_8(__BitLen) << (__BitOffset)) - -#define LE_P1BYTE_TO_HOST_1BYTE(__pStart) \ - (EF1Byte(*((u8 *)(__pStart)))) - -#define LE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen) \ - ( \ - (LE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset)) \ - & \ - BIT_LEN_MASK_8(__BitLen) \ - ) - -#define N_BYTE_ALIGMENT(__Value, __Aligment) \ - ((__Aligment == 1) ? (__Value) : (((__Value + __Aligment - 1) / \ - __Aligment) * __Aligment)) -#endif -- cgit v1.2.3 From 7527cf3710b82a07bbc608e91b7de0c2696bf74a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:54 +0100 Subject: staging: rtl8192e: remove dead code Remove commented-out unions and enum. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_HT.h | 34 ---------------------------------- drivers/staging/rtl8192e/rtllib.h | 12 ------------ 2 files changed, 46 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h index 193c872bf081..a1cc86ecee0a 100644 --- a/drivers/staging/rtl8192e/rtl819x_HT.h +++ b/drivers/staging/rtl8192e/rtl819x_HT.h @@ -80,40 +80,6 @@ enum chnl_op { #define CHHLOP_IN_PROGRESS(_pHTInfo) \ (((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false) -/* -union ht_capability { - u16 ShortData; - u8 CharData[2]; - struct - { - u16 AdvCoding:1; - u16 ChlWidth:1; - u16 MimoPwrSave:2; - u16 GreenField:1; - u16 ShortGI20Mhz:1; - u16 ShortGI40Mhz:1; - u16 STBC:1; - u16 BeamForm:1; - u16 DelayBA:1; - u16 MaxAMSDUSize:1; - u16 DssCCk:1; - u16 PSMP:1; - u16 Rsvd:3; - }Field; -}; - -union ht_capability_macpara { - u8 ShortData; - u8 CharData[1]; - struct - { - u8 MaxRxAMPDU:2; - u8 MPDUDensity:2; - u8 Rsvd:4; - }Field; -}; -*/ - enum ht_action { ACT_RECOMMAND_WIDTH = 0, ACT_MIMO_PWR_SAVE = 1, diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 3e437ea7b85d..92edce5ff418 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1649,7 +1649,6 @@ struct rtllib_network { struct list_head list; }; -#if 1 enum rtllib_state { /* the card is not linked at all */ @@ -1687,17 +1686,6 @@ enum rtllib_state { */ RTLLIB_LINKED_SCANNING, }; -#else -enum rtllib_state { - RTLLIB_UNINITIALIZED = 0, - RTLLIB_INITIALIZED, - RTLLIB_ASSOCIATING, - RTLLIB_ASSOCIATED, - RTLLIB_AUTHENTICATING, - RTLLIB_AUTHENTICATED, - RTLLIB_SHUTDOWN -}; -#endif #define DEFAULT_MAX_SCAN_AGE (15 * HZ) #define DEFAULT_FTS 2346 -- cgit v1.2.3 From 7e4eb9fdf2a1188cd4fce1945a5ba8c65fe91498 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:55 +0100 Subject: staging: rtl8192e: remove unused macros Several (unused) macros were removed from driver. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/dot11d.h | 6 ------ drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ---- drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 8 -------- drivers/staging/rtl8192e/rtl819x_HT.h | 3 --- drivers/staging/rtl8192e/rtl819x_Qos.h | 16 ---------------- drivers/staging/rtl8192e/rtllib.h | 3 --- 6 files changed, 40 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index eeea50260f1d..f15408a09584 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -78,12 +78,6 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src) #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \ cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) -#define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ - (((__Ie).Length == 0 || (__Ie).Length != \ - GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ - false : (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, \ - (__Ie).Octet, (__Ie).Length))) - #define CIE_WATCHDOG_TH 1 #define GET_CIE_WATCHDOG(__pIeeeDev) \ (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 113e42f00c75..d365af6ebdc7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -100,10 +100,6 @@ #define IS_ADAPTER_SENDS_BEACON(dev) 0 -#define IS_UNDER_11N_AES_MODE(_rtllib) \ - ((_rtllib->pHTInfo->bCurrentHTSupport == true) && \ - (_rtllib->pairwise_key_type == KEY_TYPE_CCMP)) - #define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000 #define HAL_HW_PCI_REVISION_ID_8190PCI 0x00 #define HAL_MEMORY_MAPPED_IO_RANGE_8192PCIE 0x4000 diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index ab44a9a6927c..3f02e11cfc57 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -255,14 +255,6 @@ extern u8 test_flag; /*------------------------Export global variable----------------------------*/ -/*------------------------Export Marco Definition---------------------------*/ -#define DM_APInitGainChangeNotify(Event) \ - { \ - dm_digtable.CurAPConnectState = Event; \ - } -/*------------------------Export Marco Definition---------------------------*/ - - /*--------------------------Exported Function prototype---------------------*/ /*--------------------------Exported Function prototype---------------------*/ extern void init_hal_dm(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h index a1cc86ecee0a..cc754e86997a 100644 --- a/drivers/staging/rtl8192e/rtl819x_HT.h +++ b/drivers/staging/rtl8192e/rtl819x_HT.h @@ -77,9 +77,6 @@ enum chnl_op { CHNLOP_SWCHNL = 3, }; -#define CHHLOP_IN_PROGRESS(_pHTInfo) \ - (((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false) - enum ht_action { ACT_RECOMMAND_WIDTH = 0, ACT_MIMO_PWR_SAVE = 1, diff --git a/drivers/staging/rtl8192e/rtl819x_Qos.h b/drivers/staging/rtl8192e/rtl819x_Qos.h index 74f414129c55..55ef7ec33f65 100644 --- a/drivers/staging/rtl8192e/rtl819x_Qos.h +++ b/drivers/staging/rtl8192e/rtl819x_Qos.h @@ -338,18 +338,6 @@ struct sta_qos { }; #define QBSS_LOAD_SIZE 5 -#define GET_QBSS_LOAD_STA_COUNT(__pStart) \ - ReadEF2Byte(__pStart) -#define SET_QBSS_LOAD_STA_COUNT(__pStart, __Value) \ - WriteEF2Byte(__pStart, __Value) -#define GET_QBSS_LOAD_CHNL_UTILIZATION(__pStart) \ - ReadEF1Byte((u8 *)(__pStart) + 2) -#define SET_QBSS_LOAD_CHNL_UTILIZATION(__pStart, __Value) \ - WriteEF1Byte((u8 *)(__pStart) + 2, __Value) -#define GET_QBSS_LOAD_AVAILABLE_CAPACITY(__pStart) \ - ReadEF2Byte((u8 *)(__pStart) + 3) -#define SET_QBSS_LOAD_AVAILABLE_CAPACITY(__pStart, __Value) \ - WriteEF2Byte((u8 *)(__pStart) + 3, __Value) struct bss_qos { QOS_MODE bdQoSMode; @@ -365,10 +353,6 @@ struct bss_qos { bool bQBssLoadValid; }; -#define sQoSCtlLng 2 -#define QOS_CTRL_LEN(_QosMode) ((_QosMode > QOS_DISABLE) ? sQoSCtlLng : 0) - - #define IsACValid(ac) ((ac >= 0 && ac <= 7) ? true : false) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 92edce5ff418..2f058041c738 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -482,9 +482,6 @@ enum rt_op_mode { #define IEEE_CRYPT_ALG_NAME_LEN 16 #define MAX_IE_LEN 0xff -#define RT_ASSERT_RET(_Exp) do {} while (0) -#define RT_ASSERT_RET_VALUE(_Exp, Ret) \ - do {} while (0) struct ieee_param { u32 cmd; -- cgit v1.2.3 From 34fff6db29eac1f0c48ff3ab95db9b24ffd6c51a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:56 +0100 Subject: staging: rtl8192e: rtllib.h: remove duplicated container_of This macro is already defined in kernel.h - there is no need to redefine it. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 2f058041c738..dd12218941ac 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -66,20 +66,6 @@ #define IW_CUSTOM_MAX 256 /* In bytes */ #endif -#ifndef container_of -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof(((type *)0)->member)*__mptr = (ptr); \ - (type *)((char *)__mptr - offsetof(type, member)); }) -#endif - #define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb) #define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x) -- cgit v1.2.3 From e48617a48c26aae074b99c939740597206955093 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:57 +0100 Subject: staging: rtl8192e: remove eqMacAddr macro Remove eqMacAddr macro and replace it with ether_addr_equal_unaligned() Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/dot11d.h | 3 ++- drivers/staging/rtl8192e/rtllib.h | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index f15408a09584..aad3394392fe 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -74,7 +74,8 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \ - eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) + ether_addr_equal_unaligned(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, \ + __pTa) #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \ cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index dd12218941ac..dc9f675150e7 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1686,11 +1686,6 @@ enum rtllib_state { #define RTLLIB_52GHZ_MAX_CHANNEL 165 #define RTLLIB_52GHZ_CHANNELS (RTLLIB_52GHZ_MAX_CHANNEL - \ RTLLIB_52GHZ_MIN_CHANNEL + 1) -#ifndef eqMacAddr -#define eqMacAddr(a, b) \ - (((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && \ - (a)[3] == (b)[3] && (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0) -#endif struct tx_pending { int frag; struct rtllib_txb *txb; -- cgit v1.2.3 From a8f4f33a4f8e5bd0e6b46f29ac74082d0684d9e3 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 17 Mar 2015 00:00:58 +0100 Subject: staging: rtl8192e: remove CURRENT_RATE macro CURRENT_RATE macro is used only once in driver. This patch removes it and adds rtllib_current_rate() static function in file using that macro Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_HT.h | 10 ---------- drivers/staging/rtl8192e/rtllib_tx.c | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h index cc754e86997a..f7076d7ddc53 100644 --- a/drivers/staging/rtl8192e/rtl819x_HT.h +++ b/drivers/staging/rtl8192e/rtl819x_HT.h @@ -343,16 +343,6 @@ struct false_alarm_stats { extern u8 MCS_FILTER_ALL[16]; extern u8 MCS_FILTER_1SS[16]; -#define PICK_RATE(_nLegacyRate, _nMcsRate) \ - ((_nMcsRate == 0) ? (_nLegacyRate&0x7f) : (_nMcsRate)) -#define LEGACY_WIRELESS_MODE IEEE_MODE_MASK - -#define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \ - (((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \ - (LegacyRate) : (PICK_RATE(LegacyRate, HTRate))) - - - #define RATE_ADPT_1SS_MASK 0xFF #define RATE_ADPT_2SS_MASK 0xF0 #define RATE_ADPT_MCS32_MASK 0x01 diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 7c0af26f267e..f6d0257e4c9b 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -550,6 +550,17 @@ static int wme_downgrade_ac(struct sk_buff *skb) } } +static u8 rtllib_current_rate(struct rtllib_device *ieee) +{ + if (ieee->mode & IEEE_MODE_MASK) + return ieee->rate; + + if (ieee->HTCurrentOperaRate) + return ieee->HTCurrentOperaRate; + else + return ieee->rate & 0x7F; +} + int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) { struct rtllib_device *ieee = (struct rtllib_device *) @@ -904,8 +915,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) if (tcb_desc->bMulticast || tcb_desc->bBroadcast) tcb_desc->data_rate = ieee->basic_rate; else - tcb_desc->data_rate = CURRENT_RATE(ieee->mode, - ieee->rate, ieee->HTCurrentOperaRate); + tcb_desc->data_rate = rtllib_current_rate(ieee); if (bdhcp) { if (ieee->pHTInfo->IOTAction & -- cgit v1.2.3 From f6b43c2e85c631a05ab8aece0cbde5e12deb0701 Mon Sep 17 00:00:00 2001 From: Sven Dziadek Date: Thu, 19 Mar 2015 20:42:48 +0100 Subject: Staging: wlan-ng: hfa384x: wrap long line This fixes the coding style issue "line over 80 characters" found by checkpatch.pl Signed-off-by: Sven Dziadek Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h index 8f2091070491..73c646bc50d9 100644 --- a/drivers/staging/wlan-ng/hfa384x.h +++ b/drivers/staging/wlan-ng/hfa384x.h @@ -1413,7 +1413,8 @@ int hfa384x_drvr_start(hfa384x_t *hw); int hfa384x_drvr_stop(hfa384x_t *hw); int hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, - union p80211_hdr *p80211_hdr, struct p80211_metawep *p80211_wep); + union p80211_hdr *p80211_hdr, + struct p80211_metawep *p80211_wep); void hfa384x_tx_timeout(wlandevice_t *wlandev); int hfa384x_cmd_initialize(hfa384x_t *hw); -- cgit v1.2.3 From c950a892cc302336d2a0900eba6d40ac0fb7cacb Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 18 Mar 2015 23:13:04 +0530 Subject: Staging: speakup: Add helper macro for spk_synth boilerplate For simple modules that contain a single spk_synth without any additional setup code then ends up being a block of duplicated boilerplate. This patch adds a new macro, module_spk_synth(), which replaces the module_init()/module_exit() registrations with template functions. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_types.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h index 8c565c94b8b2..55d6c9b3b472 100644 --- a/drivers/staging/speakup/spk_types.h +++ b/drivers/staging/speakup/spk_types.h @@ -16,6 +16,7 @@ #include #include #include /* for inb_p, outb_p, inb, outb, etc... */ +#include enum var_type_t { VAR_NUM = 0, @@ -179,6 +180,16 @@ struct spk_synth { struct attribute_group attributes; }; +/** + * module_spk_synth() - Helper macro for registering a speakup driver + * @__spk_synth: spk_synth struct + * Helper macro for speakup drivers which do not do anything special in module + * init/exit. This eliminates a lot of boilerplate. Each module may only + * use this macro once, and calling it replaces module_init() and module_exit() + */ +#define module_spk_synth(__spk_synth) \ + module_driver(__spk_synth, synth_add, synth_remove) + struct speakup_info_t { spinlock_t spinlock; int port_tts; -- cgit v1.2.3 From ae89faccc6bae384f10a0efd7fec001e89b15e63 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 18 Mar 2015 23:13:10 +0530 Subject: Staging: speakup: Use module_spk_synth Macro module_spk_synth can be used for speakup drivers whose init and exit paths does only module registrations. So, here remove some boilerplate code by using module_spk_synth. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/speakup_acntpc.c | 12 +----------- drivers/staging/speakup/speakup_acntsa.c | 12 +----------- drivers/staging/speakup/speakup_apollo.c | 12 +----------- drivers/staging/speakup/speakup_audptr.c | 12 +----------- drivers/staging/speakup/speakup_bns.c | 12 +----------- drivers/staging/speakup/speakup_decext.c | 12 +----------- drivers/staging/speakup/speakup_decpc.c | 12 +----------- drivers/staging/speakup/speakup_dectlk.c | 12 +----------- drivers/staging/speakup/speakup_dtlk.c | 12 +----------- drivers/staging/speakup/speakup_dummy.c | 12 +----------- drivers/staging/speakup/speakup_keypc.c | 12 +----------- drivers/staging/speakup/speakup_ltlk.c | 12 +----------- drivers/staging/speakup/speakup_soft.c | 13 +------------ drivers/staging/speakup/speakup_spkout.c | 12 +----------- drivers/staging/speakup/speakup_txprt.c | 12 +----------- 15 files changed, 15 insertions(+), 166 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/speakup_acntpc.c b/drivers/staging/speakup/speakup_acntpc.c index f0bfd9e99191..f418893928ec 100644 --- a/drivers/staging/speakup/speakup_acntpc.c +++ b/drivers/staging/speakup/speakup_acntpc.c @@ -318,18 +318,8 @@ module_param_named(start, synth_acntpc.startup, short, S_IRUGO); MODULE_PARM_DESC(port, "Set the port for the synthesizer (override probing)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init acntpc_init(void) -{ - return synth_add(&synth_acntpc); -} - -static void __exit acntpc_exit(void) -{ - synth_remove(&synth_acntpc); -} +module_spk_synth(synth_acntpc); -module_init(acntpc_init); -module_exit(acntpc_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for Accent PC synthesizer"); diff --git a/drivers/staging/speakup/speakup_acntsa.c b/drivers/staging/speakup/speakup_acntsa.c index 3f2b5698a3d8..af2690f38950 100644 --- a/drivers/staging/speakup/speakup_acntsa.c +++ b/drivers/staging/speakup/speakup_acntsa.c @@ -143,18 +143,8 @@ module_param_named(start, synth_acntsa.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init acntsa_init(void) -{ - return synth_add(&synth_acntsa); -} - -static void __exit acntsa_exit(void) -{ - synth_remove(&synth_acntsa); -} +module_spk_synth(synth_acntsa); -module_init(acntsa_init); -module_exit(acntsa_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for Accent SA synthesizer"); diff --git a/drivers/staging/speakup/speakup_apollo.c b/drivers/staging/speakup/speakup_apollo.c index 678b263e551c..51788f7d4480 100644 --- a/drivers/staging/speakup/speakup_apollo.c +++ b/drivers/staging/speakup/speakup_apollo.c @@ -207,18 +207,8 @@ module_param_named(start, synth_apollo.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init apollo_init(void) -{ - return synth_add(&synth_apollo); -} - -static void __exit apollo_exit(void) -{ - synth_remove(&synth_apollo); -} +module_spk_synth(synth_apollo); -module_init(apollo_init); -module_exit(apollo_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for Apollo II synthesizer"); diff --git a/drivers/staging/speakup/speakup_audptr.c b/drivers/staging/speakup/speakup_audptr.c index 5cbaec8335fe..ea89e36ecd0d 100644 --- a/drivers/staging/speakup/speakup_audptr.c +++ b/drivers/staging/speakup/speakup_audptr.c @@ -177,18 +177,8 @@ module_param_named(start, synth_audptr.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init audptr_init(void) -{ - return synth_add(&synth_audptr); -} - -static void __exit audptr_exit(void) -{ - synth_remove(&synth_audptr); -} +module_spk_synth(synth_audptr); -module_init(audptr_init); -module_exit(audptr_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for Audapter synthesizer"); diff --git a/drivers/staging/speakup/speakup_bns.c b/drivers/staging/speakup/speakup_bns.c index 2f070282a85d..80f8358d4199 100644 --- a/drivers/staging/speakup/speakup_bns.c +++ b/drivers/staging/speakup/speakup_bns.c @@ -127,18 +127,8 @@ module_param_named(start, synth_bns.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init bns_init(void) -{ - return synth_add(&synth_bns); -} +module_spk_synth(synth_bns); -static void __exit bns_exit(void) -{ - synth_remove(&synth_bns); -} - -module_init(bns_init); -module_exit(bns_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for Braille 'n Speak synthesizers"); diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c index 555029036dc2..2b772f8522f1 100644 --- a/drivers/staging/speakup/speakup_decext.c +++ b/drivers/staging/speakup/speakup_decext.c @@ -234,18 +234,8 @@ module_param_named(start, synth_decext.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init decext_init(void) -{ - return synth_add(&synth_decext); -} - -static void __exit decext_exit(void) -{ - synth_remove(&synth_decext); -} +module_spk_synth(synth_decext); -module_init(decext_init); -module_exit(decext_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for DECtalk External synthesizers"); diff --git a/drivers/staging/speakup/speakup_decpc.c b/drivers/staging/speakup/speakup_decpc.c index 7c9c432e48d9..f7b9c8a3a1a5 100644 --- a/drivers/staging/speakup/speakup_decpc.c +++ b/drivers/staging/speakup/speakup_decpc.c @@ -491,18 +491,8 @@ module_param_named(start, synth_dec_pc.startup, short, S_IRUGO); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init decpc_init(void) -{ - return synth_add(&synth_dec_pc); -} - -static void __exit decpc_exit(void) -{ - synth_remove(&synth_dec_pc); -} +module_spk_synth(synth_dec_pc); -module_init(decpc_init); -module_exit(decpc_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for DECtalk PC synthesizers"); diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c index 69e7c2b41b94..b5a23d42f4d5 100644 --- a/drivers/staging/speakup/speakup_dectlk.c +++ b/drivers/staging/speakup/speakup_dectlk.c @@ -306,18 +306,8 @@ module_param_named(start, synth_dectlk.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init dectlk_init(void) -{ - return synth_add(&synth_dectlk); -} - -static void __exit dectlk_exit(void) -{ - synth_remove(&synth_dectlk); -} +module_spk_synth(synth_dectlk); -module_init(dectlk_init); -module_exit(dectlk_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for DECtalk Express synthesizers"); diff --git a/drivers/staging/speakup/speakup_dtlk.c b/drivers/staging/speakup/speakup_dtlk.c index 89592c0b9151..345efd3344b0 100644 --- a/drivers/staging/speakup/speakup_dtlk.c +++ b/drivers/staging/speakup/speakup_dtlk.c @@ -388,18 +388,8 @@ module_param_named(start, synth_dtlk.startup, short, S_IRUGO); MODULE_PARM_DESC(port, "Set the port for the synthesizer (override probing)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init dtlk_init(void) -{ - return synth_add(&synth_dtlk); -} - -static void __exit dtlk_exit(void) -{ - synth_remove(&synth_dtlk); -} +module_spk_synth(synth_dtlk); -module_init(dtlk_init); -module_exit(dtlk_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for DoubleTalk PC synthesizers"); diff --git a/drivers/staging/speakup/speakup_dummy.c b/drivers/staging/speakup/speakup_dummy.c index 362342a194af..f66811269475 100644 --- a/drivers/staging/speakup/speakup_dummy.c +++ b/drivers/staging/speakup/speakup_dummy.c @@ -129,18 +129,8 @@ module_param_named(start, synth_dummy.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init dummy_init(void) -{ - return synth_add(&synth_dummy); -} +module_spk_synth(synth_dummy); -static void __exit dummy_exit(void) -{ - synth_remove(&synth_dummy); -} - -module_init(dummy_init); -module_exit(dummy_exit); MODULE_AUTHOR("Samuel Thibault "); MODULE_DESCRIPTION("Speakup support for text console"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/speakup/speakup_keypc.c b/drivers/staging/speakup/speakup_keypc.c index cef20fdda646..6ea027365664 100644 --- a/drivers/staging/speakup/speakup_keypc.c +++ b/drivers/staging/speakup/speakup_keypc.c @@ -319,18 +319,8 @@ module_param_named(start, synth_keypc.startup, short, S_IRUGO); MODULE_PARM_DESC(port, "Set the port for the synthesizer (override probing)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init keypc_init(void) -{ - return synth_add(&synth_keypc); -} - -static void __exit keypc_exit(void) -{ - synth_remove(&synth_keypc); -} +module_spk_synth(synth_keypc); -module_init(keypc_init); -module_exit(keypc_exit); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for Keynote Gold PC synthesizers"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/speakup/speakup_ltlk.c b/drivers/staging/speakup/speakup_ltlk.c index 377a6e2b8b93..cc4806be806b 100644 --- a/drivers/staging/speakup/speakup_ltlk.c +++ b/drivers/staging/speakup/speakup_ltlk.c @@ -175,18 +175,8 @@ module_param_named(start, synth_ltlk.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init ltlk_init(void) -{ - return synth_add(&synth_ltlk); -} - -static void __exit ltlk_exit(void) -{ - synth_remove(&synth_ltlk); -} +module_spk_synth(synth_ltlk); -module_init(ltlk_init); -module_exit(ltlk_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for DoubleTalk LT/LiteTalk synthesizers"); diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c index e6e93fbd183a..fb31bb95d83a 100644 --- a/drivers/staging/speakup/speakup_soft.c +++ b/drivers/staging/speakup/speakup_soft.c @@ -350,19 +350,8 @@ module_param_named(start, synth_soft.startup, short, S_IRUGO); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); +module_spk_synth(synth_soft); -static int __init soft_init(void) -{ - return synth_add(&synth_soft); -} - -static void __exit soft_exit(void) -{ - synth_remove(&synth_soft); -} - -module_init(soft_init); -module_exit(soft_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_DESCRIPTION("Speakup userspace software synthesizer support"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/speakup/speakup_spkout.c b/drivers/staging/speakup/speakup_spkout.c index bccddf8b89fd..1007a6168c3c 100644 --- a/drivers/staging/speakup/speakup_spkout.c +++ b/drivers/staging/speakup/speakup_spkout.c @@ -146,18 +146,8 @@ module_param_named(start, synth_spkout.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init spkout_init(void) -{ - return synth_add(&synth_spkout); -} - -static void __exit spkout_exit(void) -{ - synth_remove(&synth_spkout); -} +module_spk_synth(synth_spkout); -module_init(spkout_init); -module_exit(spkout_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for Speak Out synthesizers"); diff --git a/drivers/staging/speakup/speakup_txprt.c b/drivers/staging/speakup/speakup_txprt.c index dbe84b13772c..6c21e7112210 100644 --- a/drivers/staging/speakup/speakup_txprt.c +++ b/drivers/staging/speakup/speakup_txprt.c @@ -127,18 +127,8 @@ module_param_named(start, synth_txprt.startup, short, S_IRUGO); MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); -static int __init txprt_init(void) -{ - return synth_add(&synth_txprt); -} +module_spk_synth(synth_txprt); -static void __exit txprt_exit(void) -{ - synth_remove(&synth_txprt); -} - -module_init(txprt_init); -module_exit(txprt_exit); MODULE_AUTHOR("Kirk Reiser "); MODULE_AUTHOR("David Borowski"); MODULE_DESCRIPTION("Speakup support for Transport synthesizers"); -- cgit v1.2.3 From 7ef4ec4a653c2fb71d70e5c23bf2f37253b5da01 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 19 Mar 2015 02:26:58 +0530 Subject: Staging: rts5208: Introduce a new variable to shorten line length and increase readability The variable block_no is introduced so as to shorten line length in the long assignment statement and increase readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/ms.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c index 7638f802a878..5a9321b4d798 100644 --- a/drivers/staging/rts5208/ms.c +++ b/drivers/staging/rts5208/ms.c @@ -2030,6 +2030,8 @@ static int ms_init_l2p_tbl(struct rtsx_chip *chip) reg_addr = PPBUF_BASE2; for (i = 0; i < (((ms_card->total_block >> 9) * 10) + 1); i++) { + int block_no; + retval = rtsx_read_register(chip, reg_addr++, &val1); if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, INIT_FAIL); @@ -2043,7 +2045,9 @@ static int ms_init_l2p_tbl(struct rtsx_chip *chip) break; seg_no = defect_block / 512; - ms_card->segment[seg_no].defect_list[ms_card->segment[seg_no].disable_count++] = defect_block; + + block_no = ms_card->segment[seg_no].disable_count++; + ms_card->segment[seg_no].defect_list[block_no] = defect_block; } for (i = 0; i < ms_card->segment_cnt; i++) { -- cgit v1.2.3 From 127883b803c7c602a348c49963b4b10cd2d21e92 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 19 Mar 2015 03:14:15 +0530 Subject: Staging: rts5208: Add new variable idx to shorten line length and increase readability Add new variable idx to shorten line length of other statements and increase readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/ms.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c index 5a9321b4d798..4c38ff9d9a76 100644 --- a/drivers/staging/rts5208/ms.c +++ b/drivers/staging/rts5208/ms.c @@ -2194,7 +2194,7 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) struct zone_entry *segment; bool defect_flag; int retval, table_size, disable_cnt, i; - u16 start, end, phy_blk, log_blk, tmp_blk; + u16 start, end, phy_blk, log_blk, tmp_blk, idx; u8 extra[MS_EXTRA_SIZE], us1, us2; dev_dbg(rtsx_dev(chip), "ms_build_l2p_tbl: %d\n", seg_no); @@ -2305,13 +2305,15 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) continue; } - if (segment->l2p_table[log_blk - ms_start_idx[seg_no]] == 0xFFFF) { - segment->l2p_table[log_blk - ms_start_idx[seg_no]] = phy_blk; + idx = log_blk - ms_start_idx[seg_no]; + + if (segment->l2p_table[idx] == 0xFFFF) { + segment->l2p_table[idx] = phy_blk; continue; } us1 = extra[0] & 0x10; - tmp_blk = segment->l2p_table[log_blk - ms_start_idx[seg_no]]; + tmp_blk = segment->l2p_table[idx]; retval = ms_read_extra_data(chip, tmp_blk, 0, extra, MS_EXTRA_SIZE); if (retval != STATUS_SUCCESS) @@ -2342,7 +2344,8 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) for (log_blk = ms_start_idx[seg_no]; log_blk < ms_start_idx[seg_no + 1]; log_blk++) { - if (segment->l2p_table[log_blk-ms_start_idx[seg_no]] == 0xFFFF) { + idx = log_blk - ms_start_idx[seg_no]; + if (segment->l2p_table[idx] == 0xFFFF) { phy_blk = ms_get_unused_block(chip, seg_no); if (phy_blk == 0xFFFF) { chip->card_wp |= MS_CARD; @@ -2352,7 +2355,7 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) if (retval != STATUS_SUCCESS) TRACE_GOTO(chip, BUILD_FAIL); - segment->l2p_table[log_blk-ms_start_idx[seg_no]] = phy_blk; + segment->l2p_table[idx] = phy_blk; if (seg_no == ms_card->segment_cnt - 1) { if (segment->unused_blk_cnt < 2) { chip->card_wp |= MS_CARD; -- cgit v1.2.3 From 5ce019df9bf983caa65643e1589b96fef47cb35b Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 19 Mar 2015 13:25:06 +0530 Subject: Staging: rtl8188eu: Remove unused extern declarations. These externs are defined but not used anywhere in the code. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/rtw_security.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/include/rtw_security.h b/drivers/staging/rtl8188eu/include/rtw_security.h index 66d60aaf4ae8..a00d1e645a43 100644 --- a/drivers/staging/rtl8188eu/include/rtw_security.h +++ b/drivers/staging/rtl8188eu/include/rtw_security.h @@ -245,10 +245,6 @@ struct mic_data { }; extern const u32 Te0[256]; -extern const u32 Te1[256]; -extern const u32 Te2[256]; -extern const u32 Te3[256]; -extern const u32 Te4[256]; extern const u32 Td0[256]; extern const u32 Td1[256]; extern const u32 Td2[256]; -- cgit v1.2.3 From 680355f3d49624fc9bd9a7d40857b04e74c6c264 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 19 Mar 2015 13:25:12 +0530 Subject: Staging: rtl8188eu: Remove unused macros These macros are defined but never used in the code. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/rtw_security.h | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/include/rtw_security.h b/drivers/staging/rtl8188eu/include/rtw_security.h index a00d1e645a43..e9723a72af5e 100644 --- a/drivers/staging/rtl8188eu/include/rtw_security.h +++ b/drivers/staging/rtl8188eu/include/rtw_security.h @@ -265,28 +265,6 @@ static inline u32 rotr(u32 val, int bits) #define TE1(i) rotr(Te0[((i) >> 16) & 0xff], 8) #define TE2(i) rotr(Te0[((i) >> 8) & 0xff], 16) #define TE3(i) rotr(Te0[(i) & 0xff], 24) -#define TE41(i) ((Te0[((i) >> 24) & 0xff] << 8) & 0xff000000) -#define TE42(i) (Te0[((i) >> 16) & 0xff] & 0x00ff0000) -#define TE43(i) (Te0[((i) >> 8) & 0xff] & 0x0000ff00) -#define TE44(i) ((Te0[(i) & 0xff] >> 8) & 0x000000ff) -#define TE421(i) ((Te0[((i) >> 16) & 0xff] << 8) & 0xff000000) -#define TE432(i) (Te0[((i) >> 8) & 0xff] & 0x00ff0000) -#define TE443(i) (Te0[(i) & 0xff] & 0x0000ff00) -#define TE414(i) ((Te0[((i) >> 24) & 0xff] >> 8) & 0x000000ff) -#define TE4(i) ((Te0[(i)] >> 8) & 0x000000ff) - -#define TD0(i) Td0[((i) >> 24) & 0xff] -#define TD1(i) rotr(Td0[((i) >> 16) & 0xff], 8) -#define TD2(i) rotr(Td0[((i) >> 8) & 0xff], 16) -#define TD3(i) rotr(Td0[(i) & 0xff], 24) -#define TD41(i) (Td4s[((i) >> 24) & 0xff] << 24) -#define TD42(i) (Td4s[((i) >> 16) & 0xff] << 16) -#define TD43(i) (Td4s[((i) >> 8) & 0xff] << 8) -#define TD44(i) (Td4s[(i) & 0xff]) -#define TD0_(i) Td0[(i) & 0xff] -#define TD1_(i) rotr(Td0[(i) & 0xff], 8) -#define TD2_(i) rotr(Td0[(i) & 0xff], 16) -#define TD3_(i) rotr(Td0[(i) & 0xff], 24) #define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ \ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) -- cgit v1.2.3 From 2c4b2980ae16a2d8d35f126ddb9fbcba809e2612 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Thu, 19 Mar 2015 13:25:20 +0530 Subject: Staging: rtl8188eu: Remove extern as it is defined but never used RTW_WPA_VERSION is removed as is declared and defined but never used in the code. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 1 - drivers/staging/rtl8188eu/include/ieee80211.h | 1 - 2 files changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index 555efa1da676..a2055017dba2 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c @@ -27,7 +27,6 @@ #include u8 RTW_WPA_OUI_TYPE[] = { 0x00, 0x50, 0xf2, 1 }; -u16 RTW_WPA_VERSION = 1; u8 WPA_AUTH_KEY_MGMT_NONE[] = { 0x00, 0x50, 0xf2, 0 }; u8 WPA_AUTH_KEY_MGMT_UNSPEC_802_1X[] = { 0x00, 0x50, 0xf2, 1 }; u8 WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X[] = { 0x00, 0x50, 0xf2, 2 }; diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h b/drivers/staging/rtl8188eu/include/ieee80211.h index 3299571e339f..8fd35dcdbb94 100644 --- a/drivers/staging/rtl8188eu/include/ieee80211.h +++ b/drivers/staging/rtl8188eu/include/ieee80211.h @@ -122,7 +122,6 @@ enum { #define WPA_SELECTOR_LEN 4 extern u8 RTW_WPA_OUI_TYPE[]; -extern u16 RTW_WPA_VERSION; extern u8 WPA_AUTH_KEY_MGMT_NONE[]; extern u8 WPA_AUTH_KEY_MGMT_UNSPEC_802_1X[]; extern u8 WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X[]; -- cgit v1.2.3 From 9fb163f49ed3b3836f6835f06a5ef9afbabb9c24 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 19 Mar 2015 21:04:42 +0200 Subject: Staging: iio: Simplify NULL pointer condition Replace NULL comparrison with its shorter form. Done with coccinelle: @replace_rule@ expression e; @@ -e == NULL + !e Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/magnetometer/hmc5843_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c index 90cc18b703cf..6befa6f8b2e0 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_core.c +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c @@ -579,7 +579,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap, int ret; indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); - if (indio_dev == NULL) + if (!indio_dev) return -ENOMEM; dev_set_drvdata(dev, indio_dev); -- cgit v1.2.3 From 7079f21b660cc9ac2ce6d6005af3b2fd8638d61c Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 19 Mar 2015 21:06:42 +0200 Subject: Staging: iio: Align function parameters to match first row This patch improves coding style by aligning parameters in iio/magnetometer function calls, to remove the following warning: "CHECK: Alignment should match open parenthesis". Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/magnetometer/hmc5843.h | 2 +- drivers/staging/iio/magnetometer/hmc5843_core.c | 56 ++++++++++++++----------- drivers/staging/iio/magnetometer/hmc5843_i2c.c | 2 +- 3 files changed, 33 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843.h b/drivers/staging/iio/magnetometer/hmc5843.h index b784e3eb4591..879d43beb7e1 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.h +++ b/drivers/staging/iio/magnetometer/hmc5843.h @@ -41,7 +41,7 @@ struct hmc5843_data { }; int hmc5843_common_probe(struct device *dev, struct regmap *regmap, - enum hmc5843_ids id); + enum hmc5843_ids id); int hmc5843_common_remove(struct device *dev); int hmc5843_common_suspend(struct device *dev); diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c index 6befa6f8b2e0..cb857006e676 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_core.c +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c @@ -122,7 +122,7 @@ static s32 hmc5843_set_mode(struct hmc5843_data *data, u8 operating_mode) mutex_lock(&data->lock); ret = regmap_update_bits(data->regmap, HMC5843_MODE_REG, - HMC5843_MODE_MASK, operating_mode); + HMC5843_MODE_MASK, operating_mode); mutex_unlock(&data->lock); return ret; @@ -165,7 +165,7 @@ static int hmc5843_read_measurement(struct hmc5843_data *data, return ret; } ret = regmap_bulk_read(data->regmap, HMC5843_DATA_OUT_MSB_REGS, - values, sizeof(values)); + values, sizeof(values)); mutex_unlock(&data->lock); if (ret < 0) return ret; @@ -198,15 +198,16 @@ static int hmc5843_set_meas_conf(struct hmc5843_data *data, u8 meas_conf) mutex_lock(&data->lock); ret = regmap_update_bits(data->regmap, HMC5843_CONFIG_REG_A, - HMC5843_MEAS_CONF_MASK, meas_conf); + HMC5843_MEAS_CONF_MASK, meas_conf); mutex_unlock(&data->lock); return ret; } -static ssize_t hmc5843_show_measurement_configuration(struct device *dev, - struct device_attribute *attr, - char *buf) +static +ssize_t hmc5843_show_measurement_configuration(struct device *dev, + struct device_attribute *attr, + char *buf) { struct hmc5843_data *data = iio_priv(dev_to_iio_dev(dev)); unsigned int val; @@ -220,10 +221,11 @@ static ssize_t hmc5843_show_measurement_configuration(struct device *dev, return sprintf(buf, "%d\n", val); } -static ssize_t hmc5843_set_measurement_configuration(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t count) +static +ssize_t hmc5843_set_measurement_configuration(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t count) { struct hmc5843_data *data = iio_priv(dev_to_iio_dev(dev)); unsigned long meas_conf = 0; @@ -246,8 +248,9 @@ static IIO_DEVICE_ATTR(meas_conf, hmc5843_set_measurement_configuration, 0); -static ssize_t hmc5843_show_samp_freq_avail(struct device *dev, - struct device_attribute *attr, char *buf) +static +ssize_t hmc5843_show_samp_freq_avail(struct device *dev, + struct device_attribute *attr, char *buf) { struct hmc5843_data *data = iio_priv(dev_to_iio_dev(dev)); size_t len = 0; @@ -272,20 +275,21 @@ static int hmc5843_set_samp_freq(struct hmc5843_data *data, u8 rate) mutex_lock(&data->lock); ret = regmap_update_bits(data->regmap, HMC5843_CONFIG_REG_A, - HMC5843_RATE_MASK, rate << HMC5843_RATE_OFFSET); + HMC5843_RATE_MASK, + rate << HMC5843_RATE_OFFSET); mutex_unlock(&data->lock); return ret; } static int hmc5843_get_samp_freq_index(struct hmc5843_data *data, - int val, int val2) + int val, int val2) { int i; for (i = 0; i < data->variant->n_regval_to_samp_freq; i++) if (val == data->variant->regval_to_samp_freq[i][0] && - val2 == data->variant->regval_to_samp_freq[i][1]) + val2 == data->variant->regval_to_samp_freq[i][1]) return i; return -EINVAL; @@ -297,15 +301,16 @@ static int hmc5843_set_range_gain(struct hmc5843_data *data, u8 range) mutex_lock(&data->lock); ret = regmap_update_bits(data->regmap, HMC5843_CONFIG_REG_B, - HMC5843_RANGE_GAIN_MASK, - range << HMC5843_RANGE_GAIN_OFFSET); + HMC5843_RANGE_GAIN_MASK, + range << HMC5843_RANGE_GAIN_OFFSET); mutex_unlock(&data->lock); return ret; } static ssize_t hmc5843_show_scale_avail(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, + char *buf) { struct hmc5843_data *data = iio_priv(dev_to_iio_dev(dev)); @@ -396,7 +401,8 @@ static int hmc5843_write_raw(struct iio_dev *indio_dev, } static int hmc5843_write_raw_get_fmt(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, long mask) + struct iio_chan_spec const *chan, + long mask) { switch (mask) { case IIO_CHAN_INFO_SAMP_FREQ: @@ -423,14 +429,14 @@ static irqreturn_t hmc5843_trigger_handler(int irq, void *p) } ret = regmap_bulk_read(data->regmap, HMC5843_DATA_OUT_MSB_REGS, - data->buffer, 3 * sizeof(__be16)); + data->buffer, 3 * sizeof(__be16)); mutex_unlock(&data->lock); if (ret < 0) goto done; iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, - iio_get_time_ns()); + iio_get_time_ns()); done: iio_trigger_notify_done(indio_dev->trig); @@ -526,7 +532,7 @@ static int hmc5843_init(struct hmc5843_data *data) u8 id[3]; ret = regmap_bulk_read(data->regmap, HMC5843_ID_REG, - id, ARRAY_SIZE(id)); + id, ARRAY_SIZE(id)); if (ret < 0) return ret; if (id[0] != 'H' || id[1] != '4' || id[2] != '3') { @@ -567,12 +573,12 @@ EXPORT_SYMBOL(hmc5843_common_suspend); int hmc5843_common_resume(struct device *dev) { return hmc5843_set_mode(iio_priv(dev_get_drvdata(dev)), - HMC5843_MODE_SLEEP); + HMC5843_MODE_SLEEP); } EXPORT_SYMBOL(hmc5843_common_resume); int hmc5843_common_probe(struct device *dev, struct regmap *regmap, - enum hmc5843_ids id) + enum hmc5843_ids id) { struct hmc5843_data *data; struct iio_dev *indio_dev; @@ -604,7 +610,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap, return ret; ret = iio_triggered_buffer_setup(indio_dev, NULL, - hmc5843_trigger_handler, NULL); + hmc5843_trigger_handler, NULL); if (ret < 0) return ret; diff --git a/drivers/staging/iio/magnetometer/hmc5843_i2c.c b/drivers/staging/iio/magnetometer/hmc5843_i2c.c index 6acd614cdbc6..8d090b47286b 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_i2c.c +++ b/drivers/staging/iio/magnetometer/hmc5843_i2c.c @@ -57,7 +57,7 @@ static struct regmap_config hmc5843_i2c_regmap_config = { }; static int hmc5843_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { return hmc5843_common_probe(&client->dev, devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config), -- cgit v1.2.3 From ccc5fbe09028bbb66185ecc38830f3fbd2c9c6e3 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 19 Mar 2015 21:07:18 +0200 Subject: Staging: iio: Remove multiple blank lines This patch removes blank uneeded lines in order to remove the folowing checkpatch.pl warning: "Please don't use multiple blank lines". Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/magnetometer/hmc5843.h | 1 - drivers/staging/iio/magnetometer/hmc5843_core.c | 1 - 2 files changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843.h b/drivers/staging/iio/magnetometer/hmc5843.h index 879d43beb7e1..332a75c3a4fb 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.h +++ b/drivers/staging/iio/magnetometer/hmc5843.h @@ -10,7 +10,6 @@ * * */ - #ifndef HMC5843_CORE_H #define HMC5843_CORE_H diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c index cb857006e676..0074af2750a5 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_core.c +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c @@ -562,7 +562,6 @@ static const struct iio_info hmc5843_info = { static const unsigned long hmc5843_scan_masks[] = {0x7, 0}; - int hmc5843_common_suspend(struct device *dev) { return hmc5843_set_mode(iio_priv(dev_get_drvdata(dev)), -- cgit v1.2.3 From aa6432f122434a79253b07c87f292eff982bd71e Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Thu, 19 Mar 2015 21:07:51 +0200 Subject: Staging: iio: Remove line over 80 characters Rename variable in order to fix the 80 characters per line warning. Found by checkpatch.pl Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/magnetometer/hmc5843_i2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843_i2c.c b/drivers/staging/iio/magnetometer/hmc5843_i2c.c index 8d090b47286b..6b4c74236916 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_i2c.c +++ b/drivers/staging/iio/magnetometer/hmc5843_i2c.c @@ -56,11 +56,11 @@ static struct regmap_config hmc5843_i2c_regmap_config = { .cache_type = REGCACHE_RBTREE, }; -static int hmc5843_i2c_probe(struct i2c_client *client, +static int hmc5843_i2c_probe(struct i2c_client *cli, const struct i2c_device_id *id) { - return hmc5843_common_probe(&client->dev, - devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config), + return hmc5843_common_probe(&cli->dev, + devm_regmap_init_i2c(cli, &hmc5843_i2c_regmap_config), id->driver_data); } -- cgit v1.2.3 From 875887c3086a6e130beb73cd12b737c1296eb946 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Fri, 20 Mar 2015 12:47:51 +0530 Subject: Staging: ste_rmi4: Use SIMPLE_DEV_PM_OPS() macro Macro SIMPLE_DEV_PM_OPS() can be used when same suspend and resume callbacks are used for suspend to RAM and hibernation. So, here use SIMPLE_DEV_PM_OPS to make code shorter and cleaner. Signed-off-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c index 6385b336bd0d..0f524bb7b41d 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c @@ -1112,12 +1112,11 @@ static int synaptics_rmi4_resume(struct device *dev) return 0; } -static const struct dev_pm_ops synaptics_rmi4_dev_pm_ops = { - .suspend = synaptics_rmi4_suspend, - .resume = synaptics_rmi4_resume, -}; #endif +static SIMPLE_DEV_PM_OPS(synaptics_rmi4_dev_pm_ops, synaptics_rmi4_suspend, + synaptics_rmi4_resume); + static const struct i2c_device_id synaptics_rmi4_id_table[] = { { DRIVER_NAME, 0 }, { }, @@ -1128,9 +1127,7 @@ static struct i2c_driver synaptics_rmi4_driver = { .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, -#ifdef CONFIG_PM .pm = &synaptics_rmi4_dev_pm_ops, -#endif }, .probe = synaptics_rmi4_probe, .remove = synaptics_rmi4_remove, -- cgit v1.2.3 From a1c6dcda80f6dbb3e9b78809235695e8828994f9 Mon Sep 17 00:00:00 2001 From: Quentin Lambert Date: Thu, 19 Mar 2015 14:18:56 +0100 Subject: staging: vt6655: remove deprecated use of pci api Replace occurences of the pci api by appropriate call to the dma api. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr) @deprecated@ idexpression id; position p; @@ ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @bad1@ idexpression id; position deprecated.p; @@ ...when != &id->dev when != pci_get_drvdata ( id ) when != pci_enable_device ( id ) ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @depends on !bad1@ idexpression id; expression direction; position deprecated.p; @@ ( - pci_dma_supported@p ( id, + dma_supported ( &id->dev, ... + , GFP_ATOMIC ) | - pci_alloc_consistent@p ( id, + dma_alloc_coherent ( &id->dev, ... + , GFP_ATOMIC ) ) Signed-off-by: Quentin Lambert Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device_main.c | 39 ++++++++++++++++++------------------ drivers/staging/vt6655/dpc.c | 4 ++-- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 0204ea520385..e12caa8fbeb3 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -540,12 +540,12 @@ static bool device_init_rings(struct vnt_private *pDevice) void *vir_pool; /*allocate all RD/TD rings a single pool*/ - vir_pool = pci_zalloc_consistent(pDevice->pcid, + vir_pool = dma_zalloc_coherent(&pDevice->pcid->dev, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) + pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc), - &pDevice->pool_dma); + &pDevice->pool_dma, GFP_ATOMIC); if (vir_pool == NULL) { dev_err(&pDevice->pcid->dev, "allocate desc dma memory failed\n"); return false; @@ -559,16 +559,17 @@ static bool device_init_rings(struct vnt_private *pDevice) pDevice->rd1_pool_dma = pDevice->rd0_pool_dma + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc); - pDevice->tx0_bufs = pci_zalloc_consistent(pDevice->pcid, + pDevice->tx0_bufs = dma_zalloc_coherent(&pDevice->pcid->dev, pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ + pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ + CB_BEACON_BUF_SIZE + CB_MAX_BUF_SIZE, - &pDevice->tx_bufs_dma0); + &pDevice->tx_bufs_dma0, + GFP_ATOMIC); if (pDevice->tx0_bufs == NULL) { dev_err(&pDevice->pcid->dev, "allocate buf dma memory failed\n"); - pci_free_consistent(pDevice->pcid, + dma_free_coherent(&pDevice->pcid->dev, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) + @@ -614,7 +615,7 @@ static bool device_init_rings(struct vnt_private *pDevice) static void device_free_rings(struct vnt_private *pDevice) { - pci_free_consistent(pDevice->pcid, + dma_free_coherent(&pDevice->pcid->dev, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) + @@ -624,7 +625,7 @@ static void device_free_rings(struct vnt_private *pDevice) ); if (pDevice->tx0_bufs) - pci_free_consistent(pDevice->pcid, + dma_free_coherent(&pDevice->pcid->dev, pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ + pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ + CB_BEACON_BUF_SIZE + @@ -689,8 +690,8 @@ static void device_free_rd0_ring(struct vnt_private *pDevice) PSRxDesc pDesc = &(pDevice->aRD0Ring[i]); PDEVICE_RD_INFO pRDInfo = pDesc->pRDInfo; - pci_unmap_single(pDevice->pcid, pRDInfo->skb_dma, - pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE); + dma_unmap_single(&pDevice->pcid->dev, pRDInfo->skb_dma, + pDevice->rx_buf_sz, DMA_FROM_DEVICE); dev_kfree_skb(pRDInfo->skb); @@ -706,8 +707,8 @@ static void device_free_rd1_ring(struct vnt_private *pDevice) PSRxDesc pDesc = &(pDevice->aRD1Ring[i]); PDEVICE_RD_INFO pRDInfo = pDesc->pRDInfo; - pci_unmap_single(pDevice->pcid, pRDInfo->skb_dma, - pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE); + dma_unmap_single(&pDevice->pcid->dev, pRDInfo->skb_dma, + pDevice->rx_buf_sz, DMA_FROM_DEVICE); dev_kfree_skb(pRDInfo->skb); @@ -775,8 +776,8 @@ static void device_free_td0_ring(struct vnt_private *pDevice) PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) - pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma, - pTDInfo->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma, + pTDInfo->skb->len, DMA_TO_DEVICE); if (pTDInfo->skb) dev_kfree_skb(pTDInfo->skb); @@ -794,8 +795,8 @@ static void device_free_td1_ring(struct vnt_private *pDevice) PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo; if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) - pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma, - pTDInfo->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma, + pTDInfo->skb->len, DMA_TO_DEVICE); if (pTDInfo->skb) dev_kfree_skb(pTDInfo->skb); @@ -841,9 +842,9 @@ static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pRD) ASSERT(pRDInfo->skb); pRDInfo->skb_dma = - pci_map_single(pDevice->pcid, + dma_map_single(&pDevice->pcid->dev, skb_put(pRDInfo->skb, skb_tailroom(pRDInfo->skb)), - pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE); + pDevice->rx_buf_sz, DMA_FROM_DEVICE); *((unsigned int *)&(pRD->m_rd0RD0)) = 0; /* FIX cast */ @@ -994,8 +995,8 @@ static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) /* pre-allocated buf_dma can't be unmapped. */ if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) { - pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma, skb->len, - PCI_DMA_TODEVICE); + dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma, + skb->len, DMA_TO_DEVICE); } if (pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index 3c5b87ffdcac..b25ee962558d 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -140,8 +140,8 @@ bool vnt_receive_frame(struct vnt_private *priv, PSRxDesc curr_rd) skb = rd_info->skb; - pci_unmap_single(priv->pcid, rd_info->skb_dma, - priv->rx_buf_sz, PCI_DMA_FROMDEVICE); + dma_unmap_single(&priv->pcid->dev, rd_info->skb_dma, + priv->rx_buf_sz, DMA_FROM_DEVICE); frame_size = le16_to_cpu(curr_rd->m_rd1RD1.wReqCount) - cpu_to_le16(curr_rd->m_rd0RD0.wResCount); -- cgit v1.2.3 From 20ff1418d3936f76df24f5694c6b5eb9179a565f Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Sat, 14 Mar 2015 01:34:41 +0300 Subject: staging: vt6656: don't return zero on failure path in vt6656_probe() If ieee80211_alloc_hw() fails in vt6656_probe(), it breaks off initialization, but returns zero. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/main_usb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 71adc1f61838..ab3ab84cb0a7 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -963,6 +963,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) hw = ieee80211_alloc_hw(sizeof(struct vnt_private), &vnt_mac_ops); if (!hw) { dev_err(&udev->dev, "could not register ieee80211_hw\n"); + rc = -ENOMEM; goto err_nomem; } -- cgit v1.2.3 From 7a48a091962ec4f96c12038d11a15998ec28017b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Thu, 19 Mar 2015 23:09:43 +0200 Subject: Staging: vt6655: changed C99 // comments // erased and replace it with /**/ used. Error found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rxtx.c | 168 +++++++++++++++++++++--------------------- 1 file changed, 84 insertions(+), 84 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 2b4f005dc7fa..5b869d1f9e40 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -64,21 +64,21 @@ /*--------------------- Static Functions --------------------------*/ /*--------------------- Static Definitions -------------------------*/ -#define CRITICAL_PACKET_LEN 256 // if packet size < 256 -> in-direct send - // packet size >= 256 -> direct send +#define CRITICAL_PACKET_LEN 256 /* if packet size < 256 -> in-direct send + packet size >= 256 -> direct send */ static const unsigned short wTimeStampOff[2][MAX_RATE] = { - {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble - {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble + {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, /* Long Preamble */ + {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, /* Short Preamble */ }; static const unsigned short wFB_Opt0[2][5] = { - {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, // fallback_rate0 - {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, // fallback_rate1 + {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, /* fallback_rate0 */ + {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, /* fallback_rate1 */ }; static const unsigned short wFB_Opt1[2][5] = { - {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, // fallback_rate0 - {RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1 + {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, /* fallback_rate0 */ + {RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, /* fallback_rate1 */ }; #define RTSDUR_BB 0 @@ -176,9 +176,9 @@ s_uGetTxRsvTime( unsigned int uDataTime, uAckTime; uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wRate); - if (byPktType == PK_TYPE_11B) //llb,CCK mode + if (byPktType == PK_TYPE_11B) /* llb,CCK mode */ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopCCKBasicRate); - else //11g 2.4G OFDM mode & 11a 5G OFDM mode + else /* 11g 2.4G OFDM mode & 11a 5G OFDM mode */ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopOFDMBasicRate); if (bNeedAck) @@ -194,7 +194,7 @@ static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type, frame_length, rate, need_ack)); } -//byFreqType: 0=>5GHZ 1=>2.4GHZ +/* byFreqType: 0=>5GHZ 1=>2.4GHZ */ static __le16 s_uGetRTSCTSRsvTime( @@ -210,29 +210,29 @@ s_uGetRTSCTSRsvTime( uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0; uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wCurrentRate); - if (byRTSRsvType == 0) { //RTSTxRrvTime_bb + if (byRTSRsvType == 0) { /* RTSTxRrvTime_bb */ uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate); uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); - } else if (byRTSRsvType == 1) { //RTSTxRrvTime_ba, only in 2.4GHZ + } else if (byRTSRsvType == 1) { /* RTSTxRrvTime_ba, only in 2.4GHZ */ uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate); uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); - } else if (byRTSRsvType == 2) { //RTSTxRrvTime_aa + } else if (byRTSRsvType == 2) { /* RTSTxRrvTime_aa */ uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopOFDMBasicRate); uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); - } else if (byRTSRsvType == 3) { //CTSTxRrvTime_ba, only in 2.4GHZ + } else if (byRTSRsvType == 3) { /* CTSTxRrvTime_ba, only in 2.4GHZ */ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); uRrvTime = uCTSTime + uAckTime + uDataTime + 2*pDevice->uSIFS; return cpu_to_le16((u16)uRrvTime); } - //RTSRrvTime + /* RTSRrvTime */ uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3*pDevice->uSIFS; return cpu_to_le16((u16)uRrvTime); } -//byFreqType 0: 5GHz, 1:2.4Ghz +/* byFreqType 0: 5GHz, 1:2.4Ghz */ static unsigned int s_uGetDataDuration( @@ -255,15 +255,15 @@ s_uGetDataDuration( bLastFrag = true; switch (byDurType) { - case DATADUR_B: //DATADUR_B - if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag + case DATADUR_B: /* DATADUR_B */ + if (((uMACfragNum == 1)) || bLastFrag) {/* Non Frag or Last Frag */ if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); return pDevice->uSIFS + uAckTime; } else { return 0; } - } else {//First Frag or Mid Frag + } else {/* First Frag or Mid Frag */ if (uFragIdx == (uMACfragNum-2)) uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck); else @@ -278,15 +278,15 @@ s_uGetDataDuration( } break; - case DATADUR_A: //DATADUR_A - if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag + case DATADUR_A: /* DATADUR_A */ + if (((uMACfragNum == 1)) || bLastFrag) {/* Non Frag or Last Frag */ if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); return pDevice->uSIFS + uAckTime; } else { return 0; } - } else {//First Frag or Mid Frag + } else {/* First Frag or Mid Frag */ if (uFragIdx == (uMACfragNum-2)) uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck); else @@ -301,15 +301,15 @@ s_uGetDataDuration( } break; - case DATADUR_A_F0: //DATADUR_A_F0 - if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag + case DATADUR_A_F0: /* DATADUR_A_F0 */ + if (((uMACfragNum == 1)) || bLastFrag) {/* Non Frag or Last Frag */ if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); return pDevice->uSIFS + uAckTime; } else { return 0; } - } else { //First Frag or Mid Frag + } else { /* First Frag or Mid Frag */ if (byFBOption == AUTO_FB_0) { if (wRate < RATE_18M) wRate = RATE_18M; @@ -321,7 +321,7 @@ s_uGetDataDuration( else uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck); - } else { // (byFBOption == AUTO_FB_1) + } else { /* (byFBOption == AUTO_FB_1) */ if (wRate < RATE_18M) wRate = RATE_18M; else if (wRate > RATE_54M) @@ -343,15 +343,15 @@ s_uGetDataDuration( } break; - case DATADUR_A_F1: //DATADUR_A_F1 - if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag + case DATADUR_A_F1: /* DATADUR_A_F1 */ + if (((uMACfragNum == 1)) || bLastFrag) { /* Non Frag or Last Frag */ if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); return pDevice->uSIFS + uAckTime; } else { return 0; } - } else { //First Frag or Mid Frag + } else { /* First Frag or Mid Frag */ if (byFBOption == AUTO_FB_0) { if (wRate < RATE_18M) wRate = RATE_18M; @@ -363,7 +363,7 @@ s_uGetDataDuration( else uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck); - } else { // (byFBOption == AUTO_FB_1) + } else { /* (byFBOption == AUTO_FB_1) */ if (wRate < RATE_18M) wRate = RATE_18M; else if (wRate > RATE_54M) @@ -391,7 +391,7 @@ s_uGetDataDuration( return 0; } -//byFreqType: 0=>5GHZ 1=>2.4GHZ +/* byFreqType: 0=>5GHZ 1=>2.4GHZ */ static __le16 s_uGetRTSCTSDuration( @@ -407,26 +407,26 @@ s_uGetRTSCTSDuration( unsigned int uCTSTime = 0, uDurTime = 0; switch (byDurType) { - case RTSDUR_BB: //RTSDuration_bb + case RTSDUR_BB: /* RTSDuration_bb */ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); break; - case RTSDUR_BA: //RTSDuration_ba + case RTSDUR_BA: /* RTSDuration_ba */ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); break; - case RTSDUR_AA: //RTSDuration_aa + case RTSDUR_AA: /* RTSDuration_aa */ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); break; - case CTSDUR_BA: //CTSDuration_ba + case CTSDUR_BA: /* CTSDuration_ba */ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); break; - case RTSDUR_BA_F0: //RTSDuration_ba_f0 + case RTSDUR_BA_F0: /* RTSDuration_ba_f0 */ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck); @@ -435,7 +435,7 @@ s_uGetRTSCTSDuration( break; - case RTSDUR_AA_F0: //RTSDuration_aa_f0 + case RTSDUR_AA_F0: /* RTSDuration_aa_f0 */ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck); @@ -444,7 +444,7 @@ s_uGetRTSCTSDuration( break; - case RTSDUR_BA_F1: //RTSDuration_ba_f1 + case RTSDUR_BA_F1: /* RTSDuration_ba_f1 */ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck); @@ -453,7 +453,7 @@ s_uGetRTSCTSDuration( break; - case RTSDUR_AA_F1: //RTSDuration_aa_f1 + case RTSDUR_AA_F1: /* RTSDuration_aa_f1 */ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck); @@ -462,7 +462,7 @@ s_uGetRTSCTSDuration( break; - case CTSDUR_BA_F0: //CTSDuration_ba_f0 + case CTSDUR_BA_F0: /* CTSDuration_ba_f0 */ if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck); else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) @@ -470,7 +470,7 @@ s_uGetRTSCTSDuration( break; - case CTSDUR_BA_F1: //CTSDuration_ba_f1 + case CTSDUR_BA_F1: /* CTSDuration_ba_f1 */ if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck); else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) @@ -565,7 +565,7 @@ s_uFillDataHead( buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate); return buf->duration_a; - } //if (byFBOption == AUTO_FB_NONE) + } /* if (byFBOption == AUTO_FB_NONE) */ } else if (byPktType == PK_TYPE_11A) { if ((byFBOption != AUTO_FB_NONE)) { /* Auto Fallback */ @@ -651,13 +651,13 @@ s_vFillRTSHead( return; if (bDisCRC) { - // When CRCDIS bit is on, H/W forgot to generate FCS for RTS frame, - // in this case we need to decrease its length by 4. + /* When CRCDIS bit is on, H/W forgot to generate FCS for RTS frame, + in this case we need to decrease its length by 4. */ uRTSFrameLen -= 4; } - // Note: So far RTSHead dosen't appear in ATIM & Beacom DMA, so we don't need to take them into account. - // Otherwise, we need to modify codes for them. + /* Note: So far RTSHead dosen't appear in ATIM & Beacom DMA, so we don't need to take them into account. + Otherwise, we need to modify codes for them. */ if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (byFBOption == AUTO_FB_NONE) { struct vnt_rts_g *buf = pvRTS; @@ -748,7 +748,7 @@ s_vFillRTSHead( ether_addr_copy(buf->data.ra, hdr->addr1); ether_addr_copy(buf->data.ta, hdr->addr2); - } // if (byFBOption == AUTO_FB_NONE) + } /* if (byFBOption == AUTO_FB_NONE) */ } else if (byPktType == PK_TYPE_11A) { if (byFBOption == AUTO_FB_NONE) { struct vnt_rts_ab *buf = pvRTS; @@ -843,14 +843,14 @@ s_vFillCTSHead( return; if (bDisCRC) { - // When CRCDIS bit is on, H/W forgot to generate FCS for CTS frame, - // in this case we need to decrease its length by 4. + /* When CRCDIS bit is on, H/W forgot to generate FCS for CTS frame, + in this case we need to decrease its length by 4. */ uCTSFrameLen -= 4; } if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) { - // Auto Fall back + /* Auto Fall back */ struct vnt_cts_fb *buf = pvCTS; /* Get SignalField, ServiceField & Length */ vnt_get_phy_field(pDevice, uCTSFrameLen, @@ -888,7 +888,7 @@ s_vFillCTSHead( ether_addr_copy(buf->data.ra, pDevice->abyCurrentNetAddr); - } else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) + } else { /* if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) */ struct vnt_cts *buf = pvCTS; /* Get SignalField, ServiceField & Length */ vnt_get_phy_field(pDevice, uCTSFrameLen, @@ -937,8 +937,8 @@ s_vFillCTSHead( * * Return Value: none * - -*/ -// unsigned int cbFrameSize,//Hdr+Payload+FCS + - + * unsigned int cbFrameSize, Hdr+Payload+FCS */ static void s_vGenerateTxParameter( @@ -976,8 +976,8 @@ s_vGenerateTxParameter( return; if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { - if (pvRTS != NULL) { //RTS_need - /* Fill RsvTime */ + if (pvRTS != NULL) { /* RTS_need + Fill RsvTime */ struct vnt_rrv_time_rts *buf = pvRrvTime; buf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate); @@ -987,40 +987,40 @@ s_vGenerateTxParameter( buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK); s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); - } else {//RTS_needless, PCF mode + } else {/* RTS_needless, PCF mode */ struct vnt_rrv_time_cts *buf = pvRrvTime; buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK); buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK); buf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate); - //Fill CTS + /* Fill CTS */ s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption); } } else if (byPktType == PK_TYPE_11A) { - if (pvRTS != NULL) {//RTS_need, non PCF mode + if (pvRTS != NULL) {/* RTS_need, non PCF mode */ struct vnt_rrv_time_ab *buf = pvRrvTime; buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate); buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK); - //Fill RTS + /* Fill RTS */ s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); - } else if (pvRTS == NULL) {//RTS_needless, non PCF mode + } else if (pvRTS == NULL) {/* RTS_needless, non PCF mode */ struct vnt_rrv_time_ab *buf = pvRrvTime; buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK); } } else if (byPktType == PK_TYPE_11B) { - if ((pvRTS != NULL)) {//RTS_need, non PCF mode + if ((pvRTS != NULL)) {/* RTS_need, non PCF mode */ struct vnt_rrv_time_ab *buf = pvRrvTime; buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate); buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK); - //Fill RTS + /* Fill RTS */ s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); - } else { //RTS_needless, non PCF mode + } else { /* RTS_needless, non PCF mode */ struct vnt_rrv_time_ab *buf = pvRrvTime; buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK); @@ -1058,7 +1058,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, void *pvRTS; void *pvCTS; void *pvTxDataHd; - unsigned short wTxBufSize; // FFinfo size + unsigned short wTxBufSize; /* FFinfo size */ unsigned char byFBOption = AUTO_FB_NONE; pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL; @@ -1076,27 +1076,27 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, cbFrameSize += info->control.hw_key->icv_len; if (pDevice->byLocalID > REV_ID_VT3253_A1) { - //MAC Header should be padding 0 to DW alignment. + /* MAC Header should be padding 0 to DW alignment. */ uPadding = 4 - (ieee80211_get_hdrlen_from_skb(skb) % 4); uPadding %= 4; } } - // - // Use for AUTO FALL BACK - // + /* + * Use for AUTO FALL BACK + */ if (fifo_ctl & FIFOCTL_AUTO_FB_0) byFBOption = AUTO_FB_0; else if (fifo_ctl & FIFOCTL_AUTO_FB_1) byFBOption = AUTO_FB_1; - ////////////////////////////////////////////////////// - //Set RrvTime/RTS/CTS Buffer + + /* Set RrvTime/RTS/CTS Buffer */ wTxBufSize = sizeof(STxBufHead); - if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {/* 802.11g packet */ if (byFBOption == AUTO_FB_NONE) { - if (bRTS == true) {//RTS_need + if (bRTS == true) {/* RTS_need */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts)); pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR); @@ -1106,7 +1106,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(struct vnt_rts_g) + sizeof(struct vnt_tx_datahead_g); - } else { //RTS_needless + } else { /* RTS_needless */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts)); pvRTS = NULL; @@ -1117,8 +1117,8 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, cbMICHDR + sizeof(struct vnt_cts) + sizeof(struct vnt_tx_datahead_g); } } else { - // Auto Fall Back - if (bRTS == true) {//RTS_need + /* Auto Fall Back */ + if (bRTS == true) {/* RTS_need */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts)); pvRTS = (void *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR); @@ -1127,7 +1127,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, cbMICHDR + sizeof(struct vnt_rts_g_fb)); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(struct vnt_rts_g_fb) + sizeof(struct vnt_tx_datahead_g_fb); - } else { //RTS_needless + } else { /* RTS_needless */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts)); pvRTS = NULL; @@ -1137,8 +1137,8 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(struct vnt_cts_fb) + sizeof(struct vnt_tx_datahead_g_fb); } - } // Auto Fall Back - } else {//802.11a/b packet + } /* Auto Fall Back */ + } else {/* 802.11a/b packet */ if (byFBOption == AUTO_FB_NONE) { if (bRTS == true) { @@ -1150,7 +1150,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(struct vnt_rts_ab)); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(struct vnt_rts_ab) + sizeof(struct vnt_tx_datahead_ab); - } else { //RTS_needless, need MICHDR + } else { /* RTS_needless, need MICHDR */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); pvRTS = NULL; @@ -1160,8 +1160,8 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, cbMICHDR + sizeof(struct vnt_tx_datahead_ab); } } else { - // Auto Fall Back - if (bRTS == true) {//RTS_need + /* Auto Fall Back */ + if (bRTS == true) { /* RTS_need */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); @@ -1170,7 +1170,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(struct vnt_rts_a_fb)); cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(struct vnt_rts_a_fb) + sizeof(struct vnt_tx_datahead_a_fb); - } else { //RTS_needless + } else { /* RTS_needless */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); pvRTS = NULL; @@ -1179,7 +1179,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(struct vnt_tx_datahead_a_fb); } - } // Auto Fall Back + } /* Auto Fall Back */ } td_info->mic_hdr = pMICHDR; -- cgit v1.2.3 From d38f486142b6edf3dfd3407d8f0e8a55309a9e41 Mon Sep 17 00:00:00 2001 From: Abdul Hussain S Date: Wed, 18 Mar 2015 14:46:00 +0530 Subject: staging: i2o: Use kstrdup rather than duplicating its implementation The semantic patch that makes this change is available in scripts/coccinelle/api/kstrdup.cocci Signed-off-by: Abdul Hussain S Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/memory.c b/drivers/staging/i2o/memory.c index 8f9509d275a4..78b702c18537 100644 --- a/drivers/staging/i2o/memory.c +++ b/drivers/staging/i2o/memory.c @@ -270,10 +270,9 @@ EXPORT_SYMBOL_GPL(i2o_dma_realloc); int i2o_pool_alloc(struct i2o_pool *pool, const char *name, size_t size, int min_nr) { - pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL); + pool->name = kstrdup(name, GFP_KERNEL); if (!pool->name) goto exit; - strcpy(pool->name, name); pool->slab = kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL); -- cgit v1.2.3 From d9954896a286393522a851731c46caba1f7bca19 Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys Date: Fri, 13 Feb 2015 18:05:34 -0800 Subject: ion: improve ion_phys error message Clients often get confused when ion_phys errors out due to some heap being used that they didn't expect. Add the heap name and heap type to the error message to make it more obvious. Signed-off-by: Mitchel Humpherys Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 65361ca33fc9..0e3d8c7add24 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -566,8 +566,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle, buffer = handle->buffer; if (!buffer->heap->ops->phys) { - pr_err("%s: ion_phys is not implemented by this heap.\n", - __func__); + pr_err("%s: ion_phys is not implemented by this heap (name=%s, type=%d).\n", + __func__, buffer->heap->name, buffer->heap->type); mutex_unlock(&client->lock); return -ENODEV; } -- cgit v1.2.3 From aa5735f139f84a3d1e4ef4d0ba177a25372506fb Mon Sep 17 00:00:00 2001 From: Madhusudhanan Ravindran Date: Sun, 8 Mar 2015 10:26:30 +0530 Subject: staging: fbtft: Use kmemdup rather than duplicating its implementation The semantic patch that makes this change is available in scriptcoccinelle/api/memdup.cocci. Signed-off-by: Madhusudhanan Ravindran Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-sysfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c index 45f8de3d11ad..ba4551fcb9f0 100644 --- a/drivers/staging/fbtft/fbtft-sysfs.c +++ b/drivers/staging/fbtft/fbtft-sysfs.c @@ -37,10 +37,9 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves, fbtft_par_dbg(DEBUG_SYSFS, par, "%s\n", str); - tmp = kmalloc(size+1, GFP_KERNEL); + tmp = kmemdup(str, size + 1, GFP_KERNEL); if (!tmp) return -ENOMEM; - memcpy(tmp, str, size+1); /* replace optional separators */ str_p = tmp; -- cgit v1.2.3 From 6a938a8cef9abad2ae13e6a48329f5119930b0d6 Mon Sep 17 00:00:00 2001 From: "Ravindran, Madhusudhanan (M.)" Date: Mon, 16 Mar 2015 15:36:41 +0000 Subject: staging: fbtft: Fix potential null dereference This error is found by smatch tool. Signed-off-by: Madhusudhanan Ravindran Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_agm1264k-fl.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c index 578fdbe352d1..939b7b963043 100644 --- a/drivers/staging/fbtft/fb_agm1264k-fl.c +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c @@ -282,6 +282,9 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) signed short *convert_buf = kmalloc(par->info->var.xres * par->info->var.yres * sizeof(signed short), GFP_NOIO); + if (!convert_buf) + return -ENOMEM; + fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); /* converting to grayscale16 */ -- cgit v1.2.3 From f3e5df43488f7c6c5e91578ec9c7fdda5cd36167 Mon Sep 17 00:00:00 2001 From: Peter Poklop Date: Wed, 18 Mar 2015 20:15:57 +0100 Subject: Staging: fbtft: add declaration of non-static functions This patch fixes these sparse warnings: drivers/staging/fbtft/fbtft-sysfs.c:23:5: warning: symbol 'fbtft_gamma_parse_str' was not declared. Should it be static? drivers/staging/fbtft/fbtft-sysfs.c:153:6: warning: symbol 'fbtft_expand_debug_value' was not declared. Should it be static? drivers/staging/fbtft/fbtft-sysfs.c:209:6: warning: symbol 'fbtft_sysfs_init' was not declared. Should it be static? drivers/staging/fbtft/fbtft-sysfs.c:216:6: warning: symbol 'fbtft_sysfs_exit' was not declared. Should it be static? Signed-off-by: Peter Poklop Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c index ba4551fcb9f0..e3eb1f9587b3 100644 --- a/drivers/staging/fbtft/fbtft-sysfs.c +++ b/drivers/staging/fbtft/fbtft-sysfs.c @@ -1,5 +1,5 @@ #include "fbtft.h" - +#include "internal.h" static int get_next_ulong(char **str_p, unsigned long *val, char *sep, int base) { -- cgit v1.2.3 From c65434eb265393ea1741953621559c61bba56062 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Sun, 8 Mar 2015 23:10:09 +0530 Subject: staging: sm7xxfb: use module init and exit use module_init() and module_exit() instead of module_pci_driver and at the same time make way for use of kernel boot parameters. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xxfb.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index ebd95365ffae..17b3917ccde0 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -113,6 +113,8 @@ static struct vesa_mode vesa_mode_table[] = { static struct screen_info smtc_scr_info; +static char *mode_option; + /* process command line options, get vga parameter */ static int __init sm7xx_vga_setup(char *options) { @@ -1017,7 +1019,29 @@ static struct pci_driver smtcfb_driver = { .driver.pm = SM7XX_PM_OPS, }; -module_pci_driver(smtcfb_driver); +static int __init sm712fb_init(void) +{ +#ifndef MODULE + char *option = NULL; + + if (fb_get_options("sm712fb", &option)) + return -ENODEV; + if (option && *option) + mode_option = option; +#endif + sm7xx_vga_setup(mode_option); + + return pci_register_driver(&smtcfb_driver); +} + +module_init(sm712fb_init); + +static void __exit sm712fb_exit(void) +{ + pci_unregister_driver(&smtcfb_driver); +} + +module_exit(sm712fb_exit); MODULE_AUTHOR("Siliconmotion "); MODULE_DESCRIPTION("Framebuffer driver for SMI Graphic Cards"); -- cgit v1.2.3 From f0f37e658cd8fcedea81aa1bd742f27cd1f707ec Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Sun, 8 Mar 2015 23:10:10 +0530 Subject: staging: sm7xxfb: remove unneeded __setup as we start to use kernel boot parameters and fb_get_options() we donot need to use __setup() any more. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xxfb.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 17b3917ccde0..e93563fc2623 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -141,7 +141,6 @@ static int __init sm7xx_vga_setup(char *options) return -1; } -__setup("vga=", sm7xx_vga_setup); static void sm712_setpalette(int regno, unsigned red, unsigned green, unsigned blue, struct fb_info *info) -- cgit v1.2.3 From 71ce762feb382d25e8a20f88503009fee47a7e92 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Sun, 8 Mar 2015 23:10:11 +0530 Subject: staging: sm7xxfb: change return of sm7xx_vga_setup change return type of sm7xx_vga_setup() to void as we are not using the return type anywhere. if this function fails we fall back to the default configuration. Signed-off-by: Sudip Mukherjee Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xxfb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index e93563fc2623..abdb02115cac 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -116,12 +116,12 @@ static struct screen_info smtc_scr_info; static char *mode_option; /* process command line options, get vga parameter */ -static int __init sm7xx_vga_setup(char *options) +static void __init sm7xx_vga_setup(char *options) { int i; if (!options || !*options) - return -EINVAL; + return; smtc_scr_info.lfb_width = 0; smtc_scr_info.lfb_height = 0; @@ -135,11 +135,9 @@ static int __init sm7xx_vga_setup(char *options) smtc_scr_info.lfb_height = vesa_mode_table[i].lfb_height; smtc_scr_info.lfb_depth = vesa_mode_table[i].lfb_depth; - return 0; + return; } } - - return -1; } static void sm712_setpalette(int regno, unsigned red, unsigned green, -- cgit v1.2.3 From 6a9df4303b2325a7ed3c44fbf4f8878798fb2c94 Mon Sep 17 00:00:00 2001 From: Ricardo Ribalda Delgado Date: Mon, 16 Mar 2015 11:51:09 +0100 Subject: staging/sm75fb: Declare static functions as such This patch fixes this sparse warning CHECK drivers/staging/sm750fb/ddk750_swi2c.c drivers/staging/sm750fb/ddk750_swi2c.c:223:6: warning: symbol 'swI2CStart' was not declared. Should it be static? drivers/staging/sm750fb/ddk750_swi2c.c:234:6: warning: symbol 'swI2CStop' was not declared. Should it be static? drivers/staging/sm750fb/ddk750_swi2c.c:252:6: warning: symbol 'swI2CWriteByte' was not declared. Should it be static? drivers/staging/sm750fb/ddk750_swi2c.c:320:15: warning: symbol 'swI2CReadByte' was not declared. Should it be static? drivers/staging/sm750fb/ddk750_swi2c.c:361:6: warning: symbol 'swI2CInit_SM750LE' was not declared. Should it be static? Signed-off-by: Ricardo Ribalda Delgado Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_swi2c.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c index 8557cce2f420..901b3737f1ed 100644 --- a/drivers/staging/sm750fb/ddk750_swi2c.c +++ b/drivers/staging/sm750fb/ddk750_swi2c.c @@ -220,7 +220,7 @@ static void swI2CAck(void) /* * This function sends the start command to the slave device */ -void swI2CStart(void) +static void swI2CStart(void) { /* Start I2C */ swI2CSDA(1); @@ -231,7 +231,7 @@ void swI2CStart(void) /* * This function sends the stop command to the slave device */ -void swI2CStop(void) +static void swI2CStop(void) { /* Stop the I2C */ swI2CSCL(1); @@ -249,7 +249,7 @@ void swI2CStop(void) * 0 - Success * -1 - Fail to write byte */ -long swI2CWriteByte(unsigned char data) +static long swI2CWriteByte(unsigned char data) { unsigned char value = data; int i; @@ -317,7 +317,7 @@ long swI2CWriteByte(unsigned char data) * Return Value: * One byte data read from the Slave device */ -unsigned char swI2CReadByte(unsigned char ack) +static unsigned char swI2CReadByte(unsigned char ack) { int i; unsigned char data = 0; @@ -358,10 +358,8 @@ unsigned char swI2CReadByte(unsigned char ack) * -1 - Fail to initialize the i2c * 0 - Success */ -long swI2CInit_SM750LE( - unsigned char i2cClkGPIO, - unsigned char i2cDataGPIO -) +static long swI2CInit_SM750LE(unsigned char i2cClkGPIO, + unsigned char i2cDataGPIO) { int i; -- cgit v1.2.3 From de99befd18c10d8085182a1facbb4b8760b2b6fe Mon Sep 17 00:00:00 2001 From: Ragavendra Nagraj Date: Wed, 18 Mar 2015 02:37:42 -0700 Subject: staging: sm750fb: Fixed no space and indent warns This patch fixes the no spaces and indent warnings identified by the checkpath.pl script for the entire ddk750_chip.c file by using appropriate tab spaces and indents accordingly. Signed-off-by: Ragavendra Nagraj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 460 +++++++++++++++++----------------- 1 file changed, 230 insertions(+), 230 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 33add64569b0..02f9326a0404 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -20,22 +20,22 @@ logical_chip_type_t getChipType(void) physicalID = devId750;//either 0x718 or 0x750 physicalRev = revId750; - if (physicalID == 0x718) - { - chip = SM718; - } - else if (physicalID == 0x750) - { - chip = SM750; + if (physicalID == 0x718) + { + chip = SM718; + } + else if (physicalID == 0x750) + { + chip = SM750; /* SM750 and SM750LE are different in their revision ID only. */ if (physicalRev == SM750LE_REVISION_ID){ chip = SM750LE; } - } - else - { - chip = SM_UNKNOWN; - } + } + else + { + chip = SM_UNKNOWN; + } return chip; } @@ -43,63 +43,63 @@ logical_chip_type_t getChipType(void) inline unsigned int twoToPowerOfx(unsigned long x) { - unsigned long i; - unsigned long result = 1; + unsigned long i; + unsigned long result = 1; - for (i=1; i<=x; i++) - result *= 2; - return result; + for (i=1; i<=x; i++) + result *= 2; + return result; } inline unsigned int calcPLL(pll_value_t *pPLL) { - return (pPLL->inputFreq * pPLL->M / pPLL->N / twoToPowerOfx(pPLL->OD) / twoToPowerOfx(pPLL->POD)); + return (pPLL->inputFreq * pPLL->M / pPLL->N / twoToPowerOfx(pPLL->OD) / twoToPowerOfx(pPLL->POD)); } unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL) { - unsigned int ulPllReg = 0; - - pPLL->inputFreq = DEFAULT_INPUT_CLOCK; - pPLL->clockType = clockType; - - switch (clockType) - { - case MXCLK_PLL: - ulPllReg = PEEK32(MXCLK_PLL_CTRL); - break; - case PRIMARY_PLL: - ulPllReg = PEEK32(PANEL_PLL_CTRL); - break; - case SECONDARY_PLL: - ulPllReg = PEEK32(CRT_PLL_CTRL); - break; - case VGA0_PLL: - ulPllReg = PEEK32(VGA_PLL0_CTRL); - break; - case VGA1_PLL: - ulPllReg = PEEK32(VGA_PLL1_CTRL); - break; - } - - pPLL->M = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, M); - pPLL->N = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, N); - pPLL->OD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, OD); - pPLL->POD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, POD); - - return calcPLL(pPLL); + unsigned int ulPllReg = 0; + + pPLL->inputFreq = DEFAULT_INPUT_CLOCK; + pPLL->clockType = clockType; + + switch (clockType) + { + case MXCLK_PLL: + ulPllReg = PEEK32(MXCLK_PLL_CTRL); + break; + case PRIMARY_PLL: + ulPllReg = PEEK32(PANEL_PLL_CTRL); + break; + case SECONDARY_PLL: + ulPllReg = PEEK32(CRT_PLL_CTRL); + break; + case VGA0_PLL: + ulPllReg = PEEK32(VGA_PLL0_CTRL); + break; + case VGA1_PLL: + ulPllReg = PEEK32(VGA_PLL1_CTRL); + break; + } + + pPLL->M = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, M); + pPLL->N = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, N); + pPLL->OD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, OD); + pPLL->POD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, POD); + + return calcPLL(pPLL); } unsigned int getChipClock(void) { - pll_value_t pll; + pll_value_t pll; #if 1 if(getChipType() == SM750LE) return MHz(130); #endif - return getPllValue(MXCLK_PLL, &pll); + return getPllValue(MXCLK_PLL, &pll); } @@ -110,75 +110,75 @@ unsigned int getChipClock(void) */ void setChipClock(unsigned int frequency) { - pll_value_t pll; - unsigned int ulActualMxClk; + pll_value_t pll; + unsigned int ulActualMxClk; #if 1 - /* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */ - if (getChipType() == SM750LE) - return; + /* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */ + if (getChipType() == SM750LE) + return; #endif - if (frequency != 0) - { - /* - * Set up PLL, a structure to hold the value to be set in clocks. - */ - pll.inputFreq = DEFAULT_INPUT_CLOCK; /* Defined in CLOCK.H */ - pll.clockType = MXCLK_PLL; - - /* - * Call calcPllValue() to fill up the other fields for PLL structure. - * Sometime, the chip cannot set up the exact clock required by User. - * Return value from calcPllValue() gives the actual possible clock. - */ - ulActualMxClk = calcPllValue(frequency, &pll); - - /* Master Clock Control: MXCLK_PLL */ - POKE32(MXCLK_PLL_CTRL, formatPllReg(&pll)); - } + if (frequency != 0) + { + /* + * Set up PLL, a structure to hold the value to be set in clocks. + */ + pll.inputFreq = DEFAULT_INPUT_CLOCK; /* Defined in CLOCK.H */ + pll.clockType = MXCLK_PLL; + + /* + * Call calcPllValue() to fill up the other fields for PLL structure. + * Sometime, the chip cannot set up the exact clock required by User. + * Return value from calcPllValue() gives the actual possible clock. + */ + ulActualMxClk = calcPllValue(frequency, &pll); + + /* Master Clock Control: MXCLK_PLL */ + POKE32(MXCLK_PLL_CTRL, formatPllReg(&pll)); + } } void setMemoryClock(unsigned int frequency) { - unsigned int ulReg, divisor; + unsigned int ulReg, divisor; #if 1 /* Cheok_0509: For SM750LE, the memory clock is fixed. Nothing to set. */ if (getChipType() == SM750LE) return; #endif - if (frequency != 0) - { - /* Set the frequency to the maximum frequency that the DDR Memory can take - which is 336MHz. */ - if (frequency > MHz(336)) - frequency = MHz(336); - - /* Calculate the divisor */ - divisor = (unsigned int) roundedDiv(getChipClock(), frequency); - - /* Set the corresponding divisor in the register. */ - ulReg = PEEK32(CURRENT_GATE); - switch(divisor) - { - default: - case 1: - ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_1); - break; - case 2: - ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_2); - break; - case 3: - ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_3); - break; - case 4: - ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_4); - break; - } - - setCurrentGate(ulReg); - } + if (frequency != 0) + { + /* Set the frequency to the maximum frequency that the DDR Memory can take + which is 336MHz. */ + if (frequency > MHz(336)) + frequency = MHz(336); + + /* Calculate the divisor */ + divisor = (unsigned int) roundedDiv(getChipClock(), frequency); + + /* Set the corresponding divisor in the register. */ + ulReg = PEEK32(CURRENT_GATE); + switch(divisor) + { + default: + case 1: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_1); + break; + case 2: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_2); + break; + case 3: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_3); + break; + case 4: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_4); + break; + } + + setCurrentGate(ulReg); + } } @@ -192,43 +192,43 @@ void setMemoryClock(unsigned int frequency) */ void setMasterClock(unsigned int frequency) { - unsigned int ulReg, divisor; - #if 1 + unsigned int ulReg, divisor; +#if 1 /* Cheok_0509: For SM750LE, the memory clock is fixed. Nothing to set. */ if (getChipType() == SM750LE) return; #endif - if (frequency != 0) - { - /* Set the frequency to the maximum frequency that the SM750 engine can - run, which is about 190 MHz. */ - if (frequency > MHz(190)) - frequency = MHz(190); - - /* Calculate the divisor */ - divisor = (unsigned int) roundedDiv(getChipClock(), frequency); - - /* Set the corresponding divisor in the register. */ - ulReg = PEEK32(CURRENT_GATE); - switch(divisor) - { - default: - case 3: - ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_3); - break; - case 4: - ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_4); - break; - case 6: - ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_6); - break; - case 8: - ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_8); - break; - } - - setCurrentGate(ulReg); - } + if (frequency != 0) + { + /* Set the frequency to the maximum frequency that the SM750 engine can + run, which is about 190 MHz. */ + if (frequency > MHz(190)) + frequency = MHz(190); + + /* Calculate the divisor */ + divisor = (unsigned int) roundedDiv(getChipClock(), frequency); + + /* Set the corresponding divisor in the register. */ + ulReg = PEEK32(CURRENT_GATE); + switch(divisor) + { + default: + case 3: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_3); + break; + case 4: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_4); + break; + case 6: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_6); + break; + case 8: + ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_8); + break; + } + + setCurrentGate(ulReg); + } } @@ -249,11 +249,11 @@ unsigned int ddk750_getVMSize(void) /* get frame buffer size from GPIO */ reg = FIELD_GET(PEEK32(MISC_CTRL),MISC_CTRL,LOCALMEM_SIZE); switch(reg){ - case MISC_CTRL_LOCALMEM_SIZE_8M: data = MB(8); break; /* 8 Mega byte */ - case MISC_CTRL_LOCALMEM_SIZE_16M: data = MB(16); break; /* 16 Mega byte */ - case MISC_CTRL_LOCALMEM_SIZE_32M: data = MB(32); break; /* 32 Mega byte */ - case MISC_CTRL_LOCALMEM_SIZE_64M: data = MB(64); break; /* 64 Mega byte */ - default: data = 0;break; + case MISC_CTRL_LOCALMEM_SIZE_8M: data = MB(8); break; /* 8 Mega byte */ + case MISC_CTRL_LOCALMEM_SIZE_16M: data = MB(16); break; /* 16 Mega byte */ + case MISC_CTRL_LOCALMEM_SIZE_32M: data = MB(32); break; /* 32 Mega byte */ + case MISC_CTRL_LOCALMEM_SIZE_64M: data = MB(64); break; /* 64 Mega byte */ + default: data = 0;break; } return data; @@ -391,10 +391,10 @@ int ddk750_initHw(initchip_param_t * pInitParam) unsigned int absDiff(unsigned int a, unsigned int b) { - if ( a > b ) - return(a - b); - else - return(b - a); + if ( a > b ) + return(a - b); + else + return(b - a); } #endif @@ -435,7 +435,7 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) {3,0,3,8}, }; - /* as sm750 register definition, N located in 2,15 and M located in 1,255 */ + /* as sm750 register definition, N located in 2,15 and M located in 1,255 */ int N,M,X,d; int xcnt; int miniDiff; @@ -446,11 +446,11 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) #if 1 if (getChipType() == SM750LE) - { - /* SM750LE don't have prgrammable PLL and M/N values to work on. - Just return the requested clock. */ - return request_orig; - } + { + /* SM750LE don't have prgrammable PLL and M/N values to work on. + Just return the requested clock. */ + return request_orig; + } #endif ret = 0; @@ -487,7 +487,7 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) { unsigned int diff; tmpClock = pll->inputFreq *M / N / X; - diff = absDiff(tmpClock,request_orig); + diff = absDiff(tmpClock,request_orig); if(diff < miniDiff) { pll->M = M; @@ -510,104 +510,104 @@ unsigned int ulRequestClk, /* Required pixel clock in Hz unit */ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ ) { - unsigned int M, N, OD, POD = 0, diff, pllClk, odPower, podPower; - unsigned int bestDiff = 0xffffffff; /* biggest 32 bit unsigned number */ + unsigned int M, N, OD, POD = 0, diff, pllClk, odPower, podPower; + unsigned int bestDiff = 0xffffffff; /* biggest 32 bit unsigned number */ unsigned int ret; /* Init PLL structure to know states */ - pPLL->M = 0; - pPLL->N = 0; - pPLL->OD = 0; - pPLL->POD = 0; + pPLL->M = 0; + pPLL->N = 0; + pPLL->OD = 0; + pPLL->POD = 0; /* Sanity check: None at the moment */ /* Convert everything in Khz range in order to avoid calculation overflow */ - pPLL->inputFreq /= 1000; - ulRequestClk /= 1000; + pPLL->inputFreq /= 1000; + ulRequestClk /= 1000; #ifndef VALIDATION_CHIP /* The maximum of post divider is 8. */ - for (POD=0; POD<=3; POD++) + for (POD=0; POD<=3; POD++) #endif - { + { #ifndef VALIDATION_CHIP - /* MXCLK_PLL does not have post divider. */ - if ((POD > 0) && (pPLL->clockType == MXCLK_PLL)) - break; + /* MXCLK_PLL does not have post divider. */ + if ((POD > 0) && (pPLL->clockType == MXCLK_PLL)) + break; #endif - /* Work out 2 to the power of POD */ - podPower = twoToPowerOfx(POD); + /* Work out 2 to the power of POD */ + podPower = twoToPowerOfx(POD); - /* OD has only 2 bits [15:14] and its value must between 0 to 3 */ - for (OD=0; OD<=3; OD++) - { - /* Work out 2 to the power of OD */ - odPower = twoToPowerOfx(OD); + /* OD has only 2 bits [15:14] and its value must between 0 to 3 */ + for (OD=0; OD<=3; OD++) + { + /* Work out 2 to the power of OD */ + odPower = twoToPowerOfx(OD); #ifdef VALIDATION_CHIP - if (odPower > 4) - podPower = 4; - else - podPower = odPower; + if (odPower > 4) + podPower = 4; + else + podPower = odPower; #endif - /* N has 4 bits [11:8] and its value must between 2 and 15. - The N == 1 will behave differently --> Result is not correct. */ - for (N=2; N<=15; N++) - { - /* The formula for PLL is ulRequestClk = inputFreq * M / N / (2^OD) - In the following steps, we try to work out a best M value given the others are known. - To avoid decimal calculation, we use 1000 as multiplier for up to 3 decimal places of accuracy. - */ - M = ulRequestClk * N * odPower * 1000 / pPLL->inputFreq; - M = roundedDiv(M, 1000); - - /* M field has only 8 bits, reject value bigger than 8 bits */ - if (M < 256) - { - /* Calculate the actual clock for a given M & N */ - pllClk = pPLL->inputFreq * M / N / odPower / podPower; - - /* How much are we different from the requirement */ - diff = absDiff(pllClk, ulRequestClk); - - if (diff < bestDiff) - { - bestDiff = diff; - - /* Store M and N values */ - pPLL->M = M; - pPLL->N = N; - pPLL->OD = OD; + /* N has 4 bits [11:8] and its value must between 2 and 15. + The N == 1 will behave differently --> Result is not correct. */ + for (N=2; N<=15; N++) + { + /* The formula for PLL is ulRequestClk = inputFreq * M / N / (2^OD) + In the following steps, we try to work out a best M value given the others are known. + To avoid decimal calculation, we use 1000 as multiplier for up to 3 decimal places of accuracy. + */ + M = ulRequestClk * N * odPower * 1000 / pPLL->inputFreq; + M = roundedDiv(M, 1000); + + /* M field has only 8 bits, reject value bigger than 8 bits */ + if (M < 256) + { + /* Calculate the actual clock for a given M & N */ + pllClk = pPLL->inputFreq * M / N / odPower / podPower; + + /* How much are we different from the requirement */ + diff = absDiff(pllClk, ulRequestClk); + + if (diff < bestDiff) + { + bestDiff = diff; + + /* Store M and N values */ + pPLL->M = M; + pPLL->N = N; + pPLL->OD = OD; #ifdef VALIDATION_CHIP - if (OD > 2) - POD = 2; - else - POD = OD; + if (OD > 2) + POD = 2; + else + POD = OD; #endif - pPLL->POD = POD; - } - } - } - } - } + pPLL->POD = POD; + } + } + } + } + } /* Restore input frequency from Khz to hz unit */ // pPLL->inputFreq *= 1000; - ulRequestClk *= 1000; - pPLL->inputFreq = DEFAULT_INPUT_CLOCK; /* Default reference clock */ + ulRequestClk *= 1000; + pPLL->inputFreq = DEFAULT_INPUT_CLOCK; /* Default reference clock */ /* Output debug information */ - //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Requested Frequency = %d\n", ulRequestClk)); - //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Input CLK = %dHz, M=%d, N=%d, OD=%d, POD=%d\n", pPLL->inputFreq, pPLL->M, pPLL->N, pPLL->OD, pPLL->POD)); + //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Requested Frequency = %d\n", ulRequestClk)); + //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Input CLK = %dHz, M=%d, N=%d, OD=%d, POD=%d\n", pPLL->inputFreq, pPLL->M, pPLL->N, pPLL->OD, pPLL->POD)); /* Return actual frequency that the PLL can set */ ret = calcPLL(pPLL); - return ret; + return ret; } @@ -616,22 +616,22 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ unsigned int formatPllReg(pll_value_t *pPLL) { - unsigned int ulPllReg = 0; + unsigned int ulPllReg = 0; /* Note that all PLL's have the same format. Here, we just use Panel PLL parameter to work out the bit fields in the register. On returning a 32 bit number, the value can be applied to any PLL in the calling function. */ - ulPllReg = - FIELD_SET( 0, PANEL_PLL_CTRL, BYPASS, OFF) - | FIELD_SET( 0, PANEL_PLL_CTRL, POWER, ON) - | FIELD_SET( 0, PANEL_PLL_CTRL, INPUT, OSC) + ulPllReg = + FIELD_SET( 0, PANEL_PLL_CTRL, BYPASS, OFF) + | FIELD_SET( 0, PANEL_PLL_CTRL, POWER, ON) + | FIELD_SET( 0, PANEL_PLL_CTRL, INPUT, OSC) #ifndef VALIDATION_CHIP - | FIELD_VALUE(0, PANEL_PLL_CTRL, POD, pPLL->POD) + | FIELD_VALUE(0, PANEL_PLL_CTRL, POD, pPLL->POD) #endif - | FIELD_VALUE(0, PANEL_PLL_CTRL, OD, pPLL->OD) - | FIELD_VALUE(0, PANEL_PLL_CTRL, N, pPLL->N) - | FIELD_VALUE(0, PANEL_PLL_CTRL, M, pPLL->M); + | FIELD_VALUE(0, PANEL_PLL_CTRL, OD, pPLL->OD) + | FIELD_VALUE(0, PANEL_PLL_CTRL, N, pPLL->N) + | FIELD_VALUE(0, PANEL_PLL_CTRL, M, pPLL->M); return ulPllReg; } -- cgit v1.2.3 From bb046fef9668baf1c4744a3c7aba05e15e44c9ac Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Mon, 9 Mar 2015 20:08:23 +0530 Subject: staging: panel: register reboot we donot need the reboot notifier in module init section, as the notifier is used after lcd is initialized. so lets register for the reboot notifier only after we have successfully attached to the parallel port. and similarly unregister at detach. Signed-off-by: Sudip Mukherjee Acked-by: Willy Tarreau Signed-off-by: Greg Kroah-Hartman --- drivers/staging/panel/panel.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index 3339633e88d3..ac147253cc54 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -2234,6 +2234,7 @@ static void panel_attach(struct parport *port) if (misc_register(&keypad_dev)) goto err_lcd_unreg; } + register_reboot_notifier(&panel_notifier); return; err_lcd_unreg: @@ -2255,6 +2256,8 @@ static void panel_detach(struct parport *port) return; } + unregister_reboot_notifier(&panel_notifier); + if (keypad.enabled && keypad_initialized) { misc_deregister(&keypad_dev); keypad_initialized = 0; @@ -2321,7 +2324,6 @@ static int __init panel_init_module(void) break; } - /* * Overwrite selection with module param values (both keypad and lcd), * where the deprecated params have lower prio. @@ -2391,8 +2393,6 @@ static int __init panel_init_module(void) return -EIO; } - register_reboot_notifier(&panel_notifier); - if (pprt) pr_info("driver version " PANEL_VERSION " registered on parport%d (io=0x%lx).\n", parport, @@ -2408,7 +2408,6 @@ static int __init panel_init_module(void) static void __exit panel_cleanup_module(void) { - unregister_reboot_notifier(&panel_notifier); if (scan_timer.function != NULL) del_timer_sync(&scan_timer); -- cgit v1.2.3 From e134201b7a27eaf1ce3affe39ea6f30a1a747186 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Mon, 9 Mar 2015 20:08:24 +0530 Subject: staging: panel: return register value we were returning success even if the module failed to register. now we are returning the actual return value, success or error. Signed-off-by: Sudip Mukherjee Acked-by: Willy Tarreau Signed-off-by: Greg Kroah-Hartman --- drivers/staging/panel/panel.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index ac147253cc54..ee26413cea47 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -2282,7 +2282,7 @@ static struct parport_driver panel_driver = { /* init function */ static int __init panel_init_module(void) { - int selected_keypad_type = NOT_SET; + int selected_keypad_type = NOT_SET, err; /* take care of an eventual profile */ switch (profile) { @@ -2388,9 +2388,10 @@ static int __init panel_init_module(void) return -ENODEV; } - if (parport_register_driver(&panel_driver)) { + err = parport_register_driver(&panel_driver); + if (err) { pr_err("could not register with parport. Aborting.\n"); - return -EIO; + return err; } if (pprt) -- cgit v1.2.3 From dec8c37818a26869ba5cdf0b1033eeb9296dc2fb Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Mon, 9 Mar 2015 20:08:25 +0530 Subject: staging: panel: remove initialization check no need to monitor init_in_progress now as keypad_send_key() can only be called after the timer is initialized. and timer is initialized from keypad_init() which is in the attach section and can only execute after the module has initialized. Signed-off-by: Sudip Mukherjee Acked-by: Willy Tarreau Signed-off-by: Greg Kroah-Hartman --- drivers/staging/panel/panel.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index ee26413cea47..b7ffdfb5c3e6 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -473,8 +473,6 @@ static struct pardevice *pprt; static int keypad_initialized; -static char init_in_progress; - static void (*lcd_write_cmd)(int); static void (*lcd_write_data)(int); static void (*lcd_clear_fast)(void); @@ -1718,9 +1716,6 @@ static struct miscdevice keypad_dev = { static void keypad_send_key(const char *string, int max_len) { - if (init_in_progress) - return; - /* send the key to the device only if a process is attached to it. */ if (!atomic_read(&keypad_available)) { while (max_len-- && keypad_buflen < KEYPAD_BUFFER && *string) { @@ -2379,9 +2374,6 @@ static int __init panel_init_module(void) break; } - /* tells various subsystems about the fact that we are initializing */ - init_in_progress = 1; - if (!lcd.enabled && !keypad.enabled) { /* no device enabled, let's exit */ pr_err("driver version " PANEL_VERSION " disabled.\n"); @@ -2401,9 +2393,6 @@ static int __init panel_init_module(void) else pr_info("driver version " PANEL_VERSION " not yet registered\n"); - /* tells various subsystems about the fact that initialization - is finished */ - init_in_progress = 0; return 0; } -- cgit v1.2.3 From e62c1d5cdf5184ce5b09a5547483846e8d672566 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:20 +0000 Subject: staging: comedi: add comedi_pci.h Add a new header that Comedi PCI drivers can include instead of "comedidev.h". Currently, it just pulls in and "comedidev.h", but the plan is to migrate the PCI-specific stuff from "comedidev.h" here. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_pci.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 drivers/staging/comedi/comedi_pci.h (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_pci.h b/drivers/staging/comedi/comedi_pci.h new file mode 100644 index 000000000000..a0834651dee0 --- /dev/null +++ b/drivers/staging/comedi/comedi_pci.h @@ -0,0 +1,30 @@ +/* + * comedi_pci.h + * header file for Comedi PCI drivers + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 1997-2000 David A. Schleef + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _COMEDI_PCI_H +#define _COMEDI_PCI_H + +#include + +#include "comedidev.h" + +/* + * TODO: Move PCI-specific stuff into here from "comedidev.h". + */ + +#endif /* _COMEDI_PCI_H */ -- cgit v1.2.3 From 7b39675a3a1730ea4bd00be92271027474908d19 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:21 +0000 Subject: staging: comedi: comedi_pci.c: include new "comedi_pci.h" header Include the new "comedi_pci.h" header instead of and "comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_pci.c b/drivers/staging/comedi/comedi_pci.c index 6ba59c977006..027f0f4e59c1 100644 --- a/drivers/staging/comedi/comedi_pci.c +++ b/drivers/staging/comedi/comedi_pci.c @@ -17,10 +17,9 @@ */ #include -#include #include -#include "comedidev.h" +#include "comedi_pci.h" /** * comedi_to_pci_dev() - comedi_device pointer to pci_dev pointer. -- cgit v1.2.3 From 7215a28471c6b78390965b660d079249d5996c26 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:22 +0000 Subject: staging: comedi: 8255_pci: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c index 291aed14f7e3..bb9854b56807 100644 --- a/drivers/staging/comedi/drivers/8255_pci.c +++ b/drivers/staging/comedi/drivers/8255_pci.c @@ -62,9 +62,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "8255.h" -- cgit v1.2.3 From 670afd26b1eec7b88832a367b9b676d7e8b69722 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:23 +0000 Subject: staging: comedi: addi_apci_1032: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1032.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c b/drivers/staging/comedi/drivers/addi_apci_1032.c index 993ecc639430..f82cee40c8e6 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1032.c +++ b/drivers/staging/comedi/drivers/addi_apci_1032.c @@ -71,10 +71,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "amcc_s5933.h" -- cgit v1.2.3 From 7c2302e687cf36f9b4fe55269ecdb5fa967c1d0a Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:24 +0000 Subject: staging: comedi: addi_apci_1500: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1500.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index 3dd017940aaf..c71847eb749b 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -22,10 +22,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "amcc_s5933.h" #include "z8536.h" -- cgit v1.2.3 From bfa3c585989da88c51ecee949e64fe33dbf6e05f Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:25 +0000 Subject: staging: comedi: addi_apci_1516: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1516.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1516.c b/drivers/staging/comedi/drivers/addi_apci_1516.c index d8410415cc90..c3505a52cdc2 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1516.c +++ b/drivers/staging/comedi/drivers/addi_apci_1516.c @@ -23,9 +23,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "addi_watchdog.h" #include "comedi_fc.h" -- cgit v1.2.3 From 526a8e3b279cfd6a92d7146b769d023e841f9852 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:26 +0000 Subject: staging: comedi: addi_apci_1564: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1564.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index 2de5e8320957..c481c48cdbde 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -22,11 +22,10 @@ */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "addi_tcw.h" #include "addi_watchdog.h" -- cgit v1.2.3 From cebdf0dd989bbf11cb0ec8403b5d3511583c749e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:27 +0000 Subject: staging: comedi: addi_apci_16xx: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_16xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_16xx.c b/drivers/staging/comedi/drivers/addi_apci_16xx.c index a1248dab369f..c63133a12a4e 100644 --- a/drivers/staging/comedi/drivers/addi_apci_16xx.c +++ b/drivers/staging/comedi/drivers/addi_apci_16xx.c @@ -23,9 +23,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" /* * Register I/O map -- cgit v1.2.3 From 66a630cad62feea5f89b526bac32da8b51efe7b6 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:28 +0000 Subject: staging: comedi: addi_apci_2032: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_2032.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c index eebf4f151b39..86abb7201698 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2032.c +++ b/drivers/staging/comedi/drivers/addi_apci_2032.c @@ -23,11 +23,10 @@ */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "addi_watchdog.h" #include "comedi_fc.h" -- cgit v1.2.3 From 6e99da194b9e3197fecb89b273f4feaea750a165 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:29 +0000 Subject: staging: comedi: addi_apci_2200: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_2200.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_2200.c b/drivers/staging/comedi/drivers/addi_apci_2200.c index 1f9d13661ac9..2b382a52d80d 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2200.c +++ b/drivers/staging/comedi/drivers/addi_apci_2200.c @@ -23,9 +23,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "addi_watchdog.h" /* -- cgit v1.2.3 From b8c0a0ac0d3276e5c1c3e46865c582285e026e15 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:30 +0000 Subject: staging: comedi: addi_apci_3120: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3120.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index c65f9407fd06..5822f1fe359a 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -22,10 +22,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "amcc_s5933.h" -- cgit v1.2.3 From ed9c2cfc7ea7d24b424a305b3ad9d7057015d60c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:31 +0000 Subject: staging: comedi: addi_apci_3501: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3501.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index babbdffefa88..0869f7f66842 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -23,11 +23,10 @@ */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "amcc_s5933.h" -- cgit v1.2.3 From 6d669e563a2f772067c04fe457bbbb94e41b908b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:32 +0000 Subject: staging: comedi: addi_apci_3xxx: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3xxx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_3xxx.c b/drivers/staging/comedi/drivers/addi_apci_3xxx.c index c173810a3b5b..8dadab8b3e09 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3xxx.c +++ b/drivers/staging/comedi/drivers/addi_apci_3xxx.c @@ -23,10 +23,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" -- cgit v1.2.3 From 80a324c7765bb5912de87fa7ace3dc58f7d44a7e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:33 +0000 Subject: staging: comedi: adl_pci6208: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci6208.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index cc752812f8ee..7ed3fd6fbd3e 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -33,9 +33,8 @@ #include #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" /* * PCI-6208/6216-GL register map -- cgit v1.2.3 From 28b574841c188852c09f6fcf0d3444614e1e65cc Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:34 +0000 Subject: staging: comedi: adl_pci7x3x: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci7x3x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci7x3x.c b/drivers/staging/comedi/drivers/adl_pci7x3x.c index 618e641ffaac..934af3ff7897 100644 --- a/drivers/staging/comedi/drivers/adl_pci7x3x.c +++ b/drivers/staging/comedi/drivers/adl_pci7x3x.c @@ -53,9 +53,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" /* * Register I/O map (32-bit access only) -- cgit v1.2.3 From 87ac3c9e9924fa80af831dd83ba5c89741fde9fc Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:35 +0000 Subject: staging: comedi: adl_pci8164: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci8164.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index 4a9d63ab10bc..da901c8dec0e 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -28,9 +28,8 @@ #include #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" #define PCI8164_AXIS(x) ((x) * 0x08) #define PCI8164_CMD_MSTS_REG 0x00 -- cgit v1.2.3 From b60535d70d8dacabe767af2196534c33284e60cf Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:36 +0000 Subject: staging: comedi: adl_pci9111: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9111.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index bf563ed08bc2..5ca7c6e45d93 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -65,11 +65,10 @@ TODO: */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "plx9052.h" #include "comedi_fc.h" -- cgit v1.2.3 From b2ad146af57a9e0eb758c75b32e09091fff00a73 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:37 +0000 Subject: staging: comedi: adl_pci9118: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 65b702cc04c1..eb4a528b6431 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -73,13 +73,12 @@ */ #include -#include #include #include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "amcc_s5933.h" #include "comedi_8254.h" -- cgit v1.2.3 From 2a12d9681b39fd9a221199e6ebb143ae61efc412 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:38 +0000 Subject: staging: comedi: adv_pci1710: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 4a0fb62e2802..f71750bb4304 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -42,10 +42,9 @@ Configuration options: */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "comedi_8254.h" -- cgit v1.2.3 From 4b15c14b3fab1a3bf78d2dd1e63dcd010015e7f1 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:39 +0000 Subject: staging: comedi: adv_pci1723: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1723.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index f1945be89eff..1921a97cc5ca 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -41,9 +41,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" /* * PCI Bar 2 I/O Register map (dev->iobase) -- cgit v1.2.3 From 654f5cd1249a31bb4b616e54cbc20fce6b9ccdb7 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:40 +0000 Subject: staging: comedi: adv_pci1724: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1724.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adv_pci1724.c b/drivers/staging/comedi/drivers/adv_pci1724.c index a3573ea6f9c0..f7a7dab013db 100644 --- a/drivers/staging/comedi/drivers/adv_pci1724.c +++ b/drivers/staging/comedi/drivers/adv_pci1724.c @@ -47,9 +47,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" /* * PCI bar 2 Register I/O map (dev->iobase) -- cgit v1.2.3 From 5f22dadd43619ba7d5e536dc750e7ab95481e032 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:41 +0000 Subject: staging: comedi: adv_pci_dio: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 11168f9e135b..456e87013063 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -30,10 +30,9 @@ Configuration options: */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "8255.h" #include "comedi_8254.h" -- cgit v1.2.3 From ffe06e04bdc978ff529d464525711639530c08fc Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:42 +0000 Subject: staging: comedi: amplc_dio200_pci: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c index b83d1f5a8fb9..d9850c917163 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c @@ -221,10 +221,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "amplc_dio200.h" -- cgit v1.2.3 From b3c8b18850617b29f564c16f1cfad72c5bd1ad6b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:43 +0000 Subject: staging: comedi: amplc_pci224: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci224.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index cf5f646e514e..6c9fa4ab4fcd 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -103,11 +103,10 @@ */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "comedi_8254.h" -- cgit v1.2.3 From 0d23c28c23b99e8d813248143f65d22b78a9826f Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:44 +0000 Subject: staging: comedi: amplc_pci230: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci230.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 2dd794d01354..a145f39682f4 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -181,11 +181,10 @@ */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "comedi_8254.h" -- cgit v1.2.3 From 17decabfabb4d5e344e06b2c9725b1aa6cc671e0 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:45 +0000 Subject: staging: comedi: amplc_pci236: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci236.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_pci236.c b/drivers/staging/comedi/drivers/amplc_pci236.c index ad1e93dd13a0..31cc38b4bcad 100644 --- a/drivers/staging/comedi/drivers/amplc_pci236.c +++ b/drivers/staging/comedi/drivers/amplc_pci236.c @@ -42,10 +42,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "amplc_pc236.h" #include "plx9052.h" -- cgit v1.2.3 From 61873d0a1b29fa10f0c679ee9c64defb4c6a1f06 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:46 +0000 Subject: staging: comedi: amplc_pci263: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci263.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_pci263.c b/drivers/staging/comedi/drivers/amplc_pci263.c index 0d2224b832ac..b6768aa90547 100644 --- a/drivers/staging/comedi/drivers/amplc_pci263.c +++ b/drivers/staging/comedi/drivers/amplc_pci263.c @@ -33,9 +33,8 @@ The state of the outputs can be read. */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" static int pci263_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, -- cgit v1.2.3 From 326406806cd0f69cccf3a526b6297ab4b9f97e38 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:47 +0000 Subject: staging: comedi: cb_pcidas64: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 2b7c50aa1e39..15106d0a38b2 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -81,11 +81,10 @@ TODO: */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "8255.h" #include "plx9080.h" -- cgit v1.2.3 From 29e0a3db395e98a2f79555bbd4101c431e460102 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:48 +0000 Subject: staging: comedi: cb_pcidas: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 6fdf975daa19..bad04d99190b 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -62,11 +62,10 @@ analog triggering on 1602 series */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_8254.h" #include "8255.h" -- cgit v1.2.3 From b2e075f611059f7055dc962c195e7d98585de733 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:49 +0000 Subject: staging: comedi: cb_pcidda: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidda.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 2b2cfcdda5bd..1e232b1e3194 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -36,9 +36,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "8255.h" -- cgit v1.2.3 From b062252d214d50a798ca0a3910f775ee6bcac670 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:50 +0000 Subject: staging: comedi: cb_pcimdas: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index acb77406bce3..c458e5010a74 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -42,10 +42,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_8254.h" #include "plx9052.h" -- cgit v1.2.3 From bf5a5c0b2f2c7ea5a6f063d5e59e2b3ec575caaa Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:51 +0000 Subject: staging: comedi: cb_pcimdda: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdda.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index e834be9b0567..a4781dbbdd82 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -75,9 +75,8 @@ Configuration Options: not applicable, uses PCI auto config */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "8255.h" -- cgit v1.2.3 From 7c1b6627061a8bcace7b58abae609b0741d05cd1 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:52 +0000 Subject: staging: comedi: contec_pci_dio: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/contec_pci_dio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index ba26c134a46d..4956a49a6140 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -26,9 +26,8 @@ Configuration Options: not applicable, uses comedi PCI auto config */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" /* * Register map -- cgit v1.2.3 From dde50ca454097f3d0095e16208e70ee3768cfd45 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:53 +0000 Subject: staging: comedi: daqboard2000: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/daqboard2000.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index d625afd633d3..f97d18d92255 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -103,11 +103,10 @@ Configuration options: not applicable, uses PCI auto config */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "8255.h" -- cgit v1.2.3 From 0483a811cf11d1e58989368a201fe1fd548d424f Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:54 +0000 Subject: staging: comedi: das08_pci: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das08_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/das08_pci.c b/drivers/staging/comedi/drivers/das08_pci.c index b2ea10b848c3..d8d27fa44491 100644 --- a/drivers/staging/comedi/drivers/das08_pci.c +++ b/drivers/staging/comedi/drivers/das08_pci.c @@ -32,9 +32,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "das08.h" -- cgit v1.2.3 From a432e1b566c7cfa6e9f093ff7dbbcff886dabafb Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:55 +0000 Subject: staging: comedi: dt3000: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt3000.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 0aa51980e327..1b8ac9999477 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -49,11 +49,10 @@ AO commands are not supported. */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" -- cgit v1.2.3 From 5ca7653efa34b3ed4ebd6ce43eed23b5deb4d4de Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:56 +0000 Subject: staging: comedi: dyna_pci10xx: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dyna_pci10xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c index c241d92e7cc2..c9eb26fab44e 100644 --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c @@ -34,10 +34,9 @@ #include #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #define READ_TIMEOUT 50 -- cgit v1.2.3 From 3b806b175eda0de2fb74add45b14eee967e2bf7c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:57 +0000 Subject: staging: comedi: gsc_hpdi: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/gsc_hpdi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index be9988d37338..8b7c475903ec 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -41,11 +41,10 @@ */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "plx9080.h" #include "comedi_fc.h" -- cgit v1.2.3 From 16947f226a8899e3d61bcf8ae66e5336c5c7af9d Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:58 +0000 Subject: staging: comedi: icp_multi: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/icp_multi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index ddcb25df9c51..1e104ebf8057 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -43,11 +43,10 @@ Configuration options: not applicable, uses PCI auto config */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #define ICP_MULTI_ADC_CSR 0 /* R/W: ADC command/status register */ #define ICP_MULTI_AI 2 /* R: Analogue input data */ -- cgit v1.2.3 From e4c296dcd458145467711de58da609a1cef07f11 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:10:59 +0000 Subject: staging: comedi: jr3_pci: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/jr3_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index 282c37f759d8..b87192e0f9aa 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -39,14 +39,13 @@ #include #include -#include #include #include #include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "jr3_pci.h" -- cgit v1.2.3 From f13d862cab2ee604475a6425a7e5a741167296c5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:00 +0000 Subject: staging: comedi: ke_counter: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ke_counter.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 3c19e0f178ca..dc642edf4f65 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -28,9 +28,8 @@ */ #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" /* * PCI BAR 0 Register I/O map -- cgit v1.2.3 From f2e8e2853e28d8bb99d0d7613af00ba7642f6ad4 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:01 +0000 Subject: staging: comedi: me4000: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index ec99254b3a64..2502ac67bd4e 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -41,11 +41,10 @@ broken. */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "comedi_8254.h" -- cgit v1.2.3 From b33e841ef8aea4a425294d366ee023e5e27cc14c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:02 +0000 Subject: staging: comedi: me_daq: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me_daq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 92e23527f2cb..d78e9195fbce 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -30,11 +30,10 @@ */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "plx9052.h" -- cgit v1.2.3 From 31ba5981c99617f632f4c4605b78cb872d19a4fb Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:03 +0000 Subject: staging: comedi: mf6x4: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mf6x4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/mf6x4.c b/drivers/staging/comedi/drivers/mf6x4.c index e9a74ca8f7e9..a675e2ef9b45 100644 --- a/drivers/staging/comedi/drivers/mf6x4.c +++ b/drivers/staging/comedi/drivers/mf6x4.c @@ -26,9 +26,9 @@ */ #include -#include #include -#include "../comedidev.h" + +#include "../comedi_pci.h" /* Registers present in BAR0 memory region */ #define MF624_GPIOC_R 0x54 -- cgit v1.2.3 From 4953d2c25a81fb21ac94b56ff5b72de2abb2680b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:04 +0000 Subject: staging: comedi: mite.c: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mite.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 79b5597db1a1..4cfe949e4dc5 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -47,9 +47,8 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "mite.h" -- cgit v1.2.3 From 776d0d3d0aac82286431a71cbbf82fee935ab99b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:05 +0000 Subject: staging: comedi: mite.h: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mite.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index b2b12045b3a5..b3ca7fc3a31e 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -19,10 +19,9 @@ #ifndef _MITE_H_ #define _MITE_H_ -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #define PCIMIO_COMPAT -- cgit v1.2.3 From 2bacde880494c3757ee6f9dce81c0fdfbc72de62 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:06 +0000 Subject: staging: comedi: ni_6527: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_6527.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index 530f716f6586..dc87114727a2 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -28,10 +28,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" -- cgit v1.2.3 From 7b9c3d1436acff25350fa47c2ccf6a115d3d6c68 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:07 +0000 Subject: staging: comedi: ni_65xx: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_65xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 1ff231f91f3b..b158bfb292bf 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -57,10 +57,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" -- cgit v1.2.3 From a6c760b1a715c18e7599d6848bb120e8f9032273 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:08 +0000 Subject: staging: comedi: ni_660x: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 660dc6fc777e..b913158e5706 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -35,10 +35,9 @@ */ #include -#include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "mite.h" -- cgit v1.2.3 From 29321b5546f15167cdadee0d17c14debcb476e7c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:09 +0000 Subject: staging: comedi: ni_670x: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_670x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index 90b4dfa6261b..13c6ccb1fdea 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -37,11 +37,10 @@ Commands are not supported. */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #define AO_VALUE_OFFSET 0x00 #define AO_CHAN_OFFSET 0x0c -- cgit v1.2.3 From fffd65dc45d2c8c4816f191c29319afb59fb016e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:10 +0000 Subject: staging: comedi: ni_labpc_pci: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_labpc_pci.c b/drivers/staging/comedi/drivers/ni_labpc_pci.c index f50a5a2ee079..77d403801db5 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_pci.c +++ b/drivers/staging/comedi/drivers/ni_labpc_pci.c @@ -31,9 +31,8 @@ #include #include -#include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "ni_labpc.h" -- cgit v1.2.3 From 2a5f650e602f56591a96a9d74fd480ae4f42dcd6 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:11 +0000 Subject: staging: comedi: ni_pcmdio: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcidio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 28523199f7de..9e01f8d85994 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -53,7 +53,7 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "mite.h" -- cgit v1.2.3 From 069724326bbbff81ac5d37425068eb060d190416 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:12 +0000 Subject: staging: comedi: ni_pcmmio: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcimio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 409090d78cc4..1481f71a31b1 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -109,7 +109,7 @@ Bugs: #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include -- cgit v1.2.3 From 9fca154cf382922e25f73b668a6fc25b228f3f66 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:13 +0000 Subject: staging: comedi: rtd520: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/rtd520.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index f05b187c33aa..d1ecb518b97c 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -94,11 +94,10 @@ */ #include -#include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "plx9080.h" -- cgit v1.2.3 From 6ab38b050fa69092aa1de0106800571ae2b753fa Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:14 +0000 Subject: staging: comedi: s626: include new "comedi_pci.h" header Include the new "../comedi_pci.h" header instead of and "../comedidev.h", which will now get included indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/s626.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 3b9ef9a6918b..53a248bc9d80 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -61,12 +61,11 @@ #include #include -#include #include #include #include -#include "../comedidev.h" +#include "../comedi_pci.h" #include "comedi_fc.h" #include "s626.h" -- cgit v1.2.3 From 4e9adfbcaae9b5245517143c900f8873715a6059 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 10 Mar 2015 16:11:15 +0000 Subject: staging: comedi: comedi_pci.h: move PCI stuff out of comedidev.h Move the PCI-specific stuff out of "comedidev.h" into "comedi_pci.h". Comedi PCI drivers now include "comedi_pci.h" instead of "comedidev.h", which now gets pulled in indirectly. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_pci.h | 36 ++++++++++++++++++++++++++++++- drivers/staging/comedi/comedidev.h | 43 ------------------------------------- 2 files changed, 35 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_pci.h b/drivers/staging/comedi/comedi_pci.h index a0834651dee0..4005cc9cf7f1 100644 --- a/drivers/staging/comedi/comedi_pci.h +++ b/drivers/staging/comedi/comedi_pci.h @@ -24,7 +24,41 @@ #include "comedidev.h" /* - * TODO: Move PCI-specific stuff into here from "comedidev.h". + * PCI Vendor IDs not in */ +#define PCI_VENDOR_ID_KOLTER 0x1001 +#define PCI_VENDOR_ID_ICP 0x104c +#define PCI_VENDOR_ID_DT 0x1116 +#define PCI_VENDOR_ID_IOTECH 0x1616 +#define PCI_VENDOR_ID_CONTEC 0x1221 +#define PCI_VENDOR_ID_RTD 0x1435 +#define PCI_VENDOR_ID_HUMUSOFT 0x186c + +struct pci_dev *comedi_to_pci_dev(struct comedi_device *); + +int comedi_pci_enable(struct comedi_device *); +void comedi_pci_disable(struct comedi_device *); +void comedi_pci_detach(struct comedi_device *); + +int comedi_pci_auto_config(struct pci_dev *, struct comedi_driver *, + unsigned long context); +void comedi_pci_auto_unconfig(struct pci_dev *); + +int comedi_pci_driver_register(struct comedi_driver *, struct pci_driver *); +void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *); + +/** + * module_comedi_pci_driver() - Helper macro for registering a comedi PCI driver + * @__comedi_driver: comedi_driver struct + * @__pci_driver: pci_driver struct + * + * Helper macro for comedi PCI drivers which do not do anything special + * in module init/exit. This eliminates a lot of boilerplate. Each + * module may only use this macro once, and calling it replaces + * module_init() and module_exit() + */ +#define module_comedi_pci_driver(__comedi_driver, __pci_driver) \ + module_driver(__comedi_driver, comedi_pci_driver_register, \ + comedi_pci_driver_unregister, &(__pci_driver)) #endif /* _COMEDI_PCI_H */ diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 30595c0cd5b0..4720dbcd0b38 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -554,47 +554,4 @@ void comedi_driver_unregister(struct comedi_driver *); module_driver(__comedi_driver, comedi_driver_register, \ comedi_driver_unregister) -/* comedi_pci.c - comedi PCI driver specific functions */ - -/* - * PCI Vendor IDs not in - */ -#define PCI_VENDOR_ID_KOLTER 0x1001 -#define PCI_VENDOR_ID_ICP 0x104c -#define PCI_VENDOR_ID_DT 0x1116 -#define PCI_VENDOR_ID_IOTECH 0x1616 -#define PCI_VENDOR_ID_CONTEC 0x1221 -#define PCI_VENDOR_ID_RTD 0x1435 -#define PCI_VENDOR_ID_HUMUSOFT 0x186c - -struct pci_dev; -struct pci_driver; - -struct pci_dev *comedi_to_pci_dev(struct comedi_device *); - -int comedi_pci_enable(struct comedi_device *); -void comedi_pci_disable(struct comedi_device *); -void comedi_pci_detach(struct comedi_device *); - -int comedi_pci_auto_config(struct pci_dev *, struct comedi_driver *, - unsigned long context); -void comedi_pci_auto_unconfig(struct pci_dev *); - -int comedi_pci_driver_register(struct comedi_driver *, struct pci_driver *); -void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *); - -/** - * module_comedi_pci_driver() - Helper macro for registering a comedi PCI driver - * @__comedi_driver: comedi_driver struct - * @__pci_driver: pci_driver struct - * - * Helper macro for comedi PCI drivers which do not do anything special - * in module init/exit. This eliminates a lot of boilerplate. Each - * module may only use this macro once, and calling it replaces - * module_init() and module_exit() - */ -#define module_comedi_pci_driver(__comedi_driver, __pci_driver) \ - module_driver(__comedi_driver, comedi_pci_driver_register, \ - comedi_pci_driver_unregister, &(__pci_driver)) - #endif /* _COMEDIDEV_H */ -- cgit v1.2.3 From 11dd0360cf882182d780eb9941cde404a4e21034 Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Wed, 11 Mar 2015 22:52:54 -0500 Subject: staging: fsl-mc: Corrected email addresses in TODO file Signed-off-by: J. German Rivera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/TODO | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/TODO b/drivers/staging/fsl-mc/TODO index 49ebfd90438f..d78288b4e721 100644 --- a/drivers/staging/fsl-mc/TODO +++ b/drivers/staging/fsl-mc/TODO @@ -8,5 +8,6 @@ * Add at least one device driver for a DPAA2 object (child device of the fsl-mc bus). -Please send any patches to Greg Kroah-Hartman , -devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org +Please send any patches to Greg Kroah-Hartman , +german.rivera@freescale.com, devel@driverdev.osuosl.org, +linux-kernel@vger.kernel.org -- cgit v1.2.3 From 877945759df5ff6e7fb434cb5b6cddb606c2f66f Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Mon, 16 Mar 2015 20:59:08 +0100 Subject: Staging: octeon: constify of_device_id array of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 2 +- drivers/staging/octeon/ethernet.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 1daeb3125a1f..959123279ce8 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -3885,7 +3885,7 @@ static int octeon_usb_remove(struct platform_device *pdev) return 0; } -static struct of_device_id octeon_usb_match[] = { +static const struct of_device_id octeon_usb_match[] = { { .compatible = "cavium,octeon-5750-usbc", }, diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 460e8545904f..79f33349e93f 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -859,7 +859,7 @@ static int cvm_oct_remove(struct platform_device *pdev) return 0; } -static struct of_device_id cvm_oct_match[] = { +static const struct of_device_id cvm_oct_match[] = { { .compatible = "cavium,octeon-3860-pip", }, -- cgit v1.2.3 From 4bc88f63d7af89831fac82b67625f3e19156abba Mon Sep 17 00:00:00 2001 From: "Ravindran, Madhusudhanan (M.)" Date: Fri, 13 Mar 2015 13:12:37 +0000 Subject: staging: netlogic: allocate right size in devm_kzalloc sizeof when applied to a pointer typed expression gives the size of the pointer. The semantic patch that makes this change is available in scripts/coccinelle/misc/noderef.cocci. Signed-off-by: Madhusudhanan Ravindran Signed-off-by: Greg Kroah-Hartman --- drivers/staging/netlogic/xlr_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c index e8aae09d1624..8ae01753b011 100644 --- a/drivers/staging/netlogic/xlr_net.c +++ b/drivers/staging/netlogic/xlr_net.c @@ -1012,7 +1012,7 @@ static int xlr_net_probe(struct platform_device *pdev) * Allocate our adapter data structure and attach it to the device. */ adapter = (struct xlr_adapter *) - devm_kzalloc(&pdev->dev, sizeof(adapter), GFP_KERNEL); + devm_kzalloc(&pdev->dev, sizeof(*adapter), GFP_KERNEL); if (!adapter) { err = -ENOMEM; return err; -- cgit v1.2.3 From 82fdb8dd11851b4c12da78c4626740c83bc3fc2d Mon Sep 17 00:00:00 2001 From: Ricardo Ribalda Delgado Date: Mon, 16 Mar 2015 23:01:44 +0100 Subject: staging/goldfish/goldfish_audio: Fix annotations dmam_alloc_coherent does not return a __iomem pointer. here is its prototype: void * dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp) This fixes these sparse warnings: drivers/staging/goldfish/goldfish_audio.c:134:43: warning: incorrect type in argument 2 (different address spaces) drivers/staging/goldfish/goldfish_audio.c:134:43: expected void const *from drivers/staging/goldfish/goldfish_audio.c:134:43: got char [noderef] *read_buffer drivers/staging/goldfish/goldfish_audio.c:167:36: warning: incorrect type in argument 1 (different address spaces) drivers/staging/goldfish/goldfish_audio.c:167:36: expected void *to drivers/staging/goldfish/goldfish_audio.c:167:36: got char [noderef] *[assigned] kbuf drivers/staging/goldfish/goldfish_audio.c:296:27: warning: incorrect type in assignment (different address spaces) drivers/staging/goldfish/goldfish_audio.c:296:27: expected char [noderef] *buffer_virt drivers/staging/goldfish/goldfish_audio.c:296:27: got void * Signed-off-by: Ricardo Ribalda Delgado Acked-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/goldfish/goldfish_audio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/goldfish/goldfish_audio.c b/drivers/staging/goldfish/goldfish_audio.c index 81abf98025c5..702ae04df912 100644 --- a/drivers/staging/goldfish/goldfish_audio.c +++ b/drivers/staging/goldfish/goldfish_audio.c @@ -40,12 +40,12 @@ struct goldfish_audio { spinlock_t lock; wait_queue_head_t wait; - char __iomem *buffer_virt; /* combined buffer virtual address */ + char *buffer_virt; /* combined buffer virtual address */ unsigned long buffer_phys; /* combined buffer physical address */ - char __iomem *write_buffer1; /* write buffer 1 virtual address */ - char __iomem *write_buffer2; /* write buffer 2 virtual address */ - char __iomem *read_buffer; /* read buffer virtual address */ + char *write_buffer1; /* write buffer 1 virtual address */ + char *write_buffer2; /* write buffer 2 virtual address */ + char *read_buffer; /* read buffer virtual address */ int buffer_status; int read_supported; /* true if we have audio input support */ }; @@ -147,7 +147,7 @@ static ssize_t goldfish_audio_write(struct file *fp, const char __user *buf, struct goldfish_audio *data = fp->private_data; unsigned long irq_flags; ssize_t result = 0; - char __iomem *kbuf; + char *kbuf; while (count > 0) { ssize_t copy = count; -- cgit v1.2.3 From fc11a550d027bd381e0e54618f99d2f8285bbb6f Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:44 -0400 Subject: staging: unisys: clean up NULL comparisons in visorchannel_funcs.c Correct all comparisons with NULL so that NULL isn't needed. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchannel/visorchannel_funcs.c | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index de0a64624e3d..7a9a7242f75d 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c @@ -58,7 +58,7 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, void *rc = NULL; p = kmalloc(sizeof(*p), GFP_KERNEL|__GFP_NORETRY); - if (p == NULL) { + if (!p) { rc = NULL; goto cleanup; } @@ -68,7 +68,7 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, spin_lock_init(&p->remove_lock); /* prepare chan_hdr (abstraction to read/write channel memory) */ - if (parent == NULL) + if (!parent) p->memregion = visor_memregion_create(physaddr, sizeof(struct channel_header)); @@ -76,7 +76,7 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, p->memregion = visor_memregion_create_overlapped(parent->memregion, off, sizeof(struct channel_header)); - if (p->memregion == NULL) { + if (!p->memregion) { rc = NULL; goto cleanup; } @@ -101,8 +101,8 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, rc = p; cleanup: - if (rc == NULL) { - if (p != NULL) { + if (!rc) { + if (!p) { visorchannel_destroy(p); p = NULL; } @@ -150,9 +150,9 @@ EXPORT_SYMBOL_GPL(visorchannel_create_overlapped_with_lock); void visorchannel_destroy(struct visorchannel *channel) { - if (channel == NULL) + if (!channel) return; - if (channel->memregion != NULL) { + if (channel->memregion) { visor_memregion_destroy(channel->memregion); channel->memregion = NULL; } @@ -252,7 +252,7 @@ visorchannel_clear(struct visorchannel *channel, ulong offset, u8 ch, int written = 0; u8 *buf = vmalloc(bufsize); - if (buf == NULL) + if (!buf) goto cleanup; memset(buf, ch, bufsize); @@ -274,7 +274,7 @@ visorchannel_clear(struct visorchannel *channel, ulong offset, u8 ch, rc = 0; cleanup: - if (buf != NULL) { + if (buf) { vfree(buf); buf = NULL; } @@ -560,11 +560,10 @@ visorchannel_debug(struct visorchannel *channel, int num_queues, int i = 0; int errcode = 0; - if (channel == NULL) + if (!channel) return; - memregion = channel->memregion; - if (memregion == NULL) + if (!memregion) return; addr = visor_memregion_get_physaddr(memregion); -- cgit v1.2.3 From 5af3b098c3ce7c537c5687fb1260fa37ca195a8f Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:45 -0400 Subject: staging: unisys: cleanup NULL comparisons in virthba.c Fix all comparisons to NULL so that they don't use NULL anymore. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/virthba/virthba.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index e5b0dd8b4719..4a11ac62757a 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -258,7 +258,7 @@ add_scsipending_entry(struct virthba_info *vhbainfo, char cmdtype, void *new) spin_lock_irqsave(&vhbainfo->privlock, flags); insert_location = vhbainfo->nextinsert; - while (vhbainfo->pending[insert_location].sent != NULL) { + while (vhbainfo->pending[insert_location].sent) { insert_location = (insert_location + 1) % MAX_PENDING_REQUESTS; if (insert_location == (int)vhbainfo->nextinsert) { spin_unlock_irqrestore(&vhbainfo->privlock, flags); @@ -403,7 +403,7 @@ virthba_isr(int irq, void *dev_id) u64 mask; unsigned long long rc1; - if (virthbainfo == NULL) + if (!virthbainfo) return IRQ_NONE; virthbainfo->interrupts_rcvd++; channel_header = virthbainfo->chinfo.queueinfo->chan; @@ -458,7 +458,7 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) */ scsihost = scsi_host_alloc(&virthba_driver_template, sizeof(struct virthba_info)); - if (scsihost == NULL) + if (!scsihost) return -ENODEV; scsihost->this_id = UIS_MAGIC_VHBA; @@ -499,7 +499,7 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) virthbainfo = (struct virthba_info *)scsihost->hostdata; memset(virthbainfo, 0, sizeof(struct virthba_info)); for (i = 0; i < VIRTHBASOPENMAX; i++) { - if (virthbas_open[i].virthbainfo == NULL) { + if (!virthbas_open[i].virthbainfo) { virthbas_open[i].virthbainfo = virthbainfo; break; } @@ -607,7 +607,7 @@ forward_vdiskmgmt_command(enum vdisk_mgmt_types vdiskcmdtype, return FAILED; cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); - if (cmdrsp == NULL) + if (!cmdrsp) return FAILED; /* reject */ init_waitqueue_head(¬ifyevent); @@ -660,8 +660,8 @@ forward_taskmgmt_command(enum task_mgmt_types tasktype, return FAILED; cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); - if (cmdrsp == NULL) - return FAILED; /* reject */ + if (!cmdrsp) + return FAILED; /* reject */ init_waitqueue_head(¬ifyevent); @@ -821,7 +821,7 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, if (virthbainfo->serverdown || virthbainfo->serverchangingstate) return SCSI_MLQUEUE_DEVICE_BUSY; cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); - if (cmdrsp == NULL) + if (!cmdrsp) return 1; /* reject the command */ /* now saving everything we need from scsi_cmd into cmdrsp @@ -1183,7 +1183,7 @@ process_incoming_rsps(void *v) UIS_DAEMONIZE("vhba_incoming"); /* alloc once and reuse */ cmdrsp = kmalloc(SZ, GFP_ATOMIC); - if (cmdrsp == NULL) { + if (!cmdrsp) { complete_and_exit(&dc->threadinfo.has_stopped, 0); return 0; } @@ -1226,7 +1226,7 @@ static ssize_t info_debugfs_read(struct file *file, return -ENOMEM; for (i = 0; i < VIRTHBASOPENMAX; i++) { - if (virthbas_open[i].virthbainfo == NULL) + if (!virthbas_open[i].virthbainfo) continue; virthbainfo = virthbas_open[i].virthbainfo; @@ -1286,7 +1286,7 @@ static ssize_t enable_ints_write(struct file *file, const char __user *buffer, /* set all counts to new_value usually 0 */ for (i = 0; i < VIRTHBASOPENMAX; i++) { - if (virthbas_open[i].virthbainfo != NULL) { + if (virthbas_open[i].virthbainfo) { virthbainfo = virthbas_open[i].virthbainfo; features_addr = &virthbainfo->chinfo.queueinfo->chan->features; @@ -1442,11 +1442,11 @@ virthba_parse_options(char *line) char *next = line; POSTCODE_LINUX_2(VHBA_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); - if (line == NULL || !*line) + if (!line || !*line) return; - while ((line = next) != NULL) { + while ((line = next)) { next = strchr(line, ' '); - if (next != NULL) + if (next) *next++ = 0; virthba_parse_line(line); } @@ -1490,7 +1490,7 @@ virthba_mod_init(void) /* Initialize the serverdown workqueue */ virthba_serverdown_workqueue = create_singlethread_workqueue("virthba_serverdown"); - if (virthba_serverdown_workqueue == NULL) { + if (!virthba_serverdown_workqueue) { POSTCODE_LINUX_2(VHBA_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); error = -1; -- cgit v1.2.3 From 56215add6f136bf85881a12fd7b625868fe43de0 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:46 -0400 Subject: staging: unisys: fix CamelCase in virthba_probe() Rename CamelCase local variable: Features_addr => features_addr Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/virthba/virthba.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index 4a11ac62757a..d9001cca0f73 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -555,13 +555,13 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) virthbainfo->interrupt_vector = -1; POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR); } else { - u64 __iomem *Features_addr = + u64 __iomem *features_addr = &virthbainfo->chinfo.queueinfo->chan->features; mask = ~(ULTRA_IO_CHANNEL_IS_POLLING | ULTRA_IO_DRIVER_DISABLES_INTS); - uisqueue_interlocked_and(Features_addr, mask); + uisqueue_interlocked_and(features_addr, mask); mask = ULTRA_IO_DRIVER_ENABLES_INTS; - uisqueue_interlocked_or(Features_addr, mask); + uisqueue_interlocked_or(features_addr, mask); rsltq_wait_usecs = 4000000; } -- cgit v1.2.3 From 911e213ea30c119ec0ae8255de5e7c85f85a867b Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:47 -0400 Subject: staging: unisys: fix CamelCase global Poll_jiffies Fix the name and references: Poll_jiffies => poll_jiffies Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index ec258aeba768..b1399be79665 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -48,7 +48,7 @@ * message, we switch back to fast polling mode. */ #define MIN_IDLE_SECONDS 10 -static ulong Poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; +static ulong poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; static ulong Most_recent_message_jiffies; /* when we got our last * controlvm message */ static inline char * @@ -1884,17 +1884,15 @@ Away: * processed our last controlvm message; slow down the * polling */ - if (Poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_SLOW) { - Poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW; - } + if (poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_SLOW) + poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW; } else { - if (Poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_FAST) { - Poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; - } + if (poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_FAST) + poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; } queue_delayed_work(Periodic_controlvm_workqueue, - &Periodic_controlvm_work, Poll_jiffies); + &Periodic_controlvm_work, poll_jiffies); } static void @@ -1996,10 +1994,10 @@ setup_crash_devices_work_queue(struct work_struct *work) Away: - Poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW; + poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW; queue_delayed_work(Periodic_controlvm_workqueue, - &Periodic_controlvm_work, Poll_jiffies); + &Periodic_controlvm_work, poll_jiffies); } static void @@ -2265,9 +2263,9 @@ visorchipset_init(void) goto Away; } Most_recent_message_jiffies = jiffies; - Poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; + poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; rc = queue_delayed_work(Periodic_controlvm_workqueue, - &Periodic_controlvm_work, Poll_jiffies); + &Periodic_controlvm_work, poll_jiffies); if (rc < 0) { POSTCODE_LINUX_2(QUEUE_DELAYED_WORK_PC, DIAG_SEVERITY_ERR); -- cgit v1.2.3 From c394650650b0fc91aebfef601c5a427ef387bb72 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:48 -0400 Subject: staging: unisys: remove unnecessary complication from delete_vbus_device Take out the variable used to compute a comparison against NULL, and just use the parameter directly. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/virtpci/virtpci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index 3f399e60ae8d..b169d392fce9 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -400,10 +400,9 @@ delete_vbus(struct del_vbus_guestpart *delparams) static int delete_vbus_device(struct device *vbus, void *data) { - int checkforroot = (data != NULL); struct device *dev = &virtpci_rootbus_device; - if ((checkforroot) && match_busid(vbus, (void *)BUS_ID(dev))) { + if ((data) && match_busid(vbus, (void *)BUS_ID(dev))) { /* skip it - don't delete root bus */ return 0; /* pretend no error */ } -- cgit v1.2.3 From 3d8dbdbfeda40b8cf58abed84be1ae2231215862 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:49 -0400 Subject: staging: unisys: clean up NULL compares in virtpci.c Remove unnecessary NULLs by just using the pointer value directly. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/virtpci/virtpci.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index b169d392fce9..d5ad01783c07 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -809,7 +809,7 @@ static int virtpci_device_add(struct device *parentbus, int devtype, /* add a Virtual Device */ virtpcidev = kzalloc(sizeof(*virtpcidev), GFP_ATOMIC); - if (virtpcidev == NULL) { + if (!virtpcidev) { POSTCODE_LINUX_2(MALLOC_FAILURE_PC, POSTCODE_SEVERITY_ERR); return 0; } @@ -1076,8 +1076,8 @@ static int virtpci_device_del(struct device *parentbus, /* see if we are to delete all - NOTE: all implies we have a * valid parentbus */ - all = ((devtype == VIRTHBA_TYPE) && (wwnn == NULL)) || - ((devtype == VIRTNIC_TYPE) && (macaddr == NULL)); + all = ((devtype == VIRTHBA_TYPE) && (!wwnn)) || + ((devtype == VIRTNIC_TYPE) && (!macaddr)); /* find all the vhba or vnic or both in virtpci device list * keep list of ones we are deleting so we can call @@ -1206,9 +1206,8 @@ int virtpci_register_driver(struct virtpci_driver *drv) { int result = 0; - if (drv->id_table == NULL) + if (!drv->id_table) return 1; - /* initialize core driver fields needed to call driver_register */ drv->core_driver.name = drv->name; /* name of driver in sysfs */ drv->core_driver.bus = &virtpci_bus_type; /* type of bus this -- cgit v1.2.3 From a18c634275de6039c0bc7a3a077ab9e817c28ce9 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:50 -0400 Subject: staging: unisys: fix CamelCase variable Controlvm_Payload_Bytes_Buffered Fix camelcase name: Controlvm_Payload_Bytes_Buffered => controlvm_payload_bytes_buffered Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 0683472ba47c..959d540eef52 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -29,7 +29,7 @@ * incoming payloads. This serves as a throttling mechanism. */ #define MAX_CONTROLVM_PAYLOAD_BYTES (1024*128) -static ulong Controlvm_Payload_Bytes_Buffered; +static ulong controlvm_payload_bytes_buffered; struct PARSER_CONTEXT_Tag { ulong allocbytes; @@ -57,7 +57,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, * '\0'-terminated */ allocbytes++; - if ((Controlvm_Payload_Bytes_Buffered + bytes) + if ((controlvm_payload_bytes_buffered + bytes) > MAX_CONTROLVM_PAYLOAD_BYTES) { if (tryAgain) *tryAgain = TRUE; @@ -124,7 +124,7 @@ Away: rgn = NULL; } if (rc) - Controlvm_Payload_Bytes_Buffered += ctx->param_bytes; + controlvm_payload_bytes_buffered += ctx->param_bytes; else { if (ctx) { parser_done(ctx); @@ -224,7 +224,7 @@ parser_done(PARSER_CONTEXT *ctx) { if (!ctx) return; - Controlvm_Payload_Bytes_Buffered -= ctx->param_bytes; + controlvm_payload_bytes_buffered -= ctx->param_bytes; kfree(ctx); } -- cgit v1.2.3 From 317d9614a980fedfe89408030bdd92cc0f4d0dc4 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:51 -0400 Subject: staging: unisys: remove typedef for PARSER_CONTEXT Convert all references to PARSER_CONTEXT into struct parser_context. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/parser.c | 28 +++++++++++----------- drivers/staging/unisys/visorchipset/parser.h | 22 ++++++++--------- .../unisys/visorchipset/visorchipset_main.c | 9 +++---- 3 files changed, 30 insertions(+), 29 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 959d540eef52..056facd24f54 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -31,7 +31,7 @@ #define MAX_CONTROLVM_PAYLOAD_BYTES (1024*128) static ulong controlvm_payload_bytes_buffered; -struct PARSER_CONTEXT_Tag { +struct parser_context { ulong allocbytes; ulong param_bytes; u8 *curr; @@ -40,13 +40,13 @@ struct PARSER_CONTEXT_Tag { char data[0]; }; -static PARSER_CONTEXT * +static struct parser_context * parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, BOOL hasStandardPayloadHeader, BOOL *tryAgain) { - int allocbytes = sizeof(PARSER_CONTEXT) + bytes; - PARSER_CONTEXT *rc = NULL; - PARSER_CONTEXT *ctx = NULL; + int allocbytes = sizeof(struct parser_context) + bytes; + struct parser_context *rc = NULL; + struct parser_context *ctx = NULL; struct memregion *rgn = NULL; struct spar_controlvm_parameters_header *phdr = NULL; @@ -134,7 +134,7 @@ Away: return rc; } -PARSER_CONTEXT * +struct parser_context * parser_init(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain) { return parser_init_guts(addr, bytes, isLocal, TRUE, tryAgain); @@ -145,7 +145,7 @@ parser_init(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain) * structures. Afterwards, you can call parser_simpleString_get() or * parser_byteStream_get() to obtain the data. */ -PARSER_CONTEXT * +struct parser_context * parser_init_byteStream(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain) { return parser_init_guts(addr, bytes, isLocal, FALSE, tryAgain); @@ -154,7 +154,7 @@ parser_init_byteStream(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain) /* Obtain '\0'-terminated copy of string in payload area. */ char * -parser_simpleString_get(PARSER_CONTEXT *ctx) +parser_simpleString_get(struct parser_context *ctx) { if (!ctx->byte_stream) return NULL; @@ -166,7 +166,7 @@ parser_simpleString_get(PARSER_CONTEXT *ctx) /* Obtain a copy of the buffer in the payload area. */ void * -parser_byteStream_get(PARSER_CONTEXT *ctx, ulong *nbytes) +parser_byteStream_get(struct parser_context *ctx, ulong *nbytes) { if (!ctx->byte_stream) return NULL; @@ -176,7 +176,7 @@ parser_byteStream_get(PARSER_CONTEXT *ctx, ulong *nbytes) } uuid_le -parser_id_get(PARSER_CONTEXT *ctx) +parser_id_get(struct parser_context *ctx) { struct spar_controlvm_parameters_header *phdr = NULL; @@ -187,7 +187,7 @@ parser_id_get(PARSER_CONTEXT *ctx) } void -parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string) +parser_param_start(struct parser_context *ctx, PARSER_WHICH_STRING which_string) { struct spar_controlvm_parameters_header *phdr = NULL; @@ -220,7 +220,7 @@ Away: } void -parser_done(PARSER_CONTEXT *ctx) +parser_done(struct parser_context *ctx) { if (!ctx) return; @@ -263,7 +263,7 @@ string_length_no_trail(char *s, int len) * parameter */ void * -parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize) +parser_param_get(struct parser_context *ctx, char *nam, int namesize) { u8 *pscan, *pnam = nam; ulong nscan; @@ -398,7 +398,7 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize) } void * -parser_string_get(PARSER_CONTEXT *ctx) +parser_string_get(struct parser_context *ctx) { u8 *pscan; ulong nscan; diff --git a/drivers/staging/unisys/visorchipset/parser.h b/drivers/staging/unisys/visorchipset/parser.h index 7e015d1e744d..aa50ff8780a3 100644 --- a/drivers/staging/unisys/visorchipset/parser.h +++ b/drivers/staging/unisys/visorchipset/parser.h @@ -30,17 +30,17 @@ typedef enum { PARSERSTRING_NAME, } PARSER_WHICH_STRING; -typedef struct PARSER_CONTEXT_Tag PARSER_CONTEXT; - -PARSER_CONTEXT *parser_init(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain); -PARSER_CONTEXT *parser_init_byteStream(u64 addr, u32 bytes, BOOL isLocal, +struct parser_context *parser_init(u64 addr, u32 bytes, BOOL isLocal, + BOOL *tryAgain); +struct parser_context *parser_init_byteStream(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain); -void parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string); -void *parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize); -void *parser_string_get(PARSER_CONTEXT *ctx); -uuid_le parser_id_get(PARSER_CONTEXT *ctx); -char *parser_simpleString_get(PARSER_CONTEXT *ctx); -void *parser_byteStream_get(PARSER_CONTEXT *ctx, ulong *nbytes); -void parser_done(PARSER_CONTEXT *ctx); +void parser_param_start(struct parser_context *ctx, + PARSER_WHICH_STRING which_string); +void *parser_param_get(struct parser_context *ctx, char *nam, int namesize); +void *parser_string_get(struct parser_context *ctx); +uuid_le parser_id_get(struct parser_context *ctx); +char *parser_simpleString_get(struct parser_context *ctx); +void *parser_byteStream_get(struct parser_context *ctx, ulong *nbytes); +void parser_done(struct parser_context *ctx); #endif diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index b1399be79665..284ed4f75f61 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -144,7 +144,7 @@ static const char Putfile_buffer_list_pool_name[] = */ struct putfile_buffer_entry { struct list_head next; /* putfile_buffer_entry list */ - PARSER_CONTEXT *parser_ctx; /* points to buffer containing input data */ + struct parser_context *parser_ctx; /* points to input data buffer */ }; /* List of struct putfile_request *, via next_putfile_request member. @@ -159,7 +159,7 @@ static LIST_HEAD(Putfile_request_list); */ struct putfile_active_buffer { /* a payload from a controlvm message, containing a file data buffer */ - PARSER_CONTEXT *parser_ctx; + struct parser_context *parser_ctx; /* points within data area of parser_ctx to next byte of data */ u8 *pnext; /* # bytes left from to the end of this data buffer */ @@ -1134,7 +1134,8 @@ Away: } static void -bus_configure(struct controlvm_message *inmsg, PARSER_CONTEXT *parser_ctx) +bus_configure(struct controlvm_message *inmsg, + struct parser_context *parser_ctx) { struct controlvm_message_packet *cmd = &inmsg->cmd; ulong busNo = cmd->configure_bus.bus_no; @@ -1697,7 +1698,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) struct controlvm_message_packet *cmd = &inmsg.cmd; u64 parametersAddr = 0; u32 parametersBytes = 0; - PARSER_CONTEXT *parser_ctx = NULL; + struct parser_context *parser_ctx = NULL; BOOL isLocalAddr = FALSE; struct controlvm_message ackmsg; -- cgit v1.2.3 From 48e81485527612dbab926ab6e4fc73770f856f56 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:52 -0400 Subject: staging: unisys: refactor parser_init_guts() Fix CamelCase names: isLocal => local hasStandardPayloadHeader => standard_payload_header tryAgain => retry Away => cleanup Fix spacing after typecasts, add missing braces to the if statement, and eliminate the NULL comparison by just using the pointer value directly. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/parser.c | 48 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 056facd24f54..00586fa793e1 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -41,8 +41,8 @@ struct parser_context { }; static struct parser_context * -parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, - BOOL hasStandardPayloadHeader, BOOL *tryAgain) +parser_init_guts(u64 addr, u32 bytes, BOOL local, + BOOL standard_payload_header, BOOL *retry) { int allocbytes = sizeof(struct parser_context) + bytes; struct parser_context *rc = NULL; @@ -50,26 +50,26 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, struct memregion *rgn = NULL; struct spar_controlvm_parameters_header *phdr = NULL; - if (tryAgain) - *tryAgain = FALSE; - if (!hasStandardPayloadHeader) + if (retry) + *retry = FALSE; + if (!standard_payload_header) /* alloc and 0 extra byte to ensure payload is * '\0'-terminated */ allocbytes++; if ((controlvm_payload_bytes_buffered + bytes) > MAX_CONTROLVM_PAYLOAD_BYTES) { - if (tryAgain) - *tryAgain = TRUE; + if (retry) + *retry = TRUE; rc = NULL; - goto Away; + goto cleanup; } ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY); - if (ctx == NULL) { - if (tryAgain) - *tryAgain = TRUE; + if (!ctx) { + if (retry) + *retry = TRUE; rc = NULL; - goto Away; + goto cleanup; } ctx->allocbytes = allocbytes; @@ -77,12 +77,12 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, ctx->curr = NULL; ctx->bytes_remaining = 0; ctx->byte_stream = FALSE; - if (isLocal) { + if (local) { void *p; if (addr > virt_to_phys(high_memory - 1)) { rc = NULL; - goto Away; + goto cleanup; } p = __va((ulong) (addr)); memcpy(ctx->data, p, bytes); @@ -90,42 +90,42 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, rgn = visor_memregion_create(addr, bytes); if (!rgn) { rc = NULL; - goto Away; + goto cleanup; } if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) { rc = NULL; - goto Away; + goto cleanup; } } - if (!hasStandardPayloadHeader) { + if (!standard_payload_header) { ctx->byte_stream = TRUE; rc = ctx; - goto Away; + goto cleanup; } phdr = (struct spar_controlvm_parameters_header *)(ctx->data); if (phdr->total_length != bytes) { rc = NULL; - goto Away; + goto cleanup; } if (phdr->total_length < phdr->header_length) { rc = NULL; - goto Away; + goto cleanup; } if (phdr->header_length < sizeof(struct spar_controlvm_parameters_header)) { rc = NULL; - goto Away; + goto cleanup; } rc = ctx; -Away: +cleanup: if (rgn) { visor_memregion_destroy(rgn); rgn = NULL; } - if (rc) + if (rc) { controlvm_payload_bytes_buffered += ctx->param_bytes; - else { + } else { if (ctx) { parser_done(ctx); ctx = NULL; -- cgit v1.2.3 From 5e790610bc19887387d5914cf8ed58434c5bde08 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:53 -0400 Subject: staging: unisys: fix CamelCase names in parser_init() Fix CamelCase names: isLocal => local tryAgain => retry Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 00586fa793e1..f10b4439f593 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -135,9 +135,9 @@ cleanup: } struct parser_context * -parser_init(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain) +parser_init(u64 addr, u32 bytes, BOOL local, BOOL *retry) { - return parser_init_guts(addr, bytes, isLocal, TRUE, tryAgain); + return parser_init_guts(addr, bytes, local, TRUE, retry); } /* Call this instead of parser_init() if the payload area consists of just -- cgit v1.2.3 From b2d97e4be944645137143e19b51af4575950cfc4 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:54 -0400 Subject: staging: unisys: refactor parser_init_byteStream Fix CamelCase names: parser_init_byteStream => parser_init_byte_stream isLocal => local tryAgain => retry Update references to the changed function name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/parser.c | 4 ++-- drivers/staging/unisys/visorchipset/parser.h | 4 ++-- drivers/staging/unisys/visorchipset/visorchipset_main.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index f10b4439f593..29d840c74193 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -146,9 +146,9 @@ parser_init(u64 addr, u32 bytes, BOOL local, BOOL *retry) * parser_byteStream_get() to obtain the data. */ struct parser_context * -parser_init_byteStream(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain) +parser_init_byte_stream(u64 addr, u32 bytes, BOOL local, BOOL *retry) { - return parser_init_guts(addr, bytes, isLocal, FALSE, tryAgain); + return parser_init_guts(addr, bytes, local, FALSE, retry); } /* Obtain '\0'-terminated copy of string in payload area. diff --git a/drivers/staging/unisys/visorchipset/parser.h b/drivers/staging/unisys/visorchipset/parser.h index aa50ff8780a3..a06772fdb344 100644 --- a/drivers/staging/unisys/visorchipset/parser.h +++ b/drivers/staging/unisys/visorchipset/parser.h @@ -32,8 +32,8 @@ typedef enum { struct parser_context *parser_init(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain); -struct parser_context *parser_init_byteStream(u64 addr, u32 bytes, BOOL isLocal, - BOOL *tryAgain); +struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, BOOL local, + BOOL *retry); void parser_param_start(struct parser_context *ctx, PARSER_WHICH_STRING which_string); void *parser_param_get(struct parser_context *ctx, char *nam, int namesize); diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 284ed4f75f61..b1b8c94e0194 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1717,7 +1717,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) BOOL retry = FALSE; parser_ctx = - parser_init_byteStream(parametersAddr, parametersBytes, + parser_init_byte_stream(parametersAddr, parametersBytes, isLocalAddr, &retry); if (!parser_ctx && retry) return FALSE; -- cgit v1.2.3 From 53049d33158fb1b6ad8268a85b2a9de40346fba6 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:55 -0400 Subject: staging: unisys: refactor parser_byteStream_get Fix this CamelCase function name: parser_byteStream_get => parser_byte_stream_get Update all references to use the fixed name. Fix the spacing in the typecast. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/parser.c | 5 ++--- drivers/staging/unisys/visorchipset/parser.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 29d840c74193..d8a2d6f5a75d 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -165,14 +165,13 @@ parser_simpleString_get(struct parser_context *ctx) /* Obtain a copy of the buffer in the payload area. */ -void * -parser_byteStream_get(struct parser_context *ctx, ulong *nbytes) +void *parser_byte_stream_get(struct parser_context *ctx, ulong *nbytes) { if (!ctx->byte_stream) return NULL; if (nbytes) *nbytes = ctx->param_bytes; - return (void *) ctx->data; + return (void *)ctx->data; } uuid_le diff --git a/drivers/staging/unisys/visorchipset/parser.h b/drivers/staging/unisys/visorchipset/parser.h index a06772fdb344..2b903f1beff2 100644 --- a/drivers/staging/unisys/visorchipset/parser.h +++ b/drivers/staging/unisys/visorchipset/parser.h @@ -40,7 +40,7 @@ void *parser_param_get(struct parser_context *ctx, char *nam, int namesize); void *parser_string_get(struct parser_context *ctx); uuid_le parser_id_get(struct parser_context *ctx); char *parser_simpleString_get(struct parser_context *ctx); -void *parser_byteStream_get(struct parser_context *ctx, ulong *nbytes); +void *parser_byte_stream_get(struct parser_context *ctx, ulong *nbytes); void parser_done(struct parser_context *ctx); #endif -- cgit v1.2.3 From b53e0e93b75adfe7a144054848d427a425b11f93 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:56 -0400 Subject: staging: unisys: fix CamelCase global Most_recent_message_jiffies Fix the CamelCase global variable in visorchipset_main.c: Most_recent_message_jiffies => most_recent_message_jiffies Update all references to use the corrected name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index b1b8c94e0194..ca6bce14c45f 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -49,7 +49,7 @@ */ #define MIN_IDLE_SECONDS 10 static ulong poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; -static ulong Most_recent_message_jiffies; /* when we got our last +static ulong most_recent_message_jiffies; /* when we got our last * controlvm message */ static inline char * NONULLSTR(char *s) @@ -1856,7 +1856,7 @@ controlvm_periodic_work(struct work_struct *work) handle_command_failed = FALSE; while (gotACommand && (!handle_command_failed)) { - Most_recent_message_jiffies = jiffies; + most_recent_message_jiffies = jiffies; if (handle_command(inmsg, visorchannel_get_physaddr (ControlVm_channel))) @@ -1880,7 +1880,7 @@ controlvm_periodic_work(struct work_struct *work) Away: if (time_after(jiffies, - Most_recent_message_jiffies + (HZ * MIN_IDLE_SECONDS))) { + most_recent_message_jiffies + (HZ * MIN_IDLE_SECONDS))) { /* it's been longer than MIN_IDLE_SECONDS since we * processed our last controlvm message; slow down the * polling @@ -2263,7 +2263,7 @@ visorchipset_init(void) rc = -ENOMEM; goto Away; } - Most_recent_message_jiffies = jiffies; + most_recent_message_jiffies = jiffies; poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; rc = queue_delayed_work(Periodic_controlvm_workqueue, &Periodic_controlvm_work, poll_jiffies); -- cgit v1.2.3 From 9232d2d62a9d1c5005ac11c4f48ddb0fd38a0029 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:57 -0400 Subject: staging: unisys: fix CamelCase controlvm globals Fix the CamelCase variable names: Periodic_controlvm_work => periodic_controlvm_work Periodic_controlvm_workqueue => periodic_controlvm_workqueue Update all references to use the corrected names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index ca6bce14c45f..8fdecdd6a267 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -65,8 +65,8 @@ static int clientregistered; #define MAX_CHIPSET_EVENTS 2 static u8 chipset_events[MAX_CHIPSET_EVENTS] = { 0, 0 }; -static struct delayed_work Periodic_controlvm_work; -static struct workqueue_struct *Periodic_controlvm_workqueue; +static struct delayed_work periodic_controlvm_work; +static struct workqueue_struct *periodic_controlvm_workqueue; static DEFINE_SEMAPHORE(NotifierLock); static struct controlvm_message_header g_DiagMsgHdr; @@ -1892,8 +1892,8 @@ Away: poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; } - queue_delayed_work(Periodic_controlvm_workqueue, - &Periodic_controlvm_work, poll_jiffies); + queue_delayed_work(periodic_controlvm_workqueue, + &periodic_controlvm_work, poll_jiffies); } static void @@ -1997,8 +1997,8 @@ Away: poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW; - queue_delayed_work(Periodic_controlvm_workqueue, - &Periodic_controlvm_work, poll_jiffies); + queue_delayed_work(periodic_controlvm_workqueue, + &periodic_controlvm_work, poll_jiffies); } static void @@ -2249,15 +2249,15 @@ visorchipset_init(void) if (!visorchipset_disable_controlvm) { /* if booting in a crash kernel */ if (visorchipset_crash_kernel) - INIT_DELAYED_WORK(&Periodic_controlvm_work, + INIT_DELAYED_WORK(&periodic_controlvm_work, setup_crash_devices_work_queue); else - INIT_DELAYED_WORK(&Periodic_controlvm_work, + INIT_DELAYED_WORK(&periodic_controlvm_work, controlvm_periodic_work); - Periodic_controlvm_workqueue = + periodic_controlvm_workqueue = create_singlethread_workqueue("visorchipset_controlvm"); - if (Periodic_controlvm_workqueue == NULL) { + if (periodic_controlvm_workqueue == NULL) { POSTCODE_LINUX_2(CREATE_WORKQUEUE_FAILED_PC, DIAG_SEVERITY_ERR); rc = -ENOMEM; @@ -2265,8 +2265,8 @@ visorchipset_init(void) } most_recent_message_jiffies = jiffies; poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; - rc = queue_delayed_work(Periodic_controlvm_workqueue, - &Periodic_controlvm_work, poll_jiffies); + rc = queue_delayed_work(periodic_controlvm_workqueue, + &periodic_controlvm_work, poll_jiffies); if (rc < 0) { POSTCODE_LINUX_2(QUEUE_DELAYED_WORK_PC, DIAG_SEVERITY_ERR); @@ -2299,10 +2299,10 @@ visorchipset_exit(void) if (visorchipset_disable_controlvm) { ; } else { - cancel_delayed_work(&Periodic_controlvm_work); - flush_workqueue(Periodic_controlvm_workqueue); - destroy_workqueue(Periodic_controlvm_workqueue); - Periodic_controlvm_workqueue = NULL; + cancel_delayed_work(&periodic_controlvm_work); + flush_workqueue(periodic_controlvm_workqueue); + destroy_workqueue(periodic_controlvm_workqueue); + periodic_controlvm_workqueue = NULL; destroy_controlvm_payload_info(&ControlVm_payload_info); } Test_Vnic_channel = NULL; -- cgit v1.2.3 From da021f020ed43f5f511e9acaaf61b814b4417cbe Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:58 -0400 Subject: staging: unisys: fix CamelCase message header variables Fix the CamelCase variable names: g_DiagMsgHdr => g_diag_msg_hdr g_ChipSetMsgHdr => g_chipset_msg_hdr g_DelDumpMsgHdr => g_del_dump_msg_hdr Update all references to use the corrected names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 8fdecdd6a267..2c97030b6c1c 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -69,9 +69,9 @@ static struct delayed_work periodic_controlvm_work; static struct workqueue_struct *periodic_controlvm_workqueue; static DEFINE_SEMAPHORE(NotifierLock); -static struct controlvm_message_header g_DiagMsgHdr; -static struct controlvm_message_header g_ChipSetMsgHdr; -static struct controlvm_message_header g_DelDumpMsgHdr; +static struct controlvm_message_header g_diag_msg_hdr; +static struct controlvm_message_header g_chipset_msg_hdr; +static struct controlvm_message_header g_del_dump_msg_hdr; static const uuid_le UltraDiagPoolChannelProtocolGuid = SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID; /* 0xffffff is an invalid Bus/Device number */ @@ -1435,7 +1435,7 @@ chipset_ready(struct controlvm_message_header *msgHdr) /* Send CHIPSET_READY response when all modules have been loaded * and disks mounted for the partition */ - g_ChipSetMsgHdr = *msgHdr; + g_chipset_msg_hdr = *msgHdr; } } @@ -1754,7 +1754,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) /* save the hdr and cmd structures for later use */ /* when sending back the response to Command */ my_device_changestate(&inmsg); - g_DiagMsgHdr = inmsg.hdr; + g_diag_msg_hdr = inmsg.hdr; g_DeviceChangeStatePacket = inmsg.cmd; break; } @@ -1828,11 +1828,11 @@ controlvm_periodic_work(struct work_struct *work) * should be sent */ if (visorchipset_holdchipsetready - && (g_ChipSetMsgHdr.id != CONTROLVM_INVALID)) { + && (g_chipset_msg_hdr.id != CONTROLVM_INVALID)) { if (check_chipset_events() == 1) { - controlvm_respond(&g_ChipSetMsgHdr, 0); + controlvm_respond(&g_chipset_msg_hdr, 0); clear_chipset_events(); - memset(&g_ChipSetMsgHdr, 0, + memset(&g_chipset_msg_hdr, 0, sizeof(struct controlvm_message_header)); } } @@ -2231,11 +2231,11 @@ visorchipset_init(void) goto Away; } - memset(&g_DiagMsgHdr, 0, sizeof(struct controlvm_message_header)); + memset(&g_diag_msg_hdr, 0, sizeof(struct controlvm_message_header)); - memset(&g_ChipSetMsgHdr, 0, sizeof(struct controlvm_message_header)); + memset(&g_chipset_msg_hdr, 0, sizeof(struct controlvm_message_header)); - memset(&g_DelDumpMsgHdr, 0, sizeof(struct controlvm_message_header)); + memset(&g_del_dump_msg_hdr, 0, sizeof(struct controlvm_message_header)); Putfile_buffer_list_pool = kmem_cache_create(Putfile_buffer_list_pool_name, @@ -2313,11 +2313,11 @@ visorchipset_exit(void) cleanup_controlvm_structures(); - memset(&g_DiagMsgHdr, 0, sizeof(struct controlvm_message_header)); + memset(&g_diag_msg_hdr, 0, sizeof(struct controlvm_message_header)); - memset(&g_ChipSetMsgHdr, 0, sizeof(struct controlvm_message_header)); + memset(&g_chipset_msg_hdr, 0, sizeof(struct controlvm_message_header)); - memset(&g_DelDumpMsgHdr, 0, sizeof(struct controlvm_message_header)); + memset(&g_del_dump_msg_hdr, 0, sizeof(struct controlvm_message_header)); visorchannel_destroy(ControlVm_channel); -- cgit v1.2.3 From 8f1947aceb0b97a63bd8a16657a01946a7f5242f Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:57:59 -0400 Subject: staging: unisys: fix CamelCase semaphore NotifierLock Rename the semaphore NotifierLock => notifier_lock Update all references to use the new name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorchipset/visorchipset_main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 2c97030b6c1c..7687155294dc 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -67,7 +67,7 @@ static u8 chipset_events[MAX_CHIPSET_EVENTS] = { 0, 0 }; static struct delayed_work periodic_controlvm_work; static struct workqueue_struct *periodic_controlvm_workqueue; -static DEFINE_SEMAPHORE(NotifierLock); +static DEFINE_SEMAPHORE(notifier_lock); static struct controlvm_message_header g_diag_msg_hdr; static struct controlvm_message_header g_chipset_msg_hdr; @@ -587,7 +587,7 @@ visorchipset_register_busdev_server( struct visorchipset_busdev_responders *responders, struct ultra_vbus_deviceinfo *driver_info) { - down(&NotifierLock); + down(¬ifier_lock); if (notifiers == NULL) { memset(&BusDev_Server_Notifiers, 0, sizeof(BusDev_Server_Notifiers)); @@ -602,7 +602,7 @@ visorchipset_register_busdev_server( bus_device_info_init(driver_info, "chipset", "visorchipset", VERSION, NULL); - up(&NotifierLock); + up(¬ifier_lock); } EXPORT_SYMBOL_GPL(visorchipset_register_busdev_server); @@ -612,7 +612,7 @@ visorchipset_register_busdev_client( struct visorchipset_busdev_responders *responders, struct ultra_vbus_deviceinfo *driver_info) { - down(&NotifierLock); + down(¬ifier_lock); if (notifiers == NULL) { memset(&BusDev_Client_Notifiers, 0, sizeof(BusDev_Client_Notifiers)); @@ -626,7 +626,7 @@ visorchipset_register_busdev_client( if (driver_info) bus_device_info_init(driver_info, "chipset(bolts)", "visorchipset", VERSION, NULL); - up(&NotifierLock); + up(¬ifier_lock); } EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client); @@ -915,7 +915,7 @@ bus_epilog(u32 busNo, } else pBusInfo->pending_msg_hdr.id = CONTROLVM_INVALID; - down(&NotifierLock); + down(¬ifier_lock); if (response == CONTROLVM_RESP_SUCCESS) { switch (cmd) { case CONTROLVM_BUS_CREATE: @@ -960,7 +960,7 @@ bus_epilog(u32 busNo, ; else bus_responder(cmd, busNo, response); - up(&NotifierLock); + up(¬ifier_lock); } static void @@ -991,7 +991,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, } else pDevInfo->pending_msg_hdr.id = CONTROLVM_INVALID; - down(&NotifierLock); + down(¬ifier_lock); if (response >= 0) { switch (cmd) { case CONTROLVM_DEVICE_CREATE: @@ -1056,7 +1056,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, ; else device_responder(cmd, busNo, devNo, response); - up(&NotifierLock); + up(¬ifier_lock); } static void -- cgit v1.2.3 From 59827f00245fabbc2d6fb628866769affd76fb7c Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:00 -0400 Subject: staging: unisys: fix CamelCase name Fix CamelCase global variable: UltraDiagPoolChannelProtocolGuid => spar_diag_pool_channel_protocol_uuid Update all references to use the fixed name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 7687155294dc..381d3050b048 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -72,7 +72,7 @@ static DEFINE_SEMAPHORE(notifier_lock); static struct controlvm_message_header g_diag_msg_hdr; static struct controlvm_message_header g_chipset_msg_hdr; static struct controlvm_message_header g_del_dump_msg_hdr; -static const uuid_le UltraDiagPoolChannelProtocolGuid = +static const uuid_le spar_diag_pool_channel_protocol_uuid = SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID; /* 0xffffff is an invalid Bus/Device number */ static ulong g_diagpoolBusNo = 0xffffff; @@ -90,7 +90,8 @@ static struct controlvm_message_packet g_DeviceChangeStatePacket; #define FOR_VISORBUS(channel_type_guid) (!(FOR_VISORHACKBUS(channel_type_guid))) #define is_diagpool_channel(channel_type_guid) \ - (uuid_le_cmp(channel_type_guid, UltraDiagPoolChannelProtocolGuid) == 0) + (uuid_le_cmp(channel_type_guid,\ + spar_diag_pool_channel_protocol_uuid) == 0) static LIST_HEAD(BusInfoList); static LIST_HEAD(DevInfoList); -- cgit v1.2.3 From 83d48905aceaa0d3165b2a12962f8c63df98ec14 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:01 -0400 Subject: staging: unisys: fix CamelCased diagpool bus/dev names Fix CamelCase names: g_diagpoolBusNo => g_diagpool_bus_no g_diagpoolDevNo => g_diagpool_dev_no Update all references to the changed names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 381d3050b048..33fe82d8b1b5 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -75,8 +75,8 @@ static struct controlvm_message_header g_del_dump_msg_hdr; static const uuid_le spar_diag_pool_channel_protocol_uuid = SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID; /* 0xffffff is an invalid Bus/Device number */ -static ulong g_diagpoolBusNo = 0xffffff; -static ulong g_diagpoolDevNo = 0xffffff; +static ulong g_diagpool_bus_no = 0xffffff; +static ulong g_diagpool_dev_no = 0xffffff; static struct controlvm_message_packet g_DeviceChangeStatePacket; /* Only VNIC and VHBA channels are sent to visorclientbus (aka @@ -707,9 +707,9 @@ controlvm_respond(struct controlvm_message_header *msgHdr, int response) * back the deviceChangeState structure in the packet. */ if (msgHdr->id == CONTROLVM_DEVICE_CHANGESTATE && g_DeviceChangeStatePacket.device_change_state.bus_no == - g_diagpoolBusNo + g_diagpool_bus_no && g_DeviceChangeStatePacket.device_change_state.dev_no == - g_diagpoolDevNo) + g_diagpool_dev_no) outmsg.cmd = g_DeviceChangeStatePacket; if (outmsg.hdr.flags.test_message == 1) return; @@ -1030,8 +1030,8 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, /* this is lite pause where channel is * still valid just 'pause' of it */ - if (busNo == g_diagpoolBusNo - && devNo == g_diagpoolDevNo) { + if (busNo == g_diagpool_bus_no + && devNo == g_diagpool_dev_no) { /* this will trigger the * diag_shutdown.sh script in * the visorchipset hotplug */ @@ -1241,8 +1241,8 @@ Away: /* get the bus and devNo for DiagPool channel */ if (pDevInfo && is_diagpool_channel(pDevInfo->chan_info.channel_type_uuid)) { - g_diagpoolBusNo = busNo; - g_diagpoolDevNo = devNo; + g_diagpool_bus_no = busNo; + g_diagpool_dev_no = devNo; } device_epilog(busNo, devNo, segment_state_running, CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc, -- cgit v1.2.3 From 4f44b72d96ec2322bb8e1ffbcbbbd4a684763ba2 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:02 -0400 Subject: staging: unisys: fix CamelCase name for devicechangestate packet Fix the variable's CamelCase name: g_DeviceChangeStatePacket => g_devicechangestate_packet Update all references to use the fixed name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 33fe82d8b1b5..f8dfc5cda73f 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -77,7 +77,7 @@ static const uuid_le spar_diag_pool_channel_protocol_uuid = /* 0xffffff is an invalid Bus/Device number */ static ulong g_diagpool_bus_no = 0xffffff; static ulong g_diagpool_dev_no = 0xffffff; -static struct controlvm_message_packet g_DeviceChangeStatePacket; +static struct controlvm_message_packet g_devicechangestate_packet; /* Only VNIC and VHBA channels are sent to visorclientbus (aka * "visorhackbus") @@ -706,11 +706,11 @@ controlvm_respond(struct controlvm_message_header *msgHdr, int response) /* For DiagPool channel DEVICE_CHANGESTATE, we need to send * back the deviceChangeState structure in the packet. */ if (msgHdr->id == CONTROLVM_DEVICE_CHANGESTATE - && g_DeviceChangeStatePacket.device_change_state.bus_no == + && g_devicechangestate_packet.device_change_state.bus_no == g_diagpool_bus_no - && g_DeviceChangeStatePacket.device_change_state.dev_no == + && g_devicechangestate_packet.device_change_state.dev_no == g_diagpool_dev_no) - outmsg.cmd = g_DeviceChangeStatePacket; + outmsg.cmd = g_devicechangestate_packet; if (outmsg.hdr.flags.test_message == 1) return; @@ -1756,7 +1756,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) /* when sending back the response to Command */ my_device_changestate(&inmsg); g_diag_msg_hdr = inmsg.hdr; - g_DeviceChangeStatePacket = inmsg.cmd; + g_devicechangestate_packet = inmsg.cmd; break; } break; -- cgit v1.2.3 From 1390b88ce4b5259b6e69dd794e5bcf1bb791f426 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:03 -0400 Subject: staging: unisys: fix CamelCase list names Rename the CamelCased list names: BusInfoList => bus_info_list DevInfoList => dev_info_list Update all references to use the fixed names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index f8dfc5cda73f..4f36b4b6949a 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -93,8 +93,8 @@ static struct controlvm_message_packet g_devicechangestate_packet; (uuid_le_cmp(channel_type_guid,\ spar_diag_pool_channel_protocol_uuid) == 0) -static LIST_HEAD(BusInfoList); -static LIST_HEAD(DevInfoList); +static LIST_HEAD(bus_info_list); +static LIST_HEAD(dev_info_list); static struct visorchannel *ControlVm_channel; @@ -637,13 +637,13 @@ cleanup_controlvm_structures(void) struct visorchipset_bus_info *bi, *tmp_bi; struct visorchipset_device_info *di, *tmp_di; - list_for_each_entry_safe(bi, tmp_bi, &BusInfoList, entry) { + list_for_each_entry_safe(bi, tmp_bi, &bus_info_list, entry) { busInfo_clear(bi); list_del(&bi->entry); kfree(bi); } - list_for_each_entry_safe(di, tmp_di, &DevInfoList, entry) { + list_for_each_entry_safe(di, tmp_di, &dev_info_list, entry) { devInfo_clear(di); list_del(&di->entry); kfree(di); @@ -812,7 +812,7 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response) struct visorchipset_bus_info *p = NULL; BOOL need_clear = FALSE; - p = findbus(&BusInfoList, busNo); + p = findbus(&bus_info_list, busNo); if (!p) return; @@ -820,7 +820,7 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response) if ((cmdId == CONTROLVM_BUS_CREATE) && (response != (-CONTROLVM_RESP_ERROR_ALREADY_DONE))) /* undo the row we just created... */ - delbusdevices(&DevInfoList, busNo); + delbusdevices(&dev_info_list, busNo); } else { if (cmdId == CONTROLVM_BUS_CREATE) p->state.created = 1; @@ -836,7 +836,7 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response) p->pending_msg_hdr.id = CONTROLVM_INVALID; if (need_clear) { busInfo_clear(p); - delbusdevices(&DevInfoList, busNo); + delbusdevices(&dev_info_list, busNo); } } @@ -848,7 +848,7 @@ device_changestate_responder(enum controlvm_id cmdId, struct visorchipset_device_info *p = NULL; struct controlvm_message outmsg; - p = finddevice(&DevInfoList, busNo, devNo); + p = finddevice(&dev_info_list, busNo, devNo); if (!p) return; if (p->pending_msg_hdr.id == CONTROLVM_INVALID) @@ -876,7 +876,7 @@ device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, struct visorchipset_device_info *p = NULL; BOOL need_clear = FALSE; - p = finddevice(&DevInfoList, busNo, devNo); + p = finddevice(&dev_info_list, busNo, devNo); if (!p) return; if (response >= 0) { @@ -905,7 +905,7 @@ bus_epilog(u32 busNo, { BOOL notified = FALSE; - struct visorchipset_bus_info *pBusInfo = findbus(&BusInfoList, busNo); + struct visorchipset_bus_info *pBusInfo = findbus(&bus_info_list, busNo); if (!pBusInfo) return; @@ -973,7 +973,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, BOOL notified = FALSE; struct visorchipset_device_info *pDevInfo = - finddevice(&DevInfoList, busNo, devNo); + finddevice(&dev_info_list, busNo, devNo); char *envp[] = { "SPARSP_DIAGPOOL_PAUSED_STATE = 1", NULL @@ -1069,7 +1069,7 @@ bus_create(struct controlvm_message *inmsg) struct visorchipset_bus_info *pBusInfo = NULL; - pBusInfo = findbus(&BusInfoList, busNo); + pBusInfo = findbus(&bus_info_list, busNo); if (pBusInfo && (pBusInfo->state.created == 1)) { POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); @@ -1102,7 +1102,7 @@ bus_create(struct controlvm_message *inmsg) cmd->create_bus.bus_data_type_uuid; pBusInfo->chan_info.channel_inst_uuid = cmd->create_bus.bus_inst_uuid; - list_add(&pBusInfo->entry, &BusInfoList); + list_add(&pBusInfo->entry, &bus_info_list); POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO); @@ -1119,7 +1119,7 @@ bus_destroy(struct controlvm_message *inmsg) struct visorchipset_bus_info *pBusInfo; int rc = CONTROLVM_RESP_SUCCESS; - pBusInfo = findbus(&BusInfoList, busNo); + pBusInfo = findbus(&bus_info_list, busNo); if (!pBusInfo) { rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; goto Away; @@ -1147,7 +1147,7 @@ bus_configure(struct controlvm_message *inmsg, busNo = cmd->configure_bus.bus_no; POSTCODE_LINUX_3(BUS_CONFIGURE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO); - pBusInfo = findbus(&BusInfoList, busNo); + pBusInfo = findbus(&bus_info_list, busNo); if (!pBusInfo) { POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); @@ -1190,14 +1190,14 @@ my_device_create(struct controlvm_message *inmsg) struct visorchipset_bus_info *pBusInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; - pDevInfo = finddevice(&DevInfoList, busNo, devNo); + pDevInfo = finddevice(&dev_info_list, busNo, devNo); if (pDevInfo && (pDevInfo->state.created == 1)) { POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; goto Away; } - pBusInfo = findbus(&BusInfoList, busNo); + pBusInfo = findbus(&bus_info_list, busNo); if (!pBusInfo) { POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); @@ -1234,7 +1234,7 @@ my_device_create(struct controlvm_message *inmsg) pDevInfo->chan_info.channel_type_uuid = cmd->create_device.data_type_uuid; pDevInfo->chan_info.intr = cmd->create_device.intr; - list_add(&pDevInfo->entry, &DevInfoList); + list_add(&pDevInfo->entry, &dev_info_list); POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, devNo, busNo, POSTCODE_SEVERITY_INFO); Away: @@ -1260,7 +1260,7 @@ my_device_changestate(struct controlvm_message *inmsg) struct visorchipset_device_info *pDevInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; - pDevInfo = finddevice(&DevInfoList, busNo, devNo); + pDevInfo = finddevice(&dev_info_list, busNo, devNo); if (!pDevInfo) { POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); @@ -1290,7 +1290,7 @@ my_device_destroy(struct controlvm_message *inmsg) struct visorchipset_device_info *pDevInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; - pDevInfo = finddevice(&DevInfoList, busNo, devNo); + pDevInfo = finddevice(&dev_info_list, busNo, devNo); if (!pDevInfo) { rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; goto Away; @@ -2047,7 +2047,7 @@ device_resume_response(ulong busNo, ulong devNo, int response) BOOL visorchipset_get_bus_info(ulong bus_no, struct visorchipset_bus_info *bus_info) { - void *p = findbus(&BusInfoList, bus_no); + void *p = findbus(&bus_info_list, bus_no); if (!p) return FALSE; @@ -2059,7 +2059,7 @@ EXPORT_SYMBOL_GPL(visorchipset_get_bus_info); BOOL visorchipset_set_bus_context(ulong bus_no, void *context) { - struct visorchipset_bus_info *p = findbus(&BusInfoList, bus_no); + struct visorchipset_bus_info *p = findbus(&bus_info_list, bus_no); if (!p) return FALSE; @@ -2072,7 +2072,7 @@ BOOL visorchipset_get_device_info(ulong bus_no, ulong dev_no, struct visorchipset_device_info *dev_info) { - void *p = finddevice(&DevInfoList, bus_no, dev_no); + void *p = finddevice(&dev_info_list, bus_no, dev_no); if (!p) return FALSE; @@ -2085,7 +2085,7 @@ BOOL visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context) { struct visorchipset_device_info *p = - finddevice(&DevInfoList, bus_no, dev_no); + finddevice(&dev_info_list, bus_no, dev_no); if (!p) return FALSE; -- cgit v1.2.3 From 0639ba6759857ca3e8d29669e1234ef34b52a29e Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:04 -0400 Subject: staging: unisys: fix placement of logical ops in visorchipset_main.c Several if statement lines had the logical operators in the wrong place, so fix these by moving the operator to the end of the previous line. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorchipset/visorchipset_main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 4f36b4b6949a..401cd1e0d1a5 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -84,8 +84,8 @@ static struct controlvm_message_packet g_devicechangestate_packet; */ #define FOR_VISORHACKBUS(channel_type_guid) \ (((uuid_le_cmp(channel_type_guid,\ - spar_vnic_channel_protocol_uuid) == 0)\ - || (uuid_le_cmp(channel_type_guid,\ + spar_vnic_channel_protocol_uuid) == 0) ||\ + (uuid_le_cmp(channel_type_guid,\ spar_vhba_channel_protocol_uuid) == 0))) #define FOR_VISORBUS(channel_type_guid) (!(FOR_VISORHACKBUS(channel_type_guid))) @@ -705,10 +705,10 @@ controlvm_respond(struct controlvm_message_header *msgHdr, int response) controlvm_init_response(&outmsg, msgHdr, response); /* For DiagPool channel DEVICE_CHANGESTATE, we need to send * back the deviceChangeState structure in the packet. */ - if (msgHdr->id == CONTROLVM_DEVICE_CHANGESTATE - && g_devicechangestate_packet.device_change_state.bus_no == - g_diagpool_bus_no - && g_devicechangestate_packet.device_change_state.dev_no == + if (msgHdr->id == CONTROLVM_DEVICE_CHANGESTATE && + g_devicechangestate_packet.device_change_state.bus_no == + g_diagpool_bus_no && + g_devicechangestate_packet.device_change_state.dev_no == g_diagpool_dev_no) outmsg.cmd = g_devicechangestate_packet; if (outmsg.hdr.flags.test_message == 1) @@ -1030,8 +1030,8 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, /* this is lite pause where channel is * still valid just 'pause' of it */ - if (busNo == g_diagpool_bus_no - && devNo == g_diagpool_dev_no) { + if (busNo == g_diagpool_bus_no && + devNo == g_diagpool_dev_no) { /* this will trigger the * diag_shutdown.sh script in * the visorchipset hotplug */ @@ -1828,8 +1828,8 @@ controlvm_periodic_work(struct work_struct *work) /* Check events to determine if response to CHIPSET_READY * should be sent */ - if (visorchipset_holdchipsetready - && (g_chipset_msg_hdr.id != CONTROLVM_INVALID)) { + if (visorchipset_holdchipsetready && + (g_chipset_msg_hdr.id != CONTROLVM_INVALID)) { if (check_chipset_events() == 1) { controlvm_respond(&g_chipset_msg_hdr, 0); clear_chipset_events(); -- cgit v1.2.3 From c3d9a224e7872ec2a6341ef57d04432bc6f961a0 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:05 -0400 Subject: staging: unisys: fix CamelCase channel name ControlVm_channel Rename the channel: ControlVm_channel => controlvm_channel Update all references to use the new name. Fix the odd bracketing in the while() statement with the reference to controlvm_channel, too, so the patch doesn't generate a warning. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 78 +++++++++++----------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 401cd1e0d1a5..793ff1bf7f2e 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -96,7 +96,7 @@ static struct controlvm_message_packet g_devicechangestate_packet; static LIST_HEAD(bus_info_list); static LIST_HEAD(dev_info_list); -static struct visorchannel *ControlVm_channel; +static struct visorchannel *controlvm_channel; struct controlvm_payload_info { u8 __iomem *ptr; /* pointer to base address of payload pool */ @@ -353,7 +353,7 @@ static ssize_t toolaction_show(struct device *dev, { u8 toolAction; - visorchannel_read(ControlVm_channel, + visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, tool_action), &toolAction, sizeof(u8)); return scnprintf(buf, PAGE_SIZE, "%u\n", toolAction); @@ -369,7 +369,7 @@ static ssize_t toolaction_store(struct device *dev, if (kstrtou8(buf, 10, &toolAction) != 0) return -EINVAL; - ret = visorchannel_write(ControlVm_channel, + ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, tool_action), &toolAction, sizeof(u8)); @@ -384,7 +384,7 @@ static ssize_t boottotool_show(struct device *dev, { struct efi_spar_indication efiSparIndication; - visorchannel_read(ControlVm_channel, + visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, efi_spar_ind), &efiSparIndication, sizeof(struct efi_spar_indication)); @@ -403,7 +403,7 @@ static ssize_t boottotool_store(struct device *dev, return -EINVAL; efiSparIndication.boot_to_tool = val; - ret = visorchannel_write(ControlVm_channel, + ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, efi_spar_ind), &(efiSparIndication), @@ -419,7 +419,7 @@ static ssize_t error_show(struct device *dev, struct device_attribute *attr, { u32 error; - visorchannel_read(ControlVm_channel, offsetof( + visorchannel_read(controlvm_channel, offsetof( struct spar_controlvm_channel_protocol, installation_error), &error, sizeof(u32)); return scnprintf(buf, PAGE_SIZE, "%i\n", error); @@ -434,7 +434,7 @@ static ssize_t error_store(struct device *dev, struct device_attribute *attr, if (kstrtou32(buf, 10, &error) != 0) return -EINVAL; - ret = visorchannel_write(ControlVm_channel, + ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, installation_error), &error, sizeof(u32)); @@ -448,7 +448,7 @@ static ssize_t textid_show(struct device *dev, struct device_attribute *attr, { u32 textId; - visorchannel_read(ControlVm_channel, offsetof( + visorchannel_read(controlvm_channel, offsetof( struct spar_controlvm_channel_protocol, installation_text_id), &textId, sizeof(u32)); return scnprintf(buf, PAGE_SIZE, "%i\n", textId); @@ -463,7 +463,7 @@ static ssize_t textid_store(struct device *dev, struct device_attribute *attr, if (kstrtou32(buf, 10, &textId) != 0) return -EINVAL; - ret = visorchannel_write(ControlVm_channel, + ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, installation_text_id), &textId, sizeof(u32)); @@ -478,7 +478,7 @@ static ssize_t remaining_steps_show(struct device *dev, { u16 remainingSteps; - visorchannel_read(ControlVm_channel, + visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, installation_remaining_steps), &remainingSteps, @@ -495,7 +495,7 @@ static ssize_t remaining_steps_store(struct device *dev, if (kstrtou16(buf, 10, &remainingSteps) != 0) return -EINVAL; - ret = visorchannel_write(ControlVm_channel, + ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, installation_remaining_steps), &remainingSteps, sizeof(u16)); @@ -714,7 +714,7 @@ controlvm_respond(struct controlvm_message_header *msgHdr, int response) if (outmsg.hdr.flags.test_message == 1) return; - if (!visorchannel_signalinsert(ControlVm_channel, + if (!visorchannel_signalinsert(controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { return; } @@ -729,7 +729,7 @@ controlvm_respond_chipset_init(struct controlvm_message_header *msgHdr, controlvm_init_response(&outmsg, msgHdr, response); outmsg.cmd.init_chipset.features = features; - if (!visorchannel_signalinsert(ControlVm_channel, + if (!visorchannel_signalinsert(controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { return; } @@ -744,7 +744,7 @@ static void controlvm_respond_physdev_changestate( controlvm_init_response(&outmsg, msgHdr, response); outmsg.cmd.device_change_state.state = state; outmsg.cmd.device_change_state.flags.phys_device = 1; - if (!visorchannel_signalinsert(ControlVm_channel, + if (!visorchannel_signalinsert(controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { return; } @@ -758,7 +758,7 @@ visorchipset_save_message(struct controlvm_message *msg, u16 localSavedCrashMsgCount; /* get saved message count */ - if (visorchannel_read(ControlVm_channel, + if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_count), &localSavedCrashMsgCount, sizeof(u16)) < 0) { @@ -775,7 +775,7 @@ visorchipset_save_message(struct controlvm_message *msg, } /* get saved crash message offset */ - if (visorchannel_read(ControlVm_channel, + if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_offset), &localSavedCrashMsgOffset, sizeof(u32)) < 0) { @@ -785,7 +785,7 @@ visorchipset_save_message(struct controlvm_message *msg, } if (type == CRASH_BUS) { - if (visorchannel_write(ControlVm_channel, + if (visorchannel_write(controlvm_channel, localSavedCrashMsgOffset, msg, sizeof(struct controlvm_message)) < 0) { @@ -794,7 +794,7 @@ visorchipset_save_message(struct controlvm_message *msg, return; } } else { - if (visorchannel_write(ControlVm_channel, + if (visorchannel_write(controlvm_channel, localSavedCrashMsgOffset + sizeof(struct controlvm_message), msg, sizeof(struct controlvm_message)) < 0) { @@ -862,7 +862,7 @@ device_changestate_responder(enum controlvm_id cmdId, outmsg.cmd.device_change_state.dev_no = devNo; outmsg.cmd.device_change_state.state = responseState; - if (!visorchannel_signalinsert(ControlVm_channel, + if (!visorchannel_signalinsert(controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) return; @@ -1363,11 +1363,11 @@ destroy_controlvm_payload_info(struct controlvm_payload_info *info) static void initialize_controlvm_payload(void) { - HOSTADDRESS phys_addr = visorchannel_get_physaddr(ControlVm_channel); + HOSTADDRESS phys_addr = visorchannel_get_physaddr(controlvm_channel); u64 payloadOffset = 0; u32 payloadBytes = 0; - if (visorchannel_read(ControlVm_channel, + if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, request_payload_offset), &payloadOffset, sizeof(payloadOffset)) < 0) { @@ -1375,7 +1375,7 @@ initialize_controlvm_payload(void) POSTCODE_SEVERITY_ERR); return; } - if (visorchannel_read(ControlVm_channel, + if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, request_payload_bytes), &payloadBytes, sizeof(payloadBytes)) < 0) { @@ -1468,7 +1468,7 @@ chipset_notready(struct controlvm_message_header *msgHdr) static BOOL read_controlvm_event(struct controlvm_message *msg) { - if (visorchannel_signalremove(ControlVm_channel, + if (visorchannel_signalremove(controlvm_channel, CONTROLVM_QUEUE_EVENT, msg)) { /* got a message */ if (msg->hdr.flags.test_message == 1) @@ -1727,8 +1727,8 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) if (!isLocalAddr) { controlvm_init_response(&ackmsg, &inmsg.hdr, CONTROLVM_RESP_SUCCESS); - if (ControlVm_channel) - visorchannel_signalinsert(ControlVm_channel, + if (controlvm_channel) + visorchannel_signalinsert(controlvm_channel, CONTROLVM_QUEUE_ACK, &ackmsg); } @@ -1838,10 +1838,10 @@ controlvm_periodic_work(struct work_struct *work) } } - while (visorchannel_signalremove(ControlVm_channel, + while (visorchannel_signalremove(controlvm_channel, CONTROLVM_QUEUE_RESPONSE, - &inmsg)) { - } + &inmsg)) + ; if (!gotACommand) { if (ControlVm_Pending_Msg_Valid) { /* we throttled processing of a prior @@ -1860,7 +1860,7 @@ controlvm_periodic_work(struct work_struct *work) most_recent_message_jiffies = jiffies; if (handle_command(inmsg, visorchannel_get_physaddr - (ControlVm_channel))) + (controlvm_channel))) gotACommand = read_controlvm_event(&inmsg); else { /* this is a scenario where throttling @@ -1927,7 +1927,7 @@ setup_crash_devices_work_queue(struct work_struct *work) chipset_init(&msg); /* get saved message count */ - if (visorchannel_read(ControlVm_channel, + if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_count), &localSavedCrashMsgCount, sizeof(u16)) < 0) { @@ -1944,7 +1944,7 @@ setup_crash_devices_work_queue(struct work_struct *work) } /* get saved crash message offset */ - if (visorchannel_read(ControlVm_channel, + if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_offset), &localSavedCrashMsgOffset, sizeof(u32)) < 0) { @@ -1954,7 +1954,7 @@ setup_crash_devices_work_queue(struct work_struct *work) } /* read create device message for storage bus offset */ - if (visorchannel_read(ControlVm_channel, + if (visorchannel_read(controlvm_channel, localSavedCrashMsgOffset, &localCrashCreateBusMsg, sizeof(struct controlvm_message)) < 0) { @@ -1964,7 +1964,7 @@ setup_crash_devices_work_queue(struct work_struct *work) } /* read create device message for storage device */ - if (visorchannel_read(ControlVm_channel, + if (visorchannel_read(controlvm_channel, localSavedCrashMsgOffset + sizeof(struct controlvm_message), &localCrashCreateDevMsg, @@ -2208,17 +2208,17 @@ visorchipset_init(void) addr = controlvm_get_channel_address(); if (addr != 0) { - ControlVm_channel = + controlvm_channel = visorchannel_create_with_lock (addr, sizeof(struct spar_controlvm_channel_protocol), spar_controlvm_channel_protocol_uuid); if (SPAR_CONTROLVM_CHANNEL_OK_CLIENT( - visorchannel_get_header(ControlVm_channel))) { + visorchannel_get_header(controlvm_channel))) { initialize_controlvm_payload(); } else { - visorchannel_destroy(ControlVm_channel); - ControlVm_channel = NULL; + visorchannel_destroy(controlvm_channel); + controlvm_channel = NULL; return -ENODEV; } } else { @@ -2226,7 +2226,7 @@ visorchipset_init(void) } MajorDev = MKDEV(visorchipset_major, 0); - rc = visorchipset_file_init(MajorDev, &ControlVm_channel); + rc = visorchipset_file_init(MajorDev, &controlvm_channel); if (rc < 0) { POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR); goto Away; @@ -2320,7 +2320,7 @@ visorchipset_exit(void) memset(&g_del_dump_msg_hdr, 0, sizeof(struct controlvm_message_header)); - visorchannel_destroy(ControlVm_channel); + visorchannel_destroy(controlvm_channel); visorchipset_file_cleanup(); POSTCODE_LINUX_2(DRIVER_EXIT_PC, POSTCODE_SEVERITY_INFO); -- cgit v1.2.3 From b28ee90cbb890816336559841bcd2d6d036b1ed0 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:06 -0400 Subject: staging: unisys: get rid of Test_Vnic_channel Nobody is using this, so remove it. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 793ff1bf7f2e..9ce2dcdb1dea 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -108,8 +108,6 @@ struct controlvm_payload_info { /* Manages the request payload in the controlvm channel */ static struct controlvm_payload_info ControlVm_payload_info; -static struct channel_header *Test_Vnic_channel; - struct livedump_info { struct controlvm_message_header Dumpcapture_header; struct controlvm_message_header Gettextdump_header; @@ -2306,7 +2304,6 @@ visorchipset_exit(void) periodic_controlvm_workqueue = NULL; destroy_controlvm_payload_info(&ControlVm_payload_info); } - Test_Vnic_channel = NULL; if (Putfile_buffer_list_pool) { kmem_cache_destroy(Putfile_buffer_list_pool); Putfile_buffer_list_pool = NULL; -- cgit v1.2.3 From 84982fbf0f0db69bf2c071a9b49908cf7cd6bfe4 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:07 -0400 Subject: staging: unisys: fix CamelCase global ControlVm_payload_info Rename the CamelCase global structure ControlVm_payload_info => controlvm_payload_info Move the declaration to the struct definition, and update all references to use the new name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 9ce2dcdb1dea..875281d53cf5 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -98,15 +98,13 @@ static LIST_HEAD(dev_info_list); static struct visorchannel *controlvm_channel; -struct controlvm_payload_info { +/* Manages the request payload in the controlvm channel */ +static struct controlvm_payload_info { u8 __iomem *ptr; /* pointer to base address of payload pool */ u64 offset; /* offset from beginning of controlvm * channel to beginning of payload * pool */ u32 bytes; /* number of bytes in payload pool */ -}; - -/* Manages the request payload in the controlvm channel */ -static struct controlvm_payload_info ControlVm_payload_info; +} controlvm_payload_info; struct livedump_info { struct controlvm_message_header Dumpcapture_header; @@ -1383,7 +1381,7 @@ initialize_controlvm_payload(void) } initialize_controlvm_payload_info(phys_addr, payloadOffset, payloadBytes, - &ControlVm_payload_info); + &controlvm_payload_info); } /* Send ACTION=online for DEVPATH=/sys/devices/platform/visorchipset. @@ -2194,7 +2192,7 @@ visorchipset_init(void) memset(&BusDev_Server_Notifiers, 0, sizeof(BusDev_Server_Notifiers)); memset(&BusDev_Client_Notifiers, 0, sizeof(BusDev_Client_Notifiers)); - memset(&ControlVm_payload_info, 0, sizeof(ControlVm_payload_info)); + memset(&controlvm_payload_info, 0, sizeof(controlvm_payload_info)); memset(&LiveDump_info, 0, sizeof(LiveDump_info)); atomic_set(&LiveDump_info.buffers_in_use, 0); @@ -2302,7 +2300,7 @@ visorchipset_exit(void) flush_workqueue(periodic_controlvm_workqueue); destroy_workqueue(periodic_controlvm_workqueue); periodic_controlvm_workqueue = NULL; - destroy_controlvm_payload_info(&ControlVm_payload_info); + destroy_controlvm_payload_info(&controlvm_payload_info); } if (Putfile_buffer_list_pool) { kmem_cache_destroy(Putfile_buffer_list_pool); -- cgit v1.2.3 From ea33b4ee5e12a00faf03ad09f7309040685822f5 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:08 -0400 Subject: staging: unisys: refactor livedump_info structure Fix the CamelCase member names and that global variable: Dumpcapture_header => dumpcapture_header Gettextdump_header => gettextdump_header Dumpcomplete_header => dumpcomplete_header Gettextdump_outstanding => gettextdump_outstanding LiveDump_info => livedump_info Update all references and merge the definition and global structure declaration. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 875281d53cf5..6c6804f8daea 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -106,20 +106,19 @@ static struct controlvm_payload_info { u32 bytes; /* number of bytes in payload pool */ } controlvm_payload_info; -struct livedump_info { - struct controlvm_message_header Dumpcapture_header; - struct controlvm_message_header Gettextdump_header; - struct controlvm_message_header Dumpcomplete_header; - BOOL Gettextdump_outstanding; +/* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE / + * CONTROLVM_DUMP_GETTEXTDUMP / CONTROLVM_DUMP_COMPLETE conversation. + */ +static struct livedump_info { + struct controlvm_message_header dumpcapture_header; + struct controlvm_message_header gettextdump_header; + struct controlvm_message_header dumpcomplete_header; + BOOL gettextdump_outstanding; u32 crc32; ulong length; atomic_t buffers_in_use; ulong destination; -}; -/* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE / - * CONTROLVM_DUMP_GETTEXTDUMP / CONTROLVM_DUMP_COMPLETE conversation. - */ -static struct livedump_info LiveDump_info; +} livedump_info; /* The following globals are used to handle the scenario where we are unable to * offload the payload from a controlvm message due to memory requirements. In @@ -2193,8 +2192,8 @@ visorchipset_init(void) memset(&BusDev_Server_Notifiers, 0, sizeof(BusDev_Server_Notifiers)); memset(&BusDev_Client_Notifiers, 0, sizeof(BusDev_Client_Notifiers)); memset(&controlvm_payload_info, 0, sizeof(controlvm_payload_info)); - memset(&LiveDump_info, 0, sizeof(LiveDump_info)); - atomic_set(&LiveDump_info.buffers_in_use, 0); + memset(&livedump_info, 0, sizeof(livedump_info)); + atomic_set(&livedump_info.buffers_in_use, 0); if (visorchipset_testvnic) { POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, x, DIAG_SEVERITY_ERR); -- cgit v1.2.3 From 29b809e5168f12ed5a216b3c8a5e6be85146a6ab Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:09 -0400 Subject: staging: unisys: remove extra blank lines in visorchipset_main.c Fix up the line spacing around braces in visorchipset_main.c. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 6c6804f8daea..e459672dae35 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -467,7 +467,6 @@ static ssize_t textid_store(struct device *dev, struct device_attribute *attr, return count; } - static ssize_t remaining_steps_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1895,7 +1894,6 @@ Away: static void setup_crash_devices_work_queue(struct work_struct *work) { - struct controlvm_message localCrashCreateBusMsg; struct controlvm_message localCrashCreateDevMsg; struct controlvm_message msg; @@ -2024,7 +2022,6 @@ device_destroy_response(ulong busNo, ulong devNo, int response) void visorchipset_device_pause_response(ulong bus_no, ulong dev_no, int response) { - device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, bus_no, dev_no, response, segment_state_standby); @@ -2268,7 +2265,6 @@ visorchipset_init(void) DIAG_SEVERITY_ERR); goto Away; } - } Visorchipset_platform_device.dev.devt = MajorDev; -- cgit v1.2.3 From 1527e938b76a66be951fdfd948d4f6b358dcec87 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:10 -0400 Subject: staging: unisys: remove old code block in visorchipset_main.c The block of code is old and #if 0'd out, so just remove it. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 29 ---------------------- 1 file changed, 29 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index e459672dae35..dea2c83224e1 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -498,35 +498,6 @@ static ssize_t remaining_steps_store(struct device *dev, return count; } -#if 0 -static void -testUnicode(void) -{ - wchar_t unicodeString[] = { 'a', 'b', 'c', 0 }; - char s[sizeof(unicodeString) * NLS_MAX_CHARSET_SIZE]; - wchar_t unicode2[99]; - - /* NOTE: Either due to a bug, or feature I don't understand, the - * kernel utf8_mbstowcs() and utf_wcstombs() do NOT copy the - * trailed NUL byte!! REALLY!!!!! Arrrrgggghhhhh - */ - - LOGINF("sizeof(wchar_t) = %d", sizeof(wchar_t)); - LOGINF("utf8_wcstombs=%d", - chrs = utf8_wcstombs(s, unicodeString, sizeof(s))); - if (chrs >= 0) - s[chrs] = '\0'; /* GRRRRRRRR */ - LOGINF("s='%s'", s); - LOGINF("utf8_mbstowcs=%d", chrs = utf8_mbstowcs(unicode2, s, 100)); - if (chrs >= 0) - unicode2[chrs] = 0; /* GRRRRRRRR */ - if (memcmp(unicodeString, unicode2, sizeof(unicodeString)) == 0) - LOGINF("strings match... good"); - else - LOGINF("strings did not match!!"); -} -#endif - static void busInfo_clear(void *v) { -- cgit v1.2.3 From 9b989a98d74eb91c59b5bacec88e06b7b2fff436 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:11 -0400 Subject: staging: unisys: fix CamelCase-named clearing functions Fix the CamelCase-named structure clearing functions in visorchipset_main.c: busInfo_clear => bus_info_clear devInfo_clear => dev_info_clear Update references to use the fixed names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index dea2c83224e1..98238bc8ee22 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -499,7 +499,7 @@ static ssize_t remaining_steps_store(struct device *dev, } static void -busInfo_clear(void *v) +bus_info_clear(void *v) { struct visorchipset_bus_info *p = (struct visorchipset_bus_info *) (v); @@ -518,7 +518,7 @@ busInfo_clear(void *v) } static void -devInfo_clear(void *v) +dev_info_clear(void *v) { struct visorchipset_device_info *p = (struct visorchipset_device_info *)(v); @@ -603,13 +603,13 @@ cleanup_controlvm_structures(void) struct visorchipset_device_info *di, *tmp_di; list_for_each_entry_safe(bi, tmp_bi, &bus_info_list, entry) { - busInfo_clear(bi); + bus_info_clear(bi); list_del(&bi->entry); kfree(bi); } list_for_each_entry_safe(di, tmp_di, &dev_info_list, entry) { - devInfo_clear(di); + dev_info_clear(di); list_del(&di->entry); kfree(di); } @@ -800,7 +800,7 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response) controlvm_respond(&p->pending_msg_hdr, response); p->pending_msg_hdr.id = CONTROLVM_INVALID; if (need_clear) { - busInfo_clear(p); + bus_info_clear(p); delbusdevices(&dev_info_list, busNo); } } @@ -860,7 +860,7 @@ device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, controlvm_respond(&p->pending_msg_hdr, response); p->pending_msg_hdr.id = CONTROLVM_INVALID; if (need_clear) - devInfo_clear(p); + dev_info_clear(p); } static void -- cgit v1.2.3 From a59d7bed79a39a01a1fa8d3d651af592a84a4aef Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:12 -0400 Subject: staging: unisys: remove obsolete proc entry code There is an unused variable in the visorchipset_bus_info structure that used to be for a proc entry, so remove it, and the code that referenced it. We don't need it anymore. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset.h | 1 - drivers/staging/unisys/visorchipset/visorchipset_main.c | 4 ---- 2 files changed, 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset.h b/drivers/staging/unisys/visorchipset/visorchipset.h index 98f3ba4c13ac..bd46df9ef45a 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset.h +++ b/drivers/staging/unisys/visorchipset/visorchipset.h @@ -133,7 +133,6 @@ struct visorchipset_bus_info { u8 *description; /* UTF8 */ u64 reserved1; u32 reserved2; - MYPROCOBJECT *proc_object; struct { u32 server:1; /* Add new fields above. */ diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 98238bc8ee22..a60597e8f20b 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -503,10 +503,6 @@ bus_info_clear(void *v) { struct visorchipset_bus_info *p = (struct visorchipset_bus_info *) (v); - if (p->proc_object) { - visor_proc_DestroyObject(p->proc_object); - p->proc_object = NULL; - } kfree(p->name); p->name = NULL; -- cgit v1.2.3 From 38f736e974e394157c9111cc53a6f3a55ea8cbc8 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:13 -0400 Subject: staging: unisys: fix all NULL comparisons in visorchipset_main.c Fix all of the NULL comparison checks generated by checkpatch.pl. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorchipset/visorchipset_main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index a60597e8f20b..5d1f1fad511e 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -550,7 +550,7 @@ visorchipset_register_busdev_server( struct ultra_vbus_deviceinfo *driver_info) { down(¬ifier_lock); - if (notifiers == NULL) { + if (!notifiers) { memset(&BusDev_Server_Notifiers, 0, sizeof(BusDev_Server_Notifiers)); serverregistered = 0; /* clear flag */ @@ -575,7 +575,7 @@ visorchipset_register_busdev_client( struct ultra_vbus_deviceinfo *driver_info) { down(¬ifier_lock); - if (notifiers == NULL) { + if (!notifiers) { memset(&BusDev_Client_Notifiers, 0, sizeof(BusDev_Client_Notifiers)); clientregistered = 0; /* clear flag */ @@ -1038,7 +1038,7 @@ bus_create(struct controlvm_message *inmsg) goto Away; } pBusInfo = kzalloc(sizeof(struct visorchipset_bus_info), GFP_KERNEL); - if (pBusInfo == NULL) { + if (!pBusInfo) { POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; @@ -1172,7 +1172,7 @@ my_device_create(struct controlvm_message *inmsg) goto Away; } pDevInfo = kzalloc(sizeof(struct visorchipset_device_info), GFP_KERNEL); - if (pDevInfo == NULL) { + if (!pDevInfo) { POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; @@ -1282,7 +1282,7 @@ initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes, u8 __iomem *payload = NULL; int rc = CONTROLVM_RESP_SUCCESS; - if (info == NULL) { + if (!info) { rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID; goto Away; } @@ -1292,7 +1292,7 @@ initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes, goto Away; } payload = ioremap_cache(phys_addr + offset, bytes); - if (payload == NULL) { + if (!payload) { rc = -CONTROLVM_RESP_ERROR_IOREMAP_FAILED; goto Away; } @@ -1486,7 +1486,7 @@ parahotplug_request_create(struct controlvm_message *msg) struct parahotplug_request *req; req = kmalloc(sizeof(*req), GFP_KERNEL|__GFP_NORETRY); - if (req == NULL) + if (!req) return NULL; req->id = parahotplug_next_id(); @@ -1611,7 +1611,7 @@ parahotplug_process_message(struct controlvm_message *inmsg) req = parahotplug_request_create(inmsg); - if (req == NULL) + if (!req) return; if (inmsg->cmd.device_change_state.state.active) { @@ -1745,7 +1745,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) break; } - if (parser_ctx != NULL) { + if (parser_ctx) { parser_done(parser_ctx); parser_ctx = NULL; } @@ -2217,7 +2217,7 @@ visorchipset_init(void) periodic_controlvm_workqueue = create_singlethread_workqueue("visorchipset_controlvm"); - if (periodic_controlvm_workqueue == NULL) { + if (!periodic_controlvm_workqueue) { POSTCODE_LINUX_2(CREATE_WORKQUEUE_FAILED_PC, DIAG_SEVERITY_ERR); rc = -ENOMEM; -- cgit v1.2.3 From e3199b2e3c2697a4e2a99a00434e1ec09d2646b6 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:14 -0400 Subject: staging: unisys: fix Camelcase Away goto label Rename the label in both places: Away => cleanup Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 5d1f1fad511e..8c58a148562e 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -621,7 +621,7 @@ chipset_init(struct controlvm_message *inmsg) POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO); if (chipset_inited) { rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; - goto Away; + goto cleanup; } chipset_inited = 1; POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC, POSTCODE_SEVERITY_INFO); @@ -636,7 +636,7 @@ chipset_init(struct controlvm_message *inmsg) * features-aware driver. */ features |= ULTRA_CHIPSET_FEATURE_REPLY; -Away: +cleanup: if (rc < 0) cleanup_controlvm_structures(); if (inmsg->hdr.flags.response_expected) -- cgit v1.2.3 From 4577225d26d43974e79fa7d288df7fb8397cffa2 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:15 -0400 Subject: staging: unisys: fix CamelCase locals in visorchipset_save_message Rename CamelCased local variable names: localSavedCrashMsgOffset => crash_msg_offset localSavedCrashMsgCount => crash_msg_count Update references to use the new names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 8c58a148562e..66624421a208 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -715,22 +715,22 @@ void visorchipset_save_message(struct controlvm_message *msg, enum crash_obj_type type) { - u32 localSavedCrashMsgOffset; - u16 localSavedCrashMsgCount; + u32 crash_msg_offset; + u16 crash_msg_count; /* get saved message count */ if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_count), - &localSavedCrashMsgCount, sizeof(u16)) < 0) { + &crash_msg_count, sizeof(u16)) < 0) { POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; } - if (localSavedCrashMsgCount != CONTROLVM_CRASHMSG_MAX) { + if (crash_msg_count != CONTROLVM_CRASHMSG_MAX) { POSTCODE_LINUX_3(CRASH_DEV_COUNT_FAILURE_PC, - localSavedCrashMsgCount, + crash_msg_count, POSTCODE_SEVERITY_ERR); return; } @@ -739,7 +739,7 @@ visorchipset_save_message(struct controlvm_message *msg, if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_offset), - &localSavedCrashMsgOffset, sizeof(u32)) < 0) { + &crash_msg_offset, sizeof(u32)) < 0) { POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -747,7 +747,7 @@ visorchipset_save_message(struct controlvm_message *msg, if (type == CRASH_BUS) { if (visorchannel_write(controlvm_channel, - localSavedCrashMsgOffset, + crash_msg_offset, msg, sizeof(struct controlvm_message)) < 0) { POSTCODE_LINUX_2(SAVE_MSG_BUS_FAILURE_PC, @@ -756,7 +756,7 @@ visorchipset_save_message(struct controlvm_message *msg, } } else { if (visorchannel_write(controlvm_channel, - localSavedCrashMsgOffset + + crash_msg_offset + sizeof(struct controlvm_message), msg, sizeof(struct controlvm_message)) < 0) { POSTCODE_LINUX_2(SAVE_MSG_DEV_FAILURE_PC, -- cgit v1.2.3 From fbb31f48aba3d4c149b85b5b25b2667ea5ba9ccf Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:16 -0400 Subject: staging: unisys: fix CamelCase params in responder functions Fix the CamelCase parameter names in the set of responder functions: cmdId => cmd_id busNo => bus_no devNo => dev_no responseState => response_state Update all references to use the fixed names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 66624421a208..700b35ed08cd 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -768,60 +768,60 @@ visorchipset_save_message(struct controlvm_message *msg, EXPORT_SYMBOL_GPL(visorchipset_save_message); static void -bus_responder(enum controlvm_id cmdId, ulong busNo, int response) +bus_responder(enum controlvm_id cmd_id, ulong bus_no, int response) { struct visorchipset_bus_info *p = NULL; BOOL need_clear = FALSE; - p = findbus(&bus_info_list, busNo); + p = findbus(&bus_info_list, bus_no); if (!p) return; if (response < 0) { - if ((cmdId == CONTROLVM_BUS_CREATE) && + if ((cmd_id == CONTROLVM_BUS_CREATE) && (response != (-CONTROLVM_RESP_ERROR_ALREADY_DONE))) /* undo the row we just created... */ - delbusdevices(&dev_info_list, busNo); + delbusdevices(&dev_info_list, bus_no); } else { - if (cmdId == CONTROLVM_BUS_CREATE) + if (cmd_id == CONTROLVM_BUS_CREATE) p->state.created = 1; - if (cmdId == CONTROLVM_BUS_DESTROY) + if (cmd_id == CONTROLVM_BUS_DESTROY) need_clear = TRUE; } if (p->pending_msg_hdr.id == CONTROLVM_INVALID) return; /* no controlvm response needed */ - if (p->pending_msg_hdr.id != (u32) cmdId) + if (p->pending_msg_hdr.id != (u32) cmd_id) return; controlvm_respond(&p->pending_msg_hdr, response); p->pending_msg_hdr.id = CONTROLVM_INVALID; if (need_clear) { bus_info_clear(p); - delbusdevices(&dev_info_list, busNo); + delbusdevices(&dev_info_list, bus_no); } } static void -device_changestate_responder(enum controlvm_id cmdId, - ulong busNo, ulong devNo, int response, - struct spar_segment_state responseState) +device_changestate_responder(enum controlvm_id cmd_id, + ulong bus_no, ulong dev_no, int response, + struct spar_segment_state response_state) { struct visorchipset_device_info *p = NULL; struct controlvm_message outmsg; - p = finddevice(&dev_info_list, busNo, devNo); + p = finddevice(&dev_info_list, bus_no, dev_no); if (!p) return; if (p->pending_msg_hdr.id == CONTROLVM_INVALID) return; /* no controlvm response needed */ - if (p->pending_msg_hdr.id != cmdId) + if (p->pending_msg_hdr.id != cmd_id) return; controlvm_init_response(&outmsg, &p->pending_msg_hdr, response); - outmsg.cmd.device_change_state.bus_no = busNo; - outmsg.cmd.device_change_state.dev_no = devNo; - outmsg.cmd.device_change_state.state = responseState; + outmsg.cmd.device_change_state.bus_no = bus_no; + outmsg.cmd.device_change_state.dev_no = dev_no; + outmsg.cmd.device_change_state.state = response_state; if (!visorchannel_signalinsert(controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) @@ -831,26 +831,26 @@ device_changestate_responder(enum controlvm_id cmdId, } static void -device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, +device_responder(enum controlvm_id cmd_id, ulong bus_no, ulong dev_no, int response) { struct visorchipset_device_info *p = NULL; BOOL need_clear = FALSE; - p = finddevice(&dev_info_list, busNo, devNo); + p = finddevice(&dev_info_list, bus_no, dev_no); if (!p) return; if (response >= 0) { - if (cmdId == CONTROLVM_DEVICE_CREATE) + if (cmd_id == CONTROLVM_DEVICE_CREATE) p->state.created = 1; - if (cmdId == CONTROLVM_DEVICE_DESTROY) + if (cmd_id == CONTROLVM_DEVICE_DESTROY) need_clear = TRUE; } if (p->pending_msg_hdr.id == CONTROLVM_INVALID) return; /* no controlvm response needed */ - if (p->pending_msg_hdr.id != (u32) cmdId) + if (p->pending_msg_hdr.id != (u32) cmd_id) return; controlvm_respond(&p->pending_msg_hdr, response); -- cgit v1.2.3 From 2836c6a8de2174039770323dc14961eb1308c5e3 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:17 -0400 Subject: staging: unisys: fix CamelCase in epilog functions Rename the CamelCase parameters: busNo => bus_no devNo => dev_no needResponse => need_response And the local variables pBusInfo => bus_info pDevInfo => dev_info Update all references to use the corrected names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 67 +++++++++++----------- 1 file changed, 34 insertions(+), 33 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 700b35ed08cd..4e74799ade89 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -860,22 +860,23 @@ device_responder(enum controlvm_id cmd_id, ulong bus_no, ulong dev_no, } static void -bus_epilog(u32 busNo, - u32 cmd, struct controlvm_message_header *msgHdr, - int response, BOOL needResponse) +bus_epilog(u32 bus_no, + u32 cmd, struct controlvm_message_header *msg_hdr, + int response, BOOL need_response) { BOOL notified = FALSE; - struct visorchipset_bus_info *pBusInfo = findbus(&bus_info_list, busNo); + struct visorchipset_bus_info *bus_info = findbus(&bus_info_list, + bus_no); - if (!pBusInfo) + if (!bus_info) return; - if (needResponse) { - memcpy(&pBusInfo->pending_msg_hdr, msgHdr, + if (need_response) { + memcpy(&bus_info->pending_msg_hdr, msg_hdr, sizeof(struct controlvm_message_header)); } else - pBusInfo->pending_msg_hdr.id = CONTROLVM_INVALID; + bus_info->pending_msg_hdr.id = CONTROLVM_INVALID; down(¬ifier_lock); if (response == CONTROLVM_RESP_SUCCESS) { @@ -892,23 +893,23 @@ bus_epilog(u32 busNo, * - BusDev_Client can handle ONLY client * devices */ if (BusDev_Server_Notifiers.bus_create) { - (*BusDev_Server_Notifiers.bus_create) (busNo); + (*BusDev_Server_Notifiers.bus_create) (bus_no); notified = TRUE; } - if ((!pBusInfo->flags.server) /*client */ && + if ((!bus_info->flags.server) /*client */ && BusDev_Client_Notifiers.bus_create) { - (*BusDev_Client_Notifiers.bus_create) (busNo); + (*BusDev_Client_Notifiers.bus_create) (bus_no); notified = TRUE; } break; case CONTROLVM_BUS_DESTROY: if (BusDev_Server_Notifiers.bus_destroy) { - (*BusDev_Server_Notifiers.bus_destroy) (busNo); + (*BusDev_Server_Notifiers.bus_destroy) (bus_no); notified = TRUE; } - if ((!pBusInfo->flags.server) /*client */ && + if ((!bus_info->flags.server) /*client */ && BusDev_Client_Notifiers.bus_destroy) { - (*BusDev_Client_Notifiers.bus_destroy) (busNo); + (*BusDev_Client_Notifiers.bus_destroy) (bus_no); notified = TRUE; } break; @@ -921,44 +922,44 @@ bus_epilog(u32 busNo, */ ; else - bus_responder(cmd, busNo, response); + bus_responder(cmd, bus_no, response); up(¬ifier_lock); } static void -device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, - struct controlvm_message_header *msgHdr, int response, - BOOL needResponse, BOOL for_visorbus) +device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, + struct controlvm_message_header *msg_hdr, int response, + BOOL need_response, BOOL for_visorbus) { struct visorchipset_busdev_notifiers *notifiers = NULL; BOOL notified = FALSE; - struct visorchipset_device_info *pDevInfo = - finddevice(&dev_info_list, busNo, devNo); + struct visorchipset_device_info *dev_info = + finddevice(&dev_info_list, bus_no, dev_no); char *envp[] = { "SPARSP_DIAGPOOL_PAUSED_STATE = 1", NULL }; - if (!pDevInfo) + if (!dev_info) return; if (for_visorbus) notifiers = &BusDev_Server_Notifiers; else notifiers = &BusDev_Client_Notifiers; - if (needResponse) { - memcpy(&pDevInfo->pending_msg_hdr, msgHdr, + if (need_response) { + memcpy(&dev_info->pending_msg_hdr, msg_hdr, sizeof(struct controlvm_message_header)); } else - pDevInfo->pending_msg_hdr.id = CONTROLVM_INVALID; + dev_info->pending_msg_hdr.id = CONTROLVM_INVALID; down(¬ifier_lock); if (response >= 0) { switch (cmd) { case CONTROLVM_DEVICE_CREATE: if (notifiers->device_create) { - (*notifiers->device_create) (busNo, devNo); + (*notifiers->device_create) (bus_no, dev_no); notified = TRUE; } break; @@ -968,8 +969,8 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, state.operating == segment_state_running.operating) { if (notifiers->device_resume) { - (*notifiers->device_resume) (busNo, - devNo); + (*notifiers->device_resume) (bus_no, + dev_no); notified = TRUE; } } @@ -981,8 +982,8 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, * where server is lost */ if (notifiers->device_pause) { - (*notifiers->device_pause) (busNo, - devNo); + (*notifiers->device_pause) (bus_no, + dev_no); notified = TRUE; } } else if (state.alive == segment_state_paused.alive && @@ -991,8 +992,8 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, /* this is lite pause where channel is * still valid just 'pause' of it */ - if (busNo == g_diagpool_bus_no && - devNo == g_diagpool_dev_no) { + if (bus_no == g_diagpool_bus_no && + dev_no == g_diagpool_dev_no) { /* this will trigger the * diag_shutdown.sh script in * the visorchipset hotplug */ @@ -1004,7 +1005,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, break; case CONTROLVM_DEVICE_DESTROY: if (notifiers->device_destroy) { - (*notifiers->device_destroy) (busNo, devNo); + (*notifiers->device_destroy) (bus_no, dev_no); notified = TRUE; } break; @@ -1017,7 +1018,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, */ ; else - device_responder(cmd, busNo, devNo, response); + device_responder(cmd, bus_no, dev_no, response); up(¬ifier_lock); } -- cgit v1.2.3 From 6b59b31d69cdf44e2d0b6b6314f78ca6ebb31b7b Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:18 -0400 Subject: staging: unisys: fix spaces after typecasts in visorchipset_main.c Just remove a couple of extra spaces after typecasts. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 4e74799ade89..fed675cd124b 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -791,7 +791,7 @@ bus_responder(enum controlvm_id cmd_id, ulong bus_no, int response) if (p->pending_msg_hdr.id == CONTROLVM_INVALID) return; /* no controlvm response needed */ - if (p->pending_msg_hdr.id != (u32) cmd_id) + if (p->pending_msg_hdr.id != (u32)cmd_id) return; controlvm_respond(&p->pending_msg_hdr, response); p->pending_msg_hdr.id = CONTROLVM_INVALID; @@ -850,7 +850,7 @@ device_responder(enum controlvm_id cmd_id, ulong bus_no, ulong dev_no, if (p->pending_msg_hdr.id == CONTROLVM_INVALID) return; /* no controlvm response needed */ - if (p->pending_msg_hdr.id != (u32) cmd_id) + if (p->pending_msg_hdr.id != (u32)cmd_id) return; controlvm_respond(&p->pending_msg_hdr, response); -- cgit v1.2.3 From 75c1f8b726e9383c1953c4999870ff3e13c931a9 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:19 -0400 Subject: staging: unisys: fix braces in visorchipset_main.c Fix all of the bracing mistakes by adding missing braces, and removing unnecessary braces. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorchipset/visorchipset_main.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index fed675cd124b..c1bcc4af7a7f 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -875,8 +875,9 @@ bus_epilog(u32 bus_no, if (need_response) { memcpy(&bus_info->pending_msg_hdr, msg_hdr, sizeof(struct controlvm_message_header)); - } else + } else { bus_info->pending_msg_hdr.id = CONTROLVM_INVALID; + } down(¬ifier_lock); if (response == CONTROLVM_RESP_SUCCESS) { @@ -951,8 +952,9 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, if (need_response) { memcpy(&dev_info->pending_msg_hdr, msg_hdr, sizeof(struct controlvm_message_header)); - } else + } else { dev_info->pending_msg_hdr.id = CONTROLVM_INVALID; + } down(¬ifier_lock); if (response >= 0) { @@ -1257,9 +1259,8 @@ my_device_destroy(struct controlvm_message *inmsg) rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; goto Away; } - if (pDevInfo->state.created == 0) { + if (pDevInfo->state.created == 0) rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; - } Away: if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo) @@ -1813,8 +1814,9 @@ controlvm_periodic_work(struct work_struct *work) inmsg = ControlVm_Pending_Msg; ControlVm_Pending_Msg_Valid = FALSE; gotACommand = TRUE; - } else + } else { gotACommand = read_controlvm_event(&inmsg); + } } handle_command_failed = FALSE; @@ -1936,18 +1938,18 @@ setup_crash_devices_work_queue(struct work_struct *work) } /* reuse IOVM create bus message */ - if (localCrashCreateBusMsg.cmd.create_bus.channel_addr != 0) + if (localCrashCreateBusMsg.cmd.create_bus.channel_addr != 0) { bus_create(&localCrashCreateBusMsg); - else { + } else { POSTCODE_LINUX_2(CRASH_DEV_BUS_NULL_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; } /* reuse create device message for storage device */ - if (localCrashCreateDevMsg.cmd.create_device.channel_addr != 0) + if (localCrashCreateDevMsg.cmd.create_device.channel_addr != 0) { my_device_create(&localCrashCreateDevMsg); - else { + } else { POSTCODE_LINUX_2(CRASH_DEV_DEV_NULL_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; -- cgit v1.2.3 From 6c5fed359fc7f2fd0b3c5469d43a1b07c283e1f9 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:20 -0400 Subject: staging: unisys: refactor bus_create() First, fix all CamelCase names: busNo => bus_no pBusInfo => bus_info Away => cleanup Fix the kzalloc() call so it uses the variable name rather than the type, and update all of the references to the renamed variables and labels. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 51 +++++++++++----------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index c1bcc4af7a7f..e8795acd46c4 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1028,50 +1028,49 @@ static void bus_create(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - ulong busNo = cmd->create_bus.bus_no; + ulong bus_no = cmd->create_bus.bus_no; int rc = CONTROLVM_RESP_SUCCESS; - struct visorchipset_bus_info *pBusInfo = NULL; - + struct visorchipset_bus_info *bus_info = NULL; - pBusInfo = findbus(&bus_info_list, busNo); - if (pBusInfo && (pBusInfo->state.created == 1)) { - POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, + bus_info = findbus(&bus_info_list, bus_no); + if (bus_info && (bus_info->state.created == 1)) { + POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; - goto Away; + goto cleanup; } - pBusInfo = kzalloc(sizeof(struct visorchipset_bus_info), GFP_KERNEL); - if (!pBusInfo) { - POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, + bus_info = kzalloc(sizeof(*bus_info), GFP_KERNEL); + if (!bus_info) { + POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; - goto Away; + goto cleanup; } - INIT_LIST_HEAD(&pBusInfo->entry); - pBusInfo->bus_no = busNo; - pBusInfo->dev_no = cmd->create_bus.dev_count; + INIT_LIST_HEAD(&bus_info->entry); + bus_info->bus_no = bus_no; + bus_info->dev_no = cmd->create_bus.dev_count; - POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO); + POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO); if (inmsg->hdr.flags.test_message == 1) - pBusInfo->chan_info.addr_type = ADDRTYPE_LOCALTEST; + bus_info->chan_info.addr_type = ADDRTYPE_LOCALTEST; else - pBusInfo->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL; + bus_info->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL; - pBusInfo->flags.server = inmsg->hdr.flags.server; - pBusInfo->chan_info.channel_addr = cmd->create_bus.channel_addr; - pBusInfo->chan_info.n_channel_bytes = cmd->create_bus.channel_bytes; - pBusInfo->chan_info.channel_type_uuid = + bus_info->flags.server = inmsg->hdr.flags.server; + bus_info->chan_info.channel_addr = cmd->create_bus.channel_addr; + bus_info->chan_info.n_channel_bytes = cmd->create_bus.channel_bytes; + bus_info->chan_info.channel_type_uuid = cmd->create_bus.bus_data_type_uuid; - pBusInfo->chan_info.channel_inst_uuid = cmd->create_bus.bus_inst_uuid; + bus_info->chan_info.channel_inst_uuid = cmd->create_bus.bus_inst_uuid; - list_add(&pBusInfo->entry, &bus_info_list); + list_add(&bus_info->entry, &bus_info_list); - POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO); + POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO); -Away: - bus_epilog(busNo, CONTROLVM_BUS_CREATE, &inmsg->hdr, +cleanup: + bus_epilog(bus_no, CONTROLVM_BUS_CREATE, &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1); } -- cgit v1.2.3 From dff54cd605670171f2f01d5bd5be61079c0119fb Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:21 -0400 Subject: staging: unisys: refactor bus_destroy() Fix CamelCase names: busNo => bus_no pBusInfo => bus_info Update all references to use the corrected names, and remove the goto statements and labels entirely. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index e8795acd46c4..ac0a381a850d 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1078,22 +1078,17 @@ static void bus_destroy(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - ulong busNo = cmd->destroy_bus.bus_no; - struct visorchipset_bus_info *pBusInfo; + ulong bus_no = cmd->destroy_bus.bus_no; + struct visorchipset_bus_info *bus_info; int rc = CONTROLVM_RESP_SUCCESS; - pBusInfo = findbus(&bus_info_list, busNo); - if (!pBusInfo) { + bus_info = findbus(&bus_info_list, bus_no); + if (!bus_info) rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; - goto Away; - } - if (pBusInfo->state.created == 0) { + else if (bus_info->state.created == 0) rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; - goto Away; - } -Away: - bus_epilog(busNo, CONTROLVM_BUS_DESTROY, &inmsg->hdr, + bus_epilog(bus_no, CONTROLVM_BUS_DESTROY, &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1); } -- cgit v1.2.3 From 654bada025db1a292a38d33e09404b15df94991b Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:22 -0400 Subject: staging: unisys: refactor bus_configure() First, fix the CamelCase names: busNo => bus_no pBusInfo => bus_info Update all references to use the corrected names, and remove the messy goto and label. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 49 ++++++++++------------ 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index ac0a381a850d..b6a28103f6fd 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1097,44 +1097,39 @@ bus_configure(struct controlvm_message *inmsg, struct parser_context *parser_ctx) { struct controlvm_message_packet *cmd = &inmsg->cmd; - ulong busNo = cmd->configure_bus.bus_no; - struct visorchipset_bus_info *pBusInfo = NULL; + ulong bus_no = cmd->configure_bus.bus_no; + struct visorchipset_bus_info *bus_info = NULL; int rc = CONTROLVM_RESP_SUCCESS; char s[99]; - busNo = cmd->configure_bus.bus_no; - POSTCODE_LINUX_3(BUS_CONFIGURE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO); + bus_no = cmd->configure_bus.bus_no; + POSTCODE_LINUX_3(BUS_CONFIGURE_ENTRY_PC, bus_no, + POSTCODE_SEVERITY_INFO); - pBusInfo = findbus(&bus_info_list, busNo); - if (!pBusInfo) { - POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, + bus_info = findbus(&bus_info_list, bus_no); + if (!bus_info) { + POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; - goto Away; - } - if (pBusInfo->state.created == 0) { - POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, + } else if (bus_info->state.created == 0) { + POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; - goto Away; - } - /* TBD - add this check to other commands also... */ - if (pBusInfo->pending_msg_hdr.id != CONTROLVM_INVALID) { - POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, + } else if (bus_info->pending_msg_hdr.id != CONTROLVM_INVALID) { + POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT; - goto Away; - } - - pBusInfo->partition_handle = cmd->configure_bus.guest_handle; - pBusInfo->partition_uuid = parser_id_get(parser_ctx); - parser_param_start(parser_ctx, PARSERSTRING_NAME); - pBusInfo->name = parser_string_get(parser_ctx); + } else { + bus_info->partition_handle = cmd->configure_bus.guest_handle; + bus_info->partition_uuid = parser_id_get(parser_ctx); + parser_param_start(parser_ctx, PARSERSTRING_NAME); + bus_info->name = parser_string_get(parser_ctx); - visorchannel_uuid_id(&pBusInfo->partition_uuid, s); - POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO); -Away: - bus_epilog(busNo, CONTROLVM_BUS_CONFIGURE, &inmsg->hdr, + visorchannel_uuid_id(&bus_info->partition_uuid, s); + POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, bus_no, + POSTCODE_SEVERITY_INFO); + } + bus_epilog(bus_no, CONTROLVM_BUS_CONFIGURE, &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1); } -- cgit v1.2.3 From c60c8e26983fd44ffea4d1aedf9f889dcbfa80b8 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:23 -0400 Subject: staging: unisys: refactor my_device_create() Fix local CamelCase variable names: busNo => bus_no devNo => dev_no pDevinfo => dev_info pBusInfo => bus_info Away => cleanup Update references to use the corrected names, and change the kzalloc() to use the variable itself rather than the type. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 78 +++++++++++----------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index b6a28103f6fd..603afed55087 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1137,70 +1137,70 @@ static void my_device_create(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - ulong busNo = cmd->create_device.bus_no; - ulong devNo = cmd->create_device.dev_no; - struct visorchipset_device_info *pDevInfo = NULL; - struct visorchipset_bus_info *pBusInfo = NULL; + ulong bus_no = cmd->create_device.bus_no; + ulong dev_no = cmd->create_device.dev_no; + struct visorchipset_device_info *dev_info = NULL; + struct visorchipset_bus_info *bus_info = NULL; int rc = CONTROLVM_RESP_SUCCESS; - pDevInfo = finddevice(&dev_info_list, busNo, devNo); - if (pDevInfo && (pDevInfo->state.created == 1)) { - POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, + dev_info = finddevice(&dev_info_list, bus_no, dev_no); + if (dev_info && (dev_info->state.created == 1)) { + POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; - goto Away; + goto cleanup; } - pBusInfo = findbus(&bus_info_list, busNo); - if (!pBusInfo) { - POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, + bus_info = findbus(&bus_info_list, bus_no); + if (!bus_info) { + POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; - goto Away; + goto cleanup; } - if (pBusInfo->state.created == 0) { - POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, + if (bus_info->state.created == 0) { + POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; - goto Away; + goto cleanup; } - pDevInfo = kzalloc(sizeof(struct visorchipset_device_info), GFP_KERNEL); - if (!pDevInfo) { - POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, + dev_info = kzalloc(sizeof(*dev_info), GFP_KERNEL); + if (!dev_info) { + POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; - goto Away; + goto cleanup; } - INIT_LIST_HEAD(&pDevInfo->entry); - pDevInfo->bus_no = busNo; - pDevInfo->dev_no = devNo; - pDevInfo->dev_inst_uuid = cmd->create_device.dev_inst_uuid; - POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo, + INIT_LIST_HEAD(&dev_info->entry); + dev_info->bus_no = bus_no; + dev_info->dev_no = dev_no; + dev_info->dev_inst_uuid = cmd->create_device.dev_inst_uuid; + POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no, POSTCODE_SEVERITY_INFO); if (inmsg->hdr.flags.test_message == 1) - pDevInfo->chan_info.addr_type = ADDRTYPE_LOCALTEST; + dev_info->chan_info.addr_type = ADDRTYPE_LOCALTEST; else - pDevInfo->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL; - pDevInfo->chan_info.channel_addr = cmd->create_device.channel_addr; - pDevInfo->chan_info.n_channel_bytes = cmd->create_device.channel_bytes; - pDevInfo->chan_info.channel_type_uuid = + dev_info->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL; + dev_info->chan_info.channel_addr = cmd->create_device.channel_addr; + dev_info->chan_info.n_channel_bytes = cmd->create_device.channel_bytes; + dev_info->chan_info.channel_type_uuid = cmd->create_device.data_type_uuid; - pDevInfo->chan_info.intr = cmd->create_device.intr; - list_add(&pDevInfo->entry, &dev_info_list); - POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, devNo, busNo, + dev_info->chan_info.intr = cmd->create_device.intr; + list_add(&dev_info->entry, &dev_info_list); + POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, dev_no, bus_no, POSTCODE_SEVERITY_INFO); -Away: +cleanup: /* get the bus and devNo for DiagPool channel */ - if (pDevInfo && - is_diagpool_channel(pDevInfo->chan_info.channel_type_uuid)) { - g_diagpool_bus_no = busNo; - g_diagpool_dev_no = devNo; + if (dev_info && + is_diagpool_channel(dev_info->chan_info.channel_type_uuid)) { + g_diagpool_bus_no = bus_no; + g_diagpool_dev_no = dev_no; } - device_epilog(busNo, devNo, segment_state_running, + device_epilog(bus_no, dev_no, segment_state_running, CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1, - FOR_VISORBUS(pDevInfo->chan_info.channel_type_uuid)); + FOR_VISORBUS(dev_info->chan_info.channel_type_uuid)); } static void -- cgit v1.2.3 From 0278a9055ac94ff368e8cdf3de3de25967c7f66b Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:24 -0400 Subject: staging: unisys: refactor my_device_changestate() Fix the CamelCase names: busNo => bus_no devNo => dev_no pDevInfo => dev_info Update all references to use the new names, and remove the goto and label entirely. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 27 ++++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 603afed55087..9327837ee449 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1207,31 +1207,28 @@ static void my_device_changestate(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - ulong busNo = cmd->device_change_state.bus_no; - ulong devNo = cmd->device_change_state.dev_no; + ulong bus_no = cmd->device_change_state.bus_no; + ulong dev_no = cmd->device_change_state.dev_no; struct spar_segment_state state = cmd->device_change_state.state; - struct visorchipset_device_info *pDevInfo = NULL; + struct visorchipset_device_info *dev_info = NULL; int rc = CONTROLVM_RESP_SUCCESS; - pDevInfo = finddevice(&dev_info_list, busNo, devNo); - if (!pDevInfo) { - POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo, + dev_info = finddevice(&dev_info_list, bus_no, dev_no); + if (!dev_info) { + POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; - goto Away; - } - if (pDevInfo->state.created == 0) { - POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo, + } else if (dev_info->state.created == 0) { + POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; } -Away: - if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo) - device_epilog(busNo, devNo, state, CONTROLVM_DEVICE_CHANGESTATE, - &inmsg->hdr, rc, + if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info) + device_epilog(bus_no, dev_no, state, + CONTROLVM_DEVICE_CHANGESTATE, &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1, FOR_VISORBUS( - pDevInfo->chan_info.channel_type_uuid)); + dev_info->chan_info.channel_type_uuid)); } static void -- cgit v1.2.3 From 61715c8b9c532e41547d47f649649c2250e98e27 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:25 -0400 Subject: staging: unisys: refactor my_device_destroy() Fix the CamelCase variable names: busNo => bus_no devNo => dev_no pDevInfo => dev_info Update all the references to the updated names, then remove the goto and its label. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorchipset/visorchipset_main.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 9327837ee449..4fe1ad1d0d3a 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1235,26 +1235,23 @@ static void my_device_destroy(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - ulong busNo = cmd->destroy_device.bus_no; - ulong devNo = cmd->destroy_device.dev_no; - struct visorchipset_device_info *pDevInfo = NULL; + ulong bus_no = cmd->destroy_device.bus_no; + ulong dev_no = cmd->destroy_device.dev_no; + struct visorchipset_device_info *dev_info = NULL; int rc = CONTROLVM_RESP_SUCCESS; - pDevInfo = finddevice(&dev_info_list, busNo, devNo); - if (!pDevInfo) { + dev_info = finddevice(&dev_info_list, bus_no, dev_no); + if (!dev_info) rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; - goto Away; - } - if (pDevInfo->state.created == 0) + else if (dev_info->state.created == 0) rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; -Away: - if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo) - device_epilog(busNo, devNo, segment_state_running, + if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info) + device_epilog(bus_no, dev_no, segment_state_running, CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1, FOR_VISORBUS( - pDevInfo->chan_info.channel_type_uuid)); + dev_info->chan_info.channel_type_uuid)); } /* When provided with the physical address of the controlvm channel -- cgit v1.2.3 From f118a39bfec6eff3ab1c1720fd734df62e012150 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:26 -0400 Subject: staging: unisys: refactor initialize_controlvm_payload_info() Fix the CamelCased goto label: Away => cleanup and get rid of the NULL comparison. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 4fe1ad1d0d3a..7956ae71e823 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1269,26 +1269,26 @@ initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes, if (!info) { rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID; - goto Away; + goto cleanup; } memset(info, 0, sizeof(struct controlvm_payload_info)); if ((offset == 0) || (bytes == 0)) { rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID; - goto Away; + goto cleanup; } payload = ioremap_cache(phys_addr + offset, bytes); if (!payload) { rc = -CONTROLVM_RESP_ERROR_IOREMAP_FAILED; - goto Away; + goto cleanup; } info->offset = offset; info->bytes = bytes; info->ptr = payload; -Away: +cleanup: if (rc < 0) { - if (payload != NULL) { + if (payload) { iounmap(payload); payload = NULL; } -- cgit v1.2.3 From 597c338f0a6012e1360b7c71797b03438ff48fab Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:27 -0400 Subject: staging: unisys: fix NULL comparison in destroy_controlvm_payload_info() Just remove the NULL from the check and test the pointer directly. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 7956ae71e823..0f791fb0728f 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1299,7 +1299,7 @@ cleanup: static void destroy_controlvm_payload_info(struct controlvm_payload_info *info) { - if (info->ptr != NULL) { + if (info->ptr) { iounmap(info->ptr); info->ptr = NULL; } -- cgit v1.2.3 From cafefc0ca1a36fa917a9cf1bea6ea4e9e05db8f1 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:28 -0400 Subject: staging: unisys: fix Camelcase in initialize_controlvm_payload() Fix the CamelCase local variables: payloadOffset => payload_offset payloadBytes => payload_bytes Update all references to use the new names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 0f791fb0728f..a32d092b38d2 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1310,13 +1310,13 @@ static void initialize_controlvm_payload(void) { HOSTADDRESS phys_addr = visorchannel_get_physaddr(controlvm_channel); - u64 payloadOffset = 0; - u32 payloadBytes = 0; + u64 payload_offset = 0; + u32 payload_bytes = 0; if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, request_payload_offset), - &payloadOffset, sizeof(payloadOffset)) < 0) { + &payload_offset, sizeof(payload_offset)) < 0) { POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -1324,13 +1324,13 @@ initialize_controlvm_payload(void) if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, request_payload_bytes), - &payloadBytes, sizeof(payloadBytes)) < 0) { + &payload_bytes, sizeof(payload_bytes)) < 0) { POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; } initialize_controlvm_payload_info(phys_addr, - payloadOffset, payloadBytes, + payload_offset, payload_bytes, &controlvm_payload_info); } -- cgit v1.2.3 From 55b33413b882570b4790e1fada44060d6f7e5cfa Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:29 -0400 Subject: staging: unisys: refactor parahotplug_process_list() Simplify the code a little and shorten the indentation levels by reversing the check for time_after_eq(). Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index a32d092b38d2..e25bf80fe653 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1535,15 +1535,17 @@ parahotplug_process_list(void) list_for_each_safe(pos, tmp, &Parahotplug_request_list) { struct parahotplug_request *req = list_entry(pos, struct parahotplug_request, list); - if (time_after_eq(jiffies, req->expiration)) { - list_del(pos); - if (req->msg.hdr.flags.response_expected) - controlvm_respond_physdev_changestate( - &req->msg.hdr, - CONTROLVM_RESP_ERROR_DEVICE_UDEV_TIMEOUT, - req->msg.cmd.device_change_state.state); - parahotplug_request_destroy(req); - } + + if (!time_after_eq(jiffies, req->expiration)) + continue; + + list_del(pos); + if (req->msg.hdr.flags.response_expected) + controlvm_respond_physdev_changestate( + &req->msg.hdr, + CONTROLVM_RESP_ERROR_DEVICE_UDEV_TIMEOUT, + req->msg.cmd.device_change_state.state); + parahotplug_request_destroy(req); } spin_unlock(&Parahotplug_request_list_lock); @@ -1621,7 +1623,7 @@ parahotplug_process_message(struct controlvm_message *inmsg) * indicated it's done. */ spin_lock(&Parahotplug_request_list_lock); - list_add_tail(&(req->list), &Parahotplug_request_list); + list_add_tail(&req->list, &Parahotplug_request_list); spin_unlock(&Parahotplug_request_list_lock); parahotplug_request_kickoff(req); -- cgit v1.2.3 From 6a55e3c33762d1623ed9fb6d0caa52076fbac762 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:30 -0400 Subject: staging: unisys: fix spacing in parahotplug_request_create Just fix the spacing around the logical or operator in this function. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index e25bf80fe653..105683198af6 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1470,7 +1470,7 @@ parahotplug_request_create(struct controlvm_message *msg) { struct parahotplug_request *req; - req = kmalloc(sizeof(*req), GFP_KERNEL|__GFP_NORETRY); + req = kmalloc(sizeof(*req), GFP_KERNEL | __GFP_NORETRY); if (!req) return NULL; -- cgit v1.2.3 From 818352a8521d2b2458d7147662736f1406061d18 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:31 -0400 Subject: staging: unisys: refactor handle_command() First, fix the CamelCase local variable names: parametersAddr => parm_addr parametersBytes => parm_bytes isLocalAddr => local_addr Change the type of local_addr to bool instead of using the #defined type. Update all references to use the fixed names. Fix the indentation of that line that's over the 80 column limit. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 105683198af6..7f1dec7bea50 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1645,34 +1645,34 @@ static BOOL handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) { struct controlvm_message_packet *cmd = &inmsg.cmd; - u64 parametersAddr = 0; - u32 parametersBytes = 0; + u64 parm_addr = 0; + u32 parm_bytes = 0; struct parser_context *parser_ctx = NULL; - BOOL isLocalAddr = FALSE; + bool local_addr = false; struct controlvm_message ackmsg; /* create parsing context if necessary */ - isLocalAddr = (inmsg.hdr.flags.test_message == 1); + local_addr = (inmsg.hdr.flags.test_message == 1); if (channel_addr == 0) return TRUE; - parametersAddr = channel_addr + inmsg.hdr.payload_vm_offset; - parametersBytes = inmsg.hdr.payload_bytes; + parm_addr = channel_addr + inmsg.hdr.payload_vm_offset; + parm_bytes = inmsg.hdr.payload_bytes; /* Parameter and channel addresses within test messages actually lie * within our OS-controlled memory. We need to know that, because it * makes a difference in how we compute the virtual address. */ - if (parametersAddr != 0 && parametersBytes != 0) { + if (parm_addr != 0 && parm_bytes != 0) { BOOL retry = FALSE; parser_ctx = - parser_init_byte_stream(parametersAddr, parametersBytes, - isLocalAddr, &retry); + parser_init_byte_stream(parm_addr, parm_bytes, + local_addr, &retry); if (!parser_ctx && retry) return FALSE; } - if (!isLocalAddr) { + if (!local_addr) { controlvm_init_response(&ackmsg, &inmsg.hdr, CONTROLVM_RESP_SUCCESS); if (controlvm_channel) @@ -1728,7 +1728,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) default: if (inmsg.hdr.flags.response_expected) controlvm_respond(&inmsg.hdr, - -CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN); + -CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN); break; } -- cgit v1.2.3 From 1c1ed292b406ac318cabd4c88e7001fc9266f884 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:32 -0400 Subject: staging: unisys: refactor controlvm_periodic_work() Fix the CamelCase variable names: gotACommand => got_command Poll_Count => poll_count Away => cleanup Fix all references to use the new names. Remove the empty braces in the while() and put in a trailing semicolon, for clarity. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 7f1dec7bea50..4a256302ab2e 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1754,24 +1754,24 @@ static void controlvm_periodic_work(struct work_struct *work) { struct controlvm_message inmsg; - BOOL gotACommand = FALSE; + BOOL got_command = FALSE; BOOL handle_command_failed = FALSE; - static u64 Poll_Count; + static u64 poll_count; /* make sure visorbus server is registered for controlvm callbacks */ if (visorchipset_serverregwait && !serverregistered) - goto Away; + goto cleanup; /* make sure visorclientbus server is regsitered for controlvm * callbacks */ if (visorchipset_clientregwait && !clientregistered) - goto Away; + goto cleanup; - Poll_Count++; - if (Poll_Count >= 250) + poll_count++; + if (poll_count >= 250) ; /* keep going */ else - goto Away; + goto cleanup; /* Check events to determine if response to CHIPSET_READY * should be sent @@ -1790,7 +1790,7 @@ controlvm_periodic_work(struct work_struct *work) CONTROLVM_QUEUE_RESPONSE, &inmsg)) ; - if (!gotACommand) { + if (!got_command) { if (ControlVm_Pending_Msg_Valid) { /* we throttled processing of a prior * msg, so try to process it again @@ -1798,19 +1798,19 @@ controlvm_periodic_work(struct work_struct *work) */ inmsg = ControlVm_Pending_Msg; ControlVm_Pending_Msg_Valid = FALSE; - gotACommand = TRUE; + got_command = true; } else { - gotACommand = read_controlvm_event(&inmsg); + got_command = read_controlvm_event(&inmsg); } } handle_command_failed = FALSE; - while (gotACommand && (!handle_command_failed)) { + while (got_command && (!handle_command_failed)) { most_recent_message_jiffies = jiffies; if (handle_command(inmsg, visorchannel_get_physaddr (controlvm_channel))) - gotACommand = read_controlvm_event(&inmsg); + got_command = read_controlvm_event(&inmsg); else { /* this is a scenario where throttling * is required, but probably NOT an @@ -1827,7 +1827,7 @@ controlvm_periodic_work(struct work_struct *work) /* parahotplug_worker */ parahotplug_process_list(); -Away: +cleanup: if (time_after(jiffies, most_recent_message_jiffies + (HZ * MIN_IDLE_SECONDS))) { -- cgit v1.2.3 From e6bdb904c1d819b4f90453d21d46e0aab22b931b Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:33 -0400 Subject: staging: unisys: fix CamelCase in setup_crash_devices_work_queue() Fix CamelCase names: localCrashCreateBusMsg => local_crash_bus_msg localCrashCreateDevMsg => local_crash_dev_msg localSavedCrashMsgOffset => local_crash_msg_offset localSavedCrashMsgCount => local_crash_msg_count Away => cleanup Update all references to use the fixed names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 4a256302ab2e..275a0a365412 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1849,21 +1849,21 @@ cleanup: static void setup_crash_devices_work_queue(struct work_struct *work) { - struct controlvm_message localCrashCreateBusMsg; - struct controlvm_message localCrashCreateDevMsg; + struct controlvm_message local_crash_bus_msg; + struct controlvm_message local_crash_dev_msg; struct controlvm_message msg; - u32 localSavedCrashMsgOffset; - u16 localSavedCrashMsgCount; + u32 local_crash_msg_offset; + u16 local_crash_msg_count; /* make sure visorbus server is registered for controlvm callbacks */ if (visorchipset_serverregwait && !serverregistered) - goto Away; + goto cleanup; /* make sure visorclientbus server is regsitered for controlvm * callbacks */ if (visorchipset_clientregwait && !clientregistered) - goto Away; + goto cleanup; POSTCODE_LINUX_2(CRASH_DEV_ENTRY_PC, POSTCODE_SEVERITY_INFO); @@ -1878,15 +1878,15 @@ setup_crash_devices_work_queue(struct work_struct *work) if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_count), - &localSavedCrashMsgCount, sizeof(u16)) < 0) { + &local_crash_msg_count, sizeof(u16)) < 0) { POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; } - if (localSavedCrashMsgCount != CONTROLVM_CRASHMSG_MAX) { + if (local_crash_msg_count != CONTROLVM_CRASHMSG_MAX) { POSTCODE_LINUX_3(CRASH_DEV_COUNT_FAILURE_PC, - localSavedCrashMsgCount, + local_crash_msg_count, POSTCODE_SEVERITY_ERR); return; } @@ -1895,7 +1895,7 @@ setup_crash_devices_work_queue(struct work_struct *work) if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_offset), - &localSavedCrashMsgOffset, sizeof(u32)) < 0) { + &local_crash_msg_offset, sizeof(u32)) < 0) { POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); return; @@ -1903,8 +1903,8 @@ setup_crash_devices_work_queue(struct work_struct *work) /* read create device message for storage bus offset */ if (visorchannel_read(controlvm_channel, - localSavedCrashMsgOffset, - &localCrashCreateBusMsg, + local_crash_msg_offset, + &local_crash_bus_msg, sizeof(struct controlvm_message)) < 0) { POSTCODE_LINUX_2(CRASH_DEV_RD_BUS_FAIULRE_PC, POSTCODE_SEVERITY_ERR); @@ -1913,9 +1913,9 @@ setup_crash_devices_work_queue(struct work_struct *work) /* read create device message for storage device */ if (visorchannel_read(controlvm_channel, - localSavedCrashMsgOffset + + local_crash_msg_offset + sizeof(struct controlvm_message), - &localCrashCreateDevMsg, + &local_crash_dev_msg, sizeof(struct controlvm_message)) < 0) { POSTCODE_LINUX_2(CRASH_DEV_RD_DEV_FAIULRE_PC, POSTCODE_SEVERITY_ERR); @@ -1923,8 +1923,8 @@ setup_crash_devices_work_queue(struct work_struct *work) } /* reuse IOVM create bus message */ - if (localCrashCreateBusMsg.cmd.create_bus.channel_addr != 0) { - bus_create(&localCrashCreateBusMsg); + if (local_crash_bus_msg.cmd.create_bus.channel_addr != 0) { + bus_create(&local_crash_bus_msg); } else { POSTCODE_LINUX_2(CRASH_DEV_BUS_NULL_FAILURE_PC, POSTCODE_SEVERITY_ERR); @@ -1932,8 +1932,8 @@ setup_crash_devices_work_queue(struct work_struct *work) } /* reuse create device message for storage device */ - if (localCrashCreateDevMsg.cmd.create_device.channel_addr != 0) { - my_device_create(&localCrashCreateDevMsg); + if (local_crash_dev_msg.cmd.create_device.channel_addr != 0) { + my_device_create(&local_crash_dev_msg); } else { POSTCODE_LINUX_2(CRASH_DEV_DEV_NULL_FAILURE_PC, POSTCODE_SEVERITY_ERR); @@ -1942,7 +1942,7 @@ setup_crash_devices_work_queue(struct work_struct *work) POSTCODE_LINUX_2(CRASH_DEV_EXIT_PC, POSTCODE_SEVERITY_INFO); return; -Away: +cleanup: poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW; -- cgit v1.2.3 From a6a3989b514a276506d4e8432318e1186636c1f3 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:34 -0400 Subject: staging: unisys: fix CamelCase label in visorchipset_init() Fix the CamelCase label: Away => cleanup Update all references to use the fixed name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 275a0a365412..f4309b385343 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -2150,7 +2150,7 @@ visorchipset_init(void) if (visorchipset_testvnic) { POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, x, DIAG_SEVERITY_ERR); rc = x; - goto Away; + goto cleanup; } addr = controlvm_get_channel_address(); @@ -2176,7 +2176,7 @@ visorchipset_init(void) rc = visorchipset_file_init(MajorDev, &controlvm_channel); if (rc < 0) { POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR); - goto Away; + goto cleanup; } memset(&g_diag_msg_hdr, 0, sizeof(struct controlvm_message_header)); @@ -2192,7 +2192,7 @@ visorchipset_init(void) if (!Putfile_buffer_list_pool) { POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR); rc = -1; - goto Away; + goto cleanup; } if (!visorchipset_disable_controlvm) { /* if booting in a crash kernel */ @@ -2209,7 +2209,7 @@ visorchipset_init(void) POSTCODE_LINUX_2(CREATE_WORKQUEUE_FAILED_PC, DIAG_SEVERITY_ERR); rc = -ENOMEM; - goto Away; + goto cleanup; } most_recent_message_jiffies = jiffies; poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; @@ -2218,7 +2218,7 @@ visorchipset_init(void) if (rc < 0) { POSTCODE_LINUX_2(QUEUE_DELAYED_WORK_PC, DIAG_SEVERITY_ERR); - goto Away; + goto cleanup; } } @@ -2226,11 +2226,11 @@ visorchipset_init(void) if (platform_device_register(&Visorchipset_platform_device) < 0) { POSTCODE_LINUX_2(DEVICE_REGISTER_FAILURE_PC, DIAG_SEVERITY_ERR); rc = -1; - goto Away; + goto cleanup; } POSTCODE_LINUX_2(CHIPSET_INIT_SUCCESS_PC, POSTCODE_SEVERITY_INFO); rc = 0; -Away: +cleanup: if (rc) { POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, rc, POSTCODE_SEVERITY_ERR); -- cgit v1.2.3 From 862cf604071bcd94fc3d8e0a8953d340eab6e3a0 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:35 -0400 Subject: staging: unisys: fix NULL pointer comparisons in uislib.c Change pointer comparisons to NULL to just use the pointer directly. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/uislib/uislib.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index d23e0df16b01..f93d0bb11b12 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -281,7 +281,7 @@ destroy_bus(struct controlvm_message *msg, char *buf) /* verify that this bus has no devices. */ for (i = 0; i < bus->device_count; i++) { - if (bus->device[i] != NULL) { + if (bus->device[i]) { read_unlock(&bus_list_lock); return CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED; } @@ -964,7 +964,7 @@ uislib_cache_alloc(struct kmem_cache *cur_pool, char *fn, int ln) */ void *p = kmem_cache_alloc(cur_pool, GFP_ATOMIC | __GFP_NORETRY); - if (p == NULL) + if (!p) return NULL; return p; } @@ -973,7 +973,7 @@ EXPORT_SYMBOL_GPL(uislib_cache_alloc); void uislib_cache_free(struct kmem_cache *cur_pool, void *p, char *fn, int ln) { - if (p == NULL) + if (!p) return; kmem_cache_free(cur_pool, p); } @@ -1052,10 +1052,10 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, int remaining_bytes = PROC_READ_BUFFER_SIZE; /* *start = buf; */ - if (debug_buf == NULL) { + if (!debug_buf) { debug_buf = vmalloc(PROC_READ_BUFFER_SIZE); - if (debug_buf == NULL) + if (!debug_buf) return -ENOMEM; } @@ -1158,7 +1158,7 @@ static int process_incoming(void *v) * Reschedule work to occur as soon as * possible. */ idle_cycles = 0; - if (new_tail == NULL) { + if (!new_tail) { dev->first_busy_cnt++; if (! (list_is_last @@ -1174,7 +1174,7 @@ static int process_incoming(void *v) if (kthread_should_stop()) break; } - if (new_tail != NULL) { + if (new_tail) { tot_moved_to_tail_cnt++; list_move_tail(new_tail, &poll_dev_chan); } -- cgit v1.2.3 From 3e37a0306c8074263b713b8f187636018cbc583d Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:37 -0400 Subject: staging: unisys: remove last remnants of proc entry code All of the proc code using easyproc and procobjecttree support is gone, so we can remove it from the source entirely. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorutil/Makefile | 3 +- drivers/staging/unisys/visorutil/easyproc.c | 356 ---------------------- drivers/staging/unisys/visorutil/easyproc.h | 92 ------ drivers/staging/unisys/visorutil/procobjecttree.c | 335 -------------------- 4 files changed, 1 insertion(+), 785 deletions(-) delete mode 100644 drivers/staging/unisys/visorutil/easyproc.c delete mode 100644 drivers/staging/unisys/visorutil/easyproc.h delete mode 100644 drivers/staging/unisys/visorutil/procobjecttree.c (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorutil/Makefile b/drivers/staging/unisys/visorutil/Makefile index d871bbb78cef..d9ab5a36e3bf 100644 --- a/drivers/staging/unisys/visorutil/Makefile +++ b/drivers/staging/unisys/visorutil/Makefile @@ -4,7 +4,6 @@ obj-$(CONFIG_UNISYS_VISORUTIL) += visorutil.o -visorutil-y := charqueue.o easyproc.o periodic_work.o procobjecttree.o \ - memregion_direct.o visorkmodutils.o +visorutil-y := charqueue.o periodic_work.o memregion_direct.o visorkmodutils.o ccflags-y += -Idrivers/staging/unisys/include diff --git a/drivers/staging/unisys/visorutil/easyproc.c b/drivers/staging/unisys/visorutil/easyproc.c deleted file mode 100644 index 3cb55d39370b..000000000000 --- a/drivers/staging/unisys/visorutil/easyproc.c +++ /dev/null @@ -1,356 +0,0 @@ -/* Copyright (C) 2010 - 2013 UNISYS CORPORATION - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - */ - -/** @file ********************************************************************* - * - * Handle procfs-specific tasks. - * Note that this file does not know about any module-specific things, nor - * does it know anything about what information to reveal as part of the proc - * entries. The 2 functions that take care of displaying device and - * driver specific information are passed as parameters to - * visor_easyproc_InitDriver(). - * - * void show_device_info(struct seq_file *seq, void *p); - * void show_driver_info(struct seq_file *seq); - * - * The second parameter to show_device_info is actually a pointer to the - * device-specific info to show. It is the context that was originally - * passed to visor_easyproc_InitDevice(). - * - ****************************************************************************** - */ - -#include - -#include "timskmod.h" -#include "easyproc.h" - -#define MYDRVNAME "easyproc" - - - -/* - * /proc/ ProcDir - * /proc//driver ProcDriverDir - * /proc//driver/diag ProcDriverDiagFile - * /proc//device ProcDeviceDir - * /proc//device/0 procDevicexDir - * /proc//device/0/diag procDevicexDiagFile - */ - - -static ssize_t proc_write_device(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos); -static ssize_t proc_write_driver(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos); - -static struct proc_dir_entry * - createProcDir(char *name, struct proc_dir_entry *parent) -{ - struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent); - return p; -} - -static int seq_show_driver(struct seq_file *seq, void *offset); -static int proc_open_driver(struct inode *inode, struct file *file) -{ - return single_open(file, seq_show_driver, PDE_DATA(inode)); -} -static const struct file_operations proc_fops_driver = { - .open = proc_open_driver, - .read = seq_read, - .write = proc_write_driver, - .llseek = seq_lseek, - .release = single_release, -}; - -static int seq_show_device(struct seq_file *seq, void *offset); -static int seq_show_device_property(struct seq_file *seq, void *offset); -static int proc_open_device(struct inode *inode, struct file *file) -{ - return single_open(file, seq_show_device, PDE_DATA(inode)); -} -static const struct file_operations proc_fops_device = { - .open = proc_open_device, - .read = seq_read, - .write = proc_write_device, - .llseek = seq_lseek, - .release = single_release, -}; -static int proc_open_device_property(struct inode *inode, struct file *file) -{ - return single_open(file, seq_show_device_property, PDE_DATA(inode)); -} -static const struct file_operations proc_fops_device_property = { - .open = proc_open_device_property, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - - - -void visor_easyproc_InitDriver(struct easyproc_driver_info *pdriver, - char *procId, - void (*show_driver_info)(struct seq_file *), - void (*show_device_info)(struct seq_file *, - void *)) -{ - memset(pdriver, 0, sizeof(struct easyproc_driver_info)); - pdriver->ProcId = procId; - pdriver->Show_driver_info = show_driver_info; - pdriver->Show_device_info = show_device_info; - if (pdriver->ProcDir == NULL) - pdriver->ProcDir = createProcDir(pdriver->ProcId, NULL); - if ((pdriver->ProcDir != NULL) && (pdriver->ProcDriverDir == NULL)) - pdriver->ProcDriverDir = createProcDir("driver", - pdriver->ProcDir); - if ((pdriver->ProcDir != NULL) && (pdriver->ProcDeviceDir == NULL)) - pdriver->ProcDeviceDir = createProcDir("device", - pdriver->ProcDir); - if ((pdriver->ProcDriverDir != NULL) && - (pdriver->ProcDriverDiagFile == NULL)) { - pdriver->ProcDriverDiagFile = - proc_create_data("diag", 0, - pdriver->ProcDriverDir, - &proc_fops_driver, pdriver); - } -} -EXPORT_SYMBOL_GPL(visor_easyproc_InitDriver); - - - -void visor_easyproc_InitDriverEx(struct easyproc_driver_info *pdriver, - char *procId, - void (*show_driver_info)(struct seq_file *), - void (*show_device_info)(struct seq_file *, - void *), - void (*write_driver_info)(char *buf, - size_t count, - loff_t *ppos), - void (*write_device_info)(char *buf, - size_t count, - loff_t *ppos, - void *p)) -{ - visor_easyproc_InitDriver(pdriver, procId, - show_driver_info, show_device_info); - pdriver->Write_driver_info = write_driver_info; - pdriver->Write_device_info = write_device_info; -} -EXPORT_SYMBOL_GPL(visor_easyproc_InitDriverEx); - - - -void visor_easyproc_DeInitDriver(struct easyproc_driver_info *pdriver) -{ - if (pdriver->ProcDriverDiagFile != NULL) { - remove_proc_entry("diag", pdriver->ProcDriverDir); - pdriver->ProcDriverDiagFile = NULL; - } - if (pdriver->ProcDriverDir != NULL) { - remove_proc_entry("driver", pdriver->ProcDir); - pdriver->ProcDriverDir = NULL; - } - if (pdriver->ProcDeviceDir != NULL) { - remove_proc_entry("device", pdriver->ProcDir); - pdriver->ProcDeviceDir = NULL; - } - if (pdriver->ProcDir != NULL) { - remove_proc_entry(pdriver->ProcId, NULL); - pdriver->ProcDir = NULL; - } - pdriver->ProcId = NULL; - pdriver->Show_driver_info = NULL; - pdriver->Show_device_info = NULL; - pdriver->Write_driver_info = NULL; - pdriver->Write_device_info = NULL; -} -EXPORT_SYMBOL_GPL(visor_easyproc_DeInitDriver); - - - -void visor_easyproc_InitDevice(struct easyproc_driver_info *pdriver, - struct easyproc_device_info *p, int devno, - void *devdata) -{ - if ((pdriver->ProcDeviceDir != NULL) && (p->procDevicexDir == NULL)) { - char s[29]; - - sprintf(s, "%d", devno); - p->procDevicexDir = createProcDir(s, pdriver->ProcDeviceDir); - p->devno = devno; - } - p->devdata = devdata; - p->pdriver = pdriver; - p->devno = devno; - if ((p->procDevicexDir != NULL) && (p->procDevicexDiagFile == NULL)) { - p->procDevicexDiagFile = - proc_create_data("diag", 0, p->procDevicexDir, - &proc_fops_device, p); - } - memset(&(p->device_property_info[0]), 0, - sizeof(p->device_property_info)); -} -EXPORT_SYMBOL_GPL(visor_easyproc_InitDevice); - - - -void visor_easyproc_CreateDeviceProperty(struct easyproc_device_info *p, - void (*show_property_info) - (struct seq_file *, void *), - char *property_name) -{ - size_t i; - struct easyproc_device_property_info *px = NULL; - - if (p->procDevicexDir == NULL) - return; - for (i = 0; i < ARRAY_SIZE(p->device_property_info); i++) { - if (p->device_property_info[i].procEntry == NULL) { - px = &(p->device_property_info[i]); - break; - } - } - if (!px) - return; - - px->devdata = p->devdata; - px->pdriver = p->pdriver; - px->procEntry = proc_create_data(property_name, 0, p->procDevicexDir, - &proc_fops_device_property, px); - if (strlen(property_name)+1 > sizeof(px->property_name)) { - return; - } - strcpy(px->property_name, property_name); - if (px->procEntry == NULL) { - return; - } - px->show_device_property_info = show_property_info; -} -EXPORT_SYMBOL_GPL(visor_easyproc_CreateDeviceProperty); - - - -void visor_easyproc_DeInitDevice(struct easyproc_driver_info *pdriver, - struct easyproc_device_info *p, int devno) -{ - size_t i; - - for (i = 0; i < ARRAY_SIZE(p->device_property_info); i++) { - if (p->device_property_info[i].procEntry != NULL) { - struct easyproc_device_property_info *px = - &(p->device_property_info[i]); - remove_proc_entry(px->property_name, p->procDevicexDir); - px->procEntry = NULL; - } - } - if (p->procDevicexDiagFile != NULL) { - remove_proc_entry("diag", p->procDevicexDir); - p->procDevicexDiagFile = NULL; - } - if (p->procDevicexDir != NULL) { - char s[29]; - - sprintf(s, "%d", devno); - remove_proc_entry(s, pdriver->ProcDeviceDir); - p->procDevicexDir = NULL; - } - p->devdata = NULL; - p->pdriver = NULL; -} -EXPORT_SYMBOL_GPL(visor_easyproc_DeInitDevice); - - - -static int seq_show_driver(struct seq_file *seq, void *offset) -{ - struct easyproc_driver_info *p = - (struct easyproc_driver_info *)(seq->private); - if (!p) - return 0; - (*(p->Show_driver_info))(seq); - return 0; -} - - - -static int seq_show_device(struct seq_file *seq, void *offset) -{ - struct easyproc_device_info *p = - (struct easyproc_device_info *)(seq->private); - if ((!p) || (!(p->pdriver))) - return 0; - (*(p->pdriver->Show_device_info))(seq, p->devdata); - return 0; -} - - - -static int seq_show_device_property(struct seq_file *seq, void *offset) -{ - struct easyproc_device_property_info *p = - (struct easyproc_device_property_info *)(seq->private); - if ((!p) || (!(p->show_device_property_info))) - return 0; - (*(p->show_device_property_info))(seq, p->devdata); - return 0; -} - - - -static ssize_t proc_write_driver(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos) -{ - struct seq_file *seq = (struct seq_file *)file->private_data; - struct easyproc_driver_info *p = NULL; - char local_buf[256]; - - if (seq == NULL) - return 0; - p = (struct easyproc_driver_info *)(seq->private); - if ((!p) || (!(p->Write_driver_info))) - return 0; - if (count >= sizeof(local_buf)) - return -ENOMEM; - if (copy_from_user(local_buf, buffer, count)) - return -EFAULT; - local_buf[count] = '\0'; /* be friendly */ - (*(p->Write_driver_info))(local_buf, count, ppos); - return count; -} - - - -static ssize_t proc_write_device(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos) -{ - struct seq_file *seq = (struct seq_file *)file->private_data; - struct easyproc_device_info *p = NULL; - char local_buf[256]; - - if (seq == NULL) - return 0; - p = (struct easyproc_device_info *)(seq->private); - if ((!p) || (!(p->pdriver)) || (!(p->pdriver->Write_device_info))) - return 0; - if (count >= sizeof(local_buf)) - return -ENOMEM; - if (copy_from_user(local_buf, buffer, count)) - return -EFAULT; - local_buf[count] = '\0'; /* be friendly */ - (*(p->pdriver->Write_device_info))(local_buf, count, ppos, p->devdata); - return count; -} diff --git a/drivers/staging/unisys/visorutil/easyproc.h b/drivers/staging/unisys/visorutil/easyproc.h deleted file mode 100644 index 6ce7d5eb6ad1..000000000000 --- a/drivers/staging/unisys/visorutil/easyproc.h +++ /dev/null @@ -1,92 +0,0 @@ -/* easyproc.h - * - * Copyright (C) 2010 - 2013 UNISYS CORPORATION - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - */ - -/** @file ********************************************************************* - * - * This describes the interfaces necessary for a simple /proc file - * implementation for a driver. - * - ****************************************************************************** - */ - -#ifndef __EASYPROC_H__ -#define __EASYPROC_H__ - -#include "timskmod.h" - - -struct easyproc_driver_info { - struct proc_dir_entry *ProcDir; - struct proc_dir_entry *ProcDriverDir; - struct proc_dir_entry *ProcDriverDiagFile; - struct proc_dir_entry *ProcDeviceDir; - char *ProcId; - void (*Show_device_info)(struct seq_file *seq, void *p); - void (*Show_driver_info)(struct seq_file *seq); - void (*Write_device_info)(char *buf, size_t count, - loff_t *ppos, void *p); - void (*Write_driver_info)(char *buf, size_t count, loff_t *ppos); -}; - -/* property is a file under /proc//device// */ -struct easyproc_device_property_info { - char property_name[25]; - struct proc_dir_entry *procEntry; - struct easyproc_driver_info *pdriver; - void *devdata; - void (*show_device_property_info)(struct seq_file *seq, void *p); -}; - -struct easyproc_device_info { - struct proc_dir_entry *procDevicexDir; - struct proc_dir_entry *procDevicexDiagFile; - struct easyproc_driver_info *pdriver; - void *devdata; - int devno; - /* allow for a number of custom properties for each device: */ - struct easyproc_device_property_info device_property_info[10]; -}; - -void visor_easyproc_InitDevice(struct easyproc_driver_info *pdriver, - struct easyproc_device_info *p, int devno, - void *devdata); -void visor_easyproc_DeInitDevice(struct easyproc_driver_info *pdriver, - struct easyproc_device_info *p, int devno); -void visor_easyproc_InitDriver(struct easyproc_driver_info *pdriver, - char *procId, - void (*show_driver_info)(struct seq_file *), - void (*show_device_info)(struct seq_file *, - void *)); -void visor_easyproc_InitDriverEx(struct easyproc_driver_info *pdriver, - char *procId, - void (*show_driver_info)(struct seq_file *), - void (*show_device_info)(struct seq_file *, - void *), - void (*Write_driver_info)(char *buf, - size_t count, - loff_t *ppos), - void (*Write_device_info)(char *buf, - size_t count, - loff_t *ppos, - void *p)); -void visor_easyproc_DeInitDriver(struct easyproc_driver_info *pdriver); -void visor_easyproc_CreateDeviceProperty(struct easyproc_device_info *p, - void (*show_property_info) - (struct seq_file *, void *), - char *property_name); - -#endif diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c deleted file mode 100644 index e4e954ed57ef..000000000000 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ /dev/null @@ -1,335 +0,0 @@ -/* procobjecttree.c - * - * Copyright (C) 2010 - 2013 UNISYS CORPORATION - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - */ - -#include "procobjecttree.h" - -#define MYDRVNAME "procobjecttree" - - - -/** This is context info that we stash in each /proc file entry, which we - * need in order to call the callback function that supplies the /proc read - * info for that file. - */ -struct proc_dir_entry_context { - void (*show_property)(struct seq_file *, void *, int); - MYPROCOBJECT *procObject; - int propertyIndex; - -}; - -/** This describes the attributes of a tree rooted at - * ///... - * Properties for each object of this type will be located under - * ///...//. - */ -struct MYPROCTYPE_Tag { - const char **name; /**< node names for this type, ending with NULL */ - int nNames; /**< num of node names in */ - - /** root dir for this type tree in /proc */ - struct proc_dir_entry *procDirRoot; - - struct proc_dir_entry **procDirs; /**< for each node in */ - - /** bottom dir where objects will be rooted; i.e., this is - * ///.../, which is the same as the - * last entry in the array. */ - struct proc_dir_entry *procDir; - - /** name for each property that objects of this type can have */ - const char **propertyNames; - - int nProperties; /**< num of names in */ - - /** Call this, passing MYPROCOBJECT.context and the property index - * whenever someone reads the proc entry */ - void (*show_property)(struct seq_file *, void *, int); -}; - - - -struct MYPROCOBJECT_Tag { - MYPROCTYPE *type; - - /** This is the name of the dir node in /proc under which the - * properties of this object will appear as files. */ - char *name; - - int namesize; /**< number of bytes allocated for name */ - void *context; /**< passed to MYPROCTYPE.show_property */ - - /** ///.../ */ - struct proc_dir_entry *procDir; - - /** a proc dir entry for each of the properties of the object; - * properties are identified in MYPROCTYPE.propertyNames, so each of - * the describes a single file like - * ///... - * // - */ - struct proc_dir_entry **procDirProperties; - - /** this is a holding area for the context information that is needed - * to run the /proc callback function */ - struct proc_dir_entry_context *procDirPropertyContexts; -}; - - - -static struct proc_dir_entry * -createProcDir(const char *name, struct proc_dir_entry *parent) -{ - struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent); - - return p; -} - -static struct proc_dir_entry * -createProcFile(const char *name, struct proc_dir_entry *parent, - const struct file_operations *fops, void *data) -{ - struct proc_dir_entry *p = proc_create_data(name, 0, parent, - fops, data); - return p; -} - -static int seq_show(struct seq_file *seq, void *offset); -static int proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, seq_show, PDE_DATA(inode)); -} - -static const struct file_operations proc_fops = { - .open = proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - - - -MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot, - const char **name, - const char **propertyNames, - void (*show_property)(struct seq_file *, - void *, int)) -{ - int i = 0; - MYPROCTYPE *rc = NULL, *type = NULL; - struct proc_dir_entry *parent = NULL; - - if (procDirRoot == NULL) - goto Away; - - if (name == NULL || name[0] == NULL) - goto Away; - - type = kzalloc(sizeof(MYPROCTYPE), GFP_KERNEL | __GFP_NORETRY); - if (type == NULL) - goto Away; - - type->name = name; - type->propertyNames = propertyNames; - type->nProperties = 0; - type->nNames = 0; - type->show_property = show_property; - type->procDirRoot = procDirRoot; - if (type->propertyNames != NULL) - while (type->propertyNames[type->nProperties] != NULL) - type->nProperties++; - while (type->name[type->nNames] != NULL) - type->nNames++; - type->procDirs = kcalloc((type->nNames + 1), - sizeof(struct proc_dir_entry *), - GFP_KERNEL | __GFP_NORETRY); - if (type->procDirs == NULL) - goto Away; - parent = procDirRoot; - for (i = 0; i < type->nNames; i++) { - type->procDirs[i] = createProcDir(type->name[i], parent); - if (type->procDirs[i] == NULL) { - rc = NULL; - goto Away; - } - parent = type->procDirs[i]; - } - type->procDir = type->procDirs[type->nNames-1]; - rc = type; -Away: - if (rc == NULL) { - if (type != NULL) { - visor_proc_DestroyType(type); - type = NULL; - } - } - return rc; -} -EXPORT_SYMBOL_GPL(visor_proc_CreateType); - - - -void visor_proc_DestroyType(MYPROCTYPE *type) -{ - if (type == NULL) - return; - if (type->procDirs != NULL) { - int i = type->nNames-1; - - while (i >= 0) { - if (type->procDirs[i] != NULL) { - struct proc_dir_entry *parent = NULL; - - if (i == 0) - parent = type->procDirRoot; - else - parent = type->procDirs[i-1]; - remove_proc_entry(type->name[i], parent); - } - i--; - } - kfree(type->procDirs); - type->procDirs = NULL; - } - kfree(type); -} -EXPORT_SYMBOL_GPL(visor_proc_DestroyType); - - - -MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, - const char *name, void *context) -{ - MYPROCOBJECT *obj = NULL, *rc = NULL; - int i = 0; - - if (type == NULL) - goto Away; - - obj = kzalloc(sizeof(MYPROCOBJECT), GFP_KERNEL | __GFP_NORETRY); - if (obj == NULL) - goto Away; - - obj->type = type; - obj->context = context; - if (name == NULL) { - obj->name = NULL; - obj->procDir = type->procDir; - } else { - obj->namesize = strlen(name)+1; - obj->name = kmalloc(obj->namesize, GFP_KERNEL | __GFP_NORETRY); - if (obj->name == NULL) { - obj->namesize = 0; - goto Away; - } - strcpy(obj->name, name); - obj->procDir = createProcDir(obj->name, type->procDir); - if (obj->procDir == NULL) - goto Away; - } - obj->procDirPropertyContexts = - kcalloc((type->nProperties + 1), - sizeof(struct proc_dir_entry_context), - GFP_KERNEL | __GFP_NORETRY); - if (obj->procDirPropertyContexts == NULL) - goto Away; - obj->procDirProperties = kcalloc((type->nProperties + 1), - sizeof(struct proc_dir_entry *), - GFP_KERNEL | __GFP_NORETRY); - if (obj->procDirProperties == NULL) - goto Away; - for (i = 0; i < type->nProperties; i++) { - obj->procDirPropertyContexts[i].procObject = obj; - obj->procDirPropertyContexts[i].propertyIndex = i; - obj->procDirPropertyContexts[i].show_property = - type->show_property; - if (type->propertyNames[i][0] != '\0') { - /* only create properties that have names */ - obj->procDirProperties[i] = - createProcFile(type->propertyNames[i], - obj->procDir, &proc_fops, - &obj->procDirPropertyContexts[i]); - if (obj->procDirProperties[i] == NULL) { - rc = NULL; - goto Away; - } - } - } - rc = obj; -Away: - if (rc == NULL) { - if (obj != NULL) { - visor_proc_DestroyObject(obj); - obj = NULL; - } - } - return rc; -} -EXPORT_SYMBOL_GPL(visor_proc_CreateObject); - - - -void visor_proc_DestroyObject(MYPROCOBJECT *obj) -{ - MYPROCTYPE *type = NULL; - - if (obj == NULL) - return; - type = obj->type; - if (type == NULL) - return; - if (obj->procDirProperties != NULL) { - int i = 0; - - for (i = 0; i < type->nProperties; i++) { - if (obj->procDirProperties[i] != NULL) { - remove_proc_entry(type->propertyNames[i], - obj->procDir); - obj->procDirProperties[i] = NULL; - } - } - kfree(obj->procDirProperties); - obj->procDirProperties = NULL; - } - - kfree(obj->procDirPropertyContexts); - obj->procDirPropertyContexts = NULL; - - if (obj->procDir != NULL) { - if (obj->name != NULL) - remove_proc_entry(obj->name, type->procDir); - obj->procDir = NULL; - } - - kfree(obj->name); - obj->name = NULL; - kfree(obj); -} -EXPORT_SYMBOL_GPL(visor_proc_DestroyObject); - - - -static int seq_show(struct seq_file *seq, void *offset) -{ - struct proc_dir_entry_context *ctx = seq->private; - - if (ctx == NULL) - return 0; - (*ctx->show_property)(seq, ctx->procObject->context, - ctx->propertyIndex); - return 0; -} -- cgit v1.2.3 From 7166ed19a08c4dcd13d0315800237b754d09a800 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:38 -0400 Subject: staging: unisys: fix CamelCased ControlVM globals Fix the CamelCase global names: ControlVm_Pending_Msg => controlvm_pending_msg ControlVm_Pending_Msg_Valid => controlvm_pending_msg_valid Update all references to use the corrected names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index f4309b385343..670ac5b6d3de 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -125,8 +125,8 @@ static struct livedump_info { * this scenario, we simply stash the controlvm message, then attempt to * process it again the next time controlvm_periodic_work() runs. */ -static struct controlvm_message ControlVm_Pending_Msg; -static BOOL ControlVm_Pending_Msg_Valid = FALSE; +static struct controlvm_message controlvm_pending_msg; +static BOOL controlvm_pending_msg_valid = FALSE; /* Pool of struct putfile_buffer_entry, for keeping track of pending (incoming) * TRANSMIT_FILE PutFile payloads. @@ -1791,13 +1791,13 @@ controlvm_periodic_work(struct work_struct *work) &inmsg)) ; if (!got_command) { - if (ControlVm_Pending_Msg_Valid) { + if (controlvm_pending_msg_valid) { /* we throttled processing of a prior * msg, so try to process it again * rather than reading a new one */ - inmsg = ControlVm_Pending_Msg; - ControlVm_Pending_Msg_Valid = FALSE; + inmsg = controlvm_pending_msg; + controlvm_pending_msg_valid = FALSE; got_command = true; } else { got_command = read_controlvm_event(&inmsg); @@ -1819,8 +1819,8 @@ controlvm_periodic_work(struct work_struct *work) * reprocess it on our next loop */ handle_command_failed = TRUE; - ControlVm_Pending_Msg = inmsg; - ControlVm_Pending_Msg_Valid = TRUE; + controlvm_pending_msg = inmsg; + controlvm_pending_msg_valid = TRUE; } } -- cgit v1.2.3 From 1eee0011450f8c71e4ad11b914e38976d8bc7674 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:39 -0400 Subject: staging: unisys: fix CamelCase in putfile-related globals Fix the CamelCase global names: Putfile_buffer_list_pool => putfile_buffer_list_pool Putfile_buffer_list_pool_name => putfile_buffer_list_pool_name Putfile_request_list => putfile_request_list Update all references to use the corrected names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorchipset/visorchipset_main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 670ac5b6d3de..0b09102fa438 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -131,8 +131,8 @@ static BOOL controlvm_pending_msg_valid = FALSE; /* Pool of struct putfile_buffer_entry, for keeping track of pending (incoming) * TRANSMIT_FILE PutFile payloads. */ -static struct kmem_cache *Putfile_buffer_list_pool; -static const char Putfile_buffer_list_pool_name[] = +static struct kmem_cache *putfile_buffer_list_pool; +static const char putfile_buffer_list_pool_name[] = "controlvm_putfile_buffer_list_pool"; /* This identifies a data buffer that has been received via a controlvm messages @@ -147,7 +147,7 @@ struct putfile_buffer_entry { * Each entry in this list identifies an outstanding TRANSMIT_FILE * conversation. */ -static LIST_HEAD(Putfile_request_list); +static LIST_HEAD(putfile_request_list); /* This describes a buffer and its current state of transfer (e.g., how many * bytes have already been supplied as putfile data, and how many bytes are @@ -2185,11 +2185,11 @@ visorchipset_init(void) memset(&g_del_dump_msg_hdr, 0, sizeof(struct controlvm_message_header)); - Putfile_buffer_list_pool = - kmem_cache_create(Putfile_buffer_list_pool_name, + putfile_buffer_list_pool = + kmem_cache_create(putfile_buffer_list_pool_name, sizeof(struct putfile_buffer_entry), 0, SLAB_HWCACHE_ALIGN, NULL); - if (!Putfile_buffer_list_pool) { + if (!putfile_buffer_list_pool) { POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR); rc = -1; goto cleanup; @@ -2252,9 +2252,9 @@ visorchipset_exit(void) periodic_controlvm_workqueue = NULL; destroy_controlvm_payload_info(&controlvm_payload_info); } - if (Putfile_buffer_list_pool) { - kmem_cache_destroy(Putfile_buffer_list_pool); - Putfile_buffer_list_pool = NULL; + if (putfile_buffer_list_pool) { + kmem_cache_destroy(putfile_buffer_list_pool); + putfile_buffer_list_pool = NULL; } cleanup_controlvm_structures(); -- cgit v1.2.3 From 712f42cd992af9016d961b5e68faaa08abba97c8 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:40 -0400 Subject: staging: unisys: fix CamelCase global Visorchipset_cache_buffers_in_use Rename this variable: Visorchipset_cache_buffers_in_use => visorchipset_cache_buffers_in_use Update all references to use the fixed name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 0b09102fa438..cea62fdf0bdb 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -203,7 +203,7 @@ struct putfile_request { int completion_status; }; -static atomic_t Visorchipset_cache_buffers_in_use = ATOMIC_INIT(0); +static atomic_t visorchipset_cache_buffers_in_use = ATOMIC_INIT(0); struct parahotplug_request { struct list_head list; @@ -2066,7 +2066,7 @@ visorchipset_cache_alloc(struct kmem_cache *pool, BOOL ok_to_block, if (!p) return NULL; - atomic_inc(&Visorchipset_cache_buffers_in_use); + atomic_inc(&visorchipset_cache_buffers_in_use); return p; } @@ -2078,7 +2078,7 @@ visorchipset_cache_free(struct kmem_cache *pool, void *p, char *fn, int ln) if (!p) return; - atomic_dec(&Visorchipset_cache_buffers_in_use); + atomic_dec(&visorchipset_cache_buffers_in_use); kmem_cache_free(pool, p); } -- cgit v1.2.3 From ddf5de5369494f27e89023263b46f79dad3a2ab4 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:41 -0400 Subject: staging: unisys: fix CamelCased Parahotplug globals Fix the CamelCase names: Parahotplug_request_list => parahotplug_request_list Parahotplug_request_list_lock => parahotplug_request_list_lock Update references to use the corrected names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index cea62fdf0bdb..4dba816b514d 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -212,8 +212,8 @@ struct parahotplug_request { struct controlvm_message msg; }; -static LIST_HEAD(Parahotplug_request_list); -static DEFINE_SPINLOCK(Parahotplug_request_list_lock); /* lock for above */ +static LIST_HEAD(parahotplug_request_list); +static DEFINE_SPINLOCK(parahotplug_request_list_lock); /* lock for above */ static void parahotplug_process_list(void); /* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE / @@ -1530,9 +1530,9 @@ parahotplug_process_list(void) struct list_head *pos = NULL; struct list_head *tmp = NULL; - spin_lock(&Parahotplug_request_list_lock); + spin_lock(¶hotplug_request_list_lock); - list_for_each_safe(pos, tmp, &Parahotplug_request_list) { + list_for_each_safe(pos, tmp, ¶hotplug_request_list) { struct parahotplug_request *req = list_entry(pos, struct parahotplug_request, list); @@ -1548,7 +1548,7 @@ parahotplug_process_list(void) parahotplug_request_destroy(req); } - spin_unlock(&Parahotplug_request_list_lock); + spin_unlock(¶hotplug_request_list_lock); } /* @@ -1562,10 +1562,10 @@ parahotplug_request_complete(int id, u16 active) struct list_head *pos = NULL; struct list_head *tmp = NULL; - spin_lock(&Parahotplug_request_list_lock); + spin_lock(¶hotplug_request_list_lock); /* Look for a request matching "id". */ - list_for_each_safe(pos, tmp, &Parahotplug_request_list) { + list_for_each_safe(pos, tmp, ¶hotplug_request_list) { struct parahotplug_request *req = list_entry(pos, struct parahotplug_request, list); if (req->id == id) { @@ -1573,7 +1573,7 @@ parahotplug_request_complete(int id, u16 active) * respond. */ list_del(pos); - spin_unlock(&Parahotplug_request_list_lock); + spin_unlock(¶hotplug_request_list_lock); req->msg.cmd.device_change_state.state.active = active; if (req->msg.hdr.flags.response_expected) controlvm_respond_physdev_changestate( @@ -1584,7 +1584,7 @@ parahotplug_request_complete(int id, u16 active) } } - spin_unlock(&Parahotplug_request_list_lock); + spin_unlock(¶hotplug_request_list_lock); return -1; } @@ -1622,9 +1622,9 @@ parahotplug_process_message(struct controlvm_message *inmsg) * won't get responded to until the script has * indicated it's done. */ - spin_lock(&Parahotplug_request_list_lock); - list_add_tail(&req->list, &Parahotplug_request_list); - spin_unlock(&Parahotplug_request_list_lock); + spin_lock(¶hotplug_request_list_lock); + list_add_tail(&req->list, ¶hotplug_request_list); + spin_unlock(¶hotplug_request_list_lock); parahotplug_request_kickoff(req); } -- cgit v1.2.3 From 6fe345afd778cfa374c75a325f8c5b4801d89205 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:42 -0400 Subject: staging: unisys: fix CamelCased notifier globals Fix these CamelCased names: BusDev_Server_Notifiers => busdev_server_notifiers BusDev_Client_Notifiers => busdev_client_notifiers Update references to use the fixed names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 4dba816b514d..4314b8007e2e 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -219,8 +219,8 @@ static void parahotplug_process_list(void); /* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE / * CONTROLVM_REPORTEVENT. */ -static struct visorchipset_busdev_notifiers BusDev_Server_Notifiers; -static struct visorchipset_busdev_notifiers BusDev_Client_Notifiers; +static struct visorchipset_busdev_notifiers busdev_server_notifiers; +static struct visorchipset_busdev_notifiers busdev_client_notifiers; static void bus_create_response(ulong busNo, int response); static void bus_destroy_response(ulong busNo, int response); @@ -551,11 +551,11 @@ visorchipset_register_busdev_server( { down(¬ifier_lock); if (!notifiers) { - memset(&BusDev_Server_Notifiers, 0, - sizeof(BusDev_Server_Notifiers)); + memset(&busdev_server_notifiers, 0, + sizeof(busdev_server_notifiers)); serverregistered = 0; /* clear flag */ } else { - BusDev_Server_Notifiers = *notifiers; + busdev_server_notifiers = *notifiers; serverregistered = 1; /* set flag */ } if (responders) @@ -576,11 +576,11 @@ visorchipset_register_busdev_client( { down(¬ifier_lock); if (!notifiers) { - memset(&BusDev_Client_Notifiers, 0, - sizeof(BusDev_Client_Notifiers)); + memset(&busdev_client_notifiers, 0, + sizeof(busdev_client_notifiers)); clientregistered = 0; /* clear flag */ } else { - BusDev_Client_Notifiers = *notifiers; + busdev_client_notifiers = *notifiers; clientregistered = 1; /* set flag */ } if (responders) @@ -893,24 +893,24 @@ bus_epilog(u32 bus_no, * either server or client devices * - BusDev_Client can handle ONLY client * devices */ - if (BusDev_Server_Notifiers.bus_create) { - (*BusDev_Server_Notifiers.bus_create) (bus_no); + if (busdev_server_notifiers.bus_create) { + (*busdev_server_notifiers.bus_create) (bus_no); notified = TRUE; } if ((!bus_info->flags.server) /*client */ && - BusDev_Client_Notifiers.bus_create) { - (*BusDev_Client_Notifiers.bus_create) (bus_no); + busdev_client_notifiers.bus_create) { + (*busdev_client_notifiers.bus_create) (bus_no); notified = TRUE; } break; case CONTROLVM_BUS_DESTROY: - if (BusDev_Server_Notifiers.bus_destroy) { - (*BusDev_Server_Notifiers.bus_destroy) (bus_no); + if (busdev_server_notifiers.bus_destroy) { + (*busdev_server_notifiers.bus_destroy) (bus_no); notified = TRUE; } if ((!bus_info->flags.server) /*client */ && - BusDev_Client_Notifiers.bus_destroy) { - (*BusDev_Client_Notifiers.bus_destroy) (bus_no); + busdev_client_notifiers.bus_destroy) { + (*busdev_client_notifiers.bus_destroy) (bus_no); notified = TRUE; } break; @@ -946,9 +946,9 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, return; if (for_visorbus) - notifiers = &BusDev_Server_Notifiers; + notifiers = &busdev_server_notifiers; else - notifiers = &BusDev_Client_Notifiers; + notifiers = &busdev_client_notifiers; if (need_response) { memcpy(&dev_info->pending_msg_hdr, msg_hdr, sizeof(struct controlvm_message_header)); @@ -2141,8 +2141,8 @@ visorchipset_init(void) if (!unisys_spar_platform) return -ENODEV; - memset(&BusDev_Server_Notifiers, 0, sizeof(BusDev_Server_Notifiers)); - memset(&BusDev_Client_Notifiers, 0, sizeof(BusDev_Client_Notifiers)); + memset(&busdev_server_notifiers, 0, sizeof(busdev_server_notifiers)); + memset(&busdev_client_notifiers, 0, sizeof(busdev_client_notifiers)); memset(&controlvm_payload_info, 0, sizeof(controlvm_payload_info)); memset(&livedump_info, 0, sizeof(livedump_info)); atomic_set(&livedump_info.buffers_in_use, 0); -- cgit v1.2.3 From 8e3fedd6e3336a1bf200d6527751a7f1497c2e95 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:43 -0400 Subject: staging: unisys: fix CamelCase in responders functions Fix the CamelCase parameters: busNo => bus_no devNo => dev_no In the functions bus_create_response(), bus_destroy_response(), device_create_response(), device_destroy_response(), and device_resume_response(). Fix the CamelCase global structure name BusDev_Responders => busdev_responders And update all references to use the corrected names. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 4314b8007e2e..2530389ac3c1 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -222,13 +222,13 @@ static void parahotplug_process_list(void); static struct visorchipset_busdev_notifiers busdev_server_notifiers; static struct visorchipset_busdev_notifiers busdev_client_notifiers; -static void bus_create_response(ulong busNo, int response); -static void bus_destroy_response(ulong busNo, int response); -static void device_create_response(ulong busNo, ulong devNo, int response); -static void device_destroy_response(ulong busNo, ulong devNo, int response); -static void device_resume_response(ulong busNo, ulong devNo, int response); +static void bus_create_response(ulong bus_no, int response); +static void bus_destroy_response(ulong bus_no, int response); +static void device_create_response(ulong bus_no, ulong dev_no, int response); +static void device_destroy_response(ulong bus_no, ulong dev_no, int response); +static void device_resume_response(ulong bus_no, ulong dev_no, int response); -static struct visorchipset_busdev_responders BusDev_Responders = { +static struct visorchipset_busdev_responders busdev_responders = { .bus_create = bus_create_response, .bus_destroy = bus_destroy_response, .device_create = device_create_response, @@ -559,7 +559,7 @@ visorchipset_register_busdev_server( serverregistered = 1; /* set flag */ } if (responders) - *responders = BusDev_Responders; + *responders = busdev_responders; if (driver_info) bus_device_info_init(driver_info, "chipset", "visorchipset", VERSION, NULL); @@ -584,7 +584,7 @@ visorchipset_register_busdev_client( clientregistered = 1; /* set flag */ } if (responders) - *responders = BusDev_Responders; + *responders = busdev_responders; if (driver_info) bus_device_info_init(driver_info, "chipset(bolts)", "visorchipset", VERSION, NULL); @@ -1951,27 +1951,27 @@ cleanup: } static void -bus_create_response(ulong busNo, int response) +bus_create_response(ulong bus_no, int response) { - bus_responder(CONTROLVM_BUS_CREATE, busNo, response); + bus_responder(CONTROLVM_BUS_CREATE, bus_no, response); } static void -bus_destroy_response(ulong busNo, int response) +bus_destroy_response(ulong bus_no, int response) { - bus_responder(CONTROLVM_BUS_DESTROY, busNo, response); + bus_responder(CONTROLVM_BUS_DESTROY, bus_no, response); } static void -device_create_response(ulong busNo, ulong devNo, int response) +device_create_response(ulong bus_no, ulong dev_no, int response) { - device_responder(CONTROLVM_DEVICE_CREATE, busNo, devNo, response); + device_responder(CONTROLVM_DEVICE_CREATE, bus_no, dev_no, response); } static void -device_destroy_response(ulong busNo, ulong devNo, int response) +device_destroy_response(ulong bus_no, ulong dev_no, int response) { - device_responder(CONTROLVM_DEVICE_DESTROY, busNo, devNo, response); + device_responder(CONTROLVM_DEVICE_DESTROY, bus_no, dev_no, response); } void @@ -1984,10 +1984,10 @@ visorchipset_device_pause_response(ulong bus_no, ulong dev_no, int response) EXPORT_SYMBOL_GPL(visorchipset_device_pause_response); static void -device_resume_response(ulong busNo, ulong devNo, int response) +device_resume_response(ulong bus_no, ulong dev_no, int response) { device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, - busNo, devNo, response, + bus_no, dev_no, response, segment_state_running); } -- cgit v1.2.3 From 5aa8ae57c560afb1a58c42db0d98fd327b89a274 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:44 -0400 Subject: staging: unisys: fix CamelCased global MajorDev Rename the CamelCase global: MajorDev => major_dev Update references to use the corrected name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 2530389ac3c1..5017c95db20d 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -238,7 +238,7 @@ static struct visorchipset_busdev_responders busdev_responders = { }; /* info for /dev/visorchipset */ -static dev_t MajorDev = -1; /**< indicates major num for device */ +static dev_t major_dev = -1; /**< indicates major num for device */ /* prototypes for attributes */ static ssize_t toolaction_show(struct device *dev, @@ -2172,8 +2172,8 @@ visorchipset_init(void) return -ENODEV; } - MajorDev = MKDEV(visorchipset_major, 0); - rc = visorchipset_file_init(MajorDev, &controlvm_channel); + major_dev = MKDEV(visorchipset_major, 0); + rc = visorchipset_file_init(major_dev, &controlvm_channel); if (rc < 0) { POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR); goto cleanup; @@ -2222,7 +2222,7 @@ visorchipset_init(void) } } - Visorchipset_platform_device.dev.devt = MajorDev; + Visorchipset_platform_device.dev.devt = major_dev; if (platform_device_register(&Visorchipset_platform_device) < 0) { POSTCODE_LINUX_2(DEVICE_REGISTER_FAILURE_PC, DIAG_SEVERITY_ERR); rc = -1; -- cgit v1.2.3 From eb34e877ccbcd0da12bb10360d1cf9cfecd6888f Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:45 -0400 Subject: staging: unisys: fix CamelCase global Visorchipset_platform_device Rename the CamelCase variable: Visorchipset_platform_device => visorchipset_platform_device Update all references to use the corrected name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 5017c95db20d..6427bade0375 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -326,7 +326,7 @@ static const struct attribute_group *visorchipset_dev_groups[] = { }; /* /sys/devices/platform/visorchipset */ -static struct platform_device Visorchipset_platform_device = { +static struct platform_device visorchipset_platform_device = { .name = "visorchipset", .id = -1, .dev.groups = visorchipset_dev_groups, @@ -1000,7 +1000,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, * diag_shutdown.sh script in * the visorchipset hotplug */ kobject_uevent_env - (&Visorchipset_platform_device.dev. + (&visorchipset_platform_device.dev. kobj, KOBJ_ONLINE, envp); } } @@ -1340,7 +1340,7 @@ initialize_controlvm_payload(void) int visorchipset_chipset_ready(void) { - kobject_uevent(&Visorchipset_platform_device.dev.kobj, KOBJ_ONLINE); + kobject_uevent(&visorchipset_platform_device.dev.kobj, KOBJ_ONLINE); return CONTROLVM_RESP_SUCCESS; } EXPORT_SYMBOL_GPL(visorchipset_chipset_ready); @@ -1352,7 +1352,7 @@ visorchipset_chipset_selftest(void) char *envp[] = { env_selftest, NULL }; sprintf(env_selftest, "SPARSP_SELFTEST=%d", 1); - kobject_uevent_env(&Visorchipset_platform_device.dev.kobj, KOBJ_CHANGE, + kobject_uevent_env(&visorchipset_platform_device.dev.kobj, KOBJ_CHANGE, envp); return CONTROLVM_RESP_SUCCESS; } @@ -1364,7 +1364,7 @@ EXPORT_SYMBOL_GPL(visorchipset_chipset_selftest); int visorchipset_chipset_notready(void) { - kobject_uevent(&Visorchipset_platform_device.dev.kobj, KOBJ_OFFLINE); + kobject_uevent(&visorchipset_platform_device.dev.kobj, KOBJ_OFFLINE); return CONTROLVM_RESP_SUCCESS; } EXPORT_SYMBOL_GPL(visorchipset_chipset_notready); @@ -1516,7 +1516,7 @@ parahotplug_request_kickoff(struct parahotplug_request *req) sprintf(env_func, "SPAR_PARAHOTPLUG_FUNCTION=%d", cmd->device_change_state.dev_no & 0x7); - kobject_uevent_env(&Visorchipset_platform_device.dev.kobj, KOBJ_CHANGE, + kobject_uevent_env(&visorchipset_platform_device.dev.kobj, KOBJ_CHANGE, envp); } @@ -2222,8 +2222,8 @@ visorchipset_init(void) } } - Visorchipset_platform_device.dev.devt = major_dev; - if (platform_device_register(&Visorchipset_platform_device) < 0) { + visorchipset_platform_device.dev.devt = major_dev; + if (platform_device_register(&visorchipset_platform_device) < 0) { POSTCODE_LINUX_2(DEVICE_REGISTER_FAILURE_PC, DIAG_SEVERITY_ERR); rc = -1; goto cleanup; -- cgit v1.2.3 From b3168c70bb8d6d8b2679995627ebc2cbd3e7961b Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:46 -0400 Subject: staging: unisys: fix CamelCase parameter msgHdr in controlvm functions Fix the CamelCase parameter name msgHdr => msg_hdr In all of the controlvm functions in visorchipset_main.c. Update all references to use the corrected name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 6427bade0375..8ca73b62c0cc 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -333,13 +333,13 @@ static struct platform_device visorchipset_platform_device = { }; /* Function prototypes */ -static void controlvm_respond(struct controlvm_message_header *msgHdr, +static void controlvm_respond(struct controlvm_message_header *msg_hdr, int response); static void controlvm_respond_chipset_init( - struct controlvm_message_header *msgHdr, int response, + struct controlvm_message_header *msg_hdr, int response, enum ultra_chipset_feature features); static void controlvm_respond_physdev_changestate( - struct controlvm_message_header *msgHdr, int response, + struct controlvm_message_header *msg_hdr, int response, struct spar_segment_state state); static ssize_t toolaction_show(struct device *dev, @@ -645,10 +645,10 @@ cleanup: static void controlvm_init_response(struct controlvm_message *msg, - struct controlvm_message_header *msgHdr, int response) + struct controlvm_message_header *msg_hdr, int response) { memset(msg, 0, sizeof(struct controlvm_message)); - memcpy(&msg->hdr, msgHdr, sizeof(struct controlvm_message_header)); + memcpy(&msg->hdr, msg_hdr, sizeof(struct controlvm_message_header)); msg->hdr.payload_bytes = 0; msg->hdr.payload_vm_offset = 0; msg->hdr.payload_max_bytes = 0; @@ -659,14 +659,14 @@ controlvm_init_response(struct controlvm_message *msg, } static void -controlvm_respond(struct controlvm_message_header *msgHdr, int response) +controlvm_respond(struct controlvm_message_header *msg_hdr, int response) { struct controlvm_message outmsg; - controlvm_init_response(&outmsg, msgHdr, response); + controlvm_init_response(&outmsg, msg_hdr, response); /* For DiagPool channel DEVICE_CHANGESTATE, we need to send * back the deviceChangeState structure in the packet. */ - if (msgHdr->id == CONTROLVM_DEVICE_CHANGESTATE && + if (msg_hdr->id == CONTROLVM_DEVICE_CHANGESTATE && g_devicechangestate_packet.device_change_state.bus_no == g_diagpool_bus_no && g_devicechangestate_packet.device_change_state.dev_no == @@ -682,13 +682,13 @@ controlvm_respond(struct controlvm_message_header *msgHdr, int response) } static void -controlvm_respond_chipset_init(struct controlvm_message_header *msgHdr, +controlvm_respond_chipset_init(struct controlvm_message_header *msg_hdr, int response, enum ultra_chipset_feature features) { struct controlvm_message outmsg; - controlvm_init_response(&outmsg, msgHdr, response); + controlvm_init_response(&outmsg, msg_hdr, response); outmsg.cmd.init_chipset.features = features; if (!visorchannel_signalinsert(controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { @@ -697,12 +697,12 @@ controlvm_respond_chipset_init(struct controlvm_message_header *msgHdr, } static void controlvm_respond_physdev_changestate( - struct controlvm_message_header *msgHdr, int response, + struct controlvm_message_header *msg_hdr, int response, struct spar_segment_state state) { struct controlvm_message outmsg; - controlvm_init_response(&outmsg, msgHdr, response); + controlvm_init_response(&outmsg, msg_hdr, response); outmsg.cmd.device_change_state.state = state; outmsg.cmd.device_change_state.flags.phys_device = 1; if (!visorchannel_signalinsert(controlvm_channel, -- cgit v1.2.3 From 77a0449d4cf3fe63f0e712d23458207bd661e0b2 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:47 -0400 Subject: staging: unisys: fix CamelCase parameter in chipset functions Fix the CamelCase parameter msgHdr => msg_hdr In all of the chipset functions. Update all references to use the corrected name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 8ca73b62c0cc..17fe06ec7d34 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1370,42 +1370,42 @@ visorchipset_chipset_notready(void) EXPORT_SYMBOL_GPL(visorchipset_chipset_notready); static void -chipset_ready(struct controlvm_message_header *msgHdr) +chipset_ready(struct controlvm_message_header *msg_hdr) { int rc = visorchipset_chipset_ready(); if (rc != CONTROLVM_RESP_SUCCESS) rc = -rc; - if (msgHdr->flags.response_expected && !visorchipset_holdchipsetready) - controlvm_respond(msgHdr, rc); - if (msgHdr->flags.response_expected && visorchipset_holdchipsetready) { + if (msg_hdr->flags.response_expected && !visorchipset_holdchipsetready) + controlvm_respond(msg_hdr, rc); + if (msg_hdr->flags.response_expected && visorchipset_holdchipsetready) { /* Send CHIPSET_READY response when all modules have been loaded * and disks mounted for the partition */ - g_chipset_msg_hdr = *msgHdr; + g_chipset_msg_hdr = *msg_hdr; } } static void -chipset_selftest(struct controlvm_message_header *msgHdr) +chipset_selftest(struct controlvm_message_header *msg_hdr) { int rc = visorchipset_chipset_selftest(); if (rc != CONTROLVM_RESP_SUCCESS) rc = -rc; - if (msgHdr->flags.response_expected) - controlvm_respond(msgHdr, rc); + if (msg_hdr->flags.response_expected) + controlvm_respond(msg_hdr, rc); } static void -chipset_notready(struct controlvm_message_header *msgHdr) +chipset_notready(struct controlvm_message_header *msg_hdr) { int rc = visorchipset_chipset_notready(); if (rc != CONTROLVM_RESP_SUCCESS) rc = -rc; - if (msgHdr->flags.response_expected) - controlvm_respond(msgHdr, rc); + if (msg_hdr->flags.response_expected) + controlvm_respond(msg_hdr, rc); } /* This is your "one-stop" shop for grabbing the next message from the -- cgit v1.2.3 From 01f4d85a5852726d8ff71d61646690a5af98e9cc Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:48 -0400 Subject: staging: unisys: fix CamelCase local toolAction Rename the CamelCase local toolAction => tool_action In both of the sysfs functions for exposing this value, and update all references to use the corrected name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 17fe06ec7d34..c5eecce2b77f 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -346,27 +346,27 @@ static ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, char *buf) { - u8 toolAction; + u8 tool_action; visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, - tool_action), &toolAction, sizeof(u8)); - return scnprintf(buf, PAGE_SIZE, "%u\n", toolAction); + tool_action), &tool_action, sizeof(u8)); + return scnprintf(buf, PAGE_SIZE, "%u\n", tool_action); } static ssize_t toolaction_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - u8 toolAction; + u8 tool_action; int ret; - if (kstrtou8(buf, 10, &toolAction) != 0) + if (kstrtou8(buf, 10, &tool_action) != 0) return -EINVAL; ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, tool_action), - &toolAction, sizeof(u8)); + &tool_action, sizeof(u8)); if (ret) return ret; -- cgit v1.2.3 From 365522d99474998b11cb544c0167742455e8e7a0 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:49 -0400 Subject: staging: unisys: fix CamelCase variables in boottotool functions Rename the local CamelCase variable efiSparIndication => efi_spar_indication Update all references to use the corrected name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index c5eecce2b77f..b59988db7e0b 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -377,14 +377,14 @@ static ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct efi_spar_indication efiSparIndication; + struct efi_spar_indication efi_spar_indication; visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, - efi_spar_ind), &efiSparIndication, + efi_spar_ind), &efi_spar_indication, sizeof(struct efi_spar_indication)); return scnprintf(buf, PAGE_SIZE, "%u\n", - efiSparIndication.boot_to_tool); + efi_spar_indication.boot_to_tool); } static ssize_t boottotool_store(struct device *dev, @@ -392,16 +392,16 @@ static ssize_t boottotool_store(struct device *dev, const char *buf, size_t count) { int val, ret; - struct efi_spar_indication efiSparIndication; + struct efi_spar_indication efi_spar_indication; if (kstrtoint(buf, 10, &val) != 0) return -EINVAL; - efiSparIndication.boot_to_tool = val; + efi_spar_indication.boot_to_tool = val; ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, efi_spar_ind), - &(efiSparIndication), + &(efi_spar_indication), sizeof(struct efi_spar_indication)); if (ret) -- cgit v1.2.3 From 10dbf0e35f85921607f744c7ee0a86aec9367ed8 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:50 -0400 Subject: staging: unisys: fix CamelCase local in textid functions Fix the CamelCased local variable textId => text_id In both of the textid sysfs functions, and update all references to use the corrected name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index b59988db7e0b..6f4b491f2794 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -441,27 +441,27 @@ static ssize_t error_store(struct device *dev, struct device_attribute *attr, static ssize_t textid_show(struct device *dev, struct device_attribute *attr, char *buf) { - u32 textId; + u32 text_id; visorchannel_read(controlvm_channel, offsetof( struct spar_controlvm_channel_protocol, installation_text_id), - &textId, sizeof(u32)); - return scnprintf(buf, PAGE_SIZE, "%i\n", textId); + &text_id, sizeof(u32)); + return scnprintf(buf, PAGE_SIZE, "%i\n", text_id); } static ssize_t textid_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - u32 textId; + u32 text_id; int ret; - if (kstrtou32(buf, 10, &textId) != 0) + if (kstrtou32(buf, 10, &text_id) != 0) return -EINVAL; ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, installation_text_id), - &textId, sizeof(u32)); + &text_id, sizeof(u32)); if (ret) return ret; return count; -- cgit v1.2.3 From ee8da290d1e731d101f912c3b322e48fe37232c1 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:51 -0400 Subject: staging: unisys: Fix CamelCase local variable in remaining_steps functions Rename the CamelCase local variable remainingSteps => remaining_steps Update all references to use the corrected name. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/visorchipset_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 6f4b491f2794..ec48132132bc 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -470,29 +470,29 @@ static ssize_t textid_store(struct device *dev, struct device_attribute *attr, static ssize_t remaining_steps_show(struct device *dev, struct device_attribute *attr, char *buf) { - u16 remainingSteps; + u16 remaining_steps; visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, installation_remaining_steps), - &remainingSteps, + &remaining_steps, sizeof(u16)); - return scnprintf(buf, PAGE_SIZE, "%hu\n", remainingSteps); + return scnprintf(buf, PAGE_SIZE, "%hu\n", remaining_steps); } static ssize_t remaining_steps_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - u16 remainingSteps; + u16 remaining_steps; int ret; - if (kstrtou16(buf, 10, &remainingSteps) != 0) + if (kstrtou16(buf, 10, &remaining_steps) != 0) return -EINVAL; ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, installation_remaining_steps), - &remainingSteps, sizeof(u16)); + &remaining_steps, sizeof(u16)); if (ret) return ret; return count; -- cgit v1.2.3 From 8e76e695f76c99b97c0949dfafe9cf176bceb0e4 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Mon, 16 Mar 2015 13:58:52 -0400 Subject: staging: unisys: fix parenthesis alignment in visorchipset_main.c Fix as many parenthesis alignment problems in this file as possible. In cases where there was no good way to align to the leading parenthesis, the content of the parenthesis were aligned as if there were no limit, and then the leading indentation was moved back to one tab in from the previous line. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../unisys/visorchipset/visorchipset_main.c | 117 +++++++++++---------- 1 file changed, 64 insertions(+), 53 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index ec48132132bc..9c8605dea475 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -242,45 +242,51 @@ static dev_t major_dev = -1; /**< indicates major num for device */ /* prototypes for attributes */ static ssize_t toolaction_show(struct device *dev, - struct device_attribute *attr, char *buf); + struct device_attribute *attr, char *buf); static ssize_t toolaction_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); + struct device_attribute *attr, + const char *buf, size_t count); static DEVICE_ATTR_RW(toolaction); static ssize_t boottotool_show(struct device *dev, - struct device_attribute *attr, char *buf); + struct device_attribute *attr, char *buf); static ssize_t boottotool_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); + struct device_attribute *attr, const char *buf, + size_t count); static DEVICE_ATTR_RW(boottotool); static ssize_t error_show(struct device *dev, struct device_attribute *attr, - char *buf); + char *buf); static ssize_t error_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count); + const char *buf, size_t count); static DEVICE_ATTR_RW(error); static ssize_t textid_show(struct device *dev, struct device_attribute *attr, - char *buf); + char *buf); static ssize_t textid_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count); + const char *buf, size_t count); static DEVICE_ATTR_RW(textid); static ssize_t remaining_steps_show(struct device *dev, - struct device_attribute *attr, char *buf); + struct device_attribute *attr, char *buf); static ssize_t remaining_steps_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); + struct device_attribute *attr, + const char *buf, size_t count); static DEVICE_ATTR_RW(remaining_steps); static ssize_t chipsetready_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); + struct device_attribute *attr, + const char *buf, size_t count); static DEVICE_ATTR_WO(chipsetready); static ssize_t devicedisabled_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); + struct device_attribute *attr, + const char *buf, size_t count); static DEVICE_ATTR_WO(devicedisabled); static ssize_t deviceenabled_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); + struct device_attribute *attr, + const char *buf, size_t count); static DEVICE_ATTR_WO(deviceenabled); static struct attribute *visorchipset_install_attrs[] = { @@ -350,7 +356,7 @@ static ssize_t toolaction_show(struct device *dev, visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, - tool_action), &tool_action, sizeof(u8)); + tool_action), &tool_action, sizeof(u8)); return scnprintf(buf, PAGE_SIZE, "%u\n", tool_action); } @@ -365,7 +371,8 @@ static ssize_t toolaction_store(struct device *dev, return -EINVAL; ret = visorchannel_write(controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, tool_action), + offsetof(struct spar_controlvm_channel_protocol, + tool_action), &tool_action, sizeof(u8)); if (ret) @@ -380,11 +387,11 @@ static ssize_t boottotool_show(struct device *dev, struct efi_spar_indication efi_spar_indication; visorchannel_read(controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - efi_spar_ind), &efi_spar_indication, - sizeof(struct efi_spar_indication)); + offsetof(struct spar_controlvm_channel_protocol, + efi_spar_ind), &efi_spar_indication, + sizeof(struct efi_spar_indication)); return scnprintf(buf, PAGE_SIZE, "%u\n", - efi_spar_indication.boot_to_tool); + efi_spar_indication.boot_to_tool); } static ssize_t boottotool_store(struct device *dev, @@ -400,9 +407,8 @@ static ssize_t boottotool_store(struct device *dev, efi_spar_indication.boot_to_tool = val; ret = visorchannel_write(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, - efi_spar_ind), - &(efi_spar_indication), - sizeof(struct efi_spar_indication)); + efi_spar_ind), &(efi_spar_indication), + sizeof(struct efi_spar_indication)); if (ret) return ret; @@ -410,18 +416,19 @@ static ssize_t boottotool_store(struct device *dev, } static ssize_t error_show(struct device *dev, struct device_attribute *attr, - char *buf) + char *buf) { u32 error; - visorchannel_read(controlvm_channel, offsetof( - struct spar_controlvm_channel_protocol, installation_error), - &error, sizeof(u32)); + visorchannel_read(controlvm_channel, + offsetof(struct spar_controlvm_channel_protocol, + installation_error), + &error, sizeof(u32)); return scnprintf(buf, PAGE_SIZE, "%i\n", error); } static ssize_t error_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) + const char *buf, size_t count) { u32 error; int ret; @@ -430,27 +437,28 @@ static ssize_t error_store(struct device *dev, struct device_attribute *attr, return -EINVAL; ret = visorchannel_write(controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - installation_error), - &error, sizeof(u32)); + offsetof(struct spar_controlvm_channel_protocol, + installation_error), + &error, sizeof(u32)); if (ret) return ret; return count; } static ssize_t textid_show(struct device *dev, struct device_attribute *attr, - char *buf) + char *buf) { u32 text_id; - visorchannel_read(controlvm_channel, offsetof( - struct spar_controlvm_channel_protocol, installation_text_id), - &text_id, sizeof(u32)); + visorchannel_read(controlvm_channel, + offsetof(struct spar_controlvm_channel_protocol, + installation_text_id), + &text_id, sizeof(u32)); return scnprintf(buf, PAGE_SIZE, "%i\n", text_id); } static ssize_t textid_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) + const char *buf, size_t count) { u32 text_id; int ret; @@ -459,29 +467,29 @@ static ssize_t textid_store(struct device *dev, struct device_attribute *attr, return -EINVAL; ret = visorchannel_write(controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - installation_text_id), - &text_id, sizeof(u32)); + offsetof(struct spar_controlvm_channel_protocol, + installation_text_id), + &text_id, sizeof(u32)); if (ret) return ret; return count; } static ssize_t remaining_steps_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { u16 remaining_steps; visorchannel_read(controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - installation_remaining_steps), - &remaining_steps, - sizeof(u16)); + offsetof(struct spar_controlvm_channel_protocol, + installation_remaining_steps), + &remaining_steps, sizeof(u16)); return scnprintf(buf, PAGE_SIZE, "%hu\n", remaining_steps); } static ssize_t remaining_steps_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) + struct device_attribute *attr, + const char *buf, size_t count) { u16 remaining_steps; int ret; @@ -490,9 +498,9 @@ static ssize_t remaining_steps_store(struct device *dev, return -EINVAL; ret = visorchannel_write(controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - installation_remaining_steps), - &remaining_steps, sizeof(u16)); + offsetof(struct spar_controlvm_channel_protocol, + installation_remaining_steps), + &remaining_steps, sizeof(u16)); if (ret) return ret; return count; @@ -562,7 +570,7 @@ visorchipset_register_busdev_server( *responders = busdev_responders; if (driver_info) bus_device_info_init(driver_info, "chipset", "visorchipset", - VERSION, NULL); + VERSION, NULL); up(¬ifier_lock); } @@ -1613,8 +1621,8 @@ parahotplug_process_message(struct controlvm_message *inmsg) */ parahotplug_request_kickoff(req); controlvm_respond_physdev_changestate(&inmsg->hdr, - CONTROLVM_RESP_SUCCESS, inmsg->cmd. - device_change_state.state); + CONTROLVM_RESP_SUCCESS, + inmsg->cmd.device_change_state.state); parahotplug_request_destroy(req); } else { /* For disable messages, add the request to the @@ -2083,7 +2091,8 @@ visorchipset_cache_free(struct kmem_cache *pool, void *p, char *fn, int ln) } static ssize_t chipsetready_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) + struct device_attribute *attr, + const char *buf, size_t count) { char msgtype[64]; @@ -2105,7 +2114,8 @@ static ssize_t chipsetready_store(struct device *dev, * and then passed back when the device has been removed. */ static ssize_t devicedisabled_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) + struct device_attribute *attr, + const char *buf, size_t count) { uint id; @@ -2121,7 +2131,8 @@ static ssize_t devicedisabled_store(struct device *dev, * and then passed back when the device has been brought back up. */ static ssize_t deviceenabled_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) + struct device_attribute *attr, + const char *buf, size_t count) { uint id; -- cgit v1.2.3 From 28b9d6f14d30eae2d600a3f6deac625f26591820 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Sat, 21 Mar 2015 18:20:24 +0530 Subject: Staging: lustre: Convert macro class_export_rpc_inc into static inline function This patch converts the macro class_export_rpc_inc into static inline function. This is possible because the types of arguments at all the call sites are same. So, the type of parameter is compatible with the types of the arguments at all of the call sites. Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd_class.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 4a29261c514d..9f528d44287f 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -222,12 +222,12 @@ extern void (*class_export_dump_hook)(struct obd_export *); #endif -#define class_export_rpc_inc(exp) \ -({ \ - atomic_inc(&(exp)->exp_rpc_count); \ - CDEBUG(D_INFO, "RPC GETting export %p : new rpc_count %d\n", \ - (exp), atomic_read(&(exp)->exp_rpc_count)); \ -}) +static inline void class_export_rpc_inc(struct obd_export *exp) +{ + atomic_inc(&(exp)->exp_rpc_count); + CDEBUG(D_INFO, "RPC GETting export %p : new rpc_count %d\n", + (exp), atomic_read(&(exp)->exp_rpc_count)); +} #define class_export_rpc_dec(exp) \ ({ \ -- cgit v1.2.3 From 5fb0acb435c92760c4157df134e88103f1461b32 Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Sat, 21 Mar 2015 18:20:25 +0530 Subject: Staging: lustre: Convert macro class_export_rpc_dec into static inline function This patch converts the macro class_export_rpc_dec into static inline function. This is possible because the types of arguments at all the call sites are same. So, the type of parameter is compatible with the types of the arguments at all of the call sites. Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd_class.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 9f528d44287f..3565660e0630 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -229,13 +229,13 @@ static inline void class_export_rpc_inc(struct obd_export *exp) (exp), atomic_read(&(exp)->exp_rpc_count)); } -#define class_export_rpc_dec(exp) \ -({ \ - LASSERT_ATOMIC_POS(&exp->exp_rpc_count); \ - atomic_dec(&(exp)->exp_rpc_count); \ - CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n", \ - (exp), atomic_read(&(exp)->exp_rpc_count)); \ -}) +static inline void class_export_rpc_dec(struct obd_export *exp) +{ + LASSERT_ATOMIC_POS(&exp->exp_rpc_count); + atomic_dec(&(exp)->exp_rpc_count); + CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n", + (exp), atomic_read(&(exp)->exp_rpc_count)); +} #define class_export_lock_get(exp, lock) \ ({ \ -- cgit v1.2.3 From 381ca677af0a898af0e19002ea445055e6f0923a Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sat, 21 Mar 2015 08:51:35 +0300 Subject: Staging: lustre: remove extern in .c file This patch removes extern from .c file; for the variable is not used anywhere else in the file. In addition, it mark it static in the one file it is in "ldlm_resource.c". Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 2 -- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 7574502919ca..a9f4833e03e5 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -141,8 +141,6 @@ */ #define LDLM_POOL_SLV_SHIFT (10) -extern struct proc_dir_entry *ldlm_ns_proc_dir; - static inline __u64 dru(__u64 val, __u32 shift, int round_up) { return (val + (round_up ? (1 << shift) - 1 : 0)) >> shift; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index c6f62a91b233..f750d42a7ad5 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -62,7 +62,7 @@ LIST_HEAD(ldlm_cli_active_namespace_list); LIST_HEAD(ldlm_cli_inactive_namespace_list); struct proc_dir_entry *ldlm_type_proc_dir = NULL; -struct proc_dir_entry *ldlm_ns_proc_dir = NULL; +static struct proc_dir_entry *ldlm_ns_proc_dir = NULL; struct proc_dir_entry *ldlm_svc_proc_dir = NULL; extern unsigned int ldlm_cancel_unused_locks_before_replay; -- cgit v1.2.3 From 9ee941dfe7904c67794c52d78db7ec2d03a57257 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sat, 21 Mar 2015 10:47:56 +0300 Subject: Staging: lustre: Fix externs should be avoided in .c Thi patch moves extern declaration to "obd_class.h". Remove prototype from "class_obd.c". Issue addressed by checkpatch.pl. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd_class.h | 2 ++ drivers/staging/lustre/lustre/obdclass/class_obd.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 3565660e0630..e75f4b5a4362 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -1895,6 +1895,8 @@ void class_exit_uuidlist(void); /* class_obd.c */ extern char obd_jobid_node[]; +extern struct miscdevice obd_psdev; +extern spinlock_t obd_types_lock; /* prng.c */ #define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t)) diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 29456e1ad225..d4b74b670c43 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -437,8 +437,6 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) return err; } /* class_handle_ioctl */ -extern struct miscdevice obd_psdev; - #define OBD_INIT_CHECK int obd_init_checks(void) { @@ -508,7 +506,6 @@ int obd_init_checks(void) return ret; } -extern spinlock_t obd_types_lock; #if defined (CONFIG_PROC_FS) extern int class_procfs_init(void); extern int class_procfs_clean(void); -- cgit v1.2.3 From 826ad46d05c631d139289d095a68ea3c58aee821 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sat, 21 Mar 2015 10:48:30 +0300 Subject: Stagin: lustre: Fix externs should be avoided in .c This patch moves extern declaration from genops.c to obd_class.h, addressing checkpatch.pl warning: externs should be avoided in .c Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd_class.h | 1 + drivers/staging/lustre/lustre/obdclass/genops.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index e75f4b5a4362..5314f6f3dd43 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -72,6 +72,7 @@ extern int lustre_get_jobid(char *jobid); struct lu_device_type; /* genops.c */ +extern struct list_head obd_types; struct obd_export *class_conn2export(struct lustre_handle *); int class_register_type(struct obd_ops *, struct md_ops *, struct lprocfs_vars *, const char *nm, diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 01858b0af01c..f2165635e6eb 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -43,7 +43,6 @@ #include "../include/obd_class.h" #include "../include/lprocfs_status.h" -extern struct list_head obd_types; spinlock_t obd_types_lock; struct kmem_cache *obd_device_cachep; -- cgit v1.2.3 From 052c529e30cd381f0e08ee4d4ddbe44347a29e43 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sat, 21 Mar 2015 10:51:42 +0300 Subject: Staging: lustre: Fix Sparse warnings for static declarations The following patch fixes Sparse warnings in genops.c regrding: "Symbol * was not declared. Should it be static?" Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/genops.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index f2165635e6eb..66b56784f674 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -48,11 +48,11 @@ spinlock_t obd_types_lock; struct kmem_cache *obd_device_cachep; struct kmem_cache *obdo_cachep; EXPORT_SYMBOL(obdo_cachep); -struct kmem_cache *import_cachep; +static struct kmem_cache *import_cachep; -struct list_head obd_zombie_imports; -struct list_head obd_zombie_exports; -spinlock_t obd_zombie_impexp_lock; +static struct list_head obd_zombie_imports; +static struct list_head obd_zombie_exports; +static spinlock_t obd_zombie_impexp_lock; static void obd_zombie_impexp_notify(void); static void obd_zombie_export_add(struct obd_export *exp); static void obd_zombie_import_add(struct obd_import *imp); @@ -929,7 +929,7 @@ void class_unlink_export(struct obd_export *exp) EXPORT_SYMBOL(class_unlink_export); /* Import management functions */ -void class_import_destroy(struct obd_import *imp) +static void class_import_destroy(struct obd_import *imp) { CDEBUG(D_IOCTL, "destroying import %p for %s\n", imp, imp->imp_obd->obd_name); @@ -1126,7 +1126,7 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd, EXPORT_SYMBOL(class_connect); /* if export is involved in recovery then clean up related things */ -void class_export_recovery_cleanup(struct obd_export *exp) +static void class_export_recovery_cleanup(struct obd_export *exp) { struct obd_device *obd = exp->exp_obd; -- cgit v1.2.3 From daf56d91a56d41d97fda9f5979657abbd6475140 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 20 Mar 2015 18:09:43 +0200 Subject: Staging: iio: Add kernel-doc for struct hmc5843 This patch documents the struct hmc5843 specific data following this warning: "CHECK: struct mutex definition without comment". Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/magnetometer/hmc5843.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843.h b/drivers/staging/iio/magnetometer/hmc5843.h index 332a75c3a4fb..f3d0da2fe458 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.h +++ b/drivers/staging/iio/magnetometer/hmc5843.h @@ -31,12 +31,20 @@ enum hmc5843_ids { HMC5983_ID, }; +/** + * struct hcm5843_data - device specific data + * @dev: actual device + * @lock: update and read regmap data + * @regmap: hardware access register maps + * @variant: describe chip variants + * @buffer: 3x 16-bit channels + padding + 64-bit timestamp + **/ struct hmc5843_data { struct device *dev; struct mutex lock; struct regmap *regmap; const struct hmc5843_chip_info *variant; - __be16 buffer[8]; /* 3x 16-bit channels + padding + 64-bit timestamp */ + __be16 buffer[8]; }; int hmc5843_common_probe(struct device *dev, struct regmap *regmap, -- cgit v1.2.3 From e6767051951353d0156efc80f7c7aa87d632d22c Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sun, 22 Mar 2015 20:42:42 +0200 Subject: Staging: iio: Place driver in sleep mode on error Put device in sleep mode if an error is encountered after initialization in order to avoid wasting power. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/magnetometer/hmc5843_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c index 0074af2750a5..6f6e96d71462 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_core.c +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c @@ -611,7 +611,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap, ret = iio_triggered_buffer_setup(indio_dev, NULL, hmc5843_trigger_handler, NULL); if (ret < 0) - return ret; + goto buffer_setup_err; ret = iio_device_register(indio_dev); if (ret < 0) @@ -621,6 +621,8 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap, buffer_cleanup: iio_triggered_buffer_cleanup(indio_dev); +buffer_setup_err: + hmc5843_set_mode(iio_priv(indio_dev), HMC5843_MODE_SLEEP); return ret; } EXPORT_SYMBOL(hmc5843_common_probe); -- cgit v1.2.3 From 6cf23dfffd3c69fc5cf5e2ca6fee0ab7eb316812 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sun, 22 Mar 2015 20:43:16 +0200 Subject: Staging: iio: Fix file header to match standards Fix file header to match Linux Kernel style. Remove Free Software Foundation reference to silence the checkpatch.pl warning. Add driver description and correct spelling mistakes. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/magnetometer/hmc5843_core.c | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c index 6f6e96d71462..fffca3a9f637 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_core.c +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c @@ -1,25 +1,25 @@ -/* Copyright (C) 2010 Texas Instruments - Author: Shubhrajyoti Datta - Acknowledgement: Jonathan Cameron for valuable inputs. - - Support for HMC5883 and HMC5883L by Peter Meerwald . - - Split to multiple files by Josef Gajdusek - 2014 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ +/* + * Device driver for the the HMC5843 multi-chip module designed + * for low field magnetic sensing. + * + * Copyright (C) 2010 Texas Instruments + * + * Author: Shubhrajyoti Datta + * Acknowledgment: Jonathan Cameron for valuable inputs. + * Support for HMC5883 and HMC5883L by Peter Meerwald . + * Split to multiple files by Josef Gajdusek - 2014 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ #include #include -- cgit v1.2.3 From 0c76706967dd15b58dfc132d1dc46e13edb86424 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sun, 22 Mar 2015 21:23:23 +0300 Subject: Staging: iio: use the BIT macro in .h files This patch replace bit shifting on 1, 2, and 3 with the BIT(x) macro. Issue addressed by checkpatch.pl with --strict flag. This was done with the help of Coccninelle: @r1@ constant int g; @@ ( 0< Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/adis16201.h | 18 ++++++++-------- drivers/staging/iio/accel/adis16203.h | 24 ++++++++++----------- drivers/staging/iio/accel/adis16204.h | 22 +++++++++---------- drivers/staging/iio/accel/adis16209.h | 22 +++++++++---------- drivers/staging/iio/accel/adis16220.h | 40 +++++++++++++++++------------------ drivers/staging/iio/accel/adis16240.h | 30 +++++++++++++------------- drivers/staging/iio/adc/ad7280a.h | 8 +++---- 7 files changed, 82 insertions(+), 82 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/adis16201.h b/drivers/staging/iio/accel/adis16201.h index 8747de5a9805..e6b8c9af6e22 100644 --- a/drivers/staging/iio/accel/adis16201.h +++ b/drivers/staging/iio/accel/adis16201.h @@ -34,24 +34,24 @@ #define ADIS16201_GLOB_CMD 0x3E /* Operation, system command register */ /* MSC_CTRL */ -#define ADIS16201_MSC_CTRL_SELF_TEST_EN (1 << 8) /* Self-test enable */ -#define ADIS16201_MSC_CTRL_DATA_RDY_EN (1 << 2) /* Data-ready enable: 1 = enabled, 0 = disabled */ -#define ADIS16201_MSC_CTRL_ACTIVE_HIGH (1 << 1) /* Data-ready polarity: 1 = active high, 0 = active low */ -#define ADIS16201_MSC_CTRL_DATA_RDY_DIO1 (1 << 0) /* Data-ready line selection: 1 = DIO1, 0 = DIO0 */ +#define ADIS16201_MSC_CTRL_SELF_TEST_EN BIT(8) /* Self-test enable */ +#define ADIS16201_MSC_CTRL_DATA_RDY_EN BIT(2) /* Data-ready enable: 1 = enabled, 0 = disabled */ +#define ADIS16201_MSC_CTRL_ACTIVE_HIGH BIT(1) /* Data-ready polarity: 1 = active high, 0 = active low */ +#define ADIS16201_MSC_CTRL_DATA_RDY_DIO1 BIT(0) /* Data-ready line selection: 1 = DIO1, 0 = DIO0 */ /* DIAG_STAT */ -#define ADIS16201_DIAG_STAT_ALARM2 (1<<9) /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */ -#define ADIS16201_DIAG_STAT_ALARM1 (1<<8) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */ +#define ADIS16201_DIAG_STAT_ALARM2 BIT(9) /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */ +#define ADIS16201_DIAG_STAT_ALARM1 BIT(8) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */ #define ADIS16201_DIAG_STAT_SPI_FAIL_BIT 3 /* SPI communications failure */ #define ADIS16201_DIAG_STAT_FLASH_UPT_BIT 2 /* Flash update failure */ #define ADIS16201_DIAG_STAT_POWER_HIGH_BIT 1 /* Power supply above 3.625 V */ #define ADIS16201_DIAG_STAT_POWER_LOW_BIT 0 /* Power supply below 3.15 V */ /* GLOB_CMD */ -#define ADIS16201_GLOB_CMD_SW_RESET (1<<7) -#define ADIS16201_GLOB_CMD_FACTORY_CAL (1<<1) +#define ADIS16201_GLOB_CMD_SW_RESET BIT(7) +#define ADIS16201_GLOB_CMD_FACTORY_CAL BIT(1) -#define ADIS16201_ERROR_ACTIVE (1<<14) +#define ADIS16201_ERROR_ACTIVE BIT(14) enum adis16201_scan { ADIS16201_SCAN_ACC_X, diff --git a/drivers/staging/iio/accel/adis16203.h b/drivers/staging/iio/accel/adis16203.h index acc688d7ea9e..6426e38bf006 100644 --- a/drivers/staging/iio/accel/adis16203.h +++ b/drivers/staging/iio/accel/adis16203.h @@ -25,16 +25,16 @@ #define ADIS16203_GLOB_CMD 0x3E /* Operation, system command register */ /* MSC_CTRL */ -#define ADIS16203_MSC_CTRL_PWRUP_SELF_TEST (1 << 10) /* Self-test at power-on: 1 = disabled, 0 = enabled */ -#define ADIS16203_MSC_CTRL_REVERSE_ROT_EN (1 << 9) /* Reverses rotation of both inclination outputs */ -#define ADIS16203_MSC_CTRL_SELF_TEST_EN (1 << 8) /* Self-test enable */ -#define ADIS16203_MSC_CTRL_DATA_RDY_EN (1 << 2) /* Data-ready enable: 1 = enabled, 0 = disabled */ -#define ADIS16203_MSC_CTRL_ACTIVE_HIGH (1 << 1) /* Data-ready polarity: 1 = active high, 0 = active low */ -#define ADIS16203_MSC_CTRL_DATA_RDY_DIO1 (1 << 0) /* Data-ready line selection: 1 = DIO1, 0 = DIO0 */ +#define ADIS16203_MSC_CTRL_PWRUP_SELF_TEST BIT(10) /* Self-test at power-on: 1 = disabled, 0 = enabled */ +#define ADIS16203_MSC_CTRL_REVERSE_ROT_EN BIT(9) /* Reverses rotation of both inclination outputs */ +#define ADIS16203_MSC_CTRL_SELF_TEST_EN BIT(8) /* Self-test enable */ +#define ADIS16203_MSC_CTRL_DATA_RDY_EN BIT(2) /* Data-ready enable: 1 = enabled, 0 = disabled */ +#define ADIS16203_MSC_CTRL_ACTIVE_HIGH BIT(1) /* Data-ready polarity: 1 = active high, 0 = active low */ +#define ADIS16203_MSC_CTRL_DATA_RDY_DIO1 BIT(0) /* Data-ready line selection: 1 = DIO1, 0 = DIO0 */ /* DIAG_STAT */ -#define ADIS16203_DIAG_STAT_ALARM2 (1<<9) /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */ -#define ADIS16203_DIAG_STAT_ALARM1 (1<<8) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */ +#define ADIS16203_DIAG_STAT_ALARM2 BIT(9) /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */ +#define ADIS16203_DIAG_STAT_ALARM1 BIT(8) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */ #define ADIS16203_DIAG_STAT_SELFTEST_FAIL_BIT 5 /* Self-test diagnostic error flag */ #define ADIS16203_DIAG_STAT_SPI_FAIL_BIT 3 /* SPI communications failure */ #define ADIS16203_DIAG_STAT_FLASH_UPT_BIT 2 /* Flash update failure */ @@ -42,11 +42,11 @@ #define ADIS16203_DIAG_STAT_POWER_LOW_BIT 0 /* Power supply below 3.15 V */ /* GLOB_CMD */ -#define ADIS16203_GLOB_CMD_SW_RESET (1<<7) -#define ADIS16203_GLOB_CMD_CLEAR_STAT (1<<4) -#define ADIS16203_GLOB_CMD_FACTORY_CAL (1<<1) +#define ADIS16203_GLOB_CMD_SW_RESET BIT(7) +#define ADIS16203_GLOB_CMD_CLEAR_STAT BIT(4) +#define ADIS16203_GLOB_CMD_FACTORY_CAL BIT(1) -#define ADIS16203_ERROR_ACTIVE (1<<14) +#define ADIS16203_ERROR_ACTIVE BIT(14) enum adis16203_scan { ADIS16203_SCAN_INCLI_X, diff --git a/drivers/staging/iio/accel/adis16204.h b/drivers/staging/iio/accel/adis16204.h index 9ff950c1e8db..0b23f0b5c52f 100644 --- a/drivers/staging/iio/accel/adis16204.h +++ b/drivers/staging/iio/accel/adis16204.h @@ -33,15 +33,15 @@ #define ADIS16204_GLOB_CMD 0x3E /* Operation, system command register */ /* MSC_CTRL */ -#define ADIS16204_MSC_CTRL_PWRUP_SELF_TEST (1 << 10) /* Self-test at power-on: 1 = disabled, 0 = enabled */ -#define ADIS16204_MSC_CTRL_SELF_TEST_EN (1 << 8) /* Self-test enable */ -#define ADIS16204_MSC_CTRL_DATA_RDY_EN (1 << 2) /* Data-ready enable: 1 = enabled, 0 = disabled */ -#define ADIS16204_MSC_CTRL_ACTIVE_HIGH (1 << 1) /* Data-ready polarity: 1 = active high, 0 = active low */ -#define ADIS16204_MSC_CTRL_DATA_RDY_DIO2 (1 << 0) /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */ +#define ADIS16204_MSC_CTRL_PWRUP_SELF_TEST BIT(10) /* Self-test at power-on: 1 = disabled, 0 = enabled */ +#define ADIS16204_MSC_CTRL_SELF_TEST_EN BIT(8) /* Self-test enable */ +#define ADIS16204_MSC_CTRL_DATA_RDY_EN BIT(2) /* Data-ready enable: 1 = enabled, 0 = disabled */ +#define ADIS16204_MSC_CTRL_ACTIVE_HIGH BIT(1) /* Data-ready polarity: 1 = active high, 0 = active low */ +#define ADIS16204_MSC_CTRL_DATA_RDY_DIO2 BIT(0) /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */ /* DIAG_STAT */ -#define ADIS16204_DIAG_STAT_ALARM2 (1<<9) /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */ -#define ADIS16204_DIAG_STAT_ALARM1 (1<<8) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */ +#define ADIS16204_DIAG_STAT_ALARM2 BIT(9) /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */ +#define ADIS16204_DIAG_STAT_ALARM1 BIT(8) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */ #define ADIS16204_DIAG_STAT_SELFTEST_FAIL_BIT 5 /* Self-test diagnostic error flag: 1 = error condition, 0 = normal operation */ #define ADIS16204_DIAG_STAT_SPI_FAIL_BIT 3 /* SPI communications failure */ @@ -50,11 +50,11 @@ #define ADIS16204_DIAG_STAT_POWER_LOW_BIT 0 /* Power supply below 2.975 V */ /* GLOB_CMD */ -#define ADIS16204_GLOB_CMD_SW_RESET (1<<7) -#define ADIS16204_GLOB_CMD_CLEAR_STAT (1<<4) -#define ADIS16204_GLOB_CMD_FACTORY_CAL (1<<1) +#define ADIS16204_GLOB_CMD_SW_RESET BIT(7) +#define ADIS16204_GLOB_CMD_CLEAR_STAT BIT(4) +#define ADIS16204_GLOB_CMD_FACTORY_CAL BIT(1) -#define ADIS16204_ERROR_ACTIVE (1<<14) +#define ADIS16204_ERROR_ACTIVE BIT(14) enum adis16204_scan { ADIS16204_SCAN_ACC_X, diff --git a/drivers/staging/iio/accel/adis16209.h b/drivers/staging/iio/accel/adis16209.h index ad3945a06292..813698d18ec8 100644 --- a/drivers/staging/iio/accel/adis16209.h +++ b/drivers/staging/iio/accel/adis16209.h @@ -60,21 +60,21 @@ /* MSC_CTRL */ /* Self-test at power-on: 1 = disabled, 0 = enabled */ -#define ADIS16209_MSC_CTRL_PWRUP_SELF_TEST (1 << 10) +#define ADIS16209_MSC_CTRL_PWRUP_SELF_TEST BIT(10) /* Self-test enable */ -#define ADIS16209_MSC_CTRL_SELF_TEST_EN (1 << 8) +#define ADIS16209_MSC_CTRL_SELF_TEST_EN BIT(8) /* Data-ready enable: 1 = enabled, 0 = disabled */ -#define ADIS16209_MSC_CTRL_DATA_RDY_EN (1 << 2) +#define ADIS16209_MSC_CTRL_DATA_RDY_EN BIT(2) /* Data-ready polarity: 1 = active high, 0 = active low */ -#define ADIS16209_MSC_CTRL_ACTIVE_HIGH (1 << 1) +#define ADIS16209_MSC_CTRL_ACTIVE_HIGH BIT(1) /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */ -#define ADIS16209_MSC_CTRL_DATA_RDY_DIO2 (1 << 0) +#define ADIS16209_MSC_CTRL_DATA_RDY_DIO2 BIT(0) /* DIAG_STAT */ /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */ -#define ADIS16209_DIAG_STAT_ALARM2 (1<<9) +#define ADIS16209_DIAG_STAT_ALARM2 BIT(9) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */ -#define ADIS16209_DIAG_STAT_ALARM1 (1<<8) +#define ADIS16209_DIAG_STAT_ALARM1 BIT(8) /* Self-test diagnostic error flag: 1 = error condition, 0 = normal operation */ #define ADIS16209_DIAG_STAT_SELFTEST_FAIL_BIT 5 /* SPI communications failure */ @@ -87,11 +87,11 @@ #define ADIS16209_DIAG_STAT_POWER_LOW_BIT 0 /* GLOB_CMD */ -#define ADIS16209_GLOB_CMD_SW_RESET (1<<7) -#define ADIS16209_GLOB_CMD_CLEAR_STAT (1<<4) -#define ADIS16209_GLOB_CMD_FACTORY_CAL (1<<1) +#define ADIS16209_GLOB_CMD_SW_RESET BIT(7) +#define ADIS16209_GLOB_CMD_CLEAR_STAT BIT(4) +#define ADIS16209_GLOB_CMD_FACTORY_CAL BIT(1) -#define ADIS16209_ERROR_ACTIVE (1<<14) +#define ADIS16209_ERROR_ACTIVE BIT(14) #define ADIS16209_SCAN_SUPPLY 0 #define ADIS16209_SCAN_ACC_X 1 diff --git a/drivers/staging/iio/accel/adis16220.h b/drivers/staging/iio/accel/adis16220.h index a894ad7fb26d..eab86331124f 100644 --- a/drivers/staging/iio/accel/adis16220.h +++ b/drivers/staging/iio/accel/adis16220.h @@ -71,35 +71,35 @@ #define ADIS16220_CAPTURE_SIZE 2048 /* MSC_CTRL */ -#define ADIS16220_MSC_CTRL_SELF_TEST_EN (1 << 8) -#define ADIS16220_MSC_CTRL_POWER_SUP_COM_AIN1 (1 << 1) -#define ADIS16220_MSC_CTRL_POWER_SUP_COM_AIN2 (1 << 0) +#define ADIS16220_MSC_CTRL_SELF_TEST_EN BIT(8) +#define ADIS16220_MSC_CTRL_POWER_SUP_COM_AIN1 BIT(1) +#define ADIS16220_MSC_CTRL_POWER_SUP_COM_AIN2 BIT(0) /* DIO_CTRL */ -#define ADIS16220_MSC_CTRL_DIO2_BUSY_IND (3<<4) -#define ADIS16220_MSC_CTRL_DIO1_BUSY_IND (3<<2) -#define ADIS16220_MSC_CTRL_DIO2_ACT_HIGH (1<<1) -#define ADIS16220_MSC_CTRL_DIO1_ACT_HIGH (1<<0) +#define ADIS16220_MSC_CTRL_DIO2_BUSY_IND (BIT(5) | BIT(4)) +#define ADIS16220_MSC_CTRL_DIO1_BUSY_IND (BIT(3) | BIT(2)) +#define ADIS16220_MSC_CTRL_DIO2_ACT_HIGH BIT(1) +#define ADIS16220_MSC_CTRL_DIO1_ACT_HIGH BIT(0) /* DIAG_STAT */ /* AIN2 sample > ALM_MAG2 */ -#define ADIS16220_DIAG_STAT_ALM_MAG2 (1<<14) +#define ADIS16220_DIAG_STAT_ALM_MAG2 BIT(14) /* AIN1 sample > ALM_MAG1 */ -#define ADIS16220_DIAG_STAT_ALM_MAG1 (1<<13) +#define ADIS16220_DIAG_STAT_ALM_MAG1 BIT(13) /* Acceleration sample > ALM_MAGA */ -#define ADIS16220_DIAG_STAT_ALM_MAGA (1<<12) +#define ADIS16220_DIAG_STAT_ALM_MAGA BIT(12) /* Error condition programmed into ALM_MAGS[11:0] and ALM_CTRL[5:4] is true */ -#define ADIS16220_DIAG_STAT_ALM_MAGS (1<<11) +#define ADIS16220_DIAG_STAT_ALM_MAGS BIT(11) /* |Peak value in AIN2 data capture| > ALM_MAG2 */ -#define ADIS16220_DIAG_STAT_PEAK_AIN2 (1<<10) +#define ADIS16220_DIAG_STAT_PEAK_AIN2 BIT(10) /* |Peak value in AIN1 data capture| > ALM_MAG1 */ -#define ADIS16220_DIAG_STAT_PEAK_AIN1 (1<<9) +#define ADIS16220_DIAG_STAT_PEAK_AIN1 BIT(9) /* |Peak value in acceleration data capture| > ALM_MAGA */ -#define ADIS16220_DIAG_STAT_PEAK_ACCEL (1<<8) +#define ADIS16220_DIAG_STAT_PEAK_ACCEL BIT(8) /* Data ready, capture complete */ -#define ADIS16220_DIAG_STAT_DATA_RDY (1<<7) -#define ADIS16220_DIAG_STAT_FLASH_CHK (1<<6) -#define ADIS16220_DIAG_STAT_SELF_TEST (1<<5) +#define ADIS16220_DIAG_STAT_DATA_RDY BIT(7) +#define ADIS16220_DIAG_STAT_FLASH_CHK BIT(6) +#define ADIS16220_DIAG_STAT_SELF_TEST BIT(5) /* Capture period violation/interruption */ #define ADIS16220_DIAG_STAT_VIOLATION_BIT 4 /* SPI communications failure */ @@ -112,9 +112,9 @@ #define ADIS16220_DIAG_STAT_POWER_LOW_BIT 0 /* GLOB_CMD */ -#define ADIS16220_GLOB_CMD_SW_RESET (1<<7) -#define ADIS16220_GLOB_CMD_SELF_TEST (1<<2) -#define ADIS16220_GLOB_CMD_PWR_DOWN (1<<1) +#define ADIS16220_GLOB_CMD_SW_RESET BIT(7) +#define ADIS16220_GLOB_CMD_SELF_TEST BIT(2) +#define ADIS16220_GLOB_CMD_PWR_DOWN BIT(1) #define ADIS16220_MAX_TX 2048 #define ADIS16220_MAX_RX 2048 diff --git a/drivers/staging/iio/accel/adis16240.h b/drivers/staging/iio/accel/adis16240.h index d442d49f51f4..66b5ad2f42c5 100644 --- a/drivers/staging/iio/accel/adis16240.h +++ b/drivers/staging/iio/accel/adis16240.h @@ -74,31 +74,31 @@ /* MSC_CTRL */ /* Enables sum-of-squares output (XYZPEAK_OUT) */ -#define ADIS16240_MSC_CTRL_XYZPEAK_OUT_EN (1 << 15) +#define ADIS16240_MSC_CTRL_XYZPEAK_OUT_EN BIT(15) /* Enables peak tracking output (XPEAK_OUT, YPEAK_OUT, and ZPEAK_OUT) */ -#define ADIS16240_MSC_CTRL_X_Y_ZPEAK_OUT_EN (1 << 14) +#define ADIS16240_MSC_CTRL_X_Y_ZPEAK_OUT_EN BIT(14) /* Self-test enable: 1 = apply electrostatic force, 0 = disabled */ -#define ADIS16240_MSC_CTRL_SELF_TEST_EN (1 << 8) +#define ADIS16240_MSC_CTRL_SELF_TEST_EN BIT(8) /* Data-ready enable: 1 = enabled, 0 = disabled */ -#define ADIS16240_MSC_CTRL_DATA_RDY_EN (1 << 2) +#define ADIS16240_MSC_CTRL_DATA_RDY_EN BIT(2) /* Data-ready polarity: 1 = active high, 0 = active low */ -#define ADIS16240_MSC_CTRL_ACTIVE_HIGH (1 << 1) +#define ADIS16240_MSC_CTRL_ACTIVE_HIGH BIT(1) /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */ -#define ADIS16240_MSC_CTRL_DATA_RDY_DIO2 (1 << 0) +#define ADIS16240_MSC_CTRL_DATA_RDY_DIO2 BIT(0) /* DIAG_STAT */ /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */ -#define ADIS16240_DIAG_STAT_ALARM2 (1<<9) +#define ADIS16240_DIAG_STAT_ALARM2 BIT(9) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */ -#define ADIS16240_DIAG_STAT_ALARM1 (1<<8) +#define ADIS16240_DIAG_STAT_ALARM1 BIT(8) /* Capture buffer full: 1 = capture buffer is full */ -#define ADIS16240_DIAG_STAT_CPT_BUF_FUL (1<<7) +#define ADIS16240_DIAG_STAT_CPT_BUF_FUL BIT(7) /* Flash test, checksum flag: 1 = mismatch, 0 = match */ -#define ADIS16240_DIAG_STAT_CHKSUM (1<<6) +#define ADIS16240_DIAG_STAT_CHKSUM BIT(6) /* Power-on, self-test flag: 1 = failure, 0 = pass */ #define ADIS16240_DIAG_STAT_PWRON_FAIL_BIT 5 /* Power-on self-test: 1 = in-progress, 0 = complete */ -#define ADIS16240_DIAG_STAT_PWRON_BUSY (1<<4) +#define ADIS16240_DIAG_STAT_PWRON_BUSY BIT(4) /* SPI communications failure */ #define ADIS16240_DIAG_STAT_SPI_FAIL_BIT 3 /* Flash update failure */ @@ -109,11 +109,11 @@ #define ADIS16240_DIAG_STAT_POWER_LOW_BIT 0 /* GLOB_CMD */ -#define ADIS16240_GLOB_CMD_RESUME (1<<8) -#define ADIS16240_GLOB_CMD_SW_RESET (1<<7) -#define ADIS16240_GLOB_CMD_STANDBY (1<<2) +#define ADIS16240_GLOB_CMD_RESUME BIT(8) +#define ADIS16240_GLOB_CMD_SW_RESET BIT(7) +#define ADIS16240_GLOB_CMD_STANDBY BIT(2) -#define ADIS16240_ERROR_ACTIVE (1<<14) +#define ADIS16240_ERROR_ACTIVE BIT(14) /* At the moment triggers are only used for ring buffer * filling. This may change! diff --git a/drivers/staging/iio/adc/ad7280a.h b/drivers/staging/iio/adc/ad7280a.h index 20400b0045e5..732347a9bce4 100644 --- a/drivers/staging/iio/adc/ad7280a.h +++ b/drivers/staging/iio/adc/ad7280a.h @@ -23,10 +23,10 @@ #define AD7280A_CONV_AVG_4 2 #define AD7280A_CONV_AVG_8 3 -#define AD7280A_ALERT_REMOVE_VIN5 (1 << 2) -#define AD7280A_ALERT_REMOVE_VIN4_VIN5 (2 << 2) -#define AD7280A_ALERT_REMOVE_AUX5 (1 << 0) -#define AD7280A_ALERT_REMOVE_AUX4_AUX5 (2 << 0) +#define AD7280A_ALERT_REMOVE_VIN5 BIT(2) +#define AD7280A_ALERT_REMOVE_VIN4_VIN5 BIT(3) +#define AD7280A_ALERT_REMOVE_AUX5 BIT(0) +#define AD7280A_ALERT_REMOVE_AUX4_AUX5 BIT(1) struct ad7280_platform_data { unsigned acquisition_time; -- cgit v1.2.3 From c7d853268da2fd5d26addfd5ac5ca170d167a7ca Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Sat, 21 Mar 2015 13:50:05 -0300 Subject: staging: fbtft: remove trailing white space Clean useless trailing white spaces Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_st7735r.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_st7735r.c b/drivers/staging/fbtft/fb_st7735r.c index eb3af1d712d0..c1c6e58385a6 100644 --- a/drivers/staging/fbtft/fb_st7735r.c +++ b/drivers/staging/fbtft/fb_st7735r.c @@ -31,20 +31,20 @@ static int default_init_sequence[] = { /* SWRESET - Software reset */ - -1, 0x01, + -1, 0x01, -2, 150, /* delay */ /* SLPOUT - Sleep out & booster on */ - -1, 0x11, + -1, 0x11, -2, 500, /* delay */ /* FRMCTR1 - frame rate control: normal mode frame rate = fosc / (1 x 2 + 40) * (LINE + 2C + 2D) */ - -1, 0xB1, 0x01, 0x2C, 0x2D, + -1, 0xB1, 0x01, 0x2C, 0x2D, /* FRMCTR2 - frame rate control: idle mode frame rate = fosc / (1 x 2 + 40) * (LINE + 2C + 2D) */ - -1, 0xB2, 0x01, 0x2C, 0x2D, + -1, 0xB2, 0x01, 0x2C, 0x2D, /* FRMCTR3 - frame rate control - partial mode dot inversion mode, line inversion mode */ @@ -91,7 +91,7 @@ static int default_init_sequence[] = { -2, 10, /* delay */ /* end marker */ - -3 + -3 }; static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -- cgit v1.2.3 From 42efd0016cb4f5f2105775e7189ed9b7f03d6f61 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Fri, 20 Mar 2015 23:18:10 -0300 Subject: staging: fbtft: Fix indentation style by space This patch fixes the checkpatch.pl warning and error: WARNING: please, no spaces at the start of a line ERROR: code indent should use tabs where possible Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 0dbf3f95fe78..36ecf026d67d 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -326,8 +326,8 @@ static int fbtft_driver_remove_pdev(struct platform_device *pdev) \ } \ \ static const struct of_device_id dt_ids[] = { \ - { .compatible = _compatible }, \ - {}, \ + { .compatible = _compatible }, \ + {}, \ }; \ \ MODULE_DEVICE_TABLE(of, dt_ids); \ @@ -337,7 +337,7 @@ static struct spi_driver fbtft_driver_spi_driver = { \ .driver = { \ .name = _name, \ .owner = THIS_MODULE, \ - .of_match_table = of_match_ptr(dt_ids), \ + .of_match_table = of_match_ptr(dt_ids), \ }, \ .probe = fbtft_driver_probe_spi, \ .remove = fbtft_driver_remove_spi, \ @@ -347,7 +347,7 @@ static struct platform_driver fbtft_driver_platform_driver = { \ .driver = { \ .name = _name, \ .owner = THIS_MODULE, \ - .of_match_table = of_match_ptr(dt_ids), \ + .of_match_table = of_match_ptr(dt_ids), \ }, \ .probe = fbtft_driver_probe_pdev, \ .remove = fbtft_driver_remove_pdev, \ -- cgit v1.2.3 From 4c0dbe0a2e343197d3f86cb23e46fb5d57fa74ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatice=20ERT=C3=9CRK?= Date: Fri, 20 Mar 2015 21:25:20 +0200 Subject: Staging: rtl8188eu: Delete space Deleted spaces before ','.Because it is prohibited by the kernel coding style. Error found with checkpatch.pl Signed-off-by: Hatice ERTURK Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index a2055017dba2..11b780d6c4ab 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c @@ -788,7 +788,7 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen) * * Returns: the address of the specific WPS attribute found, or NULL */ -u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_attr, u32 *len_attr) +u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, u8 *buf_attr, u32 *len_attr) { u8 *attr_ptr = NULL; u8 *target_attr_ptr = NULL; @@ -798,7 +798,7 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_at *len_attr = 0; if ((wps_ie[0] != _VENDOR_SPECIFIC_IE_) || - (memcmp(wps_ie + 2, wps_oui , 4))) + (memcmp(wps_ie + 2, wps_oui, 4))) return attr_ptr; /* 6 = 1(Element ID) + 1(Length) + 4(WPS OUI) */ @@ -834,7 +834,7 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_at * * Returns: the address of the specific WPS attribute content found, or NULL */ -u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_content, uint *len_content) +u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, u8 *buf_content, uint *len_content) { u8 *attr_ptr; u32 attr_len; @@ -1238,7 +1238,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork) } else { pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_OPENSYS; } - rtw_get_sec_ie(pnetwork->network.IEs , pnetwork->network.IELength, NULL, &rsn_len, NULL, &wpa_len); + rtw_get_sec_ie(pnetwork->network.IEs, pnetwork->network.IELength, NULL, &rsn_len, NULL, &wpa_len); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_get_bcn_info: ssid =%s\n", pnetwork->network.Ssid.Ssid)); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_get_bcn_info: wpa_len =%d rsn_len =%d\n", wpa_len, rsn_len)); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_get_bcn_info: ssid =%s\n", pnetwork->network.Ssid.Ssid)); -- cgit v1.2.3 From c84b528c082a396443104f6931691948c088d94b Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Sat, 21 Mar 2015 12:27:24 +0530 Subject: Staging: wlan-ng: Remove typedef prism2sta_authlist_t Remove typdef prism2sta_authlist_t and replace its uses in the code. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h index 73c646bc50d9..0461a00fb0a7 100644 --- a/drivers/staging/wlan-ng/hfa384x.h +++ b/drivers/staging/wlan-ng/hfa384x.h @@ -1204,11 +1204,11 @@ typedef struct hfa484x_metacmd { #define WLAN_ACCESS_DENY 3 /* Do not authenticate "denied" stations. */ /* XXX These are going away ASAP */ -typedef struct prism2sta_authlist { +struct prism2sta_authlist { unsigned int cnt; u8 addr[WLAN_AUTH_MAX][ETH_ALEN]; u8 assoc[WLAN_AUTH_MAX]; -} prism2sta_authlist_t; +}; typedef struct prism2sta_accesslist { unsigned int modify; @@ -1348,7 +1348,7 @@ typedef struct hfa384x { hfa384x_InfFrame_t *scanresults; - prism2sta_authlist_t authlist; /* Authenticated station list. */ + struct prism2sta_authlist authlist; /* Authenticated station list. */ unsigned int accessmode; /* Access mode. */ prism2sta_accesslist_t allow; /* Allowed station list. */ prism2sta_accesslist_t deny; /* Denied station list. */ -- cgit v1.2.3 From ed2be12e0a2901176ad2930443322d4aa53fe6b0 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 23 Mar 2015 16:54:08 -0400 Subject: staging: rtl8723au: Fix mis-placed break In 7c3a8f2a5ec95e2b13704562f36321e20ddfc190 I made a mistake and moved a break below a bracket, causing a situation where the for loop would always exit when it shouldn't. This patch corrects that mistake. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index d01ca1d75254..cafc82dd1ee9 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -1614,8 +1614,8 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) else pstat->uapsd_be = 0; + break; } - break; } else { break; } -- cgit v1.2.3 From 18f576f6da6626ef4e055c2ce17bd09cd97c36d3 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Sun, 22 Mar 2015 19:09:42 -0400 Subject: staging: rtl8723au: Fix trailing whitespace Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/odm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/odm.c b/drivers/staging/rtl8723au/hal/odm.c index 428b2b308f27..ec543cfe1b45 100644 --- a/drivers/staging/rtl8723au/hal/odm.c +++ b/drivers/staging/rtl8723au/hal/odm.c @@ -784,7 +784,7 @@ void odm_FalseAlarmCounterStatistics23a(struct dm_odm_t *pDM_Odm) val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_RSTC_11N); val32 &= ~BIT(31); rtl8723au_write32(adapter, ODM_REG_OFDM_FA_RSTC_11N, val32); - + val32 = rtl8723au_read32(adapter, ODM_REG_OFDM_FA_RSTD_11N); val32 |= BIT(27); rtl8723au_write32(adapter, ODM_REG_OFDM_FA_RSTD_11N, val32); -- cgit v1.2.3 From a113b53cd315a45a97bfec1c1d586433200954ef Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Sun, 22 Mar 2015 19:09:43 -0400 Subject: staging: rtl8723au: update_txdesc(): bagg_pkt is always false Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723au_xmit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c b/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c index 1759487329ab..6bc1297227be 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c +++ b/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c @@ -130,7 +130,7 @@ static void fill_txdesc_phy(struct pkt_attrib *pattrib, __le32 *pdw) } } -static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bagg_pkt) +static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz) { int pull = 0; uint qsel; @@ -143,7 +143,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; int bmcst = is_multicast_ether_addr(pattrib->ra); - if ((!bagg_pkt) && (urb_zero_packet_chk(padapter, sz) == 0)) { + if (urb_zero_packet_chk(padapter, sz) == 0) { ptxdesc = (struct tx_desc *)(pmem+PACKET_OFFSET_SZ); pull = 1; pxmitframe->pkt_offset--; @@ -320,7 +320,7 @@ static int rtw_dump_xframe(struct rtw_adapter *padapter, sz = pattrib->last_txcmdsz; } - pull = update_txdesc(pxmitframe, mem_addr, sz, false); + pull = update_txdesc(pxmitframe, mem_addr, sz); if (pull) { mem_addr += PACKET_OFFSET_SZ; /* pull txdesc head */ -- cgit v1.2.3 From 5026df93d23995407cf0f024edbb16e03f367112 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Sun, 22 Mar 2015 19:09:44 -0400 Subject: staging: rtl8723au: Do not byteswap timeout twice Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index cafc82dd1ee9..1267268de349 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -3767,7 +3767,6 @@ void issue_action_BA23a(struct rtw_adapter *padapter, { u16 start_seq; u16 BA_para_set; - u16 BA_timeout_value; u16 BA_starting_seqctrl; u16 BA_para; int max_rx_ampdu_factor; @@ -3848,10 +3847,8 @@ void issue_action_BA23a(struct rtw_adapter *padapter, put_unaligned_le16(BA_para_set, &mgmt->u.action.u.addba_req.capab); - BA_timeout_value = 5000;/* 5ms */ - BA_timeout_value = cpu_to_le16(BA_timeout_value); - put_unaligned_le16(BA_timeout_value, - &mgmt->u.action.u.addba_req.timeout); + /* 5ms */ + put_unaligned_le16(5000, &mgmt->u.action.u.addba_req.timeout); psta = rtw_get_stainfo23a(pstapriv, raddr); if (psta) { -- cgit v1.2.3 From 4d10ece3336fbd75ed25ba48ecfb14f5a8a151ec Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Sat, 21 Mar 2015 12:27:34 +0530 Subject: Staging: wlan-ng: Remove typedef prism2sta_accesslist_t Remove typedef prism2sta_accesslist_t and replace its uses in the code. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h index 0461a00fb0a7..8dfe4381ddf7 100644 --- a/drivers/staging/wlan-ng/hfa384x.h +++ b/drivers/staging/wlan-ng/hfa384x.h @@ -1210,13 +1210,13 @@ struct prism2sta_authlist { u8 assoc[WLAN_AUTH_MAX]; }; -typedef struct prism2sta_accesslist { +struct prism2sta_accesslist { unsigned int modify; unsigned int cnt; u8 addr[WLAN_ACCESS_MAX][ETH_ALEN]; unsigned int cnt1; u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN]; -} prism2sta_accesslist_t; +}; typedef struct hfa384x { /* USB support data */ @@ -1349,9 +1349,9 @@ typedef struct hfa384x { hfa384x_InfFrame_t *scanresults; struct prism2sta_authlist authlist; /* Authenticated station list. */ - unsigned int accessmode; /* Access mode. */ - prism2sta_accesslist_t allow; /* Allowed station list. */ - prism2sta_accesslist_t deny; /* Denied station list. */ + unsigned int accessmode; /* Access mode. */ + struct prism2sta_accesslist allow; /* Allowed station list. */ + struct prism2sta_accesslist deny; /* Denied station list. */ } hfa384x_t; -- cgit v1.2.3 From a51bab6d42be47ae5df899bd7f72bcd4b4c321bf Mon Sep 17 00:00:00 2001 From: Somya Anand Date: Sun, 22 Mar 2015 14:49:29 +0530 Subject: Staging: rtl8723au: Remove unused function rtw_atimdone_event_callback23a This patch fixes the following sparse warning: warning: symbol 'rtw_atimdone_event_callback23a' was not declared. Should it be static? rtw_atimdone_event_callback23a is local to the file rtw_mlme.c but it isn't exposed in a header file anywhere. Moreover it is never called from anywhere as well. So, this patch removes this function completely. Signed-off-by: Somya Anand Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_mlme.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index 7299ef0a2e54..d6593a24469f 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -568,13 +568,6 @@ static int rtw_is_desired_network(struct rtw_adapter *adapter, return bselected; } -/* TODO: Perry : For Power Management */ -void rtw_atimdone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) -{ - RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("receive atimdone_evet\n")); -} - void rtw_survey_event_cb23a(struct rtw_adapter *adapter, const u8 *pbuf) { u32 len; -- cgit v1.2.3 From be546c6cd0a9ad742f1dc7869acdf2d80971ddb5 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Sun, 22 Mar 2015 03:02:02 +0300 Subject: Staging: media: remove useless dev_info to avoid null ptr dereference Context is used in dev_info after it has been freed. This patch fix that issue by removing the dev_info itself, for msg doesn't look much necessary. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_sasem.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index 0c9e08247d7f..9e5674341abe 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -170,10 +170,6 @@ static void delete_context(struct sasem_context *context) kfree(context->driver->rbuf); kfree(context->driver); kfree(context); - - if (debug) - dev_info(&context->dev->dev, "%s: context deleted\n", - __func__); } static void deregister_from_lirc(struct sasem_context *context) -- cgit v1.2.3 From ef8a83e79148bc6311a4227b23d57e3a172f1479 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sun, 22 Mar 2015 20:49:28 +0200 Subject: Staging: rtl8192u: Make function prototypes static Make functions static since they are used locally and no other files refer them. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index f6096568ffea..9b31cd0dc741 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -409,8 +409,8 @@ inline void force_pci_posting(struct net_device *dev) static struct net_device_stats *rtl8192_stats(struct net_device *dev); void rtl8192_commit(struct net_device *dev); -void rtl8192_restart(struct work_struct *work); -void watch_dog_timer_callback(unsigned long data); +static void rtl8192_restart(struct work_struct *work); +static void watch_dog_timer_callback(unsigned long data); /**************************************************************************** * -----------------------------PROCFS STUFF------------------------- @@ -1763,7 +1763,7 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) } #endif -extern void rtl8192_update_ratr_table(struct net_device *dev); +static void rtl8192_update_ratr_table(struct net_device *dev); static void rtl8192_link_change(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -2243,9 +2243,9 @@ static void rtl8192_init_priv_lock(struct r8192_priv *priv) mutex_init(&priv->mutex); } -extern void rtl819x_watchdog_wqcallback(struct work_struct *work); +static void rtl819x_watchdog_wqcallback(struct work_struct *work); -void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); +static void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); //init tasklet and wait_queue here. only 2.6 above kernel is considered #define DRV_NAME "wlan0" static void rtl8192_init_priv_task(struct net_device *dev) @@ -3017,9 +3017,9 @@ static RESET_TYPE rtl819x_ifcheck_resetornot(struct net_device *dev) } -void rtl8192_cancel_deferred_work(struct r8192_priv *priv); -int _rtl8192_up(struct net_device *dev); -int rtl8192_close(struct net_device *dev); +static void rtl8192_cancel_deferred_work(struct r8192_priv *priv); +static int _rtl8192_up(struct net_device *dev); +static int rtl8192_close(struct net_device *dev); -- cgit v1.2.3 From 3659f9c2aaabced5d0db23fa8b485a69f31c31b3 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sun, 22 Mar 2015 20:49:51 +0200 Subject: Staging: rtl8192u: Remove function prototype from .c file Remove function prototype from r8192U_core.c since it is declared in the r8192U.h header and this is included in r8192U_core.c Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 9b31cd0dc741..8834c23d67fc 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -408,7 +408,6 @@ inline void force_pci_posting(struct net_device *dev) } static struct net_device_stats *rtl8192_stats(struct net_device *dev); -void rtl8192_commit(struct net_device *dev); static void rtl8192_restart(struct work_struct *work); static void watch_dog_timer_callback(unsigned long data); -- cgit v1.2.3 From 607078fcb1614b505a4904ab51a2eb2ebf6b9d7b Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:45 +0200 Subject: staging: octeon-usb: remove internal function parameter sanity checks Remove some function parameter sanity checks from internal functions where we can rely them being called with sane parameters. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 41 --------------------------------- 1 file changed, 41 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 959123279ce8..169bc099f14c 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -231,15 +231,6 @@ enum cvmx_usb_pipe_flags { /* Maximum number of hardware channels supported by the USB block */ #define MAX_CHANNELS 8 -/* The highest valid USB device address */ -#define MAX_USB_ADDRESS 127 - -/* The highest valid USB endpoint number */ -#define MAX_USB_ENDPOINT 15 - -/* The highest valid port number on a hub */ -#define MAX_USB_HUB_PORT 15 - /* * The low level hardware can transfer a maximum of this number of bytes in each * transfer. The field is 19 bits wide @@ -675,10 +666,6 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status; int i; - /* At first allow 0-1 for the usb port number */ - if ((usb_port_number < 0) || (usb_port_number > 1)) - return -EINVAL; - memset(usb, 0, sizeof(*usb)); usb->init_flags = flags; @@ -1223,34 +1210,6 @@ static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct cvmx_usb_state *usb, { struct cvmx_usb_pipe *pipe; - if (unlikely((device_addr < 0) || (device_addr > MAX_USB_ADDRESS))) - return NULL; - if (unlikely((endpoint_num < 0) || (endpoint_num > MAX_USB_ENDPOINT))) - return NULL; - if (unlikely(device_speed > CVMX_USB_SPEED_LOW)) - return NULL; - if (unlikely((max_packet <= 0) || (max_packet > 1024))) - return NULL; - if (unlikely(transfer_type > CVMX_USB_TRANSFER_INTERRUPT)) - return NULL; - if (unlikely((transfer_dir != CVMX_USB_DIRECTION_OUT) && - (transfer_dir != CVMX_USB_DIRECTION_IN))) - return NULL; - if (unlikely(interval < 0)) - return NULL; - if (unlikely((transfer_type == CVMX_USB_TRANSFER_CONTROL) && interval)) - return NULL; - if (unlikely(multi_count < 0)) - return NULL; - if (unlikely((device_speed != CVMX_USB_SPEED_HIGH) && - (multi_count != 0))) - return NULL; - if (unlikely((hub_device_addr < 0) || - (hub_device_addr > MAX_USB_ADDRESS))) - return NULL; - if (unlikely((hub_port < 0) || (hub_port > MAX_USB_HUB_PORT))) - return NULL; - pipe = kzalloc(sizeof(*pipe), GFP_ATOMIC); if (!pipe) return NULL; -- cgit v1.2.3 From c4bdbdd916036effd90b18165819879b01c1fed8 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:46 +0200 Subject: staging: octeon-usb: eliminate 64-bit register access wrappers Eliminate 64-bit register access wrappers. Since we don't implement register-level debugging outputs, these are useless. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 108 ++++++++++---------------------- 1 file changed, 33 insertions(+), 75 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 169bc099f14c..239606555db7 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -581,38 +581,6 @@ static inline void __cvmx_usb_write_csr32(struct cvmx_usb_state *usb, cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index)); } - -/** - * Read a USB 64bit CSR. It logs the value in a readable format if - * debugging is on. - * - * @usb: USB block this access is for - * @address: 64bit address to read - * - * Returns: Result of the read - */ -static inline uint64_t __cvmx_usb_read_csr64(struct cvmx_usb_state *usb, - uint64_t address) -{ - uint64_t result = cvmx_read64_uint64(address); - return result; -} - - -/** - * Write a USB 64bit CSR. It logs the value in a readable format - * if debugging is on. - * - * @usb: USB block this access is for - * @address: 64bit address to write - * @value: Value to write - */ -static inline void __cvmx_usb_write_csr64(struct cvmx_usb_state *usb, - uint64_t address, uint64_t value) -{ - cvmx_write64_uint64(address, value); -} - /** * Return non zero if this pipe connects to a non HIGH speed * device through a high speed hub. @@ -683,8 +651,7 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, * 2a. Write USBN0/1_CLK_CTL[POR] = 1 and * USBN0/1_CLK_CTL[HRST,PRST,HCLK_RST] = 0 */ - usbn_clk_ctl.u64 = - __cvmx_usb_read_csr64(usb, CVMX_USBNX_CLK_CTL(usb->index)); + usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index)); usbn_clk_ctl.s.por = 1; usbn_clk_ctl.s.hrst = 0; usbn_clk_ctl.s.prst = 0; @@ -747,12 +714,10 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, usbn_clk_ctl.s.divide = divisor; usbn_clk_ctl.s.divide2 = 0; } - __cvmx_usb_write_csr64(usb, CVMX_USBNX_CLK_CTL(usb->index), - usbn_clk_ctl.u64); + cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); /* 2d. Write USBN0/1_CLK_CTL[HCLK_RST] = 1 */ usbn_clk_ctl.s.hclk_rst = 1; - __cvmx_usb_write_csr64(usb, CVMX_USBNX_CLK_CTL(usb->index), - usbn_clk_ctl.u64); + cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); /* 2e. Wait 64 core-clock cycles for HCLK to stabilize */ cvmx_wait(64); /* @@ -761,8 +726,7 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, * USBN_CLK_CTL[POR] = 0 */ usbn_clk_ctl.s.por = 0; - __cvmx_usb_write_csr64(usb, CVMX_USBNX_CLK_CTL(usb->index), - usbn_clk_ctl.u64); + cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); /* 4. Wait 1 ms for PHY clock to start */ mdelay(1); /* @@ -770,11 +734,11 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, * USBP control and status register: * USBN_USBP_CTL_STATUS[ATE_RESET] = 1 */ - usbn_usbp_ctl_status.u64 = __cvmx_usb_read_csr64(usb, - CVMX_USBNX_USBP_CTL_STATUS(usb->index)); + usbn_usbp_ctl_status.u64 = + cvmx_read64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index)); usbn_usbp_ctl_status.s.ate_reset = 1; - __cvmx_usb_write_csr64(usb, CVMX_USBNX_USBP_CTL_STATUS(usb->index), - usbn_usbp_ctl_status.u64); + cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index), + usbn_usbp_ctl_status.u64); /* 6. Wait 10 cycles */ cvmx_wait(10); /* @@ -782,23 +746,22 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, * USBN_USBP_CTL_STATUS[ATE_RESET] = 0 */ usbn_usbp_ctl_status.s.ate_reset = 0; - __cvmx_usb_write_csr64(usb, CVMX_USBNX_USBP_CTL_STATUS(usb->index), - usbn_usbp_ctl_status.u64); + cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index), + usbn_usbp_ctl_status.u64); /* * 8. Program the PHY reset field in the USBN clock-control register: * USBN_CLK_CTL[PRST] = 1 */ usbn_clk_ctl.s.prst = 1; - __cvmx_usb_write_csr64(usb, CVMX_USBNX_CLK_CTL(usb->index), - usbn_clk_ctl.u64); + cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); /* * 9. Program the USBP control and status register to select host or * device mode. USBN_USBP_CTL_STATUS[HST_MODE] = 0 for host, = 1 for * device */ usbn_usbp_ctl_status.s.hst_mode = 0; - __cvmx_usb_write_csr64(usb, CVMX_USBNX_USBP_CTL_STATUS(usb->index), - usbn_usbp_ctl_status.u64); + cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index), + usbn_usbp_ctl_status.u64); /* 10. Wait 1 us */ udelay(1); /* @@ -806,12 +769,10 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, * USBN_CLK_CTL[HRST] = 1 */ usbn_clk_ctl.s.hrst = 1; - __cvmx_usb_write_csr64(usb, CVMX_USBNX_CLK_CTL(usb->index), - usbn_clk_ctl.u64); + cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); /* 12. Proceed to USB core initialization */ usbn_clk_ctl.s.enable = 1; - __cvmx_usb_write_csr64(usb, CVMX_USBNX_CLK_CTL(usb->index), - usbn_clk_ctl.u64); + cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); udelay(1); /* @@ -969,15 +930,13 @@ static int cvmx_usb_shutdown(struct cvmx_usb_state *usb) return -EBUSY; /* Disable the clocks and put them in power on reset */ - usbn_clk_ctl.u64 = __cvmx_usb_read_csr64(usb, - CVMX_USBNX_CLK_CTL(usb->index)); + usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index)); usbn_clk_ctl.s.enable = 1; usbn_clk_ctl.s.por = 1; usbn_clk_ctl.s.hclk_rst = 1; usbn_clk_ctl.s.prst = 0; usbn_clk_ctl.s.hrst = 0; - __cvmx_usb_write_csr64(usb, CVMX_USBNX_CLK_CTL(usb->index), - usbn_clk_ctl.u64); + cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); return 0; } @@ -1286,13 +1245,12 @@ static void __cvmx_usb_poll_rx_fifo(struct cvmx_usb_state *usb) return; /* Get where the DMA engine would have written this data */ - address = __cvmx_usb_read_csr64(usb, - CVMX_USBNX_DMA0_INB_CHN0(usb->index) + channel*8); + address = cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + + channel * 8); ptr = cvmx_phys_to_ptr(address); - __cvmx_usb_write_csr64(usb, - CVMX_USBNX_DMA0_INB_CHN0(usb->index) + channel*8, - address + bytes); + cvmx_write64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + channel * 8, + address + bytes); /* Loop writing the FIFO data for this packet into memory */ while (bytes > 0) { @@ -1448,8 +1406,9 @@ static void __cvmx_usb_fill_tx_fifo(struct cvmx_usb_state *usb, int channel) fifo = &usb->nonperiodic; fifo->entry[fifo->head].channel = channel; - fifo->entry[fifo->head].address = __cvmx_usb_read_csr64(usb, - CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) + channel*8); + fifo->entry[fifo->head].address = + cvmx_read64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) + + channel * 8); fifo->entry[fifo->head].size = (usbc_hctsiz.s.xfersize+3)>>2; fifo->head++; if (fifo->head > MAX_CHANNELS) @@ -1503,9 +1462,9 @@ static void __cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, * Setup send the control header instead of the buffer data. The * buffer data will be used in the next stage */ - __cvmx_usb_write_csr64(usb, - CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) + channel*8, - transaction->control_header); + cvmx_write64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) + + channel * 8, + transaction->control_header); break; case CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE: usbc_hctsiz.s.pid = 3; /* Setup */ @@ -1696,13 +1655,12 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, transaction->iso_packets[0].offset + transaction->actual_bytes; - __cvmx_usb_write_csr64(usb, - CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) + channel*8, - dma_address); - - __cvmx_usb_write_csr64(usb, - CVMX_USBNX_DMA0_INB_CHN0(usb->index) + channel*8, - dma_address); + cvmx_write64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) + + channel * 8, + dma_address); + cvmx_write64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + + channel * 8, + dma_address); } /* Setup both the size of the transfer and the SPLIT characteristics */ -- cgit v1.2.3 From 68d435dd54ecfe7cb34d57204ed3ea4691fb83ea Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:47 +0200 Subject: staging: octeon-usb: remove useless prefix from internal routines Original CVMX code used "__" to distinguis internal USB functions from public ones. But in Linux all cvmx_usb routines are internal to this driver, so such separation is useless. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 424 +++++++++++++++----------------- 1 file changed, 205 insertions(+), 219 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 239606555db7..2994a464bd36 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -402,7 +402,7 @@ struct octeon_hcd { octeon_get_clock_rate() / 1000000; \ type c; \ while (1) { \ - c.u32 = __cvmx_usb_read_csr32(usb, address); \ + c.u32 = cvmx_usb_read_csr32(usb, address); \ if (c.s.field op (value)) { \ result = 0; \ break; \ @@ -422,9 +422,9 @@ struct octeon_hcd { #define USB_SET_FIELD32(address, type, field, value) \ do { \ type c; \ - c.u32 = __cvmx_usb_read_csr32(usb, address); \ + c.u32 = cvmx_usb_read_csr32(usb, address); \ c.s.field = value; \ - __cvmx_usb_write_csr32(usb, address, c.u32); \ + cvmx_usb_write_csr32(usb, address, c.u32); \ } while (0) /* Returns the IO address to push/pop stuff data from the FIFOs */ @@ -557,8 +557,8 @@ static void octeon_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) * * Returns: Result of the read */ -static inline uint32_t __cvmx_usb_read_csr32(struct cvmx_usb_state *usb, - uint64_t address) +static inline uint32_t cvmx_usb_read_csr32(struct cvmx_usb_state *usb, + uint64_t address) { uint32_t result = cvmx_read64_uint32(address ^ 4); return result; @@ -574,8 +574,8 @@ static inline uint32_t __cvmx_usb_read_csr32(struct cvmx_usb_state *usb, * @address: 64bit address to write * @value: Value to write */ -static inline void __cvmx_usb_write_csr32(struct cvmx_usb_state *usb, - uint64_t address, uint32_t value) +static inline void cvmx_usb_write_csr32(struct cvmx_usb_state *usb, + uint64_t address, uint32_t value) { cvmx_write64_uint32(address ^ 4, value); cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index)); @@ -590,8 +590,8 @@ static inline void __cvmx_usb_write_csr32(struct cvmx_usb_state *usb, * * Returns: Non zero if we need to do split transactions */ -static inline int __cvmx_usb_pipe_needs_split(struct cvmx_usb_state *usb, - struct cvmx_usb_pipe *pipe) +static inline int cvmx_usb_pipe_needs_split(struct cvmx_usb_state *usb, + struct cvmx_usb_pipe *pipe) { return pipe->device_speed != CVMX_USB_SPEED_HIGH && usb->usbcx_hprt.s.prtspd == CVMX_USB_SPEED_HIGH; @@ -605,7 +605,7 @@ static inline int __cvmx_usb_pipe_needs_split(struct cvmx_usb_state *usb, * * Returns: PID for pipe */ -static inline int __cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe) +static inline int cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe) { if (pipe->pid_toggle) return 2; /* Data1 */ @@ -813,8 +813,8 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, usbcx_gahbcfg.s.nptxfemplvl = 1; usbcx_gahbcfg.s.ptxfemplvl = 1; usbcx_gahbcfg.s.glblintrmsk = 1; - __cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index), - usbcx_gahbcfg.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index), + usbcx_gahbcfg.u32); } /* * 3. Program the following fields in USBC_GUSBCFG register. @@ -826,14 +826,14 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, { union cvmx_usbcx_gusbcfg usbcx_gusbcfg; - usbcx_gusbcfg.u32 = __cvmx_usb_read_csr32(usb, + usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index)); usbcx_gusbcfg.s.toutcal = 0; usbcx_gusbcfg.s.ddrsel = 0; usbcx_gusbcfg.s.usbtrdtim = 0x5; usbcx_gusbcfg.s.phylpwrclksel = 0; - __cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index), - usbcx_gusbcfg.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index), + usbcx_gusbcfg.u32); } /* * 4. The software must unmask the following bits in the USBC_GINTMSK @@ -845,7 +845,7 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, union cvmx_usbcx_gintmsk usbcx_gintmsk; int channel; - usbcx_gintmsk.u32 = __cvmx_usb_read_csr32(usb, + usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_GINTMSK(usb->index)); usbcx_gintmsk.s.otgintmsk = 1; usbcx_gintmsk.s.modemismsk = 1; @@ -854,15 +854,15 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, /* We need RX FIFO interrupts if we don't have DMA */ if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) usbcx_gintmsk.s.rxflvlmsk = 1; - __cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTMSK(usb->index), - usbcx_gintmsk.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTMSK(usb->index), + usbcx_gintmsk.u32); /* * Disable all channel interrupts. We'll enable them per channel * later. */ for (channel = 0; channel < 8; channel++) - __cvmx_usb_write_csr32(usb, + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), 0); } @@ -884,13 +884,12 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, { union cvmx_usbcx_hcfg usbcx_hcfg; - usbcx_hcfg.u32 = __cvmx_usb_read_csr32(usb, + usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCFG(usb->index)); usbcx_hcfg.s.fslssupp = 0; usbcx_hcfg.s.fslspclksel = 0; - __cvmx_usb_write_csr32(usb, - CVMX_USBCX_HCFG(usb->index), - usbcx_hcfg.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), + usbcx_hcfg.u32); } /* * 3. Program the port power bit to drive VBUS on the USB, @@ -953,8 +952,8 @@ static int cvmx_usb_enable(struct cvmx_usb_state *usb) { union cvmx_usbcx_ghwcfg3 usbcx_ghwcfg3; - usb->usbcx_hprt.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HPRT(usb->index)); + usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HPRT(usb->index)); /* * If the port is already enabled the just return. We don't need to do @@ -990,10 +989,10 @@ static int cvmx_usb_enable(struct cvmx_usb_state *usb) * Read the port speed field to get the enumerated speed, * USBC_HPRT[PRTSPD]. */ - usb->usbcx_hprt.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HPRT(usb->index)); - usbcx_ghwcfg3.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_GHWCFG3(usb->index)); + usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HPRT(usb->index)); + usbcx_ghwcfg3.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_GHWCFG3(usb->index)); /* * 13. Program the USBC_GRXFSIZ register to select the size of the @@ -1010,12 +1009,12 @@ static int cvmx_usb_enable(struct cvmx_usb_state *usb) { union cvmx_usbcx_gnptxfsiz siz; - siz.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_GNPTXFSIZ(usb->index)); + siz.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_GNPTXFSIZ(usb->index)); siz.s.nptxfdep = usbcx_ghwcfg3.s.dfifodepth / 2; siz.s.nptxfstaddr = usbcx_ghwcfg3.s.dfifodepth / 4; - __cvmx_usb_write_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index), - siz.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index), + siz.u32); } /* * 15. Program the USBC_HPTXFSIZ register to select the size and start @@ -1025,12 +1024,12 @@ static int cvmx_usb_enable(struct cvmx_usb_state *usb) { union cvmx_usbcx_hptxfsiz siz; - siz.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HPTXFSIZ(usb->index)); + siz.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HPTXFSIZ(usb->index)); siz.s.ptxfsize = usbcx_ghwcfg3.s.dfifodepth / 4; siz.s.ptxfstaddr = 3 * usbcx_ghwcfg3.s.dfifodepth / 4; - __cvmx_usb_write_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index), - siz.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index), + siz.u32); } /* Flush all FIFOs */ USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), @@ -1088,8 +1087,7 @@ static struct cvmx_usb_port_status cvmx_usb_get_status( memset(&result, 0, sizeof(result)); - usbc_hprt.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HPRT(usb->index)); + usbc_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index)); result.port_enabled = usbc_hprt.s.prtena; result.port_over_current = usbc_hprt.s.prtovrcurract; result.port_powered = usbc_hprt.s.prtpwr; @@ -1190,7 +1188,7 @@ static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct cvmx_usb_state *usb, */ if (!interval) interval = 1; - if (__cvmx_usb_pipe_needs_split(usb, pipe)) { + if (cvmx_usb_pipe_needs_split(usb, pipe)) { pipe->interval = interval*8; /* Force start splits to be schedule on uFrame 0 */ pipe->next_tx_frame = ((usb->frame_number+7)&~7) + @@ -1222,7 +1220,7 @@ static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct cvmx_usb_state *usb, * * @usb: USB device state populated by cvmx_usb_initialize(). */ -static void __cvmx_usb_poll_rx_fifo(struct cvmx_usb_state *usb) +static void cvmx_usb_poll_rx_fifo(struct cvmx_usb_state *usb) { union cvmx_usbcx_grxstsph rx_status; int channel; @@ -1230,8 +1228,8 @@ static void __cvmx_usb_poll_rx_fifo(struct cvmx_usb_state *usb) uint64_t address; uint32_t *ptr; - rx_status.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_GRXSTSPH(usb->index)); + rx_status.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_GRXSTSPH(usb->index)); /* Only read data if IN data is there */ if (rx_status.s.pktsts != 2) return; @@ -1254,8 +1252,8 @@ static void __cvmx_usb_poll_rx_fifo(struct cvmx_usb_state *usb) /* Loop writing the FIFO data for this packet into memory */ while (bytes > 0) { - *ptr++ = __cvmx_usb_read_csr32(usb, - USB_FIFO_ADDRESS(channel, usb->index)); + *ptr++ = cvmx_usb_read_csr32(usb, + USB_FIFO_ADDRESS(channel, usb->index)); bytes -= 4; } CVMX_SYNCW; @@ -1273,8 +1271,8 @@ static void __cvmx_usb_poll_rx_fifo(struct cvmx_usb_state *usb) * Returns: Non zero if the hardware fifo was too small and needs * to be serviced again. */ -static int __cvmx_usb_fill_tx_hw(struct cvmx_usb_state *usb, - struct cvmx_usb_tx_fifo *fifo, int available) +static int cvmx_usb_fill_tx_hw(struct cvmx_usb_state *usb, + struct cvmx_usb_tx_fifo *fifo, int available) { /* * We're done either when there isn't anymore space or the software FIFO @@ -1329,15 +1327,15 @@ static int __cvmx_usb_fill_tx_hw(struct cvmx_usb_state *usb, * * @usb: USB device state populated by cvmx_usb_initialize(). */ -static void __cvmx_usb_poll_tx_fifo(struct cvmx_usb_state *usb) +static void cvmx_usb_poll_tx_fifo(struct cvmx_usb_state *usb) { if (usb->periodic.head != usb->periodic.tail) { union cvmx_usbcx_hptxsts tx_status; - tx_status.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HPTXSTS(usb->index)); - if (__cvmx_usb_fill_tx_hw(usb, &usb->periodic, - tx_status.s.ptxfspcavail)) + tx_status.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HPTXSTS(usb->index)); + if (cvmx_usb_fill_tx_hw(usb, &usb->periodic, + tx_status.s.ptxfspcavail)) USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), union cvmx_usbcx_gintmsk, ptxfempmsk, 1); @@ -1350,10 +1348,10 @@ static void __cvmx_usb_poll_tx_fifo(struct cvmx_usb_state *usb) if (usb->nonperiodic.head != usb->nonperiodic.tail) { union cvmx_usbcx_gnptxsts tx_status; - tx_status.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_GNPTXSTS(usb->index)); - if (__cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic, - tx_status.s.nptxfspcavail)) + tx_status.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_GNPTXSTS(usb->index)); + if (cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic, + tx_status.s.nptxfspcavail)) USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), union cvmx_usbcx_gintmsk, nptxfempmsk, 1); @@ -1371,7 +1369,7 @@ static void __cvmx_usb_poll_tx_fifo(struct cvmx_usb_state *usb) * @usb: USB device state populated by cvmx_usb_initialize(). * @channel: Channel number to get packet from */ -static void __cvmx_usb_fill_tx_fifo(struct cvmx_usb_state *usb, int channel) +static void cvmx_usb_fill_tx_fifo(struct cvmx_usb_state *usb, int channel) { union cvmx_usbcx_hccharx hcchar; union cvmx_usbcx_hcspltx usbc_hcsplt; @@ -1379,14 +1377,14 @@ static void __cvmx_usb_fill_tx_fifo(struct cvmx_usb_state *usb, int channel) struct cvmx_usb_tx_fifo *fifo; /* We only need to fill data on outbound channels */ - hcchar.u32 = __cvmx_usb_read_csr32(usb, + hcchar.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index)); if (hcchar.s.epdir != CVMX_USB_DIRECTION_OUT) return; /* OUT Splits only have data on the start and not the complete */ - usbc_hcsplt.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCSPLTX(channel, usb->index)); + usbc_hcsplt.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HCSPLTX(channel, usb->index)); if (usbc_hcsplt.s.spltena && usbc_hcsplt.s.compsplt) return; @@ -1394,8 +1392,8 @@ static void __cvmx_usb_fill_tx_fifo(struct cvmx_usb_state *usb, int channel) * Find out how many bytes we need to fill and convert it into 32bit * words. */ - usbc_hctsiz.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCTSIZX(channel, usb->index)); + usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HCTSIZX(channel, usb->index)); if (!usbc_hctsiz.s.xfersize) return; @@ -1414,21 +1412,20 @@ static void __cvmx_usb_fill_tx_fifo(struct cvmx_usb_state *usb, int channel) if (fifo->head > MAX_CHANNELS) fifo->head = 0; - __cvmx_usb_poll_tx_fifo(usb); + cvmx_usb_poll_tx_fifo(usb); } /** * Perform channel specific setup for Control transactions. All - * the generic stuff will already have been done in - * __cvmx_usb_start_channel() + * the generic stuff will already have been done in cvmx_usb_start_channel(). * * @usb: USB device state populated by cvmx_usb_initialize(). * @channel: Channel to setup * @pipe: Pipe for control transaction */ -static void __cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, - int channel, - struct cvmx_usb_pipe *pipe) +static void cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, + int channel, + struct cvmx_usb_pipe *pipe) { struct octeon_hcd *priv = cvmx_usb_to_octeon(usb); struct usb_hcd *hcd = octeon_to_hcd(priv); @@ -1443,8 +1440,8 @@ static void __cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, int packets_to_transfer; union cvmx_usbcx_hctsizx usbc_hctsiz; - usbc_hctsiz.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCTSIZX(channel, usb->index)); + usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HCTSIZX(channel, usb->index)); switch (transaction->stage) { case CVMX_USB_STAGE_NON_CONTROL: @@ -1478,8 +1475,8 @@ static void __cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, union cvmx_usbcx_hcspltx, compsplt, 1); break; case CVMX_USB_STAGE_DATA: - usbc_hctsiz.s.pid = __cvmx_usb_get_data_pid(pipe); - if (__cvmx_usb_pipe_needs_split(usb, pipe)) { + usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe); + if (cvmx_usb_pipe_needs_split(usb, pipe)) { if (header->bRequestType & USB_DIR_IN) bytes_to_transfer = 0; else if (bytes_to_transfer > pipe->max_packet) @@ -1492,7 +1489,7 @@ static void __cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, CVMX_USB_DIRECTION_OUT)); break; case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE: - usbc_hctsiz.s.pid = __cvmx_usb_get_data_pid(pipe); + usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe); if (!(header->bRequestType & USB_DIR_IN)) bytes_to_transfer = 0; USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), @@ -1504,7 +1501,7 @@ static void __cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, union cvmx_usbcx_hcspltx, compsplt, 1); break; case CVMX_USB_STAGE_STATUS: - usbc_hctsiz.s.pid = __cvmx_usb_get_data_pid(pipe); + usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe); bytes_to_transfer = 0; USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), union cvmx_usbcx_hccharx, epdir, @@ -1513,7 +1510,7 @@ static void __cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, CVMX_USB_DIRECTION_IN)); break; case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE: - usbc_hctsiz.s.pid = __cvmx_usb_get_data_pid(pipe); + usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe); bytes_to_transfer = 0; USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), union cvmx_usbcx_hccharx, epdir, @@ -1564,8 +1561,8 @@ static void __cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, usbc_hctsiz.s.xfersize = bytes_to_transfer; usbc_hctsiz.s.pktcnt = packets_to_transfer; - __cvmx_usb_write_csr32(usb, CVMX_USBCX_HCTSIZX(channel, usb->index), - usbc_hctsiz.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCTSIZX(channel, usb->index), + usbc_hctsiz.u32); } @@ -1576,9 +1573,8 @@ static void __cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, * @channel: Channel to setup * @pipe: Pipe to start */ -static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, - int channel, - struct cvmx_usb_pipe *pipe) +static void cvmx_usb_start_channel(struct cvmx_usb_state *usb, int channel, + struct cvmx_usb_pipe *pipe) { struct cvmx_usb_transaction *transaction = list_first_entry(&pipe->transactions, typeof(*transaction), @@ -1602,12 +1598,12 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, union cvmx_usbcx_haintmsk usbc_haintmsk; /* Clear all channel status bits */ - usbc_hcint.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCINTX(channel, usb->index)); + usbc_hcint.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HCINTX(channel, usb->index)); - __cvmx_usb_write_csr32(usb, - CVMX_USBCX_HCINTX(channel, usb->index), - usbc_hcint.u32); + cvmx_usb_write_csr32(usb, + CVMX_USBCX_HCINTX(channel, usb->index), + usbc_hcint.u32); usbc_hcintmsk.u32 = 0; usbc_hcintmsk.s.chhltdmsk = 1; @@ -1620,7 +1616,7 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, usbc_hcintmsk.s.frmovrunmsk = 1; usbc_hcintmsk.s.bblerrmsk = 1; usbc_hcintmsk.s.xacterrmsk = 1; - if (__cvmx_usb_pipe_needs_split(usb, pipe)) { + if (cvmx_usb_pipe_needs_split(usb, pipe)) { /* * Splits don't generate xfercompl, so we need * ACK and NYET. @@ -1632,17 +1628,16 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, usbc_hcintmsk.s.stallmsk = 1; usbc_hcintmsk.s.xfercomplmsk = 1; } - __cvmx_usb_write_csr32(usb, + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), usbc_hcintmsk.u32); /* Enable the channel interrupt to propagate */ - usbc_haintmsk.u32 = __cvmx_usb_read_csr32(usb, + usbc_haintmsk.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index)); usbc_haintmsk.s.haintmsk |= 1<index), - usbc_haintmsk.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index), + usbc_haintmsk.u32); } /* Setup the locations the DMA engines use */ @@ -1684,7 +1679,7 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, * We need to do split transactions when we are talking to non * high speed devices that are behind a high speed hub */ - if (__cvmx_usb_pipe_needs_split(usb, pipe)) { + if (cvmx_usb_pipe_needs_split(usb, pipe)) { /* * On the start split phase (stage is even) record the * frame number we will need to send the split complete. @@ -1815,18 +1810,19 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, usbc_hctsiz.s.pktcnt = packets_to_transfer; /* Update the DATA0/DATA1 toggle */ - usbc_hctsiz.s.pid = __cvmx_usb_get_data_pid(pipe); + usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe); /* * High speed pipes may need a hardware ping before they start */ if (pipe->flags & __CVMX_USB_PIPE_FLAGS_NEED_PING) usbc_hctsiz.s.dopng = 1; - __cvmx_usb_write_csr32(usb, - CVMX_USBCX_HCSPLTX(channel, usb->index), - usbc_hcsplt.u32); - __cvmx_usb_write_csr32(usb, CVMX_USBCX_HCTSIZX(channel, - usb->index), usbc_hctsiz.u32); + cvmx_usb_write_csr32(usb, + CVMX_USBCX_HCSPLTX(channel, usb->index), + usbc_hcsplt.u32); + cvmx_usb_write_csr32(usb, + CVMX_USBCX_HCTSIZX(channel, usb->index), + usbc_hctsiz.u32); } /* Setup the Host Channel Characteristics Register */ @@ -1845,7 +1841,7 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, * immediate retries of failure. These retries happen too * quickly, so we disable these entirely for splits */ - if (__cvmx_usb_pipe_needs_split(usb, pipe)) + if (cvmx_usb_pipe_needs_split(usb, pipe)) usbc_hcchar.s.ec = 1; else if (pipe->multi_count < 1) usbc_hcchar.s.ec = 1; @@ -1862,21 +1858,21 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, usbc_hcchar.s.epdir = pipe->transfer_dir; usbc_hcchar.s.epnum = pipe->endpoint_num; usbc_hcchar.s.mps = pipe->max_packet; - __cvmx_usb_write_csr32(usb, - CVMX_USBCX_HCCHARX(channel, usb->index), - usbc_hcchar.u32); + cvmx_usb_write_csr32(usb, + CVMX_USBCX_HCCHARX(channel, usb->index), + usbc_hcchar.u32); } /* Do transaction type specific fixups as needed */ switch (transaction->type) { case CVMX_USB_TRANSFER_CONTROL: - __cvmx_usb_start_channel_control(usb, channel, pipe); + cvmx_usb_start_channel_control(usb, channel, pipe); break; case CVMX_USB_TRANSFER_BULK: case CVMX_USB_TRANSFER_INTERRUPT: break; case CVMX_USB_TRANSFER_ISOCHRONOUS: - if (!__cvmx_usb_pipe_needs_split(usb, pipe)) { + if (!cvmx_usb_pipe_needs_split(usb, pipe)) { /* * ISO transactions require different PIDs depending on * direction and how many packets are needed @@ -1900,18 +1896,18 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, } { union cvmx_usbcx_hctsizx usbc_hctsiz = {.u32 = - __cvmx_usb_read_csr32(usb, + cvmx_usb_read_csr32(usb, CVMX_USBCX_HCTSIZX(channel, usb->index))}; transaction->xfersize = usbc_hctsiz.s.xfersize; transaction->pktcnt = usbc_hctsiz.s.pktcnt; } /* Remeber when we start a split transaction */ - if (__cvmx_usb_pipe_needs_split(usb, pipe)) + if (cvmx_usb_pipe_needs_split(usb, pipe)) usb->active_split = transaction; USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), union cvmx_usbcx_hccharx, chena, 1); if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) - __cvmx_usb_fill_tx_fifo(usb, channel); + cvmx_usb_fill_tx_fifo(usb, channel); } @@ -1924,7 +1920,7 @@ static void __cvmx_usb_start_channel(struct cvmx_usb_state *usb, * * Returns: Pipe or NULL if none are ready */ -static struct cvmx_usb_pipe *__cvmx_usb_find_ready_pipe( +static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe( struct cvmx_usb_state *usb, struct list_head *list, uint64_t current_frame) @@ -1956,7 +1952,7 @@ static struct cvmx_usb_pipe *__cvmx_usb_find_ready_pipe( * @usb: USB device state populated by cvmx_usb_initialize(). * @is_sof: True if this schedule was called on a SOF interrupt. */ -static void __cvmx_usb_schedule(struct cvmx_usb_state *usb, int is_sof) +static void cvmx_usb_schedule(struct cvmx_usb_state *usb, int is_sof) { int channel; struct cvmx_usb_pipe *pipe; @@ -1969,12 +1965,12 @@ static void __cvmx_usb_schedule(struct cvmx_usb_state *usb, int is_sof) * at the end of a frame and cause an overrun. */ union cvmx_usbcx_hfnum hfnum = { - .u32 = __cvmx_usb_read_csr32(usb, + .u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index)) }; union cvmx_usbcx_hfir hfir = { - .u32 = __cvmx_usb_read_csr32(usb, + .u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFIR(usb->index)) }; @@ -1996,23 +1992,23 @@ static void __cvmx_usb_schedule(struct cvmx_usb_state *usb, int is_sof) * way we are sure that the periodic data is sent in the * beginning of the frame */ - pipe = __cvmx_usb_find_ready_pipe(usb, + pipe = cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_ISOCHRONOUS, usb->frame_number); if (likely(!pipe)) - pipe = __cvmx_usb_find_ready_pipe(usb, + pipe = cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_INTERRUPT, usb->frame_number); } if (likely(!pipe)) { - pipe = __cvmx_usb_find_ready_pipe(usb, + pipe = cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_CONTROL, usb->frame_number); if (likely(!pipe)) - pipe = __cvmx_usb_find_ready_pipe(usb, + pipe = cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_BULK, usb->frame_number); @@ -2020,7 +2016,7 @@ static void __cvmx_usb_schedule(struct cvmx_usb_state *usb, int is_sof) if (!pipe) break; - __cvmx_usb_start_channel(usb, channel, pipe); + cvmx_usb_start_channel(usb, channel, pipe); } done: @@ -2143,11 +2139,10 @@ static void octeon_usb_urb_complete_callback(struct cvmx_usb_state *usb, * @complete_code: * Completion code */ -static void __cvmx_usb_perform_complete( - struct cvmx_usb_state *usb, - struct cvmx_usb_pipe *pipe, - struct cvmx_usb_transaction *transaction, - enum cvmx_usb_complete complete_code) +static void cvmx_usb_perform_complete(struct cvmx_usb_state *usb, + struct cvmx_usb_pipe *pipe, + struct cvmx_usb_transaction *transaction, + enum cvmx_usb_complete complete_code) { /* If this was a split then clear our split in progress marker */ if (usb->active_split == transaction) @@ -2213,7 +2208,7 @@ static void __cvmx_usb_perform_complete( * * Returns: Transaction or NULL on failure. */ -static struct cvmx_usb_transaction *__cvmx_usb_submit_transaction( +static struct cvmx_usb_transaction *cvmx_usb_submit_transaction( struct cvmx_usb_state *usb, struct cvmx_usb_pipe *pipe, enum cvmx_usb_transfer type, @@ -2259,7 +2254,7 @@ static struct cvmx_usb_transaction *__cvmx_usb_submit_transaction( * We may need to schedule the pipe if this was the head of the * pipe. */ - __cvmx_usb_schedule(usb, 0); + cvmx_usb_schedule(usb, 0); } return transaction; @@ -2280,14 +2275,14 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_bulk( struct cvmx_usb_pipe *pipe, struct urb *urb) { - return __cvmx_usb_submit_transaction(usb, pipe, CVMX_USB_TRANSFER_BULK, - urb->transfer_dma, - urb->transfer_buffer_length, - 0, /* control_header */ - 0, /* iso_start_frame */ - 0, /* iso_number_packets */ - NULL, /* iso_packets */ - urb); + return cvmx_usb_submit_transaction(usb, pipe, CVMX_USB_TRANSFER_BULK, + urb->transfer_dma, + urb->transfer_buffer_length, + 0, /* control_header */ + 0, /* iso_start_frame */ + 0, /* iso_number_packets */ + NULL, /* iso_packets */ + urb); } @@ -2305,15 +2300,15 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_interrupt( struct cvmx_usb_pipe *pipe, struct urb *urb) { - return __cvmx_usb_submit_transaction(usb, pipe, - CVMX_USB_TRANSFER_INTERRUPT, - urb->transfer_dma, - urb->transfer_buffer_length, - 0, /* control_header */ - 0, /* iso_start_frame */ - 0, /* iso_number_packets */ - NULL, /* iso_packets */ - urb); + return cvmx_usb_submit_transaction(usb, pipe, + CVMX_USB_TRANSFER_INTERRUPT, + urb->transfer_dma, + urb->transfer_buffer_length, + 0, /* control_header */ + 0, /* iso_start_frame */ + 0, /* iso_number_packets */ + NULL, /* iso_packets */ + urb); } @@ -2338,14 +2333,14 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_control( if ((header->bRequestType & USB_DIR_IN) == 0) buffer_length = le16_to_cpu(header->wLength); - return __cvmx_usb_submit_transaction(usb, pipe, - CVMX_USB_TRANSFER_CONTROL, - urb->transfer_dma, buffer_length, - control_header, - 0, /* iso_start_frame */ - 0, /* iso_number_packets */ - NULL, /* iso_packets */ - urb); + return cvmx_usb_submit_transaction(usb, pipe, + CVMX_USB_TRANSFER_CONTROL, + urb->transfer_dma, buffer_length, + control_header, + 0, /* iso_start_frame */ + 0, /* iso_number_packets */ + NULL, /* iso_packets */ + urb); } @@ -2366,14 +2361,14 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_isochronous( struct cvmx_usb_iso_packet *packets; packets = (struct cvmx_usb_iso_packet *) urb->setup_packet; - return __cvmx_usb_submit_transaction(usb, pipe, - CVMX_USB_TRANSFER_ISOCHRONOUS, - urb->transfer_dma, - urb->transfer_buffer_length, - 0, /* control_header */ - urb->start_frame, - urb->number_of_packets, - packets, urb); + return cvmx_usb_submit_transaction(usb, pipe, + CVMX_USB_TRANSFER_ISOCHRONOUS, + urb->transfer_dma, + urb->transfer_buffer_length, + 0, /* control_header */ + urb->start_frame, + urb->number_of_packets, + packets, urb); } @@ -2407,7 +2402,7 @@ static int cvmx_usb_cancel(struct cvmx_usb_state *usb, CVMX_SYNCW; - usbc_hcchar.u32 = __cvmx_usb_read_csr32(usb, + usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCCHARX(pipe->channel, usb->index)); /* * If the channel isn't enabled then the transaction already @@ -2415,14 +2410,14 @@ static int cvmx_usb_cancel(struct cvmx_usb_state *usb, */ if (usbc_hcchar.s.chena) { usbc_hcchar.s.chdis = 1; - __cvmx_usb_write_csr32(usb, + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCCHARX(pipe->channel, usb->index), usbc_hcchar.u32); } } - __cvmx_usb_perform_complete(usb, pipe, transaction, - CVMX_USB_COMPLETE_CANCEL); + cvmx_usb_perform_complete(usb, pipe, transaction, + CVMX_USB_COMPLETE_CANCEL); return 0; } @@ -2487,8 +2482,7 @@ static int cvmx_usb_get_frame_number(struct cvmx_usb_state *usb) int frame_number; union cvmx_usbcx_hfnum usbc_hfnum; - usbc_hfnum.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HFNUM(usb->index)); + usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index)); frame_number = usbc_hfnum.s.frnum; return frame_number; @@ -2503,7 +2497,7 @@ static int cvmx_usb_get_frame_number(struct cvmx_usb_state *usb) * * Returns: Zero on success */ -static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) +static int cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) { struct octeon_hcd *priv = cvmx_usb_to_octeon(usb); struct usb_hcd *hcd = octeon_to_hcd(priv); @@ -2519,11 +2513,11 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) int buffer_space_left; /* Read the interrupt status bits for the channel */ - usbc_hcint.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCINTX(channel, usb->index)); + usbc_hcint.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HCINTX(channel, usb->index)); if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) { - usbc_hcchar.u32 = __cvmx_usb_read_csr32(usb, + usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index)); if (usbc_hcchar.s.chena && usbc_hcchar.s.chdis) { @@ -2532,7 +2526,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) * interrupt IN transfers to get stuck until we do a * write of HCCHARX without changing things */ - __cvmx_usb_write_csr32(usb, + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index), usbc_hcchar.u32); @@ -2549,12 +2543,12 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) /* Disable all interrupts except CHHLTD */ hcintmsk.u32 = 0; hcintmsk.s.chhltdmsk = 1; - __cvmx_usb_write_csr32(usb, + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), hcintmsk.u32); usbc_hcchar.s.chdis = 1; - __cvmx_usb_write_csr32(usb, + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index), usbc_hcchar.u32); @@ -2580,9 +2574,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) } /* Disable the channel interrupts now that it is done */ - __cvmx_usb_write_csr32(usb, - CVMX_USBCX_HCINTMSKX(channel, usb->index), - 0); + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), 0); usb->idle_hardware_channels |= (1<index)); - usbc_hctsiz.u32 = __cvmx_usb_read_csr32(usb, + usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCTSIZX(channel, usb->index)); /* @@ -2693,8 +2685,8 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) * the actual bytes transferred */ pipe->pid_toggle = 0; - __cvmx_usb_perform_complete(usb, pipe, transaction, - CVMX_USB_COMPLETE_STALL); + cvmx_usb_perform_complete(usb, pipe, transaction, + CVMX_USB_COMPLETE_STALL); } else if (usbc_hcint.s.xacterr) { /* * We know at least one packet worked if we get a ACK or NAK. @@ -2709,8 +2701,8 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) * something wrong with the transfer. For example, PID * toggle errors cause these */ - __cvmx_usb_perform_complete(usb, pipe, transaction, - CVMX_USB_COMPLETE_XACTERR); + cvmx_usb_perform_complete(usb, pipe, transaction, + CVMX_USB_COMPLETE_XACTERR); } else { /* * If this was a split then clear our split in progress @@ -2733,12 +2725,12 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) } } else if (usbc_hcint.s.bblerr) { /* Babble Error (BblErr) */ - __cvmx_usb_perform_complete(usb, pipe, transaction, - CVMX_USB_COMPLETE_BABBLEERR); + cvmx_usb_perform_complete(usb, pipe, transaction, + CVMX_USB_COMPLETE_BABBLEERR); } else if (usbc_hcint.s.datatglerr) { /* Data toggle error */ - __cvmx_usb_perform_complete(usb, pipe, transaction, - CVMX_USB_COMPLETE_DATATGLERR); + cvmx_usb_perform_complete(usb, pipe, transaction, + CVMX_USB_COMPLETE_DATATGLERR); } else if (usbc_hcint.s.nyet) { /* * NYET as a response is only allowed in three cases: as a @@ -2746,7 +2738,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) * as a response to a bulk out. The ping case is handled by * hardware, so we only have splits and bulk out */ - if (!__cvmx_usb_pipe_needs_split(usb, pipe)) { + if (!cvmx_usb_pipe_needs_split(usb, pipe)) { transaction->retries = 0; /* * If there is more data to go then we need to try @@ -2754,7 +2746,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) */ if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) - __cvmx_usb_perform_complete(usb, pipe, + cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); } else { @@ -2794,12 +2786,12 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) case CVMX_USB_STAGE_NON_CONTROL: case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE: /* This should be impossible */ - __cvmx_usb_perform_complete(usb, pipe, + cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_ERROR); break; case CVMX_USB_STAGE_SETUP: pipe->pid_toggle = 1; - if (__cvmx_usb_pipe_needs_split(usb, pipe)) + if (cvmx_usb_pipe_needs_split(usb, pipe)) transaction->stage = CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE; else { @@ -2826,7 +2818,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) } break; case CVMX_USB_STAGE_DATA: - if (__cvmx_usb_pipe_needs_split(usb, pipe)) { + if (cvmx_usb_pipe_needs_split(usb, pipe)) { transaction->stage = CVMX_USB_STAGE_DATA_SPLIT_COMPLETE; /* @@ -2864,16 +2856,16 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) } break; case CVMX_USB_STAGE_STATUS: - if (__cvmx_usb_pipe_needs_split(usb, pipe)) + if (cvmx_usb_pipe_needs_split(usb, pipe)) transaction->stage = CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE; else - __cvmx_usb_perform_complete(usb, pipe, + cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); break; case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE: - __cvmx_usb_perform_complete(usb, pipe, + cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); break; @@ -2887,7 +2879,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) * For splits we need to continue the transfer if more * data is needed */ - if (__cvmx_usb_pipe_needs_split(usb, pipe)) { + if (cvmx_usb_pipe_needs_split(usb, pipe)) { if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL) transaction->stage = @@ -2903,7 +2895,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) CVMX_USB_TRANSFER_INTERRUPT) pipe->next_tx_frame += pipe->interval; - __cvmx_usb_perform_complete( + cvmx_usb_perform_complete( usb, pipe, transaction, @@ -2927,15 +2919,14 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) CVMX_USB_TRANSFER_INTERRUPT) pipe->next_tx_frame += pipe->interval; - __cvmx_usb_perform_complete(usb, - pipe, + cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); } } break; case CVMX_USB_TRANSFER_ISOCHRONOUS: - if (__cvmx_usb_pipe_needs_split(usb, pipe)) { + if (cvmx_usb_pipe_needs_split(usb, pipe)) { /* * ISOCHRONOUS OUT splits don't require a * complete split stage. Instead they use a @@ -2956,10 +2947,8 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) (bytes_this_transfer < 188)) { pipe->next_tx_frame += pipe->interval; - __cvmx_usb_perform_complete( - usb, - pipe, - transaction, + cvmx_usb_perform_complete(usb, + pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); } } else { @@ -2976,7 +2965,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) pipe->max_packet)) { pipe->next_tx_frame += pipe->interval; - __cvmx_usb_perform_complete( + cvmx_usb_perform_complete( usb, pipe, transaction, @@ -2988,8 +2977,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) } } else { pipe->next_tx_frame += pipe->interval; - __cvmx_usb_perform_complete(usb, - pipe, + cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); } @@ -3027,7 +3015,7 @@ static int __cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) * We get channel halted interrupts with no result bits * sets when the cable is unplugged */ - __cvmx_usb_perform_complete(usb, pipe, transaction, + cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_ERROR); } } @@ -3061,21 +3049,19 @@ static int cvmx_usb_poll(struct cvmx_usb_state *usb) prefetch_range(usb, sizeof(*usb)); /* Update the frame counter */ - usbc_hfnum.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HFNUM(usb->index)); + usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index)); if ((usb->frame_number&0x3fff) > usbc_hfnum.s.frnum) usb->frame_number += 0x4000; usb->frame_number &= ~0x3fffull; usb->frame_number |= usbc_hfnum.s.frnum; /* Read the pending interrupts */ - usbc_gintsts.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_GINTSTS(usb->index)); + usbc_gintsts.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_GINTSTS(usb->index)); /* Clear the interrupts now that we know about them */ - __cvmx_usb_write_csr32(usb, - CVMX_USBCX_GINTSTS(usb->index), - usbc_gintsts.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index), + usbc_gintsts.u32); if (usbc_gintsts.s.rxflvl) { /* @@ -3086,12 +3072,12 @@ static int cvmx_usb_poll(struct cvmx_usb_state *usb) * In DMA mode this is handled by hardware */ if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) - __cvmx_usb_poll_rx_fifo(usb); + cvmx_usb_poll_rx_fifo(usb); } if (usbc_gintsts.s.ptxfemp || usbc_gintsts.s.nptxfemp) { /* Fill the Tx FIFOs when not in DMA mode */ if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) - __cvmx_usb_poll_tx_fifo(usb); + cvmx_usb_poll_tx_fifo(usb); } if (usbc_gintsts.s.disconnint || usbc_gintsts.s.prtint) { union cvmx_usbcx_hprt usbc_hprt; @@ -3111,11 +3097,11 @@ static int cvmx_usb_poll(struct cvmx_usb_state *usb) */ octeon_usb_port_callback(usb); /* Clear the port change bits */ - usbc_hprt.u32 = __cvmx_usb_read_csr32(usb, - CVMX_USBCX_HPRT(usb->index)); + usbc_hprt.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_HPRT(usb->index)); usbc_hprt.s.prtena = 0; - __cvmx_usb_write_csr32(usb, CVMX_USBCX_HPRT(usb->index), - usbc_hprt.u32); + cvmx_usb_write_csr32(usb, CVMX_USBCX_HPRT(usb->index), + usbc_hprt.u32); } if (usbc_gintsts.s.hchint) { /* @@ -3132,18 +3118,18 @@ static int cvmx_usb_poll(struct cvmx_usb_state *usb) */ union cvmx_usbcx_haint usbc_haint; - usbc_haint.u32 = __cvmx_usb_read_csr32(usb, + usbc_haint.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HAINT(usb->index)); while (usbc_haint.u32) { int channel; channel = __fls(usbc_haint.u32); - __cvmx_usb_poll_channel(usb, channel); + cvmx_usb_poll_channel(usb, channel); usbc_haint.u32 ^= 1< Date: Sun, 22 Mar 2015 17:37:48 +0200 Subject: staging: octeon-usb: remove useless prefix from pipe flags Remove useless prefix from pipe flags and adjust comments. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 2994a464bd36..d0f346cf8e89 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -214,15 +214,14 @@ enum cvmx_usb_initialize_flags { /** * enum cvmx_usb_pipe_flags - internal flags for a pipe. * - * @__CVMX_USB_PIPE_FLAGS_SCHEDULED: Used internally to determine if a pipe is - * actively using hardware. Do not use. - * @__CVMX_USB_PIPE_FLAGS_NEED_PING: Used internally to determine if a high - * speed pipe is in the ping state. Do not - * use. + * @CVMX_USB_PIPE_FLAGS_SCHEDULED: Used internally to determine if a pipe is + * actively using hardware. + * @CVMX_USB_PIPE_FLAGS_NEED_PING: Used internally to determine if a high speed + * pipe is in the ping state. */ enum cvmx_usb_pipe_flags { - __CVMX_USB_PIPE_FLAGS_SCHEDULED = 1 << 17, - __CVMX_USB_PIPE_FLAGS_NEED_PING = 1 << 18, + CVMX_USB_PIPE_FLAGS_SCHEDULED = 1 << 17, + CVMX_USB_PIPE_FLAGS_NEED_PING = 1 << 18, }; /* Maximum number of times to retry failed transactions */ @@ -1173,7 +1172,7 @@ static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct cvmx_usb_state *usb, if ((device_speed == CVMX_USB_SPEED_HIGH) && (transfer_dir == CVMX_USB_DIRECTION_OUT) && (transfer_type == CVMX_USB_TRANSFER_BULK)) - pipe->flags |= __CVMX_USB_PIPE_FLAGS_NEED_PING; + pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING; pipe->device_addr = device_addr; pipe->endpoint_num = endpoint_num; pipe->device_speed = device_speed; @@ -1586,7 +1585,7 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state *usb, int channel, /* Attach the channel to the pipe */ usb->pipe_for_channel[channel] = pipe; pipe->channel = channel; - pipe->flags |= __CVMX_USB_PIPE_FLAGS_SCHEDULED; + pipe->flags |= CVMX_USB_PIPE_FLAGS_SCHEDULED; /* Mark this channel as in use */ usb->idle_hardware_channels &= ~(1<flags & __CVMX_USB_PIPE_FLAGS_NEED_PING) + if (pipe->flags & CVMX_USB_PIPE_FLAGS_NEED_PING) usbc_hctsiz.s.dopng = 1; cvmx_usb_write_csr32(usb, @@ -1931,7 +1930,7 @@ static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe( struct cvmx_usb_transaction *t = list_first_entry(&pipe->transactions, typeof(*t), node); - if (!(pipe->flags & __CVMX_USB_PIPE_FLAGS_SCHEDULED) && t && + if (!(pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED) && t && (pipe->next_tx_frame <= current_frame) && ((pipe->split_sc_frame == -1) || ((((int)current_frame - (int)pipe->split_sc_frame) @@ -2394,11 +2393,11 @@ static int cvmx_usb_cancel(struct cvmx_usb_state *usb, * treat it special */ if (list_first_entry(&pipe->transactions, typeof(*transaction), node) == - transaction && (pipe->flags & __CVMX_USB_PIPE_FLAGS_SCHEDULED)) { + transaction && (pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED)) { union cvmx_usbcx_hccharx usbc_hcchar; usb->pipe_for_channel[pipe->channel] = NULL; - pipe->flags &= ~__CVMX_USB_PIPE_FLAGS_SCHEDULED; + pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED; CVMX_SYNCW; @@ -2592,7 +2591,7 @@ static int cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) * function will figure out which pipe needs to go */ usb->pipe_for_channel[channel] = NULL; - pipe->flags &= ~__CVMX_USB_PIPE_FLAGS_SCHEDULED; + pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED; /* * Read the channel config info so we can figure out how much data @@ -2675,7 +2674,7 @@ static int cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) && (pipe->transfer_type == CVMX_USB_TRANSFER_BULK) && (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT)) - pipe->flags |= __CVMX_USB_PIPE_FLAGS_NEED_PING; + pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING; if (usbc_hcint.s.stall) { /* @@ -2778,7 +2777,7 @@ static int cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) * Since we got an ACK, we know we don't need to do a ping on * this pipe */ - pipe->flags &= ~__CVMX_USB_PIPE_FLAGS_NEED_PING; + pipe->flags &= ~CVMX_USB_PIPE_FLAGS_NEED_PING; switch (transaction->type) { case CVMX_USB_TRANSFER_CONTROL: @@ -2911,7 +2910,7 @@ static int cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) CVMX_USB_DIRECTION_OUT) && (usbc_hcint.s.nak)) pipe->flags |= - __CVMX_USB_PIPE_FLAGS_NEED_PING; + CVMX_USB_PIPE_FLAGS_NEED_PING; if (!buffer_space_left || (bytes_in_last_packet < pipe->max_packet)) { -- cgit v1.2.3 From 31170da59e0ffc90b94c4a6bbfecb657b2c5e3ad Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:49 +0200 Subject: staging: octeon-usb: delete redundant field from octeon_temp_buffer Since we are not moving/realigning the original pointer returned by kmalloc, we don't need to store the value in a separate field. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index d0f346cf8e89..1ec70eb490d1 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -432,7 +432,6 @@ struct octeon_hcd { /** * struct octeon_temp_buffer - a bounce buffer for USB transfers - * @temp_buffer: the newly allocated temporary buffer (including meta-data) * @orig_buffer: the original buffer passed by the USB stack * @data: the newly allocated temporary buffer (excluding meta-data) * @@ -441,7 +440,6 @@ struct octeon_hcd { * represents it. */ struct octeon_temp_buffer { - void *temp_buffer; void *orig_buffer; u8 data[0]; }; @@ -479,7 +477,6 @@ static int octeon_alloc_temp_buffer(struct urb *urb, gfp_t mem_flags) if (!temp) return -ENOMEM; - temp->temp_buffer = temp; temp->orig_buffer = urb->transfer_buffer; if (usb_urb_dir_out(urb)) memcpy(temp->data, urb->transfer_buffer, @@ -510,7 +507,7 @@ static void octeon_free_temp_buffer(struct urb *urb) urb->actual_length); urb->transfer_buffer = temp->orig_buffer; urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER; - kfree(temp->temp_buffer); + kfree(temp); } /** -- cgit v1.2.3 From af8e4c71f6ddb9b2e20a0b5bf81a391f4552205c Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:50 +0200 Subject: staging: octeon-usb: use __BITFIELD_FIELD Use __BITFIELD_FIELD to define bitfields. OCTEON can at least in theory run also in little-endian mode, so the bitfield definitions should not assume big-endian byte order. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.h | 513 +++++++++++++++++--------------- 1 file changed, 270 insertions(+), 243 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.h b/drivers/staging/octeon-usb/octeon-hcd.h index 42fe4fec7d5d..3e351ab7465a 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.h +++ b/drivers/staging/octeon-usb/octeon-hcd.h @@ -47,6 +47,8 @@ #ifndef __OCTEON_HCD_H__ #define __OCTEON_HCD_H__ +#include + #define CVMX_USBCXBASE 0x00016F0010000000ull #define CVMX_USBCXREG1(reg, bid) \ (CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \ @@ -143,13 +145,14 @@ union cvmx_usbcx_gahbcfg { * * 1'b1: Unmask the interrupt assertion to the application. */ struct cvmx_usbcx_gahbcfg_s { - uint32_t reserved_9_31 : 23; - uint32_t ptxfemplvl : 1; - uint32_t nptxfemplvl : 1; - uint32_t reserved_6_6 : 1; - uint32_t dmaen : 1; - uint32_t hbstlen : 4; - uint32_t glblintrmsk : 1; + __BITFIELD_FIELD(uint32_t reserved_9_31 : 23, + __BITFIELD_FIELD(uint32_t ptxfemplvl : 1, + __BITFIELD_FIELD(uint32_t nptxfemplvl : 1, + __BITFIELD_FIELD(uint32_t reserved_6_6 : 1, + __BITFIELD_FIELD(uint32_t dmaen : 1, + __BITFIELD_FIELD(uint32_t hbstlen : 4, + __BITFIELD_FIELD(uint32_t glblintrmsk : 1, + ;))))))) } s; }; @@ -209,16 +212,17 @@ union cvmx_usbcx_ghwcfg3 { * * Others: Reserved */ struct cvmx_usbcx_ghwcfg3_s { - uint32_t dfifodepth : 16; - uint32_t reserved_13_15 : 3; - uint32_t ahbphysync : 1; - uint32_t rsttype : 1; - uint32_t optfeature : 1; - uint32_t vendor_control_interface_support : 1; - uint32_t i2c_selection : 1; - uint32_t otgen : 1; - uint32_t pktsizewidth : 3; - uint32_t xfersizewidth : 4; + __BITFIELD_FIELD(uint32_t dfifodepth : 16, + __BITFIELD_FIELD(uint32_t reserved_13_15 : 3, + __BITFIELD_FIELD(uint32_t ahbphysync : 1, + __BITFIELD_FIELD(uint32_t rsttype : 1, + __BITFIELD_FIELD(uint32_t optfeature : 1, + __BITFIELD_FIELD(uint32_t vendor_control_interface_support : 1, + __BITFIELD_FIELD(uint32_t i2c_selection : 1, + __BITFIELD_FIELD(uint32_t otgen : 1, + __BITFIELD_FIELD(uint32_t pktsizewidth : 3, + __BITFIELD_FIELD(uint32_t xfersizewidth : 4, + ;)))))))))) } s; }; @@ -275,38 +279,39 @@ union cvmx_usbcx_gintmsk { * @modemismsk: Mode Mismatch Interrupt Mask (ModeMisMsk) */ struct cvmx_usbcx_gintmsk_s { - uint32_t wkupintmsk : 1; - uint32_t sessreqintmsk : 1; - uint32_t disconnintmsk : 1; - uint32_t conidstschngmsk : 1; - uint32_t reserved_27_27 : 1; - uint32_t ptxfempmsk : 1; - uint32_t hchintmsk : 1; - uint32_t prtintmsk : 1; - uint32_t reserved_23_23 : 1; - uint32_t fetsuspmsk : 1; - uint32_t incomplpmsk : 1; - uint32_t incompisoinmsk : 1; - uint32_t oepintmsk : 1; - uint32_t inepintmsk : 1; - uint32_t epmismsk : 1; - uint32_t reserved_16_16 : 1; - uint32_t eopfmsk : 1; - uint32_t isooutdropmsk : 1; - uint32_t enumdonemsk : 1; - uint32_t usbrstmsk : 1; - uint32_t usbsuspmsk : 1; - uint32_t erlysuspmsk : 1; - uint32_t i2cint : 1; - uint32_t ulpickintmsk : 1; - uint32_t goutnakeffmsk : 1; - uint32_t ginnakeffmsk : 1; - uint32_t nptxfempmsk : 1; - uint32_t rxflvlmsk : 1; - uint32_t sofmsk : 1; - uint32_t otgintmsk : 1; - uint32_t modemismsk : 1; - uint32_t reserved_0_0 : 1; + __BITFIELD_FIELD(uint32_t wkupintmsk : 1, + __BITFIELD_FIELD(uint32_t sessreqintmsk : 1, + __BITFIELD_FIELD(uint32_t disconnintmsk : 1, + __BITFIELD_FIELD(uint32_t conidstschngmsk : 1, + __BITFIELD_FIELD(uint32_t reserved_27_27 : 1, + __BITFIELD_FIELD(uint32_t ptxfempmsk : 1, + __BITFIELD_FIELD(uint32_t hchintmsk : 1, + __BITFIELD_FIELD(uint32_t prtintmsk : 1, + __BITFIELD_FIELD(uint32_t reserved_23_23 : 1, + __BITFIELD_FIELD(uint32_t fetsuspmsk : 1, + __BITFIELD_FIELD(uint32_t incomplpmsk : 1, + __BITFIELD_FIELD(uint32_t incompisoinmsk : 1, + __BITFIELD_FIELD(uint32_t oepintmsk : 1, + __BITFIELD_FIELD(uint32_t inepintmsk : 1, + __BITFIELD_FIELD(uint32_t epmismsk : 1, + __BITFIELD_FIELD(uint32_t reserved_16_16 : 1, + __BITFIELD_FIELD(uint32_t eopfmsk : 1, + __BITFIELD_FIELD(uint32_t isooutdropmsk : 1, + __BITFIELD_FIELD(uint32_t enumdonemsk : 1, + __BITFIELD_FIELD(uint32_t usbrstmsk : 1, + __BITFIELD_FIELD(uint32_t usbsuspmsk : 1, + __BITFIELD_FIELD(uint32_t erlysuspmsk : 1, + __BITFIELD_FIELD(uint32_t i2cint : 1, + __BITFIELD_FIELD(uint32_t ulpickintmsk : 1, + __BITFIELD_FIELD(uint32_t goutnakeffmsk : 1, + __BITFIELD_FIELD(uint32_t ginnakeffmsk : 1, + __BITFIELD_FIELD(uint32_t nptxfempmsk : 1, + __BITFIELD_FIELD(uint32_t rxflvlmsk : 1, + __BITFIELD_FIELD(uint32_t sofmsk : 1, + __BITFIELD_FIELD(uint32_t otgintmsk : 1, + __BITFIELD_FIELD(uint32_t modemismsk : 1, + __BITFIELD_FIELD(uint32_t reserved_0_0 : 1, + ;)))))))))))))))))))))))))))))))) } s; }; @@ -504,38 +509,39 @@ union cvmx_usbcx_gintsts { * * 1'b1: Host mode */ struct cvmx_usbcx_gintsts_s { - uint32_t wkupint : 1; - uint32_t sessreqint : 1; - uint32_t disconnint : 1; - uint32_t conidstschng : 1; - uint32_t reserved_27_27 : 1; - uint32_t ptxfemp : 1; - uint32_t hchint : 1; - uint32_t prtint : 1; - uint32_t reserved_23_23 : 1; - uint32_t fetsusp : 1; - uint32_t incomplp : 1; - uint32_t incompisoin : 1; - uint32_t oepint : 1; - uint32_t iepint : 1; - uint32_t epmis : 1; - uint32_t reserved_16_16 : 1; - uint32_t eopf : 1; - uint32_t isooutdrop : 1; - uint32_t enumdone : 1; - uint32_t usbrst : 1; - uint32_t usbsusp : 1; - uint32_t erlysusp : 1; - uint32_t i2cint : 1; - uint32_t ulpickint : 1; - uint32_t goutnakeff : 1; - uint32_t ginnakeff : 1; - uint32_t nptxfemp : 1; - uint32_t rxflvl : 1; - uint32_t sof : 1; - uint32_t otgint : 1; - uint32_t modemis : 1; - uint32_t curmod : 1; + __BITFIELD_FIELD(uint32_t wkupint : 1, + __BITFIELD_FIELD(uint32_t sessreqint : 1, + __BITFIELD_FIELD(uint32_t disconnint : 1, + __BITFIELD_FIELD(uint32_t conidstschng : 1, + __BITFIELD_FIELD(uint32_t reserved_27_27 : 1, + __BITFIELD_FIELD(uint32_t ptxfemp : 1, + __BITFIELD_FIELD(uint32_t hchint : 1, + __BITFIELD_FIELD(uint32_t prtint : 1, + __BITFIELD_FIELD(uint32_t reserved_23_23 : 1, + __BITFIELD_FIELD(uint32_t fetsusp : 1, + __BITFIELD_FIELD(uint32_t incomplp : 1, + __BITFIELD_FIELD(uint32_t incompisoin : 1, + __BITFIELD_FIELD(uint32_t oepint : 1, + __BITFIELD_FIELD(uint32_t iepint : 1, + __BITFIELD_FIELD(uint32_t epmis : 1, + __BITFIELD_FIELD(uint32_t reserved_16_16 : 1, + __BITFIELD_FIELD(uint32_t eopf : 1, + __BITFIELD_FIELD(uint32_t isooutdrop : 1, + __BITFIELD_FIELD(uint32_t enumdone : 1, + __BITFIELD_FIELD(uint32_t usbrst : 1, + __BITFIELD_FIELD(uint32_t usbsusp : 1, + __BITFIELD_FIELD(uint32_t erlysusp : 1, + __BITFIELD_FIELD(uint32_t i2cint : 1, + __BITFIELD_FIELD(uint32_t ulpickint : 1, + __BITFIELD_FIELD(uint32_t goutnakeff : 1, + __BITFIELD_FIELD(uint32_t ginnakeff : 1, + __BITFIELD_FIELD(uint32_t nptxfemp : 1, + __BITFIELD_FIELD(uint32_t rxflvl : 1, + __BITFIELD_FIELD(uint32_t sof : 1, + __BITFIELD_FIELD(uint32_t otgint : 1, + __BITFIELD_FIELD(uint32_t modemis : 1, + __BITFIELD_FIELD(uint32_t curmod : 1, + ;)))))))))))))))))))))))))))))))) } s; }; @@ -560,8 +566,9 @@ union cvmx_usbcx_gnptxfsiz { * Transmit FIFO RAM. */ struct cvmx_usbcx_gnptxfsiz_s { - uint32_t nptxfdep : 16; - uint32_t nptxfstaddr : 16; + __BITFIELD_FIELD(uint32_t nptxfdep : 16, + __BITFIELD_FIELD(uint32_t nptxfstaddr : 16, + ;)) } s; }; @@ -610,10 +617,11 @@ union cvmx_usbcx_gnptxsts { * * Others: Reserved */ struct cvmx_usbcx_gnptxsts_s { - uint32_t reserved_31_31 : 1; - uint32_t nptxqtop : 7; - uint32_t nptxqspcavail : 8; - uint32_t nptxfspcavail : 16; + __BITFIELD_FIELD(uint32_t reserved_31_31 : 1, + __BITFIELD_FIELD(uint32_t nptxqtop : 7, + __BITFIELD_FIELD(uint32_t nptxqspcavail : 8, + __BITFIELD_FIELD(uint32_t nptxfspcavail : 16, + ;)))) } s; }; @@ -731,16 +739,17 @@ union cvmx_usbcx_grstctl { * selected, the PHY domain has to be reset for proper operation. */ struct cvmx_usbcx_grstctl_s { - uint32_t ahbidle : 1; - uint32_t dmareq : 1; - uint32_t reserved_11_29 : 19; - uint32_t txfnum : 5; - uint32_t txfflsh : 1; - uint32_t rxfflsh : 1; - uint32_t intknqflsh : 1; - uint32_t frmcntrrst : 1; - uint32_t hsftrst : 1; - uint32_t csftrst : 1; + __BITFIELD_FIELD(uint32_t ahbidle : 1, + __BITFIELD_FIELD(uint32_t dmareq : 1, + __BITFIELD_FIELD(uint32_t reserved_11_29 : 19, + __BITFIELD_FIELD(uint32_t txfnum : 5, + __BITFIELD_FIELD(uint32_t txfflsh : 1, + __BITFIELD_FIELD(uint32_t rxfflsh : 1, + __BITFIELD_FIELD(uint32_t intknqflsh : 1, + __BITFIELD_FIELD(uint32_t frmcntrrst : 1, + __BITFIELD_FIELD(uint32_t hsftrst : 1, + __BITFIELD_FIELD(uint32_t csftrst : 1, + ;)))))))))) } s; }; @@ -762,8 +771,9 @@ union cvmx_usbcx_grxfsiz { * * Maximum value is 32768 */ struct cvmx_usbcx_grxfsiz_s { - uint32_t reserved_16_31 : 16; - uint32_t rxfdep : 16; + __BITFIELD_FIELD(uint32_t reserved_16_31 : 16, + __BITFIELD_FIELD(uint32_t rxfdep : 16, + ;)) } s; }; @@ -804,11 +814,12 @@ union cvmx_usbcx_grxstsph { * packet belongs. */ struct cvmx_usbcx_grxstsph_s { - uint32_t reserved_21_31 : 11; - uint32_t pktsts : 4; - uint32_t dpid : 2; - uint32_t bcnt : 11; - uint32_t chnum : 4; + __BITFIELD_FIELD(uint32_t reserved_21_31 : 11, + __BITFIELD_FIELD(uint32_t pktsts : 4, + __BITFIELD_FIELD(uint32_t dpid : 2, + __BITFIELD_FIELD(uint32_t bcnt : 11, + __BITFIELD_FIELD(uint32_t chnum : 4, + ;))))) } s; }; @@ -884,19 +895,20 @@ union cvmx_usbcx_gusbcfg { * * One 48-MHz PHY clock = 0.25 bit times */ struct cvmx_usbcx_gusbcfg_s { - uint32_t reserved_17_31 : 15; - uint32_t otgi2csel : 1; - uint32_t phylpwrclksel : 1; - uint32_t reserved_14_14 : 1; - uint32_t usbtrdtim : 4; - uint32_t hnpcap : 1; - uint32_t srpcap : 1; - uint32_t ddrsel : 1; - uint32_t physel : 1; - uint32_t fsintf : 1; - uint32_t ulpi_utmi_sel : 1; - uint32_t phyif : 1; - uint32_t toutcal : 3; + __BITFIELD_FIELD(uint32_t reserved_17_31 : 15, + __BITFIELD_FIELD(uint32_t otgi2csel : 1, + __BITFIELD_FIELD(uint32_t phylpwrclksel : 1, + __BITFIELD_FIELD(uint32_t reserved_14_14 : 1, + __BITFIELD_FIELD(uint32_t usbtrdtim : 4, + __BITFIELD_FIELD(uint32_t hnpcap : 1, + __BITFIELD_FIELD(uint32_t srpcap : 1, + __BITFIELD_FIELD(uint32_t ddrsel : 1, + __BITFIELD_FIELD(uint32_t physel : 1, + __BITFIELD_FIELD(uint32_t fsintf : 1, + __BITFIELD_FIELD(uint32_t ulpi_utmi_sel : 1, + __BITFIELD_FIELD(uint32_t phyif : 1, + __BITFIELD_FIELD(uint32_t toutcal : 3, + ;))))))))))))) } s; }; @@ -920,8 +932,9 @@ union cvmx_usbcx_haint { * One bit per channel: Bit 0 for Channel 0, bit 15 for Channel 15 */ struct cvmx_usbcx_haint_s { - uint32_t reserved_16_31 : 16; - uint32_t haint : 16; + __BITFIELD_FIELD(uint32_t reserved_16_31 : 16, + __BITFIELD_FIELD(uint32_t haint : 16, + ;)) } s; }; @@ -944,8 +957,9 @@ union cvmx_usbcx_haintmsk { * One bit per channel: Bit 0 for channel 0, bit 15 for channel 15 */ struct cvmx_usbcx_haintmsk_s { - uint32_t reserved_16_31 : 16; - uint32_t haintmsk : 16; + __BITFIELD_FIELD(uint32_t reserved_16_31 : 16, + __BITFIELD_FIELD(uint32_t haintmsk : 16, + ;)) } s; }; @@ -1014,17 +1028,18 @@ union cvmx_usbcx_hccharx { * Indicates the maximum packet size of the associated endpoint. */ struct cvmx_usbcx_hccharx_s { - uint32_t chena : 1; - uint32_t chdis : 1; - uint32_t oddfrm : 1; - uint32_t devaddr : 7; - uint32_t ec : 2; - uint32_t eptype : 2; - uint32_t lspddev : 1; - uint32_t reserved_16_16 : 1; - uint32_t epdir : 1; - uint32_t epnum : 4; - uint32_t mps : 11; + __BITFIELD_FIELD(uint32_t chena : 1, + __BITFIELD_FIELD(uint32_t chdis : 1, + __BITFIELD_FIELD(uint32_t oddfrm : 1, + __BITFIELD_FIELD(uint32_t devaddr : 7, + __BITFIELD_FIELD(uint32_t ec : 2, + __BITFIELD_FIELD(uint32_t eptype : 2, + __BITFIELD_FIELD(uint32_t lspddev : 1, + __BITFIELD_FIELD(uint32_t reserved_16_16 : 1, + __BITFIELD_FIELD(uint32_t epdir : 1, + __BITFIELD_FIELD(uint32_t epnum : 4, + __BITFIELD_FIELD(uint32_t mps : 11, + ;))))))))))) } s; }; @@ -1069,9 +1084,10 @@ union cvmx_usbcx_hcfg { * * 2'b11: Reserved */ struct cvmx_usbcx_hcfg_s { - uint32_t reserved_3_31 : 29; - uint32_t fslssupp : 1; - uint32_t fslspclksel : 2; + __BITFIELD_FIELD(uint32_t reserved_3_31 : 29, + __BITFIELD_FIELD(uint32_t fslssupp : 1, + __BITFIELD_FIELD(uint32_t fslspclksel : 2, + ;))) } s; }; @@ -1110,18 +1126,19 @@ union cvmx_usbcx_hcintx { * Transfer completed normally without any errors. */ struct cvmx_usbcx_hcintx_s { - uint32_t reserved_11_31 : 21; - uint32_t datatglerr : 1; - uint32_t frmovrun : 1; - uint32_t bblerr : 1; - uint32_t xacterr : 1; - uint32_t nyet : 1; - uint32_t ack : 1; - uint32_t nak : 1; - uint32_t stall : 1; - uint32_t ahberr : 1; - uint32_t chhltd : 1; - uint32_t xfercompl : 1; + __BITFIELD_FIELD(uint32_t reserved_11_31 : 21, + __BITFIELD_FIELD(uint32_t datatglerr : 1, + __BITFIELD_FIELD(uint32_t frmovrun : 1, + __BITFIELD_FIELD(uint32_t bblerr : 1, + __BITFIELD_FIELD(uint32_t xacterr : 1, + __BITFIELD_FIELD(uint32_t nyet : 1, + __BITFIELD_FIELD(uint32_t ack : 1, + __BITFIELD_FIELD(uint32_t nak : 1, + __BITFIELD_FIELD(uint32_t stall : 1, + __BITFIELD_FIELD(uint32_t ahberr : 1, + __BITFIELD_FIELD(uint32_t chhltd : 1, + __BITFIELD_FIELD(uint32_t xfercompl : 1, + ;)))))))))))) } s; }; @@ -1151,18 +1168,19 @@ union cvmx_usbcx_hcintmskx { * @xfercomplmsk: Transfer Completed Mask (XferComplMsk) */ struct cvmx_usbcx_hcintmskx_s { - uint32_t reserved_11_31 : 21; - uint32_t datatglerrmsk : 1; - uint32_t frmovrunmsk : 1; - uint32_t bblerrmsk : 1; - uint32_t xacterrmsk : 1; - uint32_t nyetmsk : 1; - uint32_t ackmsk : 1; - uint32_t nakmsk : 1; - uint32_t stallmsk : 1; - uint32_t ahberrmsk : 1; - uint32_t chhltdmsk : 1; - uint32_t xfercomplmsk : 1; + __BITFIELD_FIELD(uint32_t reserved_11_31 : 21, + __BITFIELD_FIELD(uint32_t datatglerrmsk : 1, + __BITFIELD_FIELD(uint32_t frmovrunmsk : 1, + __BITFIELD_FIELD(uint32_t bblerrmsk : 1, + __BITFIELD_FIELD(uint32_t xacterrmsk : 1, + __BITFIELD_FIELD(uint32_t nyetmsk : 1, + __BITFIELD_FIELD(uint32_t ackmsk : 1, + __BITFIELD_FIELD(uint32_t nakmsk : 1, + __BITFIELD_FIELD(uint32_t stallmsk : 1, + __BITFIELD_FIELD(uint32_t ahberrmsk : 1, + __BITFIELD_FIELD(uint32_t chhltdmsk : 1, + __BITFIELD_FIELD(uint32_t xfercomplmsk : 1, + ;)))))))))))) } s; }; @@ -1201,12 +1219,13 @@ union cvmx_usbcx_hcspltx { * translator. */ struct cvmx_usbcx_hcspltx_s { - uint32_t spltena : 1; - uint32_t reserved_17_30 : 14; - uint32_t compsplt : 1; - uint32_t xactpos : 2; - uint32_t hubaddr : 7; - uint32_t prtaddr : 7; + __BITFIELD_FIELD(uint32_t spltena : 1, + __BITFIELD_FIELD(uint32_t reserved_17_30 : 14, + __BITFIELD_FIELD(uint32_t compsplt : 1, + __BITFIELD_FIELD(uint32_t xactpos : 2, + __BITFIELD_FIELD(uint32_t hubaddr : 7, + __BITFIELD_FIELD(uint32_t prtaddr : 7, + ;)))))) } s; }; @@ -1246,10 +1265,11 @@ union cvmx_usbcx_hctsizx { * size for IN transactions (periodic and non-periodic). */ struct cvmx_usbcx_hctsizx_s { - uint32_t dopng : 1; - uint32_t pid : 2; - uint32_t pktcnt : 10; - uint32_t xfersize : 19; + __BITFIELD_FIELD(uint32_t dopng : 1, + __BITFIELD_FIELD(uint32_t pid : 2, + __BITFIELD_FIELD(uint32_t pktcnt : 10, + __BITFIELD_FIELD(uint32_t xfersize : 19, + ;)))) } s; }; @@ -1283,8 +1303,9 @@ union cvmx_usbcx_hfir { * * 1 ms (PHY clock frequency for FS/LS) */ struct cvmx_usbcx_hfir_s { - uint32_t reserved_16_31 : 16; - uint32_t frint : 16; + __BITFIELD_FIELD(uint32_t reserved_16_31 : 16, + __BITFIELD_FIELD(uint32_t frint : 16, + ;)) } s; }; @@ -1312,8 +1333,9 @@ union cvmx_usbcx_hfnum { * USB, and is reset to 0 when it reaches 16'h3FFF. */ struct cvmx_usbcx_hfnum_s { - uint32_t frrem : 16; - uint32_t frnum : 16; + __BITFIELD_FIELD(uint32_t frrem : 16, + __BITFIELD_FIELD(uint32_t frnum : 16, + ;)) } s; }; @@ -1439,21 +1461,22 @@ union cvmx_usbcx_hprt { * * 1: A device is attached to the port. */ struct cvmx_usbcx_hprt_s { - uint32_t reserved_19_31 : 13; - uint32_t prtspd : 2; - uint32_t prttstctl : 4; - uint32_t prtpwr : 1; - uint32_t prtlnsts : 2; - uint32_t reserved_9_9 : 1; - uint32_t prtrst : 1; - uint32_t prtsusp : 1; - uint32_t prtres : 1; - uint32_t prtovrcurrchng : 1; - uint32_t prtovrcurract : 1; - uint32_t prtenchng : 1; - uint32_t prtena : 1; - uint32_t prtconndet : 1; - uint32_t prtconnsts : 1; + __BITFIELD_FIELD(uint32_t reserved_19_31 : 13, + __BITFIELD_FIELD(uint32_t prtspd : 2, + __BITFIELD_FIELD(uint32_t prttstctl : 4, + __BITFIELD_FIELD(uint32_t prtpwr : 1, + __BITFIELD_FIELD(uint32_t prtlnsts : 2, + __BITFIELD_FIELD(uint32_t reserved_9_9 : 1, + __BITFIELD_FIELD(uint32_t prtrst : 1, + __BITFIELD_FIELD(uint32_t prtsusp : 1, + __BITFIELD_FIELD(uint32_t prtres : 1, + __BITFIELD_FIELD(uint32_t prtovrcurrchng : 1, + __BITFIELD_FIELD(uint32_t prtovrcurract : 1, + __BITFIELD_FIELD(uint32_t prtenchng : 1, + __BITFIELD_FIELD(uint32_t prtena : 1, + __BITFIELD_FIELD(uint32_t prtconndet : 1, + __BITFIELD_FIELD(uint32_t prtconnsts : 1, + ;))))))))))))))) } s; }; @@ -1476,8 +1499,9 @@ union cvmx_usbcx_hptxfsiz { * @ptxfstaddr: Host Periodic TxFIFO Start Address (PTxFStAddr) */ struct cvmx_usbcx_hptxfsiz_s { - uint32_t ptxfsize : 16; - uint32_t ptxfstaddr : 16; + __BITFIELD_FIELD(uint32_t ptxfsize : 16, + __BITFIELD_FIELD(uint32_t ptxfstaddr : 16, + ;)) } s; }; @@ -1531,9 +1555,10 @@ union cvmx_usbcx_hptxsts { * * Others: Reserved */ struct cvmx_usbcx_hptxsts_s { - uint32_t ptxqtop : 8; - uint32_t ptxqspcavail : 8; - uint32_t ptxfspcavail : 16; + __BITFIELD_FIELD(uint32_t ptxqtop : 8, + __BITFIELD_FIELD(uint32_t ptxqspcavail : 8, + __BITFIELD_FIELD(uint32_t ptxfspcavail : 16, + ;))) } s; }; @@ -1636,21 +1661,22 @@ union cvmx_usbnx_clk_ctl { * until AFTER this field is set and then read. */ struct cvmx_usbnx_clk_ctl_s { - uint64_t reserved_20_63 : 44; - uint64_t divide2 : 2; - uint64_t hclk_rst : 1; - uint64_t p_x_on : 1; - uint64_t p_rtype : 2; - uint64_t p_com_on : 1; - uint64_t p_c_sel : 2; - uint64_t cdiv_byp : 1; - uint64_t sd_mode : 2; - uint64_t s_bist : 1; - uint64_t por : 1; - uint64_t enable : 1; - uint64_t prst : 1; - uint64_t hrst : 1; - uint64_t divide : 3; + __BITFIELD_FIELD(uint64_t reserved_20_63 : 44, + __BITFIELD_FIELD(uint64_t divide2 : 2, + __BITFIELD_FIELD(uint64_t hclk_rst : 1, + __BITFIELD_FIELD(uint64_t p_x_on : 1, + __BITFIELD_FIELD(uint64_t p_rtype : 2, + __BITFIELD_FIELD(uint64_t p_com_on : 1, + __BITFIELD_FIELD(uint64_t p_c_sel : 2, + __BITFIELD_FIELD(uint64_t cdiv_byp : 1, + __BITFIELD_FIELD(uint64_t sd_mode : 2, + __BITFIELD_FIELD(uint64_t s_bist : 1, + __BITFIELD_FIELD(uint64_t por : 1, + __BITFIELD_FIELD(uint64_t enable : 1, + __BITFIELD_FIELD(uint64_t prst : 1, + __BITFIELD_FIELD(uint64_t hrst : 1, + __BITFIELD_FIELD(uint64_t divide : 3, + ;))))))))))))))) } s; }; @@ -1778,41 +1804,42 @@ union cvmx_usbnx_usbp_ctl_status { * de-assertion. */ struct cvmx_usbnx_usbp_ctl_status_s { - uint64_t txrisetune : 1; - uint64_t txvreftune : 4; - uint64_t txfslstune : 4; - uint64_t txhsxvtune : 2; - uint64_t sqrxtune : 3; - uint64_t compdistune : 3; - uint64_t otgtune : 3; - uint64_t otgdisable : 1; - uint64_t portreset : 1; - uint64_t drvvbus : 1; - uint64_t lsbist : 1; - uint64_t fsbist : 1; - uint64_t hsbist : 1; - uint64_t bist_done : 1; - uint64_t bist_err : 1; - uint64_t tdata_out : 4; - uint64_t siddq : 1; - uint64_t txpreemphasistune : 1; - uint64_t dma_bmode : 1; - uint64_t usbc_end : 1; - uint64_t usbp_bist : 1; - uint64_t tclk : 1; - uint64_t dp_pulld : 1; - uint64_t dm_pulld : 1; - uint64_t hst_mode : 1; - uint64_t tuning : 4; - uint64_t tx_bs_enh : 1; - uint64_t tx_bs_en : 1; - uint64_t loop_enb : 1; - uint64_t vtest_enb : 1; - uint64_t bist_enb : 1; - uint64_t tdata_sel : 1; - uint64_t taddr_in : 4; - uint64_t tdata_in : 8; - uint64_t ate_reset : 1; + __BITFIELD_FIELD(uint64_t txrisetune : 1, + __BITFIELD_FIELD(uint64_t txvreftune : 4, + __BITFIELD_FIELD(uint64_t txfslstune : 4, + __BITFIELD_FIELD(uint64_t txhsxvtune : 2, + __BITFIELD_FIELD(uint64_t sqrxtune : 3, + __BITFIELD_FIELD(uint64_t compdistune : 3, + __BITFIELD_FIELD(uint64_t otgtune : 3, + __BITFIELD_FIELD(uint64_t otgdisable : 1, + __BITFIELD_FIELD(uint64_t portreset : 1, + __BITFIELD_FIELD(uint64_t drvvbus : 1, + __BITFIELD_FIELD(uint64_t lsbist : 1, + __BITFIELD_FIELD(uint64_t fsbist : 1, + __BITFIELD_FIELD(uint64_t hsbist : 1, + __BITFIELD_FIELD(uint64_t bist_done : 1, + __BITFIELD_FIELD(uint64_t bist_err : 1, + __BITFIELD_FIELD(uint64_t tdata_out : 4, + __BITFIELD_FIELD(uint64_t siddq : 1, + __BITFIELD_FIELD(uint64_t txpreemphasistune : 1, + __BITFIELD_FIELD(uint64_t dma_bmode : 1, + __BITFIELD_FIELD(uint64_t usbc_end : 1, + __BITFIELD_FIELD(uint64_t usbp_bist : 1, + __BITFIELD_FIELD(uint64_t tclk : 1, + __BITFIELD_FIELD(uint64_t dp_pulld : 1, + __BITFIELD_FIELD(uint64_t dm_pulld : 1, + __BITFIELD_FIELD(uint64_t hst_mode : 1, + __BITFIELD_FIELD(uint64_t tuning : 4, + __BITFIELD_FIELD(uint64_t tx_bs_enh : 1, + __BITFIELD_FIELD(uint64_t tx_bs_en : 1, + __BITFIELD_FIELD(uint64_t loop_enb : 1, + __BITFIELD_FIELD(uint64_t vtest_enb : 1, + __BITFIELD_FIELD(uint64_t bist_enb : 1, + __BITFIELD_FIELD(uint64_t tdata_sel : 1, + __BITFIELD_FIELD(uint64_t taddr_in : 4, + __BITFIELD_FIELD(uint64_t tdata_in : 8, + __BITFIELD_FIELD(uint64_t ate_reset : 1, + ;))))))))))))))))))))))))))))))))))) } s; }; -- cgit v1.2.3 From d712648a22851bef1a830274a3b5793178d3493d Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:51 +0200 Subject: staging: octeon-usb: program DMA engine based on transfer direction Program DMA engine based on transfer direction. We are only transferring to one direction at a time. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 1ec70eb490d1..a8c467ff4204 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -1636,8 +1636,9 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state *usb, int channel, usbc_haintmsk.u32); } - /* Setup the locations the DMA engines use */ + /* Setup the location the DMA engine uses. */ { + uint64_t reg; uint64_t dma_address = transaction->buffer + transaction->actual_bytes; @@ -1646,12 +1647,11 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state *usb, int channel, transaction->iso_packets[0].offset + transaction->actual_bytes; - cvmx_write64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) + - channel * 8, - dma_address); - cvmx_write64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + - channel * 8, - dma_address); + if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) + reg = CVMX_USBNX_DMA0_OUTB_CHN0(usb->index); + else + reg = CVMX_USBNX_DMA0_INB_CHN0(usb->index); + cvmx_write64_uint64(reg + channel * 8, dma_address); } /* Setup both the size of the transfer and the SPLIT characteristics */ -- cgit v1.2.3 From 532edc93e23e656094ede793c92207a2c237740e Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:52 +0200 Subject: staging: octeon-usb: never retry after xacterr Never retry after xacterr. The DMA engine cannot handle that properly and may result in wrong transfer count and hang. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 38 +++++---------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index a8c467ff4204..40e22e4bc75a 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -2685,40 +2685,12 @@ static int cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) CVMX_USB_COMPLETE_STALL); } else if (usbc_hcint.s.xacterr) { /* - * We know at least one packet worked if we get a ACK or NAK. - * Reset the retry counter + * XactErr as a response means the device signaled + * something wrong with the transfer. For example, PID + * toggle errors cause these. */ - if (usbc_hcint.s.nak || usbc_hcint.s.ack) - transaction->retries = 0; - transaction->retries++; - if (transaction->retries > MAX_RETRIES) { - /* - * XactErr as a response means the device signaled - * something wrong with the transfer. For example, PID - * toggle errors cause these - */ - cvmx_usb_perform_complete(usb, pipe, transaction, - CVMX_USB_COMPLETE_XACTERR); - } else { - /* - * If this was a split then clear our split in progress - * marker - */ - if (usb->active_split == transaction) - usb->active_split = NULL; - /* - * Rewind to the beginning of the transaction by anding - * off the split complete bit - */ - transaction->stage &= ~1; - pipe->split_sc_frame = -1; - pipe->next_tx_frame += pipe->interval; - if (pipe->next_tx_frame < usb->frame_number) - pipe->next_tx_frame = - usb->frame_number + pipe->interval - - (usb->frame_number - - pipe->next_tx_frame) % pipe->interval; - } + cvmx_usb_perform_complete(usb, pipe, transaction, + CVMX_USB_COMPLETE_XACTERR); } else if (usbc_hcint.s.bblerr) { /* Babble Error (BblErr) */ cvmx_usb_perform_complete(usb, pipe, transaction, -- cgit v1.2.3 From b5e79e6ea6d21c342a94dda9f5d91a3e8d882e56 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:53 +0200 Subject: staging: octeon-usb: refactor usbn block init Move one-time state data structure initialization out of cvmx_usb_initialize(). This enables to re-initialize USBN HW block without messing up data structures. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 57 +++++++++++++++------------------ 1 file changed, 25 insertions(+), 32 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 40e22e4bc75a..8a185ff7e932 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -613,31 +613,14 @@ static inline int cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe) * other access to the Octeon USB port is made. The port starts * off in the disabled state. * - * @usb: Pointer to an empty struct cvmx_usb_state - * that will be populated by the initialize call. - * This structure is then passed to all other USB - * functions. - * @usb_port_number: - * Which Octeon USB port to initialize. + * @usb: Pointer to struct cvmx_usb_state. * * Returns: 0 or a negative error code. */ -static int cvmx_usb_initialize(struct cvmx_usb_state *usb, - int usb_port_number, - enum cvmx_usb_initialize_flags flags) +static int cvmx_usb_initialize(struct cvmx_usb_state *usb) { union cvmx_usbnx_clk_ctl usbn_clk_ctl; union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status; - int i; - - memset(usb, 0, sizeof(*usb)); - usb->init_flags = flags; - - /* Initialize the USB state structure */ - usb->index = usb_port_number; - INIT_LIST_HEAD(&usb->idle_pipes); - for (i = 0; i < ARRAY_SIZE(usb->active_pipes); i++) - INIT_LIST_HEAD(&usb->active_pipes[i]); /* * Power On Reset and PHY Initialization @@ -672,7 +655,8 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, /* From CN52XX manual */ usbn_clk_ctl.s.p_rtype = 1; - switch (flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK) { + switch (usb->init_flags & + CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK) { case CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ: usbn_clk_ctl.s.p_c_sel = 0; break; @@ -791,20 +775,9 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb, */ { union cvmx_usbcx_gahbcfg usbcx_gahbcfg; - /* Due to an errata, CN31XX doesn't support DMA */ - if (OCTEON_IS_MODEL(OCTEON_CN31XX)) - usb->init_flags |= CVMX_USB_INITIALIZE_FLAGS_NO_DMA; usbcx_gahbcfg.u32 = 0; usbcx_gahbcfg.s.dmaen = !(usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA); - if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) - /* Only use one channel with non DMA */ - usb->idle_hardware_channels = 0x1; - else if (OCTEON_IS_MODEL(OCTEON_CN5XXX)) - /* CN5XXX have an errata with channel 3 */ - usb->idle_hardware_channels = 0xf7; - else - usb->idle_hardware_channels = 0xff; usbcx_gahbcfg.s.hbstlen = 0; usbcx_gahbcfg.s.nptxfemplvl = 1; usbcx_gahbcfg.s.ptxfemplvl = 1; @@ -3709,7 +3682,27 @@ static int octeon_usb_probe(struct platform_device *pdev) spin_lock_init(&priv->lock); - status = cvmx_usb_initialize(&priv->usb, usb_num, initialize_flags); + priv->usb.init_flags = initialize_flags; + + /* Initialize the USB state structure */ + priv->usb.index = usb_num; + INIT_LIST_HEAD(&priv->usb.idle_pipes); + for (i = 0; i < ARRAY_SIZE(priv->usb.active_pipes); i++) + INIT_LIST_HEAD(&priv->usb.active_pipes[i]); + + /* Due to an errata, CN31XX doesn't support DMA */ + if (OCTEON_IS_MODEL(OCTEON_CN31XX)) { + priv->usb.init_flags |= CVMX_USB_INITIALIZE_FLAGS_NO_DMA; + /* Only use one channel with non DMA */ + priv->usb.idle_hardware_channels = 0x1; + } else if (OCTEON_IS_MODEL(OCTEON_CN5XXX)) { + /* CN5XXX have an errata with channel 3 */ + priv->usb.idle_hardware_channels = 0xf7; + } else { + priv->usb.idle_hardware_channels = 0xff; + } + + status = cvmx_usb_initialize(&priv->usb); if (status) { dev_dbg(dev, "USB initialization failed with %d\n", status); kfree(hcd); -- cgit v1.2.3 From c8eedbd107cc73d6dfb5f8df2307c43cf27b0107 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:54 +0200 Subject: staging: octeon-usb: don't poll interrupts early Don't poll interrupts before we have registered the HCD. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 8a185ff7e932..1f501ff34a62 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -3712,10 +3712,6 @@ static int octeon_usb_probe(struct platform_device *pdev) /* This delay is needed for CN3010, but I don't know why... */ mdelay(10); - spin_lock_irqsave(&priv->lock, flags); - cvmx_usb_poll(&priv->usb); - spin_unlock_irqrestore(&priv->lock, flags); - status = usb_add_hcd(hcd, irq, 0); if (status) { dev_dbg(dev, "USB add HCD failed with %d\n", status); -- cgit v1.2.3 From 0ed64a4c8f5d53aaa6b20e7424b127be7392f700 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:55 +0200 Subject: staging: octeon-usb: use USB stack to turn on power Use USB stack to turn on the power bit. It will also do the necessary delays. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 1f501ff34a62..30a96ff869e4 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -860,12 +860,6 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb) cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), usbcx_hcfg.u32); } - /* - * 3. Program the port power bit to drive VBUS on the USB, - * USBC_HPRT[PRTPWR] = 1 - */ - USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), - union cvmx_usbcx_hprt, prtpwr, 1); /* * Steps 4-15 from the manual are done later in the port enable @@ -3354,6 +3348,7 @@ static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, struct octeon_hcd *priv = hcd_to_octeon(hcd); struct device *dev = hcd->self.controller; struct cvmx_usb_port_status usb_port_status; + struct cvmx_usb_state *usb = &priv->usb; int port_status; struct usb_hub_descriptor *desc; unsigned long flags; @@ -3531,7 +3526,14 @@ static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, return -EINVAL; case USB_PORT_FEAT_POWER: dev_dbg(dev, " POWER\n"); - return -EINVAL; + /* + * Program the port power bit to drive VBUS on the USB. + */ + spin_lock_irqsave(&priv->lock, flags); + USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), + union cvmx_usbcx_hprt, prtpwr, 1); + spin_unlock_irqrestore(&priv->lock, flags); + return 0; case USB_PORT_FEAT_RESET: dev_dbg(dev, " RESET\n"); spin_lock_irqsave(&priv->lock, flags); @@ -3709,9 +3711,6 @@ static int octeon_usb_probe(struct platform_device *pdev) return -1; } - /* This delay is needed for CN3010, but I don't know why... */ - mdelay(10); - status = usb_add_hcd(hcd, irq, 0); if (status) { dev_dbg(dev, "USB add HCD failed with %d\n", status); -- cgit v1.2.3 From 2263251fbb3f7e79b8c2dafdf45614522ddb43f4 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:56 +0200 Subject: staging: octeon-usb: move fifo setup into a separate routine Move FIFO setup into a separate routine. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 107 ++++++++++++++++---------------- 1 file changed, 53 insertions(+), 54 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 30a96ff869e4..4a65af5bb31a 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -608,6 +608,58 @@ static inline int cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe) return 0; /* Data0 */ } +static int cvmx_fifo_setup(struct cvmx_usb_state *usb) +{ + union cvmx_usbcx_ghwcfg3 usbcx_ghwcfg3; + union cvmx_usbcx_gnptxfsiz npsiz; + union cvmx_usbcx_hptxfsiz psiz; + + usbcx_ghwcfg3.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_GHWCFG3(usb->index)); + + /* + * Program the USBC_GRXFSIZ register to select the size of the receive + * FIFO (25%). + */ + USB_SET_FIELD32(CVMX_USBCX_GRXFSIZ(usb->index), + union cvmx_usbcx_grxfsiz, rxfdep, + usbcx_ghwcfg3.s.dfifodepth / 4); + + /* + * Program the USBC_GNPTXFSIZ register to select the size and the start + * address of the non-periodic transmit FIFO for nonperiodic + * transactions (50%). + */ + npsiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index)); + npsiz.s.nptxfdep = usbcx_ghwcfg3.s.dfifodepth / 2; + npsiz.s.nptxfstaddr = usbcx_ghwcfg3.s.dfifodepth / 4; + cvmx_usb_write_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index), npsiz.u32); + + /* + * Program the USBC_HPTXFSIZ register to select the size and start + * address of the periodic transmit FIFO for periodic transactions + * (25%). + */ + psiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index)); + psiz.s.ptxfsize = usbcx_ghwcfg3.s.dfifodepth / 4; + psiz.s.ptxfstaddr = 3 * usbcx_ghwcfg3.s.dfifodepth / 4; + cvmx_usb_write_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index), psiz.u32); + + /* Flush all FIFOs */ + USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), + union cvmx_usbcx_grstctl, txfnum, 0x10); + USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), + union cvmx_usbcx_grstctl, txfflsh, 1); + CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), + union cvmx_usbcx_grstctl, + txfflsh, ==, 0, 100); + USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), + union cvmx_usbcx_grstctl, rxfflsh, 1); + CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), + union cvmx_usbcx_grstctl, + rxfflsh, ==, 0, 100); +} + /** * Initialize a USB port for use. This must be called before any * other access to the Octeon USB port is made. The port starts @@ -913,8 +965,6 @@ static int cvmx_usb_shutdown(struct cvmx_usb_state *usb) */ static int cvmx_usb_enable(struct cvmx_usb_state *usb) { - union cvmx_usbcx_ghwcfg3 usbcx_ghwcfg3; - usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index)); @@ -954,59 +1004,8 @@ static int cvmx_usb_enable(struct cvmx_usb_state *usb) */ usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index)); - usbcx_ghwcfg3.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_GHWCFG3(usb->index)); - /* - * 13. Program the USBC_GRXFSIZ register to select the size of the - * receive FIFO (25%). - */ - USB_SET_FIELD32(CVMX_USBCX_GRXFSIZ(usb->index), - union cvmx_usbcx_grxfsiz, rxfdep, - usbcx_ghwcfg3.s.dfifodepth / 4); - /* - * 14. Program the USBC_GNPTXFSIZ register to select the size and the - * start address of the non- periodic transmit FIFO for nonperiodic - * transactions (50%). - */ - { - union cvmx_usbcx_gnptxfsiz siz; - - siz.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_GNPTXFSIZ(usb->index)); - siz.s.nptxfdep = usbcx_ghwcfg3.s.dfifodepth / 2; - siz.s.nptxfstaddr = usbcx_ghwcfg3.s.dfifodepth / 4; - cvmx_usb_write_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index), - siz.u32); - } - /* - * 15. Program the USBC_HPTXFSIZ register to select the size and start - * address of the periodic transmit FIFO for periodic transactions - * (25%). - */ - { - union cvmx_usbcx_hptxfsiz siz; - - siz.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HPTXFSIZ(usb->index)); - siz.s.ptxfsize = usbcx_ghwcfg3.s.dfifodepth / 4; - siz.s.ptxfstaddr = 3 * usbcx_ghwcfg3.s.dfifodepth / 4; - cvmx_usb_write_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index), - siz.u32); - } - /* Flush all FIFOs */ - USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, txfnum, 0x10); - USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, txfflsh, 1); - CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, - txfflsh, ==, 0, 100); - USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, rxfflsh, 1); - CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, - rxfflsh, ==, 0, 100); + cvmx_fifo_setup(usb); return 0; } -- cgit v1.2.3 From 164814bb6e21dfd27952ddcbe65709ed7aa83d4a Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:57 +0200 Subject: staging: octeon-usb: move fifo setup to controller reset from port reset Move FIFO setup to controller reset from port reset. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 4a65af5bb31a..98debd7876b9 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -918,6 +918,8 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb) */ } + cvmx_fifo_setup(usb); + return 0; } @@ -1005,8 +1007,6 @@ static int cvmx_usb_enable(struct cvmx_usb_state *usb) usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index)); - cvmx_fifo_setup(usb); - return 0; } -- cgit v1.2.3 From b0c8c72ba35b34a1fbbc9abe2a023fb27b40d916 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:58 +0200 Subject: staging: octeon-usb: rewrite port reset Don't disable port before resetting. Also perform reset unconditionally when requested. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 98debd7876b9..7aa28dee0e98 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -958,29 +958,16 @@ static int cvmx_usb_shutdown(struct cvmx_usb_state *usb) /** - * Enable a USB port. After this call succeeds, the USB port is + * Reset a USB port. After this call succeeds, the USB port is * online and servicing requests. * * @usb: USB device state populated by cvmx_usb_initialize(). - * - * Returns: 0 or a negative error code. */ -static int cvmx_usb_enable(struct cvmx_usb_state *usb) +static void cvmx_usb_reset_port(struct cvmx_usb_state *usb) { usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index)); - /* - * If the port is already enabled the just return. We don't need to do - * anything - */ - if (usb->usbcx_hprt.s.prtena) - return 0; - - /* If there is nothing plugged into the port then fail immediately */ - if (!usb->usbcx_hprt.s.prtconnsts) - return -ETIMEDOUT; - /* Program the port reset bit to start the reset process */ USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), union cvmx_usbcx_hprt, prtrst, 1); @@ -995,19 +982,12 @@ static int cvmx_usb_enable(struct cvmx_usb_state *usb) USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), union cvmx_usbcx_hprt, prtrst, 0); - /* Wait for the USBC_HPRT[PRTENA]. */ - if (CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_HPRT(usb->index), - union cvmx_usbcx_hprt, prtena, ==, 1, 100000)) - return -ETIMEDOUT; - /* * Read the port speed field to get the enumerated speed, * USBC_HPRT[PRTSPD]. */ usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index)); - - return 0; } @@ -3536,9 +3516,7 @@ static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, case USB_PORT_FEAT_RESET: dev_dbg(dev, " RESET\n"); spin_lock_irqsave(&priv->lock, flags); - cvmx_usb_disable(&priv->usb); - if (cvmx_usb_enable(&priv->usb)) - dev_dbg(dev, "Failed to enable the port\n"); + cvmx_usb_reset_port(&priv->usb); spin_unlock_irqrestore(&priv->lock, flags); return 0; case USB_PORT_FEAT_INDICATOR: -- cgit v1.2.3 From eb04114f37eb434b5bc18293274420d2a664adc2 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:37:59 +0200 Subject: staging: octeon-usb: move cvmx_usb_shutdown() Move cvmx_usb_shutdown() to allow its use from some other functions. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 66 ++++++++++++++++----------------- 1 file changed, 32 insertions(+), 34 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 7aa28dee0e98..84640454ba71 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -660,6 +660,38 @@ static int cvmx_fifo_setup(struct cvmx_usb_state *usb) rxfflsh, ==, 0, 100); } +/** + * Shutdown a USB port after a call to cvmx_usb_initialize(). + * The port should be disabled with all pipes closed when this + * function is called. + * + * @usb: USB device state populated by cvmx_usb_initialize(). + * + * Returns: 0 or a negative error code. + */ +static int cvmx_usb_shutdown(struct cvmx_usb_state *usb) +{ + union cvmx_usbnx_clk_ctl usbn_clk_ctl; + + /* Make sure all pipes are closed */ + if (!list_empty(&usb->idle_pipes) || + !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_ISOCHRONOUS]) || + !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_INTERRUPT]) || + !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_CONTROL]) || + !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_BULK])) + return -EBUSY; + + /* Disable the clocks and put them in power on reset */ + usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index)); + usbn_clk_ctl.s.enable = 1; + usbn_clk_ctl.s.por = 1; + usbn_clk_ctl.s.hclk_rst = 1; + usbn_clk_ctl.s.prst = 0; + usbn_clk_ctl.s.hrst = 0; + cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); + return 0; +} + /** * Initialize a USB port for use. This must be called before any * other access to the Octeon USB port is made. The port starts @@ -923,40 +955,6 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb) return 0; } - -/** - * Shutdown a USB port after a call to cvmx_usb_initialize(). - * The port should be disabled with all pipes closed when this - * function is called. - * - * @usb: USB device state populated by cvmx_usb_initialize(). - * - * Returns: 0 or a negative error code. - */ -static int cvmx_usb_shutdown(struct cvmx_usb_state *usb) -{ - union cvmx_usbnx_clk_ctl usbn_clk_ctl; - - /* Make sure all pipes are closed */ - if (!list_empty(&usb->idle_pipes) || - !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_ISOCHRONOUS]) || - !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_INTERRUPT]) || - !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_CONTROL]) || - !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_BULK])) - return -EBUSY; - - /* Disable the clocks and put them in power on reset */ - usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index)); - usbn_clk_ctl.s.enable = 1; - usbn_clk_ctl.s.por = 1; - usbn_clk_ctl.s.hclk_rst = 1; - usbn_clk_ctl.s.prst = 0; - usbn_clk_ctl.s.hrst = 0; - cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); - return 0; -} - - /** * Reset a USB port. After this call succeeds, the USB port is * online and servicing requests. -- cgit v1.2.3 From f3b8edc0f366bd7049eafa11d0c0187f039c0528 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:38:00 +0200 Subject: staging: octeon-usb: fail and warn if DMA counters are wrong Fail and WARN if DMA counters are wrong. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 84640454ba71..27acab217d21 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -2617,6 +2617,17 @@ static int cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel) (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT)) pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING; + if (unlikely(WARN_ON_ONCE(bytes_this_transfer < 0))) { + /* + * In some rare cases the DMA engine seems to get stuck and + * keeps substracting same byte count over and over again. In + * such case we just need to fail every transaction. + */ + cvmx_usb_perform_complete(usb, pipe, transaction, + CVMX_USB_COMPLETE_ERROR); + return 0; + } + if (usbc_hcint.s.stall) { /* * STALL as a response means this transaction cannot be -- cgit v1.2.3 From 6ad9c95b3a595a2ec516dfcbc677043ea5ac9a76 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:38:01 +0200 Subject: staging: octeon-usb: try to recover from failed hardware reset On some hardware the USB fails to initialize to sane state after cold boot. We can detect this based on some unexpected interrupt bits, and recover by re-initializing. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 27acab217d21..d71ae297c36f 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -697,15 +697,20 @@ static int cvmx_usb_shutdown(struct cvmx_usb_state *usb) * other access to the Octeon USB port is made. The port starts * off in the disabled state. * + * @dev: Pointer to struct device for logging purposes. * @usb: Pointer to struct cvmx_usb_state. * * Returns: 0 or a negative error code. */ -static int cvmx_usb_initialize(struct cvmx_usb_state *usb) +static int cvmx_usb_initialize(struct device *dev, + struct cvmx_usb_state *usb) { + int retries = 0; union cvmx_usbnx_clk_ctl usbn_clk_ctl; + union cvmx_usbcx_gintsts usbc_gintsts; union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status; +retry: /* * Power On Reset and PHY Initialization * @@ -952,7 +957,26 @@ static int cvmx_usb_initialize(struct cvmx_usb_state *usb) cvmx_fifo_setup(usb); - return 0; + /* + * If the controller is getting port events right after the reset, it + * means the initialization failed. Try resetting the controller again + * in such case. This is seen to happen after cold boot on DSR-1000N. + */ + usbc_gintsts.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_GINTSTS(usb->index)); + cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index), + usbc_gintsts.u32); + dev_dbg(dev, "gintsts after reset: 0x%x\n", (int)usbc_gintsts.u32); + if (!usbc_gintsts.s.disconnint && !usbc_gintsts.s.prtint) + return 0; + if (retries++ >= 5) + return -EAGAIN; + dev_info(dev, "controller reset failed (gintsts=0x%x) - retrying\n", + (int)usbc_gintsts.u32); + msleep(50); + cvmx_usb_shutdown(usb); + msleep(50); + goto retry; } /** @@ -3690,7 +3714,7 @@ static int octeon_usb_probe(struct platform_device *pdev) priv->usb.idle_hardware_channels = 0xff; } - status = cvmx_usb_initialize(&priv->usb); + status = cvmx_usb_initialize(dev, &priv->usb); if (status) { dev_dbg(dev, "USB initialization failed with %d\n", status); kfree(hcd); -- cgit v1.2.3 From edc16d8d481e4c73f9d70d648463d4b25d2c662b Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sun, 22 Mar 2015 17:38:02 +0200 Subject: stating: octeon-usb: cvmx_usb_initialize(): eliminate extra indentation Eliminate extra indentation by putting all the code into the same block. Also delete a bogus comment. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 152 ++++++++++++++------------------ 1 file changed, 68 insertions(+), 84 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index d71ae297c36f..feaaafc30976 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -705,9 +705,15 @@ static int cvmx_usb_shutdown(struct cvmx_usb_state *usb) static int cvmx_usb_initialize(struct device *dev, struct cvmx_usb_state *usb) { + int channel; + int divisor; int retries = 0; + union cvmx_usbcx_hcfg usbcx_hcfg; union cvmx_usbnx_clk_ctl usbn_clk_ctl; union cvmx_usbcx_gintsts usbc_gintsts; + union cvmx_usbcx_gahbcfg usbcx_gahbcfg; + union cvmx_usbcx_gintmsk usbcx_gintmsk; + union cvmx_usbcx_gusbcfg usbcx_gusbcfg; union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status; retry: @@ -775,15 +781,14 @@ retry: * setting USBN0/1_CLK_CTL[ENABLE] = 1. Divide the core clock down * such that USB is as close as possible to 125Mhz */ - { - int divisor = DIV_ROUND_UP(octeon_get_clock_rate(), 125000000); - /* Lower than 4 doesn't seem to work properly */ - if (divisor < 4) - divisor = 4; - usbn_clk_ctl.s.divide = divisor; - usbn_clk_ctl.s.divide2 = 0; - } + divisor = DIV_ROUND_UP(octeon_get_clock_rate(), 125000000); + /* Lower than 4 doesn't seem to work properly */ + if (divisor < 4) + divisor = 4; + usbn_clk_ctl.s.divide = divisor; + usbn_clk_ctl.s.divide2 = 0; cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); + /* 2d. Write USBN0/1_CLK_CTL[HCLK_RST] = 1 */ usbn_clk_ctl.s.hclk_rst = 1; cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); @@ -862,18 +867,16 @@ retry: * USBC_GAHBCFG[PTXFEMPLVL] * Global interrupt mask, USBC_GAHBCFG[GLBLINTRMSK] = 1 */ - { - union cvmx_usbcx_gahbcfg usbcx_gahbcfg; - usbcx_gahbcfg.u32 = 0; - usbcx_gahbcfg.s.dmaen = !(usb->init_flags & - CVMX_USB_INITIALIZE_FLAGS_NO_DMA); - usbcx_gahbcfg.s.hbstlen = 0; - usbcx_gahbcfg.s.nptxfemplvl = 1; - usbcx_gahbcfg.s.ptxfemplvl = 1; - usbcx_gahbcfg.s.glblintrmsk = 1; - cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index), - usbcx_gahbcfg.u32); - } + usbcx_gahbcfg.u32 = 0; + usbcx_gahbcfg.s.dmaen = !(usb->init_flags & + CVMX_USB_INITIALIZE_FLAGS_NO_DMA); + usbcx_gahbcfg.s.hbstlen = 0; + usbcx_gahbcfg.s.nptxfemplvl = 1; + usbcx_gahbcfg.s.ptxfemplvl = 1; + usbcx_gahbcfg.s.glblintrmsk = 1; + cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index), + usbcx_gahbcfg.u32); + /* * 3. Program the following fields in USBC_GUSBCFG register. * HS/FS timeout calibration, USBC_GUSBCFG[TOUTCAL] = 0 @@ -881,79 +884,60 @@ retry: * USB turnaround time, USBC_GUSBCFG[USBTRDTIM] = 0x5 * PHY low-power clock select, USBC_GUSBCFG[PHYLPWRCLKSEL] = 0 */ - { - union cvmx_usbcx_gusbcfg usbcx_gusbcfg; - - usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_GUSBCFG(usb->index)); - usbcx_gusbcfg.s.toutcal = 0; - usbcx_gusbcfg.s.ddrsel = 0; - usbcx_gusbcfg.s.usbtrdtim = 0x5; - usbcx_gusbcfg.s.phylpwrclksel = 0; - cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index), - usbcx_gusbcfg.u32); - } + usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_GUSBCFG(usb->index)); + usbcx_gusbcfg.s.toutcal = 0; + usbcx_gusbcfg.s.ddrsel = 0; + usbcx_gusbcfg.s.usbtrdtim = 0x5; + usbcx_gusbcfg.s.phylpwrclksel = 0; + cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index), + usbcx_gusbcfg.u32); + /* * 4. The software must unmask the following bits in the USBC_GINTMSK * register. * OTG interrupt mask, USBC_GINTMSK[OTGINTMSK] = 1 * Mode mismatch interrupt mask, USBC_GINTMSK[MODEMISMSK] = 1 */ - { - union cvmx_usbcx_gintmsk usbcx_gintmsk; - int channel; - - usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_GINTMSK(usb->index)); - usbcx_gintmsk.s.otgintmsk = 1; - usbcx_gintmsk.s.modemismsk = 1; - usbcx_gintmsk.s.hchintmsk = 1; - usbcx_gintmsk.s.sofmsk = 0; - /* We need RX FIFO interrupts if we don't have DMA */ - if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) - usbcx_gintmsk.s.rxflvlmsk = 1; - cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTMSK(usb->index), - usbcx_gintmsk.u32); + usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb, + CVMX_USBCX_GINTMSK(usb->index)); + usbcx_gintmsk.s.otgintmsk = 1; + usbcx_gintmsk.s.modemismsk = 1; + usbcx_gintmsk.s.hchintmsk = 1; + usbcx_gintmsk.s.sofmsk = 0; + /* We need RX FIFO interrupts if we don't have DMA */ + if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) + usbcx_gintmsk.s.rxflvlmsk = 1; + cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTMSK(usb->index), + usbcx_gintmsk.u32); - /* - * Disable all channel interrupts. We'll enable them per channel - * later. - */ - for (channel = 0; channel < 8; channel++) - cvmx_usb_write_csr32(usb, - CVMX_USBCX_HCINTMSKX(channel, usb->index), 0); - } + /* + * Disable all channel interrupts. We'll enable them per channel later. + */ + for (channel = 0; channel < 8; channel++) + cvmx_usb_write_csr32(usb, + CVMX_USBCX_HCINTMSKX(channel, usb->index), + 0); - { - /* - * Host Port Initialization - * - * 1. Program the host-port interrupt-mask field to unmask, - * USBC_GINTMSK[PRTINT] = 1 - */ - USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), - union cvmx_usbcx_gintmsk, prtintmsk, 1); - USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), - union cvmx_usbcx_gintmsk, disconnintmsk, 1); - /* - * 2. Program the USBC_HCFG register to select full-speed host - * or high-speed host. - */ - { - union cvmx_usbcx_hcfg usbcx_hcfg; - - usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb, - CVMX_USBCX_HCFG(usb->index)); - usbcx_hcfg.s.fslssupp = 0; - usbcx_hcfg.s.fslspclksel = 0; - cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), - usbcx_hcfg.u32); - } + /* + * Host Port Initialization + * + * 1. Program the host-port interrupt-mask field to unmask, + * USBC_GINTMSK[PRTINT] = 1 + */ + USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), + union cvmx_usbcx_gintmsk, prtintmsk, 1); + USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), + union cvmx_usbcx_gintmsk, disconnintmsk, 1); - /* - * Steps 4-15 from the manual are done later in the port enable - */ - } + /* + * 2. Program the USBC_HCFG register to select full-speed host + * or high-speed host. + */ + usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCFG(usb->index)); + usbcx_hcfg.s.fslssupp = 0; + usbcx_hcfg.s.fslspclksel = 0; + cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), usbcx_hcfg.u32); cvmx_fifo_setup(usb); -- cgit v1.2.3 From 4bef52f377b6410a89fc580a8948033f613854f8 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 12 Mar 2015 20:24:31 +0300 Subject: staging: dgnc: some off by one bugs "dgnc_NumBoards" is the number of filled out elements in the dgnc_Board[] array. "->nasync" and "->maxports" are the same value. They are the number of channels in the ->channels[] array so these tests should be ">=" instead of ">" so we avoid reading past the end of the arrays. I cleaned up the conditions in dgnc_mgmt_ioctl() a bit. There was a work around for the off by one bug in the case where there were no boards which is no longer needed. "channel" is unsigned so it can't be negative. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.c | 2 +- drivers/staging/dgnc/dgnc_mgmt.c | 4 ++-- drivers/staging/dgnc/dgnc_neo.c | 6 +++--- drivers/staging/dgnc/dgnc_tty.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 66397d66ee0e..e3564d278d91 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -375,7 +375,7 @@ static inline void cls_parse_isr(struct dgnc_board *brd, uint port) * verified in the interrupt routine. */ - if (port > brd->nasync) + if (port >= brd->nasync) return; ch = brd->channels[port]; diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c index 57814061f6db..34b6efd90e82 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.c +++ b/drivers/staging/dgnc/dgnc_mgmt.c @@ -179,11 +179,11 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) channel = ni.channel; /* Verify boundaries on board */ - if ((board > dgnc_NumBoards) || (dgnc_NumBoards == 0)) + if (board >= dgnc_NumBoards) return -ENODEV; /* Verify boundaries on channel */ - if ((channel < 0) || (channel > dgnc_Board[board]->nasync)) + if (channel >= dgnc_Board[board]->nasync) return -ENODEV; ch = dgnc_Board[board]->channels[channel]; diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 41105be24229..f5a4d365115f 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -391,7 +391,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port) if (!brd || brd->magic != DGNC_BOARD_MAGIC) return; - if (port > brd->maxports) + if (port >= brd->maxports) return; ch = brd->channels[port]; @@ -521,7 +521,7 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port) if (!brd || brd->magic != DGNC_BOARD_MAGIC) return; - if (port > brd->maxports) + if (port >= brd->maxports) return; ch = brd->channels[port]; @@ -1003,7 +1003,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) */ /* Verify the port is in range. */ - if (port > brd->nasync) + if (port >= brd->nasync) continue; ch = brd->channels[port]; diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index f1c4d07a0aaa..5b8d7b552d8a 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -1042,7 +1042,7 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file) spin_lock_irqsave(&brd->bd_lock, flags); /* If opened device is greater than our number of ports, bail. */ - if (PORT_NUM(minor) > brd->nasync) { + if (PORT_NUM(minor) >= brd->nasync) { spin_unlock_irqrestore(&brd->bd_lock, flags); return -ENXIO; } -- cgit v1.2.3 From f82d189c335ad0d9121abca77b7a79fbd120b553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Fri, 13 Mar 2015 15:56:29 +0200 Subject: dgnc: remove unused dgnc_ioctl_name() command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dgnc_ioctl_name() is never used anywhere so remove it Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_utils.c | 52 --------------------------------------- drivers/staging/dgnc/dgnc_utils.h | 1 - 2 files changed, 53 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_utils.c b/drivers/staging/dgnc/dgnc_utils.c index 80b51332292c..f76de82908d3 100644 --- a/drivers/staging/dgnc/dgnc_utils.c +++ b/drivers/staging/dgnc/dgnc_utils.c @@ -16,55 +16,3 @@ int dgnc_ms_sleep(ulong ms) schedule_timeout((ms * HZ) / 1000); return signal_pending(current); } - -/* - * dgnc_ioctl_name() : Returns a text version of each ioctl value. - */ -char *dgnc_ioctl_name(int cmd) -{ - switch (cmd) { - - case TCGETA: return "TCGETA"; - case TCGETS: return "TCGETS"; - case TCSETA: return "TCSETA"; - case TCSETS: return "TCSETS"; - case TCSETAW: return "TCSETAW"; - case TCSETSW: return "TCSETSW"; - case TCSETAF: return "TCSETAF"; - case TCSETSF: return "TCSETSF"; - case TCSBRK: return "TCSBRK"; - case TCXONC: return "TCXONC"; - case TCFLSH: return "TCFLSH"; - case TIOCGSID: return "TIOCGSID"; - - case TIOCGETD: return "TIOCGETD"; - case TIOCSETD: return "TIOCSETD"; - case TIOCGWINSZ: return "TIOCGWINSZ"; - case TIOCSWINSZ: return "TIOCSWINSZ"; - - case TIOCMGET: return "TIOCMGET"; - case TIOCMSET: return "TIOCMSET"; - case TIOCMBIS: return "TIOCMBIS"; - case TIOCMBIC: return "TIOCMBIC"; - - /* from digi.h */ - case DIGI_SETA: return "DIGI_SETA"; - case DIGI_SETAW: return "DIGI_SETAW"; - case DIGI_SETAF: return "DIGI_SETAF"; - case DIGI_SETFLOW: return "DIGI_SETFLOW"; - case DIGI_SETAFLOW: return "DIGI_SETAFLOW"; - case DIGI_GETFLOW: return "DIGI_GETFLOW"; - case DIGI_GETAFLOW: return "DIGI_GETAFLOW"; - case DIGI_GETA: return "DIGI_GETA"; - case DIGI_GEDELAY: return "DIGI_GEDELAY"; - case DIGI_SEDELAY: return "DIGI_SEDELAY"; - case DIGI_GETCUSTOMBAUD: return "DIGI_GETCUSTOMBAUD"; - case DIGI_SETCUSTOMBAUD: return "DIGI_SETCUSTOMBAUD"; - case TIOCMODG: return "TIOCMODG"; - case TIOCMODS: return "TIOCMODS"; - case TIOCSDTR: return "TIOCSDTR"; - case TIOCCDTR: return "TIOCCDTR"; - - default: return "unknown"; - } -} diff --git a/drivers/staging/dgnc/dgnc_utils.h b/drivers/staging/dgnc/dgnc_utils.h index cebf60163a26..1164c3a09c6b 100644 --- a/drivers/staging/dgnc/dgnc_utils.h +++ b/drivers/staging/dgnc/dgnc_utils.h @@ -2,6 +2,5 @@ #define __DGNC_UTILS_H int dgnc_ms_sleep(ulong ms); -char *dgnc_ioctl_name(int cmd); #endif -- cgit v1.2.3 From 944b3ad4264f0745cf4204473742a86efc382f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Fri, 13 Mar 2015 15:56:30 +0200 Subject: dgnc: clean up digi.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove a lot of unused structs and defines from digi.h. We still have to be careful with TIOCM_LE and TIOCMSET/TIOCMBIC because termios.h and ioctls.h respectfully redefine them. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/digi.h | 267 -------------------------------------------- 1 file changed, 267 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h index 554fbeb2add3..2f0b4a95155c 100644 --- a/drivers/staging/dgnc/digi.h +++ b/drivers/staging/dgnc/digi.h @@ -16,25 +16,6 @@ #ifndef __DIGI_H #define __DIGI_H -/************************************************************************ - *** Definitions for Digi ditty(1) command. - ************************************************************************/ - - -/* - * Copyright (c) 1988-96 Digi International Inc., All Rights Reserved. - */ - -/************************************************************************ - * This module provides application access to special Digi - * serial line enhancements which are not standard UNIX(tm) features. - ************************************************************************/ - -#if !defined(TIOCMODG) - -#define TIOCMODG (('d'<<8) | 250) /* get modem ctrl state */ -#define TIOCMODS (('d'<<8) | 251) /* set modem ctrl state */ - #ifndef TIOCM_LE #define TIOCM_LE 0x01 /* line enable */ #define TIOCM_DTR 0x02 /* data terminal ready */ @@ -49,8 +30,6 @@ #define TIOCM_CD TIOCM_CAR /* carrier detect (alt) */ #endif -#endif - #if !defined(TIOCMSET) #define TIOCMSET (('d'<<8) | 252) /* set modem ctrl state */ #define TIOCMGET (('d'<<8) | 253) /* set modem ctrl state */ @@ -61,83 +40,19 @@ #define TIOCMBIS (('d'<<8) | 255) /* set modem ctrl state */ #endif - -#if !defined(TIOCSDTR) -#define TIOCSDTR (('e'<<8) | 0) /* set DTR */ -#define TIOCCDTR (('e'<<8) | 1) /* clear DTR */ -#endif - -/************************************************************************ - * Ioctl command arguments for DIGI parameters. - ************************************************************************/ #define DIGI_GETA (('e'<<8) | 94) /* Read params */ - #define DIGI_SETA (('e'<<8) | 95) /* Set params */ #define DIGI_SETAW (('e'<<8) | 96) /* Drain & set params */ #define DIGI_SETAF (('e'<<8) | 97) /* Drain, flush & set params */ - -#define DIGI_KME (('e'<<8) | 98) /* Read/Write Host */ - /* Adapter Memory */ - -#define DIGI_GETFLOW (('e'<<8) | 99) /* Get startc/stopc flow */ - /* control characters */ -#define DIGI_SETFLOW (('e'<<8) | 100) /* Set startc/stopc flow */ - /* control characters */ -#define DIGI_GETAFLOW (('e'<<8) | 101) /* Get Aux. startc/stopc */ - /* flow control chars */ -#define DIGI_SETAFLOW (('e'<<8) | 102) /* Set Aux. startc/stopc */ - /* flow control chars */ - -#define DIGI_GEDELAY (('d'<<8) | 246) /* Get edelay */ -#define DIGI_SEDELAY (('d'<<8) | 247) /* Set edelay */ - -struct digiflow_t { - unsigned char startc; /* flow cntl start char */ - unsigned char stopc; /* flow cntl stop char */ -}; - - -#ifdef FLOW_2200 -#define F2200_GETA (('e'<<8) | 104) /* Get 2x36 flow cntl flags */ -#define F2200_SETAW (('e'<<8) | 105) /* Set 2x36 flow cntl flags */ -#define F2200_MASK 0x03 /* 2200 flow cntl bit mask */ -#define FCNTL_2200 0x01 /* 2x36 terminal flow cntl */ -#define PCNTL_2200 0x02 /* 2x36 printer flow cntl */ -#define F2200_XON 0xf8 -#define P2200_XON 0xf9 -#define F2200_XOFF 0xfa -#define P2200_XOFF 0xfb - -#define FXOFF_MASK 0x03 /* 2200 flow status mask */ -#define RCVD_FXOFF 0x01 /* 2x36 Terminal XOFF rcvd */ -#define RCVD_PXOFF 0x02 /* 2x36 Printer XOFF rcvd */ -#endif - -/************************************************************************ - * Values for digi_flags - ************************************************************************/ -#define DIGI_IXON 0x0001 /* Handle IXON in the FEP */ #define DIGI_FAST 0x0002 /* Fast baud rates */ #define RTSPACE 0x0004 /* RTS input flow control */ #define CTSPACE 0x0008 /* CTS output flow control */ -#define DSRPACE 0x0010 /* DSR output flow control */ -#define DCDPACE 0x0020 /* DCD output flow control */ -#define DTRPACE 0x0040 /* DTR input flow control */ #define DIGI_COOK 0x0080 /* Cooked processing done in FEP */ #define DIGI_FORCEDCD 0x0100 /* Force carrier */ #define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */ -#define DIGI_AIXON 0x0400 /* Aux flow control in fep */ #define DIGI_PRINTER 0x0800 /* Hold port open for flow cntrl*/ -#define DIGI_PP_INPUT 0x1000 /* Change parallel port to input*/ #define DIGI_DTR_TOGGLE 0x2000 /* Support DTR Toggle */ -#define DIGI_422 0x4000 /* for 422/232 selectable panel */ #define DIGI_RTS_TOGGLE 0x8000 /* Support RTS Toggle */ - -/************************************************************************ - * These options are not supported on the comxi. - ************************************************************************/ -#define DIGI_COMXI (DIGI_FAST|DIGI_COOK|DSRPACE|DCDPACE|DTRPACE) - #define DIGI_PLEN 28 /* String length */ #define DIGI_TSIZ 10 /* Terminal string len */ @@ -156,76 +71,6 @@ struct digi_t { char digi_term[DIGI_TSIZ]; /* terminal string */ }; -/************************************************************************ - * KME definitions and structures. - ************************************************************************/ -#define RW_IDLE 0 /* Operation complete */ -#define RW_READ 1 /* Read Concentrator Memory */ -#define RW_WRITE 2 /* Write Concentrator Memory */ - -struct rw_t { - unsigned char rw_req; /* Request type */ - unsigned char rw_board; /* Host Adapter board number */ - unsigned char rw_conc; /* Concentrator number */ - unsigned char rw_reserved; /* Reserved for expansion */ - unsigned int rw_addr; /* Address in concentrator */ - unsigned short rw_size; /* Read/write request length */ - unsigned char rw_data[128]; /* Data to read/write */ -}; - -/*********************************************************************** - * Shrink Buffer and Board Information definitions and structures. - - ************************************************************************/ - /* Board type return codes */ -#define PCXI_TYPE 1 /* Board type at the designated port is a PC/Xi */ -#define PCXM_TYPE 2 /* Board type at the designated port is a PC/Xm */ -#define PCXE_TYPE 3 /* Board type at the designated port is a PC/Xe */ -#define MCXI_TYPE 4 /* Board type at the designated port is a MC/Xi */ -#define COMXI_TYPE 5 /* Board type at the designated port is a COM/Xi */ - - /* Non-Zero Result codes. */ -#define RESULT_NOBDFND 1 /* A Digi product at that port is not config installed */ -#define RESULT_NODESCT 2 /* A memory descriptor was not obtainable */ -#define RESULT_NOOSSIG 3 /* FEP/OS signature was not detected on the board */ -#define RESULT_TOOSML 4 /* Too small an area to shrink. */ -#define RESULT_NOCHAN 5 /* Channel structure for the board was not found */ - -struct shrink_buf_struct { - unsigned int shrink_buf_vaddr; /* Virtual address of board */ - unsigned int shrink_buf_phys; /* Physical address of board */ - unsigned int shrink_buf_bseg; /* Amount of board memory */ - unsigned int shrink_buf_hseg; /* '186 Beginning of Dual-Port */ - - unsigned int shrink_buf_lseg; /* '186 Beginning of freed memory */ - unsigned int shrink_buf_mseg; /* Linear address from start of - dual-port were freed memory - begins, host viewpoint. */ - - unsigned int shrink_buf_bdparam; /* Parameter for xxmemon and - xxmemoff */ - - unsigned int shrink_buf_reserva; /* Reserved */ - unsigned int shrink_buf_reservb; /* Reserved */ - unsigned int shrink_buf_reservc; /* Reserved */ - unsigned int shrink_buf_reservd; /* Reserved */ - - unsigned char shrink_buf_result; /* Reason for call failing - Zero is Good return */ - unsigned char shrink_buf_init; /* Non-Zero if it caused an - xxinit call. */ - - unsigned char shrink_buf_anports; /* Number of async ports */ - unsigned char shrink_buf_snports; /* Number of sync ports */ - unsigned char shrink_buf_type; /* Board type 1 = PC/Xi, - 2 = PC/Xm, - 3 = PC/Xe - 4 = MC/Xi - 5 = COMX/i */ - unsigned char shrink_buf_card; /* Card number */ - -}; - /************************************************************************ * Structure to get driver status information ************************************************************************/ @@ -257,52 +102,6 @@ struct digi_info { #define DIGI_GETBD (('d'<<8) | 249) /* get board info */ -struct digi_stat { - unsigned int info_chan; /* Channel number (0 based) */ - unsigned int info_brd; /* Board number (0 based) */ - unsigned int info_cflag; /* cflag for channel */ - unsigned int info_iflag; /* iflag for channel */ - unsigned int info_oflag; /* oflag for channel */ - unsigned int info_mstat; /* mstat for channel */ - unsigned int info_tx_data; /* tx_data for channel */ - unsigned int info_rx_data; /* rx_data for channel */ - unsigned int info_hflow; /* hflow for channel */ - unsigned int info_reserved[8]; /* for future expansion */ -}; - -#define DIGI_GETSTAT (('d'<<8) | 244) /* get board info */ -/************************************************************************ - * - * Structure used with ioctl commands for per-channel information - * - ************************************************************************/ -struct digi_ch { - unsigned int info_bdnum; /* Board number (0 based) */ - unsigned int info_channel; /* Channel index number */ - unsigned int info_ch_cflag; /* Channel cflag */ - unsigned int info_ch_iflag; /* Channel iflag */ - unsigned int info_ch_oflag; /* Channel oflag */ - unsigned int info_chsize; /* Channel structure size */ - unsigned int info_sleep_stat; /* sleep status */ - dev_t info_dev; /* device number */ - unsigned char info_initstate; /* Channel init state */ - unsigned char info_running; /* Channel running state */ - int reserved[8]; /* reserved for future use */ -}; - -/* -* This structure is used with the DIGI_FEPCMD ioctl to -* tell the driver which port to send the command for. -*/ -struct digi_cmd { - int cmd; - int word; - int ncmds; - int chan; /* channel index (zero based) */ - int bdid; /* board index (zero based) */ -}; - - struct digi_getbuffer /* Struct for holding buffer use counts */ { unsigned long tIn; @@ -322,63 +121,9 @@ struct digi_getcounter { unsigned long tbytes; /* number of bytes transmitted fully */ }; -/* -* info_sleep_stat defines -*/ -#define INFO_RUNWAIT 0x0001 -#define INFO_WOPEN 0x0002 -#define INFO_TTIOW 0x0004 -#define INFO_CH_RWAIT 0x0008 -#define INFO_CH_WEMPTY 0x0010 -#define INFO_CH_WLOW 0x0020 -#define INFO_XXBUF_BUSY 0x0040 - -#define DIGI_GETCH (('d'<<8) | 245) /* get board info */ - -/* Board type definitions */ - -#define SUBTYPE 0007 -#define T_PCXI 0000 -#define T_PCXM 0001 -#define T_PCXE 0002 -#define T_PCXR 0003 -#define T_SP 0004 -#define T_SP_PLUS 0005 -# define T_HERC 0000 -# define T_HOU 0001 -# define T_LON 0002 -# define T_CHA 0003 -#define FAMILY 0070 -#define T_COMXI 0000 -#define T_PCXX 0010 -#define T_CX 0020 -#define T_EPC 0030 -#define T_PCLITE 0040 -#define T_SPXX 0050 -#define T_AVXX 0060 -#define T_DXB 0070 -#define T_A2K_4_8 0070 -#define BUSTYPE 0700 -#define T_ISABUS 0000 -#define T_MCBUS 0100 -#define T_EISABUS 0200 -#define T_PCIBUS 0400 - /* Board State Definitions */ - #define BD_RUNNING 0x0 -#define BD_REASON 0x7f -#define BD_NOTFOUND 0x1 -#define BD_NOIOPORT 0x2 -#define BD_NOMEM 0x3 -#define BD_NOBIOS 0x4 #define BD_NOFEP 0x5 -#define BD_FAILED 0x6 -#define BD_ALLOCATED 0x7 -#define BD_TRIBOOT 0x8 -#define BD_BADKME 0x80 - -#define DIGI_SPOLL (('d'<<8) | 254) /* change poller rate */ #define DIGI_SETCUSTOMBAUD _IOW('e', 106, int) /* Set integer baud rate */ #define DIGI_GETCUSTOMBAUD _IOR('e', 107, int) /* Get integer baud rate */ @@ -390,20 +135,8 @@ struct digi_getcounter { #define EV_OPU 0x0001 /* ! Date: Fri, 13 Mar 2015 15:56:31 +0200 Subject: dgnc: get rid of dpacompat.h, move remaining stuff to digi.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dpacompat.h contained a lot of unused #defines and only few things are used from it so since we've trimmed down digi.h, now we can delete dpacompat.h and move remaining stuff into digi.h. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.c | 1 - drivers/staging/dgnc/dgnc_mgmt.c | 1 - drivers/staging/dgnc/dgnc_tty.c | 1 - drivers/staging/dgnc/digi.h | 36 ++++++++++++ drivers/staging/dgnc/dpacompat.h | 109 ------------------------------------- 5 files changed, 36 insertions(+), 112 deletions(-) delete mode 100644 drivers/staging/dgnc/dpacompat.h (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index 9ae9014dd144..805dc617e3a7 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -21,7 +21,6 @@ #include #include "dgnc_driver.h" #include "dgnc_pci.h" -#include "dpacompat.h" #include "dgnc_mgmt.h" #include "dgnc_tty.h" #include "dgnc_cls.h" diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c index 34b6efd90e82..3ffcc1e3a019 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.c +++ b/drivers/staging/dgnc/dgnc_mgmt.c @@ -32,7 +32,6 @@ #include "dgnc_pci.h" #include "dgnc_kcompat.h" /* Kernel 2.4/2.6 compat includes */ #include "dgnc_mgmt.h" -#include "dpacompat.h" /* Our "in use" variables, to enforce 1 open only */ diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 5b8d7b552d8a..d7a19d8c8c75 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -39,7 +39,6 @@ #include "dgnc_types.h" #include "dgnc_neo.h" #include "dgnc_cls.h" -#include "dpacompat.h" #include "dgnc_sysfs.h" #include "dgnc_utils.h" diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h index 2f0b4a95155c..281b9756b9ba 100644 --- a/drivers/staging/dgnc/digi.h +++ b/drivers/staging/dgnc/digi.h @@ -44,6 +44,11 @@ #define DIGI_SETA (('e'<<8) | 95) /* Set params */ #define DIGI_SETAW (('e'<<8) | 96) /* Drain & set params */ #define DIGI_SETAF (('e'<<8) | 97) /* Drain, flush & set params */ +#define DIGI_GET_NI_INFO (('d'<<8) | 250) /* Non-intelligent state info */ +#define DIGI_LOOPBACK (('d'<<8) | 252) /* + * Enable/disable UART + * internal loopback + */ #define DIGI_FAST 0x0002 /* Fast baud rates */ #define RTSPACE 0x0004 /* RTS input flow control */ #define CTSPACE 0x0008 /* CTS output flow control */ @@ -139,4 +144,35 @@ struct digi_getcounter { #define EV_IPS 0x0020 /* ! nonintelligent + * DPA translation + */ +struct ni_info { + int board; + int channel; + int dtr; + int rts; + int cts; + int dsr; + int ri; + int dcd; + int curtx; + int currx; + unsigned short iflag; + unsigned short oflag; + unsigned short cflag; + unsigned short lflag; + unsigned int mstat; + unsigned char hflow; + unsigned char xmit_stopped; + unsigned char recv_stopped; + unsigned int baud; +}; + +#define T_CLASSIC 0002 +#define T_PCIBUS 0400 +#define T_NEO_EXPRESS 0001 +#define T_NEO 0000 + #endif /* DIGI_H */ diff --git a/drivers/staging/dgnc/dpacompat.h b/drivers/staging/dgnc/dpacompat.h deleted file mode 100644 index f41a0e164d2f..000000000000 --- a/drivers/staging/dgnc/dpacompat.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2003 Digi International (www.digi.com) - * Scott H Kilau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - */ - - -/* - * This structure holds data needed for the intelligent <--> nonintelligent - * DPA translation - */ -struct ni_info { - int board; - int channel; - int dtr; - int rts; - int cts; - int dsr; - int ri; - int dcd; - int curtx; - int currx; - unsigned short iflag; - unsigned short oflag; - unsigned short cflag; - unsigned short lflag; - - unsigned int mstat; - unsigned char hflow; - - unsigned char xmit_stopped; - unsigned char recv_stopped; - - unsigned int baud; -}; - -#define RW_READ 1 -#define RW_WRITE 2 -#define DIGI_KME (('e'<<8) | 98) /* Read/Write Host */ - -#define SUBTYPE 0007 -#define T_PCXI 0000 -#define T_PCXEM 0001 -#define T_PCXE 0002 -#define T_PCXR 0003 -#define T_SP 0004 -#define T_SP_PLUS 0005 - -#define T_HERC 0000 -#define T_HOU 0001 -#define T_LON 0002 -#define T_CHA 0003 - -#define T_NEO 0000 -#define T_NEO_EXPRESS 0001 -#define T_CLASSIC 0002 - -#define FAMILY 0070 -#define T_COMXI 0000 -#define T_NI 0000 -#define T_PCXX 0010 -#define T_CX 0020 -#define T_EPC 0030 -#define T_PCLITE 0040 -#define T_SPXX 0050 -#define T_AVXX 0060 -#define T_DXB 0070 -#define T_A2K_4_8 0070 - -#define BUSTYPE 0700 -#define T_ISABUS 0000 -#define T_MCBUS 0100 -#define T_EISABUS 0200 -#define T_PCIBUS 0400 - -/* Board State Definitions */ - -#define BD_RUNNING 0x0 -#define BD_REASON 0x7f -#define BD_NOTFOUND 0x1 -#define BD_NOIOPORT 0x2 -#define BD_NOMEM 0x3 -#define BD_NOBIOS 0x4 -#define BD_NOFEP 0x5 -#define BD_FAILED 0x6 -#define BD_ALLOCATED 0x7 -#define BD_TRIBOOT 0x8 -#define BD_BADKME 0x80 - -#define DIGI_AIXON 0x0400 /* Aux flow control in fep */ - -/* Ioctls needed for dpa operation */ - -#define DIGI_GETDD (('d'<<8) | 248) /* get driver info */ -#define DIGI_GETBD (('d'<<8) | 249) /* get board info */ -#define DIGI_GET_NI_INFO (('d'<<8) | 250) /* nonintelligent state snfo */ - -/* Other special ioctls */ -#define DIGI_TIMERIRQ (('d'<<8) | 251) /* Enable/disable RS_TIMER use */ -#define DIGI_LOOPBACK (('d'<<8) | 252) /* Enable/disable UART internal loopback */ -- cgit v1.2.3 From d533a524a88a278ea3fd1dd279000cb0df0e0014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Fri, 13 Mar 2015 15:56:32 +0200 Subject: dgnc: use linux/types.h instead of dgnc_types.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dgnc_types.h unnecesarily defines TRUE as 1 and FALSE as 0 because we already have a widely used linux/types.h so convert all TRUE to true, FALSE to false and edit the dgnc_board struct to make sure it uses "bool". Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.h | 3 --- drivers/staging/dgnc/dgnc_driver.h | 5 ++--- drivers/staging/dgnc/dgnc_neo.h | 1 - drivers/staging/dgnc/dgnc_tty.c | 10 +++++----- drivers/staging/dgnc/dgnc_types.h | 27 --------------------------- 5 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 drivers/staging/dgnc/dgnc_types.h (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h index 2398514e10ec..85042bdf3a5f 100644 --- a/drivers/staging/dgnc/dgnc_cls.h +++ b/drivers/staging/dgnc/dgnc_cls.h @@ -16,9 +16,6 @@ #ifndef __DGNC_CLS_H #define __DGNC_CLS_H -#include "dgnc_types.h" - - /************************************************************************ * Per channel/port Classic UART structure * ************************************************************************ diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 15c4d95cfe07..2bde3b2c359f 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -25,7 +25,6 @@ #include /* To pick up the various tty structs/defines */ #include /* For irqreturn_t type */ -#include "dgnc_types.h" /* Additional types needed by the Digi header files */ #include "digi.h" /* Digi specific ioctl header */ #include "dgnc_kcompat.h" /* Kernel 2.4/2.6 compat includes */ #include "dgnc_sysfs.h" /* Support for SYSFS */ @@ -206,8 +205,8 @@ struct dgnc_board { struct tty_driver PrintDriver; char PrintName[200]; - uint dgnc_Major_Serial_Registered; - uint dgnc_Major_TransparentPrint_Registered; + bool dgnc_Major_Serial_Registered; + bool dgnc_Major_TransparentPrint_Registered; uint dgnc_Serial_Major; uint dgnc_TransparentPrint_Major; diff --git a/drivers/staging/dgnc/dgnc_neo.h b/drivers/staging/dgnc/dgnc_neo.h index d7e764a307b9..c528df5a0e5a 100644 --- a/drivers/staging/dgnc/dgnc_neo.h +++ b/drivers/staging/dgnc/dgnc_neo.h @@ -16,7 +16,6 @@ #ifndef __DGNC_NEO_H #define __DGNC_NEO_H -#include "dgnc_types.h" #include "dgnc_driver.h" /************************************************************************ diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index d7a19d8c8c75..ce4187f60cb4 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include /* For udelay */ @@ -36,7 +37,6 @@ #include #include "dgnc_driver.h" #include "dgnc_tty.h" -#include "dgnc_types.h" #include "dgnc_neo.h" #include "dgnc_cls.h" #include "dgnc_sysfs.h" @@ -220,7 +220,7 @@ int dgnc_tty_register(struct dgnc_board *brd) "Can't register tty device (%d)\n", rc); return rc; } - brd->dgnc_Major_Serial_Registered = TRUE; + brd->dgnc_Major_Serial_Registered = true; } /* @@ -270,7 +270,7 @@ int dgnc_tty_register(struct dgnc_board *brd) rc); return rc; } - brd->dgnc_Major_TransparentPrint_Registered = TRUE; + brd->dgnc_Major_TransparentPrint_Registered = true; } dgnc_BoardsByMajor[brd->SerialDriver.major] = brd; @@ -408,7 +408,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd) tty_unregister_device(&brd->SerialDriver, i); } tty_unregister_driver(&brd->SerialDriver); - brd->dgnc_Major_Serial_Registered = FALSE; + brd->dgnc_Major_Serial_Registered = false; } if (brd->dgnc_Major_TransparentPrint_Registered) { @@ -419,7 +419,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd) tty_unregister_device(&brd->PrintDriver, i); } tty_unregister_driver(&brd->PrintDriver); - brd->dgnc_Major_TransparentPrint_Registered = FALSE; + brd->dgnc_Major_TransparentPrint_Registered = false; } kfree(brd->SerialDriver.ttys); diff --git a/drivers/staging/dgnc/dgnc_types.h b/drivers/staging/dgnc/dgnc_types.h deleted file mode 100644 index 2853d164e51e..000000000000 --- a/drivers/staging/dgnc/dgnc_types.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2003 Digi International (www.digi.com) - * Scott H Kilau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - */ - -#ifndef __DGNC_TYPES_H -#define __DGNC_TYPES_H - -#ifndef TRUE -# define TRUE 1 -#endif - -#ifndef FALSE -# define FALSE 0 -#endif - -#endif -- cgit v1.2.3 From 20dad752850cd2b512f3ba48a5d9a13b15dabdf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Fri, 13 Mar 2015 15:56:33 +0200 Subject: dgnc: remove old 2.4-2.6 compat kernel defines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dgnc_kcompat.h contains some old legacy defines in case the kernel doesn't have __user defined but for current kernel versions these defines don't make sense and are useless so remove them. Move the TTY_FLIPBUF_SIZE define to digi.h because it's used in the code. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_driver.h | 1 - drivers/staging/dgnc/dgnc_kcompat.h | 40 ------------------------------------- drivers/staging/dgnc/dgnc_mgmt.c | 1 - drivers/staging/dgnc/digi.h | 1 + 4 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 drivers/staging/dgnc/dgnc_kcompat.h (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 2bde3b2c359f..f77fed57b873 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -26,7 +26,6 @@ #include /* For irqreturn_t type */ #include "digi.h" /* Digi specific ioctl header */ -#include "dgnc_kcompat.h" /* Kernel 2.4/2.6 compat includes */ #include "dgnc_sysfs.h" /* Support for SYSFS */ /************************************************************************* diff --git a/drivers/staging/dgnc/dgnc_kcompat.h b/drivers/staging/dgnc/dgnc_kcompat.h deleted file mode 100644 index 22060385321a..000000000000 --- a/drivers/staging/dgnc/dgnc_kcompat.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2004 Digi International (www.digi.com) - * Scott H Kilau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - ************************************************************************* - * - * This file is intended to contain all the kernel "differences" between the - * various kernels that we support. - * - *************************************************************************/ - -#ifndef __DGNC_KCOMPAT_H -#define __DGNC_KCOMPAT_H - -#if !defined(TTY_FLIPBUF_SIZE) -# define TTY_FLIPBUF_SIZE 512 -#endif - - -/* Sparse stuff */ -# ifndef __user -# define __user -# define __kernel -# define __safe -# define __force -# define __chk_user_ptr(x) (void)0 -# endif - - -#endif /* ! __DGNC_KCOMPAT_H */ diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c index 3ffcc1e3a019..b13318a82fe1 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.c +++ b/drivers/staging/dgnc/dgnc_mgmt.c @@ -30,7 +30,6 @@ #include "dgnc_driver.h" #include "dgnc_pci.h" -#include "dgnc_kcompat.h" /* Kernel 2.4/2.6 compat includes */ #include "dgnc_mgmt.h" diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h index 281b9756b9ba..d637a7802168 100644 --- a/drivers/staging/dgnc/digi.h +++ b/drivers/staging/dgnc/digi.h @@ -175,4 +175,5 @@ struct ni_info { #define T_NEO_EXPRESS 0001 #define T_NEO 0000 +#define TTY_FLIPBUF_SIZE 512 #endif /* DIGI_H */ -- cgit v1.2.3 From 3b84f2d910ff918ef88e920c0d23b6b8d8fa48cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Fri, 13 Mar 2015 15:56:34 +0200 Subject: dgnc: remove unused stuff from dgnc_cls.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unused defines from dgnc_cls.h Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h index 85042bdf3a5f..2597e36d38c4 100644 --- a/drivers/staging/dgnc/dgnc_cls.h +++ b/drivers/staging/dgnc/dgnc_cls.h @@ -51,15 +51,9 @@ struct cls_uart_struct { #define UART_EXAR654_ENHANCED_REGISTER_SET 0xBF -#define UART_16654_FCR_TXTRIGGER_8 0x0 #define UART_16654_FCR_TXTRIGGER_16 0x10 -#define UART_16654_FCR_TXTRIGGER_32 0x20 -#define UART_16654_FCR_TXTRIGGER_56 0x30 - -#define UART_16654_FCR_RXTRIGGER_8 0x0 #define UART_16654_FCR_RXTRIGGER_16 0x40 #define UART_16654_FCR_RXTRIGGER_56 0x80 -#define UART_16654_FCR_RXTRIGGER_60 0xC0 /* Received CTS/RTS change of state */ #define UART_IIR_CTSRTS 0x20 @@ -76,13 +70,6 @@ struct cls_uart_struct { #define UART_EXAR654_EFR_IXOFF 0x8 /* Transmit Xon1/Xoff1 */ #define UART_EXAR654_EFR_RTSDTR 0x40 /* Auto RTS/DTR Flow Control Enable */ #define UART_EXAR654_EFR_CTSDSR 0x80 /* Auto CTS/DSR Flow COntrol Enable */ - -/* Indicates whether chip saw an incoming XOFF char */ -#define UART_EXAR654_XOFF_DETECT 0x1 - -/* Indicates whether chip saw an incoming XON char */ -#define UART_EXAR654_XON_DETECT 0x2 - #define UART_EXAR654_IER_XOFF 0x20 /* Xoff Interrupt Enable */ #define UART_EXAR654_IER_RTSDTR 0x40 /* Output Interrupt Enable */ #define UART_EXAR654_IER_CTSDSR 0x80 /* Input Interrupt Enable */ -- cgit v1.2.3 From c754ff966d54b3a6cb45cd57524186a16e7f5831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Fri, 13 Mar 2015 15:56:35 +0200 Subject: dgnc: Clean up dgnc_sysfs.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove redundant blank lines, move absolute include after relative include. Signed-off-by: Giedrius Statkevičius Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_sysfs.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_sysfs.h b/drivers/staging/dgnc/dgnc_sysfs.h index 2758914f69d2..be0f90a6768b 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.h +++ b/drivers/staging/dgnc/dgnc_sysfs.h @@ -16,9 +16,8 @@ #ifndef __DGNC_SYSFS_H #define __DGNC_SYSFS_H -#include "dgnc_driver.h" - #include +#include "dgnc_driver.h" struct dgnc_board; struct channel_t; @@ -38,6 +37,4 @@ extern int dgnc_tty_class_destroy(void); extern void dgnc_create_tty_sysfs(struct un_t *un, struct device *c); extern void dgnc_remove_tty_sysfs(struct device *c); - - #endif -- cgit v1.2.3 From 153fe946412b5da1a8808f79d4f7f4ebfa7586b0 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Fri, 20 Mar 2015 16:21:58 +0100 Subject: staging: fbtft: Do not use binary constants Gcc < 4.3 doesn't understand binary constants (0b*): drivers/staging/fbtft/fbtft-sysfs.c:156:19: error: invalid suffix "b111" on integer constant drivers/staging/fbtft/fb_hx8340bn.c:159:3: error: invalid suffix "b1111" on integer constant drivers/staging/fbtft/fb_hx8340bn.c:159:11: error: invalid suffix "b1111" on integer constant drivers/staging/fbtft/fb_hx8340bn.c:159:19: error: invalid suffix "b11111" on integer constant drivers/staging/fbtft/fb_hx8340bn.c:159:28: error: invalid suffix "b1111" on integer constant drivers/staging/fbtft/fb_hx8340bn.c:159:36: error: invalid suffix "b1111" on integer constant drivers/staging/fbtft/fb_hx8340bn.c:159:44: error: invalid suffix "b1111" on integer constant drivers/staging/fbtft/fb_hx8340bn.c:159:52: error: invalid suffix "b11111" on integer constant drivers/staging/fbtft/fb_hx8340bn.c:160:3: error: invalid suffix "b111" on integer constant ... Hence use hexadecimal constants (0x*) instead. Signed-off-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_hx8340bn.c | 8 ++++---- drivers/staging/fbtft/fb_hx8347d.c | 7 +++---- drivers/staging/fbtft/fb_ili9320.c | 7 +++---- drivers/staging/fbtft/fb_ili9325.c | 27 +++++++++++++-------------- drivers/staging/fbtft/fb_s6d1121.c | 10 ++++------ drivers/staging/fbtft/fb_ssd1289.c | 15 +++++++-------- drivers/staging/fbtft/fb_ssd1351.c | 8 ++++---- drivers/staging/fbtft/fb_st7735r.c | 2 +- drivers/staging/fbtft/fbtft-sysfs.c | 2 +- drivers/staging/fbtft/fbtft_device.c | 6 +++--- 10 files changed, 43 insertions(+), 49 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_hx8340bn.c b/drivers/staging/fbtft/fb_hx8340bn.c index 53edf253ed63..cfe2b5b805cb 100644 --- a/drivers/staging/fbtft/fb_hx8340bn.c +++ b/drivers/staging/fbtft/fb_hx8340bn.c @@ -149,10 +149,10 @@ static int set_var(struct fbtft_par *par) static int set_gamma(struct fbtft_par *par, unsigned long *curves) { unsigned long mask[] = { - 0b1111, 0b1111, 0b11111, 0b1111, 0b1111, 0b1111, 0b11111, - 0b111, 0b111, 0b111, 0b111, 0b111, 0b111, 0b11, 0b11, - 0b1111, 0b1111, 0b11111, 0b1111, 0b1111, 0b1111, 0b11111, - 0b111, 0b111, 0b111, 0b111, 0b111, 0b111, 0b0, 0b0 }; + 0x0f, 0x0f, 0x1f, 0x0f, 0x0f, 0x0f, 0x1f, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x03, 0x03, 0x0f, 0x0f, 0x1f, 0x0f, 0x0f, + 0x0f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, + }; int i, j; /* apply mask */ diff --git a/drivers/staging/fbtft/fb_hx8347d.c b/drivers/staging/fbtft/fb_hx8347d.c index 8139a8f587b7..03ae95b4f79e 100644 --- a/drivers/staging/fbtft/fb_hx8347d.c +++ b/drivers/staging/fbtft/fb_hx8347d.c @@ -115,10 +115,9 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) static int set_gamma(struct fbtft_par *par, unsigned long *curves) { unsigned long mask[] = { - 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, - 0b1111111, 0b1111111, - 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, - 0b1111}; + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x7f, 0x7f, 0x1f, 0x1f, + 0x1f, 0x1f, 0x1f, 0x0f, + }; int i, j; int acc = 0; diff --git a/drivers/staging/fbtft/fb_ili9320.c b/drivers/staging/fbtft/fb_ili9320.c index 880f548158e6..3a02edd447d4 100644 --- a/drivers/staging/fbtft/fb_ili9320.c +++ b/drivers/staging/fbtft/fb_ili9320.c @@ -179,10 +179,9 @@ static int set_var(struct fbtft_par *par) static int set_gamma(struct fbtft_par *par, unsigned long *curves) { unsigned long mask[] = { - 0b11111, 0b11111, 0b111, 0b111, 0b111, - 0b111, 0b111, 0b111, 0b111, 0b111, - 0b11111, 0b11111, 0b111, 0b111, 0b111, - 0b111, 0b111, 0b111, 0b111, 0b111 }; + 0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + }; int i, j; fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); diff --git a/drivers/staging/fbtft/fb_ili9325.c b/drivers/staging/fbtft/fb_ili9325.c index 5f88145fac9b..19d254e9a420 100644 --- a/drivers/staging/fbtft/fb_ili9325.c +++ b/drivers/staging/fbtft/fb_ili9325.c @@ -41,22 +41,22 @@ static unsigned bt = 6; /* VGL=Vci*4 , VGH=Vci*4 */ module_param(bt, uint, 0); MODULE_PARM_DESC(bt, "Sets the factor used in the step-up circuits"); -static unsigned vc = 0b011; /* Vci1=Vci*0.80 */ +static unsigned vc = 0x03; /* Vci1=Vci*0.80 */ module_param(vc, uint, 0); MODULE_PARM_DESC(vc, "Sets the ratio factor of Vci to generate the reference voltages Vci1"); -static unsigned vrh = 0b1101; /* VREG1OUT=Vci*1.85 */ +static unsigned vrh = 0x0d; /* VREG1OUT=Vci*1.85 */ module_param(vrh, uint, 0); MODULE_PARM_DESC(vrh, "Set the amplifying rate (1.6 ~ 1.9) of Vci applied to output the VREG1OUT"); -static unsigned vdv = 0b10010; /* VCOMH amplitude=VREG1OUT*0.98 */ +static unsigned vdv = 0x12; /* VCOMH amplitude=VREG1OUT*0.98 */ module_param(vdv, uint, 0); MODULE_PARM_DESC(vdv, "Select the factor of VREG1OUT to set the amplitude of Vcom"); -static unsigned vcm = 0b001010; /* VCOMH=VREG1OUT*0.735 */ +static unsigned vcm = 0x0a; /* VCOMH=VREG1OUT*0.735 */ module_param(vcm, uint, 0); MODULE_PARM_DESC(vcm, "Set the internal VcomH voltage"); @@ -108,11 +108,11 @@ static int init_display(struct fbtft_par *par) if (par->gpio.cs != -1) gpio_set_value(par->gpio.cs, 0); /* Activate chip */ - bt &= 0b111; - vc &= 0b111; - vrh &= 0b1111; - vdv &= 0b11111; - vcm &= 0b111111; + bt &= 0x07; + vc &= 0x07; + vrh &= 0x0f; + vdv &= 0x1f; + vcm &= 0x3f; /* Initialization sequence from ILI9325 Application Notes */ @@ -137,7 +137,7 @@ static int init_display(struct fbtft_par *par) write_reg(par, 0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */ mdelay(200); /* Dis-charge capacitor power voltage */ write_reg(par, 0x0010, /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - (1 << 12) | (bt << 8) | (1 << 7) | (0b001 << 4)); + (1 << 12) | (bt << 8) | (1 << 7) | (0x01 << 4)); write_reg(par, 0x0011, 0x220 | vc); /* DC1[2:0], DC0[2:0], VC[2:0] */ mdelay(50); /* Delay 50ms */ write_reg(par, 0x0012, vrh); /* Internal reference voltage= Vci; */ @@ -233,10 +233,9 @@ static int set_var(struct fbtft_par *par) static int set_gamma(struct fbtft_par *par, unsigned long *curves) { unsigned long mask[] = { - 0b11111, 0b11111, 0b111, 0b111, 0b111, - 0b111, 0b111, 0b111, 0b111, 0b111, - 0b11111, 0b11111, 0b111, 0b111, 0b111, - 0b111, 0b111, 0b111, 0b111, 0b111 }; + 0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + }; int i, j; fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); diff --git a/drivers/staging/fbtft/fb_s6d1121.c b/drivers/staging/fbtft/fb_s6d1121.c index 7bbb21b28eff..2e1b72ad54aa 100644 --- a/drivers/staging/fbtft/fb_s6d1121.c +++ b/drivers/staging/fbtft/fb_s6d1121.c @@ -143,12 +143,10 @@ static int set_var(struct fbtft_par *par) static int set_gamma(struct fbtft_par *par, unsigned long *curves) { unsigned long mask[] = { - 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, - 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, - 0b11111, 0b11111, - 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, - 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, - 0b11111, 0b11111 }; + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x1f, 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1f, 0x1f, + }; int i, j; fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); diff --git a/drivers/staging/fbtft/fb_ssd1289.c b/drivers/staging/fbtft/fb_ssd1289.c index ef46fbca2700..17a77e061498 100644 --- a/drivers/staging/fbtft/fb_ssd1289.c +++ b/drivers/staging/fbtft/fb_ssd1289.c @@ -126,16 +126,16 @@ static int set_var(struct fbtft_par *par) switch (par->info->var.rotate) { case 0: - write_reg(par, 0x11, reg11 | 0b110000); + write_reg(par, 0x11, reg11 | 0x30); break; case 270: - write_reg(par, 0x11, reg11 | 0b101000); + write_reg(par, 0x11, reg11 | 0x28); break; case 180: - write_reg(par, 0x11, reg11 | 0b000000); + write_reg(par, 0x11, reg11 | 0x00); break; case 90: - write_reg(par, 0x11, reg11 | 0b011000); + write_reg(par, 0x11, reg11 | 0x18); break; } @@ -151,10 +151,9 @@ static int set_var(struct fbtft_par *par) static int set_gamma(struct fbtft_par *par, unsigned long *curves) { unsigned long mask[] = { - 0b11111, 0b11111, 0b111, 0b111, 0b111, - 0b111, 0b111, 0b111, 0b111, 0b111, - 0b11111, 0b11111, 0b111, 0b111, 0b111, - 0b111, 0b111, 0b111, 0b111, 0b111 }; + 0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + }; int i, j; fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c index fd492b4eaad6..9bcd7a0aeed4 100644 --- a/drivers/staging/fbtft/fb_ssd1351.c +++ b/drivers/staging/fbtft/fb_ssd1351.c @@ -87,16 +87,16 @@ static int set_var(struct fbtft_par *par) switch (par->info->var.rotate) { case 0: - write_reg(par, 0xA0, remap | 0b00 | 1<<4); + write_reg(par, 0xA0, remap | 0x00 | 1<<4); break; case 270: - write_reg(par, 0xA0, remap | 0b11 | 1<<4); + write_reg(par, 0xA0, remap | 0x03 | 1<<4); break; case 180: - write_reg(par, 0xA0, remap | 0b10); + write_reg(par, 0xA0, remap | 0x02); break; case 90: - write_reg(par, 0xA0, remap | 0b01); + write_reg(par, 0xA0, remap | 0x01); break; } diff --git a/drivers/staging/fbtft/fb_st7735r.c b/drivers/staging/fbtft/fb_st7735r.c index c1c6e58385a6..2a614d5ba264 100644 --- a/drivers/staging/fbtft/fb_st7735r.c +++ b/drivers/staging/fbtft/fb_st7735r.c @@ -155,7 +155,7 @@ static int set_gamma(struct fbtft_par *par, unsigned long *curves) /* apply mask */ for (i = 0; i < par->gamma.num_curves; i++) for (j = 0; j < par->gamma.num_values; j++) - CURVE(i, j) &= 0b111111; + CURVE(i, j) &= 0x3f; for (i = 0; i < par->gamma.num_curves; i++) write_reg(par, 0xE0 + i, diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c index e3eb1f9587b3..c4cc452f9f2b 100644 --- a/drivers/staging/fbtft/fbtft-sysfs.c +++ b/drivers/staging/fbtft/fbtft-sysfs.c @@ -152,7 +152,7 @@ static struct device_attribute gamma_device_attrs[] = { void fbtft_expand_debug_value(unsigned long *debug) { - switch (*debug & 0b111) { + switch (*debug & 0x7) { case 1: *debug |= DEBUG_LEVEL_1; break; diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 1afeebb95c54..1880864c4d7c 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -489,7 +489,7 @@ static struct fbtft_device_display displays[] = { .buswidth = 8, .backlight = 1, }, - .startbyte = 0b01110000, + .startbyte = 0x70, .bgr = true, .gpios = (const struct fbtft_gpio []) { { "reset", 25 }, @@ -510,7 +510,7 @@ static struct fbtft_device_display displays[] = { .backlight = 1, .init_sequence = hy28b_init_sequence, }, - .startbyte = 0b01110000, + .startbyte = 0x70, .bgr = true, .fps = 50, .gpios = (const struct fbtft_gpio []) { @@ -623,7 +623,7 @@ static struct fbtft_device_display displays[] = { .buswidth = 8, .backlight = 1, }, - .startbyte = 0b01110000, + .startbyte = 0x70, .bgr = true, .gpios = (const struct fbtft_gpio []) { { "reset", 25 }, -- cgit v1.2.3 From e2e40f2c1ed433c5e224525c8c862fd32e5d3df2 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 22 Feb 2015 08:58:50 -0800 Subject: fs: move struct kiocb to fs.h struct kiocb now is a generic I/O container, so move it to fs.h. Also do a #include diet for aio.h while we're at it. Signed-off-by: Christoph Hellwig Signed-off-by: Al Viro --- drivers/staging/unisys/include/timskmod.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index 4019a0d63645..52648d4d9922 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From bf9525157107a4fac6afeb4757249e1569249faf Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Wed, 25 Mar 2015 18:35:46 +0530 Subject: Staging: rtl8188eu: Reduce line size to increase readability Reduce line size to increase readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8188eu/hal/Hal8188ERateAdaptive.c | 50 +++++++++++++++------- 1 file changed, 34 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c index 353ff3761a2a..22e4309f917f 100644 --- a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c +++ b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c @@ -115,17 +115,21 @@ static void odm_SetTxRPTTiming_8188E( } pRaInfo->RptTime = DynamicTxRPTTiming[idx]; - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("pRaInfo->RptTime = 0x%x\n", pRaInfo->RptTime)); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("pRaInfo->RptTime = 0x%x\n", pRaInfo->RptTime)); } -static int odm_RateDown_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_info *pRaInfo) +static int odm_RateDown_8188E(struct odm_dm_struct *dm_odm, + struct odm_ra_info *pRaInfo) { u8 RateID, LowestRate, HighestRate; u8 i; - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDown_8188E()\n")); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, + ODM_DBG_TRACE, ("=====>odm_RateDown_8188E()\n")); if (NULL == pRaInfo) { - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateDown_8188E(): pRaInfo is NULL\n")); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("odm_RateDown_8188E(): pRaInfo is NULL\n")); return -1; } RateID = pRaInfo->PreRate; @@ -167,10 +171,15 @@ RateDownFinish: pRaInfo->DecisionRate = RateID; odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 2); - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate down, RPT Timing default\n")); - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("RAWaitingCounter %d, RAPendingCounter %d", pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter)); - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate down to RateID %d RateSGI %d\n", RateID, pRaInfo->RateSGI)); - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<===== odm_RateDown_8188E()\n")); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, + ODM_DBG_LOUD, ("Rate down, RPT Timing default\n")); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ("RAWaitingCounter %d, RAPendingCounter %d", + pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter)); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("Rate down to RateID %d RateSGI %d\n", RateID, pRaInfo->RateSGI)); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ("<===== odm_RateDown_8188E()\n")); return 0; } @@ -182,9 +191,11 @@ static int odm_RateUp_8188E( u8 RateID, HighestRate; u8 i; - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateUp_8188E()\n")); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, + ODM_DBG_TRACE, ("=====>odm_RateUp_8188E()\n")); if (NULL == pRaInfo) { - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E(): pRaInfo is NULL\n")); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("odm_RateUp_8188E(): pRaInfo is NULL\n")); return -1; } RateID = pRaInfo->PreRate; @@ -200,7 +211,8 @@ static int odm_RateUp_8188E( goto RateUpfinish; } odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 0); - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E():Decrease RPT Timing\n")); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("odm_RateUp_8188E():Decrease RPT Timing\n")); if (RateID < HighestRate) { for (i = RateID+1; i <= HighestRate; i++) { @@ -218,15 +230,20 @@ static int odm_RateUp_8188E( RateID = HighestRate; } RateUpfinish: - if (pRaInfo->RAWaitingCounter == (4+PendingForRateUpFail[pRaInfo->RAPendingCounter])) + if (pRaInfo->RAWaitingCounter == + (4+PendingForRateUpFail[pRaInfo->RAPendingCounter])) pRaInfo->RAWaitingCounter = 0; else pRaInfo->RAWaitingCounter++; pRaInfo->DecisionRate = RateID; - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate up to RateID %d\n", RateID)); - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("RAWaitingCounter %d, RAPendingCounter %d", pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter)); - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<===== odm_RateUp_8188E()\n")); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, + ("Rate up to RateID %d\n", RateID)); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ("RAWaitingCounter %d, RAPendingCounter %d", + pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter)); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, + ODM_DBG_TRACE, ("<===== odm_RateUp_8188E()\n")); return 0; } @@ -247,7 +264,8 @@ static void odm_RateDecision_8188E(struct odm_dm_struct *dm_odm, /* u32 pool_retry; */ static u8 DynamicTxRPTTimingCounter; - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDecision_8188E()\n")); + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + ("=====>odm_RateDecision_8188E()\n")); if (pRaInfo->Active && (pRaInfo->TOTAL > 0)) { /* STA used and data packet exits */ if ((pRaInfo->RssiStaRA < (pRaInfo->PreRssiStaRA - 3)) || -- cgit v1.2.3 From 175bbae0c74bd9d250c7f9992d0b746412b78d12 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Wed, 25 Mar 2015 18:35:47 +0530 Subject: Staging: rtl8188eu: Refactor repititive code to loop to increase compactness Refactor repetitive code to loop so as to increase compactness and introduce newlines for readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8188eu/hal/Hal8188ERateAdaptive.c | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c index 22e4309f917f..082f0ca198ef 100644 --- a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c +++ b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c @@ -260,7 +260,7 @@ static void odm_RateDecision_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_info *pRaInfo ) { - u8 RateID = 0, RtyPtID = 0, PenaltyID1 = 0, PenaltyID2 = 0; + u8 RateID = 0, RtyPtID = 0, PenaltyID1 = 0, PenaltyID2 = 0, i = 0; /* u32 pool_retry; */ static u8 DynamicTxRPTTimingCounter; @@ -286,14 +286,14 @@ static void odm_RateDecision_8188E(struct odm_dm_struct *dm_odm, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" NscDown init is %d\n", pRaInfo->NscDown)); - pRaInfo->NscDown += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID1][0]; - pRaInfo->NscDown += pRaInfo->RTY[1] * RETRY_PENALTY[PenaltyID1][1]; - pRaInfo->NscDown += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID1][2]; - pRaInfo->NscDown += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID1][3]; - pRaInfo->NscDown += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID1][4]; + + for (i = 0 ; i <= 4 ; i++) + pRaInfo->NscDown += pRaInfo->RTY[i] * RETRY_PENALTY[PenaltyID1][i]; + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, - (" NscDown is %d, total*penalty[5] is %d\n", - pRaInfo->NscDown, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]))); + (" NscDown is %d, total*penalty[5] is %d\n", pRaInfo->NscDown, + (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]))); + if (pRaInfo->NscDown > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5])) pRaInfo->NscDown -= pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]; else @@ -303,14 +303,14 @@ static void odm_RateDecision_8188E(struct odm_dm_struct *dm_odm, PenaltyID2 = RETRY_PENALTY_UP_IDX[RateID]; ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" NscUp init is %d\n", pRaInfo->NscUp)); - pRaInfo->NscUp += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID2][0]; - pRaInfo->NscUp += pRaInfo->RTY[1] * RETRY_PENALTY[PenaltyID2][1]; - pRaInfo->NscUp += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID2][2]; - pRaInfo->NscUp += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID2][3]; - pRaInfo->NscUp += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID2][4]; + + for (i = 0 ; i <= 4 ; i++) + pRaInfo->NscUp += pRaInfo->RTY[i] * RETRY_PENALTY[PenaltyID2][i]; + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("NscUp is %d, total*up[5] is %d\n", pRaInfo->NscUp, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5]))); + if (pRaInfo->NscUp > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5])) pRaInfo->NscUp -= pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5]; else -- cgit v1.2.3 From fe36bad239c90416ef11d44b5ea52238c027f923 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Wed, 25 Mar 2015 18:43:11 +0530 Subject: Staging: rtl8188eu: Add new variable to make code compact Introducing this variable leads to overall more code compactness and increases readability. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/bb_cfg.c | 162 +++++++++++++++++---------------- 1 file changed, 84 insertions(+), 78 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c b/drivers/staging/rtl8188eu/hal/bb_cfg.c index 2d3d012d3736..8eb2b39a0b67 100644 --- a/drivers/staging/rtl8188eu/hal/bb_cfg.c +++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c @@ -600,84 +600,90 @@ static bool config_bb_with_pgheader(struct adapter *adapt) static void rtl88e_phy_init_bb_rf_register_definition(struct adapter *Adapter) { struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); - - hal_data->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; - hal_data->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; - hal_data->PHYRegDef[RF_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW; - hal_data->PHYRegDef[RF_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW; - - hal_data->PHYRegDef[RF_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB; - hal_data->PHYRegDef[RF_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB; - hal_data->PHYRegDef[RF_PATH_C].rfintfi = rFPGA0_XCD_RFInterfaceRB; - hal_data->PHYRegDef[RF_PATH_D].rfintfi = rFPGA0_XCD_RFInterfaceRB; - - hal_data->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; - hal_data->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; - - hal_data->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; - hal_data->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; - - hal_data->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; - hal_data->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; - - hal_data->PHYRegDef[RF_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter; - hal_data->PHYRegDef[RF_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter; - hal_data->PHYRegDef[RF_PATH_C].rfLSSI_Select = rFPGA0_XCD_RFParameter; - hal_data->PHYRegDef[RF_PATH_D].rfLSSI_Select = rFPGA0_XCD_RFParameter; - - hal_data->PHYRegDef[RF_PATH_A].rfTxGainStage = rFPGA0_TxGainStage; - hal_data->PHYRegDef[RF_PATH_B].rfTxGainStage = rFPGA0_TxGainStage; - hal_data->PHYRegDef[RF_PATH_C].rfTxGainStage = rFPGA0_TxGainStage; - hal_data->PHYRegDef[RF_PATH_D].rfTxGainStage = rFPGA0_TxGainStage; - - hal_data->PHYRegDef[RF_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; - hal_data->PHYRegDef[RF_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1; - - hal_data->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; - hal_data->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; - - hal_data->PHYRegDef[RF_PATH_A].rfSwitchControl = rFPGA0_XAB_SwitchControl; - hal_data->PHYRegDef[RF_PATH_B].rfSwitchControl = rFPGA0_XAB_SwitchControl; - hal_data->PHYRegDef[RF_PATH_C].rfSwitchControl = rFPGA0_XCD_SwitchControl; - hal_data->PHYRegDef[RF_PATH_D].rfSwitchControl = rFPGA0_XCD_SwitchControl; - - hal_data->PHYRegDef[RF_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1; - hal_data->PHYRegDef[RF_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1; - hal_data->PHYRegDef[RF_PATH_C].rfAGCControl1 = rOFDM0_XCAGCCore1; - hal_data->PHYRegDef[RF_PATH_D].rfAGCControl1 = rOFDM0_XDAGCCore1; - - hal_data->PHYRegDef[RF_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2; - hal_data->PHYRegDef[RF_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2; - hal_data->PHYRegDef[RF_PATH_C].rfAGCControl2 = rOFDM0_XCAGCCore2; - hal_data->PHYRegDef[RF_PATH_D].rfAGCControl2 = rOFDM0_XDAGCCore2; - - hal_data->PHYRegDef[RF_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance; - hal_data->PHYRegDef[RF_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance; - hal_data->PHYRegDef[RF_PATH_C].rfRxIQImbalance = rOFDM0_XCRxIQImbalance; - hal_data->PHYRegDef[RF_PATH_D].rfRxIQImbalance = rOFDM0_XDRxIQImbalance; - - hal_data->PHYRegDef[RF_PATH_A].rfRxAFE = rOFDM0_XARxAFE; - hal_data->PHYRegDef[RF_PATH_B].rfRxAFE = rOFDM0_XBRxAFE; - hal_data->PHYRegDef[RF_PATH_C].rfRxAFE = rOFDM0_XCRxAFE; - hal_data->PHYRegDef[RF_PATH_D].rfRxAFE = rOFDM0_XDRxAFE; - - hal_data->PHYRegDef[RF_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance; - hal_data->PHYRegDef[RF_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance; - hal_data->PHYRegDef[RF_PATH_C].rfTxIQImbalance = rOFDM0_XCTxIQImbalance; - hal_data->PHYRegDef[RF_PATH_D].rfTxIQImbalance = rOFDM0_XDTxIQImbalance; - - hal_data->PHYRegDef[RF_PATH_A].rfTxAFE = rOFDM0_XATxAFE; - hal_data->PHYRegDef[RF_PATH_B].rfTxAFE = rOFDM0_XBTxAFE; - hal_data->PHYRegDef[RF_PATH_C].rfTxAFE = rOFDM0_XCTxAFE; - hal_data->PHYRegDef[RF_PATH_D].rfTxAFE = rOFDM0_XDTxAFE; - - hal_data->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; - hal_data->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; - hal_data->PHYRegDef[RF_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack; - hal_data->PHYRegDef[RF_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack; - - hal_data->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback; - hal_data->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback; + struct bb_reg_def *reg[4]; + + reg[RF_PATH_A] = &(hal_data->PHYRegDef[RF_PATH_A]); + reg[RF_PATH_B] = &(hal_data->PHYRegDef[RF_PATH_B]); + reg[RF_PATH_C] = &(hal_data->PHYRegDef[RF_PATH_C]); + reg[RF_PATH_D] = &(hal_data->PHYRegDef[RF_PATH_D]); + + reg[RF_PATH_A]->rfintfs = rFPGA0_XAB_RFInterfaceSW; + reg[RF_PATH_B]->rfintfs = rFPGA0_XAB_RFInterfaceSW; + reg[RF_PATH_C]->rfintfs = rFPGA0_XCD_RFInterfaceSW; + reg[RF_PATH_D]->rfintfs = rFPGA0_XCD_RFInterfaceSW; + + reg[RF_PATH_A]->rfintfi = rFPGA0_XAB_RFInterfaceRB; + reg[RF_PATH_B]->rfintfi = rFPGA0_XAB_RFInterfaceRB; + reg[RF_PATH_C]->rfintfi = rFPGA0_XCD_RFInterfaceRB; + reg[RF_PATH_D]->rfintfi = rFPGA0_XCD_RFInterfaceRB; + + reg[RF_PATH_A]->rfintfo = rFPGA0_XA_RFInterfaceOE; + reg[RF_PATH_B]->rfintfo = rFPGA0_XB_RFInterfaceOE; + + reg[RF_PATH_A]->rfintfe = rFPGA0_XA_RFInterfaceOE; + reg[RF_PATH_B]->rfintfe = rFPGA0_XB_RFInterfaceOE; + + reg[RF_PATH_A]->rf3wireOffset = rFPGA0_XA_LSSIParameter; + reg[RF_PATH_B]->rf3wireOffset = rFPGA0_XB_LSSIParameter; + + reg[RF_PATH_A]->rfLSSI_Select = rFPGA0_XAB_RFParameter; + reg[RF_PATH_B]->rfLSSI_Select = rFPGA0_XAB_RFParameter; + reg[RF_PATH_C]->rfLSSI_Select = rFPGA0_XCD_RFParameter; + reg[RF_PATH_D]->rfLSSI_Select = rFPGA0_XCD_RFParameter; + + reg[RF_PATH_A]->rfTxGainStage = rFPGA0_TxGainStage; + reg[RF_PATH_B]->rfTxGainStage = rFPGA0_TxGainStage; + reg[RF_PATH_C]->rfTxGainStage = rFPGA0_TxGainStage; + reg[RF_PATH_D]->rfTxGainStage = rFPGA0_TxGainStage; + + reg[RF_PATH_A]->rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; + reg[RF_PATH_B]->rfHSSIPara1 = rFPGA0_XB_HSSIParameter1; + + reg[RF_PATH_A]->rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; + reg[RF_PATH_B]->rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; + + reg[RF_PATH_A]->rfSwitchControl = rFPGA0_XAB_SwitchControl; + reg[RF_PATH_B]->rfSwitchControl = rFPGA0_XAB_SwitchControl; + reg[RF_PATH_C]->rfSwitchControl = rFPGA0_XCD_SwitchControl; + reg[RF_PATH_D]->rfSwitchControl = rFPGA0_XCD_SwitchControl; + + reg[RF_PATH_A]->rfAGCControl1 = rOFDM0_XAAGCCore1; + reg[RF_PATH_B]->rfAGCControl1 = rOFDM0_XBAGCCore1; + reg[RF_PATH_C]->rfAGCControl1 = rOFDM0_XCAGCCore1; + reg[RF_PATH_D]->rfAGCControl1 = rOFDM0_XDAGCCore1; + + reg[RF_PATH_A]->rfAGCControl2 = rOFDM0_XAAGCCore2; + reg[RF_PATH_B]->rfAGCControl2 = rOFDM0_XBAGCCore2; + reg[RF_PATH_C]->rfAGCControl2 = rOFDM0_XCAGCCore2; + reg[RF_PATH_D]->rfAGCControl2 = rOFDM0_XDAGCCore2; + + reg[RF_PATH_A]->rfRxIQImbalance = rOFDM0_XARxIQImbalance; + reg[RF_PATH_B]->rfRxIQImbalance = rOFDM0_XBRxIQImbalance; + reg[RF_PATH_C]->rfRxIQImbalance = rOFDM0_XCRxIQImbalance; + reg[RF_PATH_D]->rfRxIQImbalance = rOFDM0_XDRxIQImbalance; + + reg[RF_PATH_A]->rfRxAFE = rOFDM0_XARxAFE; + reg[RF_PATH_B]->rfRxAFE = rOFDM0_XBRxAFE; + reg[RF_PATH_C]->rfRxAFE = rOFDM0_XCRxAFE; + reg[RF_PATH_D]->rfRxAFE = rOFDM0_XDRxAFE; + + reg[RF_PATH_A]->rfTxIQImbalance = rOFDM0_XATxIQImbalance; + reg[RF_PATH_B]->rfTxIQImbalance = rOFDM0_XBTxIQImbalance; + reg[RF_PATH_C]->rfTxIQImbalance = rOFDM0_XCTxIQImbalance; + reg[RF_PATH_D]->rfTxIQImbalance = rOFDM0_XDTxIQImbalance; + + reg[RF_PATH_A]->rfTxAFE = rOFDM0_XATxAFE; + reg[RF_PATH_B]->rfTxAFE = rOFDM0_XBTxAFE; + reg[RF_PATH_C]->rfTxAFE = rOFDM0_XCTxAFE; + reg[RF_PATH_D]->rfTxAFE = rOFDM0_XDTxAFE; + + reg[RF_PATH_A]->rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; + reg[RF_PATH_B]->rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; + reg[RF_PATH_C]->rfLSSIReadBack = rFPGA0_XC_LSSIReadBack; + reg[RF_PATH_D]->rfLSSIReadBack = rFPGA0_XD_LSSIReadBack; + + reg[RF_PATH_A]->rfLSSIReadBackPi = TransceiverA_HSPI_Readback; + reg[RF_PATH_B]->rfLSSIReadBackPi = TransceiverB_HSPI_Readback; } static bool config_parafile(struct adapter *adapt) -- cgit v1.2.3 From 26bce795d6f1fd0292283db0bf730a6c37970ab6 Mon Sep 17 00:00:00 2001 From: Vatika Harlalka Date: Wed, 25 Mar 2015 21:34:48 +0530 Subject: Staging: lustre: Remove extern from function declaration Functions have the extern storage class specifier by default, so this keyword can be removed. Signed-off-by: Vatika Harlalka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index 5bf948810594..70b909f55861 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -211,9 +211,9 @@ struct ldlm_state { /* interval tree, for LDLM_EXTENT. */ extern struct kmem_cache *ldlm_interval_slab; /* slab cache for ldlm_interval */ extern void ldlm_interval_attach(struct ldlm_interval *n, struct ldlm_lock *l); -extern struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l); -extern struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock); -extern void ldlm_interval_free(struct ldlm_interval *node); +struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l); +struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock); +void ldlm_interval_free(struct ldlm_interval *node); /* this function must be called with res lock held */ static inline struct ldlm_extent * ldlm_interval_extent(struct ldlm_interval *node) -- cgit v1.2.3 From dde48b99d23f3f2e0f016d297801e4d5f13297fa Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 25 Mar 2015 08:07:06 +0300 Subject: Staging: rtl8192u: Add space before open parenthesis Space is required before the open parenthesis. This patch adds space after if to address that issue. This was done with the help of the following Coccinelle script: @r@ position p1,p2; @@ if@p1 (@p2 ...) { ... } @script:python@ p1 << r.p1; p2 << r.p2; @@ l1 = int (p1[0].line) l2 = int (p2[0].line) c1 = int (p1[0].column) c2 = int (p2[0].column) if (l2 == l1 and c1 + 2 != c2): cocci.include_match(False) @@ position r.p1,r.p2; @@ - if@p1 ( + if ( ...) { ... } Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 68 +++++++++++----------- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 40 ++++++------- .../rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +- .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 20 +++---- .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 18 +++--- 5 files changed, 75 insertions(+), 75 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 0a90450a295d..b4d09b21f8ec 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -608,12 +608,12 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, bool bMatchWinStart = false, bPktInBuf = false; IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__func__,SeqNum,pTS->RxIndicateSeq,WinSize); /* Rx Reorder initialize condition.*/ - if(pTS->RxIndicateSeq == 0xffff) { + if (pTS->RxIndicateSeq == 0xffff) { pTS->RxIndicateSeq = SeqNum; } /* Drop out the packet which SeqNum is smaller than WinStart */ - if(SN_LESS(SeqNum, pTS->RxIndicateSeq)) { + if (SN_LESS(SeqNum, pTS->RxIndicateSeq)) { IEEE80211_DEBUG(IEEE80211_DL_REORDER,"Packet Drop! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum); pHTInfo->RxReorderDropCounter++; @@ -716,7 +716,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) { /* This protect buffer from overflow. */ - if(index >= REORDER_WIN_SIZE) { + if (index >= REORDER_WIN_SIZE) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Buffer overflow!! \n"); bPktInBuf = true; break; @@ -740,7 +740,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, } /* Handling pending timer. Set this timer to prevent from long time Rx buffering.*/ - if(index>0) { + if (index>0) { // Cancel previous pending timer. // del_timer_sync(&pTS->RxPktPendingTimer); pTS->RxTimeoutIndicateSeq = 0xffff; @@ -753,7 +753,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, ieee80211_indicate_packets(ieee, prxbIndicateArray, index); } - if(bPktInBuf && pTS->RxTimeoutIndicateSeq==0xffff) { + if (bPktInBuf && pTS->RxTimeoutIndicateSeq==0xffff) { // Set new pending timer. IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): SET rx timeout timer\n", __func__); pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq; @@ -783,16 +783,16 @@ static u8 parse_subframe(struct sk_buff *skb, /* just for debug purpose */ SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl)); - if((IEEE80211_QOS_HAS_SEQ(fc))&&\ + if ((IEEE80211_QOS_HAS_SEQ(fc))&&\ (((frameqos *)(skb->data + IEEE80211_3ADDR_LEN))->field.reserved)) { bIsAggregateFrame = true; } - if(IEEE80211_QOS_HAS_SEQ(fc)) { + if (IEEE80211_QOS_HAS_SEQ(fc)) { LLCOffset += 2; } - if(rx_stats->bContainHTC) { + if (rx_stats->bContainHTC) { LLCOffset += sHTCLng; } //printk("ChkLength = %d\n", LLCOffset); @@ -826,7 +826,7 @@ static u8 parse_subframe(struct sk_buff *skb, //==m==>change the length order nSubframe_Length = (nSubframe_Length>>8) + (nSubframe_Length<<8); - if(skb->len<(ETHERNET_HEADER_SIZE + nSubframe_Length)) { + if (skb->len<(ETHERNET_HEADER_SIZE + nSubframe_Length)) { printk("%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\ __func__, rxb->nr_subframes); printk("%s: A-MSDU parse error!! Subframe Length: %d\n",__func__, nSubframe_Length); @@ -852,19 +852,19 @@ static u8 parse_subframe(struct sk_buff *skb, memcpy(data_ptr, skb->data, nSubframe_Length); #endif rxb->subframes[rxb->nr_subframes++] = sub_skb; - if(rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { + if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { IEEE80211_DEBUG_RX("ParseSubframe(): Too many Subframes! Packets dropped!\n"); break; } skb_pull(skb, nSubframe_Length); - if(skb->len != 0) { + if (skb->len != 0) { nPadding_Length = 4 - ((nSubframe_Length + ETHERNET_HEADER_SIZE) % 4); - if(nPadding_Length == 4) { + if (nPadding_Length == 4) { nPadding_Length = 0; } - if(skb->len < nPadding_Length) { + if (skb->len < nPadding_Length) { return 0; } @@ -938,7 +938,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, frag = WLAN_GET_SEQ_FRAG(sc); hdrlen = ieee80211_get_hdrlen(fc); - if(HTCCheck(ieee, skb->data)) + if (HTCCheck(ieee, skb->data)) { if(net_ratelimit()) printk("find HTCControl\n"); @@ -1273,13 +1273,13 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, } */ //added by amy for reorder - if(ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data) + if (ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data) && !is_multicast_ether_addr(hdr->addr1)) { TID = Frame_QoSTID(skb->data); SeqNum = WLAN_GET_SEQ_SEQ(sc); GetTs(ieee,(PTS_COMMON_INFO *) &pTS,hdr->addr2,TID,RX_DIR,true); - if(TID !=0 && TID !=3) + if (TID !=0 && TID !=3) { ieee->bis_any_nonbepkts = true; } @@ -1289,7 +1289,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, payload = skb->data + hdrlen; //ethertype = (payload[6] << 8) | payload[7]; rxb = kmalloc(sizeof(struct ieee80211_rxb), GFP_ATOMIC); - if(rxb == NULL) + if (rxb == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR,"%s(): kmalloc rxb error\n",__func__); goto rx_dropped; @@ -1335,7 +1335,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, stats->rx_packets++; stats->rx_bytes += sub_skb->len; - if(is_multicast_ether_addr(dst)) { + if (is_multicast_ether_addr(dst)) { stats->multicast++; } @@ -1589,14 +1589,14 @@ static inline void ieee80211_extract_country_ie( u8 *addr2 ) { - if(IS_DOT11D_ENABLE(ieee)) + if (IS_DOT11D_ENABLE(ieee)) { - if(info_element->len!= 0) + if (info_element->len!= 0) { memcpy(network->CountryIeBuf, info_element->data, info_element->len); network->CountryIeLen = info_element->len; - if(!IS_COUNTRY_IE_VALID(ieee)) + if (!IS_COUNTRY_IE_VALID(ieee)) { Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); } @@ -1607,7 +1607,7 @@ static inline void ieee80211_extract_country_ie( // some AP (e.g. Cisco 1242) don't include country IE in their // probe response frame. // - if(IS_EQUAL_CIE_SRC(ieee, addr2) ) + if (IS_EQUAL_CIE_SRC(ieee, addr2) ) { UPDATE_CIE_WATCHDOG(ieee); } @@ -1887,7 +1887,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, //if(tmp_htcap_len !=0 || tmp_htinfo_len != 0) { - if((info_element->len >= 3 && + if ((info_element->len >= 3 && info_element->data[0] == 0x00 && info_element->data[1] == 0x05 && info_element->data[2] == 0xb5) || @@ -1939,7 +1939,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, else network->cisco_cap_exist = false; //added by amy for LEAP of cisco - if(info_element->len > 4 && + if (info_element->len > 4 && info_element->data[0] == 0x00 && info_element->data[1] == 0x40 && info_element->data[2] == 0x96 && @@ -1975,7 +1975,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, network->bCcxRmEnable = false; } } - if(info_element->len > 4 && + if (info_element->len > 4 && info_element->data[0] == 0x00 && info_element->data[1] == 0x40 && info_element->data[2] == 0x96 && @@ -2295,7 +2295,7 @@ static inline void update_network(struct ieee80211_network *dst, dst->rates_len = src->rates_len; memcpy(dst->rates_ex, src->rates_ex, src->rates_ex_len); dst->rates_ex_len = src->rates_ex_len; - if(src->ssid_len > 0) + if (src->ssid_len > 0) { memset(dst->ssid, 0, dst->ssid_len); dst->ssid_len = src->ssid_len; @@ -2351,7 +2351,7 @@ static inline void update_network(struct ieee80211_network *dst, dst->qos_data.param_count = src->qos_data.param_count; } - if(dst->qos_data.supported == 1) { + if (dst->qos_data.supported == 1) { dst->QoS_Enable = 1; if(dst->ssid_len) IEEE80211_DEBUG_QOS @@ -2366,7 +2366,7 @@ static inline void update_network(struct ieee80211_network *dst, /* dst->last_associate is not overwritten */ dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame. - if(src->wmm_param[0].ac_aci_acm_aifsn|| \ + if (src->wmm_param[0].ac_aci_acm_aifsn|| \ src->wmm_param[1].ac_aci_acm_aifsn|| \ src->wmm_param[2].ac_aci_acm_aifsn|| \ src->wmm_param[3].ac_aci_acm_aifsn) { @@ -2455,7 +2455,7 @@ static inline void ieee80211_process_probe_response( if (!IsLegalChannel(ieee, network.channel)) return; - if(ieee->bGlobalDomain) + if (ieee->bGlobalDomain) { if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) { @@ -2471,7 +2471,7 @@ static inline void ieee80211_process_probe_response( else { // Filter over channel ch12~14 - if(network.channel > 11) + if (network.channel > 11) { printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel); return; @@ -2492,7 +2492,7 @@ static inline void ieee80211_process_probe_response( else { // Filter over channel ch12~14 - if(network.channel > 14) + if (network.channel > 14) { printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n",network.channel); return; @@ -2513,9 +2513,9 @@ static inline void ieee80211_process_probe_response( spin_lock_irqsave(&ieee->lock, flags); - if(is_same_network(&ieee->current_network, &network, ieee)) { + if (is_same_network(&ieee->current_network, &network, ieee)) { update_network(&ieee->current_network, &network); - if((ieee->current_network.mode == IEEE_N_24G || ieee->current_network.mode == IEEE_G) + if ((ieee->current_network.mode == IEEE_N_24G || ieee->current_network.mode == IEEE_G) && ieee->current_network.berp_info_valid){ if(ieee->current_network.erp_value& ERP_UseProtection) ieee->current_network.buseprotection = true; @@ -2605,7 +2605,7 @@ static inline void ieee80211_process_probe_response( spin_unlock_irqrestore(&ieee->lock, flags); if (is_beacon(beacon->header.frame_ctl)&&is_same_network(&ieee->current_network, &network, ieee)&&\ (ieee->state == IEEE80211_LINKED)) { - if(ieee->handle_beacon != NULL) { + if (ieee->handle_beacon != NULL) { ieee->handle_beacon(ieee->dev,beacon,&ieee->current_network); } } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 66b158714822..168ee32ae45d 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -609,9 +609,9 @@ EXPORT_SYMBOL(ieee80211_stop_scan); /* called with ieee->lock held */ static void ieee80211_start_scan(struct ieee80211_device *ieee) { - if(IS_DOT11D_ENABLE(ieee) ) + if (IS_DOT11D_ENABLE(ieee) ) { - if(IS_COUNTRY_IE_VALID(ieee)) + if (IS_COUNTRY_IE_VALID(ieee)) { RESET_CIE_WATCHDOG(ieee); } @@ -629,9 +629,9 @@ static void ieee80211_start_scan(struct ieee80211_device *ieee) /* called with wx_sem held */ void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) { - if(IS_DOT11D_ENABLE(ieee) ) + if (IS_DOT11D_ENABLE(ieee) ) { - if(IS_COUNTRY_IE_VALID(ieee)) + if (IS_COUNTRY_IE_VALID(ieee)) { RESET_CIE_WATCHDOG(ieee); } @@ -739,7 +739,7 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d HTConstructInfoElement(ieee,tmp_ht_info_buf,&tmp_ht_info_len, encrypt); - if(pHTInfo->bRegRT2RTAggregation) + if (pHTInfo->bRegRT2RTAggregation) { tmp_generic_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; tmp_generic_ie_len = sizeof(ieee->pHTInfo->szRT2RTAggBuffer); @@ -1016,12 +1016,12 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name,"WEP") || wpa_ie_len)); //Include High Throuput capability && Realtek proprietary - if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT) + if (ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT) { ht_cap_buf = (u8 *)&(ieee->pHTInfo->SelfHTCap); ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); HTConstructCapabilityElement(ieee, ht_cap_buf, &ht_cap_len, encrypt); - if(ieee->pHTInfo->bCurrentRT2RTAggregation) + if (ieee->pHTInfo->bCurrentRT2RTAggregation) { realtek_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; realtek_ie_len = sizeof( ieee->pHTInfo->szRT2RTAggBuffer); @@ -1034,11 +1034,11 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco } - if(beacon->bCkipSupported) + if (beacon->bCkipSupported) { ckip_ie_len = 30+2; } - if(beacon->bCcxRmEnable) + if (beacon->bCcxRmEnable) { ccxrm_ie_len = 6+2; } @@ -1141,7 +1141,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag += osCcxAironetIE.Length; } - if(beacon->bCcxRmEnable) + if (beacon->bCcxRmEnable) { static u8 CcxRmCapBuf[] = {0x00, 0x40, 0x96, 0x01, 0x01, 0x00}; OCTET_STRING osCcxRmCap; @@ -1168,8 +1168,8 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag += osCcxVerNum.Length; } //HT cap element - if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ - if(ieee->pHTInfo->ePeerHTSpecVer != HT_SPEC_VER_EWC) + if (ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ + if (ieee->pHTInfo->ePeerHTSpecVer != HT_SPEC_VER_EWC) { tag = skb_put(skb, ht_cap_len); *tag++ = MFIE_TYPE_HT_CAP; @@ -1187,12 +1187,12 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco } tag = skb_put(skb, wmm_info_len); - if(wmm_info_len) { + if (wmm_info_len) { ieee80211_WMM_Info(ieee, &tag); } #ifdef THOMAS_TURBO tag = skb_put(skb, turbo_info_len); - if(turbo_info_len) { + if (turbo_info_len) { ieee80211_TURBO_Info(ieee, &tag); } #endif @@ -1358,7 +1358,7 @@ static void ieee80211_associate_complete_wq(struct work_struct *work) } ieee->LinkDetectInfo.SlotNum = 2 * (1 + ieee->current_network.beacon_interval/500); // To prevent the immediately calling watch_dog after association. - if(ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) + if (ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) { ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1; ieee->LinkDetectInfo.NumRecvDataInPeriod= 1; @@ -1782,7 +1782,7 @@ static inline void ieee80211_sta_ps(struct ieee80211_device *ieee) spin_lock_irqsave(&ieee->lock, flags); - if((ieee->ps == IEEE80211_PS_DISABLED || + if ((ieee->ps == IEEE80211_PS_DISABLED || ieee->iw_mode != IW_MODE_INFRA || ieee->state != IEEE80211_LINKED)){ @@ -2024,7 +2024,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, ieee->softmac_stats.rx_ass_ok++; /* station support qos */ /* Let the register setting defaultly with Legacy station */ - if(ieee->qos_support) { + if (ieee->qos_support) { assoc_resp = (struct ieee80211_assoc_response_frame *)skb->data; memset(network, 0, sizeof(*network)); if (ieee80211_parse_info_param(ieee,assoc_resp->info_element,\ @@ -2156,7 +2156,7 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * ieee->stats.tx_bytes += txb->payload_size; ieee->stats.tx_packets++; tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); - if(tcb_desc->bMulticast) { + if (tcb_desc->bMulticast) { ieee->stats.multicast++; } /* if xmit available, just xmit it immediately, else just insert it to the wait queue */ @@ -2460,9 +2460,9 @@ void ieee80211_start_bss(struct ieee80211_device *ieee) // Ref: 802.11d 11.1.3.3 // STA shall not start a BSS unless properly formed Beacon frame including a Country IE. // - if(IS_DOT11D_ENABLE(ieee) && !IS_COUNTRY_IE_VALID(ieee)) + if (IS_DOT11D_ENABLE(ieee) && !IS_COUNTRY_IE_VALID(ieee)) { - if(! ieee->bGlobalDomain) + if (! ieee->bGlobalDomain) { return; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index dcfa5abea127..77d0a34750c3 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -345,7 +345,7 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work) ieee->state = IEEE80211_LINKED; ieee->link_change(ieee->dev); // To prevent the immediately calling watch_dog after scan. - if(ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) + if (ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) { ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1; ieee->LinkDetectInfo.NumRecvDataInPeriod= 1; @@ -469,7 +469,7 @@ EXPORT_SYMBOL(ieee80211_wx_get_mode); printk(KERN_INFO"raw TX is %s\n", ieee->raw_tx ? "enabled" : "disabled"); - if(ieee->iw_mode == IW_MODE_MONITOR) + if (ieee->iw_mode == IW_MODE_MONITOR) { if(prev == 0 && ieee->raw_tx){ if (ieee->data_hard_resume) diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 1b4623c3f95e..618d2cbc049e 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -46,14 +46,14 @@ static u8 TxTsDeleteBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTs) u8 bSendDELBA = false; // Delete pending BA - if(pPendingBa->bValid) + if (pPendingBa->bValid) { DeActivateBAEntry(ieee, pPendingBa); bSendDELBA = true; } // Delete admitted BA - if(pAdmittedBa->bValid) + if (pAdmittedBa->bValid) { DeActivateBAEntry(ieee, pAdmittedBa); bSendDELBA = true; @@ -74,7 +74,7 @@ static u8 RxTsDeleteBA(struct ieee80211_device *ieee, PRX_TS_RECORD pRxTs) PBA_RECORD pBa = &pRxTs->RxAdmittedBARecord; u8 bSendDELBA = false; - if(pBa->bValid) + if (pBa->bValid) { DeActivateBAEntry(ieee, pBa); bSendDELBA = true; @@ -363,7 +363,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) printk("====================>rx ADDBAREQ from :%pM\n", dst); //some other capability is not ready now. - if( (ieee->current_network.qos_data.active == 0) || + if ((ieee->current_network.qos_data.active == 0) || (ieee->pHTInfo->bCurrentHTSupport == false)) //|| // (ieee->pStaQos->bEnableRxImmBA == false) ) { @@ -373,7 +373,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) } // Search for related traffic stream. // If there is no matched TS, reject the ADDBA request. - if( !GetTs( + if (!GetTs( ieee, (PTS_COMMON_INFO *)(&pTS), dst, @@ -390,7 +390,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) // We can do much more check here, including BufferSize, AMSDU_Support, Policy, StartSeqCtrl... // I want to check StartSeqCtrl to make sure when we start aggregation!!! // - if(pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) + if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) { rc = ADDBA_STATUS_INVALID_PARAM; IEEE80211_DEBUG(IEEE80211_DL_ERR, "BA Policy is not correct in %s()\n", __func__); @@ -522,7 +522,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) // We can compare the value of BA parameter set that Peer returned and Self sent. // If it is OK, then admitted. Or we can send DELBA to cancel BA mechanism. // - if(pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) + if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) { // Since this is a kind of ADDBA failed, we delay next ADDBA process. pTS->bAddBaReqDelayed = true; @@ -582,7 +582,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) return -1; } - if(ieee->current_network.qos_data.active == 0 || + if (ieee->current_network.qos_data.active == 0 || ieee->pHTInfo->bCurrentHTSupport == false ) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "received DELBA while QOS or HT is not supported(%d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); @@ -600,7 +600,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) { PRX_TS_RECORD pRxTs; - if( !GetTs( + if (!GetTs( ieee, (PTS_COMMON_INFO *)&pRxTs, dst, @@ -618,7 +618,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) { PTX_TS_RECORD pTxTs; - if(!GetTs( + if (!GetTs( ieee, (PTS_COMMON_INFO *)&pTxTs, dst, diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index 69b0e3054186..c2588f80625b 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -503,7 +503,7 @@ static u8 HTIOTActIsMgntUseCCK6M(struct ieee80211_network *network) // 2008/01/25 MH Judeg if we need to use OFDM to sned MGNT frame for broadcom AP. // 2008/01/28 MH We must prevent that we select null bssid to link. - if(network->broadcom_cap_exist) + if (network->broadcom_cap_exist) { retValue = 1; } @@ -620,7 +620,7 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u // 2008.06.12 // For RTL819X, if pairwisekey = wep/tkip, ap is ralink, we support only MCS0~7. - if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) { int i; for(i = 1; i< 16; i++) @@ -747,7 +747,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg, *posRT2RTAgg++ = 0x01; *posRT2RTAgg = 0x10;//*posRT2RTAgg = 0x02; - if(ieee->bSupportRemoteWakeUp) { + if (ieee->bSupportRemoteWakeUp) { *posRT2RTAgg |= 0x08;//RT_HT_CAP_USE_WOW; } @@ -874,12 +874,12 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet, u8 *pMCSF for(i = 0; i < 16; i++) { - if(availableMcsRate[i] != 0) + if (availableMcsRate[i] != 0) { bitMap = availableMcsRate[i]; for(j = 0; j < 8; j++) { - if((bitMap%2) != 0) + if ((bitMap%2) != 0) { if(HTMcsToDataRate(ieee, (8*i+j)) > HTMcsToDataRate(ieee, mcsRate)) mcsRate = (8*i+j); @@ -1062,7 +1062,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) // Lanhsin: mark for tmp to avoid deauth by ap from s3 //if(memcmp(pMgntInfo->Bssid, NETGEAR834Bv2_BROADCOM, 3)==0) - if(0) + if (0) { pHTInfo->bCurrentAMPDUEnable = false; @@ -1298,7 +1298,7 @@ void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee, struct ieee80211_ // PHT_CAPABILITY_ELE pPeerHTCap = (PHT_CAPABILITY_ELE)pNetwork->bssht.bdHTCapBuf; PHT_INFORMATION_ELE pPeerHTInfo = (PHT_INFORMATION_ELE)pNetwork->bssht.bdHTInfoBuf; - if(pHTInfo->bCurrentHTSupport) + if (pHTInfo->bCurrentHTSupport) { // // Config current operation mode. @@ -1323,7 +1323,7 @@ EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting); ********************************************************************************************************************/ u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame) { - if(ieee->pHTInfo->bCurrentHTSupport) + if (ieee->pHTInfo->bCurrentHTSupport) { if ((IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) { IEEE80211_DEBUG(IEEE80211_DL_HT, "HT CONTROL FILED EXIST!!\n"); @@ -1352,7 +1352,7 @@ void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidt // return; // spin_lock_irqsave(&(ieee->bw_spinlock), flags); - if(pHTInfo->bSwBwInProgress) { + if (pHTInfo->bSwBwInProgress) { // spin_unlock_irqrestore(&(ieee->bw_spinlock), flags); return; } -- cgit v1.2.3 From f53cb7b16861f0bd474aab07b91c744758d4f1fd Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 25 Mar 2015 08:09:59 +0300 Subject: Staging: rtl8192u: Fix space issues before '(' and after ')' Space is required before the open and after the close parenthesis. This patch adds space after 'if' and before '{'. This was done with the help of the following Coccinelle script: @r@ expression E; position p1,p2,p3; @@ if@p1 (E) @p3{@p2 ... } @script:python@ p1 << r.p1; p2 << r.p2; p3 << r.p3; @@ l1 = int (p1[0].line) l2 = int (p2[0].line) l3 = int (p3[0].line) c1 = int (p1[0].column_end) c2 = int (p2[0].column) c3 = int (p3[0].column) if (l1 != l2): cocci.include_match(False) if (l2 == l3 and c3 + 2 == c2): cocci.include_match(False) @@ position r.p1,r.p2,r.p3; expression r.E; @@ -if@p1 (E) @p3{@p2 +if (E) { ... } Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 100 ++++++++++----------- .../rtl8192u/ieee80211/ieee80211_softmac_wx.c | 18 ++-- 2 files changed, 59 insertions(+), 59 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 168ee32ae45d..543324744b4c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -62,7 +62,7 @@ static void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - if (ieee->modulation & IEEE80211_CCK_MODULATION){ + if (ieee->modulation & IEEE80211_CCK_MODULATION) { *tag++ = MFIE_TYPE_RATES; *tag++ = 4; *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; @@ -79,7 +79,7 @@ static void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - if (ieee->modulation & IEEE80211_OFDM_MODULATION){ + if (ieee->modulation & IEEE80211_OFDM_MODULATION) { *tag++ = MFIE_TYPE_RATES_EX; *tag++ = 8; @@ -192,7 +192,7 @@ static u8 MgntQuery_MgntFrameTxRate(struct ieee80211_device *ieee) else rate = ieee->basic_rate & 0x7f; - if(rate == 0){ + if (rate == 0) { // 2005.01.26, by rcnjko. if(ieee->mode == IEEE_A|| ieee->mode== IEEE_N_5G|| @@ -369,7 +369,7 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee) //unsigned long flags; skb = ieee80211_get_beacon_(ieee); - if (skb){ + if (skb) { softmac_mgmt_xmit(skb, ieee); ieee->softmac_stats.tx_beacons++; //dev_kfree_skb_any(skb);//edit by thomas @@ -378,7 +378,7 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee) // (MSECS( ieee->current_network.beacon_interval -5)); //spin_lock_irqsave(&ieee->beacon_lock,flags); - if(ieee->beacon_txing && ieee->ieee_up){ + if (ieee->beacon_txing && ieee->ieee_up) { // if(!timer_pending(&ieee->beacon_timer)) // add_timer(&ieee->beacon_timer); mod_timer(&ieee->beacon_timer,jiffies+(MSECS(ieee->current_network.beacon_interval-5))); @@ -404,7 +404,7 @@ static void ieee80211_send_probe(struct ieee80211_device *ieee) struct sk_buff *skb; skb = ieee80211_probe_req(ieee); - if (skb){ + if (skb) { softmac_mgmt_xmit(skb, ieee); ieee->softmac_stats.tx_probe_rq++; //dev_kfree_skb_any(skb);//edit by thomas @@ -413,7 +413,7 @@ static void ieee80211_send_probe(struct ieee80211_device *ieee) static void ieee80211_send_probe_requests(struct ieee80211_device *ieee) { - if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){ + if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)) { ieee80211_send_probe(ieee); ieee80211_send_probe(ieee); } @@ -587,7 +587,7 @@ static void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) down(&ieee->scan_sem); // spin_lock_irqsave(&ieee->lock, flags); - if (ieee->scanning == 1){ + if (ieee->scanning == 1) { ieee->scanning = 0; cancel_delayed_work(&ieee->softmac_scan_wq); @@ -617,7 +617,7 @@ static void ieee80211_start_scan(struct ieee80211_device *ieee) } } if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ - if (ieee->scanning == 0){ + if (ieee->scanning == 0) { ieee->scanning = 1; queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); } @@ -803,7 +803,7 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d *(tag++) = 1; *(tag++) = ieee->current_network.channel; - if(atim_len){ + if (atim_len) { *(tag++) = MFIE_TYPE_IBSS_SET; *(tag++) = 2; @@ -812,12 +812,12 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d tag+=2; } - if(erp_len){ + if (erp_len) { *(tag++) = MFIE_TYPE_ERP; *(tag++) = 1; *(tag++) = erpinfo_content; } - if(rate_ex_len){ + if (rate_ex_len) { *(tag++) = MFIE_TYPE_RATES_EX; *(tag++) = rate_ex_len-2; memcpy(tag, ieee->current_network.rates_ex, rate_ex_len-2); @@ -1029,7 +1029,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco } } - if(ieee->qos_support){ + if (ieee->qos_support) { wmm_info_len = beacon->qos_data.supported?9:0; } @@ -1168,7 +1168,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag += osCcxVerNum.Length; } //HT cap element - if (ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ + if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) { if (ieee->pHTInfo->ePeerHTSpecVer != HT_SPEC_VER_EWC) { tag = skb_put(skb, ht_cap_len); @@ -1182,7 +1182,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco //choose what wpa_supplicant gives to associate. tag = skb_put(skb, wpa_ie_len); - if (wpa_ie_len){ + if (wpa_ie_len) { memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); } @@ -1197,7 +1197,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco } #endif - if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ + if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) { if(ieee->pHTInfo->ePeerHTSpecVer == HT_SPEC_VER_EWC) { tag = skb_put(skb, ht_cap_len); @@ -1207,7 +1207,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag += ht_cap_len -2; } - if(ieee->pHTInfo->bCurrentRT2RTAggregation){ + if (ieee->pHTInfo->bCurrentRT2RTAggregation) { tag = skb_put(skb, realtek_ie_len); *tag++ = MFIE_TYPE_GENERIC; *tag++ = realtek_ie_len - 2; @@ -1273,7 +1273,7 @@ static void ieee80211_associate_step1(struct ieee80211_device *ieee) //printk(KERN_WARNING "Sending authentication request\n"); softmac_mgmt_xmit(skb, ieee); //BUGON when you try to add_timer twice, using mod_timer may be better, john0709 - if(!timer_pending(&ieee->associate_timer)){ + if (!timer_pending(&ieee->associate_timer)) { ieee->associate_timer.expires = jiffies + (HZ / 2); add_timer(&ieee->associate_timer); } @@ -1430,7 +1430,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee return; - if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){ + if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC) { /* if the user specified the AP MAC, we need also the essid * This could be obtained by beacons or, if the network does not * broadcast it, it can be put manually. @@ -1458,13 +1458,13 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee /* if the essid is hidden replace it with the * essid provided by the user. */ - if (!ssidbroad){ + if (!ssidbroad) { strncpy(tmp_ssid, ieee->current_network.ssid, IW_ESSID_MAX_SIZE); tmp_ssid_len = ieee->current_network.ssid_len; } memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network)); - if (!ssidbroad){ + if (!ssidbroad) { strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE); ieee->current_network.ssid_len = tmp_ssid_len; } @@ -1541,16 +1541,16 @@ static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen) { struct ieee80211_authentication *a; u8 *t; - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ + if (skb->len < (sizeof(struct ieee80211_authentication) - sizeof(struct ieee80211_info_element))) { IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len); return 0xcafe; } *challenge = NULL; a = (struct ieee80211_authentication *) skb->data; - if(skb->len > (sizeof(struct ieee80211_authentication) +3)){ + if (skb->len > (sizeof(struct ieee80211_authentication) + 3)) { t = skb->data + sizeof(struct ieee80211_authentication); - if(*(t++) == MFIE_TYPE_CHALLENGE){ + if (*(t++) == MFIE_TYPE_CHALLENGE) { *chlen = *(t++); *challenge = kmemdup(t, *chlen, GFP_ATOMIC); if (!*challenge) @@ -1567,7 +1567,7 @@ static int auth_rq_parse(struct sk_buff *skb, u8 *dest) { struct ieee80211_authentication *a; - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ + if (skb->len < (sizeof(struct ieee80211_authentication) - sizeof(struct ieee80211_info_element))) { IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len); return -1; } @@ -1601,7 +1601,7 @@ static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, tag = skb->data + sizeof (struct ieee80211_hdr_3addr ); while (tag+1 < skbend){ - if (*tag == 0){ + if (*tag == 0) { ssid = tag+2; ssidlen = *(tag+1); break; @@ -1642,7 +1642,7 @@ static inline u16 assoc_parse(struct ieee80211_device *ieee, struct sk_buff *skb struct ieee80211_assoc_response_frame *response_head; u16 status_code; - if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){ + if (skb->len < sizeof(struct ieee80211_assoc_response_frame)) { IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); return 0xcafe; } @@ -1672,7 +1672,7 @@ ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb) //IEEE80211DMESG("Rx probe"); ieee->softmac_stats.rx_probe_rq++; //DMESG("Dest is "MACSTR, MAC2STR(dest)); - if (probe_rq_parse(ieee, skb, dest)){ + if (probe_rq_parse(ieee, skb, dest)) { //IEEE80211DMESG("Was for me!"); ieee->softmac_stats.tx_probe_rs++; ieee80211_resp_to_probe(ieee, dest); @@ -1703,7 +1703,7 @@ ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb) //unsigned long flags; ieee->softmac_stats.rx_ass_rq++; - if (assoc_rq_parse(skb,dest) != -1){ + if (assoc_rq_parse(skb, dest) != -1) { ieee80211_resp_to_assoc_rq(ieee, dest); } @@ -1755,13 +1755,13 @@ static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) return 0; - if(time_l){ + if (time_l) { *time_l = ieee->current_network.last_dtim_sta_time[0] + (ieee->current_network.beacon_interval * ieee->current_network.dtim_period) * 1000; } - if(time_h){ + if (time_h) { *time_h = ieee->current_network.last_dtim_sta_time[1]; if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0]) *time_h += 1; @@ -1841,8 +1841,8 @@ out: void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) { - if(ieee->sta_sleep == 0){ - if(nl){ + if (ieee->sta_sleep == 0) { + if (nl) { printk("Warning: driver is probably failing to report TX ps error\n"); ieee->ps_request_tx_ack(ieee->dev); ieee80211_sta_ps_send_null_frame(ieee, 0); @@ -1856,7 +1856,7 @@ void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) ieee->sta_sleep = 0; - if(nl){ + if (nl) { ieee->ps_request_tx_ack(ieee->dev); ieee80211_sta_ps_send_null_frame(ieee, 0); } @@ -1870,7 +1870,7 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) if(ieee->sta_sleep == 2){ /* Null frame with PS bit set */ - if(success){ + if (success) { ieee->sta_sleep = 1; ieee->enter_sleep_state(ieee->dev,ieee->ps_th,ieee->ps_tl); } @@ -1881,7 +1881,7 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) /* 21112005 - tx again null without PS bit if lost */ else { - if((ieee->sta_sleep == 0) && !success){ + if ((ieee->sta_sleep == 0) && !success) { spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); ieee80211_sta_ps_send_null_frame(ieee, 0); spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); @@ -2070,7 +2070,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, case IEEE80211_STYPE_AUTH: - if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){ + if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) { if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && ieee->iw_mode == IW_MODE_INFRA) { @@ -2228,7 +2228,7 @@ void ieee80211_reset_queue(struct ieee80211_device *ieee) spin_lock_irqsave(&ieee->lock, flags); init_mgmt_queue(ieee); - if (ieee->tx_pending.txb){ + if (ieee->tx_pending.txb) { ieee80211_txb_free(ieee->tx_pending.txb); ieee->tx_pending.txb = NULL; } @@ -2250,7 +2250,7 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee) ieee->queue_stop = 0; - if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){ + if (ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE) { while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){ header = (struct ieee80211_hdr_3addr *) skb->data; @@ -2269,7 +2269,7 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee) if (!ieee->queue_stop && ieee->tx_pending.txb) ieee80211_resume_tx(ieee); - if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){ + if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)) { ieee->softmac_stats.swtxawake++; netif_wake_queue(ieee->dev); } @@ -2284,7 +2284,7 @@ void ieee80211_stop_queue(struct ieee80211_device *ieee) //unsigned long flags; //spin_lock_irqsave(&ieee->lock,flags); - if (! netif_queue_stopped(ieee->dev)){ + if (!netif_queue_stopped(ieee->dev)) { netif_stop_queue(ieee->dev); ieee->softmac_stats.swtxstop++; } @@ -2305,7 +2305,7 @@ void ieee80211_start_master_bss(struct ieee80211_device *ieee) { ieee->assoc_id = 1; - if (ieee->current_network.ssid_len == 0){ + if (ieee->current_network.ssid_len == 0) { strncpy(ieee->current_network.ssid, IEEE80211_DEFAULT_TX_ESSID, IW_ESSID_MAX_SIZE); @@ -2329,7 +2329,7 @@ void ieee80211_start_master_bss(struct ieee80211_device *ieee) static void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) { - if(ieee->raw_tx){ + if (ieee->raw_tx) { if (ieee->data_hard_resume) ieee->data_hard_resume(ieee->dev); @@ -2349,13 +2349,13 @@ static void ieee80211_start_ibss_wq(struct work_struct *work) * (abort) this wq (when syncro scanning) before sleeping * on the semaphore */ - if(!ieee->proto_started){ + if (!ieee->proto_started) { printk("==========oh driver down return\n"); return; } down(&ieee->wx_sem); - if (ieee->current_network.ssid_len == 0){ + if (ieee->current_network.ssid_len == 0) { strcpy(ieee->current_network.ssid, IEEE80211_DEFAULT_TX_ESSID); ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); ieee->ssid_set = 1; @@ -2386,7 +2386,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work) ieee80211_start_scan_syncro(ieee); /* the network definitively is not here.. create a new cell */ - if (ieee->state == IEEE80211_NOLINK){ + if (ieee->state == IEEE80211_NOLINK) { printk("creating new IBSS cell\n"); if(!ieee->wap_set) ieee80211_randomize_cell(ieee); @@ -2483,7 +2483,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee) */ spin_lock_irqsave(&ieee->lock, flags); - if (ieee->state == IEEE80211_NOLINK){ + if (ieee->state == IEEE80211_NOLINK) { ieee->actscanning = true; ieee80211_start_scan(ieee); } @@ -2637,7 +2637,7 @@ void ieee80211_start_protocol(struct ieee80211_device *ieee) ieee->proto_started = 1; - if (ieee->current_network.channel == 0){ + if (ieee->current_network.channel == 0) { do{ ch++; if (ch > MAX_CHANNEL_NUMBER) @@ -3141,7 +3141,7 @@ SendDisassociation( struct ieee80211_network *beacon = &ieee->current_network; struct sk_buff *skb; skb = ieee80211_disassociate_skb(beacon,ieee,asRsn); - if (skb){ + if (skb) { softmac_mgmt_xmit(skb, ieee); //dev_kfree_skb_any(skb);//edit by thomas } @@ -3156,7 +3156,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin down(&ieee->wx_sem); //IEEE_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); - if (p->length < sizeof(struct ieee_param) || !p->pointer){ + if (p->length < sizeof(struct ieee_param) || !p->pointer) { ret = -EINVAL; goto out; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index 77d0a34750c3..714fbcace72b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -36,7 +36,7 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info down(&ieee->wx_sem); - if(ieee->iw_mode == IW_MODE_INFRA){ + if (ieee->iw_mode == IW_MODE_INFRA) { ret = -EOPNOTSUPP; goto out; } @@ -148,12 +148,12 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee, down(&ieee->wx_sem); /* use ifconfig hw ether */ - if (ieee->iw_mode == IW_MODE_MASTER){ + if (ieee->iw_mode == IW_MODE_MASTER) { ret = -1; goto out; } - if (temp->sa_family != ARPHRD_ETHER){ + if (temp->sa_family != ARPHRD_ETHER) { ret = -EINVAL; goto out; } @@ -369,7 +369,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info down(&ieee->wx_sem); - if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ + if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)) { ret = -1; goto out; } @@ -400,12 +400,12 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, proto_started = ieee->proto_started; - if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ + if (wrqu->essid.length > IW_ESSID_MAX_SIZE) { ret= -E2BIG; goto out; } - if (ieee->iw_mode == IW_MODE_MONITOR){ + if (ieee->iw_mode == IW_MODE_MONITOR) { ret= -1; goto out; } @@ -471,7 +471,7 @@ EXPORT_SYMBOL(ieee80211_wx_get_mode); if (ieee->iw_mode == IW_MODE_MONITOR) { - if(prev == 0 && ieee->raw_tx){ + if (prev == 0 && ieee->raw_tx) { if (ieee->data_hard_resume) ieee->data_hard_resume(ieee->dev); @@ -522,7 +522,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, int ret = 0; down(&ieee->wx_sem); - if (wrqu->power.disabled){ + if (wrqu->power.disabled) { ieee->ps = IEEE80211_PS_DISABLED; goto exit; } @@ -572,7 +572,7 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee, { down(&ieee->wx_sem); - if(ieee->ps == IEEE80211_PS_DISABLED){ + if (ieee->ps == IEEE80211_PS_DISABLED) { wrqu->power.disabled = 1; goto exit; } -- cgit v1.2.3 From 9963bce76657d9fd5caa3fc77c72d57ec00c8cff Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 25 Mar 2015 10:51:55 +0300 Subject: Staging: iio: Adjust alignment for function parameters This patch adjust parameters alignment in functions to match open parenthesis. Issue addressed by checkpatch.pl. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/adis16201_core.c | 8 +++---- drivers/staging/iio/accel/adis16203_core.c | 4 ++-- drivers/staging/iio/accel/adis16204_core.c | 8 ++++--- drivers/staging/iio/accel/adis16209_core.c | 8 +++---- drivers/staging/iio/accel/adis16220_core.c | 38 +++++++++++++++--------------- drivers/staging/iio/accel/adis16240_core.c | 21 ++++++++++------- drivers/staging/iio/accel/lis3l02dq_core.c | 4 ++-- drivers/staging/iio/accel/lis3l02dq_ring.c | 2 +- 8 files changed, 49 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c index 7eae5fd0f393..10db685813c9 100644 --- a/drivers/staging/iio/accel/adis16201_core.c +++ b/drivers/staging/iio/accel/adis16201_core.c @@ -135,14 +135,14 @@ static const struct iio_chan_spec adis16201_channels[] = { ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT, ADIS16201_SCAN_SUPPLY, 0, 12), ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT, ADIS16201_SCAN_TEMP, 0, 12), ADIS_ACCEL_CHAN(X, ADIS16201_XACCL_OUT, ADIS16201_SCAN_ACC_X, - BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), + BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), ADIS_ACCEL_CHAN(Y, ADIS16201_YACCL_OUT, ADIS16201_SCAN_ACC_Y, - BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), + BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), ADIS_AUX_ADC_CHAN(ADIS16201_AUX_ADC, ADIS16201_SCAN_AUX_ADC, 0, 12), ADIS_INCLI_CHAN(X, ADIS16201_XINCL_OUT, ADIS16201_SCAN_INCLI_X, - BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), + BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), ADIS_INCLI_CHAN(X, ADIS16201_YINCL_OUT, ADIS16201_SCAN_INCLI_Y, - BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), + BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), IIO_CHAN_SOFT_TIMESTAMP(7) }; diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c index fbbe93f26bbe..fb593d23d5bc 100644 --- a/drivers/staging/iio/accel/adis16203_core.c +++ b/drivers/staging/iio/accel/adis16203_core.c @@ -104,10 +104,10 @@ static const struct iio_chan_spec adis16203_channels[] = { ADIS_SUPPLY_CHAN(ADIS16203_SUPPLY_OUT, ADIS16203_SCAN_SUPPLY, 0, 12), ADIS_AUX_ADC_CHAN(ADIS16203_AUX_ADC, ADIS16203_SCAN_AUX_ADC, 0, 12), ADIS_INCLI_CHAN(X, ADIS16203_XINCL_OUT, ADIS16203_SCAN_INCLI_X, - BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), + BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), /* Fixme: Not what it appears to be - see data sheet */ ADIS_INCLI_CHAN(Y, ADIS16203_YINCL_OUT, ADIS16203_SCAN_INCLI_Y, - 0, 0, 14), + 0, 0, 14), ADIS_TEMP_CHAN(ADIS16203_TEMP_OUT, ADIS16203_SCAN_TEMP, 0, 12), IIO_CHAN_SOFT_TIMESTAMP(5), }; diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c index 4c8acbc2e44e..ea0ac2467ac2 100644 --- a/drivers/staging/iio/accel/adis16204_core.c +++ b/drivers/staging/iio/accel/adis16204_core.c @@ -141,11 +141,13 @@ static const struct iio_chan_spec adis16204_channels[] = { ADIS_AUX_ADC_CHAN(ADIS16204_AUX_ADC, ADIS16204_SCAN_AUX_ADC, 0, 12), ADIS_TEMP_CHAN(ADIS16204_TEMP_OUT, ADIS16204_SCAN_TEMP, 0, 12), ADIS_ACCEL_CHAN(X, ADIS16204_XACCL_OUT, ADIS16204_SCAN_ACC_X, - BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), 0, 14), + BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), + 0, 14), ADIS_ACCEL_CHAN(Y, ADIS16204_YACCL_OUT, ADIS16204_SCAN_ACC_Y, - BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), 0, 14), + BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), + 0, 14), ADIS_ACCEL_CHAN(ROOT_SUM_SQUARED_X_Y, ADIS16204_XY_RSS_OUT, - ADIS16204_SCAN_ACC_XY, BIT(IIO_CHAN_INFO_PEAK), 0, 14), + ADIS16204_SCAN_ACC_XY, BIT(IIO_CHAN_INFO_PEAK), 0, 14), IIO_CHAN_SOFT_TIMESTAMP(5), }; diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c index b2c7aeda75f0..2a1589903694 100644 --- a/drivers/staging/iio/accel/adis16209_core.c +++ b/drivers/staging/iio/accel/adis16209_core.c @@ -134,14 +134,14 @@ static const struct iio_chan_spec adis16209_channels[] = { ADIS_SUPPLY_CHAN(ADIS16209_SUPPLY_OUT, ADIS16209_SCAN_SUPPLY, 0, 14), ADIS_TEMP_CHAN(ADIS16209_TEMP_OUT, ADIS16209_SCAN_TEMP, 0, 12), ADIS_ACCEL_CHAN(X, ADIS16209_XACCL_OUT, ADIS16209_SCAN_ACC_X, - BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), + BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), ADIS_ACCEL_CHAN(Y, ADIS16209_YACCL_OUT, ADIS16209_SCAN_ACC_Y, - BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), + BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), ADIS_AUX_ADC_CHAN(ADIS16209_AUX_ADC, ADIS16209_SCAN_AUX_ADC, 0, 12), ADIS_INCLI_CHAN(X, ADIS16209_XINCL_OUT, ADIS16209_SCAN_INCLI_X, - 0, 0, 14), + 0, 0, 14), ADIS_INCLI_CHAN(Y, ADIS16209_YINCL_OUT, ADIS16209_SCAN_INCLI_Y, - 0, 0, 14), + 0, 0, 14), ADIS_ROT_CHAN(X, ADIS16209_ROT_OUT, ADIS16209_SCAN_ROT, 0, 0, 14), IIO_CHAN_SOFT_TIMESTAMP(8) }; diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index 0396f24f4558..7557e3cb11b6 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c @@ -21,8 +21,8 @@ #include "adis16220.h" static ssize_t adis16220_read_16bit(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -40,9 +40,9 @@ static ssize_t adis16220_read_16bit(struct device *dev, } static ssize_t adis16220_write_16bit(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); @@ -75,8 +75,8 @@ static int adis16220_capture(struct iio_dev *indio_dev) } static ssize_t adis16220_write_capture(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); bool val; @@ -95,10 +95,10 @@ static ssize_t adis16220_write_capture(struct device *dev, } static ssize_t adis16220_capture_buffer_read(struct iio_dev *indio_dev, - char *buf, - loff_t off, - size_t count, - int addr) + char *buf, + loff_t off, + size_t count, + int addr) { struct adis16220_state *st = iio_priv(indio_dev); struct spi_transfer xfers[] = { @@ -130,8 +130,8 @@ static ssize_t adis16220_capture_buffer_read(struct iio_dev *indio_dev, /* write the begin position of capture buffer */ ret = adis_write_reg_16(&st->adis, - ADIS16220_CAPT_PNTR, - off > 1); + ADIS16220_CAPT_PNTR, + off > 1); if (ret) return -EIO; @@ -181,9 +181,9 @@ static struct bin_attribute accel_bin = { }; static ssize_t adis16220_adc1_bin_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, - size_t count) + struct bin_attribute *attr, + char *buf, loff_t off, + size_t count) { struct iio_dev *indio_dev = dev_to_iio_dev(kobj_to_dev(kobj)); @@ -202,9 +202,9 @@ static struct bin_attribute adc1_bin = { }; static ssize_t adis16220_adc2_bin_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, - size_t count) + struct bin_attribute *attr, + char *buf, loff_t off, + size_t count) { struct iio_dev *indio_dev = dev_to_iio_dev(kobj_to_dev(kobj)); diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c index e2f8affc4c15..cb074e864408 100644 --- a/drivers/staging/iio/accel/adis16240_core.c +++ b/drivers/staging/iio/accel/adis16240_core.c @@ -27,9 +27,9 @@ #include "adis16240.h" static ssize_t adis16240_spi_read_signed(struct device *dev, - struct device_attribute *attr, - char *buf, - unsigned bits) + struct device_attribute *attr, + char *buf, + unsigned bits) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct adis *st = iio_priv(indio_dev); @@ -39,7 +39,7 @@ static ssize_t adis16240_spi_read_signed(struct device *dev, struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); ret = adis_read_reg_16(st, - this_attr->address, (u16 *)&val); + this_attr->address, (u16 *)&val); if (ret) return ret; @@ -51,8 +51,8 @@ static ssize_t adis16240_spi_read_signed(struct device *dev, } static ssize_t adis16240_read_12bit_signed(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { ssize_t ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -176,11 +176,14 @@ static const struct iio_chan_spec adis16240_channels[] = { ADIS_SUPPLY_CHAN(ADIS16240_SUPPLY_OUT, ADIS16240_SCAN_SUPPLY, 0, 10), ADIS_AUX_ADC_CHAN(ADIS16240_AUX_ADC, ADIS16240_SCAN_AUX_ADC, 0, 10), ADIS_ACCEL_CHAN(X, ADIS16240_XACCL_OUT, ADIS16240_SCAN_ACC_X, - BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), 0, 10), + BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), + 0, 10), ADIS_ACCEL_CHAN(Y, ADIS16240_YACCL_OUT, ADIS16240_SCAN_ACC_Y, - BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), 0, 10), + BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), + 0, 10), ADIS_ACCEL_CHAN(Z, ADIS16240_ZACCL_OUT, ADIS16240_SCAN_ACC_Z, - BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), 0, 10), + BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK), + 0, 10), ADIS_TEMP_CHAN(ADIS16240_TEMP_OUT, ADIS16240_SCAN_TEMP, 0, 10), IIO_CHAN_SOFT_TIMESTAMP(6) }; diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c index b78c9c5d5588..66bbb8949516 100644 --- a/drivers/staging/iio/accel/lis3l02dq_core.c +++ b/drivers/staging/iio/accel/lis3l02dq_core.c @@ -656,8 +656,8 @@ static int lis3l02dq_write_event_config(struct iio_dev *indio_dev, (control | LIS3L02DQ_REG_CTRL_2_ENABLE_INTERRUPT) : (control & ~LIS3L02DQ_REG_CTRL_2_ENABLE_INTERRUPT); ret = lis3l02dq_spi_write_reg_8(indio_dev, - LIS3L02DQ_REG_CTRL_2_ADDR, - control); + LIS3L02DQ_REG_CTRL_2_ADDR, + control); if (ret) goto error_ret; } diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index e6101bbc7fbd..740cd830d3e4 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -110,7 +110,7 @@ static int lis3l02dq_read_all(struct iio_dev *indio_dev, u8 *rx_array) } static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev, - u8 *buf) + u8 *buf) { int ret, i; u8 *rx_array; -- cgit v1.2.3 From 31245077231b9204595f8a480b77590b81c9b571 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 25 Mar 2015 10:52:51 +0300 Subject: Staging: iio: remove multible blank lines This patch removes extra blank lines to address checkpatch.pl warnings regarding that. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/adis16209_core.c | 1 - drivers/staging/iio/accel/adis16220_core.c | 3 --- drivers/staging/iio/accel/lis3l02dq_core.c | 2 -- 3 files changed, 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c index 2a1589903694..d1dc1a3cb3ce 100644 --- a/drivers/staging/iio/accel/adis16209_core.c +++ b/drivers/staging/iio/accel/adis16209_core.c @@ -178,7 +178,6 @@ static const struct adis_data adis16209_data = { BIT(ADIS16209_DIAG_STAT_POWER_LOW_BIT), }; - static int adis16209_probe(struct spi_device *spi) { int ret; diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index 7557e3cb11b6..e46a91c69a31 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c @@ -138,7 +138,6 @@ static ssize_t adis16220_capture_buffer_read(struct iio_dev *indio_dev, /* read count/2 values from capture buffer */ mutex_lock(&st->buf_lock); - for (i = 0; i < count; i += 2) { st->tx[i] = ADIS_READ_REG(addr); st->tx[i + 1] = 0; @@ -147,7 +146,6 @@ static ssize_t adis16220_capture_buffer_read(struct iio_dev *indio_dev, ret = spi_sync_transfer(st->adis.spi, xfers, ARRAY_SIZE(xfers)); if (ret) { - mutex_unlock(&st->buf_lock); return -EIO; } @@ -213,7 +211,6 @@ static ssize_t adis16220_adc2_bin_read(struct file *filp, struct kobject *kobj, ADIS16220_CAPT_BUF2); } - static struct bin_attribute adc2_bin = { .attr = { .name = "in1_bin", diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c index 66bbb8949516..ebcab56c81b9 100644 --- a/drivers/staging/iio/accel/lis3l02dq_core.c +++ b/drivers/staging/iio/accel/lis3l02dq_core.c @@ -558,13 +558,11 @@ static const struct iio_chan_spec lis3l02dq_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(3) }; - static int lis3l02dq_read_event_config(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, enum iio_event_type type, enum iio_event_direction dir) { - u8 val; int ret; u8 mask = (1 << (chan->channel2*2 + (dir == IIO_EV_DIR_RISING))); -- cgit v1.2.3 From 281ab7efa25b01802e40dd4b7ef5548960881ad7 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 25 Mar 2015 10:54:32 +0300 Subject: Staging: iio: add blank line after function declaration This patch adds blank line after function declaration. Issue addressed by checkpatch.pl. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/lis3l02dq.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/lis3l02dq.h b/drivers/staging/iio/accel/lis3l02dq.h index 0a8ea8270866..3f24c629be6f 100644 --- a/drivers/staging/iio/accel/lis3l02dq.h +++ b/drivers/staging/iio/accel/lis3l02dq.h @@ -194,6 +194,7 @@ irqreturn_t lis3l02dq_data_rdy_trig_poll(int irq, void *private); static inline void lis3l02dq_remove_trigger(struct iio_dev *indio_dev) { } + static inline int lis3l02dq_probe_trigger(struct iio_dev *indio_dev) { return 0; @@ -203,6 +204,7 @@ static int lis3l02dq_configure_buffer(struct iio_dev *indio_dev) { return 0; } + static inline void lis3l02dq_unconfigure_buffer(struct iio_dev *indio_dev) { } -- cgit v1.2.3 From e273eb01feb15593d9cb3607a59d96ab12e4c0c2 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Wed, 25 Mar 2015 10:55:06 +0300 Subject: Staging: iio: Add braces on all arms of if statement The following patch adds braces on all arms of if statement. Issue addressed by checkpatch.pl. Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/lis3l02dq_ring.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index 740cd830d3e4..20435b5ce5ef 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -330,19 +330,21 @@ static int lis3l02dq_buffer_postenable(struct iio_dev *indio_dev) if (test_bit(0, indio_dev->active_scan_mask)) { t |= LIS3L02DQ_REG_CTRL_1_AXES_X_ENABLE; oneenabled = true; - } else + } else { t &= ~LIS3L02DQ_REG_CTRL_1_AXES_X_ENABLE; + } if (test_bit(1, indio_dev->active_scan_mask)) { t |= LIS3L02DQ_REG_CTRL_1_AXES_Y_ENABLE; oneenabled = true; - } else + } else { t &= ~LIS3L02DQ_REG_CTRL_1_AXES_Y_ENABLE; + } if (test_bit(2, indio_dev->active_scan_mask)) { t |= LIS3L02DQ_REG_CTRL_1_AXES_Z_ENABLE; oneenabled = true; - } else + } else { t &= ~LIS3L02DQ_REG_CTRL_1_AXES_Z_ENABLE; - + } if (!oneenabled) /* what happens in this case is unknown */ return -EINVAL; ret = lis3l02dq_spi_write_reg_8(indio_dev, -- cgit v1.2.3 From 418880f5708dec9fdb2eaa7a61175fa1d8ab4110 Mon Sep 17 00:00:00 2001 From: Haneen Mohammed Date: Thu, 26 Mar 2015 02:23:29 +0300 Subject: Staging: iio: use the BIT macro in adc This patch replaces bit shifting on: 0,1,2, and 3 with the BIT(x) macro. Issue addressed by checkpatcg.pl. This was done with the help of Coccinelle: @r1@ identifier x; constant int g; @@ ( 0<<\(x\|g\) | 1<<\(x\|g\) | 2<<\(x\|g\) | 3<<\(x\|g\) ) @script:python b@ g2 < Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/adc/ad7192.c | 62 ++++++++++++++++++------------------- drivers/staging/iio/adc/ad7280a.c | 56 ++++++++++++++++----------------- drivers/staging/iio/adc/ad7780.c | 16 +++++----- drivers/staging/iio/adc/mxs-lradc.c | 46 +++++++++++++-------------- drivers/staging/iio/adc/spear_adc.c | 6 ++-- 5 files changed, 93 insertions(+), 93 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index 6f8ce6c6574b..fe56fb6c7d30 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c @@ -41,32 +41,32 @@ * (RW, 16-bit (AD7792)/24-bit (AD7192)) */ /* Communications Register Bit Designations (AD7192_REG_COMM) */ -#define AD7192_COMM_WEN (1 << 7) /* Write Enable */ -#define AD7192_COMM_WRITE (0 << 6) /* Write Operation */ -#define AD7192_COMM_READ (1 << 6) /* Read Operation */ +#define AD7192_COMM_WEN BIT(7) /* Write Enable */ +#define AD7192_COMM_WRITE 0 /* Write Operation */ +#define AD7192_COMM_READ BIT(6) /* Read Operation */ #define AD7192_COMM_ADDR(x) (((x) & 0x7) << 3) /* Register Address */ -#define AD7192_COMM_CREAD (1 << 2) /* Continuous Read of Data Register */ +#define AD7192_COMM_CREAD BIT(2) /* Continuous Read of Data Register */ /* Status Register Bit Designations (AD7192_REG_STAT) */ -#define AD7192_STAT_RDY (1 << 7) /* Ready */ -#define AD7192_STAT_ERR (1 << 6) /* Error (Overrange, Underrange) */ -#define AD7192_STAT_NOREF (1 << 5) /* Error no external reference */ -#define AD7192_STAT_PARITY (1 << 4) /* Parity */ -#define AD7192_STAT_CH3 (1 << 2) /* Channel 3 */ -#define AD7192_STAT_CH2 (1 << 1) /* Channel 2 */ -#define AD7192_STAT_CH1 (1 << 0) /* Channel 1 */ +#define AD7192_STAT_RDY BIT(7) /* Ready */ +#define AD7192_STAT_ERR BIT(6) /* Error (Overrange, Underrange) */ +#define AD7192_STAT_NOREF BIT(5) /* Error no external reference */ +#define AD7192_STAT_PARITY BIT(4) /* Parity */ +#define AD7192_STAT_CH3 BIT(2) /* Channel 3 */ +#define AD7192_STAT_CH2 BIT(1) /* Channel 2 */ +#define AD7192_STAT_CH1 BIT(0) /* Channel 1 */ /* Mode Register Bit Designations (AD7192_REG_MODE) */ #define AD7192_MODE_SEL(x) (((x) & 0x7) << 21) /* Operation Mode Select */ #define AD7192_MODE_SEL_MASK (0x7 << 21) /* Operation Mode Select Mask */ -#define AD7192_MODE_DAT_STA (1 << 20) /* Status Register transmission */ +#define AD7192_MODE_DAT_STA BIT(20) /* Status Register transmission */ #define AD7192_MODE_CLKSRC(x) (((x) & 0x3) << 18) /* Clock Source Select */ -#define AD7192_MODE_SINC3 (1 << 15) /* SINC3 Filter Select */ -#define AD7192_MODE_ACX (1 << 14) /* AC excitation enable(AD7195 only)*/ -#define AD7192_MODE_ENPAR (1 << 13) /* Parity Enable */ -#define AD7192_MODE_CLKDIV (1 << 12) /* Clock divide by 2 (AD7190/2 only)*/ -#define AD7192_MODE_SCYCLE (1 << 11) /* Single cycle conversion */ -#define AD7192_MODE_REJ60 (1 << 10) /* 50/60Hz notch filter */ +#define AD7192_MODE_SINC3 BIT(15) /* SINC3 Filter Select */ +#define AD7192_MODE_ACX BIT(14) /* AC excitation enable(AD7195 only)*/ +#define AD7192_MODE_ENPAR BIT(13) /* Parity Enable */ +#define AD7192_MODE_CLKDIV BIT(12) /* Clock divide by 2 (AD7190/2 only)*/ +#define AD7192_MODE_SCYCLE BIT(11) /* Single cycle conversion */ +#define AD7192_MODE_REJ60 BIT(10) /* 50/60Hz notch filter */ #define AD7192_MODE_RATE(x) ((x) & 0x3FF) /* Filter Update Rate Select */ /* Mode Register: AD7192_MODE_SEL options */ @@ -91,14 +91,14 @@ /* Configuration Register Bit Designations (AD7192_REG_CONF) */ -#define AD7192_CONF_CHOP (1 << 23) /* CHOP enable */ -#define AD7192_CONF_REFSEL (1 << 20) /* REFIN1/REFIN2 Reference Select */ +#define AD7192_CONF_CHOP BIT(23) /* CHOP enable */ +#define AD7192_CONF_REFSEL BIT(20) /* REFIN1/REFIN2 Reference Select */ #define AD7192_CONF_CHAN(x) (((1 << (x)) & 0xFF) << 8) /* Channel select */ #define AD7192_CONF_CHAN_MASK (0xFF << 8) /* Channel select mask */ -#define AD7192_CONF_BURN (1 << 7) /* Burnout current enable */ -#define AD7192_CONF_REFDET (1 << 6) /* Reference detect enable */ -#define AD7192_CONF_BUF (1 << 4) /* Buffered Mode Enable */ -#define AD7192_CONF_UNIPOLAR (1 << 3) /* Unipolar/Bipolar Enable */ +#define AD7192_CONF_BURN BIT(7) /* Burnout current enable */ +#define AD7192_CONF_REFDET BIT(6) /* Reference detect enable */ +#define AD7192_CONF_BUF BIT(4) /* Buffered Mode Enable */ +#define AD7192_CONF_UNIPOLAR BIT(3) /* Unipolar/Bipolar Enable */ #define AD7192_CONF_GAIN(x) ((x) & 0x7) /* Gain Select */ #define AD7192_CH_AIN1P_AIN2M 0 /* AIN1(+) - AIN2(-) */ @@ -117,13 +117,13 @@ #define AD7192_ID_MASK 0x0F /* GPOCON Register Bit Designations (AD7192_REG_GPOCON) */ -#define AD7192_GPOCON_BPDSW (1 << 6) /* Bridge power-down switch enable */ -#define AD7192_GPOCON_GP32EN (1 << 5) /* Digital Output P3 and P2 enable */ -#define AD7192_GPOCON_GP10EN (1 << 4) /* Digital Output P1 and P0 enable */ -#define AD7192_GPOCON_P3DAT (1 << 3) /* P3 state */ -#define AD7192_GPOCON_P2DAT (1 << 2) /* P2 state */ -#define AD7192_GPOCON_P1DAT (1 << 1) /* P1 state */ -#define AD7192_GPOCON_P0DAT (1 << 0) /* P0 state */ +#define AD7192_GPOCON_BPDSW BIT(6) /* Bridge power-down switch enable */ +#define AD7192_GPOCON_GP32EN BIT(5) /* Digital Output P3 and P2 enable */ +#define AD7192_GPOCON_GP10EN BIT(4) /* Digital Output P1 and P0 enable */ +#define AD7192_GPOCON_P3DAT BIT(3) /* P3 state */ +#define AD7192_GPOCON_P2DAT BIT(2) /* P2 state */ +#define AD7192_GPOCON_P1DAT BIT(1) /* P1 state */ +#define AD7192_GPOCON_P0DAT BIT(0) /* P0 state */ #define AD7192_INT_FREQ_MHz 4915200 diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index e7d45ee2fac6..d98e229c46bf 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -55,37 +55,37 @@ #define AD7280A_CNVST_CONTROL 0x1D /* D7 to D0, Read/write */ /* Bits and Masks */ -#define AD7280A_CTRL_HB_CONV_INPUT_ALL (0 << 6) -#define AD7280A_CTRL_HB_CONV_INPUT_6CELL_AUX1_3_4 (1 << 6) -#define AD7280A_CTRL_HB_CONV_INPUT_6CELL (2 << 6) -#define AD7280A_CTRL_HB_CONV_INPUT_SELF_TEST (3 << 6) -#define AD7280A_CTRL_HB_CONV_RES_READ_ALL (0 << 4) -#define AD7280A_CTRL_HB_CONV_RES_READ_6CELL_AUX1_3_4 (1 << 4) -#define AD7280A_CTRL_HB_CONV_RES_READ_6CELL (2 << 4) -#define AD7280A_CTRL_HB_CONV_RES_READ_NO (3 << 4) -#define AD7280A_CTRL_HB_CONV_START_CNVST (0 << 3) -#define AD7280A_CTRL_HB_CONV_START_CS (1 << 3) -#define AD7280A_CTRL_HB_CONV_AVG_DIS (0 << 1) -#define AD7280A_CTRL_HB_CONV_AVG_2 (1 << 1) -#define AD7280A_CTRL_HB_CONV_AVG_4 (2 << 1) -#define AD7280A_CTRL_HB_CONV_AVG_8 (3 << 1) +#define AD7280A_CTRL_HB_CONV_INPUT_ALL 0 +#define AD7280A_CTRL_HB_CONV_INPUT_6CELL_AUX1_3_4 BIT(6) +#define AD7280A_CTRL_HB_CONV_INPUT_6CELL BIT(7) +#define AD7280A_CTRL_HB_CONV_INPUT_SELF_TEST (BIT(7) | BIT(6)) +#define AD7280A_CTRL_HB_CONV_RES_READ_ALL 0 +#define AD7280A_CTRL_HB_CONV_RES_READ_6CELL_AUX1_3_4 BIT(4) +#define AD7280A_CTRL_HB_CONV_RES_READ_6CELL BIT(5) +#define AD7280A_CTRL_HB_CONV_RES_READ_NO (BIT(5) | BIT(4)) +#define AD7280A_CTRL_HB_CONV_START_CNVST 0 +#define AD7280A_CTRL_HB_CONV_START_CS BIT(3) +#define AD7280A_CTRL_HB_CONV_AVG_DIS 0 +#define AD7280A_CTRL_HB_CONV_AVG_2 BIT(1) +#define AD7280A_CTRL_HB_CONV_AVG_4 BIT(2) +#define AD7280A_CTRL_HB_CONV_AVG_8 (BIT(2) | BIT(1)) #define AD7280A_CTRL_HB_CONV_AVG(x) ((x) << 1) -#define AD7280A_CTRL_HB_PWRDN_SW (1 << 0) +#define AD7280A_CTRL_HB_PWRDN_SW BIT(0) -#define AD7280A_CTRL_LB_SWRST (1 << 7) -#define AD7280A_CTRL_LB_ACQ_TIME_400ns (0 << 5) -#define AD7280A_CTRL_LB_ACQ_TIME_800ns (1 << 5) -#define AD7280A_CTRL_LB_ACQ_TIME_1200ns (2 << 5) -#define AD7280A_CTRL_LB_ACQ_TIME_1600ns (3 << 5) +#define AD7280A_CTRL_LB_SWRST BIT(7) +#define AD7280A_CTRL_LB_ACQ_TIME_400ns 0 +#define AD7280A_CTRL_LB_ACQ_TIME_800ns BIT(5) +#define AD7280A_CTRL_LB_ACQ_TIME_1200ns BIT(6) +#define AD7280A_CTRL_LB_ACQ_TIME_1600ns (BIT(6) | BIT(5)) #define AD7280A_CTRL_LB_ACQ_TIME(x) ((x) << 5) -#define AD7280A_CTRL_LB_MUST_SET (1 << 4) -#define AD7280A_CTRL_LB_THERMISTOR_EN (1 << 3) -#define AD7280A_CTRL_LB_LOCK_DEV_ADDR (1 << 2) -#define AD7280A_CTRL_LB_INC_DEV_ADDR (1 << 1) -#define AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN (1 << 0) - -#define AD7280A_ALERT_GEN_STATIC_HIGH (1 << 6) -#define AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN (3 << 6) +#define AD7280A_CTRL_LB_MUST_SET BIT(4) +#define AD7280A_CTRL_LB_THERMISTOR_EN BIT(3) +#define AD7280A_CTRL_LB_LOCK_DEV_ADDR BIT(2) +#define AD7280A_CTRL_LB_INC_DEV_ADDR BIT(1) +#define AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN BIT(0) + +#define AD7280A_ALERT_GEN_STATIC_HIGH BIT(6) +#define AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN (BIT(7) | BIT(6)) #define AD7280A_ALL_CELLS (0xAD << 16) diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c index 273add3ed63f..66a157be2eaf 100644 --- a/drivers/staging/iio/adc/ad7780.c +++ b/drivers/staging/iio/adc/ad7780.c @@ -24,14 +24,14 @@ #include "ad7780.h" -#define AD7780_RDY (1 << 7) -#define AD7780_FILTER (1 << 6) -#define AD7780_ERR (1 << 5) -#define AD7780_ID1 (1 << 4) -#define AD7780_ID0 (1 << 3) -#define AD7780_GAIN (1 << 2) -#define AD7780_PAT1 (1 << 1) -#define AD7780_PAT0 (1 << 0) +#define AD7780_RDY BIT(7) +#define AD7780_FILTER BIT(6) +#define AD7780_ERR BIT(5) +#define AD7780_ID1 BIT(4) +#define AD7780_ID0 BIT(3) +#define AD7780_GAIN BIT(2) +#define AD7780_PAT1 BIT(1) +#define AD7780_PAT0 BIT(0) struct ad7780_chip_info { struct iio_chan_spec channel; diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 17f4ee7f8b76..d7c5223f1c3e 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -243,7 +243,7 @@ struct mxs_lradc { * be sampled as regular LRADC channels. The driver will refuse any * attempt to sample these channels. */ -#define CHAN_MASK_TOUCHBUTTON (0x3 << 0) +#define CHAN_MASK_TOUCHBUTTON (BIT(1) | BIT(0)) #define CHAN_MASK_TOUCHSCREEN_4WIRE (0xf << 2) #define CHAN_MASK_TOUCHSCREEN_5WIRE (0x1f << 2) enum mxs_lradc_ts use_touchscreen; @@ -268,20 +268,20 @@ struct mxs_lradc { }; #define LRADC_CTRL0 0x00 -# define LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE (1 << 23) -# define LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE (1 << 22) -# define LRADC_CTRL0_MX28_YNNSW /* YM */ (1 << 21) -# define LRADC_CTRL0_MX28_YPNSW /* YP */ (1 << 20) -# define LRADC_CTRL0_MX28_YPPSW /* YP */ (1 << 19) -# define LRADC_CTRL0_MX28_XNNSW /* XM */ (1 << 18) -# define LRADC_CTRL0_MX28_XNPSW /* XM */ (1 << 17) -# define LRADC_CTRL0_MX28_XPPSW /* XP */ (1 << 16) - -# define LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE (1 << 20) -# define LRADC_CTRL0_MX23_YM (1 << 19) -# define LRADC_CTRL0_MX23_XM (1 << 18) -# define LRADC_CTRL0_MX23_YP (1 << 17) -# define LRADC_CTRL0_MX23_XP (1 << 16) +# define LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE BIT(23) +# define LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE BIT(22) +# define LRADC_CTRL0_MX28_YNNSW /* YM */ BIT(21) +# define LRADC_CTRL0_MX28_YPNSW /* YP */ BIT(20) +# define LRADC_CTRL0_MX28_YPPSW /* YP */ BIT(19) +# define LRADC_CTRL0_MX28_XNNSW /* XM */ BIT(18) +# define LRADC_CTRL0_MX28_XNPSW /* XM */ BIT(17) +# define LRADC_CTRL0_MX28_XPPSW /* XP */ BIT(16) + +# define LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE BIT(20) +# define LRADC_CTRL0_MX23_YM BIT(19) +# define LRADC_CTRL0_MX23_XM BIT(18) +# define LRADC_CTRL0_MX23_YP BIT(17) +# define LRADC_CTRL0_MX23_XP BIT(16) # define LRADC_CTRL0_MX28_PLATE_MASK \ (LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE | \ @@ -295,12 +295,12 @@ struct mxs_lradc { LRADC_CTRL0_MX23_YP | LRADC_CTRL0_MX23_XP) #define LRADC_CTRL1 0x10 -#define LRADC_CTRL1_TOUCH_DETECT_IRQ_EN (1 << 24) +#define LRADC_CTRL1_TOUCH_DETECT_IRQ_EN BIT(24) #define LRADC_CTRL1_LRADC_IRQ_EN(n) (1 << ((n) + 16)) #define LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK (0x1fff << 16) #define LRADC_CTRL1_MX23_LRADC_IRQ_EN_MASK (0x01ff << 16) #define LRADC_CTRL1_LRADC_IRQ_EN_OFFSET 16 -#define LRADC_CTRL1_TOUCH_DETECT_IRQ (1 << 8) +#define LRADC_CTRL1_TOUCH_DETECT_IRQ BIT(8) #define LRADC_CTRL1_LRADC_IRQ(n) (1 << (n)) #define LRADC_CTRL1_MX28_LRADC_IRQ_MASK 0x1fff #define LRADC_CTRL1_MX23_LRADC_IRQ_MASK 0x01ff @@ -308,13 +308,13 @@ struct mxs_lradc { #define LRADC_CTRL2 0x20 #define LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET 24 -#define LRADC_CTRL2_TEMPSENSE_PWD (1 << 15) +#define LRADC_CTRL2_TEMPSENSE_PWD BIT(15) #define LRADC_STATUS 0x40 -#define LRADC_STATUS_TOUCH_DETECT_RAW (1 << 0) +#define LRADC_STATUS_TOUCH_DETECT_RAW BIT(0) #define LRADC_CH(n) (0x50 + (0x10 * (n))) -#define LRADC_CH_ACCUMULATE (1 << 29) +#define LRADC_CH_ACCUMULATE BIT(29) #define LRADC_CH_NUM_SAMPLES_MASK (0x1f << 24) #define LRADC_CH_NUM_SAMPLES_OFFSET 24 #define LRADC_CH_NUM_SAMPLES(x) \ @@ -477,7 +477,7 @@ static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) */ mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(0) | /* don't trigger ADC */ - LRADC_DELAY_TRIGGER_DELAYS(1 << 3) | /* trigger DELAY unit#3 */ + LRADC_DELAY_TRIGGER_DELAYS(BIT(3)) | /* trigger DELAY unit#3 */ LRADC_DELAY_KICK | LRADC_DELAY_DELAY(lradc->settling_delay), LRADC_DELAY(2)); @@ -532,7 +532,7 @@ static void mxs_lradc_setup_ts_pressure(struct mxs_lradc *lradc, unsigned ch1, */ mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(0) | /* don't trigger ADC */ - LRADC_DELAY_TRIGGER_DELAYS(1 << 3) | /* trigger DELAY unit#3 */ + LRADC_DELAY_TRIGGER_DELAYS(BIT(3)) | /* trigger DELAY unit#3 */ LRADC_DELAY_KICK | LRADC_DELAY_DELAY(lradc->settling_delay), LRADC_DELAY(2)); } @@ -850,7 +850,7 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) /* Enable the IRQ and start sampling the channel. */ mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), LRADC_CTRL1); - mxs_lradc_reg_set(lradc, 1 << 0, LRADC_CTRL0); + mxs_lradc_reg_set(lradc, BIT(0), LRADC_CTRL0); /* Wait for completion on the channel, 1 second max. */ ret = wait_for_completion_killable_timeout(&lradc->completion, HZ); diff --git a/drivers/staging/iio/adc/spear_adc.c b/drivers/staging/iio/adc/spear_adc.c index 8ad71691fc09..c5382374ddf6 100644 --- a/drivers/staging/iio/adc/spear_adc.c +++ b/drivers/staging/iio/adc/spear_adc.c @@ -29,11 +29,11 @@ #define SPEAR_ADC_CLK_HIGH(x) (((x) & 0xf) << 4) /* Bit definitions for SPEAR_ADC_STATUS */ -#define SPEAR_ADC_STATUS_START_CONVERSION (1 << 0) +#define SPEAR_ADC_STATUS_START_CONVERSION BIT(0) #define SPEAR_ADC_STATUS_CHANNEL_NUM(x) ((x) << 1) -#define SPEAR_ADC_STATUS_ADC_ENABLE (1 << 4) +#define SPEAR_ADC_STATUS_ADC_ENABLE BIT(4) #define SPEAR_ADC_STATUS_AVG_SAMPLE(x) ((x) << 5) -#define SPEAR_ADC_STATUS_VREF_INTERNAL (1 << 9) +#define SPEAR_ADC_STATUS_VREF_INTERNAL BIT(9) #define SPEAR_ADC_DATA_MASK 0x03ff #define SPEAR_ADC_DATA_BITS 10 -- cgit v1.2.3 From 1f5f636c7746d2badbb960b51a13a1bb1edb1304 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Wed, 25 Mar 2015 20:54:33 -0300 Subject: staging: fbtft: Add space around '=' This patch fixes the checkpatch.pl error: ERROR: spaces required around that '=' (ctx:VxV) + sdev->bits_per_word=9; ^ Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/flexfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 90832c36e557..ca39fe90d1b8 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -423,7 +423,7 @@ static int flexfb_probe_common(struct spi_device *sdev, struct platform_device * } par->fbtftops.write_register = fbtft_write_reg8_bus9; par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; - sdev->bits_per_word=9; + sdev->bits_per_word = 9; ret = sdev->master->setup(sdev); if (ret) { dev_warn(dev, -- cgit v1.2.3 From 4ebe6f46cb20b004e94e9862509085f6b7e69366 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Wed, 25 Mar 2015 20:56:43 -0300 Subject: staging: fbtft: Remove do {} while(0) in single statement macro This patch fixes the checkpatch.pl warning: WARNING: Single statement macros should not use a do {} while (0) loop +#define write_reg(par, ...) \ +do { \ + par->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__); \ +} while (0) Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 36ecf026d67d..f55cc5b77c15 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -259,9 +259,7 @@ struct fbtft_par { #define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int)) #define write_reg(par, ...) \ -do { \ - par->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__); \ -} while (0) + par->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__) /* fbtft-core.c */ extern void fbtft_dbg_hex(const struct device *dev, -- cgit v1.2.3 From da868b0305c43eaab0e2b3c14807531c5665f0a2 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Wed, 25 Mar 2015 21:02:42 -0300 Subject: Staging: i2o: Remove indentation of labels This patch fixes the checkpatche.pl warnings: WARNING: labels should not be indented + context_remove: WARNING: labels should not be indented + nop_msg: WARNING: labels should not be indented + exit: Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/i2o/i2o_block.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/i2o/i2o_block.c b/drivers/staging/i2o/i2o_block.c index 77847875c38b..406758f755ee 100644 --- a/drivers/staging/i2o/i2o_block.c +++ b/drivers/staging/i2o/i2o_block.c @@ -871,13 +871,13 @@ static int i2o_block_transfer(struct request *req) return 0; - context_remove: +context_remove: i2o_cntxt_list_remove(c, req); - nop_msg: +nop_msg: i2o_msg_nop(c, msg); - exit: +exit: return rc; }; @@ -1002,13 +1002,13 @@ static struct i2o_block_device *i2o_block_device_alloc(void) return dev; - cleanup_queue: +cleanup_queue: put_disk(gd); - cleanup_dev: +cleanup_dev: kfree(dev); - exit: +exit: return ERR_PTR(rc); }; @@ -1115,10 +1115,10 @@ static int i2o_block_probe(struct device *dev) return 0; - claim_release: +claim_release: i2o_device_claim_release(i2o_dev); - exit: +exit: return rc; }; @@ -1187,16 +1187,16 @@ static int __init i2o_block_init(void) return 0; - unregister_blkdev: +unregister_blkdev: unregister_blkdev(I2O_MAJOR, "i2o_block"); - free_mempool: +free_mempool: mempool_destroy(i2o_blk_req_pool.pool); - free_slab: +free_slab: kmem_cache_destroy(i2o_blk_req_pool.slab); - exit: +exit: return rc; }; -- cgit v1.2.3 From 0270c6257701a33262239ffc38442f18ae047d98 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Wed, 25 Mar 2015 21:11:44 -0300 Subject: Staging: octeon: Remove extern from .c file This patch fixes the checkpatch.pl warning: WARNING: externs should be avoided in .c files +extern void octeon_mdiobus_force_mod_depencency(void); Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-mdio.h | 3 +++ drivers/staging/octeon/ethernet.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon/ethernet-mdio.h b/drivers/staging/octeon/ethernet-mdio.h index eccfcc54cea8..6191b0850646 100644 --- a/drivers/staging/octeon/ethernet-mdio.h +++ b/drivers/staging/octeon/ethernet-mdio.h @@ -40,5 +40,8 @@ #endif /* CONFIG_XFRM */ extern const struct ethtool_ops cvm_oct_ethtool_ops; + +extern void octeon_mdiobus_force_mod_depencency(void); + int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int cvm_oct_phy_setup_device(struct net_device *dev); diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 79f33349e93f..f539d82f2f11 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -573,8 +573,6 @@ static const struct net_device_ops cvm_oct_pow_netdev_ops = { #endif }; -extern void octeon_mdiobus_force_mod_depencency(void); - static struct device_node *cvm_oct_of_get_child( const struct device_node *parent, int reg_val) { -- cgit v1.2.3 From 8e43c9c75faf2902955bd2ecd7a50a8cc41cb00a Mon Sep 17 00:00:00 2001 From: Alistair Strachan Date: Tue, 24 Mar 2015 14:51:31 -0700 Subject: staging: android: sync: Fix memory corruption in sync_timeline_signal(). The android_fence_release() function checks for active sync points by calling list_empty() on the list head embedded on the sync point. However, it is only valid to use list_empty() on nodes that have been initialized with INIT_LIST_HEAD() or list_del_init(). Because the list entry has likely been removed from the active list by sync_timeline_signal(), there is a good chance that this WARN_ON_ONCE() will be hit due to dangling pointers pointing at freed memory (even though the sync drivers did nothing wrong) and memory corruption will ensue as the list entry is removed for a second time, corrupting the active list. This problem can be reproduced quite easily with CONFIG_DEBUG_LIST=y and fences with more than one sync point. Signed-off-by: Alistair Strachan Cc: Maarten Lankhorst Cc: Greg Kroah-Hartman Cc: Colin Cross Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 7bdb62bf6b40..f83e00c78051 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -114,7 +114,7 @@ void sync_timeline_signal(struct sync_timeline *obj) list_for_each_entry_safe(pt, next, &obj->active_list_head, active_list) { if (fence_is_signaled_locked(&pt->base)) - list_del(&pt->active_list); + list_del_init(&pt->active_list); } spin_unlock_irqrestore(&obj->child_list_lock, flags); -- cgit v1.2.3 From 2c20d92dad5db6440cfa88d811b69fd605240ce4 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 24 Mar 2015 16:29:32 +0530 Subject: staging: panel: fix lcd type the lcd type as defined in the Kconfig is not matching in the code. as a result the rs, rw and en pins were getting interchanged. Kconfig defines the value of PANEL_LCD to be 1 if we select custom configuration but in the code LCD_TYPE_CUSTOM is defined as 5. my hardware is LCD_TYPE_CUSTOM, but the pins were assigned to it as pins of LCD_TYPE_OLD, and it was not working. Now values are corrected with referenece to the values defined in Kconfig and it is working. checked on JHD204A lcd with LCD_TYPE_CUSTOM configuration. Cc: # 2.6.32+ Signed-off-by: Sudip Mukherjee Acked-by: Willy Tarreau Signed-off-by: Greg Kroah-Hartman --- drivers/staging/panel/panel.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index b7ffdfb5c3e6..ea54fb4ec837 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -335,11 +335,11 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES]; * LCD types */ #define LCD_TYPE_NONE 0 -#define LCD_TYPE_OLD 1 -#define LCD_TYPE_KS0074 2 -#define LCD_TYPE_HANTRONIX 3 -#define LCD_TYPE_NEXCOM 4 -#define LCD_TYPE_CUSTOM 5 +#define LCD_TYPE_CUSTOM 1 +#define LCD_TYPE_OLD 2 +#define LCD_TYPE_KS0074 3 +#define LCD_TYPE_HANTRONIX 4 +#define LCD_TYPE_NEXCOM 5 /* * keypad types @@ -500,7 +500,7 @@ MODULE_PARM_DESC(keypad_type, static int lcd_type = NOT_SET; module_param(lcd_type, int, 0000); MODULE_PARM_DESC(lcd_type, - "LCD type: 0=none, 1=old //, 2=serial ks0074, 3=hantronix //, 4=nexcom //, 5=compiled-in"); + "LCD type: 0=none, 1=compiled-in, 2=old, 3=serial ks0074, 4=hantronix, 5=nexcom"); static int lcd_height = NOT_SET; module_param(lcd_height, int, 0000); -- cgit v1.2.3 From 21a1d41174a16c1bba8b43eb607ac031f31533ae Mon Sep 17 00:00:00 2001 From: Daniele Alessandrelli Date: Mon, 16 Mar 2015 23:53:37 +0100 Subject: ft1000-pcmcia: ft1000_hw.c: fix style issues not requiring code refactoring Fix all the trivial style issues (as reported by checkpatch.pl) not requiring code refactoring. A following patch is expected to fix the remaining issues by performing some code refactoring. Signed-off-by: Daniele Alessandrelli Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 189 +++++++++++++---------- 1 file changed, 106 insertions(+), 83 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 0afe37f1255d..ff9433edf486 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -28,8 +28,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -67,8 +67,7 @@ static void ft1000_disable_interrupts(struct net_device *dev); /* new kernel */ MODULE_AUTHOR(""); -MODULE_DESCRIPTION -("Support for Flarion Flash OFDM NIC Device. Support for PCMCIA when used with ft1000_cs."); +MODULE_DESCRIPTION("Support for Flarion Flash OFDM NIC Device. Support for PCMCIA when used with ft1000_cs."); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("FT1000"); @@ -267,7 +266,8 @@ void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value) /*--------------------------------------------------------------------------- Function: ft1000_enable_interrupts - Description: This function will enable interrupts base on the current interrupt mask. + Description: This function will enable interrupts base on the current + interrupt mask. Input: dev - device structure Output: @@ -406,7 +406,8 @@ static int ft1000_reset_card(struct net_device *dev) FT1000_DPRAM_MAG_RX_BASE); for (i = 0; i < MAX_DSP_SESS_REC / 2; i++) { info->DSPSess.MagRec[i] = - inl(dev->base_addr + FT1000_REG_MAG_DPDATA); + inl(dev->base_addr + + FT1000_REG_MAG_DPDATA); } } spin_unlock_irqrestore(&info->dpram_lock, flags); @@ -435,11 +436,14 @@ static int ft1000_reset_card(struct net_device *dev) mdelay(10); pr_debug("Take DSP out of reset\n"); - /* Wait for 0xfefe indicating dsp ready before starting download */ + /* + * Wait for 0xfefe indicating dsp ready before starting + * download + */ for (i = 0; i < 50; i++) { - tempword = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DPRAM_FEFE, - FT1000_MAG_DPRAM_FEFE_INDX); + tempword = ft1000_read_dpram_mag_16(dev, + FT1000_MAG_DPRAM_FEFE, + FT1000_MAG_DPRAM_FEFE_INDX); if (tempword == 0xfefe) break; mdelay(20); @@ -466,8 +470,8 @@ static int ft1000_reset_card(struct net_device *dev) if (info->AsicID == ELECTRABUZZ_ID) { /* - * Need to initialize the FIFO length counter to zero in order to sync up - * with the DSP + * Need to initialize the FIFO length counter to zero in order + * to sync up with the DSP */ info->fifo_cnt = 0; ft1000_write_dpram(dev, FT1000_FIFO_LEN, info->fifo_cnt); @@ -664,8 +668,8 @@ static void ft1000_hbchk(u_long data) return; } /* - * Set dedicated area to hi and ring appropriate doorbell according - * to hi/ho heartbeat protocol + * Set dedicated area to hi and ring appropriate doorbell + * according to hi/ho heartbeat protocol */ if (info->AsicID == ELECTRABUZZ_ID) { ft1000_write_dpram(dev, FT1000_HI_HO, hi); @@ -687,13 +691,15 @@ static void ft1000_hbchk(u_long data) if (info->AsicID == ELECTRABUZZ_ID) ft1000_write_dpram(dev, FT1000_HI_HO, hi); else - ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, hi_mag, FT1000_MAG_HI_HO_INDX); + ft1000_write_dpram_mag_16(dev, FT1000_MAG_HI_HO, + hi_mag, FT1000_MAG_HI_HO_INDX); if (info->AsicID == ELECTRABUZZ_ID) tempword = ft1000_read_dpram(dev, FT1000_HI_HO); else - tempword = ntohs(ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX)); - + tempword = ntohs(ft1000_read_dpram_mag_16(dev, + FT1000_MAG_HI_HO, + FT1000_MAG_HI_HO_INDX)); } if (tempword != hi) { @@ -755,7 +761,8 @@ static void ft1000_hbchk(u_long data) Output: -------------------------------------------------------------------------*/ -static void ft1000_send_cmd(struct net_device *dev, u16 *ptempbuffer, int size, u16 qtype) +static void ft1000_send_cmd(struct net_device *dev, u16 *ptempbuffer, int size, + u16 qtype) { struct ft1000_info *info = netdev_priv(dev); int i; @@ -849,12 +856,12 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 *pbuffer, unsigned long flags; if (info->AsicID == ELECTRABUZZ_ID) { - size = (ft1000_read_dpram(dev, *pnxtph)) + sizeof(struct pseudo_hdr); + size = ft1000_read_dpram(dev, *pnxtph) + + sizeof(struct pseudo_hdr); } else { - size = - ntohs(ft1000_read_dpram_mag_16 - (dev, FT1000_MAG_PH_LEN, - FT1000_MAG_PH_LEN_INDX)) + sizeof(struct pseudo_hdr); + size = ntohs(ft1000_read_dpram_mag_16(dev, FT1000_MAG_PH_LEN, + FT1000_MAG_PH_LEN_INDX)) + + sizeof(struct pseudo_hdr); } if (size > maxsz) { pr_debug("Invalid command length = %d\n", size); @@ -955,7 +962,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev) if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword)) { - /* Get the message type which is total_len + PSEUDO header + msgtype + message body */ + /* + * Get the message type which is total_len + PSEUDO header + * + msgtype + message body + */ pdrvmsg = (struct drv_msg *)&cmdbuffer[0]; msgtype = ntohs(pdrvmsg->type); pr_debug("Command message type = 0x%x\n", msgtype); @@ -966,8 +976,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) while (list_empty(&info->prov_list) == 0) { pr_debug("Sending a provisioning message\n"); /* Make sure SLOWQ doorbell is clear */ - tempword = - ft1000_read_reg(dev, FT1000_REG_DOORBELL); + tempword = ft1000_read_reg(dev, + FT1000_REG_DOORBELL); i = 0; while (tempword & FT1000_DB_DPRAM_TX) { mdelay(5); @@ -975,9 +985,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) if (i == 10) break; } - ptr = - list_entry(info->prov_list.next, - struct prov_record, list); + ptr = list_entry(info->prov_list.next, + struct prov_record, list); len = *(u16 *)ptr->pprov_data; len = htons(len); @@ -996,14 +1005,15 @@ static void ft1000_proc_drvmsg(struct net_device *dev) ppseudo_hdr->checksum); } - ft1000_send_cmd(dev, (u16 *)ptr->pprov_data, len, SLOWQ_TYPE); + ft1000_send_cmd(dev, (u16 *)ptr->pprov_data, + len, SLOWQ_TYPE); list_del(&ptr->list); kfree(ptr->pprov_data); kfree(ptr); } /* - * Indicate adapter is ready to take application messages after all - * provisioning messages are sent + * Indicate adapter is ready to take application + * messages after all provisioning messages are sent */ info->CardReady = 1; break; @@ -1091,8 +1101,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) { mdelay(10); - tempword = - ft1000_read_reg(dev, FT1000_REG_DOORBELL); + tempword = ft1000_read_reg(dev, + FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) mdelay(10); } @@ -1143,8 +1153,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) { mdelay(10); - tempword = - ft1000_read_reg(dev, FT1000_REG_DOORBELL); + tempword = ft1000_read_reg(dev, + FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) mdelay(10); } @@ -1190,7 +1200,8 @@ static void ft1000_proc_drvmsg(struct net_device *dev) *pmsg++ = convert.wrd; *pmsg++ = htons(info->DrvErrNum); - ft1000_send_cmd(dev, (u16 *)&tempbuffer[0], (u16)(0x0012), 0); + ft1000_send_cmd(dev, (u16 *)&tempbuffer[0], + (u16)(0x0012), 0); info->DrvErrNum = 0; } @@ -1281,18 +1292,17 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) FT1000_MAG_TOTAL_LEN_INDX)); } pr_debug("total length = %d\n", total_len); - if ((total_len < MAX_CMD_SQSIZE) && (total_len > sizeof(struct pseudo_hdr))) { + if ((total_len < MAX_CMD_SQSIZE) + && (total_len > sizeof(struct pseudo_hdr))) { total_len += nxtph; /* - * ft1000_read_reg will return a value that needs to be byteswap - * in order to get DSP_QID_OFFSET. + * ft1000_read_reg will return a value that needs to be + * byteswap in order to get DSP_QID_OFFSET. */ if (info->AsicID == ELECTRABUZZ_ID) { - portid = - (ft1000_read_dpram - (dev, - DSP_QID_OFFSET + FT1000_DPRAM_RX_BASE + - 2) >> 8) & 0xff; + portid = (ft1000_read_dpram(dev, DSP_QID_OFFSET + + FT1000_DPRAM_RX_BASE + 2) + >> 8) & 0xff; } else { portid = ft1000_read_dpram_mag_16 @@ -1302,7 +1312,10 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) pr_debug("DSP_QID = 0x%x\n", portid); if (portid == DRIVERID) { - /* We are assumming one driver message from the DSP at a time. */ + /* + * We are assumming one driver message from the + * DSP at a time. + */ ft1000_proc_drvmsg(dev); } } @@ -1437,35 +1450,41 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) } else { info->DSP_TIME[0] = ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); + FT1000_MAG_DSP_TIMER0, + FT1000_MAG_DSP_TIMER0_INDX); info->DSP_TIME[1] = ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); + FT1000_MAG_DSP_TIMER1, + FT1000_MAG_DSP_TIMER1_INDX); info->DSP_TIME[2] = ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); + FT1000_MAG_DSP_TIMER2, + FT1000_MAG_DSP_TIMER2_INDX); info->DSP_TIME[3] = ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); + FT1000_MAG_DSP_TIMER3, + FT1000_MAG_DSP_TIMER3_INDX); } if (tempword == 0) { /* - * Let's check if ASIC reads are still ok by reading the Mask register - * which is never zero at this point of the code. + * Let's check if ASIC reads are still ok by + * reading the Mask register which is never zero + * at this point of the code. */ tempword = inw(dev->base_addr + FT1000_REG_SUP_IMASK); if (tempword == 0) { - /* This indicates that we can not communicate with the ASIC */ - info->DrvErrNum = - FIFO_FLUSH_BADCNT; + /* + * This indicates that we can not + * communicate with the ASIC + */ + info->DrvErrNum = FIFO_FLUSH_BADCNT; } else { - /* Let's assume that we really flush the FIFO */ + /* + * Let's assume that we really flush + * the FIFO + */ pcmcia->PktIntfErr++; return; } @@ -1551,7 +1570,6 @@ static int ft1000_copy_up_pkt(struct net_device *dev) skb = dev_alloc_skb(len + 12 + 2); if (skb == NULL) { - pr_debug("No Network buffers available\n"); /* Read High word to complete 32 bit access */ if (info->AsicID == MAGNEMITE_ID) tempword = ft1000_read_reg(dev, FT1000_REG_MAG_DFRH); @@ -1672,7 +1690,8 @@ static int ft1000_copy_up_pkt(struct net_device *dev) info->stats.rx_bytes += (len + 12); if (info->AsicID == ELECTRABUZZ_ID) { - /* track how many bytes have been read from FIFO - round up to 16 bit word */ + /* track how many bytes have been read from FIFO - round up to + * 16 bit word */ tempword = len + 16; if (tempword & 0x01) tempword++; @@ -1736,9 +1755,11 @@ static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len) else pseudo.blk.length = ntohs(len); - pseudo.blk.source = DSPID; /* Need to swap to get in correct order */ + pseudo.blk.source = DSPID; /* Need to swap to get in correct + order */ pseudo.blk.destination = HOSTID; - pseudo.blk.portdest = NETWORKID; /* Need to swap to get in correct order */ + pseudo.blk.portdest = NETWORKID; /* Need to swap to get in + correct order */ pseudo.blk.portsrc = DSPAIRID; pseudo.blk.sh_str_id = 0; pseudo.blk.control = 0; @@ -1842,7 +1863,8 @@ static int ft1000_open(struct net_device *dev) { ft1000_reset_card(dev); - /* schedule ft1000_hbchk to perform periodic heartbeat checks on DSP and ASIC */ + /* schedule ft1000_hbchk to perform periodic heartbeat checks on DSP + * and ASIC */ init_timer(&poll_timer); poll_timer.expires = jiffies + (2 * HZ); poll_timer.data = (u_long)dev; @@ -1927,7 +1949,8 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) /* Read interrupt type */ inttype = ft1000_read_reg(dev, FT1000_REG_SUP_ISR); - /* Make sure we process all interrupt before leaving the ISR due to the edge trigger interrupt type */ + /* Make sure we process all interrupt before leaving the ISR due to the + * edge trigger interrupt type */ while (inttype) { if (inttype & ISR_DOORBELL_PEND) ft1000_parse_dpram_msg(dev); @@ -1937,20 +1960,18 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id) cnt = 0; do { - /* Check if we have packets in the Downlink FIFO */ + /* Check if we have packets in the Downlink + * FIFO */ if (info->AsicID == ELECTRABUZZ_ID) { - tempword = - ft1000_read_reg(dev, - FT1000_REG_DFIFO_STAT); + tempword = ft1000_read_reg(dev, + FT1000_REG_DFIFO_STAT); } else { - tempword = - ft1000_read_reg(dev, - FT1000_REG_MAG_DFSR); + tempword = ft1000_read_reg(dev, + FT1000_REG_MAG_DFSR); } - if (tempword & 0x1f) - ft1000_copy_up_pkt(dev); - else + if (!(tempword & 0x1f)) break; + ft1000_copy_up_pkt(dev); cnt++; } while (cnt < MAX_RCV_LOOP); @@ -2037,8 +2058,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, struct ft1000_pcmcia *pcmcia; struct net_device *dev; - static const struct net_device_ops ft1000ops = /* Slavius 21.10.2009 due to kernel changes */ - { + static const struct net_device_ops ft1000ops = { .ndo_open = &ft1000_open, .ndo_stop = &ft1000_close, .ndo_start_xmit = &ft1000_start_xmit, @@ -2101,7 +2121,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, /* dev->open = &ft1000_open; */ /* dev->stop = &ft1000_close; */ - dev->netdev_ops = &ft1000ops; /* Slavius 21.10.2009 due to kernel changes */ + dev->netdev_ops = &ft1000ops; pr_debug("device name = %s\n", dev->name); @@ -2112,7 +2132,8 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, goto err_dev; } - if (request_irq(dev->irq, ft1000_interrupt, IRQF_SHARED, dev->name, dev)) { + if (request_irq(dev->irq, ft1000_interrupt, IRQF_SHARED, dev->name, + dev)) { netdev_err(dev, "Could not request_irq\n"); goto err_dev; } @@ -2122,7 +2143,7 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, goto err_irq; } - if (register_netdev(dev) != 0) { + if (register_netdev(dev)) { pr_debug("Could not register netdev\n"); goto err_reg; } @@ -2130,13 +2151,15 @@ struct net_device *init_ft1000_card(struct pcmcia_device *link, info->AsicID = ft1000_read_reg(dev, FT1000_REG_ASIC_ID); if (info->AsicID == ELECTRABUZZ_ID) { pr_debug("ELECTRABUZZ ASIC\n"); - if (request_firmware(&fw_entry, "ft1000.img", &link->dev) != 0) { + if (request_firmware(&fw_entry, "ft1000.img", + &link->dev) != 0) { pr_info("Could not open ft1000.img\n"); goto err_unreg; } } else { pr_debug("MAGNEMITE ASIC\n"); - if (request_firmware(&fw_entry, "ft2000.img", &link->dev) != 0) { + if (request_firmware(&fw_entry, "ft2000.img", + &link->dev) != 0) { pr_info("Could not open ft2000.img\n"); goto err_unreg; } -- cgit v1.2.3 From de5160ffd279dc6e7fa070a4a3852c6c5be42f9c Mon Sep 17 00:00:00 2001 From: Daniele Alessandrelli Date: Mon, 16 Mar 2015 23:53:38 +0100 Subject: ft1000-pcmcia: ft1000_hw.c: code refactoring: add ft1000_read_dsp_timer() Add new function ft1000_read_dsp_timer() replacing recurring code block for reading DSP timer. Such code refactoring solves all remaining "line over 80 characters" warnings reported by checkpatch.pl. Signed-off-by: Daniele Alessandrelli Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 199 +++++------------------ 1 file changed, 41 insertions(+), 158 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index ff9433edf486..eecfa377054d 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -302,6 +302,41 @@ static void ft1000_disable_interrupts(struct net_device *dev) pr_debug("current interrupt enable mask = 0x%x\n", tempword); } +/*--------------------------------------------------------------------------- + Function: ft1000_read_dsp_timer + Description: This function reads the DSP timer and stores its value in the + DSP_TIME field of the ft1000_info struct passed as argument + Input: + dev - device structure + info - ft1000_info structure + Output: + None. + + -------------------------------------------------------------------------*/ +static void ft1000_read_dsp_timer(struct net_device *dev, + struct ft1000_info *info) +{ + if (info->AsicID == ELECTRABUZZ_ID) { + info->DSP_TIME[0] = ft1000_read_dpram(dev, FT1000_DSP_TIMER0); + info->DSP_TIME[1] = ft1000_read_dpram(dev, FT1000_DSP_TIMER1); + info->DSP_TIME[2] = ft1000_read_dpram(dev, FT1000_DSP_TIMER2); + info->DSP_TIME[3] = ft1000_read_dpram(dev, FT1000_DSP_TIMER3); + } else { + info->DSP_TIME[0] = + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER0, + FT1000_MAG_DSP_TIMER0_INDX); + info->DSP_TIME[1] = + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER1, + FT1000_MAG_DSP_TIMER1_INDX); + info->DSP_TIME[2] = + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER2, + FT1000_MAG_DSP_TIMER2_INDX); + info->DSP_TIME[3] = + ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER3, + FT1000_MAG_DSP_TIMER3_INDX); + } +} + /*--------------------------------------------------------------------------- Function: ft1000_reset_asic @@ -581,33 +616,7 @@ static void ft1000_hbchk(u_long data) } if (tempword != ho) { pr_info("heartbeat failed - no ho detected\n"); - if (info->AsicID == ELECTRABUZZ_ID) { - info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); - info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); - info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); - info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); - } else { - info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); - info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); - info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); - info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); - } + ft1000_read_dsp_timer(dev, info); info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev) == 0) { pr_info("Hardware Failure Detected - PC Card disabled\n"); @@ -628,33 +637,7 @@ static void ft1000_hbchk(u_long data) if (tempword & FT1000_DB_HB) { pr_info("heartbeat doorbell not clear by firmware\n"); - if (info->AsicID == ELECTRABUZZ_ID) { - info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); - info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); - info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); - info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); - } else { - info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); - info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); - info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); - info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); - } + ft1000_read_dsp_timer(dev, info); info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev) == 0) { pr_info("Hardware Failure Detected - PC Card disabled\n"); @@ -704,33 +687,7 @@ static void ft1000_hbchk(u_long data) if (tempword != hi) { pr_info("heartbeat failed - cannot write hi into DPRAM\n"); - if (info->AsicID == ELECTRABUZZ_ID) { - info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); - info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); - info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); - info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); - } else { - info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); - info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); - info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); - info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); - } + ft1000_read_dsp_timer(dev, info); info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev) == 0) { pr_info("Hardware Failure Detected - PC Card disabled\n"); @@ -1324,29 +1281,7 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) if (doorbell & FT1000_DB_COND_RESET) { /* Reset ASIC and DSP */ - if (info->AsicID == ELECTRABUZZ_ID) { - info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); - info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); - info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); - info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); - } else { - info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); - info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); - info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); - info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); - } + ft1000_read_dsp_timer(dev, info); info->DrvErrNum = DSP_CONDRESET_INFO; pr_debug("DSP conditional reset requested\n"); ft1000_reset_card(dev); @@ -1387,29 +1322,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) u16 tempword; if (pcmcia->PktIntfErr > MAX_PH_ERR) { - if (info->AsicID == ELECTRABUZZ_ID) { - info->DSP_TIME[0] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER0); - info->DSP_TIME[1] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER1); - info->DSP_TIME[2] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER2); - info->DSP_TIME[3] = - ft1000_read_dpram(dev, FT1000_DSP_TIMER3); - } else { - info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); - info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); - info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); - info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); - } + ft1000_read_dsp_timer(dev, info); info->DrvErrNum = DrvErrNum; ft1000_reset_card(dev); return; @@ -1434,37 +1347,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) * We must reset to recover. */ if ((i > 2048) || (tempword == 0)) { - if (info->AsicID == ELECTRABUZZ_ID) { - info->DSP_TIME[0] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER0); - info->DSP_TIME[1] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER1); - info->DSP_TIME[2] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER2); - info->DSP_TIME[3] = - ft1000_read_dpram(dev, - FT1000_DSP_TIMER3); - } else { - info->DSP_TIME[0] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER0, - FT1000_MAG_DSP_TIMER0_INDX); - info->DSP_TIME[1] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER1, - FT1000_MAG_DSP_TIMER1_INDX); - info->DSP_TIME[2] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER2, - FT1000_MAG_DSP_TIMER2_INDX); - info->DSP_TIME[3] = - ft1000_read_dpram_mag_16(dev, - FT1000_MAG_DSP_TIMER3, - FT1000_MAG_DSP_TIMER3_INDX); - } + ft1000_read_dsp_timer(dev, info); if (tempword == 0) { /* * Let's check if ASIC reads are still ok by -- cgit v1.2.3 From c61ac9791e357e0589f688a0a5ee4ad24f41cd84 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Wed, 25 Mar 2015 22:04:53 -0400 Subject: staging/lustre/osc: shorten IO calling path By using osc_io_unplug_aync() for osc_queue_sync_pages() to shorten the IO calling path, to reduce the chance of stack overflow. Signed-off-by: Bobi Jam Signed-off-by: Bob Glossman Reviewed-on: http://review.whamcloud.com/11612 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3188 Reviewed-by: Jinshan Xiong Reviewed-by: Niu Yawei Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 7022ed42d2d1..d44b3d4ffe4d 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2613,7 +2613,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, } osc_object_unlock(obj); - osc_io_unplug(env, cli, obj, PDL_POLICY_ROUND); + osc_io_unplug_async(env, cli, obj); return 0; } -- cgit v1.2.3 From f42894004727ffdfb3b0826b0047eaf44cbdece6 Mon Sep 17 00:00:00 2001 From: "Christopher J. Morrone" Date: Wed, 25 Mar 2015 21:53:18 -0400 Subject: staging/lustre/mdc: Handle empty but non-zero acl xattr We have found that posix_acl_access can have a value of \002\000\000\000. In that case body->aclsize is non-zero, but the there are no actuall acls stored in the xattr. In mdc_unpack_acl(), it only checks IS_ERR() on the pointer returned by posix_acl_from_xattr(), it does not check for NULL. Because of the above situation, the xattr aclsize can be non-zero, but posic_acl_from_xattr() still returns NULL. Passing NULL to posix_acl_valid() crashes the kernel. We add a check to properly handle the NULL return value. Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/11989 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5150 Reviewed-by: Fan Yong Reviewed-by: Bob Glossman Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index c04eec5c603e..f8ef5fe5e771 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -481,6 +481,9 @@ static int mdc_unpack_acl(struct ptlrpc_request *req, struct lustre_md *md) return -EPROTO; acl = posix_acl_from_xattr(&init_user_ns, buf, body->aclsize); + if (acl == NULL) + return 0; + if (IS_ERR(acl)) { rc = PTR_ERR(acl); CERROR("convert xattr to acl: %d\n", rc); -- cgit v1.2.3 From 06fbc01a870eea4431ca340642da7bfd4a5a262e Mon Sep 17 00:00:00 2001 From: Liang Zhen Date: Wed, 25 Mar 2015 21:53:19 -0400 Subject: staging/lustre/ptlrpc: false alarm in AT network latency measuring If early reply of client RPC is lost and client RPC is expired and resent, server will drop the resent RPC because it's already in processing, server may also send reply or early reply to client, which can still match reply buffer of the original request. In this case, client is measuring time from resent time, but server is reporting service time of original RPC, which is longer than the time measured by client. Signed-off-by: Liang Zhen Reviewed-on: http://review.whamcloud.com/12855 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5545 Reviewed-by: Li Wei Reviewed-by: Johann Lombardi Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 0fe6a641092b..0357f1d4532f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -285,14 +285,27 @@ static void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req, time_t now = get_seconds(); LASSERT(req->rq_import); - at = &req->rq_import->imp_at; + + if (service_time > now - req->rq_sent + 3) { + /* bz16408, however, this can also happen if early reply + * is lost and client RPC is expired and resent, early reply + * or reply of original RPC can still be fit in reply buffer + * of resent RPC, now client is measuring time from the + * resent time, but server sent back service time of original + * RPC. + */ + CDEBUG((lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) ? + D_ADAPTTO : D_WARNING, + "Reported service time %u > total measured time " + CFS_DURATION_T"\n", service_time, + cfs_time_sub(now, req->rq_sent)); + return; + } /* Network latency is total time less server processing time */ - nl = max_t(int, now - req->rq_sent - service_time, 0) + 1/*st rounding*/; - if (service_time > now - req->rq_sent + 3 /* bz16408 */) - CWARN("Reported service time %u > total measured time " - CFS_DURATION_T"\n", service_time, - cfs_time_sub(now, req->rq_sent)); + nl = max_t(int, now - req->rq_sent - + service_time, 0) + 1; /* st rounding */ + at = &req->rq_import->imp_at; oldnl = at_measured(&at->iat_net_latency, nl); if (oldnl != 0) -- cgit v1.2.3 From 1c8aa54aaf2c74a28a9e427bb27fd1a12fca8536 Mon Sep 17 00:00:00 2001 From: Hongchao Zhang Date: Wed, 25 Mar 2015 21:53:20 -0400 Subject: staging/lustre/mgc: check the import stat for lprocfs in lprocfs_mgc_rd_ir_state, the import state should be checked the validity before doing further work. Signed-off-by: Hongchao Zhang Reviewed-on: http://review.whamcloud.com/12896 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5650 Reviewed-by: Fan Yong Reviewed-by: Niu Yawei Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 0375bfe29a7d..3f00e775cbff 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -452,10 +452,14 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) { struct obd_device *obd = data; - struct obd_import *imp = obd->u.cli.cl_import; - struct obd_connect_data *ocd = &imp->imp_connect_data; + struct obd_import *imp; + struct obd_connect_data *ocd; struct config_llog_data *cld; + LPROCFS_CLIMP_CHECK(obd); + imp = obd->u.cli.cl_import; + ocd = &imp->imp_connect_data; + seq_printf(m, "imperative_recovery: %s\n", OCD_HAS_FLAG(ocd, IMP_RECOV) ? "ENABLED" : "DISABLED"); seq_printf(m, "client_state:\n"); @@ -470,6 +474,7 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) } spin_unlock(&config_list_lock); + LPROCFS_CLIMP_EXIT(obd); return 0; } #endif -- cgit v1.2.3 From 4345abb2c3b56eae9bcf4728dcdc0f584690c8aa Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Wed, 25 Mar 2015 21:53:21 -0400 Subject: staging/lustre/mgc: detach MGC dev on error lustre_start_mgc() creates MGC device, if error happens later on ll_fill_super(), this device is still attached, and later mount fails by keep complaining that the MGC device's already in the client node. It turns out that the device was referenced by mgc config llog data which is arranged in the mgc lock requeue thread re-trying to get its mgc lock, and in normal case, this llog reference only released in mgc_blocking_ast() when the system is umount. This patch make mgc_precleanup() to wake up requeue thread to handle the config llog data. This patch also makes mgc_setup() wait for mgc_requeue_thread() start before moving on. Signed-off-by: Bobi Jam Reviewed-on: http://review.whamcloud.com/11765 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4943 Reviewed-by: Ryan Haasken Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 36 +++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 3f00e775cbff..8496d2552d52 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -484,9 +484,11 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) #define RQ_NOW 0x2 #define RQ_LATER 0x4 #define RQ_STOP 0x8 +#define RQ_PRECLEANUP 0x10 static int rq_state; static wait_queue_head_t rq_waitq; static DECLARE_COMPLETION(rq_exit); +static DECLARE_COMPLETION(rq_start); static void do_requeue(struct config_llog_data *cld) { @@ -515,6 +517,8 @@ static void do_requeue(struct config_llog_data *cld) static int mgc_requeue_thread(void *data) { + bool first = true; + CDEBUG(D_MGC, "Starting requeue thread\n"); /* Keep trying failed locks periodically */ @@ -531,13 +535,19 @@ static int mgc_requeue_thread(void *data) rq_state &= ~(RQ_NOW | RQ_LATER); spin_unlock(&config_list_lock); + if (first) { + first = false; + complete(&rq_start); + } + /* Always wait a few seconds to allow the server who caused the lock revocation to finish its setup, plus some random so everyone doesn't try to reconnect at once. */ to = MGC_TIMEOUT_MIN_SECONDS * HZ; to += rand * HZ / 100; /* rand is centi-seconds */ lwi = LWI_TIMEOUT(to, NULL, NULL); - l_wait_event(rq_waitq, rq_state & RQ_STOP, &lwi); + l_wait_event(rq_waitq, rq_state & (RQ_STOP | RQ_PRECLEANUP), + &lwi); /* * iterate & processing through the list. for each cld, process @@ -550,6 +560,7 @@ static int mgc_requeue_thread(void *data) cld_prev = NULL; spin_lock(&config_list_lock); + rq_state &= ~RQ_PRECLEANUP; list_for_each_entry(cld, &config_llog_list, cld_list_chain) { if (!cld->cld_lostlock) @@ -666,24 +677,26 @@ static atomic_t mgc_count = ATOMIC_INIT(0); static int mgc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) { int rc = 0; + int temp; switch (stage) { case OBD_CLEANUP_EARLY: break; case OBD_CLEANUP_EXPORTS: if (atomic_dec_and_test(&mgc_count)) { - int running; + LASSERT(rq_state & RQ_RUNNING); /* stop requeue thread */ - spin_lock(&config_list_lock); - running = rq_state & RQ_RUNNING; - if (running) - rq_state |= RQ_STOP; - spin_unlock(&config_list_lock); - if (running) { - wake_up(&rq_waitq); - wait_for_completion(&rq_exit); - } + temp = RQ_STOP; + } else { + /* wakeup requeue thread to clean our cld */ + temp = RQ_NOW | RQ_PRECLEANUP; } + spin_lock(&config_list_lock); + rq_state |= temp; + spin_unlock(&config_list_lock); + wake_up(&rq_waitq); + if (temp & RQ_STOP) + wait_for_completion(&rq_exit); obd_cleanup_client_import(obd); rc = mgc_llog_fini(NULL, obd); if (rc != 0) @@ -742,6 +755,7 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) } /* rc is the task_struct pointer of mgc_requeue_thread. */ rc = 0; + wait_for_completion(&rq_start); } return rc; -- cgit v1.2.3 From 397632e467d195a268ac3c5adfd7de32e92bd864 Mon Sep 17 00:00:00 2001 From: Yang Sheng Date: Wed, 25 Mar 2015 21:53:22 -0400 Subject: staging/lustre/lov: don't crash accessing LOV object with FID{0, 0} Some object maybe has a corrupted LOV EA or a hole in LOV EA. We should not crash client in such case. Signed-off-by: Fan Yong Signed-off-by: Yang Sheng Reviewed-on: http://review.whamcloud.com/12740 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4958 Reviewed-by: Jian Yu Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_ea.c | 6 +++++ drivers/staging/lustre/lustre/lov/lov_internal.h | 12 +++++++++ drivers/staging/lustre/lustre/lov/lov_io.c | 12 +++++++++ drivers/staging/lustre/lustre/lov/lov_lock.c | 26 ++++++++++++++----- drivers/staging/lustre/lustre/lov/lov_obd.c | 32 +++++++++++++++++++----- drivers/staging/lustre/lustre/lov/lov_object.c | 7 ++++++ drivers/staging/lustre/lustre/lov/lov_request.c | 9 +++++++ 7 files changed, 92 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index d1b0417d5058..2bcfaeaff6fa 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -227,6 +227,9 @@ static int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, ostid_le_to_cpu(&lmm->lmm_objects[i].l_ost_oi, &loi->loi_oi); loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); + if (lov_oinfo_is_dummy(loi)) + continue; + if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) { CERROR("OST index %d more than OST count %d\n", loi->loi_ost_idx, lov->desc.ld_tgt_count); @@ -314,6 +317,9 @@ static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, ostid_le_to_cpu(&lmm->lmm_objects[i].l_ost_oi, &loi->loi_oi); loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); + if (lov_oinfo_is_dummy(loi)) + continue; + if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) { CERROR("OST index %d more than OST count %d\n", loi->loi_ost_idx, lov->desc.ld_tgt_count); diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 8c8508bbbb80..b644acc9b034 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -304,4 +304,16 @@ static inline struct lov_stripe_md *lsm_addref(struct lov_stripe_md *lsm) return lsm; } +static inline bool lov_oinfo_is_dummy(const struct lov_oinfo *loi) +{ + if (unlikely(loi->loi_oi.oi.oi_id == 0 && + loi->loi_oi.oi.oi_seq == 0 && + loi->loi_ost_idx == 0 && + loi->loi_ost_gen == 0)) + return true; + + return false; +} + + #endif diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index f1f6db3f664a..80c2ef6d0fb5 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -148,6 +148,9 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, LASSERT(sub->sub_env == NULL); LASSERT(sub->sub_stripe < lio->lis_stripe_count); + if (unlikely(lov_r0(lov)->lo_sub[stripe] == NULL)) + return -EIO; + result = 0; sub->sub_io_initialized = 0; sub->sub_borrowed = 0; @@ -391,6 +394,15 @@ static int lov_io_iter_init(const struct lu_env *env, endpos, &start, &end)) continue; + if (unlikely(lov_r0(lio->lis_object)->lo_sub[stripe] == NULL)) { + if (ios->cis_io->ci_type == CIT_READ || + ios->cis_io->ci_type == CIT_WRITE || + ios->cis_io->ci_type == CIT_FAULT) + return -EIO; + + continue; + } + end = lov_offset_mod(end, +1); sub = lov_sub_get(env, lio, stripe); if (!IS_ERR(sub)) { diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c index 49e694222ac8..f2eca565bdda 100644 --- a/drivers/staging/lustre/lustre/lov/lov_lock.c +++ b/drivers/staging/lustre/lustre/lov/lov_lock.c @@ -308,7 +308,8 @@ static int lov_lock_sub_init(const struct lu_env *env, * XXX for wide striping smarter algorithm is desirable, * breaking out of the loop, early. */ - if (lov_stripe_intersects(loo->lo_lsm, i, + if (likely(r0->lo_sub[i] != NULL) && + lov_stripe_intersects(loo->lo_lsm, i, file_start, file_end, &start, &end)) nr++; } @@ -326,7 +327,8 @@ static int lov_lock_sub_init(const struct lu_env *env, * top-lock. */ for (i = 0, nr = 0; i < r0->lo_nr; ++i) { - if (lov_stripe_intersects(loo->lo_lsm, i, + if (likely(r0->lo_sub[i] != NULL) && + lov_stripe_intersects(loo->lo_lsm, i, file_start, file_end, &start, &end)) { struct cl_lock_descr *descr; @@ -914,10 +916,22 @@ static int lov_lock_stripe_is_matching(const struct lu_env *env, */ start = cl_offset(&lov->lo_cl, descr->cld_start); end = cl_offset(&lov->lo_cl, descr->cld_end + 1) - 1; - result = end - start <= lsm->lsm_stripe_size && - stripe == lov_stripe_number(lsm, start) && - stripe == lov_stripe_number(lsm, end); - if (result) { + result = 0; + /* glimpse should work on the object with LOV EA hole. */ + if (end - start <= lsm->lsm_stripe_size) { + int idx; + + idx = lov_stripe_number(lsm, start); + if (idx == stripe || + unlikely(lov_r0(lov)->lo_sub[idx] == NULL)) { + idx = lov_stripe_number(lsm, end); + if (idx == stripe || + unlikely(lov_r0(lov)->lo_sub[idx] == NULL)) + result = 1; + } + } + + if (result != 0) { struct cl_lock_descr *subd = &lov_env_info(env)->lti_ldescr; u64 sub_start; u64 sub_end; diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index b2ed52f20afb..02781576637e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -1011,9 +1011,13 @@ static int lov_recreate(struct obd_export *exp, struct obdo *src_oa, } for (i = 0; i < lsm->lsm_stripe_count; i++) { - if (lsm->lsm_oinfo[i]->loi_ost_idx == ost_idx) { - if (ostid_id(&lsm->lsm_oinfo[i]->loi_oi) != - ostid_id(&src_oa->o_oi)) { + struct lov_oinfo *loi = lsm->lsm_oinfo[i]; + + if (lov_oinfo_is_dummy(loi)) + continue; + + if (loi->loi_ost_idx == ost_idx) { + if (ostid_id(&loi->loi_oi) != ostid_id(&src_oa->o_oi)) { rc = -EINVAL; goto out; } @@ -1305,10 +1309,14 @@ static int lov_find_cbdata(struct obd_export *exp, struct lov_stripe_md submd; struct lov_oinfo *loi = lsm->lsm_oinfo[i]; + if (lov_oinfo_is_dummy(loi)) + continue; + if (!lov->lov_tgts[loi->loi_ost_idx]) { - CDEBUG(D_HA, "lov idx %d NULL \n", loi->loi_ost_idx); + CDEBUG(D_HA, "lov idx %d NULL\n", loi->loi_ost_idx); continue; } + submd.lsm_oi = loi->loi_oi; submd.lsm_stripe_count = 0; rc = obd_find_cbdata(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp, @@ -1616,8 +1624,12 @@ static u64 fiemap_calc_fm_end_offset(struct ll_user_fiemap *fiemap, /* Find out stripe_no from ost_index saved in the fe_device */ for (i = 0; i < lsm->lsm_stripe_count; i++) { - if (lsm->lsm_oinfo[i]->loi_ost_idx == - fiemap->fm_extents[0].fe_device) { + struct lov_oinfo *oinfo = lsm->lsm_oinfo[i]; + + if (lov_oinfo_is_dummy(oinfo)) + continue; + + if (oinfo->loi_ost_idx == fiemap->fm_extents[0].fe_device) { stripe_no = i; break; } @@ -1795,6 +1807,11 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key, &lun_start, &obd_object_end)) == 0) continue; + if (lov_oinfo_is_dummy(lsm->lsm_oinfo[cur_stripe])) { + rc = -EIO; + goto out; + } + /* If this is a continuation FIEMAP call and we are on * starting stripe then lun_start needs to be set to * fm_end_offset */ @@ -1985,6 +2002,9 @@ static int lov_get_info(const struct lu_env *env, struct obd_export *exp, * be NULL and won't match the lock's export. */ for (i = 0; i < lsm->lsm_stripe_count; i++) { loi = lsm->lsm_oinfo[i]; + if (lov_oinfo_is_dummy(loi)) + continue; + if (!lov->lov_tgts[loi->loi_ost_idx]) continue; if (lov->lov_tgts[loi->loi_ost_idx]->ltd_exp == diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index d69a0354baf5..1fb1dfae6f72 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -230,6 +230,9 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_oinfo *oinfo = lsm->lsm_oinfo[i]; int ost_idx = oinfo->loi_ost_idx; + if (lov_oinfo_is_dummy(oinfo)) + continue; + result = ostid_to_fid(ofid, &oinfo->loi_oi, oinfo->loi_ost_idx); if (result != 0) @@ -973,6 +976,10 @@ int lov_read_and_clear_async_rc(struct cl_object *clob) LASSERT(lsm != NULL); for (i = 0; i < lsm->lsm_stripe_count; i++) { struct lov_oinfo *loi = lsm->lsm_oinfo[i]; + + if (lov_oinfo_is_dummy(loi)) + continue; + if (loi->loi_ar.ar_rc && !rc) rc = loi->loi_ar.ar_rc; loi->loi_ar.ar_rc = 0; diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 7358b9d29103..933e2d1f8127 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -299,6 +299,9 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo, struct lov_request *req; loi = oinfo->oi_md->lsm_oinfo[i]; + if (lov_oinfo_is_dummy(loi)) + continue; + if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) { CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); if (oinfo->oi_oa->o_valid & OBD_MD_FLEPOCH) { @@ -384,6 +387,9 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, struct lov_request *req; loi = lsm->lsm_oinfo[i]; + if (lov_oinfo_is_dummy(loi)) + continue; + if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) { CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); continue; @@ -497,6 +503,9 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo, struct lov_oinfo *loi = oinfo->oi_md->lsm_oinfo[i]; struct lov_request *req; + if (lov_oinfo_is_dummy(loi)) + continue; + if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) { CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); continue; -- cgit v1.2.3 From 502cb58e2138dea3cef0da29021528172ff9fe58 Mon Sep 17 00:00:00 2001 From: Andriy Skulysh Date: Wed, 25 Mar 2015 22:07:07 -0400 Subject: staging/lustre/ptlrpc: fix import state during replay Client doesn't restore import state correctly on reconnect during replay. It resends lock replay when final ping was queued by server. Server fails with "target_queue_recovery_request()) ASSERTION( req->rq_export->exp_lock_replay_needed ) failed" Add imp_replay_state to store last replay state. imp_state is restored from imp_replay_state during reconnect. Signed-off-by: Andriy Skulysh Signed-off-by: Bob Glossman Xyratex-bug-id: MRP-2022 Reviewed-on: http://review.whamcloud.com/12163 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5651 Reviewed-by: Jian Yu Reviewed-by: James Simmons Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/lustre_import.h | 2 ++ drivers/staging/lustre/lustre/ptlrpc/import.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h index 51f3e98f94e2..dcc807676c49 100644 --- a/drivers/staging/lustre/lustre/include/lustre_import.h +++ b/drivers/staging/lustre/lustre/include/lustre_import.h @@ -218,6 +218,8 @@ struct obd_import { atomic_t imp_timeouts; /** Current import state */ enum lustre_imp_state imp_state; + /** Last replay state */ + enum lustre_imp_state imp_replay_state; /** History of import states */ struct import_state_hist imp_state_hist[IMP_STATE_HIST_LEN]; int imp_state_hist_idx; diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index 4ceb90db02a3..d5fc689c008b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -63,6 +63,19 @@ struct ptlrpc_connect_async_args { static void __import_set_state(struct obd_import *imp, enum lustre_imp_state state) { + switch (state) { + case LUSTRE_IMP_CLOSED: + case LUSTRE_IMP_NEW: + case LUSTRE_IMP_DISCON: + case LUSTRE_IMP_CONNECTING: + break; + case LUSTRE_IMP_REPLAY_WAIT: + imp->imp_replay_state = LUSTRE_IMP_REPLAY_LOCKS; + break; + default: + imp->imp_replay_state = LUSTRE_IMP_REPLAY; + } + imp->imp_state = state; imp->imp_state_hist[imp->imp_state_hist_idx].ish_state = state; imp->imp_state_hist[imp->imp_state_hist_idx].ish_time = @@ -966,7 +979,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, imp->imp_resend_replay = 1; spin_unlock(&imp->imp_lock); - IMPORT_SET_STATE(imp, LUSTRE_IMP_REPLAY); + IMPORT_SET_STATE(imp, imp->imp_replay_state); } else { IMPORT_SET_STATE(imp, LUSTRE_IMP_RECOVER); } -- cgit v1.2.3 From a915ffda199013a8ee2dd6a8a23b89ea45879ed3 Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Wed, 25 Mar 2015 21:53:24 -0400 Subject: staging/lustre/llite: glimpse the inode before doing fiemap For a new inode, the i_size is 0 until a stat, which will yield an empty fiemap result. Fix the issue by glimpsing the size before doing fiemap. Signed-off-by: Li Dongyang Signed-off-by: Bob Glossman Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Reviewed-on: http://review.whamcloud.com/13439 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6091 Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 6dab3baa8063..85e74d18d1c7 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1712,6 +1712,12 @@ static int ll_do_fiemap(struct inode *inode, struct ll_user_fiemap *fiemap, fm_key.oa.o_oi = lsm->lsm_oi; fm_key.oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP; + if (i_size_read(inode) == 0) { + rc = ll_glimpse_size(inode); + if (rc) + goto out; + } + obdo_from_inode(&fm_key.oa, inode, OBD_MD_FLSIZE); obdo_set_parent_fid(&fm_key.oa, &ll_i2info(inode)->lli_fid); /* If filesize is 0, then there would be no objects for mapping */ -- cgit v1.2.3 From 3ce08cd7a281e11d83ac3f92832522cf4a2f549c Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Wed, 25 Mar 2015 21:53:25 -0400 Subject: staging/lustre: update timestamps after buiding rpc The mtime/atime/ctime in the write RPC has to be updated after the RPC is built (where xid is generated), otherwise, it could race with the setattr and updating wrong timestamps on OST side. Seems this regression was introduced when landing clio code. Signed-off-by: Niu Yawei Reviewed-on: http://review.whamcloud.com/13261 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5951 Reviewed-by: John L. Hammond Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_request.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 5e27e0a9b0a1..d7a9b650df09 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1880,6 +1880,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, int page_count = 0; int i; int rc; + struct ost_body *body; LIST_HEAD(rpc_list); LASSERT(!list_empty(ext_list)); @@ -1981,6 +1982,8 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, * later setattr before earlier BRW (as determined by the request xid), * the OST will not use BRW timestamps. Sadly, there is no obvious * way to do this in a single call. bug 10150 */ + body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY); + crattr->cra_oa = &body->oa; cl_req_attr_set(env, clerq, crattr, OBD_MD_FLMTIME|OBD_MD_FLCTIME|OBD_MD_FLATIME); -- cgit v1.2.3 From d6abc59ec8440cf3677a54d6fb12afbd20f70821 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Wed, 25 Mar 2015 21:53:26 -0400 Subject: staging/lustre/xattr: xattr data may be gone with lock held Xattr cached data may be gone, but lock still held, in this case, refetch xattr from server, otherwise client will return error. Signed-off-by: Lai Siyao Reviewed-on: http://review.whamcloud.com/12952 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3544 Reviewed-by: Bobi Jam Reviewed-by: Nathaniel Clark Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/xattr_cache.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index da190f92d140..69ea92adf4f1 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -295,13 +295,18 @@ static int ll_xattr_find_get_lock(struct inode *inode, mutex_lock(&lli->lli_xattrs_enq_lock); - /* Try matching first. */ - mode = ll_take_md_lock(inode, MDS_INODELOCK_XATTR, &lockh, 0, LCK_PR); - if (mode != 0) { - /* fake oit in mdc_revalidate_lock() manner */ - oit->d.lustre.it_lock_handle = lockh.cookie; - oit->d.lustre.it_lock_mode = mode; - goto out; + /* inode may have been shrunk and recreated, so data is gone, match lock + * only when data exists. */ + if (ll_xattr_cache_valid(lli)) { + /* Try matching first. */ + mode = ll_take_md_lock(inode, MDS_INODELOCK_XATTR, &lockh, 0, + LCK_PR); + if (mode != 0) { + /* fake oit in mdc_revalidate_lock() manner */ + oit->d.lustre.it_lock_handle = lockh.cookie; + oit->d.lustre.it_lock_mode = mode; + goto out; + } } /* Enqueue if the lock isn't cached locally. */ -- cgit v1.2.3 From 855fe6ea9600a6d4b406b0d66e86e6e60ace4ef4 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 24 Mar 2015 16:22:24 +0530 Subject: staging: sm7xxfb: add MODULE_DEVICE_TABLE add MODULE_DEVICE_TABLE to support hot-plugging. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xxfb.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index abdb02115cac..5b3e6143a0ba 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -922,6 +922,8 @@ static const struct pci_device_id smtcfb_pci_table[] = { {0,} }; +MODULE_DEVICE_TABLE(pci, smtcfb_pci_table); + static void smtcfb_pci_remove(struct pci_dev *pdev) { struct smtcfb_info *sfb; -- cgit v1.2.3 From 3de08a2d14ff8c771b5f806d6186b4601b770f6f Mon Sep 17 00:00:00 2001 From: Lorenzo Stoakes Date: Fri, 20 Mar 2015 15:22:11 +0000 Subject: staging: sm750fb: Use memset_io instead of memset This patch takes into account that cursor->vstart, crtc->vScreen and share->pvMem are pointers to memory-mapped I/O and thus we should use memset_io to make this explicit. In addition, some architectures require special treatment of memory-mapped I/O so the previous code could actually break without this change. This fixes the following sparse warnings:- drivers/staging/sm750fb/sm750.c:489:17: warning: incorrect type in argument 1 (different address spaces) drivers/staging/sm750fb/sm750.c:490:17: warning: incorrect type in argument 1 (different address spaces) drivers/staging/sm750fb/sm750.c:501:17: warning: incorrect type in argument 1 (different address spaces) drivers/staging/sm750fb/sm750.c:502:17: warning: incorrect type in argument 1 (different address spaces) drivers/staging/sm750fb/sm750.c:833:5: warning: incorrect type in argument 1 (different address spaces) drivers/staging/sm750fb/sm750.c:1154:9: warning: incorrect type in argument 1 (different address spaces) Signed-off-by: Lorenzo Stoakes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index a7b1b9c50239..402bf9b0a1a2 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -486,8 +486,8 @@ static int lynxfb_resume(struct pci_dev* pdev) par = info->par; crtc = &par->crtc; cursor = &crtc->cursor; - memset(cursor->vstart, 0x0, cursor->size); - memset(crtc->vScreen,0x0,crtc->vidmem_size); + memset_io(cursor->vstart, 0x0, cursor->size); + memset_io(crtc->vScreen, 0x0, crtc->vidmem_size); lynxfb_ops_set_par(info); fb_set_suspend(info, 0); } @@ -498,8 +498,8 @@ static int lynxfb_resume(struct pci_dev* pdev) par = info->par; crtc = &par->crtc; cursor = &crtc->cursor; - memset(cursor->vstart, 0x0, cursor->size); - memset(crtc->vScreen,0x0,crtc->vidmem_size); + memset_io(cursor->vstart, 0x0, cursor->size); + memset_io(crtc->vScreen, 0x0, crtc->vidmem_size); lynxfb_ops_set_par(info); fb_set_suspend(info, 0); } @@ -830,7 +830,7 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) crtc->cursor.share = share; - memset(crtc->cursor.vstart, 0, crtc->cursor.size); + memset_io(crtc->cursor.vstart, 0, crtc->cursor.size); if(!g_hwcursor){ lynxfb_ops.fb_cursor = NULL; crtc->cursor.disable(&crtc->cursor); @@ -1151,7 +1151,7 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, } #endif - memset(share->pvMem,0,share->vidmem_size); + memset_io(share->pvMem, 0, share->vidmem_size); pr_info("sm%3x mmio address = %p\n",share->devid,share->pvReg); -- cgit v1.2.3 From d93abd15c84bd2598d0b59ab93f72bf3527cf51a Mon Sep 17 00:00:00 2001 From: Lorenzo Stoakes Date: Fri, 20 Mar 2015 15:22:12 +0000 Subject: staging: sm750fb: Make internal functions static This patch declares externally unavailable functions static. This fixes the following sparse warnings:- drivers/staging/sm750fb/ddk750_hwi2c.c:63:6: warning: symbol 'hwI2CWaitTXDone' was not declared. Should it be static? drivers/staging/sm750fb/ddk750_hwi2c.c:93:14: warning: symbol 'hwI2CWriteData' was not declared. Should it be static? drivers/staging/sm750fb/ddk750_hwi2c.c:160:14: warning: symbol 'hwI2CReadData' was not declared. Should it be static? Signed-off-by: Lorenzo Stoakes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_hwi2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c index 84dfb6f41142..7826376ed705 100644 --- a/drivers/staging/sm750fb/ddk750_hwi2c.c +++ b/drivers/staging/sm750fb/ddk750_hwi2c.c @@ -60,7 +60,7 @@ void hwI2CClose(void) } -long hwI2CWaitTXDone(void) +static long hwI2CWaitTXDone(void) { unsigned int timeout; @@ -90,7 +90,7 @@ long hwI2CWaitTXDone(void) * Return Value: * Total number of bytes those are actually written. */ -unsigned int hwI2CWriteData( +static unsigned int hwI2CWriteData( unsigned char deviceAddress, unsigned int length, unsigned char *pBuffer @@ -157,7 +157,7 @@ unsigned int hwI2CWriteData( * Return Value: * Total number of actual bytes read from the slave device */ -unsigned int hwI2CReadData( +static unsigned int hwI2CReadData( unsigned char deviceAddress, unsigned int length, unsigned char *pBuffer -- cgit v1.2.3 From 2ffbc9c6aa2c36cbdc584ef9669b9ef97c1283c1 Mon Sep 17 00:00:00 2001 From: Lorenzo Stoakes Date: Fri, 20 Mar 2015 15:22:13 +0000 Subject: staging: sm750fb: Remove unused function This patch removes the unused hw712_fillrect function. This patch fixes the following sparse warning:- drivers/staging/sm750fb/sm750_accel.c:95:5: warning: symbol 'hw712_fillrect' was not declared. Should it be static? Signed-off-by: Lorenzo Stoakes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_accel.c | 78 ----------------------------------- 1 file changed, 78 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 6521c3b3bcdc..c5a372690737 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -89,84 +89,6 @@ void hw_set2dformat(struct lynx_accel * accel,int fmt) write_dpr(accel,DE_STRETCH_FORMAT,reg); } -/* seems sm712 RectFill command is broken,so need use BitBlt to - * replace it. */ - -int hw712_fillrect(struct lynx_accel * accel, - u32 base,u32 pitch,u32 Bpp, - u32 x,u32 y,u32 width,u32 height, - u32 color,u32 rop) -{ - u32 deCtrl; - if(accel->de_wait() != 0) - { - /* int time wait and always busy,seems hardware - * got something error */ - pr_debug("%s:De engine always bussy\n",__func__); - return -1; - } - /* 24bpp 2d acceleration still not work,we already support 2d on - * both 8/16/32 bpp now, so there is no harm if we disable 2d on - * 24bpp for current stage. */ -#if 0 - if(Bpp == 3){ - width *= 3; - x *= 3; - write_dpr(accel,DE_PITCH, - FIELD_VALUE(0,DE_PITCH,DESTINATION,pitch)| - FIELD_VALUE(0,DE_PITCH,SOURCE,pitch));//dpr10 - } - else -#endif - { - write_dpr(accel,DE_PITCH, - FIELD_VALUE(0,DE_PITCH,DESTINATION,pitch/Bpp)| - FIELD_VALUE(0,DE_PITCH,SOURCE,pitch/Bpp));//dpr10 - - } - - write_dpr(accel,DE_FOREGROUND,color);//DPR14 - write_dpr(accel,DE_MONO_PATTERN_HIGH,~0);//DPR34 - write_dpr(accel,DE_MONO_PATTERN_LOW,~0);//DPR38 - - write_dpr(accel,DE_WINDOW_SOURCE_BASE,base);//dpr44 - write_dpr(accel,DE_WINDOW_DESTINATION_BASE,base);//dpr40 - - - write_dpr(accel,DE_WINDOW_WIDTH, - FIELD_VALUE(0,DE_WINDOW_WIDTH,DESTINATION,pitch/Bpp)| - FIELD_VALUE(0,DE_WINDOW_WIDTH,SOURCE,pitch/Bpp));//dpr3c - - - write_dpr(accel,DE_DESTINATION, - FIELD_SET(0,DE_DESTINATION,WRAP,DISABLE)| - FIELD_VALUE(0,DE_DESTINATION,X,x)| - FIELD_VALUE(0,DE_DESTINATION,Y,y));//dpr4 - - write_dpr(accel,DE_DIMENSION, - FIELD_VALUE(0,DE_DIMENSION,X,width)| - FIELD_VALUE(0,DE_DIMENSION,Y_ET,height));//dpr8 - - deCtrl = - FIELD_SET(0,DE_CONTROL,STATUS,START)| - FIELD_SET(0,DE_CONTROL,COMMAND,BITBLT)| - FIELD_SET(0,DE_CONTROL,ROP2_SOURCE,PATTERN)| - FIELD_SET(0,DE_CONTROL,ROP_SELECT,ROP2)| - FIELD_VALUE(0,DE_CONTROL,ROP,rop);//dpr0xc -#if 0 - /* dump registers */ - int i; - inf_msg("x,y,w,h = %d,%d,%d,%d\n",x,y,width,height); - for(i=0x04;i<=0x44;i+=4){ - inf_msg("dpr%02x = %08x\n",i,read_dpr(accel,i)); - } - inf_msg("deCtrl = %08x\n",deCtrl); -#endif - - write_dpr(accel,DE_CONTROL,deCtrl); - return 0; -} - int hw_fillrect(struct lynx_accel * accel, u32 base,u32 pitch,u32 Bpp, u32 x,u32 y,u32 width,u32 height, -- cgit v1.2.3 From 35fb80b9de08024b375d76f08591ec5b7cc57995 Mon Sep 17 00:00:00 2001 From: Lorenzo Stoakes Date: Fri, 20 Mar 2015 15:22:14 +0000 Subject: staging: sm750fb: Fix __iomem pointer types This patch annotates pointers as referring to I/O mapped memory where they ought to be, removes now unnecessary ugly casts, eliminates an incorrect deref on I/O mapped memory by using iowrite16 instead, and updates the pointer arithmetic accordingly to take into account that the pointers are now byte-sized. This fixes the following sparse warnings:- drivers/staging/sm750fb/sm750_cursor.c:113:19: warning: cast removes address space of expression drivers/staging/sm750fb/sm750_cursor.c:204:19: warning: cast removes address space of expression Signed-off-by: Lorenzo Stoakes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750_cursor.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 6cceef107c37..68d5cbc3e513 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -98,7 +98,7 @@ void hw_cursor_setData(struct lynx_cursor * cursor, int i,j,count,pitch,offset; u8 color,mask,opr; u16 data; - u16 * pbuffer,*pstart; + void __iomem *pbuffer, *pstart; /* in byte*/ pitch = cursor->w >> 3; @@ -106,11 +106,11 @@ void hw_cursor_setData(struct lynx_cursor * cursor, /* in byte */ count = pitch * cursor->h; - /* in ushort */ - offset = cursor->maxW * 2 / 8 / 2; + /* in byte */ + offset = cursor->maxW * 2 / 8; data = 0; - pstart = (u16 *)cursor->vstart; + pstart = cursor->vstart; pbuffer = pstart; /* @@ -161,7 +161,7 @@ void hw_cursor_setData(struct lynx_cursor * cursor, } } #endif - *pbuffer = data; + iowrite16(data, pbuffer); /* assume pitch is 1,2,4,8,...*/ #if 0 @@ -174,7 +174,7 @@ void hw_cursor_setData(struct lynx_cursor * cursor, pstart += offset; pbuffer = pstart; }else{ - pbuffer++; + pbuffer += sizeof(u16); } } @@ -189,7 +189,7 @@ void hw_cursor_setData2(struct lynx_cursor * cursor, int i,j,count,pitch,offset; u8 color, mask; u16 data; - u16 * pbuffer,*pstart; + void __iomem *pbuffer, *pstart; /* in byte*/ pitch = cursor->w >> 3; @@ -197,11 +197,11 @@ void hw_cursor_setData2(struct lynx_cursor * cursor, /* in byte */ count = pitch * cursor->h; - /* in ushort */ - offset = cursor->maxW * 2 / 8 / 2; + /* in byte */ + offset = cursor->maxW * 2 / 8; data = 0; - pstart = (u16 *)cursor->vstart; + pstart = cursor->vstart; pbuffer = pstart; for(i=0;i Date: Fri, 20 Mar 2015 15:22:15 +0000 Subject: staging: sm750fb: Remove spinlock helper function This patch removes the unnecessary spinlock helper function and instead calls spin_lock and spin_unlock directly. This does *not* resolve sparse warnings about context imbalances but these are spurious. Signed-off-by: Lorenzo Stoakes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 53 +++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 402bf9b0a1a2..4074375441c8 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -56,23 +56,6 @@ static char * g_settings = NULL; static int g_dualview; static char * g_option = NULL; -/* if not use spin_lock,system will die if user load driver - * and immediatly unload driver frequently (dual)*/ -static inline void myspin_lock(spinlock_t * sl){ - struct lynx_share * share; - share = container_of(sl,struct lynx_share,slock); - if(share->dual){ - spin_lock(sl); - } -} - -static inline void myspin_unlock(spinlock_t * sl){ - struct lynx_share * share; - share = container_of(sl,struct lynx_share,slock); - if(share->dual){ - spin_unlock(sl); - } -} static const struct fb_videomode lynx750_ext[] = { /* 1024x600-60 VESA [1.71:1] */ {NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3, @@ -209,13 +192,21 @@ static void lynxfb_ops_fillrect(struct fb_info* info,const struct fb_fillrect* r color = (Bpp == 1)?region->color:((u32*)info->pseudo_palette)[region->color]; rop = ( region->rop != ROP_COPY ) ? HW_ROP2_XOR:HW_ROP2_COPY; - myspin_lock(&share->slock); + /* + * If not use spin_lock,system will die if user load driver + * and immediatly unload driver frequently (dual) + */ + if (share->dual) + spin_lock(&share->slock); + share->accel.de_fillrect(&share->accel, base,pitch,Bpp, region->dx,region->dy, region->width,region->height, color,rop); - myspin_unlock(&share->slock); + + if (share->dual) + spin_unlock(&share->slock); } static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea * region) @@ -233,12 +224,20 @@ static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea * pitch = info->fix.line_length; Bpp = info->var.bits_per_pixel >> 3; - myspin_lock(&share->slock); + /* + * If not use spin_lock, system will die if user load driver + * and immediatly unload driver frequently (dual) + */ + if (share->dual) + spin_lock(&share->slock); + share->accel.de_copyarea(&share->accel, base,pitch,region->sx,region->sy, base,pitch,Bpp,region->dx,region->dy, region->width,region->height,HW_ROP2_COPY); - myspin_unlock(&share->slock); + + if (share->dual) + spin_unlock(&share->slock); } static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* image) @@ -272,14 +271,22 @@ static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* imag } return; _do_work: - myspin_lock(&share->slock); + /* + * If not use spin_lock, system will die if user load driver + * and immediatly unload driver frequently (dual) + */ + if (share->dual) + spin_lock(&share->slock); + share->accel.de_imageblit(&share->accel, image->data,image->width>>3,0, base,pitch,Bpp, image->dx,image->dy, image->width,image->height, fgcol,bgcol,HW_ROP2_COPY); - myspin_unlock(&share->slock); + + if (share->dual) + spin_unlock(&share->slock); } static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, -- cgit v1.2.3 From 3b143b5503a7ee5e9b6fdd97cb1cacc0d320786e Mon Sep 17 00:00:00 2001 From: Kozhevnikov Anatoly Date: Fri, 20 Mar 2015 18:37:54 +0300 Subject: staging: fbtft: Add support for ili9163 controller Driver for ili9163-based displays (for example: Nokia 5110) Signed-off-by: Kozhevnikov Anatoly Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/Kconfig | 6 + drivers/staging/fbtft/Makefile | 1 + drivers/staging/fbtft/fb_ili9163.c | 303 +++++++++++++++++++++++++++++++++++ drivers/staging/fbtft/fbtft_device.c | 18 +++ 4 files changed, 328 insertions(+) create mode 100644 drivers/staging/fbtft/fb_ili9163.c (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig index 995a9101a080..6cf0c58f538b 100644 --- a/drivers/staging/fbtft/Kconfig +++ b/drivers/staging/fbtft/Kconfig @@ -38,6 +38,12 @@ config FB_TFT_HX8353D help Generic Framebuffer support for HX8353D +config FB_TFT_ILI9163 + tristate "FB driver for the ILI9163 LCD Controller" + depends on FB_TFT + help + Generic Framebuffer support for ILI9163 + config FB_TFT_ILI9320 tristate "FB driver for the ILI9320 LCD Controller" depends on FB_TFT diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile index e773f0fdcfe8..9e73beee23f4 100644 --- a/drivers/staging/fbtft/Makefile +++ b/drivers/staging/fbtft/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_FB_TFT_BD663474) += fb_bd663474.o obj-$(CONFIG_FB_TFT_HX8340BN) += fb_hx8340bn.o obj-$(CONFIG_FB_TFT_HX8347D) += fb_hx8347d.o obj-$(CONFIG_FB_TFT_HX8353D) += fb_hx8353d.o +obj-$(CONFIG_FB_TFT_ILI9163) += fb_ili9163.o obj-$(CONFIG_FB_TFT_ILI9320) += fb_ili9320.o obj-$(CONFIG_FB_TFT_ILI9325) += fb_ili9325.o obj-$(CONFIG_FB_TFT_ILI9340) += fb_ili9340.o diff --git a/drivers/staging/fbtft/fb_ili9163.c b/drivers/staging/fbtft/fb_ili9163.c new file mode 100644 index 000000000000..ed92a64306ff --- /dev/null +++ b/drivers/staging/fbtft/fb_ili9163.c @@ -0,0 +1,303 @@ +/* + * FB driver for the ILI9163 LCD Controller + * + * Copyright (C) 2015 Kozhevnikov Anatoly + * + * Based on ili9325.c by Noralf Tronnes and + * .S.U.M.O.T.O.Y. by Max MC Costa (https://github.com/sumotoy/TFT_ILI9163C). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include + +#include "fbtft.h" + +#define DRVNAME "fb_ili9163" +#define WIDTH 128 +#define HEIGHT 128 +#define BPP 16 +#define FPS 30 + +#ifdef GAMMA_ADJ +#define GAMMA_LEN 15 +#define GAMMA_NUM 1 +#define DEFAULT_GAMMA "36 29 12 22 1C 15 42 B7 2F 13 12 0A 11 0B 06\n" +#endif + +/* ILI9163C commands */ +#define CMD_NOP 0x00 /* Non operation*/ +#define CMD_SWRESET 0x01 /* Soft Reset */ +#define CMD_SLPIN 0x10 /* Sleep ON */ +#define CMD_SLPOUT 0x11 /* Sleep OFF */ +#define CMD_PTLON 0x12 /* Partial Mode ON */ +#define CMD_NORML 0x13 /* Normal Display ON */ +#define CMD_DINVOF 0x20 /* Display Inversion OFF */ +#define CMD_DINVON 0x21 /* Display Inversion ON */ +#define CMD_GAMMASET 0x26 /* Gamma Set (0x01[1],0x02[2],0x04[3],0x08[4]) */ +#define CMD_DISPOFF 0x28 /* Display OFF */ +#define CMD_DISPON 0x29 /* Display ON */ +#define CMD_IDLEON 0x39 /* Idle Mode ON */ +#define CMD_IDLEOF 0x38 /* Idle Mode OFF */ +#define CMD_CLMADRS 0x2A /* Column Address Set */ +#define CMD_PGEADRS 0x2B /* Page Address Set */ + +#define CMD_RAMWR 0x2C /* Memory Write */ +#define CMD_RAMRD 0x2E /* Memory Read */ +#define CMD_CLRSPACE 0x2D /* Color Space : 4K/65K/262K */ +#define CMD_PARTAREA 0x30 /* Partial Area */ +#define CMD_VSCLLDEF 0x33 /* Vertical Scroll Definition */ +#define CMD_TEFXLON 0x34 /* Tearing Effect Line ON */ +#define CMD_TEFXLOF 0x35 /* Tearing Effect Line OFF */ +#define CMD_MADCTL 0x36 /* Memory Access Control */ + +#define CMD_PIXFMT 0x3A /* Interface Pixel Format */ +#define CMD_FRMCTR1 0xB1 /* Frame Rate Control + (In normal mode/Full colors) */ +#define CMD_FRMCTR2 0xB2 /* Frame Rate Control (In Idle mode/8-colors) */ +#define CMD_FRMCTR3 0xB3 /* Frame Rate Control + (In Partial mode/full colors) */ +#define CMD_DINVCTR 0xB4 /* Display Inversion Control */ +#define CMD_RGBBLK 0xB5 /* RGB Interface Blanking Porch setting */ +#define CMD_DFUNCTR 0xB6 /* Display Function set 5 */ +#define CMD_SDRVDIR 0xB7 /* Source Driver Direction Control */ +#define CMD_GDRVDIR 0xB8 /* Gate Driver Direction Control */ + +#define CMD_PWCTR1 0xC0 /* Power_Control1 */ +#define CMD_PWCTR2 0xC1 /* Power_Control2 */ +#define CMD_PWCTR3 0xC2 /* Power_Control3 */ +#define CMD_PWCTR4 0xC3 /* Power_Control4 */ +#define CMD_PWCTR5 0xC4 /* Power_Control5 */ +#define CMD_VCOMCTR1 0xC5 /* VCOM_Control 1 */ +#define CMD_VCOMCTR2 0xC6 /* VCOM_Control 2 */ +#define CMD_VCOMOFFS 0xC7 /* VCOM Offset Control */ +#define CMD_PGAMMAC 0xE0 /* Positive Gamma Correction Setting */ +#define CMD_NGAMMAC 0xE1 /* Negative Gamma Correction Setting */ +#define CMD_GAMRSEL 0xF2 /* GAM_R_SEL */ + +/* +This display: +http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-Color-TFT-LCD-Display-Module-/271422122271 +This particular display has a design error! The controller has 3 pins to +configure to constrain the memory and resolution to a fixed dimension (in +that case 128x128) but they leaved those pins configured for 128x160 so +there was several pixel memory addressing problems. +I solved by setup several parameters that dinamically fix the resolution as +needit so below the parameters for this display. If you have a strain or a +correct display (can happen with chinese) you can copy those parameters and +create setup for different displays. +*/ + +#ifdef RED +#define __OFFSET 32 /*see note 2 - this is the red version */ +#else +#define __OFFSET 0 /*see note 2 - this is the black version */ +#endif + +static int init_display(struct fbtft_par *par) +{ + fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); + + par->fbtftops.reset(par); + + if (par->gpio.cs != -1) + gpio_set_value(par->gpio.cs, 0); /* Activate chip */ + + write_reg(par, CMD_SWRESET); /* software reset */ + mdelay(500); + write_reg(par, CMD_SLPOUT); /* exit sleep */ + mdelay(5); + write_reg(par, CMD_PIXFMT, 0x05); /* Set Color Format 16bit */ + write_reg(par, CMD_GAMMASET, 0x02); /* default gamma curve 3 */ +#ifdef GAMMA_ADJ + write_reg(par, CMD_GAMRSEL, 0x01); /* Enable Gamma adj */ +#endif + write_reg(par, CMD_NORML); + write_reg(par, CMD_DFUNCTR, 0xff, 0x06); + /* Frame Rate Control (In normal mode/Full colors) */ + write_reg(par, CMD_FRMCTR1, 0x08, 0x02); + write_reg(par, CMD_DINVCTR, 0x07); /* display inversion */ + /* Set VRH1[4:0] & VC[2:0] for VCI1 & GVDD */ + write_reg(par, CMD_PWCTR1, 0x0A, 0x02); + /* Set BT[2:0] for AVDD & VCL & VGH & VGL */ + write_reg(par, CMD_PWCTR2, 0x02); + /* Set VMH[6:0] & VML[6:0] for VOMH & VCOML */ + write_reg(par, CMD_VCOMCTR1, 0x50, 0x63); + write_reg(par, CMD_VCOMOFFS, 0); + + write_reg(par, CMD_CLMADRS, 0, 0, 0, WIDTH); /* Set Column Address */ + write_reg(par, CMD_PGEADRS, 0, 0, 0, HEIGHT); /* Set Page Address */ + + write_reg(par, CMD_DISPON); /* display ON */ + write_reg(par, CMD_RAMWR); /* Memory Write */ + + return 0; +} + +static void set_addr_win(struct fbtft_par *par, int xs, int ys, + int xe, int ye) +{ + fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, + "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); + + switch (par->info->var.rotate) { + case 0: + write_reg(par, CMD_CLMADRS, xs >> 8, xs & 0xff, xe >> 8, + xe & 0xff); + write_reg(par, CMD_PGEADRS, + (ys + __OFFSET) >> 8, (ys + __OFFSET) & 0xff, + (ye + __OFFSET) >> 8, (ye + __OFFSET) & 0xff); + break; + case 90: + write_reg(par, CMD_CLMADRS, + (xs + __OFFSET) >> 8, (xs + __OFFSET) & 0xff, + (xe + __OFFSET) >> 8, (xe + __OFFSET) & 0xff); + write_reg(par, CMD_PGEADRS, ys >> 8, ys & 0xff, ye >> 8, + ye & 0xff); + break; + case 180: + case 270: + write_reg(par, CMD_CLMADRS, xs >> 8, xs & 0xff, xe >> 8, + xe & 0xff); + write_reg(par, CMD_PGEADRS, ys >> 8, ys & 0xff, ye >> 8, + ye & 0xff); + break; + default: + par->info->var.rotate = 0; /* Fix incorrect setting */ + } + write_reg(par, CMD_RAMWR); /* Write Data to GRAM mode */ +} + +/* +7) MY: 1(bottom to top), 0(top to bottom) Row Address Order +6) MX: 1(R to L), 0(L to R) Column Address Order +5) MV: 1(Exchanged), 0(normal) Row/Column exchange +4) ML: 1(bottom to top), 0(top to bottom) Vertical Refresh Order +3) RGB: 1(BGR), 0(RGB) Color Space +2) MH: 1(R to L), 0(L to R) Horizontal Refresh Order +1) +0) + + MY, MX, MV, ML,RGB, MH, D1, D0 + 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 //normal + 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 //Y-Mirror + 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 //X-Mirror + 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 //X-Y-Mirror + 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 //X-Y Exchange + 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 //X-Y Exchange, Y-Mirror + 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 //XY exchange + 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 +*/ +static int set_var(struct fbtft_par *par) +{ + u8 mactrl_data = 0; /* Avoid compiler warning */ + + fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); + + switch (par->info->var.rotate) { + case 0: + mactrl_data = 0x08; + break; + case 180: + mactrl_data = 0xC8; + break; + case 270: + mactrl_data = 0xA8; + break; + case 90: + mactrl_data = 0x68; + break; + } + + /* Colorspcae */ + if (par->bgr) + mactrl_data |= (1 << 2); + write_reg(par, CMD_MADCTL, mactrl_data); + write_reg(par, CMD_RAMWR); /* Write Data to GRAM mode */ + return 0; +} + +#ifdef GAMMA_ADJ +#define CURVE(num, idx) curves[num*par->gamma.num_values + idx] +static int gamma_adj(struct fbtft_par *par, unsigned long *curves) +{ + unsigned long mask[] = { + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x1f, 0x3f, 0x0f, 0x0f, 0x7f, 0x1f, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F}; + int i, j; + + fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); + + for (i = 0; i < GAMMA_NUM; i++) + for (j = 0; j < GAMMA_LEN; j++) + CURVE(i, j) &= mask[i*par->gamma.num_values + j]; + + write_reg(par, CMD_PGAMMAC, + CURVE(0, 0), + CURVE(0, 1), + CURVE(0, 2), + CURVE(0, 3), + CURVE(0, 4), + CURVE(0, 5), + CURVE(0, 6), + (CURVE(0, 7) << 4) | CURVE(0, 8), + CURVE(0, 9), + CURVE(0, 10), + CURVE(0, 11), + CURVE(0, 12), + CURVE(0, 13), + CURVE(0, 14), + CURVE(0, 15) + ); + + write_reg(par, CMD_RAMWR); /* Write Data to GRAM mode */ + + return 0; +} +#undef CURVE +#endif + +static struct fbtft_display display = { + .regwidth = 8, + .width = WIDTH, + .height = HEIGHT, + .bpp = BPP, + .fps = FPS, +#ifdef GAMMA_ADJ + .gamma_num = GAMMA_NUM, + .gamma_len = GAMMA_LEN, + .gamma = DEFAULT_GAMMA, +#endif + .fbtftops = { + .init_display = init_display, + .set_addr_win = set_addr_win, + .set_var = set_var, +#ifdef GAMMA_ADJ + .set_gamma = gamma_adj, +#endif + }, +}; + +FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9163", &display); + +MODULE_ALIAS("spi:" DRVNAME); +MODULE_ALIAS("platform:" DRVNAME); +MODULE_ALIAS("spi:ili9163"); +MODULE_ALIAS("platform:ili9163"); + +MODULE_DESCRIPTION("FB driver for the ILI9163 LCD Controller"); +MODULE_AUTHOR("Kozhevnikov Anatoly"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 1880864c4d7c..df6cd775ac1e 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -702,6 +702,24 @@ static struct fbtft_device_display displays[] = { } } }, { + .name = "nokia5110", + .spi = &(struct spi_board_info) { + .modalias = "fb_ili9163", + .max_speed_hz = 12000000, + .mode = SPI_MODE_0, + .platform_data = &(struct fbtft_platform_data) { + .display = { + .buswidth = 8, + .backlight = 1, + }, + .bgr = true, + .gpios = (const struct fbtft_gpio []) { + {}, + }, + } + } + }, { + .name = "piscreen", .spi = &(struct spi_board_info) { .modalias = "fb_ili9486", -- cgit v1.2.3 From 14cf23b155a343631adace6d41e5ace3cefb8339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udio=20Maia?= Date: Fri, 20 Mar 2015 16:31:45 +0000 Subject: Staging: fbtft: fb_pcd8544: Fix warning line over 80 characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes the following checkpatch warning: WARNING: line over 80 characters Signed-off-by: Cláudio Maia Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_pcd8544.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_pcd8544.c b/drivers/staging/fbtft/fb_pcd8544.c index b13162c35508..2d56213f1187 100644 --- a/drivers/staging/fbtft/fb_pcd8544.c +++ b/drivers/staging/fbtft/fb_pcd8544.c @@ -94,7 +94,8 @@ static int init_display(struct fbtft_par *par) static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) { - fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); + fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", + __func__, xs, ys, xe, ye); /* H=0 Set X address of RAM */ write_reg(par, 0x80); /* 7:1 1 -- cgit v1.2.3 From 4178549e4c477502e33e0cede28678faff44ad3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udio=20Maia?= Date: Fri, 20 Mar 2015 16:31:46 +0000 Subject: Staging: fbtft: fb_pcd8544: Fix comments style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes the following errors by refactoring the comments' style: WARNING: line over 80 characters ERROR: code indent should use tabs where possible Signed-off-by: Cláudio Maia Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_pcd8544.c | 107 ++++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 48 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_pcd8544.c b/drivers/staging/fbtft/fb_pcd8544.c index 2d56213f1187..15da0ec77513 100644 --- a/drivers/staging/fbtft/fb_pcd8544.c +++ b/drivers/staging/fbtft/fb_pcd8544.c @@ -34,7 +34,7 @@ #define WIDTH 84 #define HEIGHT 48 #define TXBUFLEN (84*6) -#define DEFAULT_GAMMA "40" /* gamma is used to control contrast in this driver */ +#define DEFAULT_GAMMA "40" /* gamma controls the contrast in this driver */ static unsigned tc; module_param(tc, uint, 0); @@ -51,43 +51,50 @@ static int init_display(struct fbtft_par *par) par->fbtftops.reset(par); - /* Function set */ - write_reg(par, 0x21); /* 5:1 1 - 2:0 PD - Powerdown control: chip is active - 1:0 V - Entry mode: horizontal addressing - 0:1 H - Extended instruction set control: extended - */ - - /* H=1 Temperature control */ - write_reg(par, 0x04 | (tc & 0x3)); /* - 2:1 1 - 1:x TC1 - Temperature Coefficient: 0x10 - 0:x TC0 - */ - - /* H=1 Bias system */ - write_reg(par, 0x10 | (bs & 0x7)); /* - 4:1 1 - 3:0 0 - 2:x BS2 - Bias System - 1:x BS1 - 0:x BS0 - */ - - /* Function set */ - write_reg(par, 0x22); /* 5:1 1 - 2:0 PD - Powerdown control: chip is active - 1:1 V - Entry mode: vertical addressing - 0:0 H - Extended instruction set control: basic - */ - - /* H=0 Display control */ - write_reg(par, 0x08 | 4); /* - 3:1 1 - 2:1 D - DE: 10=normal mode - 1:0 0 - 0:0 E - */ + /* Function set + * + * 5:1 1 + * 2:0 PD - Powerdown control: chip is active + * 1:0 V - Entry mode: horizontal addressing + * 0:1 H - Extended instruction set control: extended + */ + write_reg(par, 0x21); + + /* H=1 Temperature control + * + * 2:1 1 + * 1:x TC1 - Temperature Coefficient: 0x10 + * 0:x TC0 + */ + write_reg(par, 0x04 | (tc & 0x3)); + + /* H=1 Bias system + * + * 4:1 1 + * 3:0 0 + * 2:x BS2 - Bias System + * 1:x BS1 + * 0:x BS0 + */ + write_reg(par, 0x10 | (bs & 0x7)); + + /* Function set + * + * 5:1 1 + * 2:0 PD - Powerdown control: chip is active + * 1:1 V - Entry mode: vertical addressing + * 0:0 H - Extended instruction set control: basic + */ + write_reg(par, 0x22); + + /* H=0 Display control + * + * 3:1 1 + * 2:1 D - DE: 10=normal mode + * 1:0 0 + * 0:0 E + */ + write_reg(par, 0x08 | 4); return 0; } @@ -97,16 +104,20 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); - /* H=0 Set X address of RAM */ - write_reg(par, 0x80); /* 7:1 1 - 6-0: X[6:0] - 0x00 - */ - - /* H=0 Set Y address of RAM */ - write_reg(par, 0x40); /* 7:0 0 - 6:1 1 - 2-0: Y[2:0] - 0x0 - */ + /* H=0 Set X address of RAM + * + * 7:1 1 + * 6-0: X[6:0] - 0x00 + */ + write_reg(par, 0x80); + + /* H=0 Set Y address of RAM + * + * 7:0 0 + * 6:1 1 + * 2-0: Y[2:0] - 0x0 + */ + write_reg(par, 0x40); } static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) -- cgit v1.2.3 From 92def781ee757ba384ecc618004a9419d04ea749 Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Sat, 21 Mar 2015 11:48:37 +0900 Subject: staging: fbtft: Fix typo in fbtft This patch fix spelling typo in comment and printk within fbtft Signed-off-by: Masanari Iida Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_agm1264k-fl.c | 6 +++--- drivers/staging/fbtft/fb_hx8340bn.c | 2 +- drivers/staging/fbtft/fb_hx8353d.c | 2 +- drivers/staging/fbtft/fb_ili9340.c | 2 +- drivers/staging/fbtft/fb_ili9341.c | 4 ++-- drivers/staging/fbtft/fb_ili9481.c | 2 +- drivers/staging/fbtft/fb_ili9486.c | 2 +- drivers/staging/fbtft/fb_ra8875.c | 2 +- drivers/staging/fbtft/fb_s6d02a1.c | 2 +- drivers/staging/fbtft/fb_st7735r.c | 2 +- drivers/staging/fbtft/fb_tinylcd.c | 2 +- drivers/staging/fbtft/fbtft-core.c | 2 +- drivers/staging/fbtft/fbtft.h | 4 ++-- 13 files changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c index 939b7b963043..8f5af1db852c 100644 --- a/drivers/staging/fbtft/fb_agm1264k-fl.c +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c @@ -174,7 +174,7 @@ request_gpios_match(struct fbtft_par *par, const struct fbtft_gpio *gpio) /* This function oses to enter commands * first byte - destination controller 0 or 1 - * folowing - commands + * following - commands */ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) { @@ -199,7 +199,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) if (*buf > 1) { va_end(args); dev_err(par->info->device, - "Incorrect chip sellect request (%d)\n", *buf); + "Incorrect chip select request (%d)\n", *buf); return; } @@ -278,7 +278,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) int x, y; int ret = 0; - /* buffer to convert RGB565 -> grayscale16 -> Ditherd image 1bpp */ + /* buffer to convert RGB565 -> grayscale16 -> Dithered image 1bpp */ signed short *convert_buf = kmalloc(par->info->var.xres * par->info->var.yres * sizeof(signed short), GFP_NOIO); diff --git a/drivers/staging/fbtft/fb_hx8340bn.c b/drivers/staging/fbtft/fb_hx8340bn.c index cfe2b5b805cb..54528aa0c0ef 100644 --- a/drivers/staging/fbtft/fb_hx8340bn.c +++ b/drivers/staging/fbtft/fb_hx8340bn.c @@ -4,7 +4,7 @@ * This display uses 9-bit SPI: Data/Command bit + 8 data bits * For platforms that doesn't support 9-bit, the driver is capable * of emulating this using 8-bit transfer. - * This is done by transfering eight 9-bit words in 9 bytes. + * This is done by transferring eight 9-bit words in 9 bytes. * * Copyright (C) 2013 Noralf Tronnes * diff --git a/drivers/staging/fbtft/fb_hx8353d.c b/drivers/staging/fbtft/fb_hx8353d.c index ca52465715d2..d7f4308e1249 100644 --- a/drivers/staging/fbtft/fb_hx8353d.c +++ b/drivers/staging/fbtft/fb_hx8353d.c @@ -84,7 +84,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) /* column address */ write_reg(par, 0x2a, xs >> 8, xs & 0xff, xe >> 8, xe & 0xff); - /* row adress */ + /* Row address */ write_reg(par, 0x2b, ys >> 8, ys & 0xff, ye >> 8, ye & 0xff); /* memory write */ diff --git a/drivers/staging/fbtft/fb_ili9340.c b/drivers/staging/fbtft/fb_ili9340.c index c8698710e108..0f4a42f89e5e 100644 --- a/drivers/staging/fbtft/fb_ili9340.c +++ b/drivers/staging/fbtft/fb_ili9340.c @@ -104,7 +104,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) /* Column address */ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); - /* Row adress */ + /* Row address */ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); /* Memory write */ diff --git a/drivers/staging/fbtft/fb_ili9341.c b/drivers/staging/fbtft/fb_ili9341.c index 225b2d84371f..709492e560b6 100644 --- a/drivers/staging/fbtft/fb_ili9341.c +++ b/drivers/staging/fbtft/fb_ili9341.c @@ -4,7 +4,7 @@ * This display uses 9-bit SPI: Data/Command bit + 8 data bits * For platforms that doesn't support 9-bit, the driver is capable * of emulating this using 8-bit transfer. - * This is done by transfering eight 9-bit words in 9 bytes. + * This is done by transferring eight 9-bit words in 9 bytes. * * Copyright (C) 2013 Christian Vogelgsang * Based on adafruit22fb.c by Noralf Tronnes @@ -89,7 +89,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) write_reg(par, 0x2A, (xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF); - /* Row adress set */ + /* Row address set */ write_reg(par, 0x2B, (ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF); diff --git a/drivers/staging/fbtft/fb_ili9481.c b/drivers/staging/fbtft/fb_ili9481.c index 725157a1ac41..8bae09c2d5ce 100644 --- a/drivers/staging/fbtft/fb_ili9481.c +++ b/drivers/staging/fbtft/fb_ili9481.c @@ -63,7 +63,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) /* column address */ write_reg(par, 0x2a, xs >> 8, xs & 0xff, xe >> 8, xe & 0xff); - /* row adress */ + /* Row address */ write_reg(par, 0x2b, ys >> 8, ys & 0xff, ye >> 8, ye & 0xff); /* memory write */ diff --git a/drivers/staging/fbtft/fb_ili9486.c b/drivers/staging/fbtft/fb_ili9486.c index 5ce3e201aac0..dd4ddca384ad 100644 --- a/drivers/staging/fbtft/fb_ili9486.c +++ b/drivers/staging/fbtft/fb_ili9486.c @@ -67,7 +67,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) /* Column address */ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); - /* Row adress */ + /* Row address */ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); /* Memory write */ diff --git a/drivers/staging/fbtft/fb_ra8875.c b/drivers/staging/fbtft/fb_ra8875.c index e21af6c5a95f..2c4d4dc70c51 100644 --- a/drivers/staging/fbtft/fb_ra8875.c +++ b/drivers/staging/fbtft/fb_ra8875.c @@ -11,7 +11,7 @@ ***** * * Date : 10.06.2014 * * Version : V1.13 ***** - Revison : 5 + Revision : 5 ******************************************************************************* * This program is free software; you can redistribute it and/or modify diff --git a/drivers/staging/fbtft/fb_s6d02a1.c b/drivers/staging/fbtft/fb_s6d02a1.c index c87aa253064d..f3302525ec00 100644 --- a/drivers/staging/fbtft/fb_s6d02a1.c +++ b/drivers/staging/fbtft/fb_s6d02a1.c @@ -108,7 +108,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) /* Column address */ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); - /* Row adress */ + /* Row address */ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); /* Memory write */ diff --git a/drivers/staging/fbtft/fb_st7735r.c b/drivers/staging/fbtft/fb_st7735r.c index 2a614d5ba264..9d874308447e 100644 --- a/drivers/staging/fbtft/fb_st7735r.c +++ b/drivers/staging/fbtft/fb_st7735r.c @@ -102,7 +102,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) /* Column address */ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); - /* Row adress */ + /* Row address */ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); /* Memory write */ diff --git a/drivers/staging/fbtft/fb_tinylcd.c b/drivers/staging/fbtft/fb_tinylcd.c index ca98bfb5c7df..c0b1a337fafd 100644 --- a/drivers/staging/fbtft/fb_tinylcd.c +++ b/drivers/staging/fbtft/fb_tinylcd.c @@ -70,7 +70,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) /* Column address */ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); - /* Row adress */ + /* Row address */ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); /* Memory write */ diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 16c726030f37..53b748be2712 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -338,7 +338,7 @@ static void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, write_reg(par, 0x2A, (xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF); - /* Row adress set */ + /* Row address set */ write_reg(par, 0x2B, (ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF); diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index f55cc5b77c15..9fd98cb53418 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -147,7 +147,7 @@ struct fbtft_display { /** * struct fbtft_platform_data - Passes display specific data to the driver * @display: Display properties - * @gpios: Pointer to an array of piname to gpio mappings + * @gpios: Pointer to an array of pinname to gpio mappings * @rotate: Display rotation angle * @bgr: LCD Controller BGR bit * @fps: Frames per second (this will go away, use @fps in @fbtft_display) @@ -200,7 +200,7 @@ struct fbtft_platform_data { * @gpio.cs: LCD Chip Select with parallel interface bus * @gpio.db[16]: Parallel databus * @gpio.led[16]: Led control signals - * @gpio.aux[16]: Auxillary signals, not used by core + * @gpio.aux[16]: Auxiliary signals, not used by core * @init_sequence: Pointer to LCD initialization array * @gamma.lock: Mutex for Gamma curve locking * @gamma.curves: Pointer to Gamma curve array -- cgit v1.2.3 From ea07278681c9738b8da96670be20898cd40c7bfe Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 24 Mar 2015 11:10:09 -0700 Subject: staging: rtl8723au: Remove uses of MAC_FMT and MAC_ARG Use the standard vsprintf kernel extension to format mac addresses. This reduces object code size a bit. Miscellanea: o Coalesce formats o Realign arguments o Remove the now unused MAC_FMT and MAC_ARG #defines Signed-off-by: Joe Perches Acked-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_ap.c | 41 ++++++------- drivers/staging/rtl8723au/core/rtw_mlme.c | 26 ++++---- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 72 +++++++++++------------ drivers/staging/rtl8723au/core/rtw_recv.c | 42 +++++-------- drivers/staging/rtl8723au/core/rtw_wlan_util.c | 6 +- drivers/staging/rtl8723au/core/rtw_xmit.c | 8 +-- drivers/staging/rtl8723au/include/ieee80211.h | 3 - drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 18 +++--- drivers/staging/rtl8723au/os_dep/os_intfs.c | 7 +-- 9 files changed, 101 insertions(+), 122 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index bed13db03da2..645668950e9c 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -260,15 +260,17 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; - DBG_8723A("asoc expire "MAC_FMT", state = 0x%x\n", MAC_ARG(psta->hwaddr), psta->state); + DBG_8723A("asoc expire %pM, state = 0x%x\n", + psta->hwaddr, psta->state); updated = ap_free_sta23a(padapter, psta, false, WLAN_REASON_DEAUTH_LEAVING); } else { /* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */ if (psta->sleepq_len > (NR_XMITFRAME/pstapriv->asoc_list_cnt) && padapter->xmitpriv.free_xmitframe_cnt < ((NR_XMITFRAME/pstapriv->asoc_list_cnt)/2) ) { - DBG_8723A("%s sta:"MAC_FMT", sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__, - MAC_ARG(psta->hwaddr), + DBG_8723A("%s sta:%pM, sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", + __func__, + psta->hwaddr, psta->sleepq_len, padapter->xmitpriv.free_xmitframe_cnt, pstapriv->asoc_list_cnt); @@ -305,7 +307,8 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) psta->keep_alive_trycnt++; if (ret == _SUCCESS) { - DBG_8723A("asoc check, sta(" MAC_FMT ") is alive\n", MAC_ARG(psta->hwaddr)); + DBG_8723A("asoc check, sta(%pM) is alive\n", + psta->hwaddr); psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; continue; @@ -317,7 +320,8 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) psta->keep_alive_trycnt = 0; - DBG_8723A("asoc expire "MAC_FMT", state = 0x%x\n", MAC_ARG(psta->hwaddr), psta->state); + DBG_8723A("asoc expire %pM, state = 0x%x\n", + psta->hwaddr, psta->state); spin_lock_bh(&pstapriv->asoc_list_lock); if (!list_empty(&psta->asoc_list)) { list_del_init(&psta->asoc_list); @@ -1044,7 +1048,7 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q; - DBG_8723A("%s(acl_num =%d) =" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr)); + DBG_8723A("%s(acl_num =%d) =%pM\n", __func__, pacl_list->num, addr); if ((NUM_ACL-1) < pacl_list->num) return -1; @@ -1476,8 +1480,8 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info if (psta->flags & WLAN_STA_HT) { u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info); - DBG_8723A("HT: STA " MAC_FMT " HT Capabilities Info: 0x%04x\n", - MAC_ARG(psta->hwaddr), ht_capab); + DBG_8723A("HT: STA %pM HT Capabilities Info: 0x%04x\n", + psta->hwaddr, ht_capab); if (psta->no_ht_set) { psta->no_ht_set = 0; @@ -1489,10 +1493,9 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info psta->no_ht_gf_set = 1; pmlmepriv->num_sta_ht_no_gf++; } - DBG_8723A("%s STA " MAC_FMT " - no " - "greenfield, num of non-gf stations %d\n", - __func__, MAC_ARG(psta->hwaddr), - pmlmepriv->num_sta_ht_no_gf); + DBG_8723A("%s STA %pM - no greenfield, num of non-gf stations %d\n", + __func__, psta->hwaddr, + pmlmepriv->num_sta_ht_no_gf); } if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH_20_40) == 0) { @@ -1500,10 +1503,9 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info psta->ht_20mhz_set = 1; pmlmepriv->num_sta_ht_20mhz++; } - DBG_8723A("%s STA " MAC_FMT " - 20 MHz HT, " - "num of 20MHz HT STAs %d\n", - __func__, MAC_ARG(psta->hwaddr), - pmlmepriv->num_sta_ht_20mhz); + DBG_8723A("%s STA %pM - 20 MHz HT, num of 20MHz HT STAs %d\n", + __func__, psta->hwaddr, + pmlmepriv->num_sta_ht_20mhz); } } else { @@ -1512,10 +1514,9 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info pmlmepriv->num_sta_no_ht++; } if (pmlmepriv->htpriv.ht_option) { - DBG_8723A("%s STA " MAC_FMT - " - no HT, num of non-HT stations %d\n", - __func__, MAC_ARG(psta->hwaddr), - pmlmepriv->num_sta_no_ht); + DBG_8723A("%s STA %pM - no HT, num of non-HT stations %d\n", + __func__, psta->hwaddr, + pmlmepriv->num_sta_no_ht); } } diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index d6593a24469f..313ecddf98c9 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -238,9 +238,9 @@ static void _rtw_roaming(struct rtw_adapter *padapter, pnetwork = &pmlmepriv->cur_network; if (padapter->mlmepriv.to_roaming > 0) { - DBG_8723A("roaming from %s("MAC_FMT"), length:%d\n", + DBG_8723A("roaming from %s(%pM), length:%d\n", pnetwork->network.Ssid.ssid, - MAC_ARG(pnetwork->network.MacAddress), + pnetwork->network.MacAddress, pnetwork->network.Ssid.ssid_len); memcpy(&pmlmepriv->assoc_ssid, &pnetwork->network.Ssid, sizeof(struct cfg80211_ssid)); @@ -747,8 +747,8 @@ void rtw_free_assoc_resources23a(struct rtw_adapter *adapter, RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+rtw_free_assoc_resources23a\n")); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("tgt_network->network.MacAddress="MAC_FMT" ssid=%s\n", - MAC_ARG(tgt_network->network.MacAddress), + ("tgt_network->network.MacAddress=%pM ssid=%s\n", + tgt_network->network.MacAddress, tgt_network->network.Ssid.ssid)); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE)) { @@ -991,8 +991,9 @@ rtw_joinbss_update_network23a(struct rtw_adapter *padapter, DBG_8723A("%s\n", __func__); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("\nfw_state:%x, BSSID:"MAC_FMT"\n", get_fwstate(pmlmepriv), - MAC_ARG(pnetwork->network.MacAddress))); + ("\nfw_state:%x, BSSID:%pM\n", + get_fwstate(pmlmepriv), + pnetwork->network.MacAddress)); /* why not use ptarget_wlan?? */ memcpy(&cur_network->network, &pnetwork->network, @@ -1323,8 +1324,7 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) else mac_id = pstadel->mac_id; - DBG_8723A("%s(mac_id=%d)=" MAC_FMT "\n", __func__, mac_id, - MAC_ARG(pstadel->macaddr)); + DBG_8723A("%s(mac_id=%d)=%pM\n", __func__, mac_id, pstadel->macaddr); if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) return; @@ -1575,13 +1575,12 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv, } if (updated) { - DBG_8723A("[by_bssid:%u][assoc_ssid:%s][to_roaming:%u] " - "new candidate: %s("MAC_FMT") rssi:%d\n", + DBG_8723A("[by_bssid:%u][assoc_ssid:%s][to_roaming:%u] new candidate: %s(%pM) rssi:%d\n", pmlmepriv->assoc_by_bssid, pmlmepriv->assoc_ssid.ssid, adapter->mlmepriv.to_roaming, (*candidate)->network.Ssid.ssid, - MAC_ARG((*candidate)->network.MacAddress), + (*candidate)->network.MacAddress, (int)(*candidate)->network.Rssi); } @@ -1732,9 +1731,10 @@ int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv) ret = _FAIL; goto exit; } else { - DBG_8723A("%s: candidate: %s("MAC_FMT", ch:%u)\n", __func__, + DBG_8723A("%s: candidate: %s(%pM, ch:%u)\n", + __func__, candidate->network.Ssid.ssid, - MAC_ARG(candidate->network.MacAddress), + candidate->network.MacAddress, candidate->network.DSConfig); } diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 1267268de349..8996c1e24568 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -968,8 +968,7 @@ OnAuth23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) pstat = rtw_get_stainfo23a(pstapriv, sa); if (!pstat) { /* allocate a new one */ - DBG_8723A("going to alloc stainfo for sa ="MAC_FMT"\n", - MAC_ARG(sa)); + DBG_8723A("going to alloc stainfo for sa =%pM\n", sa); pstat = rtw_alloc_stainfo23a(pstapriv, sa, GFP_ATOMIC); if (!pstat) { DBG_8723A(" Exceed the upper limit of supported " @@ -1396,8 +1395,8 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) /* now parse all ieee802_11 ie to point to elems */ if (rtw_validate_frame_ies(pos, left)) { - DBG_8723A("STA " MAC_FMT " sent invalid association request\n", - MAC_ARG(pstat->hwaddr)); + DBG_8723A("STA %pM sent invalid association request\n", + pstat->hwaddr); status = WLAN_STATUS_UNSPECIFIED_FAILURE; goto OnAssocReq23aFail; } @@ -1407,8 +1406,8 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) p = cfg80211_find_ie(WLAN_EID_SSID, pos, left); if (!p || p[1] == 0) { /* broadcast ssid, however it is not allowed in assocreq */ - DBG_8723A("STA " MAC_FMT " sent invalid association request " - "lacking an SSID\n", MAC_ARG(pstat->hwaddr)); + DBG_8723A("STA %pM sent invalid association request lacking an SSID\n", + pstat->hwaddr); status = WLAN_STATUS_UNSPECIFIED_FAILURE; goto OnAssocReq23aFail; } else { @@ -1537,9 +1536,8 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) int copy_len; if (psecuritypriv->wpa_psk == 0) { - DBG_8723A("STA " MAC_FMT ": WPA/RSN IE in association " - "request, but AP don't support WPA/RSN\n", - MAC_ARG(pstat->hwaddr)); + DBG_8723A("STA %pM: WPA/RSN IE in association request, but AP don't support WPA/RSN\n", + pstat->hwaddr); status = WLAN_STATUS_INVALID_IE; @@ -1645,8 +1643,8 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) if (pstat->flags & WLAN_STA_HT && (pstat->wpa2_pairwise_cipher & WPA_CIPHER_TKIP || pstat->wpa_pairwise_cipher & WPA_CIPHER_TKIP)) { - DBG_8723A("HT: " MAC_FMT " tried to use TKIP with HT " - "association\n", MAC_ARG(pstat->hwaddr)); + DBG_8723A("HT: %pM tried to use TKIP with HT association\n", + pstat->hwaddr); /* status = WLAN_STATUS_CIPHER_REJECTED_PER_POLICY; */ /* goto OnAssocReq23aFail; */ @@ -2806,17 +2804,16 @@ static int issue_probereq_ex(struct rtw_adapter *padapter, if (try_cnt && wait_ms) { if (da) - DBG_8723A("%s(%s): to "MAC_FMT", ch:%u%s, %d/%d " - "in %u ms\n", __func__, - padapter->pnetdev->name, - MAC_ARG(da), rtw_get_oper_ch23a(padapter), - ret == _SUCCESS?", acked":"", i, try_cnt, + DBG_8723A("%s(%s): to %pM, ch:%u%s, %d/%d in %u ms\n", + __func__, padapter->pnetdev->name, + da, rtw_get_oper_ch23a(padapter), + ret == _SUCCESS ? ", acked" : "", i, try_cnt, jiffies_to_msecs(jiffies - start)); else DBG_8723A("%s(%s):, ch:%u%s, %d/%d in %u ms\n", __func__, padapter->pnetdev->name, rtw_get_oper_ch23a(padapter), - ret == _SUCCESS?", acked":"", i, try_cnt, + ret == _SUCCESS ? ", acked" : "", i, try_cnt, jiffies_to_msecs(jiffies - start)); } exit: @@ -3460,17 +3457,16 @@ int issue_nulldata23a(struct rtw_adapter *padapter, unsigned char *da, if (try_cnt && wait_ms) { if (da) - DBG_8723A("%s(%s): to "MAC_FMT", ch:%u%s, %d/%d " - "in %u ms\n", __func__, - padapter->pnetdev->name, - MAC_ARG(da), rtw_get_oper_ch23a(padapter), - ret == _SUCCESS?", acked":"", i, try_cnt, + DBG_8723A("%s(%s): to %pM, ch:%u%s, %d/%d in %u ms\n", + __func__, padapter->pnetdev->name, + da, rtw_get_oper_ch23a(padapter), + ret == _SUCCESS ? ", acked" : "", i, try_cnt, jiffies_to_msecs(jiffies - start)); else DBG_8723A("%s(%s):, ch:%u%s, %d/%d in %u ms\n", __func__, padapter->pnetdev->name, rtw_get_oper_ch23a(padapter), - ret == _SUCCESS?", acked":"", i, try_cnt, + ret == _SUCCESS ? ", acked" : "", i, try_cnt, jiffies_to_msecs(jiffies - start)); } exit: @@ -3587,17 +3583,16 @@ int issue_qos_nulldata23a(struct rtw_adapter *padapter, unsigned char *da, if (try_cnt && wait_ms) { if (da) - DBG_8723A("%s(%s): to "MAC_FMT", ch:%u%s, %d/%d " - "in %u ms\n", __func__, - padapter->pnetdev->name, - MAC_ARG(da), rtw_get_oper_ch23a(padapter), - ret == _SUCCESS?", acked":"", i, try_cnt, + DBG_8723A("%s(%s): to %pM, ch:%u%s, %d/%d in %u ms\n", + __func__, padapter->pnetdev->name, + da, rtw_get_oper_ch23a(padapter), + ret == _SUCCESS ? ", acked" : "", i, try_cnt, jiffies_to_msecs(jiffies - start)); else DBG_8723A("%s(%s):, ch:%u%s, %d/%d in %u ms\n", __func__, padapter->pnetdev->name, rtw_get_oper_ch23a(padapter), - ret == _SUCCESS?", acked":"", i, try_cnt, + ret == _SUCCESS ? ", acked" : "", i, try_cnt, jiffies_to_msecs(jiffies - start)); } exit: @@ -3615,7 +3610,7 @@ static int _issue_deauth(struct rtw_adapter *padapter, unsigned char *da, struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; int ret = _FAIL; - /* DBG_8723A("%s to "MAC_FMT"\n", __func__, MAC_ARG(da)); */ + /* DBG_8723A("%s to %pM\n", __func__, da); */ pmgntframe = alloc_mgtxmitframe23a(pxmitpriv); if (!pmgntframe) @@ -3660,7 +3655,7 @@ exit: int issue_deauth23a(struct rtw_adapter *padapter, unsigned char *da, unsigned short reason) { - DBG_8723A("%s to "MAC_FMT"\n", __func__, MAC_ARG(da)); + DBG_8723A("%s to %pM\n", __func__, da); return _issue_deauth(padapter, da, reason, false); } @@ -3692,17 +3687,16 @@ static int issue_deauth_ex(struct rtw_adapter *padapter, u8 *da, if (try_cnt && wait_ms) { if (da) - DBG_8723A("%s(%s): to "MAC_FMT", ch:%u%s, %d/%d " - "in %u ms\n", __func__, - padapter->pnetdev->name, - MAC_ARG(da), rtw_get_oper_ch23a(padapter), - ret == _SUCCESS?", acked":"", i, try_cnt, + DBG_8723A("%s(%s): to %pM, ch:%u%s, %d/%d in %u ms\n", + __func__, padapter->pnetdev->name, + da, rtw_get_oper_ch23a(padapter), + ret == _SUCCESS ? ", acked" : "", i, try_cnt, jiffies_to_msecs(jiffies - start)); else DBG_8723A("%s(%s):, ch:%u%s, %d/%d in %u ms\n", __func__, padapter->pnetdev->name, rtw_get_oper_ch23a(padapter), - ret == _SUCCESS?", acked":"", i, try_cnt, + ret == _SUCCESS ? ", acked" : "", i, try_cnt, jiffies_to_msecs(jiffies - start)); } exit: @@ -3719,8 +3713,8 @@ void issue_action_spct_ch_switch23a(struct rtw_adapter *padapter, struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - DBG_8723A("%s(%s): ra ="MAC_FMT", ch:%u, offset:%u\n", __func__, - padapter->pnetdev->name, MAC_ARG(ra), new_ch, ch_offset); + DBG_8723A("%s(%s): ra=%pM, ch:%u, offset:%u\n", + __func__, padapter->pnetdev->name, ra, new_ch, ch_offset); pmgntframe = alloc_mgtxmitframe23a(pxmitpriv); if (!pmgntframe) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 9c783002caf2..9ce6d22b9589 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -301,10 +301,7 @@ int recvframe_chkmic(struct rtw_adapter *adapter, RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n recvframe_chkmic:prxattrib->encrypt == WLAN_CIPHER_SUITE_TKIP\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("\n recvframe_chkmic:da = 0x%02x:0x%02x:0x%02x:0x%02x:" - "0x%02x:0x%02x\n", prxattrib->ra[0], - prxattrib->ra[1], prxattrib->ra[2], prxattrib->ra[3], - prxattrib->ra[4], prxattrib->ra[5])); + ("\n recvframe_chkmic:da = %pM\n", prxattrib->ra)); /* calculate mic code */ if (stainfo != NULL) { @@ -406,12 +403,8 @@ int recvframe_chkmic(struct rtw_adapter *adapter, prxattrib->hdrlen)); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("ra = 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%." - "2x 0x%.2x psecuritypriv->" - "binstallGrpkey =%d ", - prxattrib->ra[0], prxattrib->ra[1], - prxattrib->ra[2], prxattrib->ra[3], - prxattrib->ra[4], prxattrib->ra[5], + ("ra = %pM psecuritypriv->binstallGrpkey =%d ", + prxattrib->ra, psecuritypriv->binstallGrpkey)); /* double check key_index for some timing @@ -887,8 +880,8 @@ int ap2sta_data_frame(struct rtw_adapter *adapter, /* da should be for me */ if (!ether_addr_equal(myhwaddr, pattrib->dst) && !bmcast) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - (" ap2sta_data_frame: compare DA fail; DA =" - MAC_FMT"\n", MAC_ARG(pattrib->dst))); + (" ap2sta_data_frame: compare DA fail; DA=%pM\n", + pattrib->dst)); ret = _FAIL; goto exit; } @@ -898,15 +891,14 @@ int ap2sta_data_frame(struct rtw_adapter *adapter, ether_addr_equal(mybssid, "\x0\x0\x0\x0\x0\x0") || !ether_addr_equal(pattrib->bssid, mybssid)) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - (" ap2sta_data_frame: compare BSSID fail ; " - "BSSID ="MAC_FMT"\n", MAC_ARG(pattrib->bssid))); + (" ap2sta_data_frame: compare BSSID fail ; BSSID=%pM\n", + pattrib->bssid)); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("mybssid ="MAC_FMT"\n", MAC_ARG(mybssid))); + ("mybssid=%pM\n", mybssid)); if (!bmcast) { - DBG_8723A("issue_deauth23a to the nonassociated " - "ap =" MAC_FMT " for the reason(7)\n", - MAC_ARG(pattrib->bssid)); + DBG_8723A("issue_deauth23a to the nonassociated ap=%pM for the reason(7)\n", + pattrib->bssid); issue_deauth23a(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); } @@ -964,9 +956,8 @@ int ap2sta_data_frame(struct rtw_adapter *adapter, if (ether_addr_equal(myhwaddr, pattrib->dst) && !bmcast) { *psta = rtw_get_stainfo23a(pstapriv, pattrib->bssid); if (*psta == NULL) { - DBG_8723A("issue_deauth23a to the ap =" MAC_FMT - " for the reason(7)\n", - MAC_ARG(pattrib->bssid)); + DBG_8723A("issue_deauth23a to the ap=%pM for the reason(7)\n", + pattrib->bssid); issue_deauth23a(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); @@ -1011,9 +1002,8 @@ int sta2ap_data_frame(struct rtw_adapter *adapter, if (*psta == NULL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under AP_MODE; drop pkt\n")); - DBG_8723A("issue_deauth23a to sta =" MAC_FMT - " for the reason(7)\n", - MAC_ARG(pattrib->src)); + DBG_8723A("issue_deauth23a to sta=%pM for the reason(7)\n", + pattrib->src); issue_deauth23a(adapter, pattrib->src, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); @@ -1043,8 +1033,8 @@ int sta2ap_data_frame(struct rtw_adapter *adapter, ret = RTW_RX_HANDLED; goto exit; } - DBG_8723A("issue_deauth23a to sta =" MAC_FMT " for the reason(7)\n", - MAC_ARG(pattrib->src)); + DBG_8723A("issue_deauth23a to sta=%pM for the reason(7)\n", + pattrib->src); issue_deauth23a(adapter, pattrib->src, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); ret = RTW_RX_HANDLED; diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c index 69d9e0f17fd8..829bba7fa59c 100644 --- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c @@ -876,9 +876,9 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, } if (!ether_addr_equal(cur_network->network.MacAddress, mgmt->bssid)) { - DBG_8723A("%s: linked but recv other bssid bcn" - MAC_FMT MAC_FMT "\n", __func__, MAC_ARG(mgmt->bssid), - MAC_ARG(cur_network->network.MacAddress)); + DBG_8723A("%s: linked but recv other bssid bcn %pM %pM\n", + __func__, mgmt->bssid, + cur_network->network.MacAddress); return _FAIL; } diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c index 1c82dffcf596..98602d92b2fa 100644 --- a/drivers/staging/rtl8723au/core/rtw_xmit.c +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c @@ -493,8 +493,8 @@ static int update_attrib(struct rtw_adapter *padapter, psta = rtw_get_stainfo23a(pstapriv, pattrib->ra); if (psta == NULL) { /* if we cannot get psta => drrp the pkt */ RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, - ("\nupdate_attrib => get sta_info fail, ra:" - MAC_FMT"\n", MAC_ARG(pattrib->ra))); + ("\nupdate_attrib => get sta_info fail, ra:%pM\n", + pattrib->ra)); res = _FAIL; goto exit; } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) && @@ -511,8 +511,8 @@ static int update_attrib(struct rtw_adapter *padapter, } else { /* if we cannot get psta => drop the pkt */ RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, - ("\nupdate_attrib => get sta_info fail, ra:" MAC_FMT - "\n", MAC_ARG(pattrib->ra))); + ("\nupdate_attrib => get sta_info fail, ra:%pM\n", + pattrib->ra)); res = _FAIL; goto exit; } diff --git a/drivers/staging/rtl8723au/include/ieee80211.h b/drivers/staging/rtl8723au/include/ieee80211.h index 3caf4f502ad8..3aa40a32555e 100644 --- a/drivers/staging/rtl8723au/include/ieee80211.h +++ b/drivers/staging/rtl8723au/include/ieee80211.h @@ -251,9 +251,6 @@ join_res: > 0: TID */ -#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" -#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] - #define MAXTID 16 #define WME_OUI_TYPE 2 diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 537bd8214efe..f925170aa630 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -1076,8 +1076,7 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, ret = -ENOENT; goto exit; } - DBG_8723A("%s(%s): mac =" MAC_FMT "\n", __func__, ndev->name, - MAC_ARG(mac)); + DBG_8723A("%s(%s): mac=%pM\n", __func__, ndev->name, mac); /* for infra./P2PClient mode */ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && @@ -1085,8 +1084,8 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, struct wlan_network *cur_network = &pmlmepriv->cur_network; if (!ether_addr_equal(mac, cur_network->network.MacAddress)) { - DBG_8723A("%s, mismatch bssid =" MAC_FMT "\n", __func__, - MAC_ARG(cur_network->network.MacAddress)); + DBG_8723A("%s, mismatch bssid=%pM\n", + __func__, cur_network->network.MacAddress); ret = -ENOENT; goto exit; } @@ -1989,7 +1988,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, DBG_8723A("ssid =%s, len =%zu\n", sme->ssid, sme->ssid_len); if (sme->bssid) - DBG_8723A("bssid =" MAC_FMT "\n", MAC_ARG(sme->bssid)); + DBG_8723A("bssid=%pM\n", sme->bssid); if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { ret = -EBUSY; @@ -2523,8 +2522,8 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, mgmt = (struct ieee80211_mgmt *)dot11_hdr; - DBG_8723A("RTW_Tx:da =" MAC_FMT " via %s(%s)\n", - MAC_ARG(mgmt->da), __func__, ndev->name); + DBG_8723A("RTW_Tx:da=%pM via %s(%s)\n", + mgmt->da, __func__, ndev->name); category = mgmt->u.action.category; action = mgmt->u.action.u.wme_action.action_code; DBG_8723A("RTW_Tx:category(%u), action(%u)\n", @@ -2877,7 +2876,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, return ret; } - DBG_8723A("free sta macaddr =" MAC_FMT "\n", MAC_ARG(mac)); + DBG_8723A("free sta macaddr=%pM\n", mac); if (is_broadcast_ether_addr(mac)) return -EINVAL; @@ -3053,8 +3052,7 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, cfg80211_mgmt_tx_status(padapter->rtw_wdev, *cookie, buf, len, ack, GFP_KERNEL); - DBG_8723A("RTW_Tx:tx_ch =%d, da =" MAC_FMT "\n", tx_ch, - MAC_ARG(hdr->da)); + DBG_8723A("RTW_Tx:tx_ch =%d, da =%pM\n", tx_ch, hdr->da); category = hdr->u.action.category; action = hdr->u.action.u.wme_action.action_code; DBG_8723A("RTW_Tx:category(%u), action(%u)\n", category, action); diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c index db6a15971a21..8f732d9d6888 100644 --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c @@ -594,8 +594,8 @@ static int _rtw_drv_register_netdev(struct rtw_adapter *padapter, char *name) ret = _FAIL; goto error_register_netdev; } - DBG_8723A("%s, MAC Address (if%d) = " MAC_FMT "\n", __func__, - (padapter->iface_id + 1), MAC_ARG(pnetdev->dev_addr)); + DBG_8723A("%s, MAC Address (if%d) = %pM\n", + __func__, padapter->iface_id + 1, pnetdev->dev_addr); return ret; error_register_netdev: @@ -666,8 +666,7 @@ int netdev_open23a(struct net_device *pnetdev) goto netdev_open23a_error; } - DBG_8723A("MAC Address = "MAC_FMT"\n", - MAC_ARG(pnetdev->dev_addr)); + DBG_8723A("MAC Address = %pM\n", pnetdev->dev_addr); if (init_hw_mlme_ext23a(padapter) == _FAIL) { DBG_8723A("can't init mlme_ext_priv\n"); -- cgit v1.2.3 From c181be7f32d168f5deb85bffc7f874a4b36daeee Mon Sep 17 00:00:00 2001 From: Matteo Semenzato Date: Fri, 20 Mar 2015 20:41:45 +0100 Subject: Staging: rtl8188eu: remove dead code The condition pxmitpriv->hwxmit_entry == 5 is always false because HWXMIT_ENTRY is always 4. Signed-off-by: Matteo Semenzato Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index 7ed60abf4d49..fda169d37771 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -1639,19 +1639,10 @@ void rtw_alloc_hwxmits(struct adapter *padapter) hwxmits = pxmitpriv->hwxmits; - if (pxmitpriv->hwxmit_entry == 5) { - hwxmits[0] .sta_queue = &pxmitpriv->bm_pending; - hwxmits[1] .sta_queue = &pxmitpriv->vo_pending; - hwxmits[2] .sta_queue = &pxmitpriv->vi_pending; - hwxmits[3] .sta_queue = &pxmitpriv->bk_pending; - hwxmits[4] .sta_queue = &pxmitpriv->be_pending; - } else if (pxmitpriv->hwxmit_entry == 4) { - hwxmits[0] .sta_queue = &pxmitpriv->vo_pending; - hwxmits[1] .sta_queue = &pxmitpriv->vi_pending; - hwxmits[2] .sta_queue = &pxmitpriv->be_pending; - hwxmits[3] .sta_queue = &pxmitpriv->bk_pending; - } else { - } + hwxmits[0] .sta_queue = &pxmitpriv->vo_pending; + hwxmits[1] .sta_queue = &pxmitpriv->vi_pending; + hwxmits[2] .sta_queue = &pxmitpriv->be_pending; + hwxmits[3] .sta_queue = &pxmitpriv->bk_pending; } void rtw_free_hwxmits(struct adapter *padapter) -- cgit v1.2.3 From 330b5e80efcace88663b93bdd5ee41013284cb52 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Sat, 21 Mar 2015 02:15:32 +0300 Subject: staging: ozwpan: implement error handling in ozwpan_init() Errors are correctly handled in oz_cdev_register() and oz_protocol_init(), but then they are ignored in ozwpan_init(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ozwpan/ozmain.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ozwpan/ozmain.c b/drivers/staging/ozwpan/ozmain.c index 7d6ef4cadf1a..74ef34815b98 100644 --- a/drivers/staging/ozwpan/ozmain.c +++ b/drivers/staging/ozwpan/ozmain.c @@ -34,11 +34,21 @@ MODULE_PARM_DESC(g_net_dev, "The device(s) to bind to; " */ static int __init ozwpan_init(void) { - oz_cdev_register(); - oz_protocol_init(g_net_dev); + int err; + + err = oz_cdev_register(); + if (err) + return err; + err = oz_protocol_init(g_net_dev); + if (err) + goto err_protocol; oz_app_enable(OZ_APPID_USB, 1); oz_apps_init(); return 0; + +err_protocol: + oz_cdev_deregister(); + return err; } /* -- cgit v1.2.3 From d9e048cdd260a1e7f9f2e25cb2bad46521812d99 Mon Sep 17 00:00:00 2001 From: Cihangir Akturk Date: Tue, 24 Mar 2015 21:53:53 +0200 Subject: staging: rtl8192u: Fix static decleration sparse warning. The function 'ieee80211_check_auth_response' is used only in this file, so make it static. This patch fixes the following sparse warning. 'ieee80211_check_auth_response' was not declared. Should it be static? Signed-off-by: Cihangir Akturk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 543324744b4c..c2388812d4fd 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -1921,8 +1921,8 @@ static void ieee80211_process_action(struct ieee80211_device *ieee, } -void ieee80211_check_auth_response(struct ieee80211_device *ieee, - struct sk_buff *skb) +static void ieee80211_check_auth_response(struct ieee80211_device *ieee, + struct sk_buff *skb) { /* default support N mode, disable halfNmode */ bool bSupportNmode = true, bHalfSupportNmode = false; -- cgit v1.2.3 From 73454eaf2032c64f1d863ac7e91304e4bf903bfb Mon Sep 17 00:00:00 2001 From: Eddie Kovsky Date: Wed, 25 Mar 2015 22:16:11 -0600 Subject: Staging: rtl8192 Clean up function definition Change function definition to match its prototype declaration. This fixes the following warning generated by sparse: drivers/staging/rtl8192u/r8192U_core.c:1970:6: warning: symbol 'rtl8192_update_ratr_table' was not declared. Should it be static? Signed-off-by: Eddie Kovsky Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 8834c23d67fc..a4795afeeb9c 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1967,7 +1967,7 @@ static int rtl8192_handle_assoc_response(struct net_device *dev, } -void rtl8192_update_ratr_table(struct net_device *dev) +static void rtl8192_update_ratr_table(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee80211; -- cgit v1.2.3 From 90403aa118fe5e9f0e5bed1acc3fa2406237f9cb Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 24 Mar 2015 16:06:44 -0700 Subject: staging: rtl8723au: Update RT_TRACE macro and uses Create an rt_trace function using %pV to reduce overall code size. Update the macro uses to remove unnecessary and now harmful parentheses. Miscellanea around these changes: o Coalesce formats o Realign arguments o Remove commented-out RT_TRACE uses o Spelling fixes in formats o Add missing newlines to formats o Remove multiple newlines from formats o Neaten formats where noticed o Use %pM in one instance Reduces code size ~20KB Signed-off-by: Joe Perches Acked-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_cmd.c | 55 ++--- drivers/staging/rtl8723au/core/rtw_efuse.c | 3 - drivers/staging/rtl8723au/core/rtw_ieee80211.c | 64 +++--- drivers/staging/rtl8723au/core/rtw_mlme.c | 132 +++++------ drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 24 +- drivers/staging/rtl8723au/core/rtw_pwrctrl.c | 29 ++- drivers/staging/rtl8723au/core/rtw_recv.c | 244 ++++++++++----------- drivers/staging/rtl8723au/core/rtw_security.c | 58 +++-- drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 16 +- drivers/staging/rtl8723au/core/rtw_wlan_util.c | 29 ++- drivers/staging/rtl8723au/core/rtw_xmit.c | 181 +++++++-------- drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c | 38 ++-- drivers/staging/rtl8723au/hal/hal_com.c | 12 - drivers/staging/rtl8723au/hal/odm_debug.c | 15 ++ .../staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 19 +- drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 124 +++++------ drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c | 93 +------- drivers/staging/rtl8723au/hal/rtl8723au_recv.c | 2 +- drivers/staging/rtl8723au/hal/rtl8723au_xmit.c | 16 +- drivers/staging/rtl8723au/hal/usb_halinit.c | 40 ++-- drivers/staging/rtl8723au/hal/usb_ops_linux.c | 52 ++--- drivers/staging/rtl8723au/include/rtw_debug.h | 11 +- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 91 ++++---- drivers/staging/rtl8723au/os_dep/os_intfs.c | 44 ++-- drivers/staging/rtl8723au/os_dep/recv_linux.c | 16 +- drivers/staging/rtl8723au/os_dep/usb_intf.c | 30 +-- drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 31 ++- drivers/staging/rtl8723au/os_dep/xmit_linux.c | 12 +- 28 files changed, 660 insertions(+), 821 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c b/drivers/staging/rtl8723au/core/rtw_cmd.c index f6b99d8e1878..46aea16cbf78 100644 --- a/drivers/staging/rtl8723au/core/rtw_cmd.c +++ b/drivers/staging/rtl8723au/core/rtw_cmd.c @@ -299,9 +299,8 @@ post_process: pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback; if (!pcmd_callback) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, - ("mlme_cmd_hdl(): pcmd_callback = 0x%p, " - "cmdcode = 0x%x\n", - pcmd_callback, pcmd->cmdcode)); + "mlme_cmd_hdl(): pcmd_callback = 0x%p, cmdcode = 0x%x\n", + pcmd_callback, pcmd->cmdcode); rtw_free_cmd_obj23a(pcmd); } else { /* need consider that free cmd_obj in @@ -310,8 +309,8 @@ post_process: } } else { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("%s: cmdcode = 0x%x callback not defined!\n", - __func__, pcmd->cmdcode)); + "%s: cmdcode = 0x%x callback not defined!\n", + __func__, pcmd->cmdcode); rtw_free_cmd_obj23a(pcmd); } } @@ -343,7 +342,7 @@ int rtw_sitesurvey_cmd23a(struct rtw_adapter *padapter, rtw_free_network_queue23a(padapter); RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, - ("%s: flush network queue\n", __func__)); + "%s: flush network queue\n", __func__); init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, GEN_CMD_CODE(_SiteSurvey)); @@ -412,12 +411,12 @@ int rtw_createbss_cmd23a(struct rtw_adapter *padapter) if (pmlmepriv->assoc_ssid.ssid_len == 0) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, - (" createbss for Any SSid:%s\n", - pmlmepriv->assoc_ssid.ssid)); + "createbss for Any SSid:%s\n", + pmlmepriv->assoc_ssid.ssid); } else { RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, - (" createbss for SSid:%s\n", - pmlmepriv->assoc_ssid.ssid)); + "createbss for SSid:%s\n", + pmlmepriv->assoc_ssid.ssid); } pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); @@ -460,19 +459,18 @@ int rtw_joinbss_cmd23a(struct rtw_adapter *padapter, if (pmlmepriv->assoc_ssid.ssid_len == 0) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, - ("+Join cmd: Any SSid\n")); + "+Join cmd: Any SSid\n"); } else { RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, - ("+Join cmd: SSid =[%s]\n", - pmlmepriv->assoc_ssid.ssid)); + "+Join cmd: SSid =[%s]\n", + pmlmepriv->assoc_ssid.ssid); } pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (!pcmd) { res = _FAIL; RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("rtw_joinbss_cmd23a: memory allocate for cmd_obj " - "fail!!!\n")); + "rtw_joinbss_cmd23a: memory allocate for cmd_obj fail!!!\n"); goto exit; } @@ -497,7 +495,7 @@ int rtw_joinbss_cmd23a(struct rtw_adapter *padapter, res = _FAIL; RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("rtw_joinbss_cmd23a :psecnetwork == NULL!!!\n")); + "rtw_joinbss_cmd23a :psecnetwork == NULL!!!\n"); goto exit; } @@ -599,7 +597,7 @@ int rtw_disassoc_cmd23a(struct rtw_adapter *padapter, u32 deauth_timeout_ms, int res = _SUCCESS; RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, - ("+rtw_disassoc_cmd23a\n")); + "+rtw_disassoc_cmd23a\n"); /* prepare cmd parameter */ param = kzalloc(sizeof(*param), GFP_ATOMIC); @@ -1291,8 +1289,7 @@ void rtw_survey_cmd_callback23a(struct rtw_adapter *padapter, mod_timer(&pmlmepriv->scan_to_timer, jiffies + msecs_to_jiffies(1)); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("\n ********Error: MgntActrtw_set_802_11_bssid23a_" - "LIST_SCAN Fail ************\n\n.")); + "********Error: MgntActrtw_set_802_11_bssid23a_LIST_SCAN Fail ************\n"); } /* free cmd */ @@ -1309,7 +1306,7 @@ void rtw_disassoc_cmd23a_callback(struct rtw_adapter *padapter, set_fwstate(pmlmepriv, _FW_LINKED); spin_unlock_bh(&pmlmepriv->lock); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("\n ***Error: disconnect_cmd_callback Fail ***\n.")); + "***Error: disconnect_cmd_callback Fail ***\n"); return; } @@ -1329,8 +1326,7 @@ void rtw_joinbss_cmd23a_callback(struct rtw_adapter *padapter, jiffies + msecs_to_jiffies(1)); } else if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("********Error:rtw_select_and_join_from_scanned_" - "queue Wait Sema Fail ************\n")); + "********Error:rtw_select_and_join_from_scanned_queue Wait Sema Fail ************\n"); mod_timer(&pmlmepriv->assoc_timer, jiffies + msecs_to_jiffies(1)); } @@ -1349,8 +1345,7 @@ void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("\n ********Error: rtw_createbss_cmd23a_callback " - "Fail ************\n\n.")); + "********Error: rtw_createbss_cmd23a_callback Fail ************\n"); mod_timer(&pmlmepriv->assoc_timer, jiffies + msecs_to_jiffies(1)); } @@ -1366,8 +1361,7 @@ void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, GFP_KERNEL); if (!psta) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("\nCan't alloc sta_info when " - "createbss_cmd_callback\n")); + "Can't alloc sta_info when createbss_cmd_callback\n"); goto createbss_cmd_fail; } } @@ -1382,8 +1376,7 @@ void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, pwlan = rtw_get_oldest_wlan_network23a(&pmlmepriv->scanned_queue); if (!pwlan) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("\n Error: can't get pwlan in " - "rtw23a_joinbss_event_cb\n")); + "Error: can't get pwlan in rtw23a_joinbss_event_cb\n"); spin_unlock_bh(&pmlmepriv->scanned_queue.lock); goto createbss_cmd_fail; } @@ -1432,8 +1425,7 @@ void rtw_setstaKey_cmdrsp_callback23a(struct rtw_adapter *padapter, if (!psta) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("\nERROR: rtw_setstaKey_cmdrsp_callback23a => " - "can't get sta_info\n\n")); + "ERROR: rtw_setstaKey_cmdrsp_callback23a => can't get sta_info\n"); goto exit; } @@ -1457,8 +1449,7 @@ void rtw_setassocsta_cmdrsp_callback23a(struct rtw_adapter *padapter, if (psta == NULL) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("\nERROR: setassocsta_cmdrsp_callbac => can't " - "get sta_info\n\n")); + "ERROR: setassocsta_cmdrsp_callbac => can't get sta_info\n"); goto exit; } diff --git a/drivers/staging/rtl8723au/core/rtw_efuse.c b/drivers/staging/rtl8723au/core/rtw_efuse.c index 29fc25b367e5..92a34db3bd4e 100644 --- a/drivers/staging/rtl8723au/core/rtw_efuse.c +++ b/drivers/staging/rtl8723au/core/rtw_efuse.c @@ -335,7 +335,6 @@ EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value) u32 k = 0; u16 contentLen = 0; - /* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr =%x Data =%x\n", Address, Value)); */ EFUSE_GetEfuseDefinition23a(Adapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen); @@ -404,8 +403,6 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data) u8 tmpidx = 0; int bResult; - /* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr = %x Data =%x\n", addr, data)); */ - /* return 0; */ /* -----------------e-fuse reg ctrl --------------------------------- */ diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/drivers/staging/rtl8723au/core/rtw_ieee80211.c index bbbcfc8257da..cdd7bc402ece 100644 --- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c @@ -472,8 +472,8 @@ int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, int left -= WPA_SELECTOR_LEN; } else if (left > 0) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("%s: ie length mismatch, %u too much", - __func__, left)); + "%s: ie length mismatch, %u too much\n", + __func__, left); return _FAIL; } @@ -487,9 +487,8 @@ int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, int if (count == 0 || left < count * WPA_SELECTOR_LEN) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("%s: ie count botch (pairwise), " - "count %u left %u", __func__, - count, left)); + "%s: ie count botch (pairwise), count %u left %u\n", + __func__, count, left); return _FAIL; } @@ -501,7 +500,7 @@ int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, int } } else if (left == 1) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("%s: ie too short (for key mgmt)", __func__)); + "%s: ie too short (for key mgmt)\n", __func__); return _FAIL; } @@ -510,8 +509,8 @@ int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, int pos += 2; if (!memcmp(pos, RTW_WPA_OUI23A_TYPE, 4)) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s : there has 802.1x auth\n", - __func__)); + "%s : there has 802.1x auth\n", + __func__); *is_8021x = 1; } } @@ -549,8 +548,8 @@ int rtw_parse_wpa2_ie23a(const u8 *rsn_ie, int rsn_ie_len, int *group_cipher, left -= RSN_SELECTOR_LEN; } else if (left > 0) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("%s: ie length mismatch, %u too much", - __func__, left)); + "%s: ie length mismatch, %u too much\n", + __func__, left); return _FAIL; } @@ -563,9 +562,8 @@ int rtw_parse_wpa2_ie23a(const u8 *rsn_ie, int rsn_ie_len, int *group_cipher, if (count == 0 || left < count * RSN_SELECTOR_LEN) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("%s: ie count botch (pairwise), " - "count %u left %u", - __func__, count, left)); + "%s: ie count botch (pairwise), count %u left %u\n", + __func__, count, left); return _FAIL; } @@ -577,7 +575,7 @@ int rtw_parse_wpa2_ie23a(const u8 *rsn_ie, int rsn_ie_len, int *group_cipher, } } else if (left == 1) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("%s: ie too short (for key mgmt)", __func__)); + "%s: ie too short (for key mgmt)\n", __func__); return _FAIL; } @@ -587,8 +585,8 @@ int rtw_parse_wpa2_ie23a(const u8 *rsn_ie, int rsn_ie_len, int *group_cipher, pos += 2; if (!memcmp(pos, SUITE_1X, 4)) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s (): there has 802.1x auth\n", - __func__)); + "%s (): there has 802.1x auth\n", + __func__); *is_8021x = 1; } } @@ -700,7 +698,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork) if (pbuf && pbuf[1] > 0) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("rtw_get_cipher_info: wpa_ielen: %d", pbuf[1])); + "rtw_get_cipher_info: wpa_ielen: %d\n", pbuf[1]); r = rtw_parse_wpa_ie23a(pbuf, pbuf[1] + 2, &group_cipher, &pairwise_cipher, &is8021x); if (r == _SUCCESS) { @@ -708,10 +706,9 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork) pnetwork->BcnInfo.group_cipher = group_cipher; pnetwork->BcnInfo.is_8021x = is8021x; RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s: pnetwork->pairwise_cipher: %d, is_" - "8021x is %d", __func__, - pnetwork->BcnInfo.pairwise_cipher, - pnetwork->BcnInfo.is_8021x)); + "%s: pnetwork->pairwise_cipher: %d, is_8021x is %d\n", + __func__, pnetwork->BcnInfo.pairwise_cipher, + pnetwork->BcnInfo.is_8021x); ret = _SUCCESS; } } else { @@ -719,24 +716,23 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork) if (pbuf && pbuf[1] > 0) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("get RSN IE\n")); + "get RSN IE\n"); r = rtw_parse_wpa2_ie23a(pbuf, pbuf[1] + 2, &group_cipher, &pairwise_cipher, &is8021x); if (r == _SUCCESS) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("get RSN IE OK!!!\n")); + "get RSN IE OK!!!\n"); pnetwork->BcnInfo.pairwise_cipher = pairwise_cipher; pnetwork->BcnInfo.group_cipher = group_cipher; pnetwork->BcnInfo.is_8021x = is8021x; RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s: pnetwork->pairwise_cipher: %d," - "pnetwork->group_cipher is %d, " - "is_8021x is %d", __func__, - pnetwork->BcnInfo.pairwise_cipher, - pnetwork->BcnInfo.group_cipher, - pnetwork->BcnInfo.is_8021x)); + "%s: pnetwork->pairwise_cipher: %d,pnetwork->group_cipher is %d, is_8021x is %d\n", + __func__, + pnetwork->BcnInfo.pairwise_cipher, + pnetwork->BcnInfo.group_cipher, + pnetwork->BcnInfo.is_8021x); ret = _SUCCESS; } } @@ -759,7 +755,7 @@ void rtw_get_bcn_info23a(struct wlan_network *pnetwork) pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_OPENSYS; RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s: ssid =%s\n", __func__, pnetwork->network.Ssid.ssid)); + "%s: ssid =%s\n", __func__, pnetwork->network.Ssid.ssid); pie = pnetwork->network.IEs; pie_len = pnetwork->network.IELength; @@ -776,11 +772,11 @@ void rtw_get_bcn_info23a(struct wlan_network *pnetwork) pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WEP; } RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s: pnetwork->encryp_protocol is %x\n", __func__, - pnetwork->BcnInfo.encryp_protocol)); + "%s: pnetwork->encryp_protocol is %x\n", __func__, + pnetwork->BcnInfo.encryp_protocol); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s: pnetwork->encryp_protocol is %x\n", __func__, - pnetwork->BcnInfo.encryp_protocol)); + "%s: pnetwork->encryp_protocol is %x\n", __func__, + pnetwork->BcnInfo.encryp_protocol); rtw_get_cipher_info(pnetwork); /* get bwmode and ch_offset */ diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index 313ecddf98c9..3c09ea9b7348 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -94,7 +94,7 @@ void rtw23a_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv) void rtw_free_mlme_priv23a(struct mlme_priv *pmlmepriv) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("rtw_free_mlme_priv23a\n")); + "rtw_free_mlme_priv23a\n"); rtw23a_free_mlme_priv_ie_data(pmlmepriv); } @@ -196,9 +196,8 @@ int rtw_if_up23a(struct rtw_adapter *padapter) if (padapter->bDriverStopped || padapter->bSurpriseRemoved || !check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("rtw_if_up23a:bDriverStopped(%d) OR " - "bSurpriseRemoved(%d)", padapter->bDriverStopped, - padapter->bSurpriseRemoved)); + "rtw_if_up23a:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", + padapter->bDriverStopped, padapter->bSurpriseRemoved); res = false; } else res = true; @@ -466,7 +465,7 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter, if (!pnetwork) { if (!oldest) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("\n\n\nsomething wrong here\n\n\n")); + "something wrong here\n"); goto exit; } pnetwork = oldest; @@ -578,13 +577,12 @@ void rtw_survey_event_cb23a(struct rtw_adapter *adapter, const u8 *pbuf) pnetwork = survey->bss; RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("rtw_survey_event_cb23a, ssid=%s\n", pnetwork->Ssid.ssid)); + "rtw_survey_event_cb23a, ssid=%s\n", pnetwork->Ssid.ssid); len = get_wlan_bssid_ex_sz(pnetwork); if (len > (sizeof(struct wlan_bssid_ex))) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("\n ****rtw_survey_event_cb23a: return a wrong " - "bss ***\n")); + "****rtw_survey_event_cb23a: return a wrong bss ***\n"); return; } @@ -592,8 +590,6 @@ void rtw_survey_event_cb23a(struct rtw_adapter *adapter, const u8 *pbuf) /* update IBSS_network 's timestamp */ if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { - /* RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - "rtw_survey_event_cb23a : WIFI_ADHOC_MASTER_STATE\n\n"); */ if (ether_addr_equal(pmlmepriv->cur_network.network.MacAddress, pnetwork->MacAddress)) { struct wlan_network *ibss_wlan; @@ -653,8 +649,8 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) } RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("rtw_surveydone_event_callback23a: fw_state:%x\n\n", - get_fwstate(pmlmepriv))); + "rtw_surveydone_event_callback23a: fw_state:%x\n", + get_fwstate(pmlmepriv)); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { del_timer_sync(&pmlmepriv->scan_to_timer); @@ -662,8 +658,8 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } else { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("nic status =%x, survey done event comes too late!\n", - get_fwstate(pmlmepriv))); + "nic status =%x, survey done event comes too late!\n", + get_fwstate(pmlmepriv)); } rtw_set_signal_stat_timer(&adapter->recvpriv); @@ -718,7 +714,7 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv) struct rtw_queue *scan_queue = &pmlmepriv->scanned_queue; struct list_head *plist, *phead, *ptemp; - RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+free_scanqueue\n")); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n"); spin_lock_bh(&scan_queue->lock); phead = get_list_head(scan_queue); @@ -745,11 +741,11 @@ void rtw_free_assoc_resources23a(struct rtw_adapter *adapter, struct sta_info *psta; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, - ("+rtw_free_assoc_resources23a\n")); + "+rtw_free_assoc_resources23a\n"); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("tgt_network->network.MacAddress=%pM ssid=%s\n", - tgt_network->network.MacAddress, - tgt_network->network.Ssid.ssid)); + "tgt_network->network.MacAddress=%pM ssid=%s\n", + tgt_network->network.MacAddress, + tgt_network->network.Ssid.ssid); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE)) { psta = rtw_get_stainfo23a(&adapter->stapriv, @@ -781,7 +777,7 @@ void rtw_free_assoc_resources23a(struct rtw_adapter *adapter, pwlan->fixed = false; else RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("rtw_free_assoc_resources23a : pwlan== NULL\n")); + "rtw_free_assoc_resources23a : pwlan== NULL\n"); if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && adapter->stapriv.asoc_sta_count == 1) @@ -801,7 +797,7 @@ void rtw_indicate_connect23a(struct rtw_adapter *padapter) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("+rtw_indicate_connect23a\n")); + "+rtw_indicate_connect23a\n"); pmlmepriv->to_join = false; @@ -821,8 +817,8 @@ void rtw_indicate_connect23a(struct rtw_adapter *padapter) rtw_set_scan_deny(padapter, 3000); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("-rtw_indicate_connect23a: fw_state=0x%08x\n", - get_fwstate(pmlmepriv))); + "-rtw_indicate_connect23a: fw_state=0x%08x\n", + get_fwstate(pmlmepriv)); } /* @@ -833,7 +829,7 @@ void rtw_indicate_disconnect23a(struct rtw_adapter *padapter) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("+rtw_indicate_disconnect23a\n")); + "+rtw_indicate_disconnect23a\n"); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS); @@ -991,9 +987,9 @@ rtw_joinbss_update_network23a(struct rtw_adapter *padapter, DBG_8723A("%s\n", __func__); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("\nfw_state:%x, BSSID:%pM\n", - get_fwstate(pmlmepriv), - pnetwork->network.MacAddress)); + "fw_state:%x, BSSID:%pM\n", + get_fwstate(pmlmepriv), + pnetwork->network.MacAddress); /* why not use ptarget_wlan?? */ memcpy(&cur_network->network, &pnetwork->network, @@ -1036,7 +1032,7 @@ rtw_joinbss_update_network23a(struct rtw_adapter *padapter, default: pmlmepriv->fw_state = WIFI_NULL_STATE; RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("Invalid network_mode\n")); + "Invalid network_mode\n"); break; } @@ -1071,16 +1067,16 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) bool the_same_macaddr; RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("joinbss event call back received with res=%d\n", - pnetwork->join_res)); + "joinbss event call back received with res=%d\n", + pnetwork->join_res); if (pmlmepriv->assoc_ssid.ssid_len == 0) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("@@@@@ joinbss event call back for Any SSid\n")); + "@@@@@ joinbss event call back for Any SSid\n"); } else { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("@@@@@ rtw23a_joinbss_event_cb for SSid:%s\n", - pmlmepriv->assoc_ssid.ssid)); + "@@@@@ rtw23a_joinbss_event_cb for SSid:%s\n", + pmlmepriv->assoc_ssid.ssid); } if (ether_addr_equal(pnetwork->network.MacAddress, @@ -1092,15 +1088,14 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) pnetwork->network.Length = get_wlan_bssid_ex_sz(&pnetwork->network); if (pnetwork->network.Length > sizeof(struct wlan_bssid_ex)) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("\n\n ***joinbss_evt_callback return a wrong bss " - "***\n\n")); + "***joinbss_evt_callback return a wrong bss ***\n"); return; } spin_lock_bh(&pmlmepriv->lock); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("\n rtw23a_joinbss_event_cb !! _enter_critical\n")); + "rtw23a_joinbss_event_cb !! _enter_critical\n"); if (pnetwork->join_res > 0) { spin_lock_bh(&pmlmepriv->scanned_queue.lock); @@ -1149,8 +1144,7 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) pnetwork); else { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("Can't find ptarget_wlan when " - "joinbss_event callback\n")); + "Can't find ptarget_wlan when joinbss_event callback\n"); spin_unlock_bh(&pmlmepriv->scanned_queue.lock); goto ignore_joinbss_callback; } @@ -1163,8 +1157,7 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) if (!ptarget_sta) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("Can't update stainfo when " - "joinbss_event callback\n")); + "Can't update stainfo when joinbss_event callback\n"); spin_unlock_bh(&pmlmepriv->scanned_queue.lock); goto ignore_joinbss_callback; } @@ -1177,19 +1170,19 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) /* adhoc mode will rtw_indicate_connect23a when rtw_stassoc_event_callback23a */ RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("adhoc mode, fw_state:%x", - get_fwstate(pmlmepriv))); + "adhoc mode, fw_state:%x\n", + get_fwstate(pmlmepriv)); } /* s5. Cancle assoc_timer */ del_timer_sync(&pmlmepriv->assoc_timer); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("Cancle assoc_timer\n")); + "Cancle assoc_timer\n"); } else { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("rtw23a_joinbss_event_cb err: fw_state:%x", - get_fwstate(pmlmepriv))); + "rtw23a_joinbss_event_cb err: fw_state:%x\n", + get_fwstate(pmlmepriv)); spin_unlock_bh(&pmlmepriv->scanned_queue.lock); goto ignore_joinbss_callback; } @@ -1203,8 +1196,8 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("fail! clear _FW_UNDER_LINKING ^^^fw_state=" - "%x\n", get_fwstate(pmlmepriv))); + "fail! clear _FW_UNDER_LINKING ^^^fw_state=%x\n", + get_fwstate(pmlmepriv)); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); } } else { @@ -1255,8 +1248,7 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) if (psta != NULL) { /* the sta have been in sta_info_queue => do nothing */ RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("Error: rtw_stassoc_event_callback23a: sta has " - "been in sta_hash_queue\n")); + "Error: rtw_stassoc_event_callback23a: sta has been in sta_hash_queue\n"); /* between drv has received this event before and fw have not yet to set key to CAM_ENTRY) */ return; @@ -1266,8 +1258,7 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) GFP_KERNEL); if (!psta) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("Can't alloc sta_info when " - "rtw_stassoc_event_callback23a\n")); + "Can't alloc sta_info when rtw_stassoc_event_callback23a\n"); return; } @@ -1645,8 +1636,8 @@ rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv) pnetwork = container_of(plist, struct wlan_network, list); if (!pnetwork) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("%s: return _FAIL:(pnetwork == NULL)\n", - __func__)); + "%s: return _FAIL:(pnetwork == NULL)\n", + __func__); goto exit; } @@ -1672,7 +1663,7 @@ int rtw_do_join_adhoc(struct rtw_adapter *adapter) _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("switching to adhoc master\n")); + "switching to adhoc master\n"); memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(struct cfg80211_ssid)); @@ -1685,7 +1676,7 @@ int rtw_do_join_adhoc(struct rtw_adapter *adapter) ret = rtw_createbss_cmd23a(adapter); if (ret != _SUCCESS) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("Error =>rtw_createbss_cmd23a status FAIL\n")); + "Error =>rtw_createbss_cmd23a status FAIL\n"); } else { pmlmepriv->to_join = false; } @@ -1774,8 +1765,8 @@ int rtw_set_auth23a(struct rtw_adapter *adapter, pcmd->rspsz = 0; RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("after enqueue set_auth_cmd, auth_mode=%x\n", - psecuritypriv->dot11AuthAlgrthm)); + "after enqueue set_auth_cmd, auth_mode=%x\n", + psecuritypriv->dot11AuthAlgrthm); res = rtw_enqueue_cmd23a(pcmdpriv, pcmd); @@ -1815,15 +1806,13 @@ int rtw_set_key23a(struct rtw_adapter *adapter, psetkeyparm->algorithm = (unsigned char) psecuritypriv->dot118021XGrpPrivacy; RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("\n rtw_set_key23a: psetkeyparm->algorithm = " - "(unsigned char)psecuritypriv->dot118021XGrpPrivacy " - "=%d\n", psetkeyparm->algorithm)); + "rtw_set_key23a: psetkeyparm->algorithm = (unsigned char)psecuritypriv->dot118021XGrpPrivacy =%d\n", + psetkeyparm->algorithm); } else { psetkeyparm->algorithm = (u8)psecuritypriv->dot11PrivacyAlgrthm; RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("\n rtw_set_key23a: psetkeyparm->algorithm = (u8)" - "psecuritypriv->dot11PrivacyAlgrthm =%d\n", - psetkeyparm->algorithm)); + "rtw_set_key23a: psetkeyparm->algorithm = (u8)psecuritypriv->dot11PrivacyAlgrthm =%d\n", + psetkeyparm->algorithm); } psetkeyparm->keyid = keyid;/* 0~3 */ psetkeyparm->set_tx = set_tx; @@ -1834,8 +1823,8 @@ int rtw_set_key23a(struct rtw_adapter *adapter, psetkeyparm->algorithm, psetkeyparm->keyid, pmlmepriv->key_mask); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("\n rtw_set_key23a: psetkeyparm->algorithm =%d psetkeyparm->" - "keyid = (u8)keyid =%d\n", psetkeyparm->algorithm, keyid)); + "rtw_set_key23a: psetkeyparm->algorithm =%d psetkeyparm->keyid = (u8)keyid =%d\n", + psetkeyparm->algorithm, keyid); switch (psetkeyparm->algorithm) { case WLAN_CIPHER_SUITE_WEP40: @@ -1862,9 +1851,8 @@ int rtw_set_key23a(struct rtw_adapter *adapter, break; default: RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("\n rtw_set_key23a:psecuritypriv->dot11PrivacyAlgrthm" - " = %x (must be 1 or 2 or 4 or 5)\n", - psecuritypriv->dot11PrivacyAlgrthm)); + "rtw_set_key23a:psecuritypriv->dot11PrivacyAlgrthm = %x (must be 1 or 2 or 4 or 5)\n", + psecuritypriv->dot11PrivacyAlgrthm); res = _FAIL; kfree(pcmd); kfree(psetkeyparm); @@ -1991,8 +1979,8 @@ int rtw_restruct_sec_ie23a(struct rtw_adapter *adapter, u8 *in_ie, u8 *out_ie, uint ndissecuritytype = psecuritypriv->ndisencryptstatus; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, - ("+rtw_restruct_sec_ie23a: ndisauthmode=%d " - "ndissecuritytype=%d\n", ndisauthmode, ndissecuritytype)); + "+rtw_restruct_sec_ie23a: ndisauthmode=%d ndissecuritytype=%d\n", + ndisauthmode, ndissecuritytype); ielength = 0; if (ndisauthmode == Ndis802_11AuthModeWPA || @@ -2058,8 +2046,8 @@ void rtw_update_registrypriv_dev_network23a(struct rtw_adapter *adapter) pdev_network->DSConfig = pregistrypriv->channel; RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("pregistrypriv->channel =%d, pdev_network->DSConfig = 0x%x\n", - pregistrypriv->channel, pdev_network->DSConfig)); + "pregistrypriv->channel =%d, pdev_network->DSConfig = 0x%x\n", + pregistrypriv->channel, pdev_network->DSConfig); if (cur_network->network.ifmode == NL80211_IFTYPE_ADHOC) pdev_network->ATIMWindow = 0; diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 8996c1e24568..196beafde6f0 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -657,8 +657,8 @@ void mgt_dispatcher23a(struct rtw_adapter *padapter, if (index > 13) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("Currently we do not support reserved sub-fr-type =" - "%d\n", index)); + "Currently we do not support reserved sub-fr-type =%d\n", + index); return; } ptable += index; @@ -2685,7 +2685,7 @@ static int _issue_probereq(struct rtw_adapter *padapter, u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, - ("+%s\n", __func__)); + "+%s\n", __func__); pmgntframe = alloc_mgtxmitframe23a(pxmitpriv); if (!pmgntframe) @@ -2756,7 +2756,7 @@ static int _issue_probereq(struct rtw_adapter *padapter, pattrib->last_txcmdsz = pattrib->pktlen; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, - ("issuing probe_req, tx_len =%d\n", pattrib->last_txcmdsz)); + "issuing probe_req, tx_len =%d\n", pattrib->last_txcmdsz); if (wait_ack) { ret = dump_mgntframe23a_and_wait_ack23a(padapter, pmgntframe); @@ -4338,7 +4338,8 @@ static void start_create_ibss(struct rtw_adapter *padapter) /* issue beacon */ if (send_beacon23a(padapter) == _FAIL) { - RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("issuing beacon frame fail....\n")); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, + "issuing beacon frame fail....\n"); report_join_res23a(padapter, -1); pmlmeinfo->state = MSR_NOLINK; @@ -4522,7 +4523,7 @@ static void process_80211d(struct rtw_adapter *padapter, p += 3; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, - ("%s: 802.11d country =%s\n", __func__, country)); + "%s: 802.11d country =%s\n", __func__, country); i = 0; while ((ie - p) >= 3) { @@ -4699,9 +4700,8 @@ static void process_80211d(struct rtw_adapter *padapter, chplan_new[i].ScanType = SCAN_ACTIVE; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, - ("%s: change channel %d scan type " - "from passive to active\n", - __func__, channel)); + "%s: change channel %d scan type from passive to active\n", + __func__, channel); } break; } @@ -6057,7 +6057,7 @@ int mlme_evt_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) /* checking if event code is valid */ if (evt_code >= MAX_C2HEVT) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("\nEvent Code(%d) mismatch!\n", evt_code)); + "Event Code(%d) mismatch!\n", evt_code); goto _abort_event_; } @@ -6065,8 +6065,8 @@ int mlme_evt_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) if (wlanevents[evt_code].parmsize != 0 && wlanevents[evt_code].parmsize != evt_sz) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, - ("\nEvent(%d) Parm Size mismatch (%d vs %d)!\n", - evt_code, wlanevents[evt_code].parmsize, evt_sz)); + "Event(%d) Parm Size mismatch (%d vs %d)!\n", + evt_code, wlanevents[evt_code].parmsize, evt_sz); goto _abort_event_; } diff --git a/drivers/staging/rtl8723au/core/rtw_pwrctrl.c b/drivers/staging/rtl8723au/core/rtw_pwrctrl.c index e2d51afe522c..7488a104935b 100644 --- a/drivers/staging/rtl8723au/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723au/core/rtw_pwrctrl.c @@ -202,17 +202,17 @@ void rtw_set_rpwm23a(struct rtw_adapter *padapter, u8 pslv) if (pwrpriv->rpwm == pslv) { RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_, - ("%s: Already set rpwm[0x%02X], new = 0x%02X!\n", - __func__, pwrpriv->rpwm, pslv)); + "%s: Already set rpwm[0x%02X], new = 0x%02X!\n", + __func__, pwrpriv->rpwm, pslv); return; } if (padapter->bSurpriseRemoved == true || padapter->hw_init_completed == false) { RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_, - ("%s: SurpriseRemoved(%d) hw_init_completed(%d)\n", - __func__, padapter->bSurpriseRemoved, - padapter->hw_init_completed)); + "%s: SurpriseRemoved(%d) hw_init_completed(%d)\n", + __func__, padapter->bSurpriseRemoved, + padapter->hw_init_completed); pwrpriv->cpwm = PS_STATE_S4; @@ -221,22 +221,21 @@ void rtw_set_rpwm23a(struct rtw_adapter *padapter, u8 pslv) if (padapter->bDriverStopped == true) { RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_, - ("%s: change power state(0x%02X) when DriverStopped\n", - __func__, pslv)); + "%s: change power state(0x%02X) when DriverStopped\n", + __func__, pslv); if (pslv < PS_STATE_S2) { RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_, - ("%s: Reject to enter PS_STATE(0x%02X) lower " - "than S2 when DriverStopped!!\n", - __func__, pslv)); + "%s: Reject to enter PS_STATE(0x%02X) lower than S2 when DriverStopped!!\n", + __func__, pslv); return; } } rpwm = pslv | pwrpriv->tog; RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_notice_, - ("rtw_set_rpwm23a: rpwm = 0x%02x cpwm = 0x%02x\n", - rpwm, pwrpriv->cpwm)); + "rtw_set_rpwm23a: rpwm = 0x%02x cpwm = 0x%02x\n", + rpwm, pwrpriv->cpwm); pwrpriv->rpwm = pslv; @@ -282,12 +281,12 @@ void rtw_set_ps_mode23a(struct rtw_adapter *padapter, u8 ps_mode, struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_notice_, - ("%s: PowerMode =%d Smart_PS =%d\n", - __func__, ps_mode, smart_ps)); + "%s: PowerMode =%d Smart_PS =%d\n", + __func__, ps_mode, smart_ps); if (ps_mode > PM_Card_Disable) { RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_, - ("ps_mode:%d error\n", ps_mode)); + "ps_mode:%d error\n", ps_mode); return; } diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 9ce6d22b9589..274a4b65c022 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -299,9 +299,9 @@ int recvframe_chkmic(struct rtw_adapter *adapter, if (prxattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("\n recvframe_chkmic:prxattrib->encrypt == WLAN_CIPHER_SUITE_TKIP\n")); + "recvframe_chkmic:prxattrib->encrypt == WLAN_CIPHER_SUITE_TKIP\n"); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("\n recvframe_chkmic:da = %pM\n", prxattrib->ra)); + "recvframe_chkmic:da = %pM\n", prxattrib->ra); /* calculate mic code */ if (stainfo != NULL) { @@ -309,14 +309,13 @@ int recvframe_chkmic(struct rtw_adapter *adapter, mickey = &psecuritypriv->dot118021XGrprxmickey[prxattrib->key_index].skey[0]; RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("\n recvframe_chkmic: bcmc key\n")); + "recvframe_chkmic: bcmc key\n"); if (!psecuritypriv->binstallGrpkey) { res = _FAIL; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("\n recvframe_chkmic:didn't " - "install group key!!!!!!\n")); + "recvframe_chkmic:didn't install group key!\n"); DBG_8723A("\n recvframe_chkmic:didn't " "install group key!!!!!!\n"); goto exit; @@ -324,8 +323,7 @@ int recvframe_chkmic(struct rtw_adapter *adapter, } else { mickey = &stainfo->dot11tkiprxmickey.skey[0]; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("\n recvframe_chkmic: unicast " - "key\n")); + "recvframe_chkmic: unicast key\n"); } /* icv_len included the mic code */ @@ -336,9 +334,8 @@ int recvframe_chkmic(struct rtw_adapter *adapter, prxattrib->iv_len; RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("\n prxattrib->iv_len =%d prxattrib->icv_len =" - "%d\n", prxattrib->iv_len, - prxattrib->icv_len)); + "prxattrib->iv_len =%d prxattrib->icv_len =%d\n", + prxattrib->iv_len, prxattrib->icv_len); /* care the length of the data */ rtw_seccalctkipmic23a(mickey, pframe, payload, @@ -353,10 +350,9 @@ int recvframe_chkmic(struct rtw_adapter *adapter, if (miccode[i] != *(pframemic + i)) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("recvframe_chkmic:miccode" - "[%d](%02x) != *(pframemic+" - "%d)(%02x) ", i, miccode[i], - i, *(pframemic + i))); + "recvframe_chkmic:miccode[%d](%02x) != *(pframemic+%d)(%02x)\n", + i, miccode[i], + i, *(pframemic + i)); bmic_err = true; } } @@ -365,47 +361,44 @@ int recvframe_chkmic(struct rtw_adapter *adapter, int i; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("\n *(pframemic-8)-*(pframemic-1) =" - "0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:" - "0x%02x:0x%02x:0x%02x\n", - *(pframemic - 8), *(pframemic - 7), - *(pframemic - 6), *(pframemic - 5), - *(pframemic - 4), *(pframemic - 3), - *(pframemic - 2), *(pframemic - 1))); + "*(pframemic-8)-*(pframemic-1) =0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n", + *(pframemic - 8), *(pframemic - 7), + *(pframemic - 6), *(pframemic - 5), + *(pframemic - 4), *(pframemic - 3), + *(pframemic - 2), *(pframemic - 1)); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("\n *(pframemic-16)-*(pframemic-9) =" - "0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:" - "0x%02x:0x%02x:0x%02x\n", - *(pframemic - 16), *(pframemic - 15), - *(pframemic - 14), *(pframemic - 13), - *(pframemic - 12), *(pframemic - 11), - *(pframemic - 10), *(pframemic - 9))); + "*(pframemic-16)-*(pframemic-9) =0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n", + *(pframemic - 16), *(pframemic - 15), + *(pframemic - 14), *(pframemic - 13), + *(pframemic - 12), *(pframemic - 11), + *(pframemic - 10), *(pframemic - 9)); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("\n ====== demp packet (len =%d) ======" - "\n", precvframe->pkt->len)); + "====== demp packet (len =%d) ======\n", + precvframe->pkt->len); for (i = 0; i < precvframe->pkt->len; i = i + 8) { RT_TRACE(_module_rtl871x_recv_c_, - _drv_err_, ("0x%02x:0x%02x:0x" - "%02x:0x%02x:0x%0" - "2x:0x%02x:0x%02x" - ":0x%02x", - *(precvframe->pkt->data+i),*(precvframe->pkt->data+i+1), - *(precvframe->pkt->data+i+2),*(precvframe->pkt->data+i+3), - *(precvframe->pkt->data+i+4),*(precvframe->pkt->data+i+5), - *(precvframe->pkt->data+i+6),*(precvframe->pkt->data+i+7))); + _drv_err_, + "0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n", + *(precvframe->pkt->data+i), + *(precvframe->pkt->data+i+1), + *(precvframe->pkt->data+i+2), + *(precvframe->pkt->data+i+3), + *(precvframe->pkt->data+i+4), + *(precvframe->pkt->data+i+5), + *(precvframe->pkt->data+i+6), + *(precvframe->pkt->data+i+7)); } RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("\n ====== demp packet end [len =%d]" - "======\n", precvframe->pkt->len)); + "====== demp packet end [len =%d]======\n", + precvframe->pkt->len); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("\n hrdlen =%d,\n", - prxattrib->hdrlen)); + "hrdlen =%d\n", prxattrib->hdrlen); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("ra = %pM psecuritypriv->binstallGrpkey =%d ", - prxattrib->ra, - psecuritypriv->binstallGrpkey)); + "ra = %pM psecuritypriv->binstallGrpkey =%d\n", + prxattrib->ra, + psecuritypriv->binstallGrpkey); /* double check key_index for some timing issue, cannot compare with @@ -419,16 +412,17 @@ int recvframe_chkmic(struct rtw_adapter *adapter, if ((prxattrib->bdecrypted == true) && (brpt_micerror == true)) { rtw_handle_tkip_mic_err23a(adapter, (u8)is_multicast_ether_addr(prxattrib->ra)); - RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, (" mic error :prxattrib->bdecrypted =%d ", prxattrib->bdecrypted)); + RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, + "mic error :prxattrib->bdecrypted =%d\n", + prxattrib->bdecrypted); DBG_8723A(" mic error :prxattrib->" "bdecrypted =%d\n", prxattrib->bdecrypted); } else { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - (" mic error :prxattrib->" - "bdecrypted =%d ", - prxattrib->bdecrypted)); + "mic error :prxattrib->bdecrypted =%d\n", + prxattrib->bdecrypted); DBG_8723A(" mic error :prxattrib->" "bdecrypted =%d\n", prxattrib->bdecrypted); @@ -442,14 +436,12 @@ int recvframe_chkmic(struct rtw_adapter *adapter, psecuritypriv->bcheck_grpkey = 1; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("psecuritypriv->bcheck_grp" - "key = true")); + "psecuritypriv->bcheck_grpkey = true\n"); } } } else { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("recvframe_chkmic: rtw_get_stainfo23a ==" - "NULL!!!\n")); + "recvframe_chkmic: rtw_get_stainfo23a ==NULL!!!\n"); } skb_trim(precvframe->pkt, precvframe->pkt->len - 8); @@ -474,8 +466,8 @@ struct recv_frame *decryptor(struct rtw_adapter *padapter, int res = _SUCCESS; RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("prxstat->decrypted =%x prxattrib->encrypt = 0x%03x\n", - prxattrib->bdecrypted, prxattrib->encrypt)); + "prxstat->decrypted =%x prxattrib->encrypt = 0x%03x\n", + prxattrib->bdecrypted, prxattrib->encrypt); if (prxattrib->encrypt > 0) { u8 *iv = precv_frame->pkt->data + prxattrib->hdrlen; @@ -558,8 +550,8 @@ static struct recv_frame *portctrl(struct rtw_adapter *adapter, psta = rtw_get_stainfo23a(pstapriv, psta_addr); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("########portctrl:adapter->securitypriv.dot11AuthAlgrthm =" - "%d\n", adapter->securitypriv.dot11AuthAlgrthm)); + "########portctrl:adapter->securitypriv.dot11AuthAlgrthm =%d\n", + adapter->securitypriv.dot11AuthAlgrthm); prtnframe = precv_frame; @@ -573,8 +565,7 @@ static struct recv_frame *portctrl(struct rtw_adapter *adapter, /* blocked */ /* only accept EAPOL frame */ RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("########portctrl:psta->ieee8021x_blocked ==" - "1\n")); + "########portctrl:psta->ieee8021x_blocked ==1\n"); if (ether_type != eapol_type) { /* free this frame */ @@ -601,8 +592,8 @@ int recv_decache(struct recv_frame *precv_frame, u8 bretry, if (tid > 15) { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("recv_decache, (tid>15)! seq_ctrl = 0x%x, tid = 0x%x\n", - seq_ctrl, tid)); + "recv_decache, (tid>15)! seq_ctrl = 0x%x, tid = 0x%x\n", + seq_ctrl, tid); return _FAIL; } @@ -610,9 +601,8 @@ int recv_decache(struct recv_frame *precv_frame, u8 bretry, if (1) { /* if (bretry) */ if (seq_ctrl == prxcache->tid_rxseq[tid]) { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("recv_decache, seq_ctrl = 0x%x, tid = 0x%x, " - "tid_rxseq = 0x%x\n", - seq_ctrl, tid, prxcache->tid_rxseq[tid])); + "recv_decache, seq_ctrl = 0x%x, tid = 0x%x, tid_rxseq = 0x%x\n", + seq_ctrl, tid, prxcache->tid_rxseq[tid]); return _FAIL; } @@ -770,7 +760,7 @@ static int sta2sta_data_frame(struct rtw_adapter *adapter, /* filter packets that SA is myself or multicast or broadcast */ if (ether_addr_equal(myhwaddr, pattrib->src)) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - (" SA == myself\n")); + "SA == myself\n"); ret = _FAIL; goto exit; } @@ -793,8 +783,7 @@ static int sta2sta_data_frame(struct rtw_adapter *adapter, and DA is my mac-address */ if (!ether_addr_equal(pattrib->bssid, pattrib->src)) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("bssid != TA under STATION_MODE; drop " - "pkt\n")); + "bssid != TA under STATION_MODE; drop pkt\n"); ret = _FAIL; goto exit; } @@ -836,7 +825,8 @@ static int sta2sta_data_frame(struct rtw_adapter *adapter, *psta = rtw_get_stainfo23a(pstapriv, sta_addr); /* get ap_info */ if (*psta == NULL) { - RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under sta2sta_data_frame ; drop pkt\n")); + RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, + "can't get psta under sta2sta_data_frame ; drop pkt\n"); ret = _FAIL; goto exit; } @@ -872,7 +862,7 @@ int ap2sta_data_frame(struct rtw_adapter *adapter, /* filter packets that SA is myself or multicast or broadcast */ if (ether_addr_equal(myhwaddr, pattrib->src)) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - (" SA == myself\n")); + "SA == myself\n"); ret = _FAIL; goto exit; } @@ -880,8 +870,8 @@ int ap2sta_data_frame(struct rtw_adapter *adapter, /* da should be for me */ if (!ether_addr_equal(myhwaddr, pattrib->dst) && !bmcast) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - (" ap2sta_data_frame: compare DA fail; DA=%pM\n", - pattrib->dst)); + "ap2sta_data_frame: compare DA failed; DA=%pM\n", + pattrib->dst); ret = _FAIL; goto exit; } @@ -891,10 +881,10 @@ int ap2sta_data_frame(struct rtw_adapter *adapter, ether_addr_equal(mybssid, "\x0\x0\x0\x0\x0\x0") || !ether_addr_equal(pattrib->bssid, mybssid)) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - (" ap2sta_data_frame: compare BSSID fail ; BSSID=%pM\n", - pattrib->bssid)); + "ap2sta_data_frame: compare BSSID failed; BSSID=%pM\n", + pattrib->bssid); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("mybssid=%pM\n", mybssid)); + "mybssid=%pM\n", mybssid); if (!bmcast) { DBG_8723A("issue_deauth23a to the nonassociated ap=%pM for the reason(7)\n", @@ -915,8 +905,7 @@ int ap2sta_data_frame(struct rtw_adapter *adapter, if (*psta == NULL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("ap2sta: can't get psta under STATION_MODE ;" - " drop pkt\n")); + "ap2sta: can't get psta under STATION_MODE; drop pkt\n"); ret = _FAIL; goto exit; } @@ -944,7 +933,7 @@ int ap2sta_data_frame(struct rtw_adapter *adapter, *psta = rtw_get_stainfo23a(pstapriv, pattrib->bssid); if (*psta == NULL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("can't get psta under MP_MODE ; drop pkt\n")); + "can't get psta under MP_MODE ; drop pkt\n"); ret = _FAIL; goto exit; } @@ -1001,7 +990,7 @@ int sta2ap_data_frame(struct rtw_adapter *adapter, *psta = rtw_get_stainfo23a(pstapriv, pattrib->src); if (*psta == NULL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("can't get psta under AP_MODE; drop pkt\n")); + "can't get psta under AP_MODE; drop pkt\n"); DBG_8723A("issue_deauth23a to sta=%pM for the reason(7)\n", pattrib->src); @@ -1204,12 +1193,12 @@ static int validate_recv_mgnt_frame(struct rtw_adapter *padapter, /* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */ RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("+validate_recv_mgnt_frame\n")); + "+validate_recv_mgnt_frame\n"); precv_frame = recvframe_chk_defrag23a(padapter, precv_frame); if (precv_frame == NULL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("%s: fragment packet\n", __func__)); + "%s: fragment packet\n", __func__); return _SUCCESS; } @@ -1295,7 +1284,7 @@ static int validate_recv_data_frame(struct rtw_adapter *adapter, ether_addr_copy(pattrib->ra, hdr->addr1); ether_addr_copy(pattrib->ta, hdr->addr2); ret = _FAIL; - RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, (" case 3\n")); + RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, "case 3\n"); break; } @@ -1304,7 +1293,7 @@ static int validate_recv_data_frame(struct rtw_adapter *adapter, if (!psta) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - (" after to_fr_ds_chk; psta == NULL\n")); + "after to_fr_ds_chk; psta == NULL\n"); ret = _FAIL; goto exit; } @@ -1347,26 +1336,25 @@ static int validate_recv_data_frame(struct rtw_adapter *adapter, if (recv_decache(precv_frame, bretry, &psta->sta_recvpriv.rxcache) == _FAIL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("decache : drop pkt\n")); + "decache : drop pkt\n"); ret = _FAIL; goto exit; } if (pattrib->privacy) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("validate_recv_data_frame:pattrib->privacy =%x\n", - pattrib->privacy)); + "validate_recv_data_frame:pattrib->privacy =%x\n", + pattrib->privacy); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("\n ^^^^^^^^^^^is_multicast_ether_addr" - "(pattrib->ra(0x%02x)) =%d^^^^^^^^^^^^^^^6\n", - pattrib->ra[0], - is_multicast_ether_addr(pattrib->ra))); + "^^^^^^^^^^^is_multicast_ether_addr(pattrib->ra(0x%02x)) =%d^^^^^^^^^^^^^^^6\n", + pattrib->ra[0], + is_multicast_ether_addr(pattrib->ra)); GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, is_multicast_ether_addr(pattrib->ra)); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("\n pattrib->encrypt =%d\n", pattrib->encrypt)); + "pattrib->encrypt =%d\n", pattrib->encrypt); switch (pattrib->encrypt) { case WLAN_CIPHER_SUITE_WEP40: @@ -1447,7 +1435,7 @@ static int validate_recv_frame(struct rtw_adapter *adapter, /* add version chk */ if (ver != 0) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("validate_recv_data_frame fail! (ver!= 0)\n")); + "validate_recv_data_frame fail! (ver!= 0)\n"); retval = _FAIL; goto exit; } @@ -1472,7 +1460,7 @@ static int validate_recv_frame(struct rtw_adapter *adapter, retval = validate_recv_mgnt_frame(adapter, precv_frame); if (retval == _FAIL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("validate_recv_mgnt_frame fail\n")); + "validate_recv_mgnt_frame fail\n"); } retval = _FAIL; /* only data frame return _SUCCESS */ break; @@ -1480,7 +1468,7 @@ static int validate_recv_frame(struct rtw_adapter *adapter, retval = validate_recv_ctrl_frame(adapter, precv_frame); if (retval == _FAIL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("validate_recv_ctrl_frame fail\n")); + "validate_recv_ctrl_frame fail\n"); } retval = _FAIL; /* only data frame return _SUCCESS */ break; @@ -1489,13 +1477,13 @@ static int validate_recv_frame(struct rtw_adapter *adapter, retval = validate_recv_data_frame(adapter, precv_frame); if (retval == _FAIL) { struct recv_priv *precvpriv = &adapter->recvpriv; - /* RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("validate_recv_data_frame fail\n")); */ + precvpriv->rx_drop++; } break; default: RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("validate_recv_data_frame fail! type = 0x%x\n", type)); + "validate_recv_data_frame fail! type = 0x%x\n", type); retval = _FAIL; break; } @@ -1542,8 +1530,8 @@ static int wlanhdr_to_ethhdr (struct recv_frame *precvframe) len = skb->len - hdrlen; RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("\n === pattrib->hdrlen: %x, pattrib->iv_len:%x ===\n\n", - pattrib->hdrlen, pattrib->iv_len)); + "=== pattrib->hdrlen: %x, pattrib->iv_len:%x ===\n", + pattrib->hdrlen, pattrib->iv_len); pattrib->eth_type = eth_type; if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { @@ -1655,7 +1643,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, rtw_free_recvframe23a_queue(defrag_q); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("Performance defrag!!!!!\n")); + "Performance defrag!!!!!\n"); @@ -1726,8 +1714,8 @@ struct recv_frame *recvframe_chk_defrag23a(struct rtw_adapter *padapter, /* spin_unlock(&pdefrag_q->lock); */ RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("Enqueuq: ismfrag = %d, fragnum = %d\n", - ismfrag, fragnum)); + "Enqueuq: ismfrag = %d, fragnum = %d\n", + ismfrag, fragnum); prtnframe = NULL; @@ -1737,8 +1725,8 @@ struct recv_frame *recvframe_chk_defrag23a(struct rtw_adapter *padapter, rtw_free_recvframe23a(precv_frame); prtnframe = NULL; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("Free because pdefrag_q == NULL: ismfrag = " - "%d, fragnum = %d\n", ismfrag, fragnum)); + "Free because pdefrag_q == NULL: ismfrag = %d, fragnum = %d\n", + ismfrag, fragnum); } } @@ -1753,8 +1741,8 @@ struct recv_frame *recvframe_chk_defrag23a(struct rtw_adapter *padapter, /* call recvframe_defrag to defrag */ RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("defrag: ismfrag = %d, fragnum = %d\n", - ismfrag, fragnum)); + "defrag: ismfrag = %d, fragnum = %d\n", + ismfrag, fragnum); precv_frame = recvframe_defrag(padapter, pdefrag_q); prtnframe = precv_frame; } else { @@ -1763,8 +1751,8 @@ struct recv_frame *recvframe_chk_defrag23a(struct rtw_adapter *padapter, rtw_free_recvframe23a(precv_frame); prtnframe = NULL; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("Free because pdefrag_q == NULL: ismfrag = " - "%d, fragnum = %d\n", ismfrag, fragnum)); + "Free because pdefrag_q == NULL: ismfrag = %d, fragnum = %d\n", + ismfrag, fragnum); } } @@ -1773,8 +1761,7 @@ struct recv_frame *recvframe_chk_defrag23a(struct rtw_adapter *padapter, /* after defrag we must check tkip mic code */ if (recvframe_chkmic(padapter, prtnframe) == _FAIL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("recvframe_chkmic(padapter, prtnframe) ==" - "_FAIL\n")); + "recvframe_chkmic(padapter, prtnframe) ==_FAIL\n"); rtw_free_recvframe23a(prtnframe); prtnframe = NULL; } @@ -1873,7 +1860,6 @@ static int enqueue_reorder_recvframe23a(struct recv_reorder_ctrl *preorder_ctrl, continue; } else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num)) { /* Duplicate entry is found!! Do not insert current entry. */ - /* RT_TRACE(COMP_RX_REORDER, DBG_TRACE, ("InsertRxReorderList(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum)); */ /* spin_unlock_irqrestore(&ppending_recvframe_queue->lock); */ return false; @@ -1894,7 +1880,6 @@ static int enqueue_reorder_recvframe23a(struct recv_reorder_ctrl *preorder_ctrl, /* spin_unlock_ex(&ppending_recvframe_queue->lock); */ /* spin_unlock_irqrestore(&ppending_recvframe_queue->lock); */ - /* RT_TRACE(COMP_RX_REORDER, DBG_TRACE, ("InsertRxReorderList(): Pkt insert into buffer!! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum)); */ return true; } @@ -1946,10 +1931,9 @@ int recv_indicatepkts_in_order(struct rtw_adapter *padapter, if (!SN_LESS(preorder_ctrl->indicate_seq, pattrib->seq_num)) { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("recv_indicatepkts_in_order: indicate =%d " - "seq =%d amsdu =%d\n", - preorder_ctrl->indicate_seq, - pattrib->seq_num, pattrib->amsdu)); + "recv_indicatepkts_in_order: indicate =%d seq =%d amsdu =%d\n", + preorder_ctrl->indicate_seq, + pattrib->seq_num, pattrib->amsdu); plist = plist->next; list_del_init(&prframe->list); @@ -2011,8 +1995,7 @@ int recv_indicatepkt_reorder(struct rtw_adapter *padapter, if ((padapter->bDriverStopped == false) && (padapter->bSurpriseRemoved == false)) { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("@@@@ recv_indicatepkt_reorder -" - "recv_func recv_indicatepkt\n")); + "@@@@ recv_indicatepkt_reorder -recv_func recv_indicatepkt\n"); rtw_recv_indicatepkt23a(padapter, prframe); return _SUCCESS; @@ -2045,8 +2028,8 @@ int recv_indicatepkt_reorder(struct rtw_adapter *padapter, spin_lock_bh(&ppending_recvframe_queue->lock); RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("recv_indicatepkt_reorder: indicate =%d seq =%d\n", - preorder_ctrl->indicate_seq, pattrib->seq_num)); + "recv_indicatepkt_reorder: indicate =%d seq =%d\n", + preorder_ctrl->indicate_seq, pattrib->seq_num); /* s2. check if winstart_b(indicate_seq) needs to been updated */ if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) { @@ -2139,7 +2122,7 @@ int process_recv_indicatepkts(struct rtw_adapter *padapter, retval = wlanhdr_to_ethhdr(prframe); if (retval != _SUCCESS) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("wlanhdr_to_ethhdr: drop pkt\n")); + "wlanhdr_to_ethhdr: drop pkt\n"); return retval; } @@ -2147,19 +2130,16 @@ int process_recv_indicatepkts(struct rtw_adapter *padapter, (padapter->bSurpriseRemoved == false)) { /* indicate this recv_frame */ RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("@@@@ process_recv_indicatepkts- " - "recv_func recv_indicatepkt\n")); + "@@@@ process_recv_indicatepkts- recv_func recv_indicatepkt\n"); rtw_recv_indicatepkt23a(padapter, prframe); } else { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("@@@@ process_recv_indicatepkts- " - "recv_func free_indicatepkt\n")); + "@@@@ process_recv_indicatepkts- recv_func free_indicatepkt\n"); RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("recv_func:bDriverStopped(%d) OR " - "bSurpriseRemoved(%d)", - padapter->bDriverStopped, - padapter->bSurpriseRemoved)); + "recv_func:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", + padapter->bDriverStopped, + padapter->bSurpriseRemoved); retval = _FAIL; return retval; } @@ -2178,7 +2158,7 @@ static int recv_func_prehandle(struct rtw_adapter *padapter, ret = validate_recv_frame(padapter, rframe); if (ret != _SUCCESS) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("recv_func: validate_recv_frame fail! drop pkt\n")); + "recv_func: validate_recv_frame fail! drop pkt\n"); rtw_free_recvframe23a(rframe); goto exit; } @@ -2198,7 +2178,7 @@ static int recv_func_posthandle(struct rtw_adapter *padapter, prframe = decryptor(padapter, prframe); if (prframe == NULL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("decryptor: drop pkt\n")); + "decryptor: drop pkt\n"); ret = _FAIL; goto _recv_data_drop; } @@ -2206,7 +2186,7 @@ static int recv_func_posthandle(struct rtw_adapter *padapter, prframe = recvframe_chk_defrag23a(padapter, prframe); if (!prframe) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("recvframe_chk_defrag23a: drop pkt\n")); + "recvframe_chk_defrag23a: drop pkt\n"); goto _recv_data_drop; } @@ -2225,7 +2205,7 @@ static int recv_func_posthandle(struct rtw_adapter *padapter, prframe = portctrl(padapter, prframe); if (!prframe) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("portctrl: drop pkt\n")); + "portctrl: drop pkt\n"); ret = _FAIL; goto _recv_data_drop; } @@ -2235,7 +2215,7 @@ static int recv_func_posthandle(struct rtw_adapter *padapter, ret = process_recv_indicatepkts(padapter, prframe); if (ret != _SUCCESS) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("recv_func: process_recv_indicatepkts fail!\n")); + "recv_func: process_recv_indicatepkts fail!\n"); rtw_free_recvframe23a(orig_prframe);/* free this recv_frame */ goto _recv_data_drop; } diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 045a24c81b12..ea670afcc212 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -248,14 +248,11 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter, if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] || crc[1] != payload[length - 3] || crc[0] != payload[length - 4]) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - ("rtw_wep_decrypt23a:icv error crc[3](%x)!= payload" - "[length-1](%x) || crc[2](%x)!= payload[length-2](%x)" - " || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)" - "!= payload[length-4](%x)\n", - crc[3], payload[length - 1], - crc[2], payload[length - 2], - crc[1], payload[length - 3], - crc[0], payload[length - 4])); + "rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n", + crc[3], payload[length - 1], + crc[2], payload[length - 2], + crc[1], payload[length - 3], + crc[0], payload[length - 4]); } } @@ -644,7 +641,8 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, return _FAIL; } - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_encrypt23a: stainfo!= NULL!!!\n")); + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_tkip_encrypt23a: stainfo!= NULL!!!\n"); if (is_multicast_ether_addr(pattrib->ra)) prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; @@ -668,7 +666,10 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, if ((curfragnum+1) == pattrib->nr_frags) { /* 4 the last fragment */ length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; - RT_TRACE(_module_rtl871x_security_c_, _drv_info_, ("pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len, pattrib->icv_len)); + RT_TRACE(_module_rtl871x_security_c_, _drv_info_, + "pattrib->iv_len =%x, pattrib->icv_len =%x\n", + pattrib->iv_len, + pattrib->icv_len); *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ arcfour_init(&mycontext, rc4key, 16); @@ -690,7 +691,8 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, } else{ - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_encrypt23a: stainfo == NULL!!!\n")); + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_tkip_encrypt23a: stainfo == NULL!!!\n"); DBG_8723A("%s, psta == NUL\n", __func__); res = _FAIL; } @@ -738,7 +740,8 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey; prwskeylen = 16; } else { - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_decrypt23a: stainfo!= NULL!!!\n")); + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_tkip_decrypt23a: stainfo!= NULL!!!\n"); prwskey = &stainfo->dot118021x_UncstKey.skey[0]; prwskeylen = 16; } @@ -763,12 +766,17 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, if (crc[3]!= payload[length-1] || crc[2]!= payload[length-2] || crc[1]!= payload[length-3] || crc[0]!= payload[length-4]) { - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n", - crc[3], payload[length-1], crc[2], payload[length-2], crc[1], payload[length-3], crc[0], payload[length-4])); + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n", + crc[3], payload[length-1], + crc[2], payload[length-2], + crc[1], payload[length-3], + crc[0], payload[length-4]); res = _FAIL; } } else { - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_decrypt23a: stainfo == NULL!!!\n")); + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_tkip_decrypt23a: stainfo == NULL!!!\n"); res = _FAIL; } } @@ -1304,7 +1312,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter, if (!stainfo) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - ("rtw_aes_encrypt23a: stainfo == NULL!!!\n")); + "rtw_aes_encrypt23a: stainfo == NULL!!!\n"); DBG_8723A("%s, psta == NUL\n", __func__); res = _FAIL; goto out; @@ -1315,7 +1323,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter, return _FAIL; } RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - ("rtw_aes_encrypt23a: stainfo!= NULL!!!\n")); + "rtw_aes_encrypt23a: stainfo!= NULL!!!\n"); if (is_multicast_ether_addr(pattrib->ra)) prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; @@ -1544,8 +1552,9 @@ static int aes_decipher(u8 *key, uint hdrlen, for (i = 0; i < 8; i++) { if (pframe[hdrlen+8+plen-8+i] != message[hdrlen+8+plen-8+i]) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - ("aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n", - i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i])); + "aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n", + i, pframe[hdrlen + 8 + plen - 8 + i], + message[hdrlen + 8 + plen - 8 + i]); DBG_8723A("aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n", i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]); res = _FAIL; @@ -1573,13 +1582,13 @@ int rtw_aes_decrypt23a(struct rtw_adapter *padapter, stainfo = rtw_get_stainfo23a(&padapter->stapriv, &prxattrib->ta[0]); if (!stainfo) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - ("rtw_aes_encrypt23a: stainfo == NULL!!!\n")); + "rtw_aes_encrypt23a: stainfo == NULL!!!\n"); res = _FAIL; goto exit; } RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - ("rtw_aes_decrypt23a: stainfo!= NULL!!!\n")); + "rtw_aes_decrypt23a: stainfo!= NULL!!!\n"); if (is_multicast_ether_addr(prxattrib->ra)) { /* in concurrent we should use sw decrypt in group key, @@ -1613,9 +1622,10 @@ void rtw_use_tkipkey_handler23a(void *FunctionContext) { struct rtw_adapter *padapter = (struct rtw_adapter *)FunctionContext; - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("^^^rtw_use_tkipkey_handler23a ^^^\n")); + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "^^^rtw_use_tkipkey_handler23a ^^^\n"); padapter->securitypriv.busetkipkey = 1; RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - ("^^^rtw_use_tkipkey_handler23a padapter->securitypriv.busetkipkey =%d^^^\n", - padapter->securitypriv.busetkipkey)); + "^^^rtw_use_tkipkey_handler23a padapter->securitypriv.busetkipkey =%d^^^\n", + padapter->securitypriv.busetkipkey); } diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c index d17998da8600..b06bff74502a 100644 --- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c @@ -136,10 +136,10 @@ rtw_alloc_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr, gfp_t gfp) index = wifi_mac_hash(hwaddr); RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, - ("rtw_alloc_stainfo23a: index = %x", index)); + "rtw_alloc_stainfo23a: index = %x\n", index); if (index >= NUM_STA) { RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, - ("ERROR => rtw_alloc_stainfo23a: index >= NUM_STA")); + "ERROR => rtw_alloc_stainfo23a: index >= NUM_STA\n"); psta = NULL; goto exit; } @@ -160,8 +160,8 @@ rtw_alloc_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr, gfp_t gfp) &wRxSeqInitialValue, 2); RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, - ("alloc number_%d stainfo with hwaddr = %pM\n", - pstapriv->asoc_sta_count, hwaddr)); + "alloc number_%d stainfo with hwaddr = %pM\n", + pstapriv->asoc_sta_count, hwaddr); init_addba_retry_timer23a(psta); @@ -249,10 +249,8 @@ int rtw_free_stainfo23a(struct rtw_adapter *padapter, struct sta_info *psta) list_del_init(&psta->hash_list); RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, - ("\n free number_%d stainfo with hwaddr = 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x\n", - pstapriv->asoc_sta_count, psta->hwaddr[0], - psta->hwaddr[1], psta->hwaddr[2], psta->hwaddr[3], - psta->hwaddr[4], psta->hwaddr[5])); + "free number_%d stainfo with hwaddr = %pM\n", + pstapriv->asoc_sta_count, psta->hwaddr); pstapriv->asoc_sta_count--; /* re-init sta_info; 20061114 will be init in alloc_stainfo */ @@ -397,7 +395,7 @@ int rtw_init_bcmc_stainfo23a(struct rtw_adapter *padapter) if (psta == NULL) { res = _FAIL; RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, - ("rtw_alloc_stainfo23a fail")); + "rtw_alloc_stainfo23a fail\n"); return res; } /* default broadcast & multicast use macid 1 */ diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c index 829bba7fa59c..5280338aa387 100644 --- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c @@ -926,10 +926,9 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, } RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d " - "cur_network->network.Ssid.Ssid:%s len:%d\n", __func__, - ssid, ssid_len, cur_network->network.Ssid.ssid, - cur_network->network.Ssid.ssid_len)); + "%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d cur_network->network.Ssid.Ssid:%s len:%d\n", + __func__, ssid, ssid_len, cur_network->network.Ssid.ssid, + cur_network->network.Ssid.ssid_len); if (ssid_len != cur_network->network.Ssid.ssid_len || ssid_len > 32 || (ssid_len && @@ -947,8 +946,8 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, privacy = 0; RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s(): cur_network->network.Privacy is %d, bssid.Privacy " - "is %d\n", __func__, cur_network->network.Privacy, privacy)); + "%s(): cur_network->network.Privacy is %d, bssid.Privacy is %d\n", + __func__, cur_network->network.Privacy, privacy); if (cur_network->network.Privacy != privacy) { DBG_8723A("%s(), privacy is not match return FAIL\n", __func__); goto _mismatch; @@ -962,10 +961,9 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, &pairwise_cipher, &is_8021x); if (r == _SUCCESS) RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s pnetwork->pairwise_cipher: %d, " - "pnetwork->group_cipher: %d, is_802x " - ": %d\n", __func__, pairwise_cipher, - group_cipher, is_8021x)); + "%s pnetwork->pairwise_cipher: %d, pnetwork->group_cipher: %d, is_802x : %d\n", + __func__, pairwise_cipher, + group_cipher, is_8021x); } } else { p = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, @@ -977,10 +975,9 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, &pairwise_cipher, &is_8021x); if (r == _SUCCESS) RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, - ("%s pnetwork->pairwise_cipher: %d, " - "group_cipher is %d, is_8021x is " - "%d\n", __func__, pairwise_cipher, - group_cipher, is_8021x)); + "%s pnetwork->pairwise_cipher: %d, group_cipher is %d, is_8021x is %d\n", + __func__, pairwise_cipher, + group_cipher, is_8021x); } else { if (privacy) crypto = ENCRYP_PROTOCOL_WEP; @@ -996,8 +993,8 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, if (crypto == ENCRYP_PROTOCOL_WPA || crypto == ENCRYP_PROTOCOL_WPA2) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, - ("%s cur_network->group_cipher is %d: %d\n", __func__, - cur_network->BcnInfo.group_cipher, group_cipher)); + "%s cur_network->group_cipher is %d: %d\n", __func__, + cur_network->BcnInfo.group_cipher, group_cipher); if (pairwise_cipher != cur_network->BcnInfo.pairwise_cipher || group_cipher != cur_network->BcnInfo.group_cipher) { DBG_8723A("%s pairwise_cipher(%x:%x) or group_cipher " diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c index 98602d92b2fa..a4b6bb6c79a9 100644 --- a/drivers/staging/rtl8723au/core/rtw_xmit.c +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c @@ -463,9 +463,7 @@ static int update_attrib(struct rtw_adapter *padapter, /* 67 : UDP BOOTP server */ RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("======================" - "update_attrib: get DHCP " - "Packet\n")); + "======================update_attrib: get DHCP Packet\n"); pattrib->dhcp_pkt = 1; } } @@ -493,8 +491,8 @@ static int update_attrib(struct rtw_adapter *padapter, psta = rtw_get_stainfo23a(pstapriv, pattrib->ra); if (psta == NULL) { /* if we cannot get psta => drrp the pkt */ RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, - ("\nupdate_attrib => get sta_info fail, ra:%pM\n", - pattrib->ra)); + "update_attrib => get sta_info fail, ra:%pM\n", + pattrib->ra); res = _FAIL; goto exit; } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) && @@ -511,8 +509,8 @@ static int update_attrib(struct rtw_adapter *padapter, } else { /* if we cannot get psta => drop the pkt */ RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, - ("\nupdate_attrib => get sta_info fail, ra:%pM\n", - pattrib->ra)); + "update_attrib => get sta_info fail, ra:%pM\n", + pattrib->ra); res = _FAIL; goto exit; } @@ -544,16 +542,15 @@ static int update_attrib(struct rtw_adapter *padapter, if (psta->ieee8021x_blocked == true) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("\n psta->ieee8021x_blocked == true\n")); + "psta->ieee8021x_blocked == true\n"); pattrib->encrypt = 0; if ((pattrib->ether_type != ETH_P_PAE) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("\npsta->ieee8021x_blocked == true, " - "pattrib->ether_type(%.4x) != 0x888e\n", - pattrib->ether_type)); + "psta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) != 0x888e\n", + pattrib->ether_type); res = _FAIL; goto exit; } @@ -594,9 +591,8 @@ static int update_attrib(struct rtw_adapter *padapter, if (!padapter->securitypriv.busetkipkey) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("\npadapter->securitypriv.busetkip" - "key(%d) == false drop packet\n", - padapter->securitypriv.busetkipkey)); + "padapter->securitypriv.busetkipkey(%d) == false drop packet\n", + padapter->securitypriv.busetkipkey); res = _FAIL; goto exit; } @@ -604,8 +600,8 @@ static int update_attrib(struct rtw_adapter *padapter, break; case WLAN_CIPHER_SUITE_CCMP: RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - ("pattrib->encrypt =%d (WLAN_CIPHER_SUITE_CCMP)\n", - pattrib->encrypt)); + "pattrib->encrypt =%d (WLAN_CIPHER_SUITE_CCMP)\n", + pattrib->encrypt); pattrib->iv_len = IEEE80211_CCMP_HDR_LEN; pattrib->icv_len = IEEE80211_CCMP_MIC_LEN; break; @@ -617,17 +613,17 @@ static int update_attrib(struct rtw_adapter *padapter, } RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - ("update_attrib: encrypt =%d\n", pattrib->encrypt)); + "update_attrib: encrypt =%d\n", pattrib->encrypt); if (pattrib->encrypt && !psecuritypriv->hw_decrypted) { pattrib->bswenc = true; RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("update_attrib: encrypt =%d bswenc = true\n", - pattrib->encrypt)); + "update_attrib: encrypt =%d bswenc = true\n", + pattrib->encrypt); } else { pattrib->bswenc = false; RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - ("update_attrib: bswenc = false\n")); + "update_attrib: bswenc = false\n"); } update_attrib_phy_info(pattrib, psta); @@ -726,20 +722,18 @@ static int xmitframe_addmic(struct rtw_adapter *padapter, curfragnum++) { payload = PTR_ALIGN(payload, 4); RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("=== curfragnum =%d, pframe = 0x%.2x, " - "0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x" - "%.2x, 0x%.2x, 0x%.2x,!!!\n", - curfragnum, *payload, *(payload + 1), - *(payload + 2), *(payload + 3), - *(payload + 4), *(payload + 5), - *(payload + 6), *(payload + 7))); + "=== curfragnum =%d, pframe = 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x,!!!\n", + curfragnum, *payload, *(payload + 1), + *(payload + 2), *(payload + 3), + *(payload + 4), *(payload + 5), + *(payload + 6), *(payload + 7)); payload = payload + pattrib->hdrlen + pattrib->iv_len; RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("curfragnum =%d pattrib->hdrlen =%d " - "pattrib->iv_len =%d", curfragnum, - pattrib->hdrlen, pattrib->iv_len)); + "curfragnum =%d pattrib->hdrlen =%d pattrib->iv_len =%d\n", + curfragnum, + pattrib->hdrlen, pattrib->iv_len); if ((curfragnum + 1) == pattrib->nr_frags) { length = pattrib->last_txcmdsz - pattrib->hdrlen - @@ -761,25 +755,21 @@ static int xmitframe_addmic(struct rtw_adapter *padapter, pattrib->icv_len; RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("curfragnum =%d length =%d " - "pattrib->icv_len =%d", - curfragnum, length, - pattrib->icv_len)); + "curfragnum =%d length =%d pattrib->icv_len =%d\n", + curfragnum, length, + pattrib->icv_len); } } rtw_secgetmic23a(&micdata, &mic[0]); RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("xmitframe_addmic: before add mic code!!\n")); + "xmitframe_addmic: before add mic code!!\n"); RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("xmitframe_addmic: pattrib->last_txcmdsz =" - "%d!!!\n", pattrib->last_txcmdsz)); + "xmitframe_addmic: pattrib->last_txcmdsz =%d!!!\n", + pattrib->last_txcmdsz); RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("xmitframe_addmic: mic[0]= 0x%.2x , mic[1]=" - "0x%.2x , mic[2]= 0x%.2x , mic[3]= 0x%.2x\n" - "mic[4]= 0x%.2x , mic[5]= 0x%.2x , mic[6]= 0x%.2x " - ", mic[7]= 0x%.2x !!!!\n", mic[0], mic[1], - mic[2], mic[3], mic[4], mic[5], mic[6], - mic[7])); + "xmitframe_addmic: mic[0]= 0x%.2x , mic[1]=0x%.2x , mic[2]= 0x%.2x , mic[3]= 0x%.2x\nmic[4]= 0x%.2x , mic[5]= 0x%.2x , mic[6]= 0x%.2x , mic[7]= 0x%.2x !!!!\n", + mic[0], mic[1], mic[2], mic[3], + mic[4], mic[5], mic[6], mic[7]); /* add mic code and add the mic code length in last_txcmdsz */ @@ -787,25 +777,24 @@ static int xmitframe_addmic(struct rtw_adapter *padapter, pattrib->last_txcmdsz += 8; RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - ("\n ======== last pkt ========\n")); + "======== last pkt ========\n"); payload = payload - pattrib->last_txcmdsz + 8; for (curfragnum = 0; curfragnum < pattrib->last_txcmdsz; - curfragnum = curfragnum + 8) + curfragnum = curfragnum + 8) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - (" %.2x, %.2x, %.2x, %.2x, %.2x, " - " %.2x, %.2x, %.2x ", - *(payload + curfragnum), - *(payload + curfragnum + 1), - *(payload + curfragnum + 2), - *(payload + curfragnum + 3), - *(payload + curfragnum + 4), - *(payload + curfragnum + 5), - *(payload + curfragnum + 6), - *(payload + curfragnum + 7))); - } else { - RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("xmitframe_addmic: rtw_get_stainfo23a ==" - "NULL!!!\n")); + "%.2x, %.2x, %.2x, %.2x, %.2x, %.2x, %.2x, %.2x\n", + *(payload + curfragnum), + *(payload + curfragnum + 1), + *(payload + curfragnum + 2), + *(payload + curfragnum + 3), + *(payload + curfragnum + 4), + *(payload + curfragnum + 5), + *(payload + curfragnum + 6), + *(payload + curfragnum + 7)); + } + } else { + RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, + "xmitframe_addmic: rtw_get_stainfo23a ==NULL!!!\n"); } } @@ -821,7 +810,7 @@ static int xmitframe_swencrypt(struct rtw_adapter *padapter, if (pattrib->bswenc) { /* DBG_8723A("start xmitframe_swencrypt\n"); */ RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, - ("### xmitframe_swencrypt\n")); + "### xmitframe_swencrypt\n"); switch (pattrib->encrypt) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: @@ -839,7 +828,7 @@ static int xmitframe_swencrypt(struct rtw_adapter *padapter, } else { RT_TRACE(_module_rtl871x_xmit_c_, _drv_notice_, - ("### xmitframe_hwencrypt\n")); + "### xmitframe_hwencrypt\n"); } return _SUCCESS; @@ -916,7 +905,9 @@ static int rtw_make_wlanhdr(struct rtw_adapter *padapter, u8 *hdr, qos_option = true; } else { - RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("fw_state:%x is not allowed to xmit frame\n", get_fwstate(pmlmepriv))); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, + "fw_state:%x is not allowed to xmit frame\n", + get_fwstate(pmlmepriv)); res = _FAIL; goto exit; } @@ -1117,7 +1108,7 @@ int rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *skb, if (rtw_make_wlanhdr(padapter, mem_start, pattrib) == _FAIL) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("%s: rtw_make_wlanhdr fail; drop pkt\n", __func__)); + "%s: rtw_make_wlanhdr fail; drop pkt\n", __func__); res = _FAIL; goto exit; } @@ -1172,11 +1163,10 @@ int rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *skb, memcpy(pframe, pattrib->iv, pattrib->iv_len); RT_TRACE(_module_rtl871x_xmit_c_, _drv_notice_, - ("rtw_xmiaframe_coalesce23a: keyid =%d pattrib" - "->iv[3]=%.2x pframe =%.2x %.2x %.2x %.2x\n", - padapter->securitypriv.dot11PrivacyKeyIndex, - pattrib->iv[3], *pframe, *(pframe+1), - *(pframe+2), *(pframe+3))); + "rtw_xmiaframe_coalesce23a: keyid =%d pattrib->iv[3]=%.2x pframe =%.2x %.2x %.2x %.2x\n", + padapter->securitypriv.dot11PrivacyKeyIndex, + pattrib->iv[3], *pframe, *(pframe+1), + *(pframe+2), *(pframe+3)); pframe += pattrib->iv_len; mpdu_len -= pattrib->iv_len; } @@ -1223,8 +1213,8 @@ int rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *skb, break; } else { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("%s: There're still something in packet!\n", - __func__)); + "%s: There're still something in packet!\n", + __func__); } hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREFRAGS); @@ -1234,7 +1224,7 @@ int rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *skb, if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n")); + "xmitframe_addmic(padapter, pxmitframe) == _FAIL\n"); DBG_8723A("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n"); res = _FAIL; goto exit; @@ -1462,8 +1452,8 @@ static struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv) if (list_empty(&pfree_xmit_queue->queue)) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - ("rtw_alloc_xmitframe:%d\n", - pxmitpriv->free_xmitframe_cnt)); + "rtw_alloc_xmitframe:%d\n", + pxmitpriv->free_xmitframe_cnt); pxframe = NULL; } else { phead = get_list_head(pfree_xmit_queue); @@ -1475,8 +1465,8 @@ static struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv) list_del_init(&pxframe->list); pxmitpriv->free_xmitframe_cnt--; RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - ("rtw_alloc_xmitframe():free_xmitframe_cnt =%d\n", - pxmitpriv->free_xmitframe_cnt)); + "rtw_alloc_xmitframe():free_xmitframe_cnt =%d\n", + pxmitpriv->free_xmitframe_cnt); } spin_unlock_bh(&pfree_xmit_queue->lock); @@ -1495,7 +1485,9 @@ struct xmit_frame *rtw_alloc_xmitframe23a_ext(struct xmit_priv *pxmitpriv) spin_lock_bh(&queue->lock); if (list_empty(&queue->queue)) { - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_alloc_xmitframe23a_ext:%d\n", pxmitpriv->free_xframe_ext_cnt)); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, + "rtw_alloc_xmitframe23a_ext:%d\n", + pxmitpriv->free_xframe_ext_cnt); pxframe = NULL; } else { phead = get_list_head(queue); @@ -1504,7 +1496,9 @@ struct xmit_frame *rtw_alloc_xmitframe23a_ext(struct xmit_priv *pxmitpriv) list_del_init(&pxframe->list); pxmitpriv->free_xframe_ext_cnt--; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_alloc_xmitframe23a_ext():free_xmitframe_cnt =%d\n", pxmitpriv->free_xframe_ext_cnt)); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, + "rtw_alloc_xmitframe23a_ext():free_xmitframe_cnt =%d\n", + pxmitpriv->free_xframe_ext_cnt); } spin_unlock_bh(&queue->lock); @@ -1521,7 +1515,8 @@ s32 rtw_free_xmitframe23a(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitf struct sk_buff *pndis_pkt = NULL; if (pxmitframe == NULL) { - RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("====== rtw_free_xmitframe23a():pxmitframe == NULL!!!!!!!!!!\n")); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, + "====== rtw_free_xmitframe23a():pxmitframe == NULL!!!!!!!!!!\n"); goto exit; } @@ -1543,10 +1538,14 @@ s32 rtw_free_xmitframe23a(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitf list_add_tail(&pxmitframe->list, get_list_head(queue)); if (pxmitframe->ext_tag == 0) { pxmitpriv->free_xmitframe_cnt++; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_debug_, ("rtw_free_xmitframe23a():free_xmitframe_cnt =%d\n", pxmitpriv->free_xmitframe_cnt)); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_debug_, + "rtw_free_xmitframe23a():free_xmitframe_cnt =%d\n", + pxmitpriv->free_xmitframe_cnt); } else if (pxmitframe->ext_tag == 1) { pxmitpriv->free_xframe_ext_cnt++; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_debug_, ("rtw_free_xmitframe23a():free_xframe_ext_cnt =%d\n", pxmitpriv->free_xframe_ext_cnt)); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_debug_, + "rtw_free_xmitframe23a():free_xframe_ext_cnt =%d\n", + pxmitpriv->free_xframe_ext_cnt); } spin_unlock_bh(&queue->lock); @@ -1585,8 +1584,7 @@ int rtw_xmitframe_enqueue23a(struct rtw_adapter *padapter, { if (rtw_xmit23a_classifier(padapter, pxmitframe) == _FAIL) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("rtw_xmitframe_enqueue23a: drop xmit pkt for " - "classifier fail\n")); + "rtw_xmitframe_enqueue23a: drop xmit pkt for classifier fail\n"); return _FAIL; } @@ -1675,26 +1673,30 @@ struct tx_servq *rtw_get_sta_pending23a(struct rtw_adapter *padapter, struct sta case 2: ptxservq = &psta->sta_xmitpriv.bk_q; *(ac) = 3; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_get_sta_pending23a : BK\n")); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, + "rtw_get_sta_pending23a : BK\n"); break; case 4: case 5: ptxservq = &psta->sta_xmitpriv.vi_q; *(ac) = 1; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_get_sta_pending23a : VI\n")); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, + "rtw_get_sta_pending23a : VI\n"); break; case 6: case 7: ptxservq = &psta->sta_xmitpriv.vo_q; *(ac) = 0; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_get_sta_pending23a : VO\n")); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, + "rtw_get_sta_pending23a : VO\n"); break; case 0: case 3: default: ptxservq = &psta->sta_xmitpriv.be_q; *(ac) = 2; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_get_sta_pending23a : BE\n")); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, + "rtw_get_sta_pending23a : BE\n"); break; } return ptxservq; @@ -1725,7 +1727,7 @@ int rtw_xmit23a_classifier(struct rtw_adapter *padapter, res = _FAIL; DBG_8723A("rtw_xmit23a_classifier: psta == NULL\n"); RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("rtw_xmit23a_classifier: psta == NULL\n")); + "rtw_xmit23a_classifier: psta == NULL\n"); goto exit; } if (!(psta->state & _FW_LINKED)) { @@ -1876,14 +1878,15 @@ int rtw_xmit23a(struct rtw_adapter *padapter, struct sk_buff *skb) if (pxmitframe == NULL) { RT_TRACE(_module_xmit_osdep_c_, _drv_err_, - ("rtw_xmit23a: no more pxmitframe\n")); + "rtw_xmit23a: no more pxmitframe\n"); return -1; } res = update_attrib(padapter, skb, &pxmitframe->attrib); if (res == _FAIL) { - RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("rtw_xmit23a: update attrib fail\n")); + RT_TRACE(_module_xmit_osdep_c_, _drv_err_, + "rtw_xmit23a: update attrib fail\n"); rtw_free_xmitframe23a(pxmitpriv, pxmitframe); return -1; } diff --git a/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c b/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c index 2dc18560a381..ae090ab11585 100644 --- a/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c +++ b/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c @@ -59,17 +59,15 @@ u8 HalPwrSeqCmdParsing23a(struct rtw_adapter *padapter, u8 CutVersion, PwrCfgCmd = PwrSeqCmd[AryIdx]; RT_TRACE(_module_hal_init_c_, _drv_info_, - ("HalPwrSeqCmdParsing23a: offset(%#x) cut_msk(%#x) " - "fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) " - "msk(%#x) value(%#x)\n", - GET_PWR_CFG_OFFSET(PwrCfgCmd), - GET_PWR_CFG_CUT_MASK(PwrCfgCmd), - GET_PWR_CFG_FAB_MASK(PwrCfgCmd), - GET_PWR_CFG_INTF_MASK(PwrCfgCmd), - GET_PWR_CFG_BASE(PwrCfgCmd), - GET_PWR_CFG_CMD(PwrCfgCmd), - GET_PWR_CFG_MASK(PwrCfgCmd), - GET_PWR_CFG_VALUE(PwrCfgCmd))); + "HalPwrSeqCmdParsing23a: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n", + GET_PWR_CFG_OFFSET(PwrCfgCmd), + GET_PWR_CFG_CUT_MASK(PwrCfgCmd), + GET_PWR_CFG_FAB_MASK(PwrCfgCmd), + GET_PWR_CFG_INTF_MASK(PwrCfgCmd), + GET_PWR_CFG_BASE(PwrCfgCmd), + GET_PWR_CFG_CMD(PwrCfgCmd), + GET_PWR_CFG_MASK(PwrCfgCmd), + GET_PWR_CFG_VALUE(PwrCfgCmd)); /* 2 Only Handle the command whose FAB, CUT, and Interface are matched */ @@ -79,14 +77,12 @@ u8 HalPwrSeqCmdParsing23a(struct rtw_adapter *padapter, u8 CutVersion, switch (GET_PWR_CFG_CMD(PwrCfgCmd)) { case PWR_CMD_READ: RT_TRACE(_module_hal_init_c_, _drv_info_, - ("HalPwrSeqCmdParsing23a: " - "PWR_CMD_READ\n")); + "HalPwrSeqCmdParsing23a: PWR_CMD_READ\n"); break; case PWR_CMD_WRITE: RT_TRACE(_module_hal_init_c_, _drv_info_, - ("HalPwrSeqCmdParsing23a: " - "PWR_CMD_WRITE\n")); + "HalPwrSeqCmdParsing23a: PWR_CMD_WRITE\n"); offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); /* Read the value from system register */ @@ -102,8 +98,7 @@ u8 HalPwrSeqCmdParsing23a(struct rtw_adapter *padapter, u8 CutVersion, case PWR_CMD_POLLING: RT_TRACE(_module_hal_init_c_, _drv_info_, - ("HalPwrSeqCmdParsing23a: " - "PWR_CMD_POLLING\n")); + "HalPwrSeqCmdParsing23a: PWR_CMD_POLLING\n"); bPollingBit = false; offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); @@ -131,8 +126,7 @@ u8 HalPwrSeqCmdParsing23a(struct rtw_adapter *padapter, u8 CutVersion, case PWR_CMD_DELAY: RT_TRACE(_module_hal_init_c_, _drv_info_, - ("HalPwrSeqCmdParsing23a: " - "PWR_CMD_DELAY\n")); + "HalPwrSeqCmdParsing23a: PWR_CMD_DELAY\n"); if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US) udelay(GET_PWR_CFG_OFFSET(PwrCfgCmd)); @@ -145,14 +139,12 @@ u8 HalPwrSeqCmdParsing23a(struct rtw_adapter *padapter, u8 CutVersion, /* When this command is parsed, end the process */ RT_TRACE(_module_hal_init_c_, _drv_info_, - ("HalPwrSeqCmdParsing23a: " - "PWR_CMD_END\n")); + "HalPwrSeqCmdParsing23a: PWR_CMD_END\n"); return true; default: RT_TRACE(_module_hal_init_c_, _drv_err_, - ("HalPwrSeqCmdParsing23a: " - "Unknown CMD!!\n")); + "HalPwrSeqCmdParsing23a: Unknown CMD!!\n"); break; } } diff --git a/drivers/staging/rtl8723au/hal/hal_com.c b/drivers/staging/rtl8723au/hal/hal_com.c index db7d57e28165..530db57e8842 100644 --- a/drivers/staging/rtl8723au/hal/hal_com.c +++ b/drivers/staging/rtl8723au/hal/hal_com.c @@ -395,9 +395,6 @@ rtl8723a_set_ampdu_min_space(struct rtw_adapter *padapter, u8 MinSpacingToSet) if (MinSpacingToSet < SecMinSpace) MinSpacingToSet = SecMinSpace; - /* RT_TRACE(COMP_MLME, DBG_LOUD, - ("Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", - padapter->MgntInfo.MinSpaceCfg)); */ MinSpacingToSet |= rtl8723au_read8(padapter, REG_AMPDU_MIN_SPACE) & 0xf8; rtl8723au_write8(padapter, REG_AMPDU_MIN_SPACE, @@ -437,9 +434,6 @@ void rtl8723a_set_ampdu_factor(struct rtw_adapter *padapter, u8 FactorToSet) rtl8723au_write8(padapter, REG_AGGLEN_LMT + index, pRegToSet[index]); } - - /* RT_TRACE(COMP_MLME, DBG_LOUD, - ("Set HW_VAR_AMPDU_FACTOR: %#x\n", FactorToSet)); */ } } @@ -624,14 +618,8 @@ void rtl8723a_cam_empty_entry(struct rtw_adapter *padapter, u8 ucIndex) /* write content 0 is equall to mark invalid */ /* delay_ms(40); */ rtl8723au_write32(padapter, WCAMI, ulContent); - /* RT_TRACE(COMP_SEC, DBG_LOUD, - ("rtl8723a_cam_empty_entry(): WRITE A4: %lx\n", - ulContent));*/ /* delay_ms(40); */ rtl8723au_write32(padapter, REG_CAMCMD, ulCommand); - /* RT_TRACE(COMP_SEC, DBG_LOUD, - ("rtl8723a_cam_empty_entry(): WRITE A0: %lx\n", - ulCommand));*/ } } diff --git a/drivers/staging/rtl8723au/hal/odm_debug.c b/drivers/staging/rtl8723au/hal/odm_debug.c index c912ab89bc3e..cb2bdda6b0eb 100644 --- a/drivers/staging/rtl8723au/hal/odm_debug.c +++ b/drivers/staging/rtl8723au/hal/odm_debug.c @@ -22,3 +22,18 @@ void ODM_InitDebugSetting23a(struct dm_odm_t *pDM_Odm) } u32 GlobalDebugLevel23A; + +void rt_trace(int comp, int level, const char *fmt, ...) +{ + struct va_format vaf; + va_list args; + + va_start(args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + + pr_info(DRIVER_PREFIX " [0x%08x,%d] %pV", comp, level, &vaf); + + va_end(args); +} diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c index 7f091da0273f..cf15f80836ba 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c @@ -1554,7 +1554,8 @@ static void bthci_ResetBtSec(struct rtw_adapter *padapter, struct bt_security *p pBtSec->bUsedHwEncrypt = true; else pBtSec->bUsedHwEncrypt = false; - RT_TRACE(_module_rtl871x_security_c_, _drv_info_, ("%s: bUsedHwEncrypt =%d\n", __func__, pBtSec->bUsedHwEncrypt)); + RT_TRACE(_module_rtl871x_security_c_, _drv_info_, + "%s: bUsedHwEncrypt =%d\n", __func__, pBtSec->bUsedHwEncrypt); pBtSec->RSNIE.Octet = pBtSec->RSNIEBuf; } @@ -4518,8 +4519,8 @@ bthci_StateConnecting(struct rtw_adapter *padapter, RTPRINT(FIOCTL, IOCTL_STATE, ("STATE_CMD_MAC_CONNECT_COMPLETE\n")); if (pBTInfo->BtAsocEntry[EntryNum].AMPRole == AMP_BTAP_JOINER) { - RT_TRACE(_module_rtl871x_security_c_, - _drv_info_, ("StateConnecting \n")); + RT_TRACE(_module_rtl871x_security_c_, _drv_info_, + "StateConnecting\n"); } break; case STATE_CMD_DISCONNECT_PHY_LINK: @@ -11196,15 +11197,17 @@ void rtl8723a_BT_init_hal_vars(struct rtw_adapter *padapter) pHalData->bt_coexist.bt_radiosharedtype = pHalData->EEPROMBluetoothRadioShared; RT_TRACE(_module_hal_init_c_, _drv_info_, - ("BT Coexistance = 0x%x\n", rtl8723a_BT_coexist(padapter))); + "BT Coexistance = 0x%x\n", rtl8723a_BT_coexist(padapter)); if (rtl8723a_BT_coexist(padapter)) { if (pHalData->bt_coexist.BT_Ant_Num == Ant_x2) { BTDM_SetBtCoexCurrAntNum(padapter, 2); - RT_TRACE(_module_hal_init_c_, _drv_info_, ("BlueTooth BT_Ant_Num = Antx2\n")); + RT_TRACE(_module_hal_init_c_, _drv_info_, + "BlueTooth BT_Ant_Num = Antx2\n"); } else if (pHalData->bt_coexist.BT_Ant_Num == Ant_x1) { BTDM_SetBtCoexCurrAntNum(padapter, 1); - RT_TRACE(_module_hal_init_c_, _drv_info_, ("BlueTooth BT_Ant_Num = Antx1\n")); + RT_TRACE(_module_hal_init_c_, _drv_info_, + "BlueTooth BT_Ant_Num = Antx1\n"); } pHalData->bt_coexist.bBTBusyTraffic = false; pHalData->bt_coexist.bBTTrafficModeSet = false; @@ -11213,8 +11216,8 @@ void rtl8723a_BT_init_hal_vars(struct rtw_adapter *padapter) pHalData->bt_coexist.PreviousState = 0; RT_TRACE(_module_hal_init_c_, _drv_info_, - ("bt_radiosharedType = 0x%x\n", - pHalData->bt_coexist.bt_radiosharedtype)); + "bt_radiosharedType = 0x%x\n", + pHalData->bt_coexist.bt_radiosharedtype); } } diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index d3dc24b0cc46..04d01833dc30 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -95,7 +95,7 @@ static int _WriteFW(struct rtw_adapter *padapter, void *buffer, u32 size) goto exit; } RT_TRACE(_module_hal_init_c_, _drv_info_, - ("_WriteFW Done- for Normal chip.\n")); + "_WriteFW Done- for Normal chip.\n"); exit: return ret; @@ -115,13 +115,13 @@ static int _FWFreeToGo(struct rtw_adapter *padapter) if (counter >= POLLING_READY_TIMEOUT_COUNT) { RT_TRACE(_module_hal_init_c_, _drv_err_, - ("%s: chksum report fail! REG_MCUFWDL:0x%08x\n", - __func__, value32)); + "%s: chksum report fail! REG_MCUFWDL:0x%08x\n", + __func__, value32); return _FAIL; } RT_TRACE(_module_hal_init_c_, _drv_info_, - ("%s: Checksum report OK! REG_MCUFWDL:0x%08x\n", __func__, - value32)); + "%s: Checksum report OK! REG_MCUFWDL:0x%08x\n", __func__, + value32); value32 = rtl8723au_read32(padapter, REG_MCUFWDL); value32 |= MCUFWDL_RDY; @@ -134,17 +134,16 @@ static int _FWFreeToGo(struct rtw_adapter *padapter) value32 = rtl8723au_read32(padapter, REG_MCUFWDL); if (value32 & WINTINI_RDY) { RT_TRACE(_module_hal_init_c_, _drv_info_, - ("%s: Polling FW ready success!! " - "REG_MCUFWDL:0x%08x\n", - __func__, value32)); + "%s: Polling FW ready success!! REG_MCUFWDL:0x%08x\n", + __func__, value32); return _SUCCESS; } udelay(5); } while (counter++ < POLLING_READY_TIMEOUT_COUNT); RT_TRACE(_module_hal_init_c_, _drv_err_, - ("%s: Polling FW ready fail!! REG_MCUFWDL:0x%08x\n", - __func__, value32)); + "%s: Polling FW ready fail!! REG_MCUFWDL:0x%08x\n", + __func__, value32); return _FAIL; } @@ -173,8 +172,8 @@ void rtl8723a_FirmwareSelfReset(struct rtw_adapter *padapter) u1bTmp = rtl8723au_read8(padapter, REG_SYS_FUNC_EN + 1); } RT_TRACE(_module_hal_init_c_, _drv_info_, - ("-%s: 8051 reset success (%d)\n", __func__, - Delay)); + "-%s: 8051 reset success (%d)\n", __func__, + Delay); if ((Delay == 0)) { /* force firmware reset */ @@ -206,13 +205,12 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter) int fw_size; static int log_version; - RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__)); + RT_TRACE(_module_hal_init_c_, _drv_info_, "+%s\n", __func__); if (IS_8723A_A_CUT(pHalData->VersionID)) { fw_name = "rtlwifi/rtl8723aufw_A.bin"; RT_TRACE(_module_hal_init_c_, _drv_info_, - ("rtl8723a_FirmwareDownload: R8723FwImageArray_UMC " - "for RTL8723A A CUT\n")); + "rtl8723a_FirmwareDownload: R8723FwImageArray_UMC for RTL8723A A CUT\n"); } else if (IS_8723A_B_CUT(pHalData->VersionID)) { /* WLAN Fw. */ if (padapter->registrypriv.wifi_spec == 1) { @@ -234,7 +232,7 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter) /* We should download proper RAM Code here to match the ROM code. */ RT_TRACE(_module_hal_init_c_, _drv_err_, - ("%s: unknow version!\n", __func__)); + "%s: unknown version!\n", __func__); rtStatus = _FAIL; goto Exit; } @@ -319,11 +317,11 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter) rtStatus = _FWFreeToGo(padapter); if (_SUCCESS != rtStatus) { RT_TRACE(_module_hal_init_c_, _drv_err_, - ("DL Firmware failed!\n")); + "DL Firmware failed!\n"); goto Exit; } RT_TRACE(_module_hal_init_c_, _drv_info_, - ("Firmware is ready to run!\n")); + "Firmware is ready to run!\n"); Exit: kfree(firmware_buf); @@ -819,7 +817,7 @@ static void ResumeTxBeacon(struct rtw_adapter *padapter) we record the value */ /* which should be read from register to a global variable. */ - RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("+ResumeTxBeacon\n")); + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, "+ResumeTxBeacon\n"); pHalData->RegFwHwTxQCtrl |= BIT(6); rtl8723au_write8(padapter, REG_FWHW_TXQ_CTRL + 2, @@ -837,7 +835,7 @@ static void StopTxBeacon(struct rtw_adapter *padapter) we record the value */ /* which should be read from register to a global variable. */ - RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("+StopTxBeacon\n")); + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, "+StopTxBeacon\n"); pHalData->RegFwHwTxQCtrl &= ~BIT(6); rtl8723au_write8(padapter, REG_FWHW_TXQ_CTRL + 2, @@ -983,7 +981,7 @@ int c2h_handler_8723a(struct rtw_adapter *padapter, struct c2h_evt_hdr *c2h_evt) switch (c2h_evt->id) { case C2H_DBG: RT_TRACE(_module_hal_init_c_, _drv_info_, - ("C2HCommandHandler: %s\n", c2h_evt->payload)); + "C2HCommandHandler: %s\n", c2h_evt->payload); break; case C2H_CCX_TX_RPT: @@ -993,22 +991,22 @@ int c2h_handler_8723a(struct rtw_adapter *padapter, struct c2h_evt_hdr *c2h_evt) break; case C2H_HW_INFO_EXCH: RT_TRACE(_module_hal_init_c_, _drv_info_, - ("[BT], C2H_HW_INFO_EXCH\n")); + "[BT], C2H_HW_INFO_EXCH\n"); for (i = 0; i < c2h_evt->plen; i++) { RT_TRACE(_module_hal_init_c_, _drv_info_, - ("[BT], tmpBuf[%d]= 0x%x\n", i, - c2h_evt->payload[i])); + "[BT], tmpBuf[%d]= 0x%x\n", i, + c2h_evt->payload[i]); } break; case C2H_C2H_H2C_TEST: RT_TRACE(_module_hal_init_c_, _drv_info_, - ("[BT], C2H_H2C_TEST\n")); + "[BT], C2H_H2C_TEST\n"); RT_TRACE(_module_hal_init_c_, _drv_info_, - ("[BT], tmpBuf[0]/[1]/[2]/[3]/[4]= 0x%x/ 0x%x/ " - "0x%x/ 0x%x/ 0x%x\n", c2h_evt->payload[0], - c2h_evt->payload[1], c2h_evt->payload[2], - c2h_evt->payload[3], c2h_evt->payload[4])); + "[BT], tmpBuf[0]/[1]/[2]/[3]/[4]= 0x%x/ 0x%x/ 0x%x/ 0x%x/ 0x%x\n", + c2h_evt->payload[0], + c2h_evt->payload[1], c2h_evt->payload[2], + c2h_evt->payload[3], c2h_evt->payload[4]); break; case C2H_BT_INFO: @@ -1141,8 +1139,8 @@ static int _LLTWrite(struct rtw_adapter *padapter, u32 address, u32 data) if (count > POLLING_LLT_THRESHOLD) { RT_TRACE(_module_hal_init_c_, _drv_err_, - ("Failed to polling write LLT done at " - "address %d!\n", address)); + "Failed to polling write LLT done at address %d!\n", + address); status = _FAIL; break; } @@ -1254,8 +1252,6 @@ e. SYS_FUNC_EN 0x02[7:0] = 0x14 reset BB state machine /* 2010/08/12 MH We need to set BB/GLBAL reset to save power for SS mode. */ - -/* RT_TRACE(COMP_INIT, DBG_LOUD, ("======> RF off and reset BB.\n")); */ } static void _ResetDigitalProcedure1_92C(struct rtw_adapter *padapter, @@ -1384,8 +1380,6 @@ static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM) value8 = rtl8723au_read8(padapter, REG_LDOV12D_CTRL); value8 &= ~LDV12_EN; rtl8723au_write8(padapter, REG_LDOV12D_CTRL, value8); -/* RT_TRACE(COMP_INIT, DBG_LOUD, - (" REG_LDOV12D_CTRL Reg0x21:0x%02x.\n", value8)); */ } /***************************** @@ -1433,7 +1427,7 @@ int CardDisableHWSM(struct rtw_adapter *padapter, u8 resetMCU) _DisableAnalog(padapter, false); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("======> Card disable finished.\n")); + "======> Card disable finished.\n"); return _SUCCESS; } @@ -1459,8 +1453,6 @@ int CardDisableWithoutHWSM(struct rtw_adapter *padapter) /* ==== Disable analog sequence === */ _DisableAnalog(padapter, true); - /* RT_TRACE(COMP_INIT, DBG_LOUD, - ("<====== Card Disable Without HWSM .\n")); */ return _SUCCESS; } @@ -1477,7 +1469,7 @@ void Hal_InitPGData(struct rtw_adapter *padapter, u8 *PROMContent) } } else { RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, - ("AutoLoad Fail reported from CR9346!!\n")); + "AutoLoad Fail reported from CR9346!!\n"); /* update to default value 0xFF */ if (!pEEPROM->EepromOrEfuse) EFUSE_ShadowMapUpdate23a(padapter, EFUSE_WIFI); @@ -1502,7 +1494,7 @@ void Hal_EfuseParseIDCode(struct rtw_adapter *padapter, u8 *hwinfo) } RT_TRACE(_module_hal_init_c_, _drv_info_, - ("EEPROM ID = 0x%04x\n", EEPROMId)); + "EEPROM ID = 0x%04x\n", EEPROMId); } static void Hal_EEValueCheck(u8 EEType, void *pInValue, void *pOutValue) @@ -1517,9 +1509,8 @@ static void Hal_EEValueCheck(u8 EEType, void *pInValue, void *pOutValue) *pOut = *pIn; else { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("EETYPE_TX_PWR, value =%d is invalid, set " - "to default = 0x%x\n", - *pIn, EEPROM_Default_TxPowerLevel)); + "EETYPE_TX_PWR, value =%d is invalid, set to default = 0x%x\n", + *pIn, EEPROM_Default_TxPowerLevel); *pOut = EEPROM_Default_TxPowerLevel; } } @@ -1657,35 +1648,34 @@ Hal_EfuseParsetxpowerinfo_8723A(struct rtw_adapter *padapter, for (rfPath = 0; rfPath < RF_PATH_MAX; rfPath++) { for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) { RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("RF(%u)-Ch(%u) [CCK / HT40_1S / HT40_2S] = " - "[0x%x / 0x%x / 0x%x]\n", - rfPath, ch, - pHalData->TxPwrLevelCck[rfPath][ch], - pHalData->TxPwrLevelHT40_1S[rfPath][ch], - pHalData->TxPwrLevelHT40_2S[rfPath][ch])); + "RF(%u)-Ch(%u) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n", + rfPath, ch, + pHalData->TxPwrLevelCck[rfPath][ch], + pHalData->TxPwrLevelHT40_1S[rfPath][ch], + pHalData->TxPwrLevelHT40_2S[rfPath][ch]); } } for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) { RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("RF-A Ht20 to HT40 Diff[%u] = 0x%x(%d)\n", ch, - pHalData->TxPwrHt20Diff[RF_PATH_A][ch], - pHalData->TxPwrHt20Diff[RF_PATH_A][ch])); + "RF-A Ht20 to HT40 Diff[%u] = 0x%x(%d)\n", ch, + pHalData->TxPwrHt20Diff[RF_PATH_A][ch], + pHalData->TxPwrHt20Diff[RF_PATH_A][ch]); } for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("RF-A Legacy to Ht40 Diff[%u] = 0x%x\n", ch, - pHalData->TxPwrLegacyHtDiff[RF_PATH_A][ch])); + "RF-A Legacy to Ht40 Diff[%u] = 0x%x\n", ch, + pHalData->TxPwrLegacyHtDiff[RF_PATH_A][ch]); for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) { RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("RF-B Ht20 to HT40 Diff[%u] = 0x%x(%d)\n", ch, - pHalData->TxPwrHt20Diff[RF_PATH_B][ch], - pHalData->TxPwrHt20Diff[RF_PATH_B][ch])); + "RF-B Ht20 to HT40 Diff[%u] = 0x%x(%d)\n", ch, + pHalData->TxPwrHt20Diff[RF_PATH_B][ch], + pHalData->TxPwrHt20Diff[RF_PATH_B][ch]); } for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("RF-B Legacy to HT40 Diff[%u] = 0x%x\n", ch, - pHalData->TxPwrLegacyHtDiff[RF_PATH_B][ch])); + "RF-B Legacy to HT40 Diff[%u] = 0x%x\n", ch, + pHalData->TxPwrLegacyHtDiff[RF_PATH_B][ch]); if (!AutoLoadFail) { struct registry_priv *registry_par = &padapter->registrypriv; if (registry_par->regulatory_tid == 0xff) { @@ -1702,7 +1692,7 @@ Hal_EfuseParsetxpowerinfo_8723A(struct rtw_adapter *padapter, pHalData->EEPROMRegulatory = 0; } RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("EEPROMRegulatory = 0x%x\n", pHalData->EEPROMRegulatory)); + "EEPROMRegulatory = 0x%x\n", pHalData->EEPROMRegulatory); if (!AutoLoadFail) pHalData->bTXPowerDataReadFromEEPORM = true; @@ -1752,8 +1742,8 @@ Hal_EfuseParseEEPROMVer(struct rtw_adapter *padapter, else pHalData->EEPROMVersion = 1; RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("Hal_EfuseParseEEPROMVer(), EEVer = %d\n", - pHalData->EEPROMVersion)); + "Hal_EfuseParseEEPROMVer(), EEVer = %d\n", + pHalData->EEPROMVersion); } void @@ -1786,10 +1776,10 @@ Hal_EfuseParseCustomerID(struct rtw_adapter *padapter, pHalData->EEPROMSubCustomerID = 0; } RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("EEPROM Customer ID: 0x%2x\n", pHalData->EEPROMCustomerID)); + "EEPROM Customer ID: 0x%2x\n", pHalData->EEPROMCustomerID); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("EEPROM SubCustomer ID: 0x%02x\n", - pHalData->EEPROMSubCustomerID)); + "EEPROM SubCustomer ID: 0x%02x\n", + pHalData->EEPROMSubCustomerID); } void @@ -1818,8 +1808,8 @@ Hal_EfuseParseXtal_8723A(struct rtw_adapter *pAdapter, pHalData->CrystalCap = EEPROM_Default_CrystalCap_8723A; } RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("%s: CrystalCap = 0x%2x\n", __func__, - pHalData->CrystalCap)); + "%s: CrystalCap = 0x%2x\n", __func__, + pHalData->CrystalCap); } void diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c index 38f8c3de3029..46a30659c96f 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c @@ -121,8 +121,6 @@ PHY_SetBBReg(struct rtw_adapter *Adapter, u32 RegAddr, u32 BitMask, u32 Data) { u32 OriginalValue, BitShift; - /* RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data)); */ - if (BitMask != bMaskDWord) {/* if not "double word" write */ OriginalValue = rtl8723au_read32(Adapter, RegAddr); BitShift = phy_CalculateBitShift(BitMask); @@ -132,7 +130,6 @@ PHY_SetBBReg(struct rtw_adapter *Adapter, u32 RegAddr, u32 BitMask, u32 Data) rtl8723au_write32(Adapter, RegAddr, Data); /* RTPRINT(FPHY, PHY_BBW, ("BBW MASK = 0x%lx Addr[0x%lx]= 0x%lx\n", BitMask, RegAddr, Data)); */ - /* RT_TRACE(COMP_RF, DBG_TRACE, ("<---PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data)); */ } /* */ @@ -548,131 +545,51 @@ storePwrIndexDiffRateOffset(struct rtw_adapter *Adapter, u32 RegAddr, if (RegAddr == rTxAGC_A_Rate18_06) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][0] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][0])); */ } if (RegAddr == rTxAGC_A_Rate54_24) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][1] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][1])); */ } if (RegAddr == rTxAGC_A_CCK1_Mcs32) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][6] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][6])); */ } if (RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0xffffff00) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][7] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][7])); */ } if (RegAddr == rTxAGC_A_Mcs03_Mcs00) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][2] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][2])); */ } if (RegAddr == rTxAGC_A_Mcs07_Mcs04) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][3] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][3])); */ } if (RegAddr == rTxAGC_A_Mcs11_Mcs08) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][4] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][4])); */ } if (RegAddr == rTxAGC_A_Mcs15_Mcs12) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][5] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][5])); */ } if (RegAddr == rTxAGC_B_Rate18_06) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][8] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][8])); */ } if (RegAddr == rTxAGC_B_Rate54_24) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][9] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][9])); */ } if (RegAddr == rTxAGC_B_CCK1_55_Mcs32) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][14] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][14])); */ } if (RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0x000000ff) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][15] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][15])); */ } if (RegAddr == rTxAGC_B_Mcs03_Mcs00) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][10] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][10])); */ } if (RegAddr == rTxAGC_B_Mcs07_Mcs04) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][11] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][11])); */ } if (RegAddr == rTxAGC_B_Mcs11_Mcs08) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][12] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][12])); */ } if (RegAddr == rTxAGC_B_Mcs15_Mcs12) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13] = Data; - /* RT_TRACE(COMP_INIT, DBG_TRACE, - ("MCSTxPowerLevelOriginalOffset[%d][13] = 0x%lx\n", - pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[ - pHalData->pwrGroupCnt][13])); */ pHalData->pwrGroupCnt++; } } @@ -974,10 +891,7 @@ _PHY_SetBWMode23a92C(struct rtw_adapter *Adapter) break; default: - /*RT_TRACE(COMP_DBG, DBG_LOUD, - ("PHY_SetBWMode23aCallback8192C(): unknown Bandwidth: %#X\n" \ - , pHalData->CurrentChannelBW));*/ - break; + break; } /* Skip over setting of J-mode in BB register here. Default value is "None J mode". Emily 20070315 */ @@ -986,13 +900,8 @@ _PHY_SetBWMode23a92C(struct rtw_adapter *Adapter) /* NowL = PlatformEFIORead4Byte(Adapter, TSFR); */ /* NowH = PlatformEFIORead4Byte(Adapter, TSFR+4); */ /* EndTime = ((u64)NowH << 32) + NowL; */ - /* RT_TRACE(COMP_SCAN, DBG_LOUD, ("SetBWMode23aCallback8190Pci: time - of SetBWMode23a = %I64d us!\n", (EndTime - BeginTime))); */ rtl8723a_phy_rf6052set_bw(Adapter, pHalData->CurrentChannelBW); - - /* RT_TRACE(COMP_SCAN, DBG_LOUD, - ("<== PHY_SetBWMode23aCallback8192C() \n")); */ } /*----------------------------------------------------------------------------- diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c index aae433f0e8af..0fec84bcb5d9 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c +++ b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c @@ -48,7 +48,7 @@ int rtl8723au_init_recv_priv(struct rtw_adapter *padapter) if (!precvpriv->precv_buf) { res = _FAIL; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("alloc recv_buf fail!\n")); + "alloc recv_buf fail!\n"); goto exit; } diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c b/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c index 6bc1297227be..41ac843b9260 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c +++ b/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c @@ -272,7 +272,8 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz) if (bmcst) ptxdesc->txdw0 |= cpu_to_le32(BIT(24)); - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("offset0-txdesc = 0x%x\n", ptxdesc->txdw0)); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, + "offset0-txdesc = 0x%x\n", ptxdesc->txdw0); /* offset 4 */ /* pkt_offset, unit:8 bytes padding */ @@ -303,7 +304,7 @@ static int rtw_dump_xframe(struct rtw_adapter *padapter, mem_addr = pxmitframe->buf_addr; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_dump_xframe()\n")); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, "rtw_dump_xframe()\n"); for (t = 0; t < pattrib->nr_frags; t++) { if (inner_ret != _SUCCESS && ret == _SUCCESS) @@ -311,7 +312,7 @@ static int rtw_dump_xframe(struct rtw_adapter *padapter, if (t != (pattrib->nr_frags - 1)) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, - ("pattrib->nr_frags =%d\n", pattrib->nr_frags)); + "pattrib->nr_frags =%d\n", pattrib->nr_frags); sz = pxmitpriv->frag_len; sz = sz - 4 - pattrib->icv_len; @@ -338,7 +339,7 @@ static int rtw_dump_xframe(struct rtw_adapter *padapter, rtw_count_tx_stats23a(padapter, pxmitframe, sz); RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - ("rtw_write_port, w_sz =%d\n", w_sz)); + "rtw_write_port, w_sz =%d\n", w_sz); mem_addr += w_sz; @@ -365,7 +366,7 @@ bool rtl8723au_xmitframe_complete(struct rtw_adapter *padapter, phwxmits = pxmitpriv->hwxmits; hwentry = pxmitpriv->hwxmit_entry; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("xmitframe_complete()\n")); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, "xmitframe_complete()\n"); if (pxmitbuf == NULL) { pxmitbuf = rtw_alloc_xmitbuf23a(pxmitpriv); @@ -388,7 +389,8 @@ bool rtl8723au_xmitframe_complete(struct rtw_adapter *padapter, rtw_os_xmit_complete23a(padapter, pxmitframe);/* always return ndis_packet after rtw_xmitframe_coalesce23a */ } - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("xmitframe_complete(): rtw_dump_xframe\n")); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, + "xmitframe_complete(): rtw_dump_xframe\n"); if (res == _SUCCESS) { rtw_dump_xframe(padapter, pxmitframe); @@ -481,7 +483,7 @@ enqueue: if (res != _SUCCESS) { RT_TRACE(_module_xmit_osdep_c_, _drv_err_, - ("pre_xmitframe: enqueue xmitframe fail\n")); + "pre_xmitframe: enqueue xmitframe fail\n"); rtw_free_xmitframe23a(pxmitpriv, pxmitframe); /* Trick, make the statistics correct */ diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index 0d08863d72bd..42ae29d26302 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -516,7 +516,7 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) /* Check if MAC has already power on. by tynli. 2011.05.27. */ val8 = rtl8723au_read8(Adapter, REG_CR); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("%s: REG_CR 0x100 = 0x%02x\n", __func__, val8)); + "%s: REG_CR 0x100 = 0x%02x\n", __func__, val8); /* Fix 92DU-VC S3 hang with the reason is that secondary mac is not initialized. */ /* 0x100 value of first mac is 0xEA while 0x100 value of secondary @@ -526,13 +526,13 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) } else { mac_on = true; RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("%s: MAC has already power on\n", __func__)); + "%s: MAC has already power on\n", __func__); } status = _InitPowerOn(Adapter); if (status == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("Failed to init power on!\n")); + "Failed to init power on!\n"); goto exit; } @@ -547,7 +547,7 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) status = InitLLTTable23a(Adapter, boundary); if (status == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("Failed to init LLT table\n")); + "Failed to init LLT table\n"); goto exit; } } @@ -623,8 +623,8 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) rtl8723au_write32(Adapter, rFPGA0_XA_RFInterfaceOE, 0x66F60210); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("%s: 0x870 = value 0x%x\n", __func__, - rtl8723au_read32(Adapter, 0x870))); + "%s: 0x870 = value 0x%x\n", __func__, + rtl8723au_read32(Adapter, 0x870)); /* */ /* Joseph Note: Keep RfRegChnlVal for later use. */ @@ -744,7 +744,8 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) if (((rtl8723au_read32(Adapter, rFPGA0_RFMOD) & 0xFF000000) != 0x83000000)) { PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT(24), 1); - RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("%s: IQK fail recorver\n", __func__)); + RT_TRACE(_module_hci_hal_init_c_, _drv_err_, + "%s: IQK fail recover\n", __func__); } /* ack for xmit mgmt frames. */ @@ -817,7 +818,7 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, else sps0 &= ~(BIT(0) | BIT(3)); - RT_TRACE(_module_hal_init_c_, _drv_err_, ("SS LVL1\n")); + RT_TRACE(_module_hal_init_c_, _drv_err_, "SS LVL1\n"); /* Disable RF and BB only for SelectSuspend. */ /* 1. Set BB/RF to shutdown. */ @@ -933,14 +934,14 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) status = _SUCCESS; - RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("===> usb_inirp_init\n")); + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, "===> usb_inirp_init\n"); /* issue Rx irp to receive data */ precvbuf = (struct recv_buf *)precvpriv->precv_buf; for (i = 0; i < NR_RECVBUFF; i++) { if (rtl8723au_read_port(Adapter, 0, precvbuf) == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("usb_rx_init: usb_read_port error\n")); + "usb_rx_init: usb_read_port error\n"); status = _FAIL; goto exit; } @@ -948,7 +949,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) } if (rtl8723au_read_interrupt(Adapter) == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("%s: usb_read_interrupt error\n", __func__)); + "%s: usb_read_interrupt error\n", __func__); status = _FAIL; } pHalData->IntrMask[0] = rtl8723au_read32(Adapter, REG_USB_HIMR); @@ -957,7 +958,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) rtl8723au_write32(Adapter, REG_USB_HIMR, pHalData->IntrMask[0]); exit: RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("<=== usb_inirp_init\n")); + "<=== usb_inirp_init\n"); return status; } @@ -966,7 +967,7 @@ int rtl8723au_inirp_deinit(struct rtw_adapter *Adapter) struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("\n ===> usb_rx_deinit\n")); + "===> usb_rx_deinit\n"); rtl8723au_read_port_cancel(Adapter); pHalData->IntrMask[0] = rtl8723au_read32(Adapter, REG_USB_HIMR); MSG_8723A("%s pHalData->IntrMask = 0x%04x\n", __func__, @@ -974,7 +975,7 @@ int rtl8723au_inirp_deinit(struct rtw_adapter *Adapter) pHalData->IntrMask[0] = 0x0; rtl8723au_write32(Adapter, REG_USB_HIMR, pHalData->IntrMask[0]); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("\n <=== usb_rx_deinit\n")); + "<=== usb_rx_deinit\n"); return _SUCCESS; } @@ -1021,11 +1022,10 @@ static void Hal_EfuseParseMACAddr_8723AU(struct rtw_adapter *padapter, } RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, - ("Hal_EfuseParseMACAddr_8723AU: Permanent Address =%02x:%02x:" - "%02x:%02x:%02x:%02x\n", - pEEPROM->mac_addr[0], pEEPROM->mac_addr[1], - pEEPROM->mac_addr[2], pEEPROM->mac_addr[3], - pEEPROM->mac_addr[4], pEEPROM->mac_addr[5])); + "Hal_EfuseParseMACAddr_8723AU: Permanent Address =%02x:%02x:%02x:%02x:%02x:%02x\n", + pEEPROM->mac_addr[0], pEEPROM->mac_addr[1], + pEEPROM->mac_addr[2], pEEPROM->mac_addr[3], + pEEPROM->mac_addr[4], pEEPROM->mac_addr[5]); } static void readAdapterInfo(struct rtw_adapter *padapter) @@ -1165,8 +1165,6 @@ int GetHalDefVar8192CUsb(struct rtw_adapter *Adapter, } break; default: - /* RT_TRACE(COMP_INIT, DBG_WARNING, ("GetHalDefVar8192CUsb(): " - "Unkown variable: %d!\n", eVariable)); */ bResult = _FAIL; break; } diff --git a/drivers/staging/rtl8723au/hal/usb_ops_linux.c b/drivers/staging/rtl8723au/hal/usb_ops_linux.c index a6d16adce107..371e6b373420 100644 --- a/drivers/staging/rtl8723au/hal/usb_ops_linux.c +++ b/drivers/staging/rtl8723au/hal/usb_ops_linux.c @@ -297,14 +297,12 @@ urb_submit: case -ENODEV: case -ESHUTDOWN: RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete:bSurpriseRemoved =" - "true\n")); + "usb_read_port_complete:bSurpriseRemoved =true\n"); /* Fall Through here */ case -ENOENT: padapter->bDriverStopped = true; RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete:bDriverStopped =" - "true\n")); + "usb_read_port_complete:bDriverStopped =true\n"); break; case -EPROTO: break; @@ -367,16 +365,16 @@ static int recvbuf2recvframe(struct rtw_adapter *padapter, struct sk_buff *pskb) do { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("recvbuf2recvframe: rxdesc = offsset 0:0x%08x, " - "4:0x%08x, 8:0x%08x, C:0x%08x\n", prxstat->rxdw0, - prxstat->rxdw1, prxstat->rxdw2, prxstat->rxdw4)); + "recvbuf2recvframe: rxdesc = offsset 0:0x%08x, 4:0x%08x, 8:0x%08x, C:0x%08x\n", + prxstat->rxdw0, prxstat->rxdw1, + prxstat->rxdw2, prxstat->rxdw4); prxstat = (struct recv_stat *)pbuf; precvframe = rtw_alloc_recvframe23a(pfree_recv_queue); if (!precvframe) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("recvbuf2recvframe: precvframe == NULL\n")); + "recvbuf2recvframe: precvframe == NULL\n"); DBG_8723A("%s()-%d: rtw_alloc_recvframe23a() failed! RX " "Drop!\n", __func__, __LINE__); goto _exit_recvbuf2recvframe; @@ -400,7 +398,7 @@ static int recvbuf2recvframe(struct rtw_adapter *padapter, struct sk_buff *pskb) if (pattrib->pkt_len <= 0 || pkt_offset > transfer_len) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("recvbuf2recvframe: pkt_len<= 0\n")); + "recvbuf2recvframe: pkt_len<= 0\n"); DBG_8723A("%s()-%d: RX Warning!\n", __func__, __LINE__); rtw_free_recvframe23a(precvframe); @@ -471,8 +469,7 @@ static int recvbuf2recvframe(struct rtw_adapter *padapter, struct sk_buff *pskb) if (rtw_recv_entry23a(precvframe) != _SUCCESS) RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, - ("recvbuf2recvframe: rtw_recv_entry23a" - "(precvframe) != _SUCCESS\n")); + "recvbuf2recvframe: rtw_recv_entry23a(precvframe) != _SUCCESS\n"); pkt_cnt--; transfer_len -= pkt_offset; @@ -520,16 +517,15 @@ static void usb_read_port_complete(struct urb *purb) struct recv_priv *precvpriv = &padapter->recvpriv; RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete!!!\n")); + "usb_read_port_complete!!!\n"); precvpriv->rx_pending_cnt--; if (padapter->bSurpriseRemoved || padapter->bDriverStopped || padapter->bReadPortCancel) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete:bDriverStopped(%d) OR " - "bSurpriseRemoved(%d)\n", padapter->bDriverStopped, - padapter->bSurpriseRemoved)); + "usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", + padapter->bDriverStopped, padapter->bSurpriseRemoved); DBG_8723A("%s()-%d: RX Warning! bDriverStopped(%d) OR " "bSurpriseRemoved(%d) bReadPortCancel(%d)\n", @@ -542,9 +538,7 @@ static void usb_read_port_complete(struct urb *purb) if (purb->actual_length > MAX_RECVBUF_SZ || purb->actual_length < RXDESC_SIZE) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete: (purb->actual_" - "length > MAX_RECVBUF_SZ) || (purb->actual_" - "length < RXDESC_SIZE)\n")); + "usb_read_port_complete: (purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n"); rtl8723au_read_port(padapter, 0, precvbuf); DBG_8723A("%s()-%d: RX Warning!\n", __func__, __LINE__); @@ -564,8 +558,8 @@ static void usb_read_port_complete(struct urb *purb) } } else { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete : purb->status(%d) != 0 \n", - purb->status)); + "usb_read_port_complete : purb->status(%d) != 0\n", + purb->status); skb_put(precvbuf->pskb, purb->actual_length); precvbuf->pskb = NULL; @@ -583,14 +577,12 @@ static void usb_read_port_complete(struct urb *purb) case -ENODEV: case -ESHUTDOWN: RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete:bSurprise" - "Removed = true\n")); + "usb_read_port_complete:bSurpriseRemoved = true\n"); /* Intentional fall through here */ case -ENOENT: padapter->bDriverStopped = true; RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete:" - "bDriverStopped = true\n")); + "usb_read_port_complete:bDriverStopped = true\n"); break; case -EPROTO: case -EOVERFLOW: @@ -620,14 +612,13 @@ int rtl8723au_read_port(struct rtw_adapter *adapter, u32 cnt, if (adapter->bDriverStopped || adapter->bSurpriseRemoved) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port:(padapter->bDriverStopped ||" - "padapter->bSurpriseRemoved)!!!\n")); + "usb_read_port:(padapter->bDriverStopped ||padapter->bSurpriseRemoved)!!!\n"); return _FAIL; } if (!precvbuf) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port:precvbuf == NULL\n")); + "usb_read_port:precvbuf == NULL\n"); return _FAIL; } @@ -638,7 +629,8 @@ int rtl8723au_read_port(struct rtw_adapter *adapter, u32 cnt, if (!precvbuf->pskb) { precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); if (precvbuf->pskb == NULL) { - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("init_recvbuf(): alloc_skb fail!\n")); + RT_TRACE(_module_hci_ops_os_c_, _drv_err_, + "init_recvbuf(): alloc_skb fail!\n"); return _FAIL; } @@ -661,8 +653,8 @@ int rtl8723au_read_port(struct rtw_adapter *adapter, u32 cnt, err = usb_submit_urb(purb, GFP_ATOMIC); if ((err) && (err != -EPERM)) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("cannot submit rx in-token(err = 0x%.8x), URB_STATUS " - "= 0x%.8x", err, purb->status)); + "cannot submit rx in-token(err = 0x%.8x), URB_STATUS = 0x%.8x\n", + err, purb->status); DBG_8723A("cannot submit rx in-token(err = 0x%08x), urb_status " "= %d\n", err, purb->status); ret = _FAIL; diff --git a/drivers/staging/rtl8723au/include/rtw_debug.h b/drivers/staging/rtl8723au/include/rtw_debug.h index b6b01732a725..159183e9cab0 100644 --- a/drivers/staging/rtl8723au/include/rtw_debug.h +++ b/drivers/staging/rtl8723au/include/rtw_debug.h @@ -163,14 +163,13 @@ extern u32 GlobalDebugLevel23A; +__printf(3, 4) +void rt_trace(int comp, int level, const char *fmt, ...); -#define RT_TRACE(_Comp, _Level, Fmt) \ +#define RT_TRACE(_Comp, _Level, Fmt, ...) \ do { \ - if (_Level <= GlobalDebugLevel23A) { \ - pr_info("%s [0x%08x,%d]", DRIVER_PREFIX, \ - (unsigned int)_Comp, _Level); \ - pr_info Fmt; \ - } \ + if (_Level <= GlobalDebugLevel23A) \ + rt_trace(_Comp, _Level, Fmt, ##__VA_ARGS__); \ } while (0) #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, \ diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index f925170aa630..b139ed40cb27 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -729,7 +729,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, u8 key_index, if (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 || keyparms->cipher == WLAN_CIPHER_SUITE_WEP104) { RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, - ("wpa_set_encryption, crypt.alg = WEP\n")); + "wpa_set_encryption, crypt.alg = WEP\n"); DBG_8723A("wpa_set_encryption, crypt.alg = WEP\n"); if (psecuritypriv->bWepDefaultKeyIdxSet == 0) { @@ -1127,14 +1127,14 @@ static int cfg80211_infrastructure_mode(struct rtw_adapter *padapter, old_mode = cur_network->network.ifmode; RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_notice_, - ("+%s: old =%d new =%d fw_state = 0x%08x\n", __func__, - old_mode, ifmode, get_fwstate(pmlmepriv))); + "+%s: old =%d new =%d fw_state = 0x%08x\n", __func__, + old_mode, ifmode, get_fwstate(pmlmepriv)); if (old_mode != ifmode) { spin_lock_bh(&pmlmepriv->lock); RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - (" change mode!")); + "change mode!\n"); if (old_mode == NL80211_IFTYPE_AP || old_mode == NL80211_IFTYPE_P2P_GO) { @@ -1194,10 +1194,6 @@ static int cfg80211_infrastructure_mode(struct rtw_adapter *padapter, /* SecClearAllKeys(adapter); */ - /* RT_TRACE(COMP_OID_SET, DBG_LOUD, - ("set_infrastructure: fw_state:%x after changing mode\n", */ - /* get_fwstate(pmlmepriv))); */ - spin_unlock_bh(&pmlmepriv->lock); } @@ -1602,7 +1598,7 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie, pie[i + 4], pie[i + 5], pie[i + 6], pie[i + 7]); if (ielen < RSN_HEADER_LEN) { RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, - ("Ie len too short %d\n", (int)ielen)); + "Ie len too short %d\n", (int)ielen); ret = -1; goto exit; } @@ -1725,11 +1721,10 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie, rtl8723a_off_rcr_am(padapter); RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, - ("rtw_set_wpa_ie: pairwise_cipher = 0x%08x padapter->" - "securitypriv.ndisencryptstatus =%d padapter->" - "securitypriv.ndisauthtype =%d\n", pairwise_cipher, - padapter->securitypriv.ndisencryptstatus, - padapter->securitypriv.ndisauthtype)); + "rtw_set_wpa_ie: pairwise_cipher = 0x%08x padapter->securitypriv.ndisencryptstatus =%d padapter->securitypriv.ndisauthtype =%d\n", + pairwise_cipher, + padapter->securitypriv.ndisencryptstatus, + padapter->securitypriv.ndisauthtype); exit: if (ret) @@ -1745,7 +1740,7 @@ static int rtw_cfg80211_add_wep(struct rtw_adapter *padapter, if (keyid >= NUM_WEP_KEYS) { RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, - ("%s:keyid>4 =>fail\n", __func__)); + "%s:keyid>4 =>fail\n", __func__); res = _FAIL; goto exit; } @@ -1754,45 +1749,45 @@ static int rtw_cfg80211_add_wep(struct rtw_adapter *padapter, case WLAN_KEY_LEN_WEP40: psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40; RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - ("%s:wep->KeyLength = 5\n", __func__)); + "%s:wep->KeyLength = 5\n", __func__); break; case WLAN_KEY_LEN_WEP104: psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104; RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - ("%s:wep->KeyLength = 13\n", __func__)); + "%s:wep->KeyLength = 13\n", __func__); break; default: psecuritypriv->dot11PrivacyAlgrthm = 0; RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - ("%s:wep->KeyLength!= 5 or 13\n", __func__)); + "%s:wep->KeyLength!= 5 or 13\n", __func__); res = _FAIL; goto exit; } RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - ("%s:before memcpy, wep->KeyLength = 0x%x keyid =%x\n", - __func__, wep->keylen, keyid)); + "%s:before memcpy, wep->KeyLength = 0x%x keyid =%x\n", + __func__, wep->keylen, keyid); memcpy(&psecuritypriv->wep_key[keyid], wep, sizeof(struct rtw_wep_key)); psecuritypriv->dot11PrivacyKeyIndex = keyid; RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - ("%s:security key material : " - "%x %x %x %x %x %x %x %x %x %x %x %x %x\n", __func__, - psecuritypriv->wep_key[keyid].key[0], - psecuritypriv->wep_key[keyid].key[1], - psecuritypriv->wep_key[keyid].key[2], - psecuritypriv->wep_key[keyid].key[3], - psecuritypriv->wep_key[keyid].key[4], - psecuritypriv->wep_key[keyid].key[5], - psecuritypriv->wep_key[keyid].key[6], - psecuritypriv->wep_key[keyid].key[7], - psecuritypriv->wep_key[keyid].key[8], - psecuritypriv->wep_key[keyid].key[9], - psecuritypriv->wep_key[keyid].key[10], - psecuritypriv->wep_key[keyid].key[11], - psecuritypriv->wep_key[keyid].key[12])); + "%s:security key material : %x %x %x %x %x %x %x %x %x %x %x %x %x\n", + __func__, + psecuritypriv->wep_key[keyid].key[0], + psecuritypriv->wep_key[keyid].key[1], + psecuritypriv->wep_key[keyid].key[2], + psecuritypriv->wep_key[keyid].key[3], + psecuritypriv->wep_key[keyid].key[4], + psecuritypriv->wep_key[keyid].key[5], + psecuritypriv->wep_key[keyid].key[6], + psecuritypriv->wep_key[keyid].key[7], + psecuritypriv->wep_key[keyid].key[8], + psecuritypriv->wep_key[keyid].key[9], + psecuritypriv->wep_key[keyid].key[10], + psecuritypriv->wep_key[keyid].key[11], + psecuritypriv->wep_key[keyid].key[12]); res = rtw_set_key23a(padapter, psecuritypriv, keyid, 1); @@ -1814,7 +1809,7 @@ static int rtw_set_ssid(struct rtw_adapter *padapter, if (padapter->hw_init_completed == false) { RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, - ("set_ssid: hw_init_completed == false =>exit!!!\n")); + "set_ssid: hw_init_completed == false =>exit!!!\n"); status = _FAIL; goto exit; } @@ -1827,7 +1822,7 @@ static int rtw_set_ssid(struct rtw_adapter *padapter, if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) { RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - ("set_ssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n")); + "set_ssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"); if (pmlmepriv->assoc_ssid.ssid_len == newnetwork->network.Ssid.ssid_len && @@ -1836,9 +1831,9 @@ static int rtw_set_ssid(struct rtw_adapter *padapter, newnetwork->network.Ssid.ssid_len)) { if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { RT_TRACE(_module_rtl871x_ioctl_set_c_, - _drv_err_, ("New SSID is same SSID, " - "fw_state = 0x%08x\n", - get_fwstate(pmlmepriv))); + _drv_err_, + "New SSID is same SSID, fw_state = 0x%08x\n", + get_fwstate(pmlmepriv)); if (rtw_is_same_ibss23a(padapter, pnetwork)) { /* @@ -1874,15 +1869,15 @@ static int rtw_set_ssid(struct rtw_adapter *padapter, } } else { RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - ("Set SSID not the same ssid\n")); + "Set SSID not the same ssid\n"); RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - ("set_ssid =[%s] len = 0x%x\n", - newnetwork->network.Ssid.ssid, - newnetwork->network.Ssid.ssid_len)); + "set_ssid =[%s] len = 0x%x\n", + newnetwork->network.Ssid.ssid, + newnetwork->network.Ssid.ssid_len); RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, - ("assoc_ssid =[%s] len = 0x%x\n", - pmlmepriv->assoc_ssid.ssid, - pmlmepriv->assoc_ssid.ssid_len)); + "assoc_ssid =[%s] len = 0x%x\n", + pmlmepriv->assoc_ssid.ssid, + pmlmepriv->assoc_ssid.ssid_len); rtw_disassoc_cmd23a(padapter, 0, true); @@ -1946,7 +1941,7 @@ release_mlme_lock: exit: RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, - ("-%s: status =%d\n", __func__, status)); + "-%s: status =%d\n", __func__, status); return status; } diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c index 8f732d9d6888..83696360c293 100644 --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c @@ -342,7 +342,7 @@ int rtw_init_netdev23a_name23a(struct net_device *pnetdev, const char *ifname) { if (dev_alloc_name(pnetdev, ifname) < 0) { RT_TRACE(_module_os_intfs_c_, _drv_err_, - ("dev_alloc_name, fail!\n")); + "dev_alloc_name, fail!\n"); } netif_carrier_off(pnetdev); return 0; @@ -357,7 +357,7 @@ struct net_device *rtw_init_netdev23a(struct rtw_adapter *old_padapter) struct rtw_adapter *padapter; struct net_device *pnetdev; - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+init_net_dev\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, "+init_net_dev\n"); pnetdev = alloc_etherdev_mq(sizeof(struct rtw_adapter), 4); if (!pnetdev) @@ -456,11 +456,11 @@ int rtw_init_drv_sw23a(struct rtw_adapter *padapter) { int ret8 = _SUCCESS; - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_init_drv_sw23a\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, "+rtw_init_drv_sw23a\n"); if (rtw_init_cmd_priv23a(&padapter->cmdpriv) == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, - ("\n Can't init cmd_priv\n")); + "Can't init cmd_priv\n"); ret8 = _FAIL; goto exit; } @@ -469,14 +469,14 @@ int rtw_init_drv_sw23a(struct rtw_adapter *padapter) if (rtw_init_evt_priv23a(&padapter->evtpriv) == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, - ("\n Can't init evt_priv\n")); + "Can't init evt_priv\n"); ret8 = _FAIL; goto exit; } if (rtw_init_mlme_priv23a(padapter) == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, - ("\n Can't init mlme_priv\n")); + "Can't init mlme_priv\n"); ret8 = _FAIL; goto exit; } @@ -484,7 +484,7 @@ int rtw_init_drv_sw23a(struct rtw_adapter *padapter) if (init_mlme_ext_priv23a(padapter) == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, - ("\n Can't init mlme_ext_priv\n")); + "Can't init mlme_ext_priv\n"); ret8 = _FAIL; goto exit; } @@ -521,40 +521,40 @@ int rtw_init_drv_sw23a(struct rtw_adapter *padapter) exit: - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-rtw_init_drv_sw23a\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, "-rtw_init_drv_sw23a\n"); return ret8; } void rtw_cancel_all_timer23a(struct rtw_adapter *padapter) { RT_TRACE(_module_os_intfs_c_, _drv_info_, - ("+rtw_cancel_all_timer23a\n")); + "+rtw_cancel_all_timer23a\n"); del_timer_sync(&padapter->mlmepriv.assoc_timer); RT_TRACE(_module_os_intfs_c_, _drv_info_, - ("%s:cancel association timer complete!\n", __func__)); + "%s:cancel association timer complete!\n", __func__); del_timer_sync(&padapter->mlmepriv.scan_to_timer); RT_TRACE(_module_os_intfs_c_, _drv_info_, - ("%s:cancel scan_to_timer!\n", __func__)); + "%s:cancel scan_to_timer!\n", __func__); del_timer_sync(&padapter->mlmepriv.dynamic_chk_timer); RT_TRACE(_module_os_intfs_c_, _drv_info_, - ("%s:cancel dynamic_chk_timer!\n", __func__)); + "%s:cancel dynamic_chk_timer!\n", __func__); del_timer_sync(&padapter->pwrctrlpriv.pwr_state_check_timer); del_timer_sync(&padapter->mlmepriv.set_scan_deny_timer); rtw_clear_scan_deny(padapter); RT_TRACE(_module_os_intfs_c_, _drv_info_, - ("%s:cancel set_scan_deny_timer!\n", __func__)); + "%s:cancel set_scan_deny_timer!\n", __func__); del_timer_sync(&padapter->recvpriv.signal_stat_timer); } int rtw_free_drv_sw23a(struct rtw_adapter *padapter) { - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("==>rtw_free_drv_sw23a")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, "==>rtw_free_drv_sw23a\n"); free_mlme_ext_priv23a(&padapter->mlmeextpriv); @@ -574,7 +574,7 @@ int rtw_free_drv_sw23a(struct rtw_adapter *padapter) kfree(padapter->HalData); padapter->HalData = NULL; - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-rtw_free_drv_sw23a\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, "-rtw_free_drv_sw23a\n"); return _SUCCESS; } @@ -647,7 +647,7 @@ int netdev_open23a(struct net_device *pnetdev) int ret = 0; int status; - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+871x_drv - dev_open\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, "+871x_drv - dev_open\n"); DBG_8723A("+871x_drv - drv_open, bup =%d\n", padapter->bup); mutex_lock(&adapter_to_dvobj(padapter)->hw_init_mutex); @@ -662,7 +662,7 @@ int netdev_open23a(struct net_device *pnetdev) status = rtl8723au_hal_init(padapter); if (status == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, - ("rtl871x_hal_init(): Can't init h/w!\n")); + "rtl871x_hal_init(): Can't init h/w!\n"); goto netdev_open23a_error; } @@ -694,7 +694,7 @@ int netdev_open23a(struct net_device *pnetdev) else netif_tx_wake_all_queues(pnetdev); - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-871x_drv - dev_open\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, "-871x_drv - dev_open\n"); DBG_8723A("-871x_drv - drv_open, bup =%d\n", padapter->bup); exit: mutex_unlock(&adapter_to_dvobj(padapter)->hw_init_mutex); @@ -707,7 +707,7 @@ netdev_open23a_error: netif_tx_stop_all_queues(pnetdev); RT_TRACE(_module_os_intfs_c_, _drv_err_, - ("-871x_drv - dev_open, fail!\n")); + "-871x_drv - dev_open, fail!\n"); DBG_8723A("-871x_drv - drv_open fail, bup =%d\n", padapter->bup); ret = -1; @@ -728,7 +728,7 @@ static int ips_netdrv_open(struct rtw_adapter *padapter) status = rtl8723au_hal_init(padapter); if (status == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, - ("ips_netdrv_open(): Can't init h/w!\n")); + "ips_netdrv_open(): Can't init h/w!\n"); goto netdev_open23a_error; } @@ -806,7 +806,7 @@ static int netdev_close(struct net_device *pnetdev) { struct rtw_adapter *padapter = netdev_priv(pnetdev); - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+871x_drv - drv_close\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, "+871x_drv - drv_close\n"); padapter->net_closed = true; @@ -834,7 +834,7 @@ static int netdev_close(struct net_device *pnetdev) rtw_scan_abort23a(padapter); - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-871x_drv - drv_close\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, "-871x_drv - drv_close\n"); DBG_8723A("-871x_drv - drv_close, bup =%d\n", padapter->bup); return 0; diff --git a/drivers/staging/rtl8723au/os_dep/recv_linux.c b/drivers/staging/rtl8723au/os_dep/recv_linux.c index bcd970baf405..084b506ae161 100644 --- a/drivers/staging/rtl8723au/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723au/os_dep/recv_linux.c @@ -81,19 +81,19 @@ int rtw_recv_indicatepkt23a(struct rtw_adapter *padapter, skb = precv_frame->pkt; if (!skb) { RT_TRACE(_module_recv_osdep_c_, _drv_err_, - ("rtw_recv_indicatepkt23a():skb == NULL!!!!\n")); + "rtw_recv_indicatepkt23a():skb == NULL!!!!\n"); goto _recv_indicatepkt_drop; } RT_TRACE(_module_recv_osdep_c_, _drv_info_, - ("rtw_recv_indicatepkt23a():skb != NULL !!!\n")); + "rtw_recv_indicatepkt23a():skb != NULL !!!\n"); RT_TRACE(_module_recv_osdep_c_, _drv_info_, - ("rtw_recv_indicatepkt23a():precv_frame->hdr.rx_data =%p\n", - precv_frame->pkt->data)); + "rtw_recv_indicatepkt23a():precv_frame->hdr.rx_data =%p\n", + precv_frame->pkt->data); RT_TRACE(_module_recv_osdep_c_, _drv_info_, - ("\n skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n", - skb->head, skb->data, - skb_tail_pointer(skb), skb_end_pointer(skb), skb->len)); + "skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n", + skb->head, skb->data, + skb_tail_pointer(skb), skb_end_pointer(skb), skb->len); if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { struct sk_buff *pskb2 = NULL; @@ -148,7 +148,7 @@ _recv_indicatepkt_end: rtw_free_recvframe23a(precv_frame); RT_TRACE(_module_recv_osdep_c_, _drv_info_, - ("\n rtw_recv_indicatepkt23a :after netif_rx!!!!\n")); + "rtw_recv_indicatepkt23a :after netif_rx!!!!\n"); return _SUCCESS; _recv_indicatepkt_drop: diff --git a/drivers/staging/rtl8723au/os_dep/usb_intf.c b/drivers/staging/rtl8723au/os_dep/usb_intf.c index bab06995078b..27b3a5b7d8d4 100644 --- a/drivers/staging/rtl8723au/os_dep/usb_intf.c +++ b/drivers/staging/rtl8723au/os_dep/usb_intf.c @@ -159,7 +159,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) if (rtw_init_intf_priv(pdvobjpriv) == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, - ("\n Can't INIT rtw_init_intf_priv\n")); + "Can't INIT rtw_init_intf_priv\n"); goto free_dvobj; } /* 3 misc */ @@ -213,7 +213,7 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf) void rtl8723a_usb_intf_stop(struct rtw_adapter *padapter) { - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+usb_intf_stop\n")); + RT_TRACE(_module_hci_intfs_c_, _drv_err_, "+usb_intf_stop\n"); /* disable_hw_interrupt */ if (!padapter->bSurpriseRemoved) { @@ -221,7 +221,7 @@ void rtl8723a_usb_intf_stop(struct rtw_adapter *padapter) * TODO: */ RT_TRACE(_module_hci_intfs_c_, _drv_err_, - ("SurpriseRemoved == false\n")); + "SurpriseRemoved == false\n"); } /* cancel in irp */ @@ -231,14 +231,14 @@ void rtl8723a_usb_intf_stop(struct rtw_adapter *padapter) rtl8723au_write_port_cancel(padapter); /* todo:cancel other irps */ - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-usb_intf_stop\n")); + RT_TRACE(_module_hci_intfs_c_, _drv_err_, "-usb_intf_stop\n"); } static void rtw_dev_unload(struct rtw_adapter *padapter) { struct submit_ctx *pack_tx_ops = &padapter->xmitpriv.ack_tx_ops; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_dev_unload\n")); + RT_TRACE(_module_hci_intfs_c_, _drv_err_, "+rtw_dev_unload\n"); if (padapter->bup) { DBG_8723A("===> rtw_dev_unload\n"); @@ -262,10 +262,10 @@ static void rtw_dev_unload(struct rtw_adapter *padapter) padapter->bup = false; } else { RT_TRACE(_module_hci_intfs_c_, _drv_err_, - ("r871x_dev_unload():padapter->bup == false\n")); + "r871x_dev_unload():padapter->bup == false\n"); } DBG_8723A("<=== rtw_dev_unload\n"); - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-rtw_dev_unload\n")); + RT_TRACE(_module_hci_intfs_c_, _drv_err_, "-rtw_dev_unload\n"); } static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) @@ -436,7 +436,7 @@ static struct rtw_adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, /* step 5. */ if (rtw_init_drv_sw23a(padapter) == _FAIL) { RT_TRACE(_module_hci_intfs_c_, _drv_err_, - ("Initialize driver software resource Failed!\n")); + "Initialize driver software resource Failed!\n"); goto free_hal_data; } @@ -534,13 +534,13 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, struct dvobj_priv *dvobj; int status = _FAIL; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_init\n")); + RT_TRACE(_module_hci_intfs_c_, _drv_err_, "+rtw_drv_init\n"); /* Initialize dvobj_priv */ dvobj = usb_dvobj_init(pusb_intf); if (!dvobj) { RT_TRACE(_module_hci_intfs_c_, _drv_err_, - ("initialize device object priv Failed!\n")); + "initialize device object priv Failed!\n"); goto exit; } @@ -555,7 +555,7 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, if (status != _SUCCESS) goto free_if1; RT_TRACE(_module_hci_intfs_c_, _drv_err_, - ("-871x_drv - drv_init, success!\n")); + "-871x_drv - drv_init, success!\n"); status = _SUCCESS; @@ -587,7 +587,7 @@ static void rtw_disconnect(struct usb_interface *pusb_intf) usb_set_intfdata(pusb_intf, NULL); - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+dev_remove()\n")); + RT_TRACE(_module_hci_intfs_c_, _drv_err_, "+dev_remove()\n"); rtw_pm_set_ips23a(padapter, IPS_NONE); rtw_pm_set_lps23a(padapter, PS_MODE_ACTIVE); @@ -598,19 +598,19 @@ static void rtw_disconnect(struct usb_interface *pusb_intf) usb_dvobj_deinit(pusb_intf); - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-dev_remove()\n")); + RT_TRACE(_module_hci_intfs_c_, _drv_err_, "-dev_remove()\n"); DBG_8723A("-r871xu_dev_remove, done\n"); } static int __init rtw_drv_entry(void) { - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_entry\n")); + RT_TRACE(_module_hci_intfs_c_, _drv_err_, "+rtw_drv_entry\n"); return usb_register(usb_drv); } static void __exit rtw_drv_halt(void) { - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_halt\n")); + RT_TRACE(_module_hci_intfs_c_, _drv_err_, "+rtw_drv_halt\n"); DBG_8723A("+rtw_drv_halt\n"); usb_deregister(usb_drv); diff --git a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c index 3e19b3b2c1c2..0cdaef0a8c24 100644 --- a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c +++ b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c @@ -58,9 +58,8 @@ static void usb_write_port23a_complete(struct urb *purb) if (padapter->bSurpriseRemoved || padapter->bDriverStopped || padapter->bWritePortCancel) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_write_port23a_complete:bDriverStopped(%d) OR " - "bSurpriseRemoved(%d)", padapter->bDriverStopped, - padapter->bSurpriseRemoved)); + "usb_write_port23a_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", + padapter->bDriverStopped, padapter->bSurpriseRemoved); DBG_8723A("%s(): TX Warning! bDriverStopped(%d) OR " "bSurpriseRemoved(%d) bWritePortCancel(%d) " "pxmitbuf->ext_tag(%x)\n", __func__, @@ -72,14 +71,14 @@ static void usb_write_port23a_complete(struct urb *purb) if (purb->status) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_write_port23a_complete : purb->status(%d) " - "!= 0\n", purb->status)); + "usb_write_port23a_complete : purb->status(%d) != 0\n", + purb->status); DBG_8723A("###=> urb_write_port_complete status(%d)\n", purb->status); if (purb->status == -EPIPE || purb->status == -EPROTO) { } else if (purb->status == -EINPROGRESS) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_write_port23a_complete: EINPROGESS\n")); + "usb_write_port23a_complete: EINPROGESS\n"); goto check_completion; } else if (purb->status == -ENOENT) { DBG_8723A("%s: -ENOENT\n", __func__); @@ -89,18 +88,16 @@ static void usb_write_port23a_complete(struct urb *purb) goto check_completion; } else if (purb->status == -ESHUTDOWN) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_write_port23a_complete: ESHUTDOWN\n")); + "usb_write_port23a_complete: ESHUTDOWN\n"); padapter->bDriverStopped = true; RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_write_port23a_complete:bDriverStopped " - "= true\n")); + "usb_write_port23a_complete:bDriverStopped = true\n"); goto check_completion; } else { padapter->bSurpriseRemoved = true; DBG_8723A("bSurpriseRemoved = true\n"); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_write_port23a_complete:bSurpriseRemoved " - "= true\n")); + "usb_write_port23a_complete:bSurpriseRemoved = true\n"); goto check_completion; } } @@ -132,12 +129,12 @@ int rtl8723au_write_port(struct rtw_adapter *padapter, u32 addr, u32 cnt, int status; int ret = _FAIL; - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("+usb_write_port23a\n")); + RT_TRACE(_module_hci_ops_os_c_, _drv_err_, "+usb_write_port23a\n"); if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("%s:(padapter->bDriverStopped || " - "padapter->bSurpriseRemoved)!!!\n", __func__)); + "%s:(padapter->bDriverStopped || padapter->bSurpriseRemoved)!!!\n", + __func__); rtw23a_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_TX_DENY); goto exit; } @@ -188,8 +185,8 @@ int rtl8723au_write_port(struct rtw_adapter *padapter, u32 addr, u32 cnt, RTW_SCTX_DONE_WRITE_PORT_ERR); DBG_8723A("usb_write_port23a, status =%d\n", status); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_write_port23a(): usb_submit_urb, status =%x\n", - status)); + "usb_write_port23a(): usb_submit_urb, status =%x\n", + status); switch (status) { case -ENODEV: @@ -201,7 +198,7 @@ int rtl8723au_write_port(struct rtw_adapter *padapter, u32 addr, u32 cnt, goto exit; } ret = _SUCCESS; - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("-usb_write_port23a\n")); + RT_TRACE(_module_hci_ops_os_c_, _drv_err_, "-usb_write_port23a\n"); exit: if (ret != _SUCCESS) diff --git a/drivers/staging/rtl8723au/os_dep/xmit_linux.c b/drivers/staging/rtl8723au/os_dep/xmit_linux.c index 69f88848715a..9a14074ecec0 100644 --- a/drivers/staging/rtl8723au/os_dep/xmit_linux.c +++ b/drivers/staging/rtl8723au/os_dep/xmit_linux.c @@ -123,11 +123,11 @@ int rtw_xmit23a_entry23a(struct sk_buff *skb, struct net_device *pnetdev) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; int res = 0; - RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("+xmit_enry\n")); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, "+xmit_enry\n"); if (!rtw_if_up23a(padapter)) { RT_TRACE(_module_xmit_osdep_c_, _drv_err_, - ("rtw_xmit23a_entry23a: rtw_if_up23a fail\n")); + "rtw_xmit23a_entry23a: rtw_if_up23a fail\n"); goto drop_packet; } @@ -139,16 +139,16 @@ int rtw_xmit23a_entry23a(struct sk_buff *skb, struct net_device *pnetdev) pxmitpriv->tx_pkts++; RT_TRACE(_module_xmit_osdep_c_, _drv_info_, - ("rtw_xmit23a_entry23a: tx_pkts=%d\n", - (u32)pxmitpriv->tx_pkts)); + "rtw_xmit23a_entry23a: tx_pkts=%d\n", + (u32)pxmitpriv->tx_pkts); goto exit; drop_packet: pxmitpriv->tx_drop++; dev_kfree_skb_any(skb); RT_TRACE(_module_xmit_osdep_c_, _drv_notice_, - ("rtw_xmit23a_entry23a: drop, tx_drop=%d\n", - (u32)pxmitpriv->tx_drop)); + "rtw_xmit23a_entry23a: drop, tx_drop=%d\n", + (u32)pxmitpriv->tx_drop); exit: return 0; } -- cgit v1.2.3 From da3c8deef6b392cfe9d19645de2fec9fc2005522 Mon Sep 17 00:00:00 2001 From: Niranjan Dighe Date: Wed, 25 Mar 2015 00:46:33 +0530 Subject: Staging: rtl8188eu: replace kzalloc and memcpy by kmemdup This was generated by 'make coccicheck' using scripts at scripts/coccinelle/api/memdup.cocci. Signed-off-by: Niranjan Dighe Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 86d955fadc4b..be9e34a0daef 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -5431,15 +5431,14 @@ u8 set_tx_beacon_cmd(struct adapter *padapter) goto exit; } - ptxBeacon_parm = kzalloc(sizeof(struct wlan_bssid_ex), GFP_KERNEL); + ptxBeacon_parm = kmemdup(&(pmlmeinfo->network), + sizeof(struct wlan_bssid_ex), GFP_KERNEL); if (ptxBeacon_parm == NULL) { kfree(ph2c); res = _FAIL; goto exit; } - memcpy(ptxBeacon_parm, &(pmlmeinfo->network), sizeof(struct wlan_bssid_ex)); - len_diff = update_hidden_ssid(ptxBeacon_parm->IEs+_BEACON_IE_OFFSET_, ptxBeacon_parm->IELength-_BEACON_IE_OFFSET_, pmlmeinfo->hidden_ssid_mode); -- cgit v1.2.3 From 031366ea65495f787eb792a135f51c093d75a197 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 25 Mar 2015 12:54:25 -0700 Subject: staging: rts5208: Remove TRACE_RET and TRACE_GOTO macros Remove these flow hiding macros. Miscellanea: o Add a macro and function to replace a large inline o Simplify #includes o Add trace.c and update Makefile o Remove static inline filename function and use kbasename instead This reduces object size quite a lot: ~350KB (x86-64 allyesconfig) $ size drivers/staging/rts5208/built-in.o* text data bss dec hex filename 248385 36728 77888 363001 589f9 drivers/staging/rts5208/built-in.o.new 506691 83352 115896 705939 ac593 drivers/staging/rts5208/built-in.o.old Done via coccinelle script and some typing. @@ expression chip; expression ret; @@ - TRACE_RET(chip, ret); + rtsx_trace(chip); + return ret; @@ expression chip; identifier label; @@ - TRACE_GOTO(chip, label); + rtsx_trace(chip); + goto label; Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/Makefile | 2 +- drivers/staging/rts5208/ms.c | 1404 ++++++++++++++++++++---------- drivers/staging/rts5208/rtsx.c | 6 - drivers/staging/rts5208/rtsx.h | 13 +- drivers/staging/rts5208/rtsx_card.c | 85 +- drivers/staging/rts5208/rtsx_chip.c | 295 ++++--- drivers/staging/rts5208/rtsx_chip.h | 26 +- drivers/staging/rts5208/rtsx_scsi.c | 539 ++++++++---- drivers/staging/rts5208/rtsx_transport.c | 7 +- drivers/staging/rts5208/sd.c | 1389 +++++++++++++++++++---------- drivers/staging/rts5208/spi.c | 255 ++++-- drivers/staging/rts5208/trace.c | 26 + drivers/staging/rts5208/trace.h | 61 +- drivers/staging/rts5208/xd.c | 453 ++++++---- 14 files changed, 2986 insertions(+), 1575 deletions(-) create mode 100644 drivers/staging/rts5208/trace.c (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/Makefile b/drivers/staging/rts5208/Makefile index 17b4471c4d6d..f7fd03a94e5f 100644 --- a/drivers/staging/rts5208/Makefile +++ b/drivers/staging/rts5208/Makefile @@ -3,4 +3,4 @@ obj-$(CONFIG_RTS5208) := rts5208.o ccflags-y := -Idrivers/scsi rts5208-y := rtsx.o rtsx_chip.o rtsx_transport.o rtsx_scsi.o \ - rtsx_card.o general.o sd.o xd.o ms.o spi.o + rtsx_card.o general.o sd.o xd.o ms.o spi.o trace.o diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c index 4c38ff9d9a76..dcaec195cdcc 100644 --- a/drivers/staging/rts5208/ms.c +++ b/drivers/staging/rts5208/ms.c @@ -26,9 +26,6 @@ #include #include "rtsx.h" -#include "rtsx_transport.h" -#include "rtsx_scsi.h" -#include "rtsx_card.h" #include "ms.h" static inline void ms_set_err_code(struct rtsx_chip *chip, u8 err_code) @@ -47,7 +44,8 @@ static inline int ms_check_err_code(struct rtsx_chip *chip, u8 err_code) static int ms_parse_err_code(struct rtsx_chip *chip) { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } static int ms_transfer_tpc(struct rtsx_chip *chip, u8 trans_mode, @@ -78,7 +76,8 @@ static int ms_transfer_tpc(struct rtsx_chip *chip, u8 trans_mode, if (retval < 0) { rtsx_clear_ms_error(chip); ms_set_err_code(chip, MS_TO_ERROR); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } ptr = rtsx_get_cmd_data(chip) + 1; @@ -86,13 +85,15 @@ static int ms_transfer_tpc(struct rtsx_chip *chip, u8 trans_mode, if (!(tpc & 0x08)) { /* Read Packet */ if (*ptr & MS_CRC16_ERR) { ms_set_err_code(chip, MS_CRC16_ERROR); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } } else { /* Write Packet */ if (CHK_MSPRO(ms_card) && !(*ptr & 0x80)) { if (*ptr & (MS_INT_ERR | MS_INT_CMDNK)) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } } } @@ -100,7 +101,8 @@ static int ms_transfer_tpc(struct rtsx_chip *chip, u8 trans_mode, if (*ptr & MS_RDY_TIMEOUT) { rtsx_clear_ms_error(chip); ms_set_err_code(chip, MS_TO_ERROR); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } return STATUS_SUCCESS; @@ -114,8 +116,10 @@ static int ms_transfer_data(struct rtsx_chip *chip, u8 trans_mode, u8 val, err_code = 0; enum dma_data_direction dir; - if (!buf || !buf_len) - TRACE_RET(chip, STATUS_FAIL); + if (!buf || !buf_len) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (trans_mode == MS_TM_AUTO_READ) { dir = DMA_FROM_DEVICE; @@ -124,7 +128,8 @@ static int ms_transfer_data(struct rtsx_chip *chip, u8 trans_mode, dir = DMA_TO_DEVICE; err_code = MS_FLASH_WRITE_ERROR; } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } rtsx_init_cmd(chip); @@ -160,12 +165,15 @@ static int ms_transfer_data(struct rtsx_chip *chip, u8 trans_mode, else retval = STATUS_FAIL; - TRACE_RET(chip, retval); + rtsx_trace(chip); + return retval; } RTSX_READ_REG(chip, MS_TRANS_CFG, &val); - if (val & (MS_INT_CMDNK | MS_INT_ERR | MS_CRC16_ERR | MS_RDY_TIMEOUT)) - TRACE_RET(chip, STATUS_FAIL); + if (val & (MS_INT_CMDNK | MS_INT_ERR | MS_CRC16_ERR | MS_RDY_TIMEOUT)) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -176,8 +184,10 @@ static int ms_write_bytes(struct rtsx_chip *chip, struct ms_info *ms_card = &(chip->ms_card); int retval, i; - if (!data || (data_len < cnt)) - TRACE_RET(chip, STATUS_ERROR); + if (!data || (data_len < cnt)) { + rtsx_trace(chip); + return STATUS_ERROR; + } rtsx_init_cmd(chip); @@ -211,25 +221,28 @@ static int ms_write_bytes(struct rtsx_chip *chip, if (!(tpc & 0x08)) { if (val & MS_CRC16_ERR) { ms_set_err_code(chip, MS_CRC16_ERROR); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } } else { if (CHK_MSPRO(ms_card) && !(val & 0x80)) { if (val & (MS_INT_ERR | MS_INT_CMDNK)) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, - ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } } } if (val & MS_RDY_TIMEOUT) { ms_set_err_code(chip, MS_TO_ERROR); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } ms_set_err_code(chip, MS_TO_ERROR); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } return STATUS_SUCCESS; @@ -242,8 +255,10 @@ static int ms_read_bytes(struct rtsx_chip *chip, int retval, i; u8 *ptr; - if (!data) - TRACE_RET(chip, STATUS_ERROR); + if (!data) { + rtsx_trace(chip); + return STATUS_ERROR; + } rtsx_init_cmd(chip); @@ -277,25 +292,28 @@ static int ms_read_bytes(struct rtsx_chip *chip, if (!(tpc & 0x08)) { if (val & MS_CRC16_ERR) { ms_set_err_code(chip, MS_CRC16_ERROR); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } } else { if (CHK_MSPRO(ms_card) && !(val & 0x80)) { if (val & (MS_INT_ERR | MS_INT_CMDNK)) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, - ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } } } if (val & MS_RDY_TIMEOUT) { ms_set_err_code(chip, MS_TO_ERROR); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } ms_set_err_code(chip, MS_TO_ERROR); - TRACE_RET(chip, ms_parse_err_code(chip)); + rtsx_trace(chip); + return ms_parse_err_code(chip); } ptr = rtsx_get_cmd_data(chip) + 1; @@ -331,7 +349,8 @@ static int ms_set_rw_reg_addr(struct rtsx_chip *chip, rtsx_clear_ms_error(chip); } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } static int ms_send_cmd(struct rtsx_chip *chip, u8 cmd, u8 cfg) @@ -369,12 +388,16 @@ static int ms_set_init_para(struct rtsx_chip *chip) } retval = switch_clock(chip, ms_card->ms_clock); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = select_card(chip, MS_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -385,12 +408,16 @@ static int ms_switch_clock(struct rtsx_chip *chip) int retval; retval = select_card(chip, MS_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = switch_clock(chip, ms_card->ms_clock); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -455,8 +482,10 @@ static int ms_pull_ctl_enable(struct rtsx_chip *chip) } retval = rtsx_send_cmd(chip, MS_CARD, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -475,20 +504,26 @@ static int ms_prepare_reset(struct rtsx_chip *chip) ms_card->pro_under_formatting = 0; retval = ms_power_off_card3v3(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!chip->ft2_fast_mode) wait_timeout(250); retval = enable_card_clock(chip, MS_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (chip->asic_code) { retval = ms_pull_ctl_enable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { RTSX_WRITE_REG(chip, FPGA_PULL_CTL, FPGA_MS_PULL_CTL_BIT | 0x20, 0); @@ -496,8 +531,10 @@ static int ms_prepare_reset(struct rtsx_chip *chip) if (!chip->ft2_fast_mode) { retval = card_power_on(chip, MS_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } wait_timeout(150); @@ -510,7 +547,8 @@ static int ms_prepare_reset(struct rtsx_chip *chip) if (chip->ocp_stat & oc_mask) { dev_dbg(rtsx_dev(chip), "Over current, OCPSTAT is 0x%x\n", chip->ocp_stat); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif } @@ -532,8 +570,10 @@ static int ms_prepare_reset(struct rtsx_chip *chip) MS_STOP | MS_CLR_ERR, MS_STOP | MS_CLR_ERR); retval = ms_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -545,8 +585,10 @@ static int ms_identify_media_type(struct rtsx_chip *chip, int switch_8bit_bus) u8 val; retval = ms_set_rw_reg_addr(chip, Pro_StatusReg, 6, SystemParm, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } for (i = 0; i < MS_MAX_RETRY_COUNT; i++) { retval = ms_transfer_tpc(chip, MS_TM_READ_BYTES, READ_REG, @@ -554,8 +596,10 @@ static int ms_identify_media_type(struct rtsx_chip *chip, int switch_8bit_bus) if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_READ_REG(chip, PPBUF_BASE2 + 2, &val); dev_dbg(rtsx_dev(chip), "Type register: 0x%x\n", val); @@ -563,14 +607,16 @@ static int ms_identify_media_type(struct rtsx_chip *chip, int switch_8bit_bus) if (val != 0x02) ms_card->check_ms_flow = 1; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } RTSX_READ_REG(chip, PPBUF_BASE2 + 4, &val); dev_dbg(rtsx_dev(chip), "Category register: 0x%x\n", val); if (val != 0) { ms_card->check_ms_flow = 1; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } RTSX_READ_REG(chip, PPBUF_BASE2 + 5, &val); @@ -586,7 +632,8 @@ static int ms_identify_media_type(struct rtsx_chip *chip, int switch_8bit_bus) chip->card_wp |= MS_CARD; } else { ms_card->check_ms_flow = 1; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } ms_card->ms_type |= TYPE_MSPRO; @@ -602,7 +649,8 @@ static int ms_identify_media_type(struct rtsx_chip *chip, int switch_8bit_bus) ms_card->ms_type &= 0x0F; } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -618,7 +666,8 @@ static int ms_confirm_cpu_startup(struct rtsx_chip *chip) do { if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { ms_set_err_code(chip, MS_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } for (i = 0; i < MS_MAX_RETRY_COUNT; i++) { @@ -627,11 +676,15 @@ static int ms_confirm_cpu_startup(struct rtsx_chip *chip) if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } - if (k > 100) - TRACE_RET(chip, STATUS_FAIL); + if (k > 100) { + rtsx_trace(chip); + return STATUS_FAIL; + } k++; wait_timeout(100); @@ -642,14 +695,18 @@ static int ms_confirm_cpu_startup(struct rtsx_chip *chip) if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_ERR) { if (val & INT_REG_CMDNK) chip->card_wp |= (MS_CARD); - else - TRACE_RET(chip, STATUS_FAIL); + else { + rtsx_trace(chip); + return STATUS_FAIL; + } } /* -- end confirm CPU startup */ @@ -669,8 +726,10 @@ static int ms_switch_parallel_bus(struct rtsx_chip *chip) if (retval == STATUS_SUCCESS) break; } - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -689,21 +748,27 @@ static int ms_switch_8bit_bus(struct rtsx_chip *chip) if (retval == STATUS_SUCCESS) break; } - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, MS_CFG, 0x98, MS_BUS_WIDTH_8 | SAMPLE_TIME_FALLING); ms_card->ms_type |= MS_8BIT; retval = ms_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } for (i = 0; i < MS_MAX_RETRY_COUNT; i++) { retval = ms_transfer_tpc(chip, MS_TM_READ_BYTES, GET_INT, 1, NO_WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -716,22 +781,29 @@ static int ms_pro_reset_flow(struct rtsx_chip *chip, int switch_8bit_bus) for (i = 0; i < 3; i++) { retval = ms_prepare_reset(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_identify_media_type(chip, switch_8bit_bus); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_confirm_cpu_startup(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_switch_parallel_bus(chip); if (retval != STATUS_SUCCESS) { if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { ms_set_err_code(chip, MS_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } continue; } else { @@ -739,23 +811,28 @@ static int ms_pro_reset_flow(struct rtsx_chip *chip, int switch_8bit_bus) } } - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } /* Switch MS-PRO into Parallel mode */ RTSX_WRITE_REG(chip, MS_CFG, 0x18, MS_BUS_WIDTH_4); RTSX_WRITE_REG(chip, MS_CFG, PUSH_TIME_ODD, PUSH_TIME_ODD); retval = ms_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } /* If MSPro HG Card, We shall try to switch to 8-bit bus */ if (CHK_MSHG(ms_card) && chip->support_ms_8bit && switch_8bit_bus) { retval = ms_switch_8bit_bus(chip); if (retval != STATUS_SUCCESS) { ms_card->switch_8bit_fail = 1; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -771,8 +848,10 @@ static int msxc_change_power(struct rtsx_chip *chip, u8 mode) ms_cleanup_work(chip); retval = ms_set_rw_reg_addr(chip, 0, 0, Pro_DataCount1, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } buf[0] = 0; buf[1] = mode; @@ -782,16 +861,22 @@ static int msxc_change_power(struct rtsx_chip *chip, u8 mode) buf[5] = 0; retval = ms_write_bytes(chip, PRO_WRITE_REG, 6, NO_WAIT_INT, buf, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_send_cmd(chip, XC_CHG_POWER, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_READ_REG(chip, MS_TRANS_CFG, buf); - if (buf[0] & (MS_INT_CMDNK | MS_INT_ERR)) - TRACE_RET(chip, STATUS_FAIL); + if (buf[0] & (MS_INT_CMDNK | MS_INT_ERR)) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -813,8 +898,10 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) #endif retval = ms_set_rw_reg_addr(chip, Pro_IntReg, 2, Pro_SystemParm, 7); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_MS8BIT(ms_card)) data[0] = PARALLEL_8BIT_IF; @@ -836,12 +923,16 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) if (retval == STATUS_SUCCESS) break; } - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } buf = kmalloc(64 * 512, GFP_KERNEL); - if (buf == NULL) - TRACE_RET(chip, STATUS_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return STATUS_ERROR; + } for (i = 0; i < MS_MAX_RETRY_COUNT; i++) { retval = ms_send_cmd(chip, PRO_READ_ATRB, WAIT_INT); @@ -851,11 +942,13 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) retval = rtsx_read_register(chip, MS_TRANS_CFG, &val); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (!(val & MS_INT_BREQ)) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA, 0x40, WAIT_INT, @@ -867,7 +960,8 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) } if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } i = 0; @@ -875,7 +969,8 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) retval = rtsx_read_register(chip, MS_TRANS_CFG, &val); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if ((val & MS_INT_CED) || !(val & MS_INT_BREQ)) @@ -885,7 +980,8 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) PRO_READ_LONG_DATA, 0, WAIT_INT); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } i++; @@ -893,18 +989,21 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if ((buf[0] != 0xa5) && (buf[1] != 0xc3)) { /* Signature code is wrong */ kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if ((buf[4] < 1) || (buf[4] > 12)) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } for (i = 0; i < buf[4]; i++) { @@ -929,15 +1028,18 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) sys_info_addr, sys_info_size); if (sys_info_size != 96) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (sys_info_addr < 0x1A0) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if ((sys_info_size + sys_info_addr) > 0x8000) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #ifdef SUPPORT_MSXC @@ -964,15 +1066,18 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) model_name_addr, model_name_size); if (model_name_size != 48) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (model_name_addr < 0x1A0) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if ((model_name_size + model_name_addr) > 0x8000) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } found_model_name = 1; @@ -985,7 +1090,8 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) if (i == buf[4]) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } class_code = buf[sys_info_addr + 0]; @@ -1030,15 +1136,21 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) #ifdef SUPPORT_MSXC if (CHK_MSXC(ms_card)) { - if (class_code != 0x03) - TRACE_RET(chip, STATUS_FAIL); + if (class_code != 0x03) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { - if (class_code != 0x02) - TRACE_RET(chip, STATUS_FAIL); + if (class_code != 0x02) { + rtsx_trace(chip); + return STATUS_FAIL; + } } #else - if (class_code != 0x02) - TRACE_RET(chip, STATUS_FAIL); + if (class_code != 0x02) { + rtsx_trace(chip); + return STATUS_FAIL; + } #endif if (device_type != 0x00) { @@ -1046,12 +1158,15 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) (device_type == 0x03)) { chip->card_wp |= MS_CARD; } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } - if (sub_class & 0xC0) - TRACE_RET(chip, STATUS_FAIL); + if (sub_class & 0xC0) { + rtsx_trace(chip); + return STATUS_FAIL; + } dev_dbg(rtsx_dev(chip), "class_code: 0x%x, device_type: 0x%x, sub_class: 0x%x\n", class_code, device_type, sub_class); @@ -1099,16 +1214,21 @@ Retry: if (retval != STATUS_SUCCESS) { if (ms_card->switch_8bit_fail) { retval = ms_pro_reset_flow(chip, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } retval = ms_read_attribute_info(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } #ifdef XC_POWERCLASS if (CHK_HG8BIT(ms_card)) @@ -1148,8 +1268,10 @@ Retry: #ifdef SUPPORT_MAGIC_GATE retval = mg_set_tpc_para_sub(chip, 0, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } #endif if (CHK_HG8BIT(ms_card)) @@ -1166,16 +1288,21 @@ static int ms_read_status_reg(struct rtsx_chip *chip) u8 val[2]; retval = ms_set_rw_reg_addr(chip, StatusReg0, 2, 0, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_read_bytes(chip, READ_REG, 2, NO_WAIT_INT, val, 2); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val[1] & (STS_UCDT | STS_UCEX | STS_UCFG)) { ms_set_err_code(chip, MS_FLASH_READ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -1191,8 +1318,10 @@ static int ms_read_extra_data(struct rtsx_chip *chip, retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_MS4BIT(ms_card)) { /* Parallel interface */ @@ -1213,8 +1342,10 @@ static int ms_read_extra_data(struct rtsx_chip *chip, if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); @@ -1223,35 +1354,46 @@ static int ms_read_extra_data(struct rtsx_chip *chip, if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_CMDNK) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_CED) { if (val & INT_REG_ERR) { retval = ms_read_status_reg(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } } retval = ms_read_bytes(chip, READ_REG, MS_EXTRA_SIZE, NO_WAIT_INT, data, MS_EXTRA_SIZE); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (buf && buf_len) { if (buf_len > MS_EXTRA_SIZE) @@ -1269,13 +1411,17 @@ static int ms_write_extra_data(struct rtsx_chip *chip, int retval, i; u8 val, data[16]; - if (!buf || (buf_len < MS_EXTRA_SIZE)) - TRACE_RET(chip, STATUS_FAIL); + if (!buf || (buf_len < MS_EXTRA_SIZE)) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 6 + MS_EXTRA_SIZE); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_MS4BIT(ms_card)) data[0] = 0x88; @@ -1293,26 +1439,34 @@ static int ms_write_extra_data(struct rtsx_chip *chip, retval = ms_write_bytes(chip, WRITE_REG, (6 + MS_EXTRA_SIZE), NO_WAIT_INT, data, 16); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_send_cmd(chip, BLOCK_WRITE, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_CMDNK) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_CED) { if (val & INT_REG_ERR) { ms_set_err_code(chip, MS_FLASH_WRITE_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1328,8 +1482,10 @@ static int ms_read_page(struct rtsx_chip *chip, u16 block_addr, u8 page_num) retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_MS4BIT(ms_card)) data[0] = 0x88; @@ -1343,28 +1499,36 @@ static int ms_read_page(struct rtsx_chip *chip, u16 block_addr, u8 page_num) data[5] = page_num; retval = ms_write_bytes(chip, WRITE_REG, 6, NO_WAIT_INT, data, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_send_cmd(chip, BLOCK_READ, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_CMDNK) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_CED) { if (val & INT_REG_ERR) { if (!(val & INT_REG_BREQ)) { ms_set_err_code(chip, MS_FLASH_READ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_read_status_reg(chip); if (retval != STATUS_SUCCESS) @@ -1373,18 +1537,23 @@ static int ms_read_page(struct rtsx_chip *chip, u16 block_addr, u8 page_num) } else { if (!(val & INT_REG_BREQ)) { ms_set_err_code(chip, MS_BREQ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } } retval = ms_transfer_tpc(chip, MS_TM_NORMAL_READ, READ_PAGE_DATA, 0, NO_WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } - if (ms_check_err_code(chip, MS_FLASH_WRITE_ERROR)) - TRACE_RET(chip, STATUS_FAIL); + if (ms_check_err_code(chip, MS_FLASH_WRITE_ERROR)) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1397,13 +1566,17 @@ static int ms_set_bad_block(struct rtsx_chip *chip, u16 phy_blk) u8 val, data[8], extra[MS_EXTRA_SIZE]; retval = ms_read_extra_data(chip, phy_blk, 0, extra, MS_EXTRA_SIZE); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 7); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); @@ -1421,27 +1594,35 @@ static int ms_set_bad_block(struct rtsx_chip *chip, u16 phy_blk) data[7] = 0xFF; retval = ms_write_bytes(chip, WRITE_REG, 7, NO_WAIT_INT, data, 7); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_send_cmd(chip, BLOCK_WRITE, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_CMDNK) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_CED) { if (val & INT_REG_ERR) { ms_set_err_code(chip, MS_FLASH_WRITE_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1457,8 +1638,10 @@ static int ms_erase_block(struct rtsx_chip *chip, u16 phy_blk) retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); @@ -1474,18 +1657,24 @@ static int ms_erase_block(struct rtsx_chip *chip, u16 phy_blk) data[5] = 0; retval = ms_write_bytes(chip, WRITE_REG, 6, NO_WAIT_INT, data, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ERASE_RTY: retval = ms_send_cmd(chip, BLOCK_ERASE, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_CMDNK) { if (i < 3) { @@ -1495,13 +1684,15 @@ ERASE_RTY: ms_set_err_code(chip, MS_CMD_NK); ms_set_bad_block(chip, phy_blk); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_CED) { if (val & INT_REG_ERR) { ms_set_err_code(chip, MS_FLASH_WRITE_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1544,13 +1735,16 @@ static int ms_init_page(struct rtsx_chip *chip, u16 phy_blk, u16 log_blk, for (i = start_page; i < end_page; i++) { if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { ms_set_err_code(chip, MS_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_write_extra_data(chip, phy_blk, i, extra, MS_EXTRA_SIZE); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1570,42 +1764,54 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, start_page, end_page); retval = ms_read_extra_data(chip, new_blk, 0, extra, MS_EXTRA_SIZE); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_read_status_reg(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_READ_REG(chip, PPBUF_BASE2, &val); if (val & BUF_FULL) { retval = ms_send_cmd(chip, CLEAR_BUF, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!(val & INT_REG_CED)) { ms_set_err_code(chip, MS_FLASH_WRITE_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } for (i = start_page; i < end_page; i++) { if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { ms_set_err_code(chip, MS_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } ms_read_extra_data(chip, old_blk, i, extra, MS_EXTRA_SIZE); retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); @@ -1622,21 +1828,28 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, retval = ms_write_bytes(chip, WRITE_REG, 6, NO_WAIT_INT, data, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_send_cmd(chip, BLOCK_READ, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_CMDNK) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_CED) { @@ -1653,8 +1866,10 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, MS_TM_NORMAL_READ, READ_PAGE_DATA, 0, NO_WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (uncorrect_flag) { ms_set_page_status(log_blk, setPS_NG, @@ -1685,13 +1900,16 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, if (retval == STATUS_SUCCESS) break; } - if (rty_cnt == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (rty_cnt == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } } if (!(val & INT_REG_BREQ)) { ms_set_err_code(chip, MS_BREQ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1725,35 +1943,45 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, retval = ms_write_bytes(chip, WRITE_REG, (6 + MS_EXTRA_SIZE), NO_WAIT_INT, data, 16); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_send_cmd(chip, BLOCK_WRITE, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_CMDNK) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_CED) { if (val & INT_REG_ERR) { ms_set_err_code(chip, MS_FLASH_WRITE_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } if (i == 0) { retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 7); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); @@ -1772,29 +2000,37 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, retval = ms_write_bytes(chip, WRITE_REG, 7, NO_WAIT_INT, data, 8); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_send_cmd(chip, BLOCK_WRITE, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_CMDNK) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_CED) { if (val & INT_REG_ERR) { ms_set_err_code(chip, MS_FLASH_WRITE_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } } @@ -1815,18 +2051,24 @@ static int reset_ms(struct rtsx_chip *chip) #endif retval = ms_prepare_reset(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_card->ms_type |= TYPE_MS; retval = ms_send_cmd(chip, MS_RESET, NO_WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_read_status_reg(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_READ_REG(chip, PPBUF_BASE2, &val); if (val & WRT_PRTCT) @@ -1841,7 +2083,8 @@ RE_SEARCH: while (i < (MAX_DEFECTIVE_BLOCK + 2)) { if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { ms_set_err_code(chip, MS_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_read_extra_data(chip, i, 0, extra, MS_EXTRA_SIZE); @@ -1861,7 +2104,8 @@ RE_SEARCH: if (i == (MAX_DEFECTIVE_BLOCK + 2)) { dev_dbg(rtsx_dev(chip), "No boot block found!"); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } for (j = 0; j < 3; j++) { @@ -1876,8 +2120,10 @@ RE_SEARCH: } retval = ms_read_page(chip, ms_card->boot_block, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } /* Read MS system information as sys_info */ rtsx_init_cmd(chip); @@ -1886,8 +2132,10 @@ RE_SEARCH: rtsx_add_cmd(chip, READ_REG_CMD, PPBUF_BASE2 + 0x1A0 + i, 0, 0); retval = rtsx_send_cmd(chip, MS_CARD, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } ptr = rtsx_get_cmd_data(chip); memcpy(ms_card->raw_sys_info, ptr, 96); @@ -1909,8 +2157,10 @@ RE_SEARCH: rtsx_add_cmd(chip, READ_REG_CMD, MS_4bit_Support, 0, 0); retval = rtsx_send_cmd(chip, MS_CARD, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } ptr = rtsx_get_cmd_data(chip); @@ -1983,16 +2233,20 @@ RE_SEARCH: /* Switch I/F Mode */ if (ptr[15]) { retval = ms_set_rw_reg_addr(chip, 0, 0, SystemParm, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, PPBUF_BASE2, 0xFF, 0x88); RTSX_WRITE_REG(chip, PPBUF_BASE2 + 1, 0xFF, 0); retval = ms_transfer_tpc(chip, MS_TM_WRITE_BYTES, WRITE_REG, 1, NO_WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, MS_CFG, 0x58 | MS_NO_CHECK_INT, MS_BUS_WIDTH_4 | PUSH_TIME_ODD | MS_NO_CHECK_INT); @@ -2021,24 +2275,32 @@ static int ms_init_l2p_tbl(struct rtsx_chip *chip) size = ms_card->segment_cnt * sizeof(struct zone_entry); ms_card->segment = vzalloc(size); - if (ms_card->segment == NULL) - TRACE_RET(chip, STATUS_FAIL); + if (ms_card->segment == NULL) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_read_page(chip, ms_card->boot_block, 1); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, INIT_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto INIT_FAIL; + } reg_addr = PPBUF_BASE2; for (i = 0; i < (((ms_card->total_block >> 9) * 10) + 1); i++) { int block_no; retval = rtsx_read_register(chip, reg_addr++, &val1); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, INIT_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto INIT_FAIL; + } retval = rtsx_read_register(chip, reg_addr++, &val2); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, INIT_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto INIT_FAIL; + } defect_block = ((u16)val1 << 8) | val2; if (defect_block == 0xFFFF) @@ -2201,8 +2463,10 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) if (ms_card->segment == NULL) { retval = ms_init_l2p_tbl(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, retval); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return retval; + } } if (ms_card->segment[seg_no].build_flag) { @@ -2220,15 +2484,19 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) if (segment->l2p_table == NULL) { segment->l2p_table = vmalloc(table_size * 2); - if (segment->l2p_table == NULL) - TRACE_GOTO(chip, BUILD_FAIL); + if (segment->l2p_table == NULL) { + rtsx_trace(chip); + goto BUILD_FAIL; + } } memset((u8 *)(segment->l2p_table), 0xff, table_size * 2); if (segment->free_table == NULL) { segment->free_table = vmalloc(MS_FREE_TABLE_CNT * 2); - if (segment->free_table == NULL) - TRACE_GOTO(chip, BUILD_FAIL); + if (segment->free_table == NULL) { + rtsx_trace(chip); + goto BUILD_FAIL; + } } memset((u8 *)(segment->free_table), 0xff, MS_FREE_TABLE_CNT * 2); @@ -2352,8 +2620,10 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) return STATUS_SUCCESS; } retval = ms_init_page(chip, phy_blk, log_blk, 0, 1); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, BUILD_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto BUILD_FAIL; + } segment->l2p_table[idx] = phy_blk; if (seg_no == ms_card->segment_cnt - 1) { @@ -2383,14 +2653,18 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) phy_blk = ms_get_unused_block(chip, 0); retval = ms_copy_page(chip, tmp_blk, phy_blk, log_blk, 0, ms_card->page_off + 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } segment->l2p_table[log_blk] = phy_blk; retval = ms_set_bad_block(chip, tmp_blk); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } } } @@ -2420,12 +2694,16 @@ int reset_ms_card(struct rtsx_chip *chip) memset(ms_card, 0, sizeof(struct ms_info)); retval = enable_card_clock(chip, MS_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = select_card(chip, MS_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_card->ms_type = 0; @@ -2433,24 +2711,31 @@ int reset_ms_card(struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { if (ms_card->check_ms_flow) { retval = reset_ms(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } retval = ms_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!CHK_MSPRO(ms_card)) { /* Build table for the last segment, * to check if L2P table block exists, erasing it */ retval = ms_build_l2p_tbl(chip, ms_card->total_block / 512 - 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } dev_dbg(rtsx_dev(chip), "ms_card->ms_type = 0x%x\n", ms_card->ms_type); @@ -2479,8 +2764,10 @@ static int mspro_set_rw_cmd(struct rtsx_chip *chip, if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -2520,8 +2807,10 @@ static inline int ms_auto_tune_clock(struct rtsx_chip *chip) } retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -2570,8 +2859,10 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb, } retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (srb->sc_data_direction == DMA_FROM_DEVICE) trans_mode = MS_TM_AUTO_READ; @@ -2591,8 +2882,10 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb, ms_card->total_sec_cnt = 0; if (val & MS_INT_BREQ) { retval = ms_send_cmd(chip, PRO_STOP, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_write_register(chip, RBCTL, RB_FLUSH, RB_FLUSH); } @@ -2619,7 +2912,8 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb, retval = mspro_set_rw_cmd(chip, start_sector, count, rw_cmd); if (retval != STATUS_SUCCESS) { ms_card->seq_mode = 0; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -2634,7 +2928,8 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb, if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { chip->rw_need_retry = 0; dev_dbg(rtsx_dev(chip), "No card exist, exit mspro_rw_multi_sector\n"); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & MS_INT_BREQ) @@ -2646,7 +2941,8 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb, ms_auto_tune_clock(chip); } - TRACE_RET(chip, retval); + rtsx_trace(chip); + return retval; } if (ms_card->seq_mode) { @@ -2674,13 +2970,15 @@ static int mspro_read_format_progress(struct rtsx_chip *chip, retval = ms_switch_clock(chip); if (retval != STATUS_SUCCESS) { ms_card->format_status = FORMAT_FAIL; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = rtsx_read_register(chip, MS_TRANS_CFG, &tmp); if (retval != STATUS_SUCCESS) { ms_card->format_status = FORMAT_FAIL; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (!(tmp & MS_INT_BREQ)) { @@ -2689,7 +2987,8 @@ static int mspro_read_format_progress(struct rtsx_chip *chip, return STATUS_SUCCESS; } ms_card->format_status = FORMAT_FAIL; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (short_data_len >= 256) @@ -2701,14 +3000,16 @@ static int mspro_read_format_progress(struct rtsx_chip *chip, MS_NO_CHECK_INT); if (retval != STATUS_SUCCESS) { ms_card->format_status = FORMAT_FAIL; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_read_bytes(chip, PRO_READ_SHORT_DATA, cnt, WAIT_INT, data, 8); if (retval != STATUS_SUCCESS) { ms_card->format_status = FORMAT_FAIL; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } total_progress = (data[0] << 24) | (data[1] << 16) | @@ -2733,7 +3034,8 @@ static int mspro_read_format_progress(struct rtsx_chip *chip, retval = rtsx_read_register(chip, MS_TRANS_CFG, &tmp); if (retval != STATUS_SUCCESS) { ms_card->format_status = FORMAT_FAIL; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (tmp & (MS_INT_CED | MS_INT_CMDNK | MS_INT_BREQ | MS_INT_ERR)) @@ -2745,17 +3047,20 @@ static int mspro_read_format_progress(struct rtsx_chip *chip, retval = rtsx_write_register(chip, MS_CFG, MS_NO_CHECK_INT, 0); if (retval != STATUS_SUCCESS) { ms_card->format_status = FORMAT_FAIL; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (i == 5000) { ms_card->format_status = FORMAT_FAIL; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (tmp & (MS_INT_CMDNK | MS_INT_ERR)) { ms_card->format_status = FORMAT_FAIL; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (tmp & MS_INT_CED) { @@ -2766,7 +3071,8 @@ static int mspro_read_format_progress(struct rtsx_chip *chip, } else { ms_card->format_status = FORMAT_FAIL; ms_card->pro_under_formatting = 0; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -2798,12 +3104,16 @@ int mspro_format(struct scsi_cmnd *srb, struct rtsx_chip *chip, u16 para; retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_set_rw_reg_addr(chip, 0x00, 0x00, Pro_TPCParm, 0x01); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } memset(buf, 0, 2); switch (short_data_len) { @@ -2828,8 +3138,10 @@ int mspro_format(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (quick_format) para = 0x0000; @@ -2837,13 +3149,17 @@ int mspro_format(struct scsi_cmnd *srb, struct rtsx_chip *chip, para = 0x0001; retval = mspro_set_rw_cmd(chip, 0, para, PRO_FORMAT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_READ_REG(chip, MS_TRANS_CFG, &tmp); - if (tmp & (MS_INT_CMDNK | MS_INT_ERR)) - TRACE_RET(chip, STATUS_FAIL); + if (tmp & (MS_INT_CMDNK | MS_INT_ERR)) { + rtsx_trace(chip); + return STATUS_FAIL; + } if ((tmp & (MS_INT_BREQ | MS_INT_CED)) == MS_INT_BREQ) { ms_card->pro_under_formatting = 1; @@ -2860,7 +3176,8 @@ int mspro_format(struct scsi_cmnd *srb, struct rtsx_chip *chip, return STATUS_SUCCESS; } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } @@ -2879,14 +3196,17 @@ static int ms_read_multiple_pages(struct rtsx_chip *chip, u16 phy_blk, if (retval == STATUS_SUCCESS) { if ((extra[1] & 0x30) != 0x30) { ms_set_err_code(chip, MS_FLASH_READ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_MS4BIT(ms_card)) data[0] = 0x88; @@ -2905,14 +3225,18 @@ static int ms_read_multiple_pages(struct rtsx_chip *chip, u16 phy_blk, if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_send_cmd(chip, BLOCK_READ, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ptr = buf; @@ -2921,16 +3245,20 @@ static int ms_read_multiple_pages(struct rtsx_chip *chip, u16 phy_blk, if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { ms_set_err_code(chip, MS_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (val & INT_REG_CMDNK) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_ERR) { if (val & INT_REG_BREQ) { @@ -2943,34 +3271,42 @@ static int ms_read_multiple_pages(struct rtsx_chip *chip, u16 phy_blk, page_addr, extra, MS_EXTRA_SIZE); } ms_set_err_code(chip, MS_FLASH_READ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else { ms_set_err_code(chip, MS_FLASH_READ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else { if (!(val & INT_REG_BREQ)) { ms_set_err_code(chip, MS_BREQ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } if (page_addr == (end_page - 1)) { if (!(val & INT_REG_CED)) { retval = ms_send_cmd(chip, BLOCK_END, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!(val & INT_REG_CED)) { ms_set_err_code(chip, MS_FLASH_READ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } trans_cfg = NO_WAIT_INT; @@ -3003,19 +3339,22 @@ static int ms_read_multiple_pages(struct rtsx_chip *chip, u16 phy_blk, if (retval == -ETIMEDOUT) { ms_set_err_code(chip, MS_TO_ERROR); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_TIMEDOUT); + rtsx_trace(chip); + return STATUS_TIMEDOUT; } retval = rtsx_read_register(chip, MS_TRANS_CFG, &val); if (retval != STATUS_SUCCESS) { ms_set_err_code(chip, MS_TO_ERROR); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_TIMEDOUT); + rtsx_trace(chip); + return STATUS_TIMEDOUT; } if (val & (MS_CRC16_ERR | MS_RDY_TIMEOUT)) { ms_set_err_code(chip, MS_CRC16_ERROR); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -3039,8 +3378,10 @@ static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk, if (!start_page) { retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, 7); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_MS4BIT(ms_card)) data[0] = 0x88; @@ -3057,24 +3398,32 @@ static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk, retval = ms_write_bytes(chip, WRITE_REG, 7, NO_WAIT_INT, data, 8); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_send_cmd(chip, BLOCK_WRITE, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); retval = ms_transfer_tpc(chip, MS_TM_READ_BYTES, GET_INT, 1, NO_WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = ms_set_rw_reg_addr(chip, OverwriteFlag, MS_EXTRA_SIZE, SystemParm, (6 + MS_EXTRA_SIZE)); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ms_set_err_code(chip, MS_NO_ERROR); @@ -3106,20 +3455,26 @@ static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk, if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } for (i = 0; i < MS_MAX_RETRY_COUNT; i++) { retval = ms_send_cmd(chip, BLOCK_WRITE, WAIT_INT); if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ptr = buf; for (page_addr = start_page; page_addr < end_page; page_addr++) { @@ -3127,20 +3482,24 @@ static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk, if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { ms_set_err_code(chip, MS_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_CMDNK) { ms_set_err_code(chip, MS_CMD_NK); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (val & INT_REG_ERR) { ms_set_err_code(chip, MS_FLASH_WRITE_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (!(val & INT_REG_BREQ)) { ms_set_err_code(chip, MS_BREQ_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } udelay(30); @@ -3171,34 +3530,43 @@ static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk, ms_set_err_code(chip, MS_TO_ERROR); rtsx_clear_ms_error(chip); - if (retval == -ETIMEDOUT) - TRACE_RET(chip, STATUS_TIMEDOUT); - else - TRACE_RET(chip, STATUS_FAIL); + if (retval == -ETIMEDOUT) { + rtsx_trace(chip); + return STATUS_TIMEDOUT; + } + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if ((end_page - start_page) == 1) { if (!(val & INT_REG_CED)) { ms_set_err_code(chip, MS_FLASH_WRITE_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else { if (page_addr == (end_page - 1)) { if (!(val & INT_REG_CED)) { retval = ms_send_cmd(chip, BLOCK_END, WAIT_INT); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = ms_read_bytes(chip, GET_INT, 1, NO_WAIT_INT, &val, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } if ((page_addr == (end_page - 1)) || @@ -3206,7 +3574,8 @@ static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk, if (!(val & INT_REG_CED)) { ms_set_err_code(chip, MS_FLASH_WRITE_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } } @@ -3227,8 +3596,10 @@ static int ms_finish_write(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, retval = ms_copy_page(chip, old_blk, new_blk, log_blk, page_off, ms_card->page_off + 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } seg_no = old_blk >> 9; @@ -3254,8 +3625,10 @@ static int ms_prepare_write(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, if (start_page) { retval = ms_copy_page(chip, old_blk, new_blk, log_blk, 0, start_page); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -3270,8 +3643,10 @@ int ms_delay_write(struct rtsx_chip *chip) if (delay_write->delay_write_flag) { retval = ms_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } delay_write->delay_write_flag = 0; retval = ms_finish_write(chip, @@ -3279,8 +3654,10 @@ int ms_delay_write(struct rtsx_chip *chip) delay_write->new_phyblock, delay_write->logblock, delay_write->pageoff); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -3319,7 +3696,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, retval = ms_switch_clock(chip); if (retval != STATUS_SUCCESS) { ms_rw_fail(srb, chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } log_blk = (u16)(start_sector >> ms_card->block_shift); @@ -3335,7 +3713,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval != STATUS_SUCCESS) { chip->card_fail |= MS_CARD; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -3352,7 +3731,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } old_blk = delay_write->old_phyblock; new_blk = delay_write->new_phyblock; @@ -3367,7 +3747,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif old_blk = ms_get_l2p_tbl(chip, seg_no, @@ -3376,7 +3757,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, if ((old_blk == 0xFFFF) || (new_blk == 0xFFFF)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_prepare_write(chip, old_blk, new_blk, @@ -3385,11 +3767,13 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #ifdef MS_DELAY_WRITE } @@ -3401,11 +3785,13 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif old_blk = ms_get_l2p_tbl(chip, seg_no, @@ -3413,7 +3799,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (old_blk == 0xFFFF) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -3446,10 +3833,12 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } ms_rw_fail(srb, chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (srb->sc_data_direction == DMA_TO_DEVICE) { @@ -3485,7 +3874,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, chip->card_fail |= MS_CARD; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -3493,14 +3883,16 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, log_blk - ms_start_idx[seg_no]); if (old_blk == 0xFFFF) { ms_rw_fail(srb, chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (srb->sc_data_direction == DMA_TO_DEVICE) { new_blk = ms_get_unused_block(chip, seg_no); if (new_blk == 0xFFFF) { ms_rw_fail(srb, chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -3525,11 +3917,13 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (detect_card_cd(chip, MS_CARD) != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } ms_rw_fail(srb, chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif } @@ -3591,12 +3985,16 @@ static int ms_poll_int(struct rtsx_chip *chip) rtsx_add_cmd(chip, CHECK_REG_CMD, MS_TRANS_CFG, MS_INT_CED, MS_INT_CED); retval = rtsx_send_cmd(chip, MS_CARD, 5000); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } val = *rtsx_get_cmd_data(chip); - if (val & MS_INT_ERR) - TRACE_RET(chip, STATUS_FAIL); + if (val & MS_INT_ERR) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -3659,12 +4057,15 @@ static int mg_send_ex_cmd(struct rtsx_chip *chip, u8 cmd, u8 entry_num) if (retval == STATUS_SUCCESS) break; } - if (i == MS_MAX_RETRY_COUNT) - TRACE_RET(chip, STATUS_FAIL); + if (i == MS_MAX_RETRY_COUNT) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (check_ms_err(chip)) { rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -3681,8 +4082,10 @@ static int mg_set_tpc_para_sub(struct rtsx_chip *chip, int type, else retval = ms_set_rw_reg_addr(chip, 0, 0, Pro_DataCount1, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } buf[0] = 0; buf[1] = 0; @@ -3694,8 +4097,10 @@ static int mg_set_tpc_para_sub(struct rtsx_chip *chip, int type, } retval = ms_write_bytes(chip, PRO_WRITE_REG, (type == 0) ? 1 : 6, NO_WAIT_INT, buf, 6); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -3709,19 +4114,23 @@ int mg_set_leaf_id(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (scsi_bufflen(srb) < 12) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } ms_cleanup_work(chip); retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = mg_send_ex_cmd(chip, MG_SET_LID, 0); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } memset(buf1, 0, 32); @@ -3733,12 +4142,14 @@ int mg_set_leaf_id(struct scsi_cmnd *srb, struct rtsx_chip *chip) buf1, 32); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (check_ms_err(chip)) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -3754,12 +4165,16 @@ int mg_get_local_EKB(struct scsi_cmnd *srb, struct rtsx_chip *chip) ms_cleanup_work(chip); retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } buf = kmalloc(1540, GFP_KERNEL); - if (!buf) - TRACE_RET(chip, STATUS_ERROR); + if (!buf) { + rtsx_trace(chip); + return STATUS_ERROR; + } buf[0] = 0x04; buf[1] = 0x1A; @@ -3769,7 +4184,8 @@ int mg_get_local_EKB(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = mg_send_ex_cmd(chip, MG_GET_LEKB, 0); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); - TRACE_GOTO(chip, GetEKBFinish); + rtsx_trace(chip); + goto GetEKBFinish; } retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA, @@ -3777,12 +4193,14 @@ int mg_get_local_EKB(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); rtsx_clear_ms_error(chip); - TRACE_GOTO(chip, GetEKBFinish); + rtsx_trace(chip); + goto GetEKBFinish; } if (check_ms_err(chip)) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } bufflen = min_t(int, 1052, scsi_bufflen(srb)); @@ -3805,25 +4223,30 @@ int mg_chg(struct scsi_cmnd *srb, struct rtsx_chip *chip) ms_cleanup_work(chip); retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = mg_send_ex_cmd(chip, MG_GET_ID, 0); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_read_bytes(chip, PRO_READ_SHORT_DATA, 32, WAIT_INT, buf, 32); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (check_ms_err(chip)) { set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } memcpy(ms_card->magic_gate_id, buf, 16); @@ -3832,14 +4255,16 @@ int mg_chg(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = ms_poll_int(chip); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif retval = mg_send_ex_cmd(chip, MG_SET_RD, 0); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } bufflen = min_t(int, 12, scsi_bufflen(srb)); @@ -3855,12 +4280,14 @@ int mg_chg(struct scsi_cmnd *srb, struct rtsx_chip *chip) 32, WAIT_INT, buf, 32); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (check_ms_err(chip)) { set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } ms_card->mg_auth = 0; @@ -3879,25 +4306,30 @@ int mg_get_rsp_chg(struct scsi_cmnd *srb, struct rtsx_chip *chip) ms_cleanup_work(chip); retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = mg_send_ex_cmd(chip, MG_MAKE_RMS, 0); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = ms_read_bytes(chip, PRO_READ_SHORT_DATA, 32, WAIT_INT, buf1, 32); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (check_ms_err(chip)) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } buf2[0] = 0x00; @@ -3915,7 +4347,8 @@ int mg_get_rsp_chg(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = ms_poll_int(chip); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif @@ -3934,13 +4367,16 @@ int mg_rsp(struct scsi_cmnd *srb, struct rtsx_chip *chip) ms_cleanup_work(chip); retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = mg_send_ex_cmd(chip, MG_MAKE_KSE, 0); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } bufflen = min_t(int, 12, scsi_bufflen(srb)); @@ -3956,12 +4392,14 @@ int mg_rsp(struct scsi_cmnd *srb, struct rtsx_chip *chip) buf, 32); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (check_ms_err(chip)) { set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } ms_card->mg_auth = 1; @@ -3980,12 +4418,16 @@ int mg_get_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip) ms_cleanup_work(chip); retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } buf = kmalloc(1028, GFP_KERNEL); - if (!buf) - TRACE_RET(chip, STATUS_ERROR); + if (!buf) { + rtsx_trace(chip); + return STATUS_ERROR; + } buf[0] = 0x04; buf[1] = 0x02; @@ -3995,7 +4437,8 @@ int mg_get_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = mg_send_ex_cmd(chip, MG_GET_IBD, ms_card->mg_entry_num); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_GOTO(chip, GetICVFinish); + rtsx_trace(chip); + goto GetICVFinish; } retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA, @@ -4003,12 +4446,14 @@ int mg_get_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); rtsx_clear_ms_error(chip); - TRACE_GOTO(chip, GetICVFinish); + rtsx_trace(chip); + goto GetICVFinish; } if (check_ms_err(chip)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); rtsx_clear_ms_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } bufflen = min_t(int, 1028, scsi_bufflen(srb)); @@ -4033,12 +4478,16 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip) ms_cleanup_work(chip); retval = ms_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } buf = kmalloc(1028, GFP_KERNEL); - if (!buf) - TRACE_RET(chip, STATUS_ERROR); + if (!buf) { + rtsx_trace(chip); + return STATUS_ERROR; + } bufflen = min_t(int, 1028, scsi_bufflen(srb)); rtsx_stor_get_xfer_buf(buf, bufflen, srb); @@ -4055,7 +4504,8 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip) } else { set_sense_type(chip, lun, SENSE_TYPE_MG_WRITE_ERR); } - TRACE_GOTO(chip, SetICVFinish); + rtsx_trace(chip); + goto SetICVFinish; } #ifdef MG_SET_ICV_SLOW @@ -4094,7 +4544,8 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip) SENSE_TYPE_MG_WRITE_ERR); } retval = STATUS_FAIL; - TRACE_GOTO(chip, SetICVFinish); + rtsx_trace(chip); + goto SetICVFinish; } } #else @@ -4112,7 +4563,8 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip) } else { set_sense_type(chip, lun, SENSE_TYPE_MG_WRITE_ERR); } - TRACE_GOTO(chip, SetICVFinish); + rtsx_trace(chip); + goto SetICVFinish; } #endif @@ -4152,13 +4604,17 @@ int ms_power_off_card3v3(struct rtsx_chip *chip) int retval; retval = disable_card_clock(chip, MS_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (chip->asic_code) { retval = ms_pull_ctl_disable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { RTSX_WRITE_REG(chip, FPGA_PULL_CTL, FPGA_MS_PULL_CTL_BIT | 0x20, FPGA_MS_PULL_CTL_BIT); @@ -4166,8 +4622,10 @@ int ms_power_off_card3v3(struct rtsx_chip *chip) RTSX_WRITE_REG(chip, CARD_OE, MS_OUTPUT_EN, 0); if (!chip->ft2_fast_mode) { retval = card_power_off(chip, MS_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -4195,8 +4653,10 @@ int release_ms_card(struct rtsx_chip *chip) #endif retval = ms_power_off_card3v3(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c index c482a6ac26ba..d64b6ed9c0c9 100644 --- a/drivers/staging/rts5208/rtsx.c +++ b/drivers/staging/rts5208/rtsx.c @@ -26,12 +26,6 @@ #include #include "rtsx.h" -#include "rtsx_chip.h" -#include "rtsx_transport.h" -#include "rtsx_scsi.h" -#include "rtsx_card.h" -#include "general.h" - #include "ms.h" #include "sd.h" #include "xd.h" diff --git a/drivers/staging/rts5208/rtsx.h b/drivers/staging/rts5208/rtsx.h index 9e6ecb7457b5..262441bcfc41 100644 --- a/drivers/staging/rts5208/rtsx.h +++ b/drivers/staging/rts5208/rtsx.h @@ -46,9 +46,6 @@ #include #include -#include "trace.h" -#include "general.h" - #define CR_DRIVER_NAME "rts5208" #define pci_get_bus_and_slot(bus, devfn) \ @@ -181,4 +178,14 @@ enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF}; int rtsx_read_pci_cfg_byte(u8 bus, u8 dev, u8 func, u8 offset, u8 *val); +#define _MSG_TRACE + +#include "trace.h" +#include "rtsx_chip.h" +#include "rtsx_transport.h" +#include "rtsx_scsi.h" +#include "rtsx_card.h" +#include "rtsx_sys.h" +#include "general.h" + #endif /* __REALTEK_RTSX_H */ diff --git a/drivers/staging/rts5208/rtsx_card.c b/drivers/staging/rts5208/rtsx_card.c index b4595ab3f02b..d7ca44f61447 100644 --- a/drivers/staging/rts5208/rtsx_card.c +++ b/drivers/staging/rts5208/rtsx_card.c @@ -27,13 +27,6 @@ #include #include "rtsx.h" -#include "rtsx_transport.h" -#include "rtsx_scsi.h" -#include "rtsx_card.h" - -#include "rtsx_sys.h" -#include "general.h" - #include "sd.h" #include "xd.h" #include "ms.h" @@ -657,8 +650,10 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk) dev_dbg(rtsx_dev(chip), "Switch SSC clock to %dMHz (cur_clk = %d)\n", clk, chip->cur_clk); - if ((clk <= 2) || (N > max_N)) - TRACE_RET(chip, STATUS_FAIL); + if ((clk <= 2) || (N > max_N)) { + rtsx_trace(chip); + return STATUS_FAIL; + } mcu_cnt = (u8)(125/clk + 3); if (mcu_cnt > 7) @@ -697,8 +692,10 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk) } retval = rtsx_send_cmd(chip, 0, WAIT_TIME); - if (retval < 0) - TRACE_RET(chip, STATUS_ERROR); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_ERROR; + } udelay(10); RTSX_WRITE_REG(chip, CLK_CTL, CLK_LOW_FREQ, 0); @@ -790,7 +787,8 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk) default: dev_dbg(rtsx_dev(chip), "Try to switch to an illegal clock (%d)\n", clk); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } RTSX_WRITE_REG(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ); @@ -893,8 +891,10 @@ int card_power_on(struct rtsx_chip *chip, u8 card) rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val1); retval = rtsx_send_cmd(chip, 0, 100); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } udelay(chip->pmos_pwr_on_interval); @@ -902,8 +902,10 @@ int card_power_on(struct rtsx_chip *chip, u8 card) rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val2); retval = rtsx_send_cmd(chip, 0, 100); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -932,8 +934,10 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, unsigned int lun = SCSI_LUN(srb); int i; - if (chip->rw_card[lun] == NULL) - TRACE_RET(chip, STATUS_FAIL); + if (chip->rw_card[lun] == NULL) { + rtsx_trace(chip); + return STATUS_FAIL; + } for (i = 0; i < 3; i++) { chip->rw_need_retry = 0; @@ -942,11 +946,14 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval != STATUS_SUCCESS) { if (rtsx_check_chip_exist(chip) != STATUS_SUCCESS) { rtsx_release_chip(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (detect_card_cd(chip, chip->cur_card) != - STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!chip->rw_need_retry) { dev_dbg(rtsx_dev(chip), "RW fail, but no need to retry\n"); @@ -975,8 +982,10 @@ int card_share_mode(struct rtsx_chip *chip, int card) value = CARD_SHARE_48_MS; else if (card == XD_CARD) value = CARD_SHARE_48_XD; - else - TRACE_RET(chip, STATUS_FAIL); + else { + rtsx_trace(chip); + return STATUS_FAIL; + } } else if (CHECK_PID(chip, 0x5288)) { mask = 0x03; @@ -986,11 +995,14 @@ int card_share_mode(struct rtsx_chip *chip, int card) value = CARD_SHARE_BAROSSA_MS; else if (card == XD_CARD) value = CARD_SHARE_BAROSSA_XD; - else - TRACE_RET(chip, STATUS_FAIL); + else { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } RTSX_WRITE_REG(chip, CARD_SHARE_MODE, mask, value); @@ -1014,15 +1026,19 @@ int select_card(struct rtsx_chip *chip, int card) mod = XD_MOD_SEL; else if (card == SPI_CARD) mod = SPI_MOD_SEL; - else - TRACE_RET(chip, STATUS_FAIL); + else { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, CARD_SELECT, 0x07, mod); chip->cur_card = card; retval = card_share_mode(chip, card); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1067,12 +1083,15 @@ int detect_card_cd(struct rtsx_chip *chip, int card) card_cd = XD_EXIST; } else { dev_dbg(rtsx_dev(chip), "Wrong card type: 0x%x\n", card); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } status = rtsx_readl(chip, RTSX_BIPR); - if (!(status & card_cd)) - TRACE_RET(chip, STATUS_FAIL); + if (!(status & card_cd)) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c index 35fa19d8b7a2..a8feee846dd3 100644 --- a/drivers/staging/rts5208/rtsx_chip.c +++ b/drivers/staging/rts5208/rtsx_chip.c @@ -27,13 +27,6 @@ #include #include "rtsx.h" -#include "rtsx_transport.h" -#include "rtsx_scsi.h" -#include "rtsx_card.h" -#include "rtsx_chip.h" -#include "rtsx_sys.h" -#include "general.h" - #include "sd.h" #include "xd.h" #include "ms.h" @@ -198,15 +191,19 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip) if (chip->asic_code) { retval = sd_pull_ctl_enable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { RTSX_WRITE_REG(chip, FPGA_PULL_CTL, FPGA_SD_PULL_CTL_BIT | 0x20, 0); } retval = card_share_mode(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } /* Enable sdio_bus_auto_switch */ if (CHECK_PID(chip, 0x5288)) @@ -237,8 +234,10 @@ static int rtsx_reset_aspm(struct rtsx_chip *chip) ret = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFF, chip->aspm_l0s_l1_en); - if (ret != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (ret != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -246,16 +245,20 @@ static int rtsx_reset_aspm(struct rtsx_chip *chip) if (CHECK_PID(chip, 0x5208)) RTSX_WRITE_REG(chip, ASPM_FORCE_CTL, 0xFF, 0x3F); ret = rtsx_write_config_byte(chip, LCTLR, chip->aspm_l0s_l1_en); - if (ret != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (ret != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } chip->aspm_level[0] = chip->aspm_l0s_l1_en; if (CHK_SDIO_EXIST(chip)) { chip->aspm_level[1] = chip->aspm_l0s_l1_en; ret = rtsx_write_cfg_dw(chip, CHECK_PID(chip, 0x5288) ? 2 : 1, 0xC0, 0xFF, chip->aspm_l0s_l1_en); - if (ret != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (ret != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } chip->aspm_enabled = 1; @@ -283,23 +286,31 @@ static int rtsx_enable_pcie_intr(struct rtsx_chip *chip) u16 reg; ret = rtsx_read_phy_register(chip, 0x00, ®); - if (ret != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (ret != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } reg &= 0xFE7F; reg |= 0x80; ret = rtsx_write_phy_register(chip, 0x00, reg); - if (ret != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (ret != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } ret = rtsx_read_phy_register(chip, 0x1C, ®); - if (ret != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (ret != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } reg &= 0xFFF7; ret = rtsx_write_phy_register(chip, 0x1C, reg); - if (ret != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (ret != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } if (chip->driver_first_load && (chip->ic_version < IC_VER_C)) @@ -371,41 +382,55 @@ int rtsx_reset_chip(struct rtsx_chip *chip) /* Enable ASPM */ if (chip->aspm_l0s_l1_en) { retval = rtsx_reset_aspm(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { if (chip->asic_code && CHECK_PID(chip, 0x5208)) { retval = rtsx_write_phy_register(chip, 0x07, 0x0129); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = rtsx_write_config_byte(chip, LCTLR, chip->aspm_l0s_l1_en); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = rtsx_write_config_byte(chip, 0x81, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_SDIO_EXIST(chip)) { retval = rtsx_write_cfg_dw(chip, CHECK_PID(chip, 0x5288) ? 2 : 1, 0xC0, 0xFF00, 0x0100); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } if (CHECK_PID(chip, 0x5288) && !CHK_SDIO_EXIST(chip)) { retval = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFFFF, 0x0103); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = rtsx_write_cfg_dw(chip, 2, 0x84, 0xFF, 0x03); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } RTSX_WRITE_REG(chip, IRQSTAT0, LINK_RDY_INT, LINK_RDY_INT); @@ -413,8 +438,10 @@ int rtsx_reset_chip(struct rtsx_chip *chip) RTSX_WRITE_REG(chip, PERST_GLITCH_WIDTH, 0xFF, 0x80); retval = rtsx_enable_pcie_intr(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } chip->need_reset = 0; @@ -436,8 +463,10 @@ int rtsx_reset_chip(struct rtsx_chip *chip) #else /* HW_AUTO_SWITCH_SD_BUS */ retval = rtsx_pre_handle_sdio_old(chip); #endif /* HW_AUTO_SWITCH_SD_BUS */ - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { chip->sd_io = 0; @@ -477,8 +506,10 @@ nextcard: if (chip->asic_code && CHECK_PID(chip, 0x5208)) { retval = rtsx_clr_phy_reg_bit(chip, 0x1C, 2); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } if (chip->ft2_fast_mode) { @@ -545,8 +576,10 @@ static int rts5208_init(struct rtsx_chip *chip) if (chip->asic_code) { retval = rtsx_read_phy_register(chip, 0x1C, ®); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } dev_dbg(rtsx_dev(chip), "Value of phy register 0x1C is 0x%x\n", reg); @@ -605,8 +638,10 @@ static int rts5288_init(struct rtsx_chip *chip) chip->hw_bypass_sd = val & 0x10 ? 1 : 0; retval = rtsx_read_cfg_dw(chip, 0, 0x718, &lval); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } max_func = (u8)((lval >> 29) & 0x07); dev_dbg(rtsx_dev(chip), "Max function number: %d\n", max_func); @@ -703,13 +738,17 @@ int rtsx_init_chip(struct rtsx_chip *chip) if (CHECK_PID(chip, 0x5208)) { retval = rts5208_init(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else if (CHECK_PID(chip, 0x5288)) { retval = rts5288_init(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } if (chip->ss_en == 2) @@ -756,8 +795,10 @@ int rtsx_init_chip(struct rtsx_chip *chip) } retval = rtsx_reset_chip(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1155,14 +1196,17 @@ int rtsx_write_register(struct rtsx_chip *chip, u16 addr, u8 mask, u8 data) for (i = 0; i < MAX_RW_REG_CNT; i++) { val = rtsx_readl(chip, RTSX_HAIMR); if ((val & (1 << 31)) == 0) { - if (data != (u8)val) - TRACE_RET(chip, STATUS_FAIL); + if (data != (u8)val) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } } - TRACE_RET(chip, STATUS_TIMEDOUT); + rtsx_trace(chip); + return STATUS_TIMEDOUT; } int rtsx_read_register(struct rtsx_chip *chip, u16 addr, u8 *data) @@ -1183,8 +1227,10 @@ int rtsx_read_register(struct rtsx_chip *chip, u16 addr, u8 *data) break; } - if (i >= MAX_RW_REG_CNT) - TRACE_RET(chip, STATUS_TIMEDOUT); + if (i >= MAX_RW_REG_CNT) { + rtsx_trace(chip); + return STATUS_TIMEDOUT; + } if (data) *data = (u8)(val & 0xFF); @@ -1261,8 +1307,10 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, int dw_len, i, j; int retval; - if (!buf) - TRACE_RET(chip, STATUS_NOMEM); + if (!buf) { + rtsx_trace(chip); + return STATUS_NOMEM; + } if ((len + offset) % 4) dw_len = (len + offset) / 4 + 1; @@ -1272,13 +1320,16 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, dev_dbg(rtsx_dev(chip), "dw_len = %d\n", dw_len); data = vzalloc(dw_len * 4); - if (!data) - TRACE_RET(chip, STATUS_NOMEM); + if (!data) { + rtsx_trace(chip); + return STATUS_NOMEM; + } mask = vzalloc(dw_len * 4); if (!mask) { vfree(data); - TRACE_RET(chip, STATUS_NOMEM); + rtsx_trace(chip); + return STATUS_NOMEM; } j = 0; @@ -1302,7 +1353,8 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, if (retval != STATUS_SUCCESS) { vfree(data); vfree(mask); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1329,15 +1381,18 @@ int rtsx_read_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, dev_dbg(rtsx_dev(chip), "dw_len = %d\n", dw_len); data = vmalloc(dw_len * 4); - if (!data) - TRACE_RET(chip, STATUS_NOMEM); + if (!data) { + rtsx_trace(chip); + return STATUS_NOMEM; + } for (i = 0; i < dw_len; i++) { retval = rtsx_read_cfg_dw(chip, func, aligned_addr + i * 4, data + i); if (retval != STATUS_SUCCESS) { vfree(data); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1377,8 +1432,10 @@ int rtsx_write_phy_register(struct rtsx_chip *chip, u8 addr, u16 val) } } - if (!finished) - TRACE_RET(chip, STATUS_FAIL); + if (!finished) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1401,8 +1458,10 @@ int rtsx_read_phy_register(struct rtsx_chip *chip, u8 addr, u16 *val) } } - if (!finished) - TRACE_RET(chip, STATUS_FAIL); + if (!finished) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_READ_REG(chip, PHYDATA0, &tmp); data = tmp; @@ -1429,8 +1488,10 @@ int rtsx_read_efuse(struct rtsx_chip *chip, u8 addr, u8 *val) udelay(1); } - if (data & 0x80) - TRACE_RET(chip, STATUS_TIMEDOUT); + if (data & 0x80) { + rtsx_trace(chip); + return STATUS_TIMEDOUT; + } RTSX_READ_REG(chip, EFUSE_DATA, &data); if (val) @@ -1461,8 +1522,10 @@ int rtsx_write_efuse(struct rtsx_chip *chip, u8 addr, u8 val) wait_timeout(3); } - if (data & 0x80) - TRACE_RET(chip, STATUS_TIMEDOUT); + if (data & 0x80) { + rtsx_trace(chip); + return STATUS_TIMEDOUT; + } wait_timeout(5); } @@ -1476,14 +1539,18 @@ int rtsx_clr_phy_reg_bit(struct rtsx_chip *chip, u8 reg, u8 bit) u16 value; retval = rtsx_read_phy_register(chip, reg, &value); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (value & (1 << bit)) { value &= ~(1 << bit); retval = rtsx_write_phy_register(chip, reg, value); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1495,14 +1562,18 @@ int rtsx_set_phy_reg_bit(struct rtsx_chip *chip, u8 reg, u8 bit) u16 value; retval = rtsx_read_phy_register(chip, reg, &value); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if ((value & (1 << bit)) == 0) { value |= (1 << bit); retval = rtsx_write_phy_register(chip, reg, value); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1818,8 +1889,10 @@ int rtsx_read_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len) u16 reg_addr; u8 *ptr; - if (!buf) - TRACE_RET(chip, STATUS_ERROR); + if (!buf) { + rtsx_trace(chip); + return STATUS_ERROR; + } ptr = buf; reg_addr = PPBUF_BASE2; @@ -1830,8 +1903,10 @@ int rtsx_read_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len) rtsx_add_cmd(chip, READ_REG_CMD, reg_addr++, 0, 0); retval = rtsx_send_cmd(chip, 0, 250); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } memcpy(ptr, rtsx_get_cmd_data(chip), 256); ptr += 256; @@ -1844,8 +1919,10 @@ int rtsx_read_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len) rtsx_add_cmd(chip, READ_REG_CMD, reg_addr++, 0, 0); retval = rtsx_send_cmd(chip, 0, 250); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } } memcpy(ptr, rtsx_get_cmd_data(chip), buf_len%256); @@ -1860,8 +1937,10 @@ int rtsx_write_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len) u16 reg_addr; u8 *ptr; - if (!buf) - TRACE_RET(chip, STATUS_ERROR); + if (!buf) { + rtsx_trace(chip); + return STATUS_ERROR; + } ptr = buf; reg_addr = PPBUF_BASE2; @@ -1875,8 +1954,10 @@ int rtsx_write_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len) } retval = rtsx_send_cmd(chip, 0, 250); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } } if (buf_len%256) { @@ -1889,8 +1970,10 @@ int rtsx_write_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len) } retval = rtsx_send_cmd(chip, 0, 250); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1898,8 +1981,10 @@ int rtsx_write_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len) int rtsx_check_chip_exist(struct rtsx_chip *chip) { - if (rtsx_readl(chip, 0) == 0xFFFFFFFF) - TRACE_RET(chip, STATUS_FAIL); + if (rtsx_readl(chip, 0) == 0xFFFFFFFF) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1922,8 +2007,10 @@ int rtsx_force_power_on(struct rtsx_chip *chip, u8 ctl) if (mask) { retval = rtsx_write_register(chip, FPDCTL, mask, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHECK_PID(chip, 0x5288)) wait_timeout(200); @@ -1951,8 +2038,10 @@ int rtsx_force_power_down(struct rtsx_chip *chip, u8 ctl) if (mask) { val = mask; retval = rtsx_write_register(chip, FPDCTL, mask, val); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; diff --git a/drivers/staging/rts5208/rtsx_chip.h b/drivers/staging/rts5208/rtsx_chip.h index feac98661cec..93fd7b286f49 100644 --- a/drivers/staging/rts5208/rtsx_chip.h +++ b/drivers/staging/rts5208/rtsx_chip.h @@ -989,19 +989,21 @@ int rtsx_write_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len); int rtsx_check_chip_exist(struct rtsx_chip *chip); #define RTSX_WRITE_REG(chip, addr, mask, data) \ - do { \ - int retval = rtsx_write_register((chip), (addr), (mask), (data)); \ - if (retval != STATUS_SUCCESS) { \ - TRACE_RET((chip), retval); \ - } \ - } while (0) +do { \ + int retval = rtsx_write_register(chip, addr, mask, data); \ + if (retval != STATUS_SUCCESS) { \ + rtsx_trace(chip); \ + return retval; \ + } \ +} while (0) #define RTSX_READ_REG(chip, addr, data) \ - do { \ - int retval = rtsx_read_register((chip), (addr), (data)); \ - if (retval != STATUS_SUCCESS) { \ - TRACE_RET((chip), retval); \ - } \ - } while (0) +do { \ + int retval = rtsx_read_register(chip, addr, data); \ + if (retval != STATUS_SUCCESS) { \ + rtsx_trace(chip); \ + return retval; \ + } \ +} while (0) #endif /* __REALTEK_RTSX_CHIP_H */ diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c index 98f102b78e6d..8a5d6a8e780f 100644 --- a/drivers/staging/rts5208/rtsx_scsi.c +++ b/drivers/staging/rts5208/rtsx_scsi.c @@ -26,11 +26,6 @@ #include #include "rtsx.h" -#include "rtsx_transport.h" -#include "rtsx_sys.h" -#include "rtsx_card.h" -#include "rtsx_chip.h" -#include "rtsx_scsi.h" #include "sd.h" #include "ms.h" #include "spi.h" @@ -512,8 +507,10 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip *chip) } buf = vmalloc(scsi_bufflen(srb)); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } #ifdef SUPPORT_MAGIC_GATE if ((chip->mspro_formatter_enable) && @@ -587,12 +584,14 @@ static int start_stop_unit(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (check_card_ready(chip, lun)) return TRANSPORT_GOOD; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; break; } - TRACE_RET(chip, TRANSPORT_ERROR); + rtsx_trace(chip); + return TRANSPORT_ERROR; } @@ -607,7 +606,8 @@ static int allow_medium_removal(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (prevent) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } return TRANSPORT_GOOD; @@ -644,8 +644,10 @@ static int request_sense(struct scsi_cmnd *srb, struct rtsx_chip *chip) } buf = vmalloc(scsi_bufflen(srb)); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } tmp = (unsigned char *)sense; memcpy(buf, tmp, scsi_bufflen(srb)); @@ -765,7 +767,8 @@ static int mode_sense(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); scsi_set_resid(srb, scsi_bufflen(srb)); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } #endif @@ -789,8 +792,10 @@ static int mode_sense(struct scsi_cmnd *srb, struct rtsx_chip *chip) #endif buf = kmalloc(dataSize, GFP_KERNEL); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } pageCode = srb->cmnd[2] & 0x3f; @@ -869,7 +874,8 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun) || (get_card_size(chip, lun) == 0)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (!(CHK_BIT(chip->lun_mc, lun))) { @@ -885,7 +891,8 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip) */ dev_dbg(rtsx_dev(chip), "SD card being erased!\n"); set_sense_type(chip, lun, SENSE_TYPE_MEDIA_READ_FORBIDDEN); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (get_lun_card(chip, lun) == SD_CARD) { @@ -893,7 +900,8 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip) dev_dbg(rtsx_dev(chip), "SD card locked!\n"); set_sense_type(chip, lun, SENSE_TYPE_MEDIA_READ_FORBIDDEN); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } #endif @@ -916,7 +924,8 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip) sec_cnt = ((u16)(srb->cmnd[9]) << 8) | srb->cmnd[10]; } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } /* In some test, we will receive a start_sec like 0xFFFFFFFF. @@ -926,7 +935,8 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip) if ((start_sec > get_card_size(chip, lun)) || ((start_sec + sec_cnt) > get_card_size(chip, lun))) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LBA_OVER_RANGE); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (sec_cnt == 0) { @@ -942,7 +952,8 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip) else set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (srb->sc_data_direction == DMA_TO_DEVICE) { @@ -950,7 +961,8 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip) dev_dbg(rtsx_dev(chip), "Write protected card!\n"); set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_PROTECT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } @@ -969,7 +981,8 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip) SENSE_TYPE_MEDIA_WRITE_ERR); } retval = TRANSPORT_FAILED; - TRACE_GOTO(chip, Exit); + rtsx_trace(chip); + goto Exit; } else { chip->rw_fail_cnt[lun] = 0; retval = TRANSPORT_GOOD; @@ -994,15 +1007,18 @@ static int read_format_capacity(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun)) { if (!chip->mspro_formatter_enable) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } buf_len = (scsi_bufflen(srb) > 12) ? 0x14 : 12; buf = kmalloc(buf_len, GFP_KERNEL); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } buf[i++] = 0; buf[i++] = 0; @@ -1067,7 +1083,8 @@ static int read_capacity(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (!(CHK_BIT(chip->lun_mc, lun))) { @@ -1077,8 +1094,10 @@ static int read_capacity(struct scsi_cmnd *srb, struct rtsx_chip *chip) } buf = kmalloc(8, GFP_KERNEL); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } card_size = get_card_size(chip, lun); buf[0] = (unsigned char)((card_size - 1) >> 24); @@ -1116,15 +1135,18 @@ static int read_eeprom(struct scsi_cmnd *srb, struct rtsx_chip *chip) len = ((u16)srb->cmnd[4] << 8) | srb->cmnd[5]; buf = vmalloc(len); - if (!buf) - TRACE_RET(chip, TRANSPORT_ERROR); + if (!buf) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } retval = rtsx_force_power_on(chip, SSC_PDCTL); if (retval != STATUS_SUCCESS) { vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } for (i = 0; i < len; i++) { @@ -1133,7 +1155,8 @@ static int read_eeprom(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } @@ -1165,7 +1188,8 @@ static int write_eeprom(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = rtsx_force_power_on(chip, SSC_PDCTL); if (retval != STATUS_SUCCESS) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (len == 511) { @@ -1173,14 +1197,17 @@ static int write_eeprom(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } else { len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len); buf = vmalloc(len); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } rtsx_stor_get_xfer_buf(buf, len, srb); scsi_set_resid(srb, scsi_bufflen(srb) - len); @@ -1191,7 +1218,8 @@ static int write_eeprom(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } @@ -1221,18 +1249,22 @@ static int read_mem(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (addr < 0xFC00) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } buf = vmalloc(len); - if (!buf) - TRACE_RET(chip, TRANSPORT_ERROR); + if (!buf) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } retval = rtsx_force_power_on(chip, SSC_PDCTL); if (retval != STATUS_SUCCESS) { vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } for (i = 0; i < len; i++) { @@ -1241,7 +1273,8 @@ static int read_mem(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } @@ -1274,13 +1307,16 @@ static int write_mem(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (addr < 0xFC00) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len); buf = vmalloc(len); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } rtsx_stor_get_xfer_buf(buf, len, srb); scsi_set_resid(srb, scsi_bufflen(srb) - len); @@ -1289,7 +1325,8 @@ static int write_mem(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } for (i = 0; i < len; i++) { @@ -1298,7 +1335,8 @@ static int write_mem(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } @@ -1314,12 +1352,14 @@ static int get_sd_csd(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (get_lun_card(chip, lun) != SD_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } scsi_set_resid(srb, 0); @@ -1361,14 +1401,17 @@ static int trace_msg_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip) if ((scsi_bufflen(srb) < buf_len) || (scsi_sglist(srb) == NULL)) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } clear = srb->cmnd[2]; buf = vmalloc(scsi_bufflen(srb)); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } ptr = buf; if (chip->trace_msg[chip->msg_idx].valid) @@ -1500,7 +1543,8 @@ static int set_variable(struct scsi_cmnd *srb, struct rtsx_chip *chip) default: set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } else if (srb->cmnd[3] == 2) { if (srb->cmnd[4]) { @@ -1523,14 +1567,16 @@ static int set_variable(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } turn_off_led(chip, LED_GPIO); } } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } return TRANSPORT_GOOD; @@ -1562,7 +1608,8 @@ static int get_variable(struct scsi_cmnd *srb, struct rtsx_chip *chip) default: set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } rtsx_stor_set_xfer_buf(&tmp, 1, srb); @@ -1572,7 +1619,8 @@ static int get_variable(struct scsi_cmnd *srb, struct rtsx_chip *chip) rtsx_stor_set_xfer_buf(&tmp, 1, srb); } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } return TRANSPORT_GOOD; @@ -1610,7 +1658,8 @@ static int dma_access_ring_buffer(struct scsi_cmnd *srb, struct rtsx_chip *chip) set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } scsi_set_resid(srb, 0); @@ -1757,7 +1806,8 @@ static int set_chip_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!CHECK_PID(chip, 0x5208)) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } phy_debug_mode = (int)(srb->cmnd[3]); @@ -1765,35 +1815,47 @@ static int set_chip_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (phy_debug_mode) { chip->phy_debug_mode = 1; retval = rtsx_write_register(chip, CDRESUMECTL, 0x77, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } rtsx_disable_bus_int(chip); retval = rtsx_read_phy_register(chip, 0x1C, ®); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } reg |= 0x0001; retval = rtsx_write_phy_register(chip, 0x1C, reg); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else { chip->phy_debug_mode = 0; retval = rtsx_write_register(chip, CDRESUMECTL, 0x77, 0x77); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } rtsx_enable_bus_int(chip); retval = rtsx_read_phy_register(chip, 0x1C, ®); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } reg &= 0xFFFE; retval = rtsx_write_phy_register(chip, 0x1C, reg); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } return TRANSPORT_GOOD; @@ -1824,7 +1886,8 @@ static int rw_mem_cmd_buf(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (cmd_type > 2) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } addr = (srb->cmnd[5] << 8) | srb->cmnd[6]; mask = srb->cmnd[7]; @@ -1842,7 +1905,8 @@ static int rw_mem_cmd_buf(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (scsi_bufflen(srb) < 1) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } rtsx_stor_set_xfer_buf(&value, 1, srb); scsi_set_resid(srb, 0); @@ -1850,12 +1914,14 @@ static int rw_mem_cmd_buf(struct scsi_cmnd *srb, struct rtsx_chip *chip) default: set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } return TRANSPORT_GOOD; @@ -1902,15 +1968,18 @@ static int read_phy_register(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (len) { buf = vmalloc(len); - if (!buf) - TRACE_RET(chip, TRANSPORT_ERROR); + if (!buf) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } retval = rtsx_force_power_on(chip, SSC_PDCTL); if (retval != STATUS_SUCCESS) { vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } for (i = 0; i < len / 2; i++) { @@ -1919,7 +1988,8 @@ static int read_phy_register(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } buf[2*i] = (u8)(val >> 8); @@ -1963,8 +2033,10 @@ static int write_phy_register(struct scsi_cmnd *srb, struct rtsx_chip *chip) len); buf = vmalloc(len); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } rtsx_stor_get_xfer_buf(buf, len, srb); scsi_set_resid(srb, scsi_bufflen(srb) - len); @@ -1974,7 +2046,8 @@ static int write_phy_register(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } for (i = 0; i < len / 2; i++) { @@ -1984,7 +2057,8 @@ static int write_phy_register(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } @@ -2011,7 +2085,8 @@ static int erase_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = rtsx_force_power_on(chip, SSC_PDCTL); if (retval != STATUS_SUCCESS) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } mode = srb->cmnd[3]; @@ -2022,19 +2097,22 @@ static int erase_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } else if (mode == 1) { retval = spi_erase_eeprom_byte(chip, addr); if (retval != STATUS_SUCCESS) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } else { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } return TRANSPORT_GOOD; @@ -2058,15 +2136,18 @@ static int read_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip) len = ((u16)srb->cmnd[6] << 8) | srb->cmnd[7]; buf = vmalloc(len); - if (!buf) - TRACE_RET(chip, TRANSPORT_ERROR); + if (!buf) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } retval = rtsx_force_power_on(chip, SSC_PDCTL); if (retval != STATUS_SUCCESS) { vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } for (i = 0; i < len; i++) { @@ -2075,7 +2156,8 @@ static int read_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } @@ -2107,8 +2189,10 @@ static int write_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip) len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len); buf = vmalloc(len); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } rtsx_stor_get_xfer_buf(buf, len, srb); scsi_set_resid(srb, scsi_bufflen(srb) - len); @@ -2117,7 +2201,8 @@ static int write_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } for (i = 0; i < len; i++) { @@ -2126,7 +2211,8 @@ static int write_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } @@ -2153,15 +2239,18 @@ static int read_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip) len = srb->cmnd[5]; buf = vmalloc(len); - if (!buf) - TRACE_RET(chip, TRANSPORT_ERROR); + if (!buf) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } retval = rtsx_force_power_on(chip, SSC_PDCTL); if (retval != STATUS_SUCCESS) { vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } for (i = 0; i < len; i++) { @@ -2170,7 +2259,8 @@ static int read_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip) vfree(buf); set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } @@ -2203,8 +2293,10 @@ static int write_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip) len = (u8)min_t(unsigned int, scsi_bufflen(srb), len); buf = vmalloc(len); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } rtsx_stor_get_xfer_buf(buf, len, srb); scsi_set_resid(srb, scsi_bufflen(srb) - len); @@ -2212,21 +2304,24 @@ static int write_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = rtsx_force_power_on(chip, SSC_PDCTL); if (retval != STATUS_SUCCESS) { vfree(buf); - TRACE_RET(chip, TRANSPORT_ERROR); + rtsx_trace(chip); + return TRANSPORT_ERROR; } if (chip->asic_code) { retval = rtsx_read_phy_register(chip, 0x08, &val); if (retval != STATUS_SUCCESS) { vfree(buf); - TRACE_RET(chip, TRANSPORT_ERROR); + rtsx_trace(chip); + return TRANSPORT_ERROR; } retval = rtsx_write_register(chip, PWR_GATE_CTRL, LDO3318_PWR_MASK, LDO_OFF); if (retval != STATUS_SUCCESS) { vfree(buf); - TRACE_RET(chip, TRANSPORT_ERROR); + rtsx_trace(chip); + return TRANSPORT_ERROR; } wait_timeout(600); @@ -2235,14 +2330,16 @@ static int write_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip) 0x4C00 | chip->phy_voltage); if (retval != STATUS_SUCCESS) { vfree(buf); - TRACE_RET(chip, TRANSPORT_ERROR); + rtsx_trace(chip); + return TRANSPORT_ERROR; } retval = rtsx_write_register(chip, PWR_GATE_CTRL, LDO3318_PWR_MASK, LDO_ON); if (retval != STATUS_SUCCESS) { vfree(buf); - TRACE_RET(chip, TRANSPORT_ERROR); + rtsx_trace(chip); + return TRANSPORT_ERROR; } wait_timeout(600); @@ -2251,7 +2348,8 @@ static int write_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = card_power_on(chip, SPI_CARD); if (retval != STATUS_SUCCESS) { vfree(buf); - TRACE_RET(chip, TRANSPORT_ERROR); + rtsx_trace(chip); + return TRANSPORT_ERROR; } wait_timeout(50); @@ -2262,7 +2360,8 @@ static int write_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip) set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); result = TRANSPORT_FAILED; - TRACE_GOTO(chip, Exit); + rtsx_trace(chip); + goto Exit; } } @@ -2270,25 +2369,33 @@ Exit: vfree(buf); retval = card_power_off(chip, SPI_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_ERROR); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } if (chip->asic_code) { retval = rtsx_write_register(chip, PWR_GATE_CTRL, LDO3318_PWR_MASK, LDO_OFF); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_ERROR); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } wait_timeout(600); retval = rtsx_write_phy_register(chip, 0x08, val); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_ERROR); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } retval = rtsx_write_register(chip, PWR_GATE_CTRL, LDO3318_PWR_MASK, LDO_ON); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_ERROR); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } } return result; @@ -2325,19 +2432,23 @@ static int read_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (func > func_max) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } buf = vmalloc(len); - if (!buf) - TRACE_RET(chip, TRANSPORT_ERROR); + if (!buf) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } retval = rtsx_read_cfg_seq(chip, func, addr, buf, len); if (retval != STATUS_SUCCESS) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); vfree(buf); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } len = (u16)min_t(unsigned int, scsi_bufflen(srb), len); @@ -2380,13 +2491,16 @@ static int write_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (func > func_max) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len); buf = vmalloc(len); - if (!buf) - TRACE_RET(chip, TRANSPORT_ERROR); + if (!buf) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } rtsx_stor_get_xfer_buf(buf, len, srb); scsi_set_resid(srb, scsi_bufflen(srb) - len); @@ -2395,7 +2509,8 @@ static int write_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_WRITE_ERR); vfree(buf); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } vfree(buf); @@ -2485,7 +2600,8 @@ static int app_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip) default: set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } return result; @@ -2628,7 +2744,8 @@ static int get_card_bus_width(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } card = get_lun_card(chip, lun); @@ -2636,7 +2753,8 @@ static int get_card_bus_width(struct scsi_cmnd *srb, struct rtsx_chip *chip) bus_width = chip->card_bus_width[lun]; } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } scsi_set_resid(srb, 0); @@ -2653,7 +2771,8 @@ static int spi_vendor_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (CHECK_PID(chip, 0x5208) || CHECK_PID(chip, 0x5288)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } rtsx_disable_aspm(chip); @@ -2702,13 +2821,16 @@ static int spi_vendor_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip) rtsx_write_register(chip, CARD_GPIO_DIR, 0x07, gpio_dir); set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } rtsx_write_register(chip, CARD_GPIO_DIR, 0x07, gpio_dir); - if (result != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (result != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } return TRANSPORT_GOOD; } @@ -2767,7 +2889,8 @@ static int vendor_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip) default: set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } return result; @@ -2804,14 +2927,16 @@ static int ms_format_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (get_lun_card(chip, lun) != MS_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if ((srb->cmnd[3] != 0x4D) || (srb->cmnd[4] != 0x47) || (srb->cmnd[5] != 0x66) || (srb->cmnd[6] != 0x6D) || (srb->cmnd[7] != 0x74)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } rtsx_disable_aspm(chip); @@ -2823,7 +2948,8 @@ static int ms_format_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun) || (get_card_size(chip, lun) == 0)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } rtsx_set_stat(chip, RTSX_STAT_RUN); @@ -2835,23 +2961,27 @@ static int ms_format_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!(chip->card_ready & MS_CARD)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (chip->card_wp & MS_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_PROTECT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (!CHK_MSPRO(ms_card)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } retval = mspro_format(srb, chip, MS_SHORT_DATA_LEN, quick_format); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_FORMAT_CMD_FAILED); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } scsi_set_resid(srb, 0); @@ -2870,18 +3000,21 @@ static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (get_lun_card(chip, lun) != MS_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if ((srb->cmnd[2] != 0xB0) || (srb->cmnd[4] != 0x4D) || (srb->cmnd[5] != 0x53) || (srb->cmnd[6] != 0x49) || (srb->cmnd[7] != 0x44)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } dev_info_id = srb->cmnd[3]; @@ -2889,7 +3022,8 @@ static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip) (!CHK_MSXC(ms_card) && (dev_info_id == 0x13)) || !CHK_MSPRO(ms_card)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (dev_info_id == 0x15) @@ -2898,8 +3032,10 @@ static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip) buf_len = data_len = 0x6A; buf = kmalloc(buf_len, GFP_KERNEL); - if (!buf) - TRACE_RET(chip, TRANSPORT_ERROR); + if (!buf) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } i = 0; /* GET Memory Stick Media Information Response Header */ @@ -2986,11 +3122,13 @@ static int sd_extention_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (get_lun_card(chip, lun) != SD_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } switch (srb->cmnd[0]) { @@ -3020,7 +3158,8 @@ static int sd_extention_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip) default: set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } return result; @@ -3047,21 +3186,25 @@ static int mg_report_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (get_lun_card(chip, lun) != MS_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (srb->cmnd[7] != KC_MG_R_PRO) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (!CHK_MSPRO(ms_card)) { set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } key_format = srb->cmnd[10] & 0x3F; @@ -3073,13 +3216,16 @@ static int mg_report_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) (srb->cmnd[8] == 0x04) && (srb->cmnd[9] == 0x1C)) { retval = mg_get_local_EKB(srb, chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } break; @@ -3088,13 +3234,16 @@ static int mg_report_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) (srb->cmnd[8] == 0x00) && (srb->cmnd[9] == 0x24)) { retval = mg_get_rsp_chg(srb, chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } break; @@ -3108,19 +3257,23 @@ static int mg_report_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) (srb->cmnd[4] == 0x00) && (srb->cmnd[5] < 32)) { retval = mg_get_ICV(srb, chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } break; default: set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } scsi_set_resid(srb, 0); @@ -3146,25 +3299,30 @@ static int mg_send_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (check_card_wp(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_PROTECT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (get_lun_card(chip, lun) != MS_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (srb->cmnd[7] != KC_MG_R_PRO) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (!CHK_MSPRO(ms_card)) { set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } key_format = srb->cmnd[10] & 0x3F; @@ -3176,13 +3334,16 @@ static int mg_send_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) (srb->cmnd[8] == 0x00) && (srb->cmnd[9] == 0x0C)) { retval = mg_set_leaf_id(srb, chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } break; @@ -3191,13 +3352,16 @@ static int mg_send_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) (srb->cmnd[8] == 0x00) && (srb->cmnd[9] == 0x0C)) { retval = mg_chg(srb, chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } break; @@ -3206,13 +3370,16 @@ static int mg_send_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) (srb->cmnd[8] == 0x00) && (srb->cmnd[9] == 0x0C)) { retval = mg_rsp(srb, chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } break; @@ -3226,19 +3393,23 @@ static int mg_send_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) (srb->cmnd[4] == 0x00) && (srb->cmnd[5] < 32)) { retval = mg_set_ICV(srb, chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } break; default: set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } scsi_set_resid(srb, 0); @@ -3267,7 +3438,8 @@ int rtsx_scsi_handler(struct scsi_cmnd *srb, struct rtsx_chip *chip) /* Logical Unit Not Ready Format in Progress */ set_sense_data(chip, lun, CUR_ERR, 0x02, 0, 0x04, 0x04, 0, 0); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } #endif @@ -3279,7 +3451,8 @@ int rtsx_scsi_handler(struct scsi_cmnd *srb, struct rtsx_chip *chip) /* Logical Unit Not Ready Format in Progress */ set_sense_data(chip, lun, CUR_ERR, 0x02, 0, 0x04, 0x04, 0, (u16)(ms_card->progress)); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } } diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index 03caa9b3771f..f27491e802ed 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -25,10 +25,6 @@ #include #include "rtsx.h" -#include "rtsx_scsi.h" -#include "rtsx_transport.h" -#include "rtsx_chip.h" -#include "rtsx_card.h" /*********************************************************************** * Scatter-gather transfer buffer access routines @@ -276,7 +272,8 @@ int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout) dev_dbg(rtsx_dev(chip), "chip->int_reg = 0x%x\n", chip->int_reg); err = -ETIMEDOUT; - TRACE_GOTO(chip, finish_send_cmd); + rtsx_trace(chip); + goto finish_send_cmd; } spin_lock_irq(&rtsx->reg_lock); diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index a03cbe93722a..0eee67642e45 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -25,9 +25,6 @@ #include #include "rtsx.h" -#include "rtsx_transport.h" -#include "rtsx_scsi.h" -#include "rtsx_card.h" #include "sd.h" #define SD_MAX_RETRY_COUNT 3 @@ -114,7 +111,8 @@ static int sd_check_data0_status(struct rtsx_chip *chip) if (!(stat & SD_DAT0_STATUS)) { sd_set_err_code(chip, SD_BUSY); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -187,7 +185,8 @@ RTY_SEND_CMD: retval = sd_check_data0_status(chip); if (retval != STATUS_SUCCESS) { rtsx_clear_sd_error(chip); - TRACE_RET(chip, retval); + rtsx_trace(chip); + return retval; } } else { sd_set_err_code(chip, SD_TO_ERR); @@ -198,7 +197,8 @@ RTY_SEND_CMD: } rtsx_clear_sd_error(chip); - TRACE_RET(chip, retval); + rtsx_trace(chip); + return retval; } if (rsp_type == SD_RSP_TYPE_R0) @@ -208,14 +208,16 @@ RTY_SEND_CMD: if ((ptr[0] & 0xC0) != 0) { sd_set_err_code(chip, SD_STS_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (!(rsp_type & SD_NO_CHECK_CRC7)) { if (ptr[stat_idx] & SD_CRC7_ERR) { if (cmd_idx == WRITE_MULTIPLE_BLOCK) { sd_set_err_code(chip, SD_CRC_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (rty_cnt < SD_MAX_RETRY_COUNT) { wait_timeout(20); @@ -223,7 +225,8 @@ RTY_SEND_CMD: goto RTY_SEND_CMD; } else { sd_set_err_code(chip, SD_CRC_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } } @@ -232,8 +235,10 @@ RTY_SEND_CMD: if ((cmd_idx != SEND_RELATIVE_ADDR) && (cmd_idx != SEND_IF_COND)) { if (cmd_idx != STOP_TRANSMISSION) { - if (ptr[1] & 0x80) - TRACE_RET(chip, STATUS_FAIL); + if (ptr[1] & 0x80) { + rtsx_trace(chip); + return STATUS_FAIL; + } } #ifdef SUPPORT_SD_LOCK if (ptr[1] & 0x7D) @@ -243,17 +248,20 @@ RTY_SEND_CMD: { dev_dbg(rtsx_dev(chip), "ptr[1]: 0x%02x\n", ptr[1]); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (ptr[2] & 0xFF) { dev_dbg(rtsx_dev(chip), "ptr[2]: 0x%02x\n", ptr[2]); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (ptr[3] & 0x80) { dev_dbg(rtsx_dev(chip), "ptr[3]: 0x%02x\n", ptr[3]); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (ptr[3] & 0x01) sd_card->sd_data_buf_ready = 1; @@ -282,8 +290,10 @@ static int sd_read_data(struct rtsx_chip *chip, if (!buf) buf_len = 0; - if (buf_len > 512) - TRACE_RET(chip, STATUS_FAIL); + if (buf_len > 512) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -323,13 +333,16 @@ static int sd_read_data(struct rtsx_chip *chip, SD_RSP_TYPE_R1, NULL, 0); } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (buf && buf_len) { retval = rtsx_read_ppbuf(chip, buf, buf_len); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -350,13 +363,16 @@ static int sd_write_data(struct rtsx_chip *chip, u8 trans_mode, if (buf_len > 512) { /* This function can't write data more than one page */ - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (buf && buf_len) { retval = rtsx_write_ppbuf(chip, buf, buf_len); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } rtsx_init_cmd(chip); @@ -395,7 +411,8 @@ static int sd_write_data(struct rtsx_chip *chip, u8 trans_mode, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -412,7 +429,8 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp) for (i = 0; i < 6; i++) { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { sd_set_err_code(chip, SD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sd_send_cmd_get_rsp(chip, SEND_CSD, sd_card->sd_addr, @@ -421,8 +439,10 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp) break; } - if (i == 6) - TRACE_RET(chip, STATUS_FAIL); + if (i == 6) { + rtsx_trace(chip); + return STATUS_FAIL; + } memcpy(sd_card->raw_csd, rsp + 1, 15); @@ -464,10 +484,12 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp) else sd_card->sd_clock = CLK_20; } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (CHK_MMC_SECTOR_MODE(sd_card)) { @@ -606,14 +628,18 @@ static int sd_set_init_para(struct rtsx_chip *chip) int retval; retval = sd_set_sample_push_timing(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } sd_choose_proper_clock(chip); retval = switch_clock(chip, sd_card->sd_clock); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -636,8 +662,10 @@ int sd_select_card(struct rtsx_chip *chip, int select) } retval = sd_send_cmd_get_rsp(chip, cmd_idx, addr, cmd_type, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -651,8 +679,10 @@ static int sd_update_lock_status(struct rtsx_chip *chip) retval = sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr, SD_RSP_TYPE_R1, rsp, 5); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (rsp[1] & 0x02) sd_card->sd_lock_status |= SD_LOCKED; @@ -662,8 +692,10 @@ static int sd_update_lock_status(struct rtsx_chip *chip) dev_dbg(rtsx_dev(chip), "sd_card->sd_lock_status = 0x%x\n", sd_card->sd_lock_status); - if (rsp[1] & 0x01) - TRACE_RET(chip, STATUS_FAIL); + if (rsp[1] & 0x01) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -680,15 +712,18 @@ static int sd_wait_state_data_ready(struct rtsx_chip *chip, u8 state, retval = sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr, SD_RSP_TYPE_R1, rsp, 5); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (((rsp[3] & 0x1E) == state) && ((rsp[3] & 0x01) == data_ready)) return STATUS_SUCCESS; } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } static int sd_change_bank_voltage(struct rtsx_chip *chip, u8 voltage) @@ -700,8 +735,10 @@ static int sd_change_bank_voltage(struct rtsx_chip *chip, u8 voltage) retval = rtsx_write_phy_register(chip, 0x08, 0x4FC0 | chip->phy_voltage); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { RTSX_WRITE_REG(chip, SD_PAD_CTL, SD_IO_USING_1V8, 0); } @@ -710,14 +747,17 @@ static int sd_change_bank_voltage(struct rtsx_chip *chip, u8 voltage) retval = rtsx_write_phy_register(chip, 0x08, 0x4C40 | chip->phy_voltage); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { RTSX_WRITE_REG(chip, SD_PAD_CTL, SD_IO_USING_1V8, SD_IO_USING_1V8); } } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -733,21 +773,26 @@ static int sd_voltage_switch(struct rtsx_chip *chip) retval = sd_send_cmd_get_rsp(chip, VOLTAGE_SWITCH, 0, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } udelay(chip->sd_voltage_switch_delay); RTSX_READ_REG(chip, SD_BUS_STAT, &stat); if (stat & (SD_CMD_STATUS | SD_DAT3_STATUS | SD_DAT2_STATUS | SD_DAT1_STATUS | SD_DAT0_STATUS)) { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } RTSX_WRITE_REG(chip, SD_BUS_STAT, 0xFF, SD_CLK_FORCE_STOP); retval = sd_change_bank_voltage(chip, SD_IO_1V8); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } wait_timeout(50); @@ -763,7 +808,8 @@ static int sd_voltage_switch(struct rtsx_chip *chip) rtsx_write_register(chip, SD_BUS_STAT, SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, 0); rtsx_write_register(chip, CARD_CLK_EN, 0xFF, 0); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } RTSX_WRITE_REG(chip, SD_BUS_STAT, SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, @@ -839,15 +885,21 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) rtsx_add_cmd(chip, CHECK_REG_CMD, SD_DCMPS_CTL, DCMPS_CHANGE_DONE, DCMPS_CHANGE_DONE); retval = rtsx_send_cmd(chip, SD_CARD, 100); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, Fail); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto Fail; + } val = *rtsx_get_cmd_data(chip); - if (val & DCMPS_ERROR) - TRACE_GOTO(chip, Fail); + if (val & DCMPS_ERROR) { + rtsx_trace(chip); + goto Fail; + } - if ((val & DCMPS_CURRENT_PHASE) != sample_point) - TRACE_GOTO(chip, Fail); + if ((val & DCMPS_CURRENT_PHASE) != sample_point) { + rtsx_trace(chip); + goto Fail; + } RTSX_WRITE_REG(chip, SD_DCMPS_CTL, DCMPS_CHANGE, 0); if (ddr_rx) @@ -883,8 +935,10 @@ static int sd_check_spec(struct rtsx_chip *chip, u8 bus_width) retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } cmd[0] = 0x40 | SEND_SCR; cmd[1] = 0; @@ -896,13 +950,16 @@ static int sd_check_spec(struct rtsx_chip *chip, u8 bus_width) buf, 8, 250); if (retval != STATUS_SUCCESS) { rtsx_clear_sd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } memcpy(sd_card->raw_scr, buf, 8); - if ((buf[0] & 0x0F) == 0) - TRACE_RET(chip, STATUS_FAIL); + if ((buf[0] & 0x0F) == 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -944,7 +1001,8 @@ static int sd_query_switch_result(struct rtsx_chip *chip, u8 func_group, break; default: - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else if (func_group == SD_FUNC_GROUP_3) { support_offset = FUNCTION_GROUP3_SUPPORT_OFFSET; @@ -971,7 +1029,8 @@ static int sd_query_switch_result(struct rtsx_chip *chip, u8 func_group, break; default: - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else if (func_group == SD_FUNC_GROUP_4) { support_offset = FUNCTION_GROUP4_SUPPORT_OFFSET; @@ -998,23 +1057,27 @@ static int sd_query_switch_result(struct rtsx_chip *chip, u8 func_group, break; default: - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (func_group == SD_FUNC_GROUP_1) { if (!(buf[support_offset] & support_mask) || ((buf[query_switch_offset] & 0x0F) != query_switch)) { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } /* Check 'Busy Status' */ if ((buf[DATA_STRUCTURE_VER_OFFSET] == 0x01) && ((buf[check_busy_offset] & switch_busy) == switch_busy)) { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -1056,7 +1119,8 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode, buf, 64, 250); if (retval != STATUS_SUCCESS) { rtsx_clear_sd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } dev_dbg(rtsx_dev(chip), "%*ph\n", 64, buf); @@ -1083,13 +1147,17 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode, dev_dbg(rtsx_dev(chip), "Maximum current consumption: %dmA\n", cc); - if ((cc == 0) || (cc > 800)) - TRACE_RET(chip, STATUS_FAIL); + if ((cc == 0) || (cc > 800)) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_query_switch_result(chip, func_group, func_to_switch, buf, 64); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if ((cc > 400) || (func_to_switch > CURRENT_LIMIT_400)) { RTSX_WRITE_REG(chip, OCPPARA2, SD_OCP_THD_MASK, @@ -1126,7 +1194,8 @@ static int sd_check_switch(struct rtsx_chip *chip, for (i = 0; i < 3; i++) { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { sd_set_err_code(chip, SD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sd_check_switch_mode(chip, SD_CHECK_MODE, func_group, @@ -1144,7 +1213,8 @@ static int sd_check_switch(struct rtsx_chip *chip, RTSX_READ_REG(chip, SD_STAT1, &stat); if (stat & SD_CRC16_ERR) { dev_dbg(rtsx_dev(chip), "SD CRC16 error when switching mode\n"); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1154,8 +1224,10 @@ static int sd_check_switch(struct rtsx_chip *chip, wait_timeout(20); } - if (!switch_good) - TRACE_RET(chip, STATUS_FAIL); + if (!switch_good) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1170,8 +1242,10 @@ static int sd_switch_function(struct rtsx_chip *chip, u8 bus_width) /* Get supported functions */ retval = sd_check_switch_mode(chip, SD_CHECK_MODE, NO_ARGUMENT, NO_ARGUMENT, bus_width); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } sd_card->func_group1_mask &= ~(sd_card->sd_switch_fail); @@ -1239,7 +1313,8 @@ static int sd_switch_function(struct rtsx_chip *chip, u8 bus_width) sd_card->sd_switch_fail = SDR104_SUPPORT_MASK | DDR50_SUPPORT_MASK | SDR50_SUPPORT_MASK; } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (func_to_switch == SDR104_SUPPORT) @@ -1255,8 +1330,10 @@ static int sd_switch_function(struct rtsx_chip *chip, u8 bus_width) if (CHK_SD_DDR50(sd_card)) { RTSX_WRITE_REG(chip, SD_PUSH_POINT_CTL, 0x06, 0x04); retval = sd_set_sample_push_timing(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } if (!func_to_switch || (func_to_switch == HS_SUPPORT)) { @@ -1310,8 +1387,10 @@ static int sd_switch_function(struct rtsx_chip *chip, u8 bus_width) retval = sd_check_switch(chip, SD_FUNC_GROUP_4, func_to_switch, bus_width); if (retval != STATUS_SUCCESS) { - if (sd_check_err_code(chip, SD_NO_CARD)) - TRACE_RET(chip, STATUS_FAIL); + if (sd_check_err_code(chip, SD_NO_CARD)) { + rtsx_trace(chip); + return STATUS_FAIL; + } } dev_dbg(rtsx_dev(chip), "Switch current limit finished! (%d)\n", retval); @@ -1348,8 +1427,10 @@ static int sd_sdr_tuning_rx_cmd(struct rtsx_chip *chip, u8 sample_point) u8 cmd[5]; retval = sd_change_phase(chip, sample_point, TUNE_RX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } cmd[0] = 0x40 | SEND_TUNING_PATTERN; cmd[1] = 0; @@ -1363,7 +1444,8 @@ static int sd_sdr_tuning_rx_cmd(struct rtsx_chip *chip, u8 sample_point) (void)sd_wait_data_idle(chip); rtsx_clear_sd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -1376,15 +1458,19 @@ static int sd_ddr_tuning_rx_cmd(struct rtsx_chip *chip, u8 sample_point) u8 cmd[5]; retval = sd_change_phase(chip, sample_point, TUNE_RX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } dev_dbg(rtsx_dev(chip), "sd ddr tuning rx\n"); retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } cmd[0] = 0x40 | SD_STATUS; cmd[1] = 0; @@ -1398,7 +1484,8 @@ static int sd_ddr_tuning_rx_cmd(struct rtsx_chip *chip, u8 sample_point) (void)sd_wait_data_idle(chip); rtsx_clear_sd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -1418,8 +1505,10 @@ static int mmc_ddr_tunning_rx_cmd(struct rtsx_chip *chip, u8 sample_point) bus_width = SD_BUS_WIDTH_1; retval = sd_change_phase(chip, sample_point, TUNE_RX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } dev_dbg(rtsx_dev(chip), "mmc ddr tuning rx\n"); @@ -1435,7 +1524,8 @@ static int mmc_ddr_tunning_rx_cmd(struct rtsx_chip *chip, u8 sample_point) (void)sd_wait_data_idle(chip); rtsx_clear_sd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -1447,8 +1537,10 @@ static int sd_sdr_tuning_tx_cmd(struct rtsx_chip *chip, u8 sample_point) int retval; retval = sd_change_phase(chip, sample_point, TUNE_TX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, SD_RSP_80CLK_TIMEOUT_EN); @@ -1459,7 +1551,8 @@ static int sd_sdr_tuning_tx_cmd(struct rtsx_chip *chip, u8 sample_point) if (sd_check_err_code(chip, SD_RSP_TIMEOUT)) { rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, 0); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1475,8 +1568,10 @@ static int sd_ddr_tuning_tx_cmd(struct rtsx_chip *chip, u8 sample_point) u8 cmd[5], bus_width; retval = sd_change_phase(chip, sample_point, TUNE_TX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_SD(sd_card)) { bus_width = SD_BUS_WIDTH_4; @@ -1490,8 +1585,10 @@ static int sd_ddr_tuning_tx_cmd(struct rtsx_chip *chip, u8 sample_point) } retval = sd_wait_state_data_ready(chip, 0x08, 1, 1000); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, SD_RSP_80CLK_TIMEOUT_EN); @@ -1507,7 +1604,8 @@ static int sd_ddr_tuning_tx_cmd(struct rtsx_chip *chip, u8 sample_point) if (retval != STATUS_SUCCESS) { rtsx_clear_sd_error(chip); rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, 0); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } RTSX_WRITE_REG(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, 0); @@ -1655,8 +1753,10 @@ static int sd_tuning_rx(struct rtsx_chip *chip) } else { if (CHK_MMC_DDR52(sd_card)) tuning_cmd = mmc_ddr_tunning_rx_cmd; - else - TRACE_RET(chip, STATUS_FAIL); + else { + rtsx_trace(chip); + return STATUS_FAIL; + } } for (i = 0; i < 3; i++) { @@ -1664,7 +1764,8 @@ static int sd_tuning_rx(struct rtsx_chip *chip) for (j = MAX_PHASE; j >= 0; j--) { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { sd_set_err_code(chip, SD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = tuning_cmd(chip, (u8)j); @@ -1681,12 +1782,16 @@ static int sd_tuning_rx(struct rtsx_chip *chip) dev_dbg(rtsx_dev(chip), "RX phase_map = 0x%08x\n", phase_map); final_phase = sd_search_final_phase(chip, phase_map, TUNE_RX); - if (final_phase == 0xFF) - TRACE_RET(chip, STATUS_FAIL); + if (final_phase == 0xFF) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_change_phase(chip, final_phase, TUNE_RX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1708,7 +1813,8 @@ static int sd_ddr_pre_tuning_tx(struct rtsx_chip *chip) sd_set_err_code(chip, SD_NO_CARD); rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, 0); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sd_change_phase(chip, (u8)i, TUNE_TX); @@ -1729,12 +1835,16 @@ static int sd_ddr_pre_tuning_tx(struct rtsx_chip *chip) phase_map); final_phase = sd_search_final_phase(chip, phase_map, TUNE_TX); - if (final_phase == 0xFF) - TRACE_RET(chip, STATUS_FAIL); + if (final_phase == 0xFF) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_change_phase(chip, final_phase, TUNE_TX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } dev_dbg(rtsx_dev(chip), "DDR TX pre tune phase: %d\n", (int)final_phase); @@ -1760,8 +1870,10 @@ static int sd_tuning_tx(struct rtsx_chip *chip) } else { if (CHK_MMC_DDR52(sd_card)) tuning_cmd = sd_ddr_tuning_tx_cmd; - else - TRACE_RET(chip, STATUS_FAIL); + else { + rtsx_trace(chip); + return STATUS_FAIL; + } } for (i = 0; i < 3; i++) { @@ -1771,7 +1883,8 @@ static int sd_tuning_tx(struct rtsx_chip *chip) sd_set_err_code(chip, SD_NO_CARD); rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, 0); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = tuning_cmd(chip, (u8)j); @@ -1788,12 +1901,16 @@ static int sd_tuning_tx(struct rtsx_chip *chip) dev_dbg(rtsx_dev(chip), "TX phase_map = 0x%08x\n", phase_map); final_phase = sd_search_final_phase(chip, phase_map, TUNE_TX); - if (final_phase == 0xFF) - TRACE_RET(chip, STATUS_FAIL); + if (final_phase == 0xFF) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_change_phase(chip, final_phase, TUNE_TX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1803,12 +1920,16 @@ static int sd_sdr_tuning(struct rtsx_chip *chip) int retval; retval = sd_tuning_tx(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_tuning_rx(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1819,23 +1940,31 @@ static int sd_ddr_tuning(struct rtsx_chip *chip) if (!(chip->sd_ctl & SD_DDR_TX_PHASE_SET_BY_USER)) { retval = sd_ddr_pre_tuning_tx(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { retval = sd_change_phase(chip, (u8)chip->sd_ddr_tx_phase, TUNE_TX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = sd_tuning_rx(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!(chip->sd_ctl & SD_DDR_TX_PHASE_SET_BY_USER)) { retval = sd_tuning_tx(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1847,23 +1976,31 @@ static int mmc_ddr_tuning(struct rtsx_chip *chip) if (!(chip->sd_ctl & MMC_DDR_TX_PHASE_SET_BY_USER)) { retval = sd_ddr_pre_tuning_tx(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { retval = sd_change_phase(chip, (u8)chip->mmc_ddr_tx_phase, TUNE_TX); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = sd_tuning_rx(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!(chip->sd_ctl & MMC_DDR_TX_PHASE_SET_BY_USER)) { retval = sd_tuning_tx(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1876,12 +2013,16 @@ int sd_switch_clock(struct rtsx_chip *chip) int re_tuning = 0; retval = select_card(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = switch_clock(chip, sd_card->sd_clock); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (re_tuning) { if (CHK_SD(sd_card)) { @@ -1894,8 +2035,10 @@ int sd_switch_clock(struct rtsx_chip *chip) retval = mmc_ddr_tuning(chip); } - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1925,8 +2068,10 @@ static int sd_prepare_reset(struct rtsx_chip *chip) chip->sd_io = 0; retval = sd_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, retval); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return retval; + } RTSX_WRITE_REG(chip, REG_SD_CFG1, 0xFF, 0x40); @@ -1934,8 +2079,10 @@ static int sd_prepare_reset(struct rtsx_chip *chip) SD_STOP | SD_CLR_ERR); retval = select_card(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1999,8 +2146,10 @@ int sd_pull_ctl_enable(struct rtsx_chip *chip) } retval = rtsx_send_cmd(chip, SD_CARD, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -2010,20 +2159,26 @@ static int sd_init_power(struct rtsx_chip *chip) int retval; retval = sd_power_off_card3v3(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!chip->ft2_fast_mode) wait_timeout(250); retval = enable_card_clock(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (chip->asic_code) { retval = sd_pull_ctl_enable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { RTSX_WRITE_REG(chip, FPGA_PULL_CTL, FPGA_SD_PULL_CTL_BIT | 0x20, 0); @@ -2031,8 +2186,10 @@ static int sd_init_power(struct rtsx_chip *chip) if (!chip->ft2_fast_mode) { retval = card_power_on(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } wait_timeout(260); @@ -2040,7 +2197,8 @@ static int sd_init_power(struct rtsx_chip *chip) if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER)) { dev_dbg(rtsx_dev(chip), "Over current, OCPSTAT is 0x%x\n", chip->ocp_stat); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif } @@ -2086,7 +2244,8 @@ static int sd_read_lba0(struct rtsx_chip *chip) 5, 512, 1, bus_width, NULL, 0, 100); if (retval != STATUS_SUCCESS) { rtsx_clear_sd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -2102,8 +2261,10 @@ static int sd_check_wp_state(struct rtsx_chip *chip) retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } cmd[0] = 0x40 | SD_STATUS; cmd[1] = 0; @@ -2118,7 +2279,8 @@ static int sd_check_wp_state(struct rtsx_chip *chip) sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } dev_dbg(rtsx_dev(chip), "ACMD13:\n"); @@ -2167,12 +2329,16 @@ Switch_Fail: #endif retval = sd_prepare_reset(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_dummy_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip) && try_sdio) { int rty_cnt = 0; @@ -2180,7 +2346,8 @@ Switch_Fail: for (; rty_cnt < chip->sdio_retry_cnt; rty_cnt++) { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { sd_set_err_code(chip, SD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sd_send_cmd_get_rsp(chip, IO_SEND_OP_COND, 0, @@ -2192,7 +2359,8 @@ Switch_Fail: dev_dbg(rtsx_dev(chip), "SD_IO card (Function number: %d)!\n", func_num); chip->sd_io = 1; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } break; @@ -2210,8 +2378,10 @@ Switch_Fail: RTY_SD_RST: retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0, SD_RSP_TYPE_R0, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } wait_timeout(20); @@ -2229,8 +2399,10 @@ RTY_SD_RST: retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0, SD_RSP_TYPE_R0, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } wait_timeout(20); } @@ -2241,14 +2413,17 @@ RTY_SD_RST: if (retval != STATUS_SUCCESS) { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { sd_set_err_code(chip, SD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } j++; if (j < 3) goto RTY_SD_RST; - else - TRACE_RET(chip, STATUS_FAIL); + else { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = sd_send_cmd_get_rsp(chip, SD_APP_OP_COND, voltage, @@ -2257,16 +2432,20 @@ RTY_SD_RST: k++; if (k < 3) goto RTY_SD_RST; - else - TRACE_RET(chip, STATUS_FAIL); + else { + rtsx_trace(chip); + return STATUS_FAIL; + } } i++; wait_timeout(20); } while (!(rsp[1] & 0x80) && (i < 255)); - if (i == 255) - TRACE_RET(chip, STATUS_FAIL); + if (i == 255) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (hi_cap_flow) { if (rsp[1] & 0x40) @@ -2283,20 +2462,26 @@ RTY_SD_RST: if (support_1v8) { retval = sd_voltage_switch(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = sd_send_cmd_get_rsp(chip, ALL_SEND_CID, 0, SD_RSP_TYPE_R2, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } for (i = 0; i < 3; i++) { retval = sd_send_cmd_get_rsp(chip, SEND_RELATIVE_ADDR, 0, SD_RSP_TYPE_R6, rsp, 5); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } sd_card->sd_addr = (u32)rsp[1] << 24; sd_card->sd_addr += (u32)rsp[2] << 16; @@ -2306,18 +2491,24 @@ RTY_SD_RST: } retval = sd_check_csd(chip, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_select_card(chip, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } #ifdef SUPPORT_SD_LOCK SD_UNLOCK_ENTRY: retval = sd_update_lock_status(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (sd_card->sd_lock_status & SD_LOCKED) { sd_card->sd_lock_status |= (SD_LOCK_1BIT_MODE | SD_PWD_EXIST); @@ -2329,24 +2520,32 @@ SD_UNLOCK_ENTRY: retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_send_cmd_get_rsp(chip, SET_CLR_CARD_DETECT, 0, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (support_1v8) { retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } switch_bus_width = SD_BUS_WIDTH_4; } else { @@ -2355,12 +2554,16 @@ SD_UNLOCK_ENTRY: retval = sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!(sd_card->raw_csd[4] & 0x40)) sd_dont_switch = true; @@ -2399,13 +2602,17 @@ SD_UNLOCK_ENTRY: if (!support_1v8) { retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } #ifdef SUPPORT_SD_LOCK @@ -2419,8 +2626,10 @@ SD_UNLOCK_ENTRY: chip->sd30_drive_sel_1v8); retval = sd_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (CHK_SD_DDR50(sd_card)) retval = sd_ddr_tuning(chip); @@ -2429,11 +2638,14 @@ SD_UNLOCK_ENTRY: if (retval != STATUS_SUCCESS) { if (sd20_mode) { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } else { retval = sd_init_power(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } try_sdio = false; sd20_mode = true; @@ -2454,11 +2666,14 @@ SD_UNLOCK_ENTRY: retval = sd_read_lba0(chip); if (retval != STATUS_SUCCESS) { if (sd20_mode) { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } else { retval = sd_init_power(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } try_sdio = false; sd20_mode = true; @@ -2469,8 +2684,10 @@ SD_UNLOCK_ENTRY: } retval = sd_check_wp_state(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } chip->card_bus_width[chip->card2lun[SD_CARD]] = 4; @@ -2495,8 +2712,10 @@ static int mmc_test_switch_bus(struct rtsx_chip *chip, u8 width) retval = sd_send_cmd_get_rsp(chip, BUSTEST_W, 0, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, SWITCH_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return SWITCH_FAIL; + } if (width == MMC_8BIT_BUS) { buf[0] = 0x55; @@ -2512,20 +2731,25 @@ static int mmc_test_switch_bus(struct rtsx_chip *chip, u8 width) } retval = rtsx_write_register(chip, REG_SD_CFG3, 0x02, 0x02); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, SWITCH_ERR); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return SWITCH_ERR; + } retval = sd_write_data(chip, SD_TM_AUTO_WRITE_3, NULL, 0, byte_cnt, 1, bus_width, buf, len, 100); if (retval != STATUS_SUCCESS) { rtsx_clear_sd_error(chip); rtsx_write_register(chip, REG_SD_CFG3, 0x02, 0); - TRACE_RET(chip, SWITCH_ERR); + rtsx_trace(chip); + return SWITCH_ERR; } retval = rtsx_write_register(chip, REG_SD_CFG3, 0x02, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, SWITCH_ERR); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return SWITCH_ERR; + } dev_dbg(rtsx_dev(chip), "SD/MMC CMD %d\n", BUSTEST_R); @@ -2560,7 +2784,8 @@ static int mmc_test_switch_bus(struct rtsx_chip *chip, u8 width) retval = rtsx_send_cmd(chip, SD_CARD, 100); if (retval < 0) { rtsx_clear_sd_error(chip); - TRACE_RET(chip, SWITCH_ERR); + rtsx_trace(chip); + return SWITCH_ERR; } ptr = rtsx_get_cmd_data(chip) + 1; @@ -2602,7 +2827,8 @@ static int mmc_test_switch_bus(struct rtsx_chip *chip, u8 width) } } - TRACE_RET(chip, SWITCH_FAIL); + rtsx_trace(chip); + return SWITCH_FAIL; } @@ -2653,14 +2879,16 @@ static int mmc_switch_timing_bus(struct rtsx_chip *chip, bool switch_ddr) sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } ptr = rtsx_get_cmd_data(chip); if (ptr[0] & SD_TRANSFER_ERR) { sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (CHK_MMC_SECTOR_MODE(sd_card)) { @@ -2692,8 +2920,10 @@ static int mmc_switch_timing_bus(struct rtsx_chip *chip, bool switch_ddr) sd_choose_proper_clock(chip); retval = switch_clock(chip, sd_card->sd_clock); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } /* Test Bus Procedure */ retval = mmc_test_switch_bus(chip, MMC_8BIT_BUS); @@ -2715,10 +2945,12 @@ static int mmc_switch_timing_bus(struct rtsx_chip *chip, bool switch_ddr) CLR_MMC_8BIT(sd_card); CLR_MMC_4BIT(sd_card); } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -2741,21 +2973,26 @@ static int reset_mmc(struct rtsx_chip *chip) Switch_Fail: retval = sd_prepare_reset(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, retval); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return retval; + } SET_MMC(sd_card); RTY_MMC_RST: retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0, SD_RSP_TYPE_R0, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } do { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { sd_set_err_code(chip, SD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sd_send_cmd_get_rsp(chip, SEND_OP_COND, @@ -2769,7 +3006,8 @@ RTY_MMC_RST: sd_clr_err_code(chip); goto RTY_MMC_RST; } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else { j++; @@ -2777,7 +3015,8 @@ RTY_MMC_RST: sd_clr_err_code(chip); goto RTY_MMC_RST; } else { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } } @@ -2786,8 +3025,10 @@ RTY_MMC_RST: i++; } while (!(rsp[1] & 0x80) && (i < 255)); - if (i == 255) - TRACE_RET(chip, STATUS_FAIL); + if (i == 255) { + rtsx_trace(chip); + return STATUS_FAIL; + } if ((rsp[1] & 0x60) == 0x40) SET_MMC_SECTOR_MODE(sd_card); @@ -2796,40 +3037,54 @@ RTY_MMC_RST: retval = sd_send_cmd_get_rsp(chip, ALL_SEND_CID, 0, SD_RSP_TYPE_R2, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } sd_card->sd_addr = 0x00100000; retval = sd_send_cmd_get_rsp(chip, SET_RELATIVE_ADDR, sd_card->sd_addr, SD_RSP_TYPE_R6, rsp, 5); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_check_csd(chip, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } spec_ver = (sd_card->raw_csd[0] & 0x3C) >> 2; retval = sd_select_card(chip, 1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } #ifdef SUPPORT_SD_LOCK MMC_UNLOCK_ENTRY: retval = sd_update_lock_status(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } #endif retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } chip->card_bus_width[chip->card2lun[SD_CARD]] = 1; @@ -2839,29 +3094,39 @@ MMC_UNLOCK_ENTRY: retval = mmc_switch_timing_bus(chip, switch_ddr); if (retval != STATUS_SUCCESS) { retval = sd_init_power(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } sd_card->mmc_dont_switch_bus = 1; - TRACE_GOTO(chip, Switch_Fail); + rtsx_trace(chip); + goto Switch_Fail; } } - if (CHK_MMC_SECTOR_MODE(sd_card) && (sd_card->capacity == 0)) - TRACE_RET(chip, STATUS_FAIL); + if (CHK_MMC_SECTOR_MODE(sd_card) && (sd_card->capacity == 0)) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (switch_ddr && CHK_MMC_DDR52(sd_card)) { retval = sd_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = mmc_ddr_tuning(chip); if (retval != STATUS_SUCCESS) { retval = sd_init_power(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } switch_ddr = false; - TRACE_GOTO(chip, Switch_Fail); + rtsx_trace(chip); + goto Switch_Fail; } retval = sd_wait_state_data_ready(chip, 0x08, 1, 1000); @@ -2869,11 +3134,14 @@ MMC_UNLOCK_ENTRY: retval = sd_read_lba0(chip); if (retval != STATUS_SUCCESS) { retval = sd_init_power(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } switch_ddr = false; - TRACE_GOTO(chip, Switch_Fail); + rtsx_trace(chip); + goto Switch_Fail; } } } @@ -2904,62 +3172,84 @@ int reset_sd_card(struct rtsx_chip *chip) chip->capacity[chip->card2lun[SD_CARD]] = 0; retval = enable_card_clock(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (chip->ignore_sd && CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip)) { if (chip->asic_code) { retval = sd_pull_ctl_enable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { retval = rtsx_write_register(chip, FPGA_PULL_CTL, FPGA_SD_PULL_CTL_BIT | 0x20, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } retval = card_share_mode(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } chip->sd_io = 1; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sd_init_power(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (chip->sd_ctl & RESET_MMC_FIRST) { retval = reset_mmc(chip); if (retval != STATUS_SUCCESS) { - if (sd_check_err_code(chip, SD_NO_CARD)) - TRACE_RET(chip, STATUS_FAIL); + if (sd_check_err_code(chip, SD_NO_CARD)) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = reset_sd(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } } else { retval = reset_sd(chip); if (retval != STATUS_SUCCESS) { - if (sd_check_err_code(chip, SD_NO_CARD)) - TRACE_RET(chip, STATUS_FAIL); + if (sd_check_err_code(chip, SD_NO_CARD)) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (chip->sd_io) { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } else { retval = reset_mmc(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } } } retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, REG_SD_BYTE_CNT_L, 0xFF, 0); RTSX_WRITE_REG(chip, REG_SD_BYTE_CNT_H, 0xFF, 2); @@ -2967,8 +3257,10 @@ int reset_sd_card(struct rtsx_chip *chip) chip->capacity[chip->card2lun[SD_CARD]] = sd_card->capacity; retval = sd_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } dev_dbg(rtsx_dev(chip), "sd_card->sd_type = 0x%x\n", sd_card->sd_type); @@ -2994,20 +3286,28 @@ static int reset_mmc_only(struct rtsx_chip *chip) chip->capacity[chip->card2lun[SD_CARD]] = sd_card->capacity = 0; retval = enable_card_clock(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_init_power(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = reset_mmc(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, REG_SD_BYTE_CNT_L, 0xFF, 0); RTSX_WRITE_REG(chip, REG_SD_BYTE_CNT_H, 0xFF, 2); @@ -3015,8 +3315,10 @@ static int reset_mmc_only(struct rtsx_chip *chip) chip->capacity[chip->card2lun[SD_CARD]] = sd_card->capacity; retval = sd_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } dev_dbg(rtsx_dev(chip), "In reset_mmc_only, sd_card->sd_type = 0x%x\n", sd_card->sd_type); @@ -3034,15 +3336,18 @@ static int wait_data_buf_ready(struct rtsx_chip *chip) for (i = 0; i < WAIT_DATA_READY_RTY_CNT; i++) { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { sd_set_err_code(chip, SD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } sd_card->sd_data_buf_ready = 0; retval = sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (sd_card->sd_data_buf_ready) { return sd_send_cmd_get_rsp(chip, SEND_STATUS, @@ -3052,7 +3357,8 @@ static int wait_data_buf_ready(struct rtsx_chip *chip) sd_set_err_code(chip, SD_TO_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } void sd_stop_seq_mode(struct rtsx_chip *chip) @@ -3120,8 +3426,10 @@ static inline int sd_auto_tune_clock(struct rtsx_chip *chip) } retval = sd_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -3158,7 +3466,8 @@ int sd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 start_sector, chip->card_fail |= SD_CARD; chip->capacity[chip->card2lun[SD_CARD]] = 0; chip->rw_need_retry = 1; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -3172,7 +3481,8 @@ int sd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 start_sector, retval = sd_switch_clock(chip); if (retval != STATUS_SUCCESS) { sd_set_err_code(chip, SD_IO_ERR); - TRACE_GOTO(chip, RW_FAIL); + rtsx_trace(chip); + goto RW_FAIL; } if (sd_card->seq_mode && @@ -3193,7 +3503,8 @@ int sd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 start_sector, if (retval != STATUS_SUCCESS) { chip->rw_need_retry = 1; sd_set_err_code(chip, SD_STS_ERR); - TRACE_GOTO(chip, RW_FAIL); + rtsx_trace(chip); + goto RW_FAIL; } sd_card->seq_mode = 0; @@ -3201,7 +3512,8 @@ int sd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 start_sector, retval = rtsx_write_register(chip, RBCTL, RB_FLUSH, RB_FLUSH); if (retval != STATUS_SUCCESS) { sd_set_err_code(chip, SD_IO_ERR); - TRACE_GOTO(chip, RW_FAIL); + rtsx_trace(chip); + goto RW_FAIL; } if ((sd_card->pre_sec_cnt < 0x80) @@ -3292,21 +3604,24 @@ int sd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 start_sector, chip->rw_need_retry = 1; sd_set_err_code(chip, SD_TO_ERR); - TRACE_GOTO(chip, RW_FAIL); + rtsx_trace(chip); + goto RW_FAIL; } retval = wait_data_buf_ready(chip); if (retval != STATUS_SUCCESS) { chip->rw_need_retry = 1; sd_set_err_code(chip, SD_TO_ERR); - TRACE_GOTO(chip, RW_FAIL); + rtsx_trace(chip); + goto RW_FAIL; } retval = sd_send_cmd_get_rsp(chip, WRITE_MULTIPLE_BLOCK, data_addr, SD_RSP_TYPE_R1, NULL, 0); if (retval != STATUS_SUCCESS) { chip->rw_need_retry = 1; - TRACE_GOTO(chip, RW_FAIL); + rtsx_trace(chip); + goto RW_FAIL; } rtsx_init_cmd(chip); @@ -3350,7 +3665,8 @@ int sd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 start_sector, if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { chip->rw_need_retry = 0; dev_dbg(rtsx_dev(chip), "No card exist, exit sd_rw\n"); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } chip->rw_need_retry = 1; @@ -3359,21 +3675,25 @@ int sd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 start_sector, SD_RSP_TYPE_R1b, NULL, 0); if (retval != STATUS_SUCCESS) { sd_set_err_code(chip, SD_STS_ERR); - TRACE_GOTO(chip, RW_FAIL); + rtsx_trace(chip); + goto RW_FAIL; } if (stat & (SD_CRC7_ERR | SD_CRC16_ERR | SD_CRC_WRITE_ERR)) { dev_dbg(rtsx_dev(chip), "SD CRC error, tune clock!\n"); sd_set_err_code(chip, SD_CRC_ERR); - TRACE_GOTO(chip, RW_FAIL); + rtsx_trace(chip); + goto RW_FAIL; } if (err == STATUS_TIMEDOUT) { sd_set_err_code(chip, SD_TO_ERR); - TRACE_GOTO(chip, RW_FAIL); + rtsx_trace(chip); + goto RW_FAIL; } - TRACE_RET(chip, err); + rtsx_trace(chip); + return err; } sd_card->pre_sec_addr = start_sector; @@ -3388,7 +3708,8 @@ RW_FAIL: if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { chip->rw_need_retry = 0; dev_dbg(rtsx_dev(chip), "No card exist, exit sd_rw\n"); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (sd_check_err_code(chip, SD_CRC_ERR)) { @@ -3409,7 +3730,8 @@ RW_FAIL: } } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #ifdef SUPPORT_CPRM @@ -3475,13 +3797,16 @@ RTY_SEND_CMD: if (rsp_type & SD_WAIT_BUSY_END) { retval = sd_check_data0_status(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, retval); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return retval; + } } else { sd_set_err_code(chip, SD_TO_ERR); } } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (rsp_type == SD_RSP_TYPE_R0) @@ -3491,14 +3816,16 @@ RTY_SEND_CMD: if ((ptr[0] & 0xC0) != 0) { sd_set_err_code(chip, SD_STS_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (!(rsp_type & SD_NO_CHECK_CRC7)) { if (ptr[stat_idx] & SD_CRC7_ERR) { if (cmd_idx == WRITE_MULTIPLE_BLOCK) { sd_set_err_code(chip, SD_CRC_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (rty_cnt < SD_MAX_RETRY_COUNT) { wait_timeout(20); @@ -3506,7 +3833,8 @@ RTY_SEND_CMD: goto RTY_SEND_CMD; } else { sd_set_err_code(chip, SD_CRC_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } } @@ -3514,8 +3842,10 @@ RTY_SEND_CMD: if ((cmd_idx == SELECT_CARD) || (cmd_idx == APP_CMD) || (cmd_idx == SEND_STATUS) || (cmd_idx == STOP_TRANSMISSION)) { if ((cmd_idx != STOP_TRANSMISSION) && !special_check) { - if (ptr[1] & 0x80) - TRACE_RET(chip, STATUS_FAIL); + if (ptr[1] & 0x80) { + rtsx_trace(chip); + return STATUS_FAIL; + } } #ifdef SUPPORT_SD_LOCK if (ptr[1] & 0x7D) @@ -3523,19 +3853,26 @@ RTY_SEND_CMD: if (ptr[1] & 0x7F) #endif { - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; + } + if (ptr[2] & 0xF8) { + rtsx_trace(chip); + return STATUS_FAIL; } - if (ptr[2] & 0xF8) - TRACE_RET(chip, STATUS_FAIL); if (cmd_idx == SELECT_CARD) { if (rsp_type == SD_RSP_TYPE_R2) { - if ((ptr[3] & 0x1E) != 0x04) - TRACE_RET(chip, STATUS_FAIL); + if ((ptr[3] & 0x1E) != 0x04) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else if (rsp_type == SD_RSP_TYPE_R0) { - if ((ptr[3] & 0x1E) != 0x03) - TRACE_RET(chip, STATUS_FAIL); + if ((ptr[3] & 0x1E) != 0x03) { + rtsx_trace(chip); + return STATUS_FAIL; + } } } } @@ -3572,8 +3909,10 @@ int ext_sd_get_rsp(struct rtsx_chip *chip, int len, u8 *rsp, u8 rsp_type) rtsx_add_cmd(chip, READ_REG_CMD, REG_SD_CMD5, 0xFF, 0); retval = rtsx_send_cmd(chip, SD_CARD, 100); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (rsp) { int min_len = (rsp_len < len) ? rsp_len : len; @@ -3619,7 +3958,8 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!(CHK_BIT(chip->lun_mc, lun))) { SET_BIT(chip->lun_mc, lun); set_sense_type(chip, lun, SENSE_TYPE_MEDIA_CHANGE); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if ((0x53 != srb->cmnd[2]) || (0x44 != srb->cmnd[3]) || @@ -3627,7 +3967,8 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip) (0x61 != srb->cmnd[6]) || (0x72 != srb->cmnd[7]) || (0x64 != srb->cmnd[8])) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } switch (srb->cmnd[1] & 0x0F) { @@ -3641,7 +3982,8 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip) default: set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } buf[5] = (1 == CHK_SD(sd_card)) ? 0x01 : 0x02; @@ -3709,17 +4051,21 @@ int sd_execute_no_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!sd_card->sd_pass_thru_en) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } retval = sd_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } if (sd_card->pre_cmd_err) { sd_card->pre_cmd_err = 0; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_CHANGE); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } cmd_idx = srb->cmnd[2] & 0x3F; @@ -3735,64 +4081,83 @@ int sd_execute_no_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = get_rsp_type(srb, &rsp_type, &rsp_len); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } sd_card->last_rsp_type = rsp_type; retval = sd_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } #ifdef SUPPORT_SD_LOCK if ((sd_card->sd_lock_status & SD_LOCK_1BIT_MODE) == 0) { if (CHK_MMC_8BIT(sd_card)) { retval = rtsx_write_register(chip, REG_SD_CFG1, 0x03, SD_BUS_WIDTH_8); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else if (CHK_SD(sd_card) || CHK_MMC_4BIT(sd_card)) { retval = rtsx_write_register(chip, REG_SD_CFG1, 0x03, SD_BUS_WIDTH_4); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } } #else retval = rtsx_write_register(chip, REG_SD_CFG1, 0x03, SD_BUS_WIDTH_4); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } #endif if (standby) { retval = sd_select_card(chip, 0); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Cmd_Failed; + } } if (acmd) { retval = ext_sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Cmd_Failed; + } } retval = ext_sd_send_cmd_get_rsp(chip, cmd_idx, arg, rsp_type, sd_card->rsp, rsp_len, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Cmd_Failed; + } if (standby) { retval = sd_select_card(chip, 1); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Cmd_Failed; + } } #ifdef SUPPORT_SD_LOCK retval = sd_update_lock_status(chip); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Cmd_Failed; + } #endif scsi_set_resid(srb, 0); @@ -3806,7 +4171,8 @@ SD_Execute_Cmd_Failed: if (!(chip->card_ready & SD_CARD)) set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) @@ -3821,18 +4187,22 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!sd_card->sd_pass_thru_en) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (sd_card->pre_cmd_err) { sd_card->pre_cmd_err = 0; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_CHANGE); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } retval = sd_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } cmd_idx = srb->cmnd[2] & 0x3F; if (srb->cmnd[1] & 0x04) @@ -3850,13 +4220,16 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = get_rsp_type(srb, &rsp_type, &rsp_len); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } sd_card->last_rsp_type = rsp_type; retval = sd_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } #ifdef SUPPORT_SD_LOCK if ((sd_card->sd_lock_status & SD_LOCK_1BIT_MODE) == 0) { @@ -3877,22 +4250,28 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (data_len < 512) { retval = ext_sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, data_len, SD_RSP_TYPE_R1, NULL, 0, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } } if (standby) { retval = sd_select_card(chip, 0); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } } if (acmd) { retval = ext_sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } } if (data_len <= 512) { @@ -3911,8 +4290,10 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) cmd[4] = srb->cmnd[6]; buf = kmalloc(data_len, GFP_KERNEL); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } retval = sd_read_data(chip, SD_TM_NORMAL_READ, cmd, 5, byte_cnt, blk_cnt, bus_width, buf, data_len, 2000); @@ -3920,7 +4301,8 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) read_err = true; kfree(buf); rtsx_clear_sd_error(chip); - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; } min_len = min(data_len, scsi_bufflen(srb)); @@ -3968,43 +4350,57 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval < 0) { read_err = true; rtsx_clear_sd_error(chip); - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; } } else { - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; } retval = ext_sd_get_rsp(chip, rsp_len, sd_card->rsp, rsp_type); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } if (standby) { retval = sd_select_card(chip, 1); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } } if (send_cmd12) { retval = ext_sd_send_cmd_get_rsp(chip, STOP_TRANSMISSION, 0, SD_RSP_TYPE_R1b, NULL, 0, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } } if (data_len < 512) { retval = ext_sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, SD_RSP_TYPE_R1, NULL, 0, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } retval = rtsx_write_register(chip, SD_BYTE_CNT_H, 0xFF, 0x02); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } retval = rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } } if ((srb->cmnd[1] & 0x02) || (srb->cmnd[1] & 0x04)) @@ -4018,8 +4414,10 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval == STATUS_SUCCESS) break; } - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Read_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Read_Cmd_Failed; + } scsi_set_resid(srb, 0); return TRANSPORT_GOOD; @@ -4035,7 +4433,8 @@ SD_Execute_Read_Cmd_Failed: if (!(chip->card_ready & SD_CARD)) set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) @@ -4055,18 +4454,22 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!sd_card->sd_pass_thru_en) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (sd_card->pre_cmd_err) { sd_card->pre_cmd_err = 0; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_CHANGE); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } retval = sd_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } cmd_idx = srb->cmnd[2] & 0x3F; if (srb->cmnd[1] & 0x04) @@ -4093,68 +4496,87 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = get_rsp_type(srb, &rsp_type, &rsp_len); if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } sd_card->last_rsp_type = rsp_type; retval = sd_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } #ifdef SUPPORT_SD_LOCK if ((sd_card->sd_lock_status & SD_LOCK_1BIT_MODE) == 0) { if (CHK_MMC_8BIT(sd_card)) { retval = rtsx_write_register(chip, REG_SD_CFG1, 0x03, SD_BUS_WIDTH_8); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } else if (CHK_SD(sd_card) || CHK_MMC_4BIT(sd_card)) { retval = rtsx_write_register(chip, REG_SD_CFG1, 0x03, SD_BUS_WIDTH_4); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } } } #else retval = rtsx_write_register(chip, REG_SD_CFG1, 0x03, SD_BUS_WIDTH_4); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, TRANSPORT_FAILED); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return TRANSPORT_FAILED; + } #endif if (data_len < 512) { retval = ext_sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, data_len, SD_RSP_TYPE_R1, NULL, 0, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } } if (standby) { retval = sd_select_card(chip, 0); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } } if (acmd) { retval = ext_sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } } retval = ext_sd_send_cmd_get_rsp(chip, cmd_idx, arg, rsp_type, sd_card->rsp, rsp_len, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } if (data_len <= 512) { u16 i; u8 *buf; buf = kmalloc(data_len, GFP_KERNEL); - if (buf == NULL) - TRACE_RET(chip, TRANSPORT_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return TRANSPORT_ERROR; + } rtsx_stor_get_xfer_buf(buf, data_len, srb); @@ -4172,7 +4594,8 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = rtsx_send_cmd(chip, 0, 250); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; } rtsx_init_cmd(chip); @@ -4183,7 +4606,8 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = rtsx_send_cmd(chip, 0, 250); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; } } else { rtsx_init_cmd(chip); @@ -4194,7 +4618,8 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = rtsx_send_cmd(chip, 0, 250); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; } } @@ -4245,13 +4670,15 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) DMA_TO_DEVICE, 10000); } else { - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; } if (retval < 0) { write_err = true; rtsx_clear_sd_error(chip); - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; } #ifdef SUPPORT_SD_LOCK @@ -4277,30 +4704,40 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (standby) { retval = sd_select_card(chip, 1); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } } if (send_cmd12) { retval = ext_sd_send_cmd_get_rsp(chip, STOP_TRANSMISSION, 0, SD_RSP_TYPE_R1b, NULL, 0, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } } if (data_len < 512) { retval = ext_sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, SD_RSP_TYPE_R1, NULL, 0, false); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } retval = rtsx_write_register(chip, SD_BYTE_CNT_H, 0xFF, 0x02); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00); - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } } if ((srb->cmnd[1] & 0x02) || (srb->cmnd[1] & 0x04)) @@ -4314,8 +4751,10 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval == STATUS_SUCCESS) break; } - if (retval != STATUS_SUCCESS) - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; + } #ifdef SUPPORT_SD_LOCK if (cmd_idx == LOCK_UNLOCK) { @@ -4341,7 +4780,8 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = reset_sd(chip); if (retval != STATUS_SUCCESS) { sd_card->sd_lock_status &= ~(SD_UNLOCK_POW_ON | SD_SDR_RST); - TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed); + rtsx_trace(chip); + goto SD_Execute_Write_Cmd_Failed; } } @@ -4354,7 +4794,8 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (lock_cmd_fail) { scsi_set_resid(srb, 0); set_sense_type(chip, lun, SENSE_TYPE_NO_SENSE); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } #endif /* SUPPORT_SD_LOCK */ @@ -4372,7 +4813,8 @@ SD_Execute_Write_Cmd_Failed: if (!(chip->card_ready & SD_CARD)) set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } int sd_get_cmd_rsp(struct scsi_cmnd *srb, struct rtsx_chip *chip) @@ -4384,20 +4826,23 @@ int sd_get_cmd_rsp(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!sd_card->sd_pass_thru_en) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (sd_card->pre_cmd_err) { sd_card->pre_cmd_err = 0; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_CHANGE); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } data_len = ((u16)srb->cmnd[7] << 8) | srb->cmnd[8]; if (sd_card->last_rsp_type == SD_RSP_TYPE_R0) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } else if (sd_card->last_rsp_type == SD_RSP_TYPE_R2) { count = (data_len < 17) ? data_len : 17; } else { @@ -4422,13 +4867,15 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (!sd_card->sd_pass_thru_en) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if (sd_card->pre_cmd_err) { sd_card->pre_cmd_err = 0; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_CHANGE); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } if ((0x53 != srb->cmnd[2]) || (0x44 != srb->cmnd[3]) || @@ -4436,7 +4883,8 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct rtsx_chip *chip) (0x61 != srb->cmnd[6]) || (0x72 != srb->cmnd[7]) || (0x64 != srb->cmnd[8])) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } switch (srb->cmnd[1] & 0x0F) { @@ -4452,7 +4900,8 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct rtsx_chip *chip) #endif set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); sd_card->pre_cmd_err = 1; - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } #ifdef SUPPORT_SD_LOCK sd_card->sd_lock_status &= ~SD_SDR_RST; @@ -4464,13 +4913,15 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); sd_card->pre_cmd_err = 1; - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } break; default: set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); - TRACE_RET(chip, TRANSPORT_FAILED); + rtsx_trace(chip); + return TRANSPORT_FAILED; } scsi_set_resid(srb, 0); @@ -4494,23 +4945,29 @@ int sd_power_off_card3v3(struct rtsx_chip *chip) int retval; retval = disable_card_clock(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, CARD_OE, SD_OUTPUT_EN, 0); if (!chip->ft2_fast_mode) { retval = card_power_off(chip, SD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } wait_timeout(50); } if (chip->asic_code) { retval = sd_pull_ctl_disable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { RTSX_WRITE_REG(chip, FPGA_PULL_CTL, FPGA_SD_PULL_CTL_BIT | 0x20, FPGA_SD_PULL_CTL_BIT); @@ -4540,8 +4997,10 @@ int release_sd_card(struct rtsx_chip *chip) memset(sd_card->raw_scr, 0, 8); retval = sd_power_off_card3v3(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } diff --git a/drivers/staging/rts5208/spi.c b/drivers/staging/rts5208/spi.c index 29f4a80844fa..d3ac6c0b11b5 100644 --- a/drivers/staging/rts5208/spi.c +++ b/drivers/staging/rts5208/spi.c @@ -25,9 +25,6 @@ #include #include "rtsx.h" -#include "rtsx_transport.h" -#include "rtsx_scsi.h" -#include "rtsx_card.h" #include "spi.h" static inline void spi_set_err_code(struct rtsx_chip *chip, u8 err_code) @@ -56,12 +53,16 @@ static int spi_set_init_para(struct rtsx_chip *chip) RTSX_WRITE_REG(chip, SPI_CLK_DIVIDER0, 0xFF, (u8)(spi->clk_div)); retval = switch_clock(chip, spi->spi_clock); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = select_card(chip, SPI_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, CARD_CLK_EN, SPI_CLK_EN, SPI_CLK_EN); RTSX_WRITE_REG(chip, CARD_OE, SPI_OUTPUT_EN, SPI_OUTPUT_EN); @@ -69,8 +70,10 @@ static int spi_set_init_para(struct rtsx_chip *chip) wait_timeout(10); retval = spi_init(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -91,7 +94,8 @@ static int sf_polling_status(struct rtsx_chip *chip, int msec) if (retval < 0) { rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_BUSY_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -119,7 +123,8 @@ static int sf_enable_write(struct rtsx_chip *chip, u8 ins) if (retval < 0) { rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -147,7 +152,8 @@ static int sf_disable_write(struct rtsx_chip *chip, u8 ins) if (retval < 0) { rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -205,7 +211,8 @@ static int sf_erase(struct rtsx_chip *chip, u8 ins, u8 addr_mode, u32 addr) if (retval < 0) { rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -225,12 +232,16 @@ static int spi_init_eeprom(struct rtsx_chip *chip) RTSX_WRITE_REG(chip, SPI_CLK_DIVIDER0, 0xFF, 0x27); retval = switch_clock(chip, clk); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = select_card(chip, SPI_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, CARD_CLK_EN, SPI_CLK_EN, SPI_CLK_EN); RTSX_WRITE_REG(chip, CARD_OE, SPI_OUTPUT_EN, SPI_OUTPUT_EN); @@ -258,8 +269,10 @@ static int spi_eeprom_program_enable(struct rtsx_chip *chip) SPI_TRANSFER0_END); retval = rtsx_send_cmd(chip, 0, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -269,12 +282,16 @@ int spi_erase_eeprom_chip(struct rtsx_chip *chip) int retval; retval = spi_init_eeprom(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = spi_eeprom_program_enable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -288,8 +305,10 @@ int spi_erase_eeprom_chip(struct rtsx_chip *chip) SPI_TRANSFER0_END); retval = rtsx_send_cmd(chip, 0, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, CARD_GPIO_DIR, 0x01, 0x01); @@ -301,12 +320,16 @@ int spi_erase_eeprom_byte(struct rtsx_chip *chip, u16 addr) int retval; retval = spi_init_eeprom(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = spi_eeprom_program_enable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -322,8 +345,10 @@ int spi_erase_eeprom_byte(struct rtsx_chip *chip, u16 addr) SPI_TRANSFER0_END); retval = rtsx_send_cmd(chip, 0, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, CARD_GPIO_DIR, 0x01, 0x01); @@ -337,8 +362,10 @@ int spi_read_eeprom(struct rtsx_chip *chip, u16 addr, u8 *val) u8 data; retval = spi_init_eeprom(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -355,8 +382,10 @@ int spi_read_eeprom(struct rtsx_chip *chip, u16 addr, u8 *val) SPI_TRANSFER0_END); retval = rtsx_send_cmd(chip, 0, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } wait_timeout(5); RTSX_READ_REG(chip, SPI_DATA, &data); @@ -374,12 +403,16 @@ int spi_write_eeprom(struct rtsx_chip *chip, u16 addr, u8 val) int retval; retval = spi_init_eeprom(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = spi_eeprom_program_enable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -396,8 +429,10 @@ int spi_write_eeprom(struct rtsx_chip *chip, u16 addr, u8 val) SPI_TRANSFER0_END); retval = rtsx_send_cmd(chip, 0, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, CARD_GPIO_DIR, 0x01, 0x01); @@ -449,13 +484,15 @@ int spi_read_flash_id(struct scsi_cmnd *srb, struct rtsx_chip *chip) len = ((u16)(srb->cmnd[7]) << 8) | srb->cmnd[8]; if (len > 512) { spi_set_err_code(chip, SPI_INVALID_COMMAND); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = spi_set_init_para(chip); if (retval != STATUS_SUCCESS) { spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } rtsx_init_cmd(chip); @@ -497,19 +534,23 @@ int spi_read_flash_id(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval < 0) { rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (len) { buf = kmalloc(len, GFP_KERNEL); - if (!buf) - TRACE_RET(chip, STATUS_ERROR); + if (!buf) { + rtsx_trace(chip); + return STATUS_ERROR; + } retval = rtsx_read_ppbuf(chip, buf, len); if (retval != STATUS_SUCCESS) { spi_set_err_code(chip, SPI_READ_ERR); kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } rtsx_stor_set_xfer_buf(buf, scsi_bufflen(srb), srb); @@ -541,12 +582,15 @@ int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = spi_set_init_para(chip); if (retval != STATUS_SUCCESS) { spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } buf = kmalloc(SF_PAGE_LEN, GFP_KERNEL); - if (buf == NULL) - TRACE_RET(chip, STATUS_ERROR); + if (buf == NULL) { + rtsx_trace(chip); + return STATUS_ERROR; + } while (len) { u16 pagelen = SF_PAGE_LEN - (u8)addr; @@ -598,7 +642,8 @@ int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) kfree(buf); rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } rtsx_stor_access_xfer_buf(buf, pagelen, srb, &index, &offset, @@ -634,19 +679,23 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = spi_set_init_para(chip); if (retval != STATUS_SUCCESS) { spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (program_mode == BYTE_PROGRAM) { buf = kmalloc(4, GFP_KERNEL); - if (!buf) - TRACE_RET(chip, STATUS_ERROR); + if (!buf) { + rtsx_trace(chip); + return STATUS_ERROR; + } while (len) { retval = sf_enable_write(chip, SPI_WREN); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } rtsx_stor_access_xfer_buf(buf, 1, srb, &index, &offset, @@ -665,13 +714,15 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) kfree(buf); rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sf_polling_status(chip, 100); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } addr++; @@ -684,12 +735,16 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) int first_byte = 1; retval = sf_enable_write(chip, SPI_WREN); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } buf = kmalloc(4, GFP_KERNEL); - if (!buf) - TRACE_RET(chip, STATUS_ERROR); + if (!buf) { + rtsx_trace(chip); + return STATUS_ERROR; + } while (len) { rtsx_stor_access_xfer_buf(buf, 1, srb, &index, &offset, @@ -713,13 +768,15 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) kfree(buf); rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sf_polling_status(chip, 100); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } len--; @@ -728,16 +785,22 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) kfree(buf); retval = sf_disable_write(chip, SPI_WRDI); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sf_polling_status(chip, 100); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else if (program_mode == PAGE_PROGRAM) { buf = kmalloc(SF_PAGE_LEN, GFP_KERNEL); - if (!buf) - TRACE_RET(chip, STATUS_NOMEM); + if (!buf) { + rtsx_trace(chip); + return STATUS_NOMEM; + } while (len) { u16 pagelen = SF_PAGE_LEN - (u8)addr; @@ -748,7 +811,8 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = sf_enable_write(chip, SPI_WREN); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } rtsx_init_cmd(chip); @@ -767,13 +831,15 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) kfree(buf); rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sf_polling_status(chip, 100); if (retval != STATUS_SUCCESS) { kfree(buf); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } addr += pagelen; @@ -783,7 +849,8 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) kfree(buf); } else { spi_set_err_code(chip, SPI_INVALID_COMMAND); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -805,28 +872,38 @@ int spi_erase_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = spi_set_init_para(chip); if (retval != STATUS_SUCCESS) { spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (erase_mode == PAGE_ERASE) { retval = sf_enable_write(chip, SPI_WREN); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sf_erase(chip, ins, 1, addr); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else if (erase_mode == CHIP_ERASE) { retval = sf_enable_write(chip, SPI_WREN); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = sf_erase(chip, ins, 0, 0); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { spi_set_err_code(chip, SPI_INVALID_COMMAND); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -844,12 +921,15 @@ int spi_write_flash_status(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = spi_set_init_para(chip); if (retval != STATUS_SUCCESS) { spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = sf_enable_write(chip, ewsr); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -871,7 +951,8 @@ int spi_write_flash_status(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (retval != STATUS_SUCCESS) { rtsx_clear_spi_error(chip); spi_set_err_code(chip, SPI_HW_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; diff --git a/drivers/staging/rts5208/trace.c b/drivers/staging/rts5208/trace.c new file mode 100644 index 000000000000..1bddbdf3454b --- /dev/null +++ b/drivers/staging/rts5208/trace.c @@ -0,0 +1,26 @@ +#include +#include + +#include "rtsx.h" + +#ifdef _MSG_TRACE + +void _rtsx_trace(struct rtsx_chip *chip, const char *file, const char *func, + int line) +{ + struct trace_msg_t *msg = &chip->trace_msg[chip->msg_idx]; + + file = kbasename(file); + dev_dbg(rtsx_dev(chip), "[%s][%s]:[%d]\n", file, func, line); + + strncpy(msg->file, file, MSG_FILE_LEN - 1); + strncpy(msg->func, func, MSG_FUNC_LEN - 1); + msg->line = (u16)line; + get_current_time(msg->timeval_buf, TIME_VAL_LEN); + msg->valid = 1; + + chip->msg_idx++; + if (chip->msg_idx >= TRACE_ITEM_CNT) + chip->msg_idx = 0; +} +#endif diff --git a/drivers/staging/rts5208/trace.h b/drivers/staging/rts5208/trace.h index a9ab4077b283..5b807874c1d7 100644 --- a/drivers/staging/rts5208/trace.h +++ b/drivers/staging/rts5208/trace.h @@ -24,64 +24,17 @@ #ifndef __REALTEK_RTSX_TRACE_H #define __REALTEK_RTSX_TRACE_H -#define _MSG_TRACE +struct rtsx_chip; #ifdef _MSG_TRACE -static inline char *filename(char *path) +void _rtsx_trace(struct rtsx_chip *chip, const char *file, const char *func, + int line); +#define rtsx_trace(chip) \ + _rtsx_trace(chip, __FILE__, __func__, __LINE__) +#else +static inline void rtsx_trace(struct rtsx_chip *chip) { - char *ptr; - - if (path == NULL) - return NULL; - - ptr = path; - - while (*ptr != '\0') { - if ((*ptr == '\\') || (*ptr == '/')) - path = ptr + 1; - - ptr++; - } - - return path; } - -#define TRACE_RET(chip, ret) \ - do { \ - char *_file = filename(__FILE__); \ - dev_dbg(rtsx_dev(chip), "[%s][%s]:[%d]\n", _file, \ - __func__, __LINE__); \ - (chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \ - strncpy((chip)->trace_msg[(chip)->msg_idx].func, __func__, MSG_FUNC_LEN-1); \ - strncpy((chip)->trace_msg[(chip)->msg_idx].file, _file, MSG_FILE_LEN-1); \ - get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf, TIME_VAL_LEN); \ - (chip)->trace_msg[(chip)->msg_idx].valid = 1; \ - (chip)->msg_idx++; \ - if ((chip)->msg_idx >= TRACE_ITEM_CNT) { \ - (chip)->msg_idx = 0; \ - } \ - return ret; \ - } while (0) - -#define TRACE_GOTO(chip, label) \ - do { \ - char *_file = filename(__FILE__); \ - dev_dbg(rtsx_dev(chip), "[%s][%s]:[%d]\n", _file, \ - __func__, __LINE__); \ - (chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \ - strncpy((chip)->trace_msg[(chip)->msg_idx].func, __func__, MSG_FUNC_LEN-1); \ - strncpy((chip)->trace_msg[(chip)->msg_idx].file, _file, MSG_FILE_LEN-1); \ - get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf, TIME_VAL_LEN); \ - (chip)->trace_msg[(chip)->msg_idx].valid = 1; \ - (chip)->msg_idx++; \ - if ((chip)->msg_idx >= TRACE_ITEM_CNT) { \ - (chip)->msg_idx = 0; \ - } \ - goto label; \ - } while (0) -#else -#define TRACE_RET(chip, ret) return ret -#define TRACE_GOTO(chip, label) goto label #endif #endif /* __REALTEK_RTSX_TRACE_H */ diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c index 0d029fe92b40..2afa6021c33b 100644 --- a/drivers/staging/rts5208/xd.c +++ b/drivers/staging/rts5208/xd.c @@ -60,8 +60,10 @@ static int xd_set_init_para(struct rtsx_chip *chip) xd_card->xd_clock = CLK_50; retval = switch_clock(chip, xd_card->xd_clock); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -72,12 +74,16 @@ static int xd_switch_clock(struct rtsx_chip *chip) int retval; retval = select_card(chip, XD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = switch_clock(chip, xd_card->xd_clock); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -99,8 +105,10 @@ static int xd_read_id(struct rtsx_chip *chip, u8 id_cmd, u8 *id_buf, u8 buf_len) rtsx_add_cmd(chip, READ_REG_CMD, (u16)(XD_ADDRESS1 + i), 0, 0); retval = rtsx_send_cmd(chip, XD_CARD, 20); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } ptr = rtsx_get_cmd_data(chip) + 1; if (id_buf && buf_len) { @@ -167,8 +175,10 @@ static int xd_read_redundant(struct rtsx_chip *chip, u32 page_addr, rtsx_add_cmd(chip, READ_REG_CMD, XD_PARITY, 0, 0); retval = rtsx_send_cmd(chip, XD_CARD, 500); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (buf && buf_len) { u8 *ptr = rtsx_get_cmd_data(chip) + 1; @@ -186,8 +196,10 @@ static int xd_read_data_from_ppb(struct rtsx_chip *chip, int offset, { int retval, i; - if (!buf || (buf_len < 0)) - TRACE_RET(chip, STATUS_FAIL); + if (!buf || (buf_len < 0)) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -198,7 +210,8 @@ static int xd_read_data_from_ppb(struct rtsx_chip *chip, int offset, retval = rtsx_send_cmd(chip, 0, 250); if (retval < 0) { rtsx_clear_xd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } memcpy(buf, rtsx_get_cmd_data(chip), buf_len); @@ -212,8 +225,10 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 page_addr, u8 *buf, int retval; u8 reg; - if (!buf || (buf_len < 10)) - TRACE_RET(chip, STATUS_FAIL); + if (!buf || (buf_len < 10)) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -233,20 +248,24 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 page_addr, u8 *buf, retval = rtsx_send_cmd(chip, XD_CARD, 250); if (retval == -ETIMEDOUT) { rtsx_clear_xd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } RTSX_READ_REG(chip, XD_PAGE_STATUS, ®); if (reg != XD_GPG) { rtsx_clear_xd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } RTSX_READ_REG(chip, XD_CTL, ®); if (!(reg & XD_ECC1_ERROR) || !(reg & XD_ECC1_UNCORRECTABLE)) { retval = xd_read_data_from_ppb(chip, 0, buf, buf_len); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (reg & XD_ECC1_ERROR) { u8 ecc_bit, ecc_byte; @@ -267,8 +286,10 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 page_addr, u8 *buf, rtsx_clear_xd_error(chip); retval = xd_read_data_from_ppb(chip, 256, buf, buf_len); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (reg & XD_ECC2_ERROR) { u8 ecc_bit, ecc_byte; @@ -287,7 +308,8 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 page_addr, u8 *buf, } } else { rtsx_clear_xd_error(chip); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -394,8 +416,10 @@ static int reset_xd(struct rtsx_chip *chip) u8 *ptr, id_buf[4], redunt[11]; retval = select_card(chip, XD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -418,13 +442,17 @@ static int reset_xd(struct rtsx_chip *chip) rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_OE, XD_OUTPUT_EN, 0); retval = rtsx_send_cmd(chip, XD_CARD, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!chip->ft2_fast_mode) { retval = card_power_off(chip, XD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } wait_timeout(250); @@ -439,19 +467,24 @@ static int reset_xd(struct rtsx_chip *chip) } retval = rtsx_send_cmd(chip, XD_CARD, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = card_power_on(chip, XD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } #ifdef SUPPORT_OCP wait_timeout(50); if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER)) { dev_dbg(rtsx_dev(chip), "Over current, OCPSTAT is 0x%x\n", chip->ocp_stat); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif } @@ -472,15 +505,19 @@ static int reset_xd(struct rtsx_chip *chip) rtsx_add_cmd(chip, WRITE_REG_CMD, XD_CTL, XD_CE_DISEN, XD_CE_DISEN); retval = rtsx_send_cmd(chip, XD_CARD, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (!chip->ft2_fast_mode) wait_timeout(200); retval = xd_set_init_para(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } /* Read ID to check if the timing setting is right */ for (i = 0; i < 4; i++) { @@ -502,8 +539,10 @@ static int reset_xd(struct rtsx_chip *chip) rtsx_add_cmd(chip, READ_REG_CMD, XD_CTL, 0, 0); retval = rtsx_send_cmd(chip, XD_CARD, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } ptr = rtsx_get_cmd_data(chip) + 1; @@ -515,8 +554,10 @@ static int reset_xd(struct rtsx_chip *chip) continue; retval = xd_read_id(chip, READ_ID, id_buf, 4); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } dev_dbg(rtsx_dev(chip), "READ_ID: 0x%x 0x%x 0x%x 0x%x\n", id_buf[0], id_buf[1], id_buf[2], id_buf[3]); @@ -596,8 +637,10 @@ static int reset_xd(struct rtsx_chip *chip) /* Confirm timing setting */ for (j = 0; j < 10; j++) { retval = xd_read_id(chip, READ_ID, id_buf, 4); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (id_buf[1] != xd_card->device_code) break; @@ -613,23 +656,30 @@ static int reset_xd(struct rtsx_chip *chip) xd_card->addr_cycle = 0; xd_card->capacity = 0; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = xd_read_id(chip, READ_xD_ID, id_buf, 4); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } dev_dbg(rtsx_dev(chip), "READ_xD_ID: 0x%x 0x%x 0x%x 0x%x\n", id_buf[0], id_buf[1], id_buf[2], id_buf[3]); - if (id_buf[2] != XD_ID_CODE) - TRACE_RET(chip, STATUS_FAIL); + if (id_buf[2] != XD_ID_CODE) { + rtsx_trace(chip); + return STATUS_FAIL; + } /* Search CIS block */ for (i = 0; i < 24; i++) { u32 page_addr; - if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } page_addr = (u32)i << xd_card->block_shift; @@ -667,8 +717,10 @@ static int reset_xd(struct rtsx_chip *chip) page_addr += j; retval = xd_read_cis(chip, page_addr, buf, 10); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if ((buf[0] == 0x01) && (buf[1] == 0x03) && (buf[2] == 0xD9) @@ -684,8 +736,10 @@ static int reset_xd(struct rtsx_chip *chip) } dev_dbg(rtsx_dev(chip), "CIS block: 0x%x\n", xd_card->cis_block); - if (xd_card->cis_block == 0xFFFF) - TRACE_RET(chip, STATUS_FAIL); + if (xd_card->cis_block == 0xFFFF) { + rtsx_trace(chip); + return STATUS_FAIL; + } chip->capacity[chip->card2lun[XD_CARD]] = xd_card->capacity; @@ -739,15 +793,19 @@ static int xd_init_l2p_tbl(struct rtsx_chip *chip) dev_dbg(rtsx_dev(chip), "xd_init_l2p_tbl: zone_cnt = %d\n", xd_card->zone_cnt); - if (xd_card->zone_cnt < 1) - TRACE_RET(chip, STATUS_FAIL); + if (xd_card->zone_cnt < 1) { + rtsx_trace(chip); + return STATUS_FAIL; + } size = xd_card->zone_cnt * sizeof(struct zone_entry); dev_dbg(rtsx_dev(chip), "Buffer size for l2p table is %d\n", size); xd_card->zone = vmalloc(size); - if (!xd_card->zone) - TRACE_RET(chip, STATUS_ERROR); + if (!xd_card->zone) { + rtsx_trace(chip); + return STATUS_ERROR; + } for (i = 0; i < xd_card->zone_cnt; i++) { xd_card->zone[i].build_flag = 0; @@ -927,16 +985,22 @@ int reset_xd_card(struct rtsx_chip *chip) xd_card->delay_write.delay_write_flag = 0; retval = enable_card_clock(chip, XD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = reset_xd(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } retval = xd_init_l2p_tbl(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -950,8 +1014,10 @@ static int xd_mark_bad_block(struct rtsx_chip *chip, u32 phy_blk) dev_dbg(rtsx_dev(chip), "mark block 0x%x as bad block\n", phy_blk); - if (phy_blk == BLK_NOT_FOUND) - TRACE_RET(chip, STATUS_FAIL); + if (phy_blk == BLK_NOT_FOUND) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -986,7 +1052,8 @@ static int xd_mark_bad_block(struct rtsx_chip *chip, u32 phy_blk) xd_set_err_code(chip, XD_PRG_ERROR); else xd_set_err_code(chip, XD_TO_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -1002,10 +1069,14 @@ static int xd_init_page(struct rtsx_chip *chip, u32 phy_blk, dev_dbg(rtsx_dev(chip), "Init block 0x%x\n", phy_blk); - if (start_page > end_page) - TRACE_RET(chip, STATUS_FAIL); - if (phy_blk == BLK_NOT_FOUND) - TRACE_RET(chip, STATUS_FAIL); + if (start_page > end_page) { + rtsx_trace(chip); + return STATUS_FAIL; + } + if (phy_blk == BLK_NOT_FOUND) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -1040,7 +1111,8 @@ static int xd_init_page(struct rtsx_chip *chip, u32 phy_blk, } else { xd_set_err_code(chip, XD_TO_ERROR); } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -1057,11 +1129,15 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk, dev_dbg(rtsx_dev(chip), "Copy page from block 0x%x to block 0x%x\n", old_blk, new_blk); - if (start_page > end_page) - TRACE_RET(chip, STATUS_FAIL); + if (start_page > end_page) { + rtsx_trace(chip); + return STATUS_FAIL; + } - if ((old_blk == BLK_NOT_FOUND) || (new_blk == BLK_NOT_FOUND)) - TRACE_RET(chip, STATUS_FAIL); + if ((old_blk == BLK_NOT_FOUND) || (new_blk == BLK_NOT_FOUND)) { + rtsx_trace(chip); + return STATUS_FAIL; + } old_page = (old_blk << xd_card->block_shift) + start_page; new_page = (new_blk << xd_card->block_shift) + start_page; @@ -1074,7 +1150,8 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk, if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { rtsx_clear_xd_error(chip); xd_set_err_code(chip, XD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } rtsx_init_cmd(chip); @@ -1100,7 +1177,8 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk, if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { xd_set_err_code(chip, XD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (((reg & (XD_ECC1_ERROR | XD_ECC1_UNCORRECTABLE)) == @@ -1119,7 +1197,8 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk, } } else { xd_set_err_code(chip, XD_TO_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1147,7 +1226,8 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk, } else { xd_set_err_code(chip, XD_TO_ERROR); } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } old_page++; @@ -1172,14 +1252,17 @@ static int xd_reset_cmd(struct rtsx_chip *chip) rtsx_add_cmd(chip, READ_REG_CMD, XD_CTL, 0, 0); retval = rtsx_send_cmd(chip, XD_CARD, 100); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } ptr = rtsx_get_cmd_data(chip) + 1; if (((ptr[0] & READY_FLAG) == READY_STATE) && (ptr[1] & XD_RDY)) return STATUS_SUCCESS; - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } static int xd_erase_block(struct rtsx_chip *chip, u32 phy_blk) @@ -1189,8 +1272,10 @@ static int xd_erase_block(struct rtsx_chip *chip, u32 phy_blk) u8 reg = 0, *ptr; int i, retval; - if (phy_blk == BLK_NOT_FOUND) - TRACE_RET(chip, STATUS_FAIL); + if (phy_blk == BLK_NOT_FOUND) { + rtsx_trace(chip); + return STATUS_FAIL; + } page_addr = phy_blk << xd_card->block_shift; @@ -1212,13 +1297,16 @@ static int xd_erase_block(struct rtsx_chip *chip, u32 phy_blk) if (reg & PROGRAM_ERROR) { xd_mark_bad_block(chip, phy_blk); xd_set_err_code(chip, XD_PRG_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } else { xd_set_err_code(chip, XD_ERASE_FAIL); } retval = xd_reset_cmd(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } continue; } @@ -1226,7 +1314,8 @@ static int xd_erase_block(struct rtsx_chip *chip, u32 phy_blk) if (*ptr & PROGRAM_ERROR) { xd_mark_bad_block(chip, phy_blk); xd_set_err_code(chip, XD_PRG_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } return STATUS_SUCCESS; @@ -1234,7 +1323,8 @@ static int xd_erase_block(struct rtsx_chip *chip, u32 phy_blk) xd_mark_bad_block(chip, phy_blk); xd_set_err_code(chip, XD_ERASE_FAIL); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } @@ -1266,15 +1356,19 @@ static int xd_build_l2p_tbl(struct rtsx_chip *chip, int zone_no) if (zone->l2p_table == NULL) { zone->l2p_table = vmalloc(2000); - if (zone->l2p_table == NULL) - TRACE_GOTO(chip, Build_Fail); + if (zone->l2p_table == NULL) { + rtsx_trace(chip); + goto Build_Fail; + } } memset((u8 *)(zone->l2p_table), 0xff, 2000); if (zone->free_table == NULL) { zone->free_table = vmalloc(XD_FREE_TABLE_CNT * 2); - if (zone->free_table == NULL) - TRACE_GOTO(chip, Build_Fail); + if (zone->free_table == NULL) { + rtsx_trace(chip); + goto Build_Fail; + } } memset((u8 *)(zone->free_table), 0xff, XD_FREE_TABLE_CNT * 2); @@ -1440,8 +1534,10 @@ static int xd_send_cmd(struct rtsx_chip *chip, u8 cmd) XD_TRANSFER_END, XD_TRANSFER_END); retval = rtsx_send_cmd(chip, XD_CARD, 200); - if (retval < 0) - TRACE_RET(chip, STATUS_FAIL); + if (retval < 0) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } @@ -1457,8 +1553,10 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk, u8 reg_val, page_cnt; int zone_no, retval, i; - if (start_page > end_page) - TRACE_RET(chip, STATUS_FAIL); + if (start_page > end_page) { + rtsx_trace(chip); + return STATUS_FAIL; + } page_cnt = end_page - start_page; zone_no = (int)(log_blk / 1000); @@ -1474,7 +1572,8 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk, if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { xd_set_err_code(chip, XD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } } @@ -1509,9 +1608,11 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk, if (retval == -ETIMEDOUT) { xd_set_err_code(chip, XD_TO_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } else { - TRACE_GOTO(chip, Fail); + rtsx_trace(chip); + goto Fail; } } @@ -1533,7 +1634,8 @@ Fail: if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { xd_set_err_code(chip, XD_NO_CARD); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } xd_set_err_code(chip, XD_ECC_ERROR); @@ -1541,7 +1643,8 @@ Fail: new_blk = xd_get_unused_block(chip, zone_no); if (new_blk == NO_NEW_BLK) { XD_CLR_BAD_OLDBLK(xd_card); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = xd_copy_page(chip, phy_blk, new_blk, 0, @@ -1555,7 +1658,8 @@ Fail: XD_CLR_BAD_NEWBLK(xd_card); } XD_CLR_BAD_OLDBLK(xd_card); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } xd_set_l2p_tbl(chip, zone_no, log_off, (u16)(new_blk & 0x3FF)); xd_erase_block(chip, phy_blk); @@ -1563,7 +1667,8 @@ Fail: XD_CLR_BAD_OLDBLK(xd_card); } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } static int xd_finish_write(struct rtsx_chip *chip, @@ -1576,8 +1681,10 @@ static int xd_finish_write(struct rtsx_chip *chip, dev_dbg(rtsx_dev(chip), "xd_finish_write, old_blk = 0x%x, new_blk = 0x%x, log_blk = 0x%x\n", old_blk, new_blk, log_blk); - if (page_off > xd_card->page_off) - TRACE_RET(chip, STATUS_FAIL); + if (page_off > xd_card->page_off) { + rtsx_trace(chip); + return STATUS_FAIL; + } zone_no = (int)(log_blk / 1000); log_off = (u16)(log_blk % 1000); @@ -1589,7 +1696,8 @@ static int xd_finish_write(struct rtsx_chip *chip, retval = xd_erase_block(chip, new_blk); if (retval == STATUS_SUCCESS) xd_set_unused_block(chip, new_blk); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else { retval = xd_copy_page(chip, old_blk, new_blk, @@ -1601,7 +1709,8 @@ static int xd_finish_write(struct rtsx_chip *chip, xd_set_unused_block(chip, new_blk); } XD_CLR_BAD_NEWBLK(xd_card); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = xd_erase_block(chip, old_blk); @@ -1633,8 +1742,10 @@ static int xd_prepare_write(struct rtsx_chip *chip, if (page_off) { retval = xd_copy_page(chip, old_blk, new_blk, 0, page_off); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1655,8 +1766,10 @@ static int xd_write_multiple_pages(struct rtsx_chip *chip, u32 old_blk, dev_dbg(rtsx_dev(chip), "%s, old_blk = 0x%x, new_blk = 0x%x, log_blk = 0x%x\n", __func__, old_blk, new_blk, log_blk); - if (start_page > end_page) - TRACE_RET(chip, STATUS_FAIL); + if (start_page > end_page) { + rtsx_trace(chip); + return STATUS_FAIL; + } page_cnt = end_page - start_page; zone_no = (int)(log_blk / 1000); @@ -1665,8 +1778,10 @@ static int xd_write_multiple_pages(struct rtsx_chip *chip, u32 old_blk, page_addr = (new_blk << xd_card->block_shift) + start_page; retval = xd_send_cmd(chip, READ1_1); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } rtsx_init_cmd(chip); @@ -1701,9 +1816,11 @@ static int xd_write_multiple_pages(struct rtsx_chip *chip, u32 old_blk, if (retval == -ETIMEDOUT) { xd_set_err_code(chip, XD_TO_ERROR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } else { - TRACE_GOTO(chip, Fail); + rtsx_trace(chip); + goto Fail; } } @@ -1736,7 +1853,8 @@ Fail: xd_mark_bad_block(chip, new_blk); } - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #ifdef XD_DELAY_WRITE @@ -1749,16 +1867,20 @@ int xd_delay_write(struct rtsx_chip *chip) if (delay_write->delay_write_flag) { dev_dbg(rtsx_dev(chip), "xd_delay_write\n"); retval = xd_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } delay_write->delay_write_flag = 0; retval = xd_finish_write(chip, delay_write->old_phyblock, delay_write->new_phyblock, delay_write->logblock, delay_write->pageoff); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } return STATUS_SUCCESS; @@ -1790,14 +1912,17 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, ptr = (u8 *)scsi_sglist(srb); retval = xd_switch_clock(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { chip->card_fail |= XD_CARD; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } log_blk = start_sector >> xd_card->block_shift; @@ -1810,7 +1935,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval != STATUS_SUCCESS) { chip->card_fail |= XD_CARD; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1828,7 +1954,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } old_blk = delay_write->old_phyblock; @@ -1844,7 +1971,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif old_blk = xd_get_l2p_tbl(chip, zone_no, log_off); @@ -1853,7 +1981,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, (new_blk == BLK_NOT_FOUND)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = xd_prepare_write(chip, old_blk, new_blk, @@ -1863,11 +1992,13 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #ifdef XD_DELAY_WRITE } @@ -1879,11 +2010,13 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif @@ -1891,7 +2024,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (old_blk == BLK_NOT_FOUND) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1901,7 +2035,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { chip->card_fail |= XD_CARD; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if ((start_page + total_sec_cnt) > (xd_card->page_off + 1)) @@ -1917,7 +2052,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } else { retval = xd_write_multiple_pages(chip, old_blk, @@ -1927,7 +2063,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (retval != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1948,7 +2085,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, chip->card_fail |= XD_CARD; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1961,7 +2099,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } if (srb->sc_data_direction == DMA_TO_DEVICE) { @@ -1969,7 +2108,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (new_blk == BLK_NOT_FOUND) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } } @@ -1988,7 +2128,8 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { chip->card_fail |= XD_CARD; set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } retval = xd_finish_write(chip, old_blk, new_blk, @@ -1997,10 +2138,12 @@ int xd_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } set_sense_type(chip, lun, SENSE_TYPE_MEDIA_WRITE_ERR); - TRACE_RET(chip, STATUS_FAIL); + rtsx_trace(chip); + return STATUS_FAIL; } #endif } @@ -2049,23 +2192,29 @@ int xd_power_off_card3v3(struct rtsx_chip *chip) int retval; retval = disable_card_clock(chip, XD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } RTSX_WRITE_REG(chip, CARD_OE, XD_OUTPUT_EN, 0); if (!chip->ft2_fast_mode) { retval = card_power_off(chip, XD_CARD); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } wait_timeout(50); } if (chip->asic_code) { retval = xd_pull_ctl_disable(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } } else { RTSX_WRITE_REG(chip, FPGA_PULL_CTL, 0xFF, 0xDF); } @@ -2087,8 +2236,10 @@ int release_xd_card(struct rtsx_chip *chip) xd_free_l2p_tbl(chip); retval = xd_power_off_card3v3(chip); - if (retval != STATUS_SUCCESS) - TRACE_RET(chip, STATUS_FAIL); + if (retval != STATUS_SUCCESS) { + rtsx_trace(chip); + return STATUS_FAIL; + } return STATUS_SUCCESS; } -- cgit v1.2.3 From 8ee775f92c8af2eb1626d39f06feac04fe0cb6e0 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 25 Mar 2015 12:54:26 -0700 Subject: staging: rts5208: Remove RTSX_READ_REG and RTSX_WRITE_REG macros Macros with hidden flow control are bad form as the code path taken can be unexpected for the reader. Expand these in-place and remove the macros. Done with coccinelle script: @@ expression chip; expression arg1; expression arg2; expression arg3; @@ - RTSX_WRITE_REG(chip, arg1, arg2, arg3); + retval = rtsx_write_register(chip, arg1, arg2, arg3); + if (retval) { + rtsx_trace(chip); + return retval; + } @@ expression chip; expression arg1; expression arg2; @@ - RTSX_READ_REG(chip, arg1, arg2); + retval = rtsx_read_register(chip, arg1, arg2); + if (retval) { + rtsx_trace(chip); + return retval; + } Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/ms.c | 250 ++++++++++++--- drivers/staging/rts5208/rtsx_card.c | 96 +++++- drivers/staging/rts5208/rtsx_card.h | 8 +- drivers/staging/rts5208/rtsx_chip.c | 607 +++++++++++++++++++++++++++++------- drivers/staging/rts5208/rtsx_chip.h | 18 -- drivers/staging/rts5208/sd.c | 494 +++++++++++++++++++++++------ drivers/staging/rts5208/spi.c | 117 +++++-- drivers/staging/rts5208/xd.c | 154 +++++++-- 8 files changed, 1410 insertions(+), 334 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c index dcaec195cdcc..ee818b0dc401 100644 --- a/drivers/staging/rts5208/ms.c +++ b/drivers/staging/rts5208/ms.c @@ -169,7 +169,11 @@ static int ms_transfer_data(struct rtsx_chip *chip, u8 trans_mode, return retval; } - RTSX_READ_REG(chip, MS_TRANS_CFG, &val); + retval = rtsx_read_register(chip, MS_TRANS_CFG, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } if (val & (MS_INT_CMDNK | MS_INT_ERR | MS_CRC16_ERR | MS_RDY_TIMEOUT)) { rtsx_trace(chip); return STATUS_FAIL; @@ -424,25 +428,71 @@ static int ms_switch_clock(struct rtsx_chip *chip) static int ms_pull_ctl_disable(struct rtsx_chip *chip) { + int retval; + if (CHECK_PID(chip, 0x5208)) { - RTSX_WRITE_REG(chip, CARD_PULL_CTL1, 0xFF, - MS_D1_PD | MS_D2_PD | MS_CLK_PD | MS_D6_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL2, 0xFF, - MS_D3_PD | MS_D0_PD | MS_BS_PD | XD_D4_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL3, 0xFF, - MS_D7_PD | XD_CE_PD | XD_CLE_PD | XD_CD_PU); - RTSX_WRITE_REG(chip, CARD_PULL_CTL4, 0xFF, - XD_RDY_PD | SD_D3_PD | SD_D2_PD | XD_ALE_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL5, 0xFF, - MS_INS_PU | SD_WP_PD | SD_CD_PU | SD_CMD_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL6, 0xFF, - MS_D5_PD | MS_D4_PD); + retval = rtsx_write_register(chip, CARD_PULL_CTL1, 0xFF, + MS_D1_PD | MS_D2_PD | MS_CLK_PD | MS_D6_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL2, 0xFF, + MS_D3_PD | MS_D0_PD | MS_BS_PD | XD_D4_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL3, 0xFF, + MS_D7_PD | XD_CE_PD | XD_CLE_PD | XD_CD_PU); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL4, 0xFF, + XD_RDY_PD | SD_D3_PD | SD_D2_PD | XD_ALE_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL5, 0xFF, + MS_INS_PU | SD_WP_PD | SD_CD_PU | SD_CMD_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL6, 0xFF, + MS_D5_PD | MS_D4_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } } else if (CHECK_PID(chip, 0x5288)) { if (CHECK_BARO_PKG(chip, QFN)) { - RTSX_WRITE_REG(chip, CARD_PULL_CTL1, 0xFF, 0x55); - RTSX_WRITE_REG(chip, CARD_PULL_CTL2, 0xFF, 0x55); - RTSX_WRITE_REG(chip, CARD_PULL_CTL3, 0xFF, 0x4B); - RTSX_WRITE_REG(chip, CARD_PULL_CTL4, 0xFF, 0x69); + retval = rtsx_write_register(chip, CARD_PULL_CTL1, + 0xFF, 0x55); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL2, + 0xFF, 0x55); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL3, + 0xFF, 0x4B); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL4, + 0xFF, 0x69); + if (retval) { + rtsx_trace(chip); + return retval; + } } } @@ -525,8 +575,12 @@ static int ms_prepare_reset(struct rtsx_chip *chip) return STATUS_FAIL; } } else { - RTSX_WRITE_REG(chip, FPGA_PULL_CTL, - FPGA_MS_PULL_CTL_BIT | 0x20, 0); + retval = rtsx_write_register(chip, FPGA_PULL_CTL, + FPGA_MS_PULL_CTL_BIT | 0x20, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } } if (!chip->ft2_fast_mode) { @@ -553,21 +607,40 @@ static int ms_prepare_reset(struct rtsx_chip *chip) #endif } - RTSX_WRITE_REG(chip, CARD_OE, MS_OUTPUT_EN, MS_OUTPUT_EN); + retval = rtsx_write_register(chip, CARD_OE, MS_OUTPUT_EN, + MS_OUTPUT_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } if (chip->asic_code) { - RTSX_WRITE_REG(chip, MS_CFG, 0xFF, - SAMPLE_TIME_RISING | PUSH_TIME_DEFAULT | - NO_EXTEND_TOGGLE | MS_BUS_WIDTH_1); + retval = rtsx_write_register(chip, MS_CFG, 0xFF, + SAMPLE_TIME_RISING | PUSH_TIME_DEFAULT | NO_EXTEND_TOGGLE | MS_BUS_WIDTH_1); + if (retval) { + rtsx_trace(chip); + return retval; + } } else { - RTSX_WRITE_REG(chip, MS_CFG, 0xFF, - SAMPLE_TIME_FALLING | PUSH_TIME_DEFAULT | - NO_EXTEND_TOGGLE | MS_BUS_WIDTH_1); + retval = rtsx_write_register(chip, MS_CFG, 0xFF, + SAMPLE_TIME_FALLING | PUSH_TIME_DEFAULT | NO_EXTEND_TOGGLE | MS_BUS_WIDTH_1); + if (retval) { + rtsx_trace(chip); + return retval; + } + } + retval = rtsx_write_register(chip, MS_TRANS_CFG, 0xFF, + NO_WAIT_INT | NO_AUTO_READ_INT_REG); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_STOP, MS_STOP | MS_CLR_ERR, + MS_STOP | MS_CLR_ERR); + if (retval) { + rtsx_trace(chip); + return retval; } - RTSX_WRITE_REG(chip, MS_TRANS_CFG, - 0xFF, NO_WAIT_INT | NO_AUTO_READ_INT_REG); - RTSX_WRITE_REG(chip, CARD_STOP, - MS_STOP | MS_CLR_ERR, MS_STOP | MS_CLR_ERR); retval = ms_set_init_para(chip); if (retval != STATUS_SUCCESS) { @@ -601,7 +674,11 @@ static int ms_identify_media_type(struct rtsx_chip *chip, int switch_8bit_bus) return STATUS_FAIL; } - RTSX_READ_REG(chip, PPBUF_BASE2 + 2, &val); + retval = rtsx_read_register(chip, PPBUF_BASE2 + 2, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "Type register: 0x%x\n", val); if (val != 0x01) { if (val != 0x02) @@ -611,7 +688,11 @@ static int ms_identify_media_type(struct rtsx_chip *chip, int switch_8bit_bus) return STATUS_FAIL; } - RTSX_READ_REG(chip, PPBUF_BASE2 + 4, &val); + retval = rtsx_read_register(chip, PPBUF_BASE2 + 4, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "Category register: 0x%x\n", val); if (val != 0) { ms_card->check_ms_flow = 1; @@ -619,10 +700,18 @@ static int ms_identify_media_type(struct rtsx_chip *chip, int switch_8bit_bus) return STATUS_FAIL; } - RTSX_READ_REG(chip, PPBUF_BASE2 + 5, &val); + retval = rtsx_read_register(chip, PPBUF_BASE2 + 5, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "Class register: 0x%x\n", val); if (val == 0) { - RTSX_READ_REG(chip, PPBUF_BASE2, &val); + retval = rtsx_read_register(chip, PPBUF_BASE2, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } if (val & WRT_PRTCT) chip->card_wp |= MS_CARD; else @@ -638,7 +727,11 @@ static int ms_identify_media_type(struct rtsx_chip *chip, int switch_8bit_bus) ms_card->ms_type |= TYPE_MSPRO; - RTSX_READ_REG(chip, PPBUF_BASE2 + 3, &val); + retval = rtsx_read_register(chip, PPBUF_BASE2 + 3, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "IF Mode register: 0x%x\n", val); if (val == 0) { ms_card->ms_type &= 0x0F; @@ -753,8 +846,12 @@ static int ms_switch_8bit_bus(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, MS_CFG, 0x98, - MS_BUS_WIDTH_8 | SAMPLE_TIME_FALLING); + retval = rtsx_write_register(chip, MS_CFG, 0x98, + MS_BUS_WIDTH_8 | SAMPLE_TIME_FALLING); + if (retval) { + rtsx_trace(chip); + return retval; + } ms_card->ms_type |= MS_8BIT; retval = ms_set_init_para(chip); if (retval != STATUS_SUCCESS) { @@ -817,8 +914,17 @@ static int ms_pro_reset_flow(struct rtsx_chip *chip, int switch_8bit_bus) } /* Switch MS-PRO into Parallel mode */ - RTSX_WRITE_REG(chip, MS_CFG, 0x18, MS_BUS_WIDTH_4); - RTSX_WRITE_REG(chip, MS_CFG, PUSH_TIME_ODD, PUSH_TIME_ODD); + retval = rtsx_write_register(chip, MS_CFG, 0x18, MS_BUS_WIDTH_4); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, MS_CFG, PUSH_TIME_ODD, + PUSH_TIME_ODD); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = ms_set_init_para(chip); if (retval != STATUS_SUCCESS) { @@ -872,7 +978,11 @@ static int msxc_change_power(struct rtsx_chip *chip, u8 mode) return STATUS_FAIL; } - RTSX_READ_REG(chip, MS_TRANS_CFG, buf); + retval = rtsx_read_register(chip, MS_TRANS_CFG, buf); + if (retval) { + rtsx_trace(chip); + return retval; + } if (buf[0] & (MS_INT_CMDNK | MS_INT_ERR)) { rtsx_trace(chip); return STATUS_FAIL; @@ -1775,7 +1885,11 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, return STATUS_FAIL; } - RTSX_READ_REG(chip, PPBUF_BASE2, &val); + retval = rtsx_read_register(chip, PPBUF_BASE2, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } if (val & BUF_FULL) { retval = ms_send_cmd(chip, CLEAR_BUF, WAIT_INT); @@ -2070,7 +2184,11 @@ static int reset_ms(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_READ_REG(chip, PPBUF_BASE2, &val); + retval = rtsx_read_register(chip, PPBUF_BASE2, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } if (val & WRT_PRTCT) chip->card_wp |= MS_CARD; else @@ -2238,8 +2356,16 @@ RE_SEARCH: return STATUS_FAIL; } - RTSX_WRITE_REG(chip, PPBUF_BASE2, 0xFF, 0x88); - RTSX_WRITE_REG(chip, PPBUF_BASE2 + 1, 0xFF, 0); + retval = rtsx_write_register(chip, PPBUF_BASE2, 0xFF, 0x88); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, PPBUF_BASE2 + 1, 0xFF, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = ms_transfer_tpc(chip, MS_TM_WRITE_BYTES, WRITE_REG, 1, NO_WAIT_INT); @@ -2248,8 +2374,13 @@ RE_SEARCH: return STATUS_FAIL; } - RTSX_WRITE_REG(chip, MS_CFG, 0x58 | MS_NO_CHECK_INT, - MS_BUS_WIDTH_4 | PUSH_TIME_ODD | MS_NO_CHECK_INT); + retval = rtsx_write_register(chip, MS_CFG, + 0x58 | MS_NO_CHECK_INT, + MS_BUS_WIDTH_4 | PUSH_TIME_ODD | MS_NO_CHECK_INT); + if (retval) { + rtsx_trace(chip); + return retval; + } ms_card->ms_type |= MS_4BIT; } @@ -2869,7 +3000,11 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb, else trans_mode = MS_TM_AUTO_WRITE; - RTSX_READ_REG(chip, MS_TRANS_CFG, &val); + retval = rtsx_read_register(chip, MS_TRANS_CFG, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } if (ms_card->seq_mode) { if ((ms_card->pre_dir != srb->sc_data_direction) @@ -3154,7 +3289,11 @@ int mspro_format(struct scsi_cmnd *srb, struct rtsx_chip *chip, return STATUS_FAIL; } - RTSX_READ_REG(chip, MS_TRANS_CFG, &tmp); + retval = rtsx_read_register(chip, MS_TRANS_CFG, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } if (tmp & (MS_INT_CMDNK | MS_INT_ERR)) { rtsx_trace(chip); @@ -4616,10 +4755,19 @@ int ms_power_off_card3v3(struct rtsx_chip *chip) return STATUS_FAIL; } } else { - RTSX_WRITE_REG(chip, FPGA_PULL_CTL, - FPGA_MS_PULL_CTL_BIT | 0x20, FPGA_MS_PULL_CTL_BIT); + retval = rtsx_write_register(chip, FPGA_PULL_CTL, + FPGA_MS_PULL_CTL_BIT | 0x20, + FPGA_MS_PULL_CTL_BIT); + if (retval) { + rtsx_trace(chip); + return retval; + } + } + retval = rtsx_write_register(chip, CARD_OE, MS_OUTPUT_EN, 0); + if (retval) { + rtsx_trace(chip); + return retval; } - RTSX_WRITE_REG(chip, CARD_OE, MS_OUTPUT_EN, 0); if (!chip->ft2_fast_mode) { retval = card_power_off(chip, MS_CARD); if (retval != STATUS_SUCCESS) { diff --git a/drivers/staging/rts5208/rtsx_card.c b/drivers/staging/rts5208/rtsx_card.c index d7ca44f61447..437436f5dbdd 100644 --- a/drivers/staging/rts5208/rtsx_card.c +++ b/drivers/staging/rts5208/rtsx_card.c @@ -698,7 +698,11 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk) } udelay(10); - RTSX_WRITE_REG(chip, CLK_CTL, CLK_LOW_FREQ, 0); + retval = rtsx_write_register(chip, CLK_CTL, CLK_LOW_FREQ, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->cur_clk = clk; @@ -707,6 +711,7 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk) int switch_normal_clock(struct rtsx_chip *chip, int clk) { + int retval; u8 sel, div, mcu_cnt; int sd_vpclk_phase_reset = 0; @@ -791,23 +796,58 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ); + retval = rtsx_write_register(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ); + if (retval) { + rtsx_trace(chip); + return retval; + } if (sd_vpclk_phase_reset) { - RTSX_WRITE_REG(chip, SD_VPCLK0_CTL, PHASE_NOT_RESET, 0); - RTSX_WRITE_REG(chip, SD_VPCLK1_CTL, PHASE_NOT_RESET, 0); + retval = rtsx_write_register(chip, SD_VPCLK0_CTL, + PHASE_NOT_RESET, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SD_VPCLK1_CTL, + PHASE_NOT_RESET, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + } + retval = rtsx_write_register(chip, CLK_DIV, 0xFF, + (div << 4) | mcu_cnt); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CLK_SEL, 0xFF, sel); + if (retval) { + rtsx_trace(chip); + return retval; } - RTSX_WRITE_REG(chip, CLK_DIV, 0xFF, (div << 4) | mcu_cnt); - RTSX_WRITE_REG(chip, CLK_SEL, 0xFF, sel); if (sd_vpclk_phase_reset) { udelay(200); - RTSX_WRITE_REG(chip, SD_VPCLK0_CTL, PHASE_NOT_RESET, - PHASE_NOT_RESET); - RTSX_WRITE_REG(chip, SD_VPCLK1_CTL, PHASE_NOT_RESET, - PHASE_NOT_RESET); + retval = rtsx_write_register(chip, SD_VPCLK0_CTL, + PHASE_NOT_RESET, PHASE_NOT_RESET); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SD_VPCLK1_CTL, + PHASE_NOT_RESET, PHASE_NOT_RESET); + if (retval) { + rtsx_trace(chip); + return retval; + } udelay(200); } - RTSX_WRITE_REG(chip, CLK_CTL, 0xFF, 0); + retval = rtsx_write_register(chip, CLK_CTL, 0xFF, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->cur_clk = clk; @@ -842,6 +882,7 @@ void trans_dma_enable(enum dma_data_direction dir, struct rtsx_chip *chip, int enable_card_clock(struct rtsx_chip *chip, u8 card) { + int retval; u8 clk_en = 0; if (card & XD_CARD) @@ -851,13 +892,18 @@ int enable_card_clock(struct rtsx_chip *chip, u8 card) if (card & MS_CARD) clk_en |= MS_CLK_EN; - RTSX_WRITE_REG(chip, CARD_CLK_EN, clk_en, clk_en); + retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, clk_en); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } int disable_card_clock(struct rtsx_chip *chip, u8 card) { + int retval; u8 clk_en = 0; if (card & XD_CARD) @@ -867,7 +913,11 @@ int disable_card_clock(struct rtsx_chip *chip, u8 card) if (card & MS_CARD) clk_en |= MS_CLK_EN; - RTSX_WRITE_REG(chip, CARD_CLK_EN, clk_en, 0); + retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -912,6 +962,7 @@ int card_power_on(struct rtsx_chip *chip, u8 card) int card_power_off(struct rtsx_chip *chip, u8 card) { + int retval; u8 mask, val; if (CHECK_LUN_MODE(chip, SD_MS_2LUN) && (card == MS_CARD)) { @@ -922,7 +973,11 @@ int card_power_off(struct rtsx_chip *chip, u8 card) val = SD_POWER_OFF; } - RTSX_WRITE_REG(chip, CARD_PWR_CTL, mask, val); + retval = rtsx_write_register(chip, CARD_PWR_CTL, mask, val); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -972,6 +1027,7 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, int card_share_mode(struct rtsx_chip *chip, int card) { + int retval; u8 mask, value; if (CHECK_PID(chip, 0x5208)) { @@ -1005,7 +1061,11 @@ int card_share_mode(struct rtsx_chip *chip, int card) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CARD_SHARE_MODE, mask, value); + retval = rtsx_write_register(chip, CARD_SHARE_MODE, mask, value); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -1031,7 +1091,11 @@ int select_card(struct rtsx_chip *chip, int card) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CARD_SELECT, 0x07, mod); + retval = rtsx_write_register(chip, CARD_SELECT, 0x07, mod); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->cur_card = card; retval = card_share_mode(chip, card); diff --git a/drivers/staging/rts5208/rtsx_card.h b/drivers/staging/rts5208/rtsx_card.h index 75cf5889bda4..8f2cf9a4ec69 100644 --- a/drivers/staging/rts5208/rtsx_card.h +++ b/drivers/staging/rts5208/rtsx_card.h @@ -1061,7 +1061,13 @@ int card_power_off(struct rtsx_chip *chip, u8 card); static inline int card_power_off_all(struct rtsx_chip *chip) { - RTSX_WRITE_REG(chip, CARD_PWR_CTL, 0x0F, 0x0F); + int retval; + + retval = rtsx_write_register(chip, CARD_PWR_CTL, 0x0F, 0x0F); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c index a8feee846dd3..0c1716ebc827 100644 --- a/drivers/staging/rts5208/rtsx_chip.c +++ b/drivers/staging/rts5208/rtsx_chip.c @@ -116,22 +116,46 @@ void rtsx_disable_bus_int(struct rtsx_chip *chip) static int rtsx_pre_handle_sdio_old(struct rtsx_chip *chip) { + int retval; + if (chip->ignore_sd && CHK_SDIO_EXIST(chip)) { if (chip->asic_code) { - RTSX_WRITE_REG(chip, CARD_PULL_CTL5, 0xFF, - MS_INS_PU | SD_WP_PU | - SD_CD_PU | SD_CMD_PU); + retval = rtsx_write_register(chip, CARD_PULL_CTL5, + 0xFF, + MS_INS_PU | SD_WP_PU | SD_CD_PU | SD_CMD_PU); + if (retval) { + rtsx_trace(chip); + return retval; + } } else { - RTSX_WRITE_REG(chip, FPGA_PULL_CTL, 0xFF, - FPGA_SD_PULL_CTL_EN); + retval = rtsx_write_register(chip, FPGA_PULL_CTL, + 0xFF, + FPGA_SD_PULL_CTL_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } + } + retval = rtsx_write_register(chip, CARD_SHARE_MODE, 0xFF, + CARD_SHARE_48_SD); + if (retval) { + rtsx_trace(chip); + return retval; } - RTSX_WRITE_REG(chip, CARD_SHARE_MODE, 0xFF, CARD_SHARE_48_SD); /* Enable SDIO internal clock */ - RTSX_WRITE_REG(chip, 0xFF2C, 0x01, 0x01); + retval = rtsx_write_register(chip, 0xFF2C, 0x01, 0x01); + if (retval) { + rtsx_trace(chip); + return retval; + } - RTSX_WRITE_REG(chip, SDIO_CTRL, 0xFF, - SDIO_BUS_CTRL | SDIO_CD_CTRL); + retval = rtsx_write_register(chip, SDIO_CTRL, 0xFF, + SDIO_BUS_CTRL | SDIO_CD_CTRL); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->sd_int = 1; chip->sd_io = 1; @@ -151,11 +175,19 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip) if (chip->driver_first_load) { if (CHECK_PID(chip, 0x5288)) { - RTSX_READ_REG(chip, 0xFE5A, &tmp); + retval = rtsx_read_register(chip, 0xFE5A, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } if (tmp & 0x08) sw_bypass_sd = true; } else if (CHECK_PID(chip, 0x5208)) { - RTSX_READ_REG(chip, 0xFE70, &tmp); + retval = rtsx_read_register(chip, 0xFE70, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } if (tmp & 0x80) sw_bypass_sd = true; } @@ -173,17 +205,37 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip) if (sw_bypass_sd) { u8 cd_toggle_mask = 0; - RTSX_READ_REG(chip, TLPTISTAT, &tmp); + retval = rtsx_read_register(chip, TLPTISTAT, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } cd_toggle_mask = 0x08; if (tmp & cd_toggle_mask) { /* Disable sdio_bus_auto_switch */ - if (CHECK_PID(chip, 0x5288)) - RTSX_WRITE_REG(chip, 0xFE5A, 0x08, 0x00); - else if (CHECK_PID(chip, 0x5208)) - RTSX_WRITE_REG(chip, 0xFE70, 0x80, 0x00); + if (CHECK_PID(chip, 0x5288)) { + retval = rtsx_write_register(chip, 0xFE5A, + 0x08, 0x00); + if (retval) { + rtsx_trace(chip); + return retval; + } + } else if (CHECK_PID(chip, 0x5208)) { + retval = rtsx_write_register(chip, 0xFE70, + 0x80, 0x00); + if (retval) { + rtsx_trace(chip); + return retval; + } + } - RTSX_WRITE_REG(chip, TLPTISTAT, 0xFF, tmp); + retval = rtsx_write_register(chip, TLPTISTAT, 0xFF, + tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->need_reset |= SD_CARD; } else { @@ -196,8 +248,14 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip) return STATUS_FAIL; } } else { - RTSX_WRITE_REG(chip, FPGA_PULL_CTL, - FPGA_SD_PULL_CTL_BIT | 0x20, 0); + retval = rtsx_write_register(chip, + FPGA_PULL_CTL, + FPGA_SD_PULL_CTL_BIT | 0x20, + 0); + if (retval) { + rtsx_trace(chip); + return retval; + } } retval = card_share_mode(chip, SD_CARD); if (retval != STATUS_SUCCESS) { @@ -206,16 +264,31 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip) } /* Enable sdio_bus_auto_switch */ - if (CHECK_PID(chip, 0x5288)) - RTSX_WRITE_REG(chip, 0xFE5A, 0x08, 0x08); - else if (CHECK_PID(chip, 0x5208)) - RTSX_WRITE_REG(chip, 0xFE70, 0x80, 0x80); + if (CHECK_PID(chip, 0x5288)) { + retval = rtsx_write_register(chip, 0xFE5A, + 0x08, 0x08); + if (retval) { + rtsx_trace(chip); + return retval; + } + } else if (CHECK_PID(chip, 0x5208)) { + retval = rtsx_write_register(chip, 0xFE70, + 0x80, 0x80); + if (retval) { + rtsx_trace(chip); + return retval; + } + } chip->chip_insert_with_sdio = 1; chip->sd_io = 1; } } else { - RTSX_WRITE_REG(chip, TLPTISTAT, 0x08, 0x08); + retval = rtsx_write_register(chip, TLPTISTAT, 0x08, 0x08); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->need_reset |= SD_CARD; } @@ -242,8 +315,13 @@ static int rtsx_reset_aspm(struct rtsx_chip *chip) return STATUS_SUCCESS; } - if (CHECK_PID(chip, 0x5208)) - RTSX_WRITE_REG(chip, ASPM_FORCE_CTL, 0xFF, 0x3F); + if (CHECK_PID(chip, 0x5208)) { + ret = rtsx_write_register(chip, ASPM_FORCE_CTL, 0xFF, 0x3F); + if (ret) { + rtsx_trace(chip); + return ret; + } + } ret = rtsx_write_config_byte(chip, LCTLR, chip->aspm_l0s_l1_en); if (ret != STATUS_SUCCESS) { rtsx_trace(chip); @@ -276,7 +354,11 @@ static int rtsx_enable_pcie_intr(struct rtsx_chip *chip) } if (chip->phy_debug_mode) { - RTSX_WRITE_REG(chip, CDRESUMECTL, 0x77, 0); + ret = rtsx_write_register(chip, CDRESUMECTL, 0x77, 0); + if (ret) { + rtsx_trace(chip); + return ret; + } rtsx_disable_bus_int(chip); } else { rtsx_enable_bus_int(chip); @@ -327,47 +409,116 @@ int rtsx_reset_chip(struct rtsx_chip *chip) rtsx_disable_aspm(chip); - RTSX_WRITE_REG(chip, HOST_SLEEP_STATE, 0x03, 0x00); + retval = rtsx_write_register(chip, HOST_SLEEP_STATE, 0x03, 0x00); + if (retval) { + rtsx_trace(chip); + return retval; + } /* Disable card clock */ - RTSX_WRITE_REG(chip, CARD_CLK_EN, 0x1E, 0); + retval = rtsx_write_register(chip, CARD_CLK_EN, 0x1E, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } #ifdef SUPPORT_OCP /* SSC power on, OCD power on */ - if (CHECK_LUN_MODE(chip, SD_MS_2LUN)) - RTSX_WRITE_REG(chip, FPDCTL, OC_POWER_DOWN, 0); - else - RTSX_WRITE_REG(chip, FPDCTL, OC_POWER_DOWN, MS_OC_POWER_DOWN); + if (CHECK_LUN_MODE(chip, SD_MS_2LUN)) { + retval = rtsx_write_register(chip, FPDCTL, OC_POWER_DOWN, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + } else { + retval = rtsx_write_register(chip, FPDCTL, OC_POWER_DOWN, + MS_OC_POWER_DOWN); + if (retval) { + rtsx_trace(chip); + return retval; + } + } - RTSX_WRITE_REG(chip, OCPPARA1, OCP_TIME_MASK, OCP_TIME_800); - RTSX_WRITE_REG(chip, OCPPARA2, OCP_THD_MASK, OCP_THD_244_946); - RTSX_WRITE_REG(chip, OCPCTL, 0xFF, CARD_OC_INT_EN | CARD_DETECT_EN); + retval = rtsx_write_register(chip, OCPPARA1, OCP_TIME_MASK, + OCP_TIME_800); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, OCPPARA2, OCP_THD_MASK, + OCP_THD_244_946); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, OCPCTL, 0xFF, + CARD_OC_INT_EN | CARD_DETECT_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } #else /* OC power down */ - RTSX_WRITE_REG(chip, FPDCTL, OC_POWER_DOWN, OC_POWER_DOWN); + retval = rtsx_write_register(chip, FPDCTL, OC_POWER_DOWN, + OC_POWER_DOWN); + if (retval) { + rtsx_trace(chip); + return retval; + } #endif - if (!CHECK_PID(chip, 0x5288)) - RTSX_WRITE_REG(chip, CARD_GPIO_DIR, 0xFF, 0x03); + if (!CHECK_PID(chip, 0x5288)) { + retval = rtsx_write_register(chip, CARD_GPIO_DIR, 0xFF, 0x03); + if (retval) { + rtsx_trace(chip); + return retval; + } + } /* Turn off LED */ - RTSX_WRITE_REG(chip, CARD_GPIO, 0xFF, 0x03); + retval = rtsx_write_register(chip, CARD_GPIO, 0xFF, 0x03); + if (retval) { + rtsx_trace(chip); + return retval; + } /* Reset delink mode */ - RTSX_WRITE_REG(chip, CHANGE_LINK_STATE, 0x0A, 0); + retval = rtsx_write_register(chip, CHANGE_LINK_STATE, 0x0A, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } /* Card driving select */ - RTSX_WRITE_REG(chip, CARD_DRIVE_SEL, 0xFF, chip->card_drive_sel); + retval = rtsx_write_register(chip, CARD_DRIVE_SEL, 0xFF, + chip->card_drive_sel); + if (retval) { + rtsx_trace(chip); + return retval; + } #ifdef LED_AUTO_BLINK - RTSX_WRITE_REG(chip, CARD_AUTO_BLINK, 0xFF, - LED_BLINK_SPEED | BLINK_EN | LED_GPIO0); + retval = rtsx_write_register(chip, CARD_AUTO_BLINK, 0xFF, + LED_BLINK_SPEED | BLINK_EN | LED_GPIO0); + if (retval) { + rtsx_trace(chip); + return retval; + } #endif if (chip->asic_code) { /* Enable SSC Clock */ - RTSX_WRITE_REG(chip, SSC_CTL1, 0xFF, SSC_8X_EN | SSC_SEL_4M); - RTSX_WRITE_REG(chip, SSC_CTL2, 0xFF, 0x12); + retval = rtsx_write_register(chip, SSC_CTL1, 0xFF, + SSC_8X_EN | SSC_SEL_4M); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SSC_CTL2, 0xFF, 0x12); + if (retval) { + rtsx_trace(chip); + return retval; + } } /* Disable cd_pwr_save (u_force_rst_core_en=0, u_cd_rst_core_en=0) @@ -377,7 +528,11 @@ int rtsx_reset_chip(struct rtsx_chip *chip) bit[5] u_mac_phy_rst_n_dbg rst_value = 1 bit[4] u_non_sticky_rst_n_dbg rst_value = 0 */ - RTSX_WRITE_REG(chip, CHANGE_LINK_STATE, 0x16, 0x10); + retval = rtsx_write_register(chip, CHANGE_LINK_STATE, 0x16, 0x10); + if (retval) { + rtsx_trace(chip); + return retval; + } /* Enable ASPM */ if (chip->aspm_l0s_l1_en) { @@ -433,9 +588,18 @@ int rtsx_reset_chip(struct rtsx_chip *chip) } } - RTSX_WRITE_REG(chip, IRQSTAT0, LINK_RDY_INT, LINK_RDY_INT); + retval = rtsx_write_register(chip, IRQSTAT0, LINK_RDY_INT, + LINK_RDY_INT); + if (retval) { + rtsx_trace(chip); + return retval; + } - RTSX_WRITE_REG(chip, PERST_GLITCH_WIDTH, 0xFF, 0x80); + retval = rtsx_write_register(chip, PERST_GLITCH_WIDTH, 0xFF, 0x80); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = rtsx_enable_pcie_intr(chip); if (retval != STATUS_SUCCESS) { @@ -470,8 +634,12 @@ int rtsx_reset_chip(struct rtsx_chip *chip) } else { chip->sd_io = 0; - RTSX_WRITE_REG(chip, SDIO_CTRL, SDIO_BUS_CTRL | SDIO_CD_CTRL, - 0); + retval = rtsx_write_register(chip, SDIO_CTRL, + SDIO_BUS_CTRL | SDIO_CD_CTRL, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } } nextcard: @@ -479,30 +647,68 @@ nextcard: chip->need_reset |= XD_CARD; if (chip->int_reg & MS_EXIST) chip->need_reset |= MS_CARD; - if (chip->int_reg & CARD_EXIST) - RTSX_WRITE_REG(chip, SSC_CTL1, SSC_RSTB, SSC_RSTB); + if (chip->int_reg & CARD_EXIST) { + retval = rtsx_write_register(chip, SSC_CTL1, SSC_RSTB, + SSC_RSTB); + if (retval) { + rtsx_trace(chip); + return retval; + } + } dev_dbg(rtsx_dev(chip), "In %s, chip->need_reset = 0x%x\n", __func__, (unsigned int)(chip->need_reset)); - RTSX_WRITE_REG(chip, RCCTL, 0x01, 0x00); + retval = rtsx_write_register(chip, RCCTL, 0x01, 0x00); + if (retval) { + rtsx_trace(chip); + return retval; + } if (CHECK_PID(chip, 0x5208) || CHECK_PID(chip, 0x5288)) { /* Turn off main power when entering S3/S4 state */ - RTSX_WRITE_REG(chip, MAIN_PWR_OFF_CTL, 0x03, 0x03); + retval = rtsx_write_register(chip, MAIN_PWR_OFF_CTL, 0x03, + 0x03); + if (retval) { + rtsx_trace(chip); + return retval; + } } if (chip->remote_wakeup_en && !chip->auto_delink_en) { - RTSX_WRITE_REG(chip, WAKE_SEL_CTL, 0x07, 0x07); - if (chip->aux_pwr_exist) - RTSX_WRITE_REG(chip, PME_FORCE_CTL, 0xFF, 0x33); + retval = rtsx_write_register(chip, WAKE_SEL_CTL, 0x07, 0x07); + if (retval) { + rtsx_trace(chip); + return retval; + } + if (chip->aux_pwr_exist) { + retval = rtsx_write_register(chip, PME_FORCE_CTL, + 0xFF, 0x33); + if (retval) { + rtsx_trace(chip); + return retval; + } + } } else { - RTSX_WRITE_REG(chip, WAKE_SEL_CTL, 0x07, 0x04); - RTSX_WRITE_REG(chip, PME_FORCE_CTL, 0xFF, 0x30); + retval = rtsx_write_register(chip, WAKE_SEL_CTL, 0x07, 0x04); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, PME_FORCE_CTL, 0xFF, 0x30); + if (retval) { + rtsx_trace(chip); + return retval; + } } - if (CHECK_PID(chip, 0x5208) && (chip->ic_version >= IC_VER_D)) - RTSX_WRITE_REG(chip, PETXCFG, 0x1C, 0x14); + if (CHECK_PID(chip, 0x5208) && (chip->ic_version >= IC_VER_D)) { + retval = rtsx_write_register(chip, PETXCFG, 0x1C, 0x14); + if (retval) { + rtsx_trace(chip); + return retval; + } + } if (chip->asic_code && CHECK_PID(chip, 0x5208)) { retval = rtsx_clr_phy_reg_bit(chip, 0x1C, 2); @@ -513,11 +719,19 @@ nextcard: } if (chip->ft2_fast_mode) { - RTSX_WRITE_REG(chip, CARD_PWR_CTL, 0xFF, - MS_PARTIAL_POWER_ON | SD_PARTIAL_POWER_ON); + retval = rtsx_write_register(chip, CARD_PWR_CTL, 0xFF, + MS_PARTIAL_POWER_ON | SD_PARTIAL_POWER_ON); + if (retval) { + rtsx_trace(chip); + return retval; + } udelay(chip->pmos_pwr_on_interval); - RTSX_WRITE_REG(chip, CARD_PWR_CTL, 0xFF, - MS_POWER_ON | SD_POWER_ON); + retval = rtsx_write_register(chip, CARD_PWR_CTL, 0xFF, + MS_POWER_ON | SD_POWER_ON); + if (retval) { + rtsx_trace(chip); + return retval; + } wait_timeout(200); } @@ -570,8 +784,16 @@ static int rts5208_init(struct rtsx_chip *chip) u16 reg = 0; u8 val = 0; - RTSX_WRITE_REG(chip, CLK_SEL, 0x03, 0x03); - RTSX_READ_REG(chip, CLK_SEL, &val); + retval = rtsx_write_register(chip, CLK_SEL, 0x03, 0x03); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_read_register(chip, CLK_SEL, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->asic_code = val == 0 ? 1 : 0; if (chip->asic_code) { @@ -587,16 +809,28 @@ static int rts5208_init(struct rtsx_chip *chip) chip->phy_debug_mode = reg & PHY_DEBUG_MODE ? 1 : 0; } else { - RTSX_READ_REG(chip, 0xFE80, &val); + retval = rtsx_read_register(chip, 0xFE80, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->ic_version = val; chip->phy_debug_mode = 0; } - RTSX_READ_REG(chip, PDINFO, &val); + retval = rtsx_read_register(chip, PDINFO, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "PDINFO: 0x%x\n", val); chip->aux_pwr_exist = val & AUX_PWR_DETECTED ? 1 : 0; - RTSX_READ_REG(chip, 0xFE50, &val); + retval = rtsx_read_register(chip, 0xFE50, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->hw_bypass_sd = val & 0x01 ? 1 : 0; rtsx_read_config_byte(chip, 0x0E, &val); @@ -606,7 +840,11 @@ static int rts5208_init(struct rtsx_chip *chip) CLR_SDIO_EXIST(chip); if (chip->use_hw_setting) { - RTSX_READ_REG(chip, CHANGE_LINK_STATE, &val); + retval = rtsx_read_register(chip, CHANGE_LINK_STATE, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->auto_delink_en = val & 0x80 ? 1 : 0; } @@ -619,22 +857,42 @@ static int rts5288_init(struct rtsx_chip *chip) u8 val = 0, max_func; u32 lval = 0; - RTSX_WRITE_REG(chip, CLK_SEL, 0x03, 0x03); - RTSX_READ_REG(chip, CLK_SEL, &val); + retval = rtsx_write_register(chip, CLK_SEL, 0x03, 0x03); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_read_register(chip, CLK_SEL, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->asic_code = val == 0 ? 1 : 0; chip->ic_version = 0; chip->phy_debug_mode = 0; - RTSX_READ_REG(chip, PDINFO, &val); + retval = rtsx_read_register(chip, PDINFO, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "PDINFO: 0x%x\n", val); chip->aux_pwr_exist = val & AUX_PWR_DETECTED ? 1 : 0; - RTSX_READ_REG(chip, CARD_SHARE_MODE, &val); + retval = rtsx_read_register(chip, CARD_SHARE_MODE, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "CARD_SHARE_MODE: 0x%x\n", val); chip->baro_pkg = val & 0x04 ? QFN : LQFP; - RTSX_READ_REG(chip, 0xFE5A, &val); + retval = rtsx_read_register(chip, 0xFE5A, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->hw_bypass_sd = val & 0x10 ? 1 : 0; retval = rtsx_read_cfg_dw(chip, 0, 0x718, &lval); @@ -651,7 +909,11 @@ static int rts5288_init(struct rtsx_chip *chip) CLR_SDIO_EXIST(chip); if (chip->use_hw_setting) { - RTSX_READ_REG(chip, CHANGE_LINK_STATE, &val); + retval = rtsx_read_register(chip, CHANGE_LINK_STATE, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->auto_delink_en = val & 0x80 ? 1 : 0; if (CHECK_BARO_PKG(chip, LQFP)) @@ -730,9 +992,17 @@ int rtsx_init_chip(struct rtsx_chip *chip) if ((chip->mmc_ddr_tx_phase > 31) || (chip->mmc_ddr_tx_phase < 0)) chip->mmc_ddr_tx_phase = 0; - RTSX_WRITE_REG(chip, FPDCTL, SSC_POWER_DOWN, 0); + retval = rtsx_write_register(chip, FPDCTL, SSC_POWER_DOWN, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } wait_timeout(200); - RTSX_WRITE_REG(chip, CLK_DIV, 0x07, 0x07); + retval = rtsx_write_register(chip, CLK_DIV, 0x07, 0x07); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "chip->use_hw_setting = %d\n", chip->use_hw_setting); @@ -1241,13 +1511,19 @@ int rtsx_read_register(struct rtsx_chip *chip, u16 addr, u8 *data) int rtsx_write_cfg_dw(struct rtsx_chip *chip, u8 func_no, u16 addr, u32 mask, u32 val) { + int retval; u8 mode = 0, tmp; int i; for (i = 0; i < 4; i++) { if (mask & 0xFF) { - RTSX_WRITE_REG(chip, CFGDATA0 + i, - 0xFF, (u8)(val & mask & 0xFF)); + retval = rtsx_write_register(chip, CFGDATA0 + i, + 0xFF, + (u8)(val & mask & 0xFF)); + if (retval) { + rtsx_trace(chip); + return retval; + } mode |= (1 << i); } mask >>= 8; @@ -1255,14 +1531,31 @@ int rtsx_write_cfg_dw(struct rtsx_chip *chip, u8 func_no, u16 addr, u32 mask, } if (mode) { - RTSX_WRITE_REG(chip, CFGADDR0, 0xFF, (u8)addr); - RTSX_WRITE_REG(chip, CFGADDR1, 0xFF, (u8)(addr >> 8)); + retval = rtsx_write_register(chip, CFGADDR0, 0xFF, (u8)addr); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CFGADDR1, 0xFF, + (u8)(addr >> 8)); + if (retval) { + rtsx_trace(chip); + return retval; + } - RTSX_WRITE_REG(chip, CFGRWCTL, 0xFF, - 0x80 | mode | ((func_no & 0x03) << 4)); + retval = rtsx_write_register(chip, CFGRWCTL, 0xFF, + 0x80 | mode | ((func_no & 0x03) << 4)); + if (retval) { + rtsx_trace(chip); + return retval; + } for (i = 0; i < MAX_RW_REG_CNT; i++) { - RTSX_READ_REG(chip, CFGRWCTL, &tmp); + retval = rtsx_read_register(chip, CFGRWCTL, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } if ((tmp & 0x80) == 0) break; } @@ -1273,22 +1566,44 @@ int rtsx_write_cfg_dw(struct rtsx_chip *chip, u8 func_no, u16 addr, u32 mask, int rtsx_read_cfg_dw(struct rtsx_chip *chip, u8 func_no, u16 addr, u32 *val) { + int retval; int i; u8 tmp; u32 data = 0; - RTSX_WRITE_REG(chip, CFGADDR0, 0xFF, (u8)addr); - RTSX_WRITE_REG(chip, CFGADDR1, 0xFF, (u8)(addr >> 8)); - RTSX_WRITE_REG(chip, CFGRWCTL, 0xFF, 0x80 | ((func_no & 0x03) << 4)); + retval = rtsx_write_register(chip, CFGADDR0, 0xFF, (u8)addr); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CFGADDR1, 0xFF, (u8)(addr >> 8)); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CFGRWCTL, 0xFF, + 0x80 | ((func_no & 0x03) << 4)); + if (retval) { + rtsx_trace(chip); + return retval; + } for (i = 0; i < MAX_RW_REG_CNT; i++) { - RTSX_READ_REG(chip, CFGRWCTL, &tmp); + retval = rtsx_read_register(chip, CFGRWCTL, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } if ((tmp & 0x80) == 0) break; } for (i = 0; i < 4; i++) { - RTSX_READ_REG(chip, CFGDATA0 + i, &tmp); + retval = rtsx_read_register(chip, CFGDATA0 + i, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } data |= (u32)tmp << (i * 8); } @@ -1415,17 +1730,38 @@ int rtsx_read_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, int rtsx_write_phy_register(struct rtsx_chip *chip, u8 addr, u16 val) { + int retval; bool finished = false; int i; u8 tmp; - RTSX_WRITE_REG(chip, PHYDATA0, 0xFF, (u8)val); - RTSX_WRITE_REG(chip, PHYDATA1, 0xFF, (u8)(val >> 8)); - RTSX_WRITE_REG(chip, PHYADDR, 0xFF, addr); - RTSX_WRITE_REG(chip, PHYRWCTL, 0xFF, 0x81); + retval = rtsx_write_register(chip, PHYDATA0, 0xFF, (u8)val); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, PHYDATA1, 0xFF, (u8)(val >> 8)); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, PHYADDR, 0xFF, addr); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, PHYRWCTL, 0xFF, 0x81); + if (retval) { + rtsx_trace(chip); + return retval; + } for (i = 0; i < 100000; i++) { - RTSX_READ_REG(chip, PHYRWCTL, &tmp); + retval = rtsx_read_register(chip, PHYRWCTL, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } if (!(tmp & 0x80)) { finished = true; break; @@ -1442,16 +1778,29 @@ int rtsx_write_phy_register(struct rtsx_chip *chip, u8 addr, u16 val) int rtsx_read_phy_register(struct rtsx_chip *chip, u8 addr, u16 *val) { + int retval; bool finished = false; int i; u16 data = 0; u8 tmp; - RTSX_WRITE_REG(chip, PHYADDR, 0xFF, addr); - RTSX_WRITE_REG(chip, PHYRWCTL, 0xFF, 0x80); + retval = rtsx_write_register(chip, PHYADDR, 0xFF, addr); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, PHYRWCTL, 0xFF, 0x80); + if (retval) { + rtsx_trace(chip); + return retval; + } for (i = 0; i < 100000; i++) { - RTSX_READ_REG(chip, PHYRWCTL, &tmp); + retval = rtsx_read_register(chip, PHYRWCTL, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } if (!(tmp & 0x80)) { finished = true; break; @@ -1463,9 +1812,17 @@ int rtsx_read_phy_register(struct rtsx_chip *chip, u8 addr, u16 *val) return STATUS_FAIL; } - RTSX_READ_REG(chip, PHYDATA0, &tmp); + retval = rtsx_read_register(chip, PHYDATA0, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } data = tmp; - RTSX_READ_REG(chip, PHYDATA1, &tmp); + retval = rtsx_read_register(chip, PHYDATA1, &tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } data |= (u16)tmp << 8; if (val) @@ -1476,13 +1833,22 @@ int rtsx_read_phy_register(struct rtsx_chip *chip, u8 addr, u16 *val) int rtsx_read_efuse(struct rtsx_chip *chip, u8 addr, u8 *val) { + int retval; int i; u8 data = 0; - RTSX_WRITE_REG(chip, EFUSE_CTRL, 0xFF, 0x80|addr); + retval = rtsx_write_register(chip, EFUSE_CTRL, 0xFF, 0x80 | addr); + if (retval) { + rtsx_trace(chip); + return retval; + } for (i = 0; i < 100; i++) { - RTSX_READ_REG(chip, EFUSE_CTRL, &data); + retval = rtsx_read_register(chip, EFUSE_CTRL, &data); + if (retval) { + rtsx_trace(chip); + return retval; + } if (!(data & 0x80)) break; udelay(1); @@ -1493,7 +1859,11 @@ int rtsx_read_efuse(struct rtsx_chip *chip, u8 addr, u8 *val) return STATUS_TIMEDOUT; } - RTSX_READ_REG(chip, EFUSE_DATA, &data); + retval = rtsx_read_register(chip, EFUSE_DATA, &data); + if (retval) { + rtsx_trace(chip); + return retval; + } if (val) *val = data; @@ -1502,6 +1872,7 @@ int rtsx_read_efuse(struct rtsx_chip *chip, u8 addr, u8 *val) int rtsx_write_efuse(struct rtsx_chip *chip, u8 addr, u8 val) { + int retval; int i, j; u8 data = 0, tmp = 0xFF; @@ -1512,11 +1883,24 @@ int rtsx_write_efuse(struct rtsx_chip *chip, u8 addr, u8 val) tmp &= (~(u8)(1 << i)); dev_dbg(rtsx_dev(chip), "Write 0x%x to 0x%x\n", tmp, addr); - RTSX_WRITE_REG(chip, EFUSE_DATA, 0xFF, tmp); - RTSX_WRITE_REG(chip, EFUSE_CTRL, 0xFF, 0xA0|addr); + retval = rtsx_write_register(chip, EFUSE_DATA, 0xFF, tmp); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, EFUSE_CTRL, 0xFF, + 0xA0 | addr); + if (retval) { + rtsx_trace(chip); + return retval; + } for (j = 0; j < 100; j++) { - RTSX_READ_REG(chip, EFUSE_CTRL, &data); + retval = rtsx_read_register(chip, EFUSE_CTRL, &data); + if (retval) { + rtsx_trace(chip); + return retval; + } if (!(data & 0x80)) break; wait_timeout(3); @@ -1581,9 +1965,14 @@ int rtsx_set_phy_reg_bit(struct rtsx_chip *chip, u8 reg, u8 bit) int rtsx_check_link_ready(struct rtsx_chip *chip) { + int retval; u8 val; - RTSX_READ_REG(chip, IRQSTAT0, &val); + retval = rtsx_read_register(chip, IRQSTAT0, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "IRQSTAT0: 0x%x\n", val); if (val & LINK_RDY_INT) { diff --git a/drivers/staging/rts5208/rtsx_chip.h b/drivers/staging/rts5208/rtsx_chip.h index 93fd7b286f49..c295b1eedb44 100644 --- a/drivers/staging/rts5208/rtsx_chip.h +++ b/drivers/staging/rts5208/rtsx_chip.h @@ -988,22 +988,4 @@ int rtsx_read_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len); int rtsx_write_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len); int rtsx_check_chip_exist(struct rtsx_chip *chip); -#define RTSX_WRITE_REG(chip, addr, mask, data) \ -do { \ - int retval = rtsx_write_register(chip, addr, mask, data); \ - if (retval != STATUS_SUCCESS) { \ - rtsx_trace(chip); \ - return retval; \ - } \ -} while (0) - -#define RTSX_READ_REG(chip, addr, data) \ -do { \ - int retval = rtsx_read_register(chip, addr, data); \ - if (retval != STATUS_SUCCESS) { \ - rtsx_trace(chip); \ - return retval; \ - } \ -} while (0) - #endif /* __REALTEK_RTSX_CHIP_H */ diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index 0eee67642e45..a8d657bb5c1b 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -105,9 +105,14 @@ static void sd_init_reg_addr(struct rtsx_chip *chip) static int sd_check_data0_status(struct rtsx_chip *chip) { + int retval; u8 stat; - RTSX_READ_REG(chip, REG_SD_STAT1, &stat); + retval = rtsx_read_register(chip, REG_SD_STAT1, &stat); + if (retval) { + rtsx_trace(chip); + return retval; + } if (!(stat & SD_DAT0_STATUS)) { sd_set_err_code(chip, SD_BUSY); @@ -529,8 +534,8 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp) static int sd_set_sample_push_timing(struct rtsx_chip *chip) { + int retval; struct sd_info *sd_card = &(chip->sd_card); - u8 val = 0; if ((chip->sd_ctl & SD_PUSH_POINT_CTL_MASK) == SD_PUSH_POINT_DELAY) @@ -558,7 +563,11 @@ static int sd_set_sample_push_timing(struct rtsx_chip *chip) val |= 0x08; } - RTSX_WRITE_REG(chip, REG_SD_CFG1, 0x1C, val); + retval = rtsx_write_register(chip, REG_SD_CFG1, 0x1C, val); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -607,6 +616,7 @@ static void sd_choose_proper_clock(struct rtsx_chip *chip) static int sd_set_clock_divider(struct rtsx_chip *chip, u8 clk_div) { + int retval; u8 mask = 0, val = 0; mask = 0x60; @@ -617,7 +627,11 @@ static int sd_set_clock_divider(struct rtsx_chip *chip, u8 clk_div) else if (clk_div == SD_CLK_DIVIDE_256) val = 0x20; - RTSX_WRITE_REG(chip, REG_SD_CFG1, mask, val); + retval = rtsx_write_register(chip, REG_SD_CFG1, mask, val); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -740,7 +754,12 @@ static int sd_change_bank_voltage(struct rtsx_chip *chip, u8 voltage) return STATUS_FAIL; } } else { - RTSX_WRITE_REG(chip, SD_PAD_CTL, SD_IO_USING_1V8, 0); + retval = rtsx_write_register(chip, SD_PAD_CTL, + SD_IO_USING_1V8, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } } } else if (voltage == SD_IO_1V8) { if (chip->asic_code) { @@ -752,8 +771,13 @@ static int sd_change_bank_voltage(struct rtsx_chip *chip, u8 voltage) return STATUS_FAIL; } } else { - RTSX_WRITE_REG(chip, SD_PAD_CTL, SD_IO_USING_1V8, - SD_IO_USING_1V8); + retval = rtsx_write_register(chip, SD_PAD_CTL, + SD_IO_USING_1V8, + SD_IO_USING_1V8); + if (retval) { + rtsx_trace(chip); + return retval; + } } } else { rtsx_trace(chip); @@ -768,8 +792,13 @@ static int sd_voltage_switch(struct rtsx_chip *chip) int retval; u8 stat; - RTSX_WRITE_REG(chip, SD_BUS_STAT, SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, - SD_CLK_TOGGLE_EN); + retval = rtsx_write_register(chip, SD_BUS_STAT, + SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, + SD_CLK_TOGGLE_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = sd_send_cmd_get_rsp(chip, VOLTAGE_SWITCH, 0, SD_RSP_TYPE_R1, NULL, 0); @@ -780,14 +809,23 @@ static int sd_voltage_switch(struct rtsx_chip *chip) udelay(chip->sd_voltage_switch_delay); - RTSX_READ_REG(chip, SD_BUS_STAT, &stat); + retval = rtsx_read_register(chip, SD_BUS_STAT, &stat); + if (retval) { + rtsx_trace(chip); + return retval; + } if (stat & (SD_CMD_STATUS | SD_DAT3_STATUS | SD_DAT2_STATUS | SD_DAT1_STATUS | SD_DAT0_STATUS)) { rtsx_trace(chip); return STATUS_FAIL; } - RTSX_WRITE_REG(chip, SD_BUS_STAT, 0xFF, SD_CLK_FORCE_STOP); + retval = rtsx_write_register(chip, SD_BUS_STAT, 0xFF, + SD_CLK_FORCE_STOP); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = sd_change_bank_voltage(chip, SD_IO_1V8); if (retval != STATUS_SUCCESS) { rtsx_trace(chip); @@ -796,10 +834,19 @@ static int sd_voltage_switch(struct rtsx_chip *chip) wait_timeout(50); - RTSX_WRITE_REG(chip, SD_BUS_STAT, 0xFF, SD_CLK_TOGGLE_EN); + retval = rtsx_write_register(chip, SD_BUS_STAT, 0xFF, + SD_CLK_TOGGLE_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } wait_timeout(10); - RTSX_READ_REG(chip, SD_BUS_STAT, &stat); + retval = rtsx_read_register(chip, SD_BUS_STAT, &stat); + if (retval) { + rtsx_trace(chip); + return retval; + } if ((stat & (SD_CMD_STATUS | SD_DAT3_STATUS | SD_DAT2_STATUS | SD_DAT1_STATUS | SD_DAT0_STATUS)) != (SD_CMD_STATUS | SD_DAT3_STATUS | SD_DAT2_STATUS | @@ -812,20 +859,44 @@ static int sd_voltage_switch(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, SD_BUS_STAT, SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, - 0); + retval = rtsx_write_register(chip, SD_BUS_STAT, + SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } static int sd_reset_dcm(struct rtsx_chip *chip, u8 tune_dir) { + int retval; + if (tune_dir == TUNE_RX) { - RTSX_WRITE_REG(chip, DCM_DRP_CTL, 0xFF, DCM_RESET | DCM_RX); - RTSX_WRITE_REG(chip, DCM_DRP_CTL, 0xFF, DCM_RX); + retval = rtsx_write_register(chip, DCM_DRP_CTL, 0xFF, + DCM_RESET | DCM_RX); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, DCM_DRP_CTL, 0xFF, DCM_RX); + if (retval) { + rtsx_trace(chip); + return retval; + } } else { - RTSX_WRITE_REG(chip, DCM_DRP_CTL, 0xFF, DCM_RESET | DCM_TX); - RTSX_WRITE_REG(chip, DCM_DRP_CTL, 0xFF, DCM_TX); + retval = rtsx_write_register(chip, DCM_DRP_CTL, 0xFF, + DCM_RESET | DCM_TX); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, DCM_DRP_CTL, 0xFF, DCM_TX); + if (retval) { + rtsx_trace(chip); + return retval; + } } return STATUS_SUCCESS; @@ -853,12 +924,35 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) } if (chip->asic_code) { - RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, CHANGE_CLK); - RTSX_WRITE_REG(chip, SD_VP_CTL, 0x1F, sample_point); - RTSX_WRITE_REG(chip, SD_VPCLK0_CTL, PHASE_NOT_RESET, 0); - RTSX_WRITE_REG(chip, SD_VPCLK0_CTL, PHASE_NOT_RESET, - PHASE_NOT_RESET); - RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, 0); + retval = rtsx_write_register(chip, CLK_CTL, CHANGE_CLK, + CHANGE_CLK); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SD_VP_CTL, 0x1F, + sample_point); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SD_VPCLK0_CTL, + PHASE_NOT_RESET, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SD_VPCLK0_CTL, + PHASE_NOT_RESET, PHASE_NOT_RESET); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CLK_CTL, CHANGE_CLK, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } } else { rtsx_read_register(chip, SD_VP_CTL, &val); dev_dbg(rtsx_dev(chip), "SD_VP_CTL: 0x%x\n", val); @@ -866,16 +960,34 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) dev_dbg(rtsx_dev(chip), "SD_DCMPS_CTL: 0x%x\n", val); if (ddr_rx) { - RTSX_WRITE_REG(chip, SD_VP_CTL, PHASE_CHANGE, - PHASE_CHANGE); + retval = rtsx_write_register(chip, SD_VP_CTL, + PHASE_CHANGE, + PHASE_CHANGE); + if (retval) { + rtsx_trace(chip); + return retval; + } udelay(50); - RTSX_WRITE_REG(chip, SD_VP_CTL, 0xFF, - PHASE_CHANGE | PHASE_NOT_RESET | sample_point); + retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF, + PHASE_CHANGE | PHASE_NOT_RESET | sample_point); + if (retval) { + rtsx_trace(chip); + return retval; + } } else { - RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, CHANGE_CLK); + retval = rtsx_write_register(chip, CLK_CTL, + CHANGE_CLK, CHANGE_CLK); + if (retval) { + rtsx_trace(chip); + return retval; + } udelay(50); - RTSX_WRITE_REG(chip, SD_VP_CTL, 0xFF, - PHASE_NOT_RESET | sample_point); + retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF, + PHASE_NOT_RESET | sample_point); + if (retval) { + rtsx_trace(chip); + return retval; + } } udelay(100); @@ -901,16 +1013,36 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) goto Fail; } - RTSX_WRITE_REG(chip, SD_DCMPS_CTL, DCMPS_CHANGE, 0); - if (ddr_rx) - RTSX_WRITE_REG(chip, SD_VP_CTL, PHASE_CHANGE, 0); - else - RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, 0); + retval = rtsx_write_register(chip, SD_DCMPS_CTL, + DCMPS_CHANGE, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + if (ddr_rx) { + retval = rtsx_write_register(chip, SD_VP_CTL, + PHASE_CHANGE, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + } else { + retval = rtsx_write_register(chip, CLK_CTL, + CHANGE_CLK, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + } udelay(50); } - RTSX_WRITE_REG(chip, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0); + retval = rtsx_write_register(chip, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; @@ -1160,10 +1292,20 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode, } if ((cc > 400) || (func_to_switch > CURRENT_LIMIT_400)) { - RTSX_WRITE_REG(chip, OCPPARA2, SD_OCP_THD_MASK, - chip->sd_800mA_ocp_thd); - RTSX_WRITE_REG(chip, CARD_PWR_CTL, PMOS_STRG_MASK, - PMOS_STRG_800mA); + retval = rtsx_write_register(chip, OCPPARA2, + SD_OCP_THD_MASK, + chip->sd_800mA_ocp_thd); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PWR_CTL, + PMOS_STRG_MASK, + PMOS_STRG_800mA); + if (retval) { + rtsx_trace(chip); + return retval; + } } } @@ -1210,7 +1352,11 @@ static int sd_check_switch(struct rtsx_chip *chip, break; } - RTSX_READ_REG(chip, SD_STAT1, &stat); + retval = rtsx_read_register(chip, SD_STAT1, &stat); + if (retval) { + rtsx_trace(chip); + return retval; + } if (stat & SD_CRC16_ERR) { dev_dbg(rtsx_dev(chip), "SD CRC16 error when switching mode\n"); rtsx_trace(chip); @@ -1328,7 +1474,12 @@ static int sd_switch_function(struct rtsx_chip *chip, u8 bus_width) } if (CHK_SD_DDR50(sd_card)) { - RTSX_WRITE_REG(chip, SD_PUSH_POINT_CTL, 0x06, 0x04); + retval = rtsx_write_register(chip, SD_PUSH_POINT_CTL, 0x06, + 0x04); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = sd_set_sample_push_timing(chip); if (retval != STATUS_SUCCESS) { rtsx_trace(chip); @@ -1396,8 +1547,13 @@ static int sd_switch_function(struct rtsx_chip *chip, u8 bus_width) retval); } - if (CHK_SD_DDR50(sd_card)) - RTSX_WRITE_REG(chip, SD_PUSH_POINT_CTL, 0x06, 0); + if (CHK_SD_DDR50(sd_card)) { + retval = rtsx_write_register(chip, SD_PUSH_POINT_CTL, 0x06, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + } return STATUS_SUCCESS; } @@ -1409,7 +1565,11 @@ static int sd_wait_data_idle(struct rtsx_chip *chip) u8 val = 0; for (i = 0; i < 100; i++) { - RTSX_READ_REG(chip, SD_DATA_STATE, &val); + retval = rtsx_read_register(chip, SD_DATA_STATE, &val); + if (retval) { + rtsx_trace(chip); + return retval; + } if (val & SD_DATA_IDLE) { retval = STATUS_SUCCESS; break; @@ -1542,8 +1702,12 @@ static int sd_sdr_tuning_tx_cmd(struct rtsx_chip *chip, u8 sample_point) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, - SD_RSP_80CLK_TIMEOUT_EN); + retval = rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, + SD_RSP_80CLK_TIMEOUT_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); @@ -1556,7 +1720,12 @@ static int sd_sdr_tuning_tx_cmd(struct rtsx_chip *chip, u8 sample_point) } } - RTSX_WRITE_REG(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, 0); + retval = rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, + 0); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -1590,8 +1759,12 @@ static int sd_ddr_tuning_tx_cmd(struct rtsx_chip *chip, u8 sample_point) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, - SD_RSP_80CLK_TIMEOUT_EN); + retval = rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, + SD_RSP_80CLK_TIMEOUT_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } cmd[0] = 0x40 | PROGRAM_CSD; cmd[1] = 0; @@ -1608,7 +1781,12 @@ static int sd_ddr_tuning_tx_cmd(struct rtsx_chip *chip, u8 sample_point) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, 0); + retval = rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, + 0); + if (retval) { + rtsx_trace(chip); + return retval; + } sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr, SD_RSP_TYPE_R1, NULL, 0); @@ -1804,8 +1982,12 @@ static int sd_ddr_pre_tuning_tx(struct rtsx_chip *chip) u32 phase_map; u8 final_phase; - RTSX_WRITE_REG(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, - SD_RSP_80CLK_TIMEOUT_EN); + retval = rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, + SD_RSP_80CLK_TIMEOUT_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } phase_map = 0; for (i = MAX_PHASE; i >= 0; i--) { @@ -1829,7 +2011,12 @@ static int sd_ddr_pre_tuning_tx(struct rtsx_chip *chip) phase_map |= 1 << i; } - RTSX_WRITE_REG(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, 0); + retval = rtsx_write_register(chip, SD_CFG3, SD_RSP_80CLK_TIMEOUT_EN, + 0); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "DDR TX pre tune phase_map = 0x%08x\n", phase_map); @@ -2073,10 +2260,18 @@ static int sd_prepare_reset(struct rtsx_chip *chip) return retval; } - RTSX_WRITE_REG(chip, REG_SD_CFG1, 0xFF, 0x40); + retval = rtsx_write_register(chip, REG_SD_CFG1, 0xFF, 0x40); + if (retval) { + rtsx_trace(chip); + return retval; + } - RTSX_WRITE_REG(chip, CARD_STOP, SD_STOP | SD_CLR_ERR, - SD_STOP | SD_CLR_ERR); + retval = rtsx_write_register(chip, CARD_STOP, SD_STOP | SD_CLR_ERR, + SD_STOP | SD_CLR_ERR); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = select_card(chip, SD_CARD); if (retval != STATUS_SUCCESS) { @@ -2089,24 +2284,71 @@ static int sd_prepare_reset(struct rtsx_chip *chip) static int sd_pull_ctl_disable(struct rtsx_chip *chip) { + int retval; + if (CHECK_PID(chip, 0x5208)) { - RTSX_WRITE_REG(chip, CARD_PULL_CTL1, 0xFF, - XD_D3_PD | SD_D7_PD | SD_CLK_PD | SD_D5_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL2, 0xFF, - SD_D6_PD | SD_D0_PD | SD_D1_PD | XD_D5_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL3, 0xFF, - SD_D4_PD | XD_CE_PD | XD_CLE_PD | XD_CD_PU); - RTSX_WRITE_REG(chip, CARD_PULL_CTL4, 0xFF, - XD_RDY_PD | SD_D3_PD | SD_D2_PD | XD_ALE_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL5, 0xFF, - MS_INS_PU | SD_WP_PD | SD_CD_PU | SD_CMD_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL6, 0xFF, MS_D5_PD | MS_D4_PD); + retval = rtsx_write_register(chip, CARD_PULL_CTL1, 0xFF, + XD_D3_PD | SD_D7_PD | SD_CLK_PD | SD_D5_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL2, 0xFF, + SD_D6_PD | SD_D0_PD | SD_D1_PD | XD_D5_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL3, 0xFF, + SD_D4_PD | XD_CE_PD | XD_CLE_PD | XD_CD_PU); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL4, 0xFF, + XD_RDY_PD | SD_D3_PD | SD_D2_PD | XD_ALE_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL5, 0xFF, + MS_INS_PU | SD_WP_PD | SD_CD_PU | SD_CMD_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL6, 0xFF, + MS_D5_PD | MS_D4_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } } else if (CHECK_PID(chip, 0x5288)) { if (CHECK_BARO_PKG(chip, QFN)) { - RTSX_WRITE_REG(chip, CARD_PULL_CTL1, 0xFF, 0x55); - RTSX_WRITE_REG(chip, CARD_PULL_CTL2, 0xFF, 0x55); - RTSX_WRITE_REG(chip, CARD_PULL_CTL3, 0xFF, 0x4B); - RTSX_WRITE_REG(chip, CARD_PULL_CTL4, 0xFF, 0x69); + retval = rtsx_write_register(chip, CARD_PULL_CTL1, + 0xFF, 0x55); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL2, + 0xFF, 0x55); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL3, + 0xFF, 0x4B); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL4, + 0xFF, 0x69); + if (retval) { + rtsx_trace(chip); + return retval; + } } } @@ -2180,8 +2422,12 @@ static int sd_init_power(struct rtsx_chip *chip) return STATUS_FAIL; } } else { - RTSX_WRITE_REG(chip, FPGA_PULL_CTL, FPGA_SD_PULL_CTL_BIT | 0x20, - 0); + retval = rtsx_write_register(chip, FPGA_PULL_CTL, + FPGA_SD_PULL_CTL_BIT | 0x20, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } } if (!chip->ft2_fast_mode) { @@ -2203,16 +2449,31 @@ static int sd_init_power(struct rtsx_chip *chip) #endif } - RTSX_WRITE_REG(chip, CARD_OE, SD_OUTPUT_EN, SD_OUTPUT_EN); + retval = rtsx_write_register(chip, CARD_OE, SD_OUTPUT_EN, + SD_OUTPUT_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } static int sd_dummy_clock(struct rtsx_chip *chip) { - RTSX_WRITE_REG(chip, REG_SD_CFG3, 0x01, 0x01); + int retval; + + retval = rtsx_write_register(chip, REG_SD_CFG3, 0x01, 0x01); + if (retval) { + rtsx_trace(chip); + return retval; + } wait_timeout(5); - RTSX_WRITE_REG(chip, REG_SD_CFG3, 0x01, 0); + retval = rtsx_write_register(chip, REG_SD_CFG3, 0x01, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -2622,8 +2883,12 @@ SD_UNLOCK_ENTRY: if (!sd20_mode && CHK_SD30_SPEED(sd_card)) { int read_lba0 = 1; - RTSX_WRITE_REG(chip, SD30_DRIVE_SEL, 0x07, - chip->sd30_drive_sel_1v8); + retval = rtsx_write_register(chip, SD30_DRIVE_SEL, 0x07, + chip->sd30_drive_sel_1v8); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = sd_set_init_para(chip); if (retval != STATUS_SUCCESS) { @@ -2693,8 +2958,18 @@ SD_UNLOCK_ENTRY: #ifdef SUPPORT_SD_LOCK if (sd_card->sd_lock_status & SD_UNLOCK_POW_ON) { - RTSX_WRITE_REG(chip, REG_SD_BLOCK_CNT_H, 0xFF, 0x02); - RTSX_WRITE_REG(chip, REG_SD_BLOCK_CNT_L, 0xFF, 0x00); + retval = rtsx_write_register(chip, REG_SD_BLOCK_CNT_H, 0xFF, + 0x02); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, REG_SD_BLOCK_CNT_L, 0xFF, + 0x00); + if (retval) { + rtsx_trace(chip); + return retval; + } } #endif @@ -3149,8 +3424,18 @@ MMC_UNLOCK_ENTRY: #ifdef SUPPORT_SD_LOCK if (sd_card->sd_lock_status & SD_UNLOCK_POW_ON) { - RTSX_WRITE_REG(chip, REG_SD_BLOCK_CNT_H, 0xFF, 0x02); - RTSX_WRITE_REG(chip, REG_SD_BLOCK_CNT_L, 0xFF, 0x00); + retval = rtsx_write_register(chip, REG_SD_BLOCK_CNT_H, 0xFF, + 0x02); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, REG_SD_BLOCK_CNT_L, 0xFF, + 0x00); + if (retval) { + rtsx_trace(chip); + return retval; + } } #endif @@ -3251,8 +3536,16 @@ int reset_sd_card(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, REG_SD_BYTE_CNT_L, 0xFF, 0); - RTSX_WRITE_REG(chip, REG_SD_BYTE_CNT_H, 0xFF, 2); + retval = rtsx_write_register(chip, REG_SD_BYTE_CNT_L, 0xFF, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, REG_SD_BYTE_CNT_H, 0xFF, 2); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->capacity[chip->card2lun[SD_CARD]] = sd_card->capacity; @@ -3309,8 +3602,16 @@ static int reset_mmc_only(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, REG_SD_BYTE_CNT_L, 0xFF, 0); - RTSX_WRITE_REG(chip, REG_SD_BYTE_CNT_H, 0xFF, 2); + retval = rtsx_write_register(chip, REG_SD_BYTE_CNT_L, 0xFF, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, REG_SD_BYTE_CNT_H, 0xFF, 2); + if (retval) { + rtsx_trace(chip); + return retval; + } chip->capacity[chip->card2lun[SD_CARD]] = sd_card->capacity; @@ -4950,7 +5251,11 @@ int sd_power_off_card3v3(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CARD_OE, SD_OUTPUT_EN, 0); + retval = rtsx_write_register(chip, CARD_OE, SD_OUTPUT_EN, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } if (!chip->ft2_fast_mode) { retval = card_power_off(chip, SD_CARD); @@ -4969,8 +5274,13 @@ int sd_power_off_card3v3(struct rtsx_chip *chip) return STATUS_FAIL; } } else { - RTSX_WRITE_REG(chip, FPGA_PULL_CTL, - FPGA_SD_PULL_CTL_BIT | 0x20, FPGA_SD_PULL_CTL_BIT); + retval = rtsx_write_register(chip, FPGA_PULL_CTL, + FPGA_SD_PULL_CTL_BIT | 0x20, + FPGA_SD_PULL_CTL_BIT); + if (retval) { + rtsx_trace(chip); + return retval; + } } return STATUS_SUCCESS; diff --git a/drivers/staging/rts5208/spi.c b/drivers/staging/rts5208/spi.c index d3ac6c0b11b5..e67e7ecc2cbd 100644 --- a/drivers/staging/rts5208/spi.c +++ b/drivers/staging/rts5208/spi.c @@ -36,10 +36,20 @@ static inline void spi_set_err_code(struct rtsx_chip *chip, u8 err_code) static int spi_init(struct rtsx_chip *chip) { - RTSX_WRITE_REG(chip, SPI_CONTROL, 0xFF, - CS_POLARITY_LOW | DTO_MSB_FIRST | SPI_MASTER | SPI_MODE0 | - SPI_AUTO); - RTSX_WRITE_REG(chip, SPI_TCTL, EDO_TIMING_MASK, SAMPLE_DELAY_HALF); + int retval; + + retval = rtsx_write_register(chip, SPI_CONTROL, 0xFF, + CS_POLARITY_LOW | DTO_MSB_FIRST | SPI_MASTER | SPI_MODE0 | SPI_AUTO); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SPI_TCTL, EDO_TIMING_MASK, + SAMPLE_DELAY_HALF); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -49,8 +59,18 @@ static int spi_set_init_para(struct rtsx_chip *chip) struct spi_info *spi = &(chip->spi); int retval; - RTSX_WRITE_REG(chip, SPI_CLK_DIVIDER1, 0xFF, (u8)(spi->clk_div >> 8)); - RTSX_WRITE_REG(chip, SPI_CLK_DIVIDER0, 0xFF, (u8)(spi->clk_div)); + retval = rtsx_write_register(chip, SPI_CLK_DIVIDER1, 0xFF, + (u8)(spi->clk_div >> 8)); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SPI_CLK_DIVIDER0, 0xFF, + (u8)(spi->clk_div)); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = switch_clock(chip, spi->spi_clock); if (retval != STATUS_SUCCESS) { @@ -64,8 +84,18 @@ static int spi_set_init_para(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CARD_CLK_EN, SPI_CLK_EN, SPI_CLK_EN); - RTSX_WRITE_REG(chip, CARD_OE, SPI_OUTPUT_EN, SPI_OUTPUT_EN); + retval = rtsx_write_register(chip, CARD_CLK_EN, SPI_CLK_EN, + SPI_CLK_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_OE, SPI_OUTPUT_EN, + SPI_OUTPUT_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } wait_timeout(10); @@ -228,8 +258,16 @@ static int spi_init_eeprom(struct rtsx_chip *chip) else clk = CLK_30; - RTSX_WRITE_REG(chip, SPI_CLK_DIVIDER1, 0xFF, 0x00); - RTSX_WRITE_REG(chip, SPI_CLK_DIVIDER0, 0xFF, 0x27); + retval = rtsx_write_register(chip, SPI_CLK_DIVIDER1, 0xFF, 0x00); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SPI_CLK_DIVIDER0, 0xFF, 0x27); + if (retval) { + rtsx_trace(chip); + return retval; + } retval = switch_clock(chip, clk); if (retval != STATUS_SUCCESS) { @@ -243,14 +281,33 @@ static int spi_init_eeprom(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CARD_CLK_EN, SPI_CLK_EN, SPI_CLK_EN); - RTSX_WRITE_REG(chip, CARD_OE, SPI_OUTPUT_EN, SPI_OUTPUT_EN); + retval = rtsx_write_register(chip, CARD_CLK_EN, SPI_CLK_EN, + SPI_CLK_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_OE, SPI_OUTPUT_EN, + SPI_OUTPUT_EN); + if (retval) { + rtsx_trace(chip); + return retval; + } wait_timeout(10); - RTSX_WRITE_REG(chip, SPI_CONTROL, 0xFF, - CS_POLARITY_HIGH | SPI_EEPROM_AUTO); - RTSX_WRITE_REG(chip, SPI_TCTL, EDO_TIMING_MASK, SAMPLE_DELAY_HALF); + retval = rtsx_write_register(chip, SPI_CONTROL, 0xFF, + CS_POLARITY_HIGH | SPI_EEPROM_AUTO); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, SPI_TCTL, EDO_TIMING_MASK, + SAMPLE_DELAY_HALF); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -310,7 +367,11 @@ int spi_erase_eeprom_chip(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CARD_GPIO_DIR, 0x01, 0x01); + retval = rtsx_write_register(chip, CARD_GPIO_DIR, 0x01, 0x01); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -350,7 +411,11 @@ int spi_erase_eeprom_byte(struct rtsx_chip *chip, u16 addr) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CARD_GPIO_DIR, 0x01, 0x01); + retval = rtsx_write_register(chip, CARD_GPIO_DIR, 0x01, 0x01); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -388,12 +453,20 @@ int spi_read_eeprom(struct rtsx_chip *chip, u16 addr, u8 *val) } wait_timeout(5); - RTSX_READ_REG(chip, SPI_DATA, &data); + retval = rtsx_read_register(chip, SPI_DATA, &data); + if (retval) { + rtsx_trace(chip); + return retval; + } if (val) *val = data; - RTSX_WRITE_REG(chip, CARD_GPIO_DIR, 0x01, 0x01); + retval = rtsx_write_register(chip, CARD_GPIO_DIR, 0x01, 0x01); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } @@ -434,7 +507,11 @@ int spi_write_eeprom(struct rtsx_chip *chip, u16 addr, u8 val) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CARD_GPIO_DIR, 0x01, 0x01); + retval = rtsx_write_register(chip, CARD_GPIO_DIR, 0x01, 0x01); + if (retval) { + rtsx_trace(chip); + return retval; + } return STATUS_SUCCESS; } diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c index 2afa6021c33b..8fd108e50509 100644 --- a/drivers/staging/rts5208/xd.c +++ b/drivers/staging/rts5208/xd.c @@ -252,14 +252,22 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 page_addr, u8 *buf, return STATUS_FAIL; } - RTSX_READ_REG(chip, XD_PAGE_STATUS, ®); + retval = rtsx_read_register(chip, XD_PAGE_STATUS, ®); + if (retval) { + rtsx_trace(chip); + return retval; + } if (reg != XD_GPG) { rtsx_clear_xd_error(chip); rtsx_trace(chip); return STATUS_FAIL; } - RTSX_READ_REG(chip, XD_CTL, ®); + retval = rtsx_read_register(chip, XD_CTL, ®); + if (retval) { + rtsx_trace(chip); + return retval; + } if (!(reg & XD_ECC1_ERROR) || !(reg & XD_ECC1_UNCORRECTABLE)) { retval = xd_read_data_from_ppb(chip, 0, buf, buf_len); if (retval != STATUS_SUCCESS) { @@ -269,8 +277,18 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 page_addr, u8 *buf, if (reg & XD_ECC1_ERROR) { u8 ecc_bit, ecc_byte; - RTSX_READ_REG(chip, XD_ECC_BIT1, &ecc_bit); - RTSX_READ_REG(chip, XD_ECC_BYTE1, &ecc_byte); + retval = rtsx_read_register(chip, XD_ECC_BIT1, + &ecc_bit); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_read_register(chip, XD_ECC_BYTE1, + &ecc_byte); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "ECC_BIT1 = 0x%x, ECC_BYTE1 = 0x%x\n", ecc_bit, ecc_byte); @@ -293,8 +311,18 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 page_addr, u8 *buf, if (reg & XD_ECC2_ERROR) { u8 ecc_bit, ecc_byte; - RTSX_READ_REG(chip, XD_ECC_BIT2, &ecc_bit); - RTSX_READ_REG(chip, XD_ECC_BYTE2, &ecc_byte); + retval = rtsx_read_register(chip, XD_ECC_BIT2, + &ecc_bit); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_read_register(chip, XD_ECC_BYTE2, + &ecc_byte); + if (retval) { + rtsx_trace(chip); + return retval; + } dev_dbg(rtsx_dev(chip), "ECC_BIT2 = 0x%x, ECC_BYTE2 = 0x%x\n", ecc_bit, ecc_byte); @@ -385,24 +413,71 @@ static void xd_fill_pull_ctl_enable(struct rtsx_chip *chip) static int xd_pull_ctl_disable(struct rtsx_chip *chip) { + int retval; + if (CHECK_PID(chip, 0x5208)) { - RTSX_WRITE_REG(chip, CARD_PULL_CTL1, 0xFF, - XD_D3_PD | XD_D2_PD | XD_D1_PD | XD_D0_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL2, 0xFF, - XD_D7_PD | XD_D6_PD | XD_D5_PD | XD_D4_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL3, 0xFF, - XD_WP_PD | XD_CE_PD | XD_CLE_PD | XD_CD_PU); - RTSX_WRITE_REG(chip, CARD_PULL_CTL4, 0xFF, - XD_RDY_PD | XD_WE_PD | XD_RE_PD | XD_ALE_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL5, 0xFF, - MS_INS_PU | SD_WP_PD | SD_CD_PU | SD_CMD_PD); - RTSX_WRITE_REG(chip, CARD_PULL_CTL6, 0xFF, MS_D5_PD | MS_D4_PD); + retval = rtsx_write_register(chip, CARD_PULL_CTL1, 0xFF, + XD_D3_PD | XD_D2_PD | XD_D1_PD | XD_D0_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL2, 0xFF, + XD_D7_PD | XD_D6_PD | XD_D5_PD | XD_D4_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL3, 0xFF, + XD_WP_PD | XD_CE_PD | XD_CLE_PD | XD_CD_PU); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL4, 0xFF, + XD_RDY_PD | XD_WE_PD | XD_RE_PD | XD_ALE_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL5, 0xFF, + MS_INS_PU | SD_WP_PD | SD_CD_PU | SD_CMD_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL6, 0xFF, + MS_D5_PD | MS_D4_PD); + if (retval) { + rtsx_trace(chip); + return retval; + } } else if (CHECK_PID(chip, 0x5288)) { if (CHECK_BARO_PKG(chip, QFN)) { - RTSX_WRITE_REG(chip, CARD_PULL_CTL1, 0xFF, 0x55); - RTSX_WRITE_REG(chip, CARD_PULL_CTL2, 0xFF, 0x55); - RTSX_WRITE_REG(chip, CARD_PULL_CTL3, 0xFF, 0x4B); - RTSX_WRITE_REG(chip, CARD_PULL_CTL4, 0xFF, 0x69); + retval = rtsx_write_register(chip, CARD_PULL_CTL1, + 0xFF, 0x55); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL2, + 0xFF, 0x55); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL3, + 0xFF, 0x4B); + if (retval) { + rtsx_trace(chip); + return retval; + } + retval = rtsx_write_register(chip, CARD_PULL_CTL4, + 0xFF, 0x69); + if (retval) { + rtsx_trace(chip); + return retval; + } } } @@ -1144,7 +1219,12 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk, XD_CLR_BAD_NEWBLK(xd_card); - RTSX_WRITE_REG(chip, CARD_DATA_SOURCE, 0x01, PINGPONG_BUFFER); + retval = rtsx_write_register(chip, CARD_DATA_SOURCE, 0x01, + PINGPONG_BUFFER); + if (retval) { + rtsx_trace(chip); + return retval; + } for (i = start_page; i < end_page; i++) { if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) { @@ -1619,12 +1699,20 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk, return STATUS_SUCCESS; Fail: - RTSX_READ_REG(chip, XD_PAGE_STATUS, ®_val); + retval = rtsx_read_register(chip, XD_PAGE_STATUS, ®_val); + if (retval) { + rtsx_trace(chip); + return retval; + } if (reg_val != XD_GPG) xd_set_err_code(chip, XD_PRG_ERROR); - RTSX_READ_REG(chip, XD_CTL, ®_val); + retval = rtsx_read_register(chip, XD_CTL, ®_val); + if (retval) { + rtsx_trace(chip); + return retval; + } if (((reg_val & (XD_ECC1_ERROR | XD_ECC1_UNCORRECTABLE)) == (XD_ECC1_ERROR | XD_ECC1_UNCORRECTABLE)) @@ -1847,7 +1935,11 @@ static int xd_write_multiple_pages(struct rtsx_chip *chip, u32 old_blk, return STATUS_SUCCESS; Fail: - RTSX_READ_REG(chip, XD_DAT, ®_val); + retval = rtsx_read_register(chip, XD_DAT, ®_val); + if (retval) { + rtsx_trace(chip); + return retval; + } if (reg_val & PROGRAM_ERROR) { xd_set_err_code(chip, XD_PRG_ERROR); xd_mark_bad_block(chip, new_blk); @@ -2197,7 +2289,11 @@ int xd_power_off_card3v3(struct rtsx_chip *chip) return STATUS_FAIL; } - RTSX_WRITE_REG(chip, CARD_OE, XD_OUTPUT_EN, 0); + retval = rtsx_write_register(chip, CARD_OE, XD_OUTPUT_EN, 0); + if (retval) { + rtsx_trace(chip); + return retval; + } if (!chip->ft2_fast_mode) { retval = card_power_off(chip, XD_CARD); @@ -2216,7 +2312,11 @@ int xd_power_off_card3v3(struct rtsx_chip *chip) return STATUS_FAIL; } } else { - RTSX_WRITE_REG(chip, FPGA_PULL_CTL, 0xFF, 0xDF); + retval = rtsx_write_register(chip, FPGA_PULL_CTL, 0xFF, 0xDF); + if (retval) { + rtsx_trace(chip); + return retval; + } } return STATUS_SUCCESS; -- cgit v1.2.3 From 61986f730eb83912ac4a0c59b671232bdee07c40 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 24 Mar 2015 20:47:26 +0530 Subject: staging: unisys: remove redundant variable remove the variable "registered", which was used in the cleanup() to detect if the driver has successfully initialized. the cleanup() is called from module_exit, so its obvious that the module has successfully initialized. if the initialization had failed, then we will never be in the cleanup(). Signed-off-by: Sudip Mukherjee Reviewed-by: Dan Carpenter Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/file.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 9ca7f1eb1e7e..b426762665be 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -31,7 +31,6 @@ static struct cdev file_cdev; static struct visorchannel **file_controlvm_channel; static dev_t majordev = -1; /**< indicates major num for device */ -static BOOL registered = FALSE; static int visorchipset_open(struct inode *inode, struct file *file); static int visorchipset_release(struct inode *inode, struct file *file); @@ -62,12 +61,10 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) /* dynamic major device number registration required */ if (alloc_chrdev_region(&majordev, 0, 1, MYDRVNAME) < 0) return -1; - registered = TRUE; } else { /* static major device number registration required */ if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0) return -1; - registered = TRUE; } rc = cdev_add(&file_cdev, MKDEV(MAJOR(majordev), 0), 1); if (rc < 0) @@ -81,12 +78,9 @@ visorchipset_file_cleanup(void) if (file_cdev.ops != NULL) cdev_del(&file_cdev); file_cdev.ops = NULL; - if (registered) { - if (MAJOR(majordev) >= 0) { - unregister_chrdev_region(majordev, 1); - majordev = MKDEV(0, 0); - } - registered = FALSE; + if (MAJOR(majordev) >= 0) { + unregister_chrdev_region(majordev, 1); + majordev = MKDEV(0, 0); } } -- cgit v1.2.3 From a1191146c9a6ebc0e15ef50788bd392339510c0d Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 24 Mar 2015 20:47:27 +0530 Subject: staging: unisys: use local variable we are getting dev_t as an argument in the function, so use the local variable instead of the global variable "majordev". this global variable will be removed in one of the next patch of the series. Signed-off-by: Sudip Mukherjee Reviewed-by: Dan Carpenter Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index b426762665be..6ebe7f733ba4 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -57,16 +57,16 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) majordev = major_dev; cdev_init(&file_cdev, &visorchipset_fops); file_cdev.owner = THIS_MODULE; - if (MAJOR(majordev) == 0) { + if (MAJOR(major_dev) == 0) { /* dynamic major device number registration required */ - if (alloc_chrdev_region(&majordev, 0, 1, MYDRVNAME) < 0) + if (alloc_chrdev_region(&major_dev, 0, 1, MYDRVNAME) < 0) return -1; } else { /* static major device number registration required */ - if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0) + if (register_chrdev_region(major_dev, 1, MYDRVNAME) < 0) return -1; } - rc = cdev_add(&file_cdev, MKDEV(MAJOR(majordev), 0), 1); + rc = cdev_add(&file_cdev, MKDEV(MAJOR(major_dev), 0), 1); if (rc < 0) return -1; return 0; -- cgit v1.2.3 From addceb12a3ed62e50c842f4c8f6099e1ead29ba8 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 24 Mar 2015 20:47:28 +0530 Subject: staging: unisys: use local variable in cleanup the dev_t was being stored in visorchipset_platform_device.dev.devt while initializing the module. so pass that value as an argument to cleanup() so that it can use this local variable instead of the global variable. Signed-off-by: Sudip Mukherjee Reviewed-by: Dan Carpenter Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/file.c | 6 +++--- drivers/staging/unisys/visorchipset/file.h | 2 +- drivers/staging/unisys/visorchipset/visorchipset_main.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 6ebe7f733ba4..257cfdd841d4 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -73,13 +73,13 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) } void -visorchipset_file_cleanup(void) +visorchipset_file_cleanup(dev_t major_dev) { if (file_cdev.ops != NULL) cdev_del(&file_cdev); file_cdev.ops = NULL; - if (MAJOR(majordev) >= 0) { - unregister_chrdev_region(majordev, 1); + if (MAJOR(major_dev) >= 0) { + unregister_chrdev_region(major_dev, 1); majordev = MKDEV(0, 0); } } diff --git a/drivers/staging/unisys/visorchipset/file.h b/drivers/staging/unisys/visorchipset/file.h index dc7a19556b3f..51f7699b744b 100644 --- a/drivers/staging/unisys/visorchipset/file.h +++ b/drivers/staging/unisys/visorchipset/file.h @@ -22,6 +22,6 @@ int visorchipset_file_init(dev_t majorDev, struct visorchannel **pControlVm_channel); -void visorchipset_file_cleanup(void); +void visorchipset_file_cleanup(dev_t major_dev); #endif diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 9c8605dea475..f2663d2c7530 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -2278,7 +2278,7 @@ visorchipset_exit(void) visorchannel_destroy(controlvm_channel); - visorchipset_file_cleanup(); + visorchipset_file_cleanup(visorchipset_platform_device.dev.devt); POSTCODE_LINUX_2(DRIVER_EXIT_PC, POSTCODE_SEVERITY_INFO); } -- cgit v1.2.3 From eb79db2b59ce9acda94cd8f0e27cdba0bea0bad1 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 24 Mar 2015 20:47:29 +0530 Subject: staging: unisys: remove global dev_t the global variable majordev is no longer required, as it is not being used anywhere. Signed-off-by: Sudip Mukherjee Reviewed-by: Dan Carpenter Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/file.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 257cfdd841d4..890869ad36f4 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -30,7 +30,6 @@ static struct cdev file_cdev; static struct visorchannel **file_controlvm_channel; -static dev_t majordev = -1; /**< indicates major num for device */ static int visorchipset_open(struct inode *inode, struct file *file); static int visorchipset_release(struct inode *inode, struct file *file); @@ -54,7 +53,6 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) int rc = 0; file_controlvm_channel = controlvm_channel; - majordev = major_dev; cdev_init(&file_cdev, &visorchipset_fops); file_cdev.owner = THIS_MODULE; if (MAJOR(major_dev) == 0) { @@ -80,7 +78,6 @@ visorchipset_file_cleanup(dev_t major_dev) file_cdev.ops = NULL; if (MAJOR(major_dev) >= 0) { unregister_chrdev_region(major_dev, 1); - majordev = MKDEV(0, 0); } } -- cgit v1.2.3 From 8b82fa8388db5ccd50bad172d3e885dcea22596d Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Tue, 24 Mar 2015 20:47:30 +0530 Subject: staging: unisys: remove comparison the comparison is always true as the dev_t has been initialized in the init function and we are sending that initialized dev_t to the cleanup(). Signed-off-by: Sudip Mukherjee Reviewed-by: Dan Carpenter Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 890869ad36f4..39b19afa5169 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -76,9 +76,7 @@ visorchipset_file_cleanup(dev_t major_dev) if (file_cdev.ops != NULL) cdev_del(&file_cdev); file_cdev.ops = NULL; - if (MAJOR(major_dev) >= 0) { - unregister_chrdev_region(major_dev, 1); - } + unregister_chrdev_region(major_dev, 1); } static int -- cgit v1.2.3 From 3866a3c6e554cb3f3d6e7fadb1ff4dac1fde2348 Mon Sep 17 00:00:00 2001 From: Niranjan Dighe Date: Thu, 26 Mar 2015 23:51:58 +0530 Subject: Staging: slicoss: Remove redundant and disabled code block Removing code guarded by undefined macro SLIC_TRACE_DUMP_ENABLED Signed-off-by: Niranjan Dighe Signed-off-by: Greg Kroah-Hartman --- drivers/staging/slicoss/slicoss.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 3104cb0d0589..c2bda1d38e41 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2553,41 +2553,6 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) slic_intagg_set(adapter, intagg); return 0; -#ifdef SLIC_TRACE_DUMP_ENABLED - case SIOCSLICTRACEDUMP: - { - u32 value; - - DBG_IOCTL("slic_ioctl SIOCSLIC_TRACE_DUMP\n"); - - if (copy_from_user(data, rq->ifr_data, 28)) { - PRINT_ERROR - ("slic: copy_from_user FAILED getting initial simba param\n"); - return -EFAULT; - } - - value = data[0]; - if (tracemon_request == SLIC_DUMP_DONE) { - PRINT_ERROR - ("ATK Diagnostic Trace Dump Requested\n"); - tracemon_request = SLIC_DUMP_REQUESTED; - tracemon_request_type = value; - tracemon_timestamp = jiffies; - } else if ((tracemon_request == SLIC_DUMP_REQUESTED) || - (tracemon_request == - SLIC_DUMP_IN_PROGRESS)) { - PRINT_ERROR - ("ATK Diagnostic Trace Dump Requested but already in progress... ignore\n"); - } else { - PRINT_ERROR - ("ATK Diagnostic Trace Dump Requested\n"); - tracemon_request = SLIC_DUMP_REQUESTED; - tracemon_request_type = value; - tracemon_timestamp = jiffies; - } - return 0; - } -#endif case SIOCETHTOOL: if (copy_from_user(&ecmd, rq->ifr_data, sizeof(ecmd))) return -EFAULT; -- cgit v1.2.3 From 569a6dcf3d7f7b6b84ba20fdf419df5a1c4f885d Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Thu, 26 Mar 2015 14:09:13 -0300 Subject: staging: sm750fb: Add space after struct definition This patch fixes checkpatch.pl warning: WARNING: missing space after struct definition +typedef struct _pllcalparam{ Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 02f9326a0404..c931e831f0b0 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -2,7 +2,7 @@ #include "ddk750_reg.h" #include "ddk750_chip.h" #include "ddk750_power.h" -typedef struct _pllcalparam{ +typedef struct _pllcalparam { unsigned char power;/* d : 0~ 6*/ unsigned char pod; unsigned char od; -- cgit v1.2.3 From 9767fc5126c5eff780adff6b4beae81134655206 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Thu, 26 Mar 2015 14:09:14 -0300 Subject: staging: sm750fb: Fix if/else/for/switch braces style This patch fixes the checkpatch.pl errors: ERROR: that open brace { should be on the previous line ERROR: else should follow close brace '}' WARNING: braces {} are not necessary for single statement blocks ERROR: space required before the open brace '{' Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 75 ++++++++++++----------------------- 1 file changed, 26 insertions(+), 49 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index c931e831f0b0..de7fa4ab4ed2 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -21,21 +21,14 @@ logical_chip_type_t getChipType(void) physicalRev = revId750; if (physicalID == 0x718) - { chip = SM718; - } - else if (physicalID == 0x750) - { + else if (physicalID == 0x750) { chip = SM750; /* SM750 and SM750LE are different in their revision ID only. */ - if (physicalRev == SM750LE_REVISION_ID){ + if (physicalRev == SM750LE_REVISION_ID) chip = SM750LE; - } - } - else - { + } else chip = SM_UNKNOWN; - } return chip; } @@ -63,8 +56,7 @@ unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL) pPLL->inputFreq = DEFAULT_INPUT_CLOCK; pPLL->clockType = clockType; - switch (clockType) - { + switch (clockType) { case MXCLK_PLL: ulPllReg = PEEK32(MXCLK_PLL_CTRL); break; @@ -118,8 +110,7 @@ void setChipClock(unsigned int frequency) return; #endif - if (frequency != 0) - { + if (frequency != 0) { /* * Set up PLL, a structure to hold the value to be set in clocks. */ @@ -148,8 +139,7 @@ void setMemoryClock(unsigned int frequency) if (getChipType() == SM750LE) return; #endif - if (frequency != 0) - { + if (frequency != 0) { /* Set the frequency to the maximum frequency that the DDR Memory can take which is 336MHz. */ if (frequency > MHz(336)) @@ -160,8 +150,7 @@ void setMemoryClock(unsigned int frequency) /* Set the corresponding divisor in the register. */ ulReg = PEEK32(CURRENT_GATE); - switch(divisor) - { + switch(divisor) { default: case 1: ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_1); @@ -198,8 +187,7 @@ void setMasterClock(unsigned int frequency) if (getChipType() == SM750LE) return; #endif - if (frequency != 0) - { + if (frequency != 0) { /* Set the frequency to the maximum frequency that the SM750 engine can run, which is about 190 MHz. */ if (frequency > MHz(190)) @@ -210,8 +198,7 @@ void setMasterClock(unsigned int frequency) /* Set the corresponding divisor in the register. */ ulReg = PEEK32(CURRENT_GATE); - switch(divisor) - { + switch(divisor) { default: case 3: ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_3); @@ -248,7 +235,7 @@ unsigned int ddk750_getVMSize(void) /* get frame buffer size from GPIO */ reg = FIELD_GET(PEEK32(MISC_CTRL),MISC_CTRL,LOCALMEM_SIZE); - switch(reg){ + switch(reg) { case MISC_CTRL_LOCALMEM_SIZE_8M: data = MB(8); break; /* 8 Mega byte */ case MISC_CTRL_LOCALMEM_SIZE_16M: data = MB(16); break; /* 16 Mega byte */ case MISC_CTRL_LOCALMEM_SIZE_32M: data = MB(32); break; /* 32 Mega byte */ @@ -265,7 +252,7 @@ int ddk750_initHw(initchip_param_t * pInitParam) unsigned int ulReg; #if 0 //move the code to map regiter function. - if(getChipType() == SM718){ + if(getChipType() == SM718) { /* turn on big endian bit*/ ulReg = PEEK32(0x74); /* now consider register definition in a big endian pattern*/ @@ -285,13 +272,13 @@ int ddk750_initHw(initchip_param_t * pInitParam) ulReg = FIELD_SET(ulReg,CURRENT_GATE,LOCALMEM,ON); setCurrentGate(ulReg); - if(getChipType() != SM750LE){ + if(getChipType() != SM750LE) { /* set panel pll and graphic mode via mmio_88 */ ulReg = PEEK32(VGA_CONFIGURATION); ulReg = FIELD_SET(ulReg,VGA_CONFIGURATION,PLL,PANEL); ulReg = FIELD_SET(ulReg,VGA_CONFIGURATION,MODE,GRAPHIC); POKE32(VGA_CONFIGURATION,ulReg); - }else{ + } else { #if defined(__i386__) || defined( __x86_64__) /* set graphic mode via IO method */ outb_p(0x88,0x3d4); @@ -313,8 +300,7 @@ int ddk750_initHw(initchip_param_t * pInitParam) the system might hang when sw accesses the memory. The memory should be resetted after changing the MXCLK. */ - if (pInitParam->resetMemory == 1) - { + if (pInitParam->resetMemory == 1) { ulReg = PEEK32(MISC_CTRL); ulReg = FIELD_SET(ulReg, MISC_CTRL, LOCALMEM_RESET, RESET); POKE32(MISC_CTRL, ulReg); @@ -323,8 +309,7 @@ int ddk750_initHw(initchip_param_t * pInitParam) POKE32(MISC_CTRL, ulReg); } - if (pInitParam->setAllEngOff == 1) - { + if (pInitParam->setAllEngOff == 1) { enable2DEngine(0); /* Disable Overlay, if a former application left it on */ @@ -445,8 +430,7 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) pllcalparam * xparm; #if 1 - if (getChipType() == SM750LE) - { + if (getChipType() == SM750LE) { /* SM750LE don't have prgrammable PLL and M/N values to work on. Just return the requested clock. */ return request_orig; @@ -460,36 +444,33 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) /* for MXCLK register , no POD provided, so need be treated differently */ - if(pll->clockType != MXCLK_PLL){ + if(pll->clockType != MXCLK_PLL) { xparm = &xparm_PIXEL[0]; xcnt = sizeof(xparm_PIXEL)/sizeof(xparm_PIXEL[0]); - }else{ + } else { xparm = &xparm_MXCLK[0]; xcnt = sizeof(xparm_MXCLK)/sizeof(xparm_MXCLK[0]); } - for(N = 15;N>1;N--) - { + for(N = 15;N>1;N--) { /* RN will not exceed maximum long if @request <= 285 MHZ (for 32bit cpu) */ RN = N * request; quo = RN / input; rem = RN % input;/* rem always small than 14318181 */ fl_quo = (rem * 10000 /input); - for(d = xcnt - 1;d >= 0;d--){ + for(d = xcnt - 1;d >= 0;d--) { X = xparm[d].value; M = quo*X; M += fl_quo * X / 10000; /* round step */ M += (fl_quo*X % 10000)>5000?1:0; - if(M < 256 && M > 0) - { + if(M < 256 && M > 0) { unsigned int diff; tmpClock = pll->inputFreq *M / N / X; diff = absDiff(tmpClock,request_orig); - if(diff < miniDiff) - { + if(diff < miniDiff) { pll->M = M; pll->N = N; pll->OD = xparm[d].od; @@ -541,8 +522,7 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ podPower = twoToPowerOfx(POD); /* OD has only 2 bits [15:14] and its value must between 0 to 3 */ - for (OD=0; OD<=3; OD++) - { + for (OD=0; OD<=3; OD++) { /* Work out 2 to the power of OD */ odPower = twoToPowerOfx(OD); @@ -555,8 +535,7 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ /* N has 4 bits [11:8] and its value must between 2 and 15. The N == 1 will behave differently --> Result is not correct. */ - for (N=2; N<=15; N++) - { + for (N=2; N<=15; N++) { /* The formula for PLL is ulRequestClk = inputFreq * M / N / (2^OD) In the following steps, we try to work out a best M value given the others are known. To avoid decimal calculation, we use 1000 as multiplier for up to 3 decimal places of accuracy. @@ -565,16 +544,14 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ M = roundedDiv(M, 1000); /* M field has only 8 bits, reject value bigger than 8 bits */ - if (M < 256) - { + if (M < 256) { /* Calculate the actual clock for a given M & N */ pllClk = pPLL->inputFreq * M / N / odPower / podPower; /* How much are we different from the requirement */ diff = absDiff(pllClk, ulRequestClk); - if (diff < bestDiff) - { + if (diff < bestDiff) { bestDiff = diff; /* Store M and N values */ -- cgit v1.2.3 From ce02a16ae444f8a80877d660e41f162f7b2a967a Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Thu, 26 Mar 2015 14:09:15 -0300 Subject: staging: sm750fb: Fix for statement style This patch fixes the checkpatch.pl warnings: ERROR: spaces required around that '=' (ctx:VxV) ERROR: spaces required around that '<=' (ctx:VxV) ERROR: spaces required around that '>' (ctx:VxV) ERROR: space required before the open parenthesis '(' ERROR: space required after that ';' (ctx:VxV) Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index de7fa4ab4ed2..3d228f4fc7c9 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -39,7 +39,7 @@ inline unsigned int twoToPowerOfx(unsigned long x) unsigned long i; unsigned long result = 1; - for (i=1; i<=x; i++) + for (i = 1; i <= x; i++) result *= 2; return result; } @@ -453,14 +453,14 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) } - for(N = 15;N>1;N--) { + for (N = 15; N > 1; N--) { /* RN will not exceed maximum long if @request <= 285 MHZ (for 32bit cpu) */ RN = N * request; quo = RN / input; rem = RN % input;/* rem always small than 14318181 */ fl_quo = (rem * 10000 /input); - for(d = xcnt - 1;d >= 0;d--) { + for (d = xcnt - 1; d >= 0; d--) { X = xparm[d].value; M = quo*X; M += fl_quo * X / 10000; @@ -508,7 +508,7 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ #ifndef VALIDATION_CHIP /* The maximum of post divider is 8. */ - for (POD=0; POD<=3; POD++) + for (POD = 0; POD <= 3; POD++) #endif { @@ -522,7 +522,7 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ podPower = twoToPowerOfx(POD); /* OD has only 2 bits [15:14] and its value must between 0 to 3 */ - for (OD=0; OD<=3; OD++) { + for (OD = 0; OD <= 3; OD++) { /* Work out 2 to the power of OD */ odPower = twoToPowerOfx(OD); @@ -535,7 +535,7 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ /* N has 4 bits [11:8] and its value must between 2 and 15. The N == 1 will behave differently --> Result is not correct. */ - for (N=2; N<=15; N++) { + for (N = 2; N <= 15; N++) { /* The formula for PLL is ulRequestClk = inputFreq * M / N / (2^OD) In the following steps, we try to work out a best M value given the others are known. To avoid decimal calculation, we use 1000 as multiplier for up to 3 decimal places of accuracy. -- cgit v1.2.3 From 82736d2244a059962bf9efec3338036ae9464986 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Thu, 26 Mar 2015 14:09:16 -0300 Subject: staging: sm750fb: Add space before if statement This patch fix the checkpatch.pl warning: ERROR: space required before the open parenthesis '(' Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 3d228f4fc7c9..49e26bd0f6ce 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -87,7 +87,7 @@ unsigned int getChipClock(void) { pll_value_t pll; #if 1 - if(getChipType() == SM750LE) + if (getChipType() == SM750LE) return MHz(130); #endif @@ -225,7 +225,7 @@ unsigned int ddk750_getVMSize(void) unsigned int data; /* sm750le only use 64 mb memory*/ - if(getChipType() == SM750LE) + if (getChipType() == SM750LE) return MB(64); /* for 750,always use power mode0*/ @@ -252,7 +252,7 @@ int ddk750_initHw(initchip_param_t * pInitParam) unsigned int ulReg; #if 0 //move the code to map regiter function. - if(getChipType() == SM718) { + if (getChipType() == SM718) { /* turn on big endian bit*/ ulReg = PEEK32(0x74); /* now consider register definition in a big endian pattern*/ @@ -272,7 +272,7 @@ int ddk750_initHw(initchip_param_t * pInitParam) ulReg = FIELD_SET(ulReg,CURRENT_GATE,LOCALMEM,ON); setCurrentGate(ulReg); - if(getChipType() != SM750LE) { + if (getChipType() != SM750LE) { /* set panel pll and graphic mode via mmio_88 */ ulReg = PEEK32(VGA_CONFIGURATION); ulReg = FIELD_SET(ulReg,VGA_CONFIGURATION,PLL,PANEL); @@ -444,7 +444,7 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) /* for MXCLK register , no POD provided, so need be treated differently */ - if(pll->clockType != MXCLK_PLL) { + if (pll->clockType != MXCLK_PLL) { xparm = &xparm_PIXEL[0]; xcnt = sizeof(xparm_PIXEL)/sizeof(xparm_PIXEL[0]); } else { @@ -466,11 +466,11 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) M += fl_quo * X / 10000; /* round step */ M += (fl_quo*X % 10000)>5000?1:0; - if(M < 256 && M > 0) { + if (M < 256 && M > 0) { unsigned int diff; tmpClock = pll->inputFreq *M / N / X; diff = absDiff(tmpClock,request_orig); - if(diff < miniDiff) { + if (diff < miniDiff) { pll->M = M; pll->N = N; pll->OD = xparm[d].od; -- cgit v1.2.3 From c107243b09a62d17956362b6780c07cd5bbb071c Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Thu, 26 Mar 2015 14:09:17 -0300 Subject: staging: sm750fb: Add space before switch statement This patch fixes the checkpatch.pl warnings: ERROR: space required before the open parenthesis '(' + switch(divisor) { ERROR: space required before the open parenthesis '(' + switch(divisor) { ERROR: space required before the open parenthesis '(' + switch(reg) { Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 49e26bd0f6ce..3913aa4a9068 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -150,7 +150,7 @@ void setMemoryClock(unsigned int frequency) /* Set the corresponding divisor in the register. */ ulReg = PEEK32(CURRENT_GATE); - switch(divisor) { + switch (divisor) { default: case 1: ulReg = FIELD_SET(ulReg, CURRENT_GATE, M2XCLK, DIV_1); @@ -198,7 +198,7 @@ void setMasterClock(unsigned int frequency) /* Set the corresponding divisor in the register. */ ulReg = PEEK32(CURRENT_GATE); - switch(divisor) { + switch (divisor) { default: case 3: ulReg = FIELD_SET(ulReg, CURRENT_GATE, MCLK, DIV_3); @@ -235,7 +235,7 @@ unsigned int ddk750_getVMSize(void) /* get frame buffer size from GPIO */ reg = FIELD_GET(PEEK32(MISC_CTRL),MISC_CTRL,LOCALMEM_SIZE); - switch(reg) { + switch (reg) { case MISC_CTRL_LOCALMEM_SIZE_8M: data = MB(8); break; /* 8 Mega byte */ case MISC_CTRL_LOCALMEM_SIZE_16M: data = MB(16); break; /* 16 Mega byte */ case MISC_CTRL_LOCALMEM_SIZE_32M: data = MB(32); break; /* 32 Mega byte */ -- cgit v1.2.3 From c04051f533da0408e21782f2e39f88281201f511 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Thu, 26 Mar 2015 14:09:18 -0300 Subject: staging: sm750fb: Add spaces after ',' This patch fixes the checkpatch.pl error: ERROR: space required after that ',' (ctx:VxV) Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 54 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 3913aa4a9068..4f2e0dbf5a2e 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -230,11 +230,11 @@ unsigned int ddk750_getVMSize(void) /* for 750,always use power mode0*/ reg = PEEK32(MODE0_GATE); - reg = FIELD_SET(reg,MODE0_GATE,GPIO,ON); - POKE32(MODE0_GATE,reg); + reg = FIELD_SET(reg, MODE0_GATE, GPIO, ON); + POKE32(MODE0_GATE, reg); /* get frame buffer size from GPIO */ - reg = FIELD_GET(PEEK32(MISC_CTRL),MISC_CTRL,LOCALMEM_SIZE); + reg = FIELD_GET(PEEK32(MISC_CTRL), MISC_CTRL, LOCALMEM_SIZE); switch (reg) { case MISC_CTRL_LOCALMEM_SIZE_8M: data = MB(8); break; /* 8 Mega byte */ case MISC_CTRL_LOCALMEM_SIZE_16M: data = MB(16); break; /* 16 Mega byte */ @@ -256,7 +256,7 @@ int ddk750_initHw(initchip_param_t * pInitParam) /* turn on big endian bit*/ ulReg = PEEK32(0x74); /* now consider register definition in a big endian pattern*/ - POKE32(0x74,ulReg|0x80000000); + POKE32(0x74, ulReg|0x80000000); } #endif @@ -269,20 +269,20 @@ int ddk750_initHw(initchip_param_t * pInitParam) /* Enable display power gate & LOCALMEM power gate*/ ulReg = PEEK32(CURRENT_GATE); ulReg = FIELD_SET(ulReg, CURRENT_GATE, DISPLAY, ON); - ulReg = FIELD_SET(ulReg,CURRENT_GATE,LOCALMEM,ON); + ulReg = FIELD_SET(ulReg, CURRENT_GATE, LOCALMEM, ON); setCurrentGate(ulReg); if (getChipType() != SM750LE) { /* set panel pll and graphic mode via mmio_88 */ ulReg = PEEK32(VGA_CONFIGURATION); - ulReg = FIELD_SET(ulReg,VGA_CONFIGURATION,PLL,PANEL); - ulReg = FIELD_SET(ulReg,VGA_CONFIGURATION,MODE,GRAPHIC); - POKE32(VGA_CONFIGURATION,ulReg); + ulReg = FIELD_SET(ulReg, VGA_CONFIGURATION, PLL, PANEL); + ulReg = FIELD_SET(ulReg, VGA_CONFIGURATION, MODE, GRAPHIC); + POKE32(VGA_CONFIGURATION, ulReg); } else { #if defined(__i386__) || defined( __x86_64__) /* set graphic mode via IO method */ - outb_p(0x88,0x3d4); - outb_p(0x06,0x3d5); + outb_p(0x88, 0x3d4); + outb_p(0x06, 0x3d5); #endif } @@ -399,34 +399,34 @@ unsigned int absDiff(unsigned int a, unsigned int b) M = {1,...,255} N = {2,...,15} */ -unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) +unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) { /* used for primary and secondary channel pixel clock pll */ static pllcalparam xparm_PIXEL[] = { - /* 2^0 = 1*/ {0,0,0,1}, - /* 2^ 1 =2*/ {1,0,1,2}, - /* 2^ 2 = 4*/ {2,0,2,4}, - {3,0,3,8}, - {4,1,3,16}, - {5,2,3,32}, - /* 2^6 = 64 */ {6,3,3,64}, + /* 2^0 = 1*/ {0, 0, 0, 1}, + /* 2^ 1 =2*/ {1, 0, 1, 2}, + /* 2^ 2 = 4*/ {2, 0, 2, 4}, + {3, 0, 3, 8}, + {4, 1, 3, 16}, + {5, 2, 3, 32}, + /* 2^6 = 64 */ {6, 3, 3, 64}, }; /* used for MXCLK (chip clock) */ static pllcalparam xparm_MXCLK[] = { - /* 2^0 = 1*/ {0,0,0,1}, - /* 2^ 1 =2*/ {1,0,1,2}, - /* 2^ 2 = 4*/ {2,0,2,4}, - {3,0,3,8}, + /* 2^0 = 1*/ {0, 0, 0, 1}, + /* 2^ 1 =2*/ {1, 0, 1, 2}, + /* 2^ 2 = 4*/ {2, 0, 2, 4}, + {3, 0, 3, 8}, }; /* as sm750 register definition, N located in 2,15 and M located in 1,255 */ - int N,M,X,d; + int N, M, X, d; int xcnt; int miniDiff; - unsigned int RN,quo,rem,fl_quo; - unsigned int input,request; - unsigned int tmpClock,ret; + unsigned int RN, quo, rem, fl_quo; + unsigned int input, request; + unsigned int tmpClock, ret; pllcalparam * xparm; #if 1 @@ -469,7 +469,7 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll) if (M < 256 && M > 0) { unsigned int diff; tmpClock = pll->inputFreq *M / N / X; - diff = absDiff(tmpClock,request_orig); + diff = absDiff(tmpClock, request_orig); if (diff < miniDiff) { pll->M = M; pll->N = N; -- cgit v1.2.3 From ae59c465417a726453f36fc6167e92b14e8bda36 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Thu, 26 Mar 2015 14:09:19 -0300 Subject: staging: sm750fb: Move switch case trailing statment This patch fixes the checkpatch.pl error: ERROR: trailing statements should be on next line Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 4f2e0dbf5a2e..b30c183f489e 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -236,11 +236,16 @@ unsigned int ddk750_getVMSize(void) /* get frame buffer size from GPIO */ reg = FIELD_GET(PEEK32(MISC_CTRL), MISC_CTRL, LOCALMEM_SIZE); switch (reg) { - case MISC_CTRL_LOCALMEM_SIZE_8M: data = MB(8); break; /* 8 Mega byte */ - case MISC_CTRL_LOCALMEM_SIZE_16M: data = MB(16); break; /* 16 Mega byte */ - case MISC_CTRL_LOCALMEM_SIZE_32M: data = MB(32); break; /* 32 Mega byte */ - case MISC_CTRL_LOCALMEM_SIZE_64M: data = MB(64); break; /* 64 Mega byte */ - default: data = 0;break; + case MISC_CTRL_LOCALMEM_SIZE_8M: + data = MB(8); break; /* 8 Mega byte */ + case MISC_CTRL_LOCALMEM_SIZE_16M: + data = MB(16); break; /* 16 Mega byte */ + case MISC_CTRL_LOCALMEM_SIZE_32M: + data = MB(32); break; /* 32 Mega byte */ + case MISC_CTRL_LOCALMEM_SIZE_64M: + data = MB(64); break; /* 64 Mega byte */ + default: + data = 0;break; } return data; -- cgit v1.2.3 From f8da055aafec0483c12132554504ec683868c655 Mon Sep 17 00:00:00 2001 From: Helen Fornazier Date: Thu, 26 Mar 2015 14:09:20 -0300 Subject: staging: sm750fb: Change "foo * bar" style to "foo *bar" This patch fixes the checkpatch.pl error: ERROR: "foo * bar" should be "foo *bar" +int ddk750_initHw(initchip_param_t * pInitParam) Signed-off-by: Helen Fornazier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index b30c183f489e..c8a8b3ffcc74 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -251,7 +251,7 @@ unsigned int ddk750_getVMSize(void) } -int ddk750_initHw(initchip_param_t * pInitParam) +int ddk750_initHw(initchip_param_t *pInitParam) { unsigned int ulReg; -- cgit v1.2.3 From 37d3455672732b29a477732a94abfe95e199f0ce Mon Sep 17 00:00:00 2001 From: Josselin Costanzi Date: Sun, 22 Mar 2015 20:33:38 +0200 Subject: iio: add watermark logic to iio read and poll Currently the IIO buffer blocking read only wait until at least one data element is available. This patch makes the reader sleep until enough data is collected before returning to userspace. This should limit the read() calls count when trying to get data in batches. Co-author: Yannick Bedhomme Signed-off-by: Josselin Costanzi [rebased and remove buffer timeout] Signed-off-by: Octavian Purdila Reviewed-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/staging/iio/accel/sca3000_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c index f76a26885808..8589eade1057 100644 --- a/drivers/staging/iio/accel/sca3000_ring.c +++ b/drivers/staging/iio/accel/sca3000_ring.c @@ -129,9 +129,9 @@ error_ret: return ret ? ret : num_read; } -static bool sca3000_ring_buf_data_available(struct iio_buffer *r) +static size_t sca3000_ring_buf_data_available(struct iio_buffer *r) { - return r->stufftoread; + return r->stufftoread ? r->watermark : 0; } /** -- cgit v1.2.3 From 6bab2e19c5ffd1f21b28c2cabb3801a37b77ae69 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 18 Mar 2015 11:13:39 +0100 Subject: cfg80211: pass name_assign_type to rdev_add_virtual_intf() This will expose in /sys whether the ifname of a device is set by userspace or generated by the kernel. The latter kind (wlanX, etc) is not deterministic, so userspace needs to rename these devices to names that are guaranteed to stay the same between reboots. The former, however should never be renamed, so userspace needs to be able to reliably tell the difference. Similar functionality was introduced for the rtnetlink core in commit 5517750f058e ("net: rtnetlink - make create_link take name_assign_type") Signed-off-by: Tom Gundersen Cc: Kalle Valo Cc: Brett Rudley Cc: Arend van Spriel Cc: Franky (Zhenhui) Lin Cc: Hante Meuleman Cc: Johannes Berg [reformat changelog to fit 72 cols] Signed-off-by: Johannes Berg --- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 537bd8214efe..a6116fdc8678 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -2580,6 +2580,7 @@ static const struct net_device_ops rtw_cfg80211_monitor_if_ops = { }; static int rtw_cfg80211_add_monitor_if(struct rtw_adapter *padapter, char *name, + unsigned char name_assign_type, struct net_device **ndev) { int ret = 0; @@ -2612,6 +2613,7 @@ static int rtw_cfg80211_add_monitor_if(struct rtw_adapter *padapter, char *name, mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; strncpy(mon_ndev->name, name, IFNAMSIZ); mon_ndev->name[IFNAMSIZ - 1] = 0; + mon_ndev->name_assign_type = name_assign_type; mon_ndev->destructor = rtw_ndev_destructor; mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops; @@ -2654,6 +2656,7 @@ out: static struct wireless_dev * cfg80211_rtw_add_virtual_intf(struct wiphy *wiphy, const char *name, + unsigned char name_assign_type, enum nl80211_iftype type, u32 *flags, struct vif_params *params) { @@ -2673,7 +2676,8 @@ cfg80211_rtw_add_virtual_intf(struct wiphy *wiphy, const char *name, break; case NL80211_IFTYPE_MONITOR: ret = - rtw_cfg80211_add_monitor_if(padapter, (char *)name, &ndev); + rtw_cfg80211_add_monitor_if(padapter, (char *)name, + name_assign_type, &ndev); break; case NL80211_IFTYPE_P2P_CLIENT: -- cgit v1.2.3 From 8a5cc923af4298e7d40a434398743c03ef875fb1 Mon Sep 17 00:00:00 2001 From: Paul Martin Date: Mon, 30 Mar 2015 17:00:59 +0100 Subject: MIPS: Octeon: Set up ethernet hardware for little endian Signed-off-by: Paul Martin Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9635/ Signed-off-by: Ralf Baechle --- drivers/staging/octeon/ethernet-tx.c | 3 +++ drivers/staging/octeon/ethernet.c | 10 ++++++++++ 2 files changed, 13 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index b7a7854d3f7e..a078b903a168 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c @@ -274,6 +274,9 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) /* Build the PKO command */ pko_command.u64 = 0; +#ifdef __LITTLE_ENDIAN + pko_command.s.le = 1; +#endif pko_command.s.n2 = 1; /* Don't pollute L2 with the outgoing packet */ pko_command.s.segs = 1; pko_command.s.total_bytes = skb->len; diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 460e8545904f..85618f155ffa 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -170,6 +170,16 @@ static void cvm_oct_configure_common_hw(void) cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128); +#ifdef __LITTLE_ENDIAN + { + union cvmx_ipd_ctl_status ipd_ctl_status; + ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS); + ipd_ctl_status.s.pkt_lend = 1; + ipd_ctl_status.s.wqe_lend = 1; + cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_ctl_status.u64); + } +#endif + if (USE_RED) cvmx_helper_setup_red(num_packet_buffers / 4, num_packet_buffers / 8); -- cgit v1.2.3 From 97b290b5637f473588a297834c10cd750718e980 Mon Sep 17 00:00:00 2001 From: Paul Martin Date: Mon, 30 Mar 2015 17:01:01 +0100 Subject: MIPS: Octeon: Fix to IP checksum offloading in Little Endian When hardware checksum generation is switched on the checksum generation was only being signalled to the hardware correctly in Big Endian mode. Signed-off-by: Paul Martin Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9634/ Signed-off-by: Ralf Baechle --- drivers/staging/octeon/ethernet-tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index a078b903a168..5b9ac1f6d6f0 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c @@ -413,7 +413,7 @@ dont_put_skbuff_in_hw: /* Check if we can use the hardware checksumming */ if (USE_HW_TCPUDP_CHECKSUM && (skb->protocol == htons(ETH_P_IP)) && (ip_hdr(skb)->version == 4) && (ip_hdr(skb)->ihl == 5) && - ((ip_hdr(skb)->frag_off == 0) || (ip_hdr(skb)->frag_off == 1 << 14)) + ((ip_hdr(skb)->frag_off == 0) || (ip_hdr(skb)->frag_off == htons(1 << 14))) && ((ip_hdr(skb)->protocol == IPPROTO_TCP) || (ip_hdr(skb)->protocol == IPPROTO_UDP))) { /* Use hardware checksum calc */ -- cgit v1.2.3 From b72eb70209a0aac7651166d3f610ffb57b4c6e5f Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sun, 29 Mar 2015 16:14:39 +0300 Subject: Staging: iio: Add error check on iio_register_device() This patch checks if an error occurred on probe and stops the device in order to avoid wasting power. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7754.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c index 6335b5815acd..f12b2e50329b 100644 --- a/drivers/staging/iio/meter/ade7754.c +++ b/drivers/staging/iio/meter/ade7754.c @@ -550,8 +550,15 @@ static int ade7754_probe(struct spi_device *spi) /* Get the device into a sane initial state */ ret = ade7754_initial_setup(indio_dev); if (ret) - return ret; - return iio_device_register(indio_dev); + goto powerdown_on_error; + ret = iio_device_register(indio_dev); + if (ret) + goto powerdown_on_error; + return ret; + +powerdown_on_error: + ade7754_stop_device(&indio_dev->dev); + return ret; } /* fixme, confirm ordering in this function */ -- cgit v1.2.3 From 025c7da9eeba3a6c77ef9485a4c1c1a797dd7a4e Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 31 Mar 2015 12:51:10 +0300 Subject: Staging: iio: iio_dummy_evgen: Simplify NULL comparison Remove explicit NULL comparison and write it in its simpler form. Replacement done with coccinelle: @replace_rule@ expression e; @@ -e == NULL + !e Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_dummy_evgen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/iio_dummy_evgen.c b/drivers/staging/iio/iio_dummy_evgen.c index 59ad5a3efe9c..0c9c86d7b509 100644 --- a/drivers/staging/iio/iio_dummy_evgen.c +++ b/drivers/staging/iio/iio_dummy_evgen.c @@ -72,7 +72,7 @@ static int iio_dummy_evgen_create(void) int ret, i; iio_evgen = kzalloc(sizeof(*iio_evgen), GFP_KERNEL); - if (iio_evgen == NULL) + if (!iio_evgen) return -ENOMEM; iio_evgen->base = irq_alloc_descs(-1, 0, IIO_EVENTGEN_NO, 0); @@ -105,7 +105,7 @@ int iio_dummy_evgen_get_irq(void) { int i, ret = 0; - if (iio_evgen == NULL) + if (!iio_evgen) return -ENODEV; mutex_lock(&iio_evgen->lock); -- cgit v1.2.3 From 8f94c31feeba8b872ed18d075b57de5d04575d05 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 31 Mar 2015 12:51:38 +0300 Subject: Staging: iio: iio_simple_dummy: Remove explicit NULL comparison This patch removes explicit NULL comparison and writes it in its simpler form. Done with coccinelle: @replace_rule@ expression e; @@ -e == NULL + !e Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_simple_dummy.c | 2 +- drivers/staging/iio/iio_simple_dummy_buffer.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c index 8341dce82f10..b47bf9fb64be 100644 --- a/drivers/staging/iio/iio_simple_dummy.c +++ b/drivers/staging/iio/iio_simple_dummy.c @@ -588,7 +588,7 @@ static int iio_dummy_probe(int index) * for chip specific state information. */ indio_dev = iio_device_alloc(sizeof(*st)); - if (indio_dev == NULL) { + if (!indio_dev) { ret = -ENOMEM; goto error_ret; } diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c index 360a4c980722..a651b8922d0a 100644 --- a/drivers/staging/iio/iio_simple_dummy_buffer.c +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c @@ -50,7 +50,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) u16 *data; data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); - if (data == NULL) + if (!data) goto done; if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) { @@ -122,7 +122,7 @@ int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev) /* Allocate a buffer to use - here a kfifo */ buffer = iio_kfifo_allocate(); - if (buffer == NULL) { + if (!buffer) { ret = -ENOMEM; goto error_ret; } @@ -161,7 +161,7 @@ int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev) "iio_simple_dummy_consumer%d", indio_dev->id); - if (indio_dev->pollfunc == NULL) { + if (!indio_dev->pollfunc) { ret = -ENOMEM; goto error_free_buffer; } -- cgit v1.2.3 From 45297571e90bd59195011ae8e328dae84534ecef Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 31 Mar 2015 13:01:18 +0300 Subject: Staging: iio: meter: Remove explicit NULL comparison This patch removes explicit NULL comparison and replaces it with its shorter form. Detected with coccinelle. @replace_rule@ expression e; @@ -e == NULL + !e Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/meter/ade7758_core.c | 2 +- drivers/staging/iio/meter/ade7758_ring.c | 2 +- drivers/staging/iio/meter/ade7758_trigger.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c index 652aa1069b06..77141ae1349d 100644 --- a/drivers/staging/iio/meter/ade7758_core.c +++ b/drivers/staging/iio/meter/ade7758_core.c @@ -833,7 +833,7 @@ static int ade7758_probe(struct spi_device *spi) if (!st->rx) return -ENOMEM; st->tx = kcalloc(ADE7758_MAX_TX, sizeof(*st->tx), GFP_KERNEL); - if (st->tx == NULL) { + if (!st->tx) { ret = -ENOMEM; goto error_free_rx; } diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c index ead38a50b25b..9a24e0226f8b 100644 --- a/drivers/staging/iio/meter/ade7758_ring.c +++ b/drivers/staging/iio/meter/ade7758_ring.c @@ -132,7 +132,7 @@ int ade7758_configure_ring(struct iio_dev *indio_dev) indio_dev, "ade7759_consumer%d", indio_dev->id); - if (indio_dev->pollfunc == NULL) { + if (!indio_dev->pollfunc) { ret = -ENOMEM; goto error_iio_kfifo_free; } diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c index 6f45ce0478d7..5b35a7f08f4f 100644 --- a/drivers/staging/iio/meter/ade7758_trigger.c +++ b/drivers/staging/iio/meter/ade7758_trigger.c @@ -66,7 +66,7 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev) st->trig = iio_trigger_alloc("%s-dev%d", spi_get_device_id(st->us)->name, indio_dev->id); - if (st->trig == NULL) { + if (!st->trig) { ret = -ENOMEM; goto error_ret; } -- cgit v1.2.3 From e84d0724101ba8a38afab21c118135815f707733 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 31 Mar 2015 13:03:12 +0300 Subject: Staging: iio: trigger: Remove explicit NULL comparison This patch removes explicit NULL comparison and replaces it with its shorter form. Detected with coccinelle. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c index 89df1d32874d..0c1976ddee74 100644 --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c @@ -124,7 +124,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev) int i, ret; for (i = 0;; i++) { - if (pdata[i] == NULL) + if (!pdata[i]) break; trig = iio_trigger_alloc("periodic%s", pdata[i]); if (!trig) { @@ -142,7 +142,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev) trig->ops = &iio_prtc_trigger_ops; /* RTC access */ trig_info->rtc = rtc_class_open(pdata[i]); - if (trig_info->rtc == NULL) { + if (!trig_info->rtc) { ret = -EINVAL; goto error_free_trig_info; } -- cgit v1.2.3 From 16d55be4cc694f76bff0cd99a8101e943e878d38 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 31 Mar 2015 13:03:38 +0300 Subject: Staging: iio: impedance-analyzer: Remove explicit NULL comparison This patch removes explicit NULL comparison and replaces it with its shorter form. Detected with coccinelle. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index 79194399e040..c18109c55497 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c @@ -703,7 +703,7 @@ static int ad5933_probe(struct i2c_client *client, struct iio_dev *indio_dev; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st)); - if (indio_dev == NULL) + if (!indio_dev) return -ENOMEM; st = iio_priv(indio_dev); -- cgit v1.2.3 From d3f31e87dbcc2c6d3a9cf28e1404cf43ef265ebe Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 31 Mar 2015 13:04:07 +0300 Subject: Staging: iio: adc: Remove explicit NULL comparison This patch removes explicit NULL comparison and writes it in its shorter form. Detected with coccinelle. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/adc/ad7606_ring.c | 2 +- drivers/staging/iio/adc/ad7780.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/adc/ad7606_ring.c b/drivers/staging/iio/adc/ad7606_ring.c index 3bf174cb19b1..a6f8eb11242c 100644 --- a/drivers/staging/iio/adc/ad7606_ring.c +++ b/drivers/staging/iio/adc/ad7606_ring.c @@ -50,7 +50,7 @@ static void ad7606_poll_bh_to_ring(struct work_struct *work_s) int ret; buf = kzalloc(indio_dev->scan_bytes, GFP_KERNEL); - if (buf == NULL) + if (!buf) return; if (gpio_is_valid(st->pdata->gpio_frstdata)) { diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c index 66a157be2eaf..9f03fe3ee3d9 100644 --- a/drivers/staging/iio/adc/ad7780.c +++ b/drivers/staging/iio/adc/ad7780.c @@ -169,7 +169,7 @@ static int ad7780_probe(struct spi_device *spi) int ret, voltage_uv = 0; indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); - if (indio_dev == NULL) + if (!indio_dev) return -ENOMEM; st = iio_priv(indio_dev); -- cgit v1.2.3 From aa5587f3cb9fde2db852b5549ee561198aa95748 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Tue, 31 Mar 2015 13:04:29 +0300 Subject: Staging: iio: accel: Remove explicit NULL comparison This patch removes explicit NULL comparison and writes it in its equivalent shorter form. Done with coccinelle. @replace_rule@ expression e; @@ -e == NULL + !e Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/lis3l02dq_ring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index 20435b5ce5ef..b892f2cf5f9e 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -119,7 +119,7 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev, indio_dev->masklength); rx_array = kcalloc(4, scan_count, GFP_KERNEL); - if (rx_array == NULL) + if (!rx_array) return -ENOMEM; ret = lis3l02dq_read_all(indio_dev, rx_array); if (ret < 0) { @@ -142,7 +142,7 @@ static irqreturn_t lis3l02dq_trigger_handler(int irq, void *p) char *data; data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); - if (data == NULL) + if (!data) goto done; if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) @@ -412,7 +412,7 @@ int lis3l02dq_configure_buffer(struct iio_dev *indio_dev) "lis3l02dq_consumer%d", indio_dev->id); - if (indio_dev->pollfunc == NULL) { + if (!indio_dev->pollfunc) { ret = -ENOMEM; goto error_iio_sw_rb_free; } -- cgit v1.2.3 From 45de432775d6df1b349b02c4d783237937278906 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sat, 28 Mar 2015 02:57:34 +0200 Subject: Staging: rtl8712: Use memdup_user() instead of copy_from_user() Use memdup_user() to avoid its duplicated implementation and simplify code. memdup_user() uses GFP_KERNEL instead of GFP_ATOMIC, which is valid because copy_from_user() might sleep and it's useless to make the allocation atomic. Found with coccinelle. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 81f39c315947..c39d031c4aa6 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -1912,13 +1912,9 @@ static int r871x_mp_ioctl_hdl(struct net_device *dev, bset = (u8)(p->flags & 0xFFFF); len = p->length; pparmbuf = NULL; - pparmbuf = kmalloc(len, GFP_ATOMIC); - if (pparmbuf == NULL) { - ret = -ENOMEM; - goto _r871x_mp_ioctl_hdl_exit; - } - if (copy_from_user(pparmbuf, p->pointer, len)) { - ret = -EFAULT; + pparmbuf = memdup_user(p->pointer, len); + if (IS_ERR(pparmbuf)) { + ret = PTR_ERR(pparmbuf); goto _r871x_mp_ioctl_hdl_exit; } poidparam = (struct mp_ioctl_param *)pparmbuf; -- cgit v1.2.3 From b6955a8f4350686321ccc4efd2b2333d91c5c2f5 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Sat, 28 Mar 2015 03:30:12 +0200 Subject: Staging: rtl8712: Remove duplicated argument to | Delete duplicated argument to | for the state argument in the _clr_fwstate_() function call as it is redundant. Detected with coccinelle. Signed-off-by: Cristina Opriceana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_ioctl_set.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c index bd1d1b773c48..22262b3558ba 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c @@ -266,8 +266,7 @@ void r8712_set_802_11_infrastructure_mode(struct _adapter *padapter, /* clear WIFI_STATION_STATE; WIFI_AP_STATE; WIFI_ADHOC_STATE; * WIFI_ADHOC_MASTER_STATE */ _clr_fwstate_(pmlmepriv, WIFI_STATION_STATE | WIFI_AP_STATE | - WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE | - WIFI_AP_STATE); + WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE); switch (networktype) { case Ndis802_11IBSS: set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); -- cgit v1.2.3 From 5c7d08c32d0cb96ec0e831539bb68b7fe5b45973 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Wed, 1 Apr 2015 00:52:18 +0530 Subject: Staging: rtl8712: Remove zero-testing pointer typed value Removes variable comparison with 0 by using !. Done using following coccinelle script. @ disable is_zero,isnt_zero @ expression *E; expression E1,f; @@ E = f(...) <... ( - E == 0 + !E | - E != 0 + E | - 0 == E + !E | - 0 != E + E ) ...> ?E = E1 @ disable is_zero,isnt_zero @ expression *E; @@ ( E == - 0 + NULL | E != - 0 + NULL | - 0 + NULL == E | - 0 + NULL != E ) Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index a178c232b44a..bcd1a5128868 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -153,7 +153,7 @@ static u32 getcrc32(u8 *buf, u32 len) u8 *p; u32 crc; - if (bcrc32initialized == 0) + if (!bcrc32initialized) crc32_init(); crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ for (p = buf; len > 0; ++p, --len) -- cgit v1.2.3 From 967db076bd3eddb36c4699743f8304a5ffcbd814 Mon Sep 17 00:00:00 2001 From: Darshana Padmadas Date: Sat, 28 Mar 2015 17:12:53 +0530 Subject: Staging: lustre: Add function prototypes in console.h Sparse reported the following warnings: warning: symbol 'lstcon_console_init' was not declared. Should it be static? warning: symbol 'lstcon_console_fini' was not declared. Should it be static? warning: symbol 'lstcon_ioctl_entry' was not declared. Should it be static? However since these functions are used in other files, they cannot be made static, so add protoypes for the same in console.h. Signed-off-by: Darshana Padmadas Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/console.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index f960174ceff8..e41ca89f10ba 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -182,6 +182,9 @@ lstcon_id2hash (lnet_process_id_t id, struct list_head *hash) return &hash[idx]; } +int lstcon_console_init(void); +int lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_data *data); +int lstcon_console_fini(void); extern int lstcon_session_match(lst_sid_t sid); extern int lstcon_session_new(char *name, int key, unsigned version, int timeout, int flags, lst_sid_t *sid_up); -- cgit v1.2.3 From 132eacb7fbd32cbfd55d47a230aea636e48ee959 Mon Sep 17 00:00:00 2001 From: Darshana Padmadas Date: Sat, 28 Mar 2015 23:13:52 +0530 Subject: Staging: lustre: Make obd_proc_version_seq_show static The function obd_proc_version_seq_show is only used in this file, so make it static. This eliminates the following sparse warning: warning: symbol 'obd_proc_version_seq_show' was not declared. Should it be static? Signed-off-by: Darshana Padmadas Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c index 75e704dc8944..06944b863d16 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c @@ -217,7 +217,7 @@ struct miscdevice obd_psdev = { #if defined (CONFIG_PROC_FS) -int obd_proc_version_seq_show(struct seq_file *m, void *v) +static int obd_proc_version_seq_show(struct seq_file *m, void *v) { seq_printf(m, "lustre: %s\nkernel: %s\nbuild: %s\n", LUSTRE_VERSION_STRING, "patchless_client", BUILD_VERSION); -- cgit v1.2.3 From 80e177380b3a9e08a3c74ae0562c020c80ce3c2c Mon Sep 17 00:00:00 2001 From: Darshana Padmadas Date: Sat, 28 Mar 2015 23:13:53 +0530 Subject: Staging: lustre: Add header that declares function lprocfs_lmv_init_vars This patch includes the header file lmv_internal.h that declares the function lprocfs_lmv_init_vars defined in lproc_lmv.c. This eliminates the sparse warning: warning: symbol 'lprocfs_lmv_init_vars' was not declared. Should it be static? Signed-off-by: Darshana Padmadas Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c index d5bc0fbdf790..22e5c315faa4 100644 --- a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c +++ b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c @@ -40,6 +40,7 @@ #include #include "../include/lprocfs_status.h" #include "../include/obd_class.h" +#include "lmv_internal.h" static int lmv_numobd_seq_show(struct seq_file *m, void *v) { -- cgit v1.2.3 From b5edcf2f8679d2a4434f791ee19eb82b2d6997f3 Mon Sep 17 00:00:00 2001 From: Darshana Padmadas Date: Sat, 28 Mar 2015 23:13:54 +0530 Subject: Staging: lustre: Include header for functions prototypes This patch includes the header lustre/include/lclient.h that declares the functions lov_lsm_put and lov_read_and_clear_async_rc defined in lov_object.c. This eliminates warnings reported by sparse: warning: symbol was not declared. Should it be static? Signed-off-by: Darshana Padmadas Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_object.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 1fb1dfae6f72..a22342fa792d 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -42,6 +42,7 @@ #define DEBUG_SUBSYSTEM S_LOV #include "lov_cl_internal.h" +#include "../include/lclient.h" /** \addtogroup lov * @{ -- cgit v1.2.3 From 171aee168e4fe04502e2e065750dcbe0b2e0ffa9 Mon Sep 17 00:00:00 2001 From: Darshana Padmadas Date: Sat, 28 Mar 2015 23:13:55 +0530 Subject: Staging: lustre: Include header file that declares lprocfs_mdc_init_vars This patch includes the header file mdc_internal.h that declares the function lprocfs_mdc_init_vars. This also eliminates the sparse warning: warning: symbol 'lprocfs_mdc_init_vars' was not declared. Should it be static? Signed-off-by: Darshana Padmadas Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c index a4fb29496850..acfe08e459c0 100644 --- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c +++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c @@ -38,6 +38,7 @@ #include #include "../include/obd_class.h" #include "../include/lprocfs_status.h" +#include "mdc_internal.h" static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v) { -- cgit v1.2.3 From 0bf31f075c5138bab1a5d9c61798739424f51781 Mon Sep 17 00:00:00 2001 From: Darshana Padmadas Date: Sat, 28 Mar 2015 23:13:56 +0530 Subject: Staging: lustre: Mark internal functions as static This patch makes functions mgc_logname2resid, mgc_set_info_async and mgc_init static as these are only used internally. This also eliminates sparse warnings of the type: warning: symbol * was not declared. Should it be static? Signed-off-by: Darshana Padmadas Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 8496d2552d52..7947aec5c847 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -95,7 +95,7 @@ int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type) } EXPORT_SYMBOL(mgc_fsname2resid); -int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id, int type) +static int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id, int type) { char *name_end; int len; @@ -967,7 +967,7 @@ static int mgc_target_register(struct obd_export *exp, return rc; } -int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, +static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, u32 keylen, void *key, u32 vallen, void *val, struct ptlrpc_request_set *set) { @@ -1743,7 +1743,7 @@ struct obd_ops mgc_obd_ops = { .o_process_config = mgc_process_config, }; -int __init mgc_init(void) +static int __init mgc_init(void) { return class_register_type(&mgc_obd_ops, NULL, NULL, LUSTRE_MGC_NAME, NULL); -- cgit v1.2.3 From 4b80af40ebd61fcaaa9a2326a4ce401b5fe7c103 Mon Sep 17 00:00:00 2001 From: Darshana Padmadas Date: Sat, 28 Mar 2015 23:55:04 +0530 Subject: Staging: lustre: Mark internal functions static in llog_cat.c This patch marks functions llog_cat_set_first_idx and cat_cancel_cb static as these are used only within this file. Also since cat_cancel_cb is made static do not export it. This eliminates the following sparse warning: warning: symbol * was not declared. Should it be static? Signed-off-by: Darshana Padmadas Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index 08afdf332531..c8f6ab006124 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -692,7 +692,7 @@ int llog_cat_reverse_process(const struct lu_env *env, } EXPORT_SYMBOL(llog_cat_reverse_process); -int llog_cat_set_first_idx(struct llog_handle *cathandle, int index) +static int llog_cat_set_first_idx(struct llog_handle *cathandle, int index) { struct llog_log_hdr *llh = cathandle->lgh_hdr; int i, bitmap_size, idx; @@ -751,7 +751,7 @@ int llog_cat_cleanup(const struct lu_env *env, struct llog_handle *cathandle, return rc; } -int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle, +static int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle, struct llog_rec_hdr *rec, void *data) { struct llog_logid_rec *lir = (struct llog_logid_rec *)rec; @@ -795,7 +795,6 @@ int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle, return rc; } -EXPORT_SYMBOL(cat_cancel_cb); /* helper to initialize catalog llog and process it to cancel */ int llog_cat_init_and_process(const struct lu_env *env, -- cgit v1.2.3 From c471c989addf4d806c62ece60d6cfd6d9ad50c95 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Tue, 31 Mar 2015 02:29:35 +0300 Subject: staging: dgnc_sysfs: Replace printk(KERN_ERR ) with pr_err() Fix the following checkpatch warning: WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c index 2df889e29e53..65551d190515 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ b/drivers/staging/dgnc/dgnc_sysfs.c @@ -75,7 +75,7 @@ void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver) rc |= driver_create_file(driverfs, &driver_attr_maxboards); rc |= driver_create_file(driverfs, &driver_attr_pollrate); if (rc) - printk(KERN_ERR "DGNC: sysfs driver_create_file failed!\n"); + pr_err("DGNC: sysfs driver_create_file failed!\n"); } -- cgit v1.2.3 From 822aa3e22f6eace077b53b28176aaf001a92a61d Mon Sep 17 00:00:00 2001 From: Luca Wehrstedt Date: Thu, 2 Apr 2015 16:33:34 +0200 Subject: Staging: lustre: lov_io.c: remove useless unary pluses Replace two occurrences of "+1" with simply "1". Signed-off-by: Luca Wehrstedt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 80c2ef6d0fb5..cf96e0d01e22 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -403,7 +403,7 @@ static int lov_io_iter_init(const struct lu_env *env, continue; } - end = lov_offset_mod(end, +1); + end = lov_offset_mod(end, 1); sub = lov_sub_get(env, lio, stripe); if (!IS_ERR(sub)) { lov_io_sub_inherit(sub->sub_io, lio, stripe, @@ -925,7 +925,7 @@ int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj, break; case CIT_FSYNC: case CIT_SETATTR: - result = +1; + result = 1; break; case CIT_WRITE: result = -EBADF; -- cgit v1.2.3 From e9ab674e23872f5c13fa0ccb531c6bc52741d23a Mon Sep 17 00:00:00 2001 From: Auguste Olivry Date: Thu, 2 Apr 2015 16:07:17 +0200 Subject: staging: lustre: ping_test.c : remove space after function names remove space between function names and open parentheses as reported by checkpatch.pl. Signed-off-by: Auguste Olivry Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/ping_test.c | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index d8c0df6e6852..644069a9fe4e 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -70,19 +70,19 @@ ping_client_init(sfw_test_instance_t *tsi) } static void -ping_client_fini (sfw_test_instance_t *tsi) +ping_client_fini(sfw_test_instance_t *tsi) { sfw_session_t *sn = tsi->tsi_batch->bat_session; int errors; - LASSERT (sn != NULL); - LASSERT (tsi->tsi_is_client); + LASSERT(sn != NULL); + LASSERT(tsi->tsi_is_client); errors = atomic_read(&sn->sn_ping_errors); if (errors) - CWARN ("%d pings have failed.\n", errors); + CWARN("%d pings have failed.\n", errors); else - CDEBUG (D_NET, "Ping test finished OK.\n"); + CDEBUG(D_NET, "Ping test finished OK.\n"); } static int @@ -118,7 +118,7 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu, } static void -ping_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) +ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) { sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_session_t *sn = tsi->tsi_batch->bat_session; @@ -126,12 +126,12 @@ ping_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; struct timeval tv; - LASSERT (sn != NULL); + LASSERT(sn != NULL); if (rpc->crpc_status != 0) { if (!tsi->tsi_stopping) /* rpc could have been aborted */ atomic_inc(&sn->sn_ping_errors); - CERROR ("Unable to ping %s (%d): %d\n", + CERROR("Unable to ping %s (%d): %d\n", libcfs_id2str(rpc->crpc_dest), reqst->pnr_seq, rpc->crpc_status); return; @@ -146,7 +146,7 @@ ping_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) if (reply->pnr_magic != LST_PING_TEST_MAGIC) { rpc->crpc_status = -EBADMSG; atomic_inc(&sn->sn_ping_errors); - CERROR ("Bad magic %u from %s, %u expected.\n", + CERROR("Bad magic %u from %s, %u expected.\n", reply->pnr_magic, libcfs_id2str(rpc->crpc_dest), LST_PING_TEST_MAGIC); return; @@ -155,14 +155,14 @@ ping_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) if (reply->pnr_seq != reqst->pnr_seq) { rpc->crpc_status = -EBADMSG; atomic_inc(&sn->sn_ping_errors); - CERROR ("Bad seq %u from %s, %u expected.\n", + CERROR("Bad seq %u from %s, %u expected.\n", reply->pnr_seq, libcfs_id2str(rpc->crpc_dest), reqst->pnr_seq); return; } cfs_fs_timeval(&tv); - CDEBUG (D_NET, "%d reply in %u usec\n", reply->pnr_seq, + CDEBUG(D_NET, "%d reply in %u usec\n", reply->pnr_seq, (unsigned)((tv.tv_sec - (unsigned)reqst->pnr_time_sec) * 1000000 + (tv.tv_usec - reqst->pnr_time_usec))); return; @@ -177,20 +177,20 @@ ping_server_handle(struct srpc_server_rpc *rpc) srpc_ping_reqst_t *req = &reqstmsg->msg_body.ping_reqst; srpc_ping_reply_t *rep = &rpc->srpc_replymsg.msg_body.ping_reply; - LASSERT (sv->sv_id == SRPC_SERVICE_PING); + LASSERT(sv->sv_id == SRPC_SERVICE_PING); if (reqstmsg->msg_magic != SRPC_MSG_MAGIC) { - LASSERT (reqstmsg->msg_magic == __swab32(SRPC_MSG_MAGIC)); + LASSERT(reqstmsg->msg_magic == __swab32(SRPC_MSG_MAGIC)); __swab32s(&req->pnr_seq); __swab32s(&req->pnr_magic); __swab64s(&req->pnr_time_sec); __swab64s(&req->pnr_time_usec); } - LASSERT (reqstmsg->msg_type == srpc_service2request(sv->sv_id)); + LASSERT(reqstmsg->msg_type == srpc_service2request(sv->sv_id)); if (req->pnr_magic != LST_PING_TEST_MAGIC) { - CERROR ("Unexpected magic %08x from %s\n", + CERROR("Unexpected magic %08x from %s\n", req->pnr_magic, libcfs_id2str(rpc->srpc_peer)); return -EINVAL; } -- cgit v1.2.3 From b311ebac5babac7ce2b11e35a1462815580324b8 Mon Sep 17 00:00:00 2001 From: Achille Aknin Date: Thu, 2 Apr 2015 16:12:04 +0200 Subject: Staging: lustre: brw_test.c: remove unneeded return statement Remove an unneeded return statement in this file Signed-off-by: Achille Aknin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/brw_test.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 463da076fa70..658f4584fff8 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -175,7 +175,6 @@ brw_fill_page(struct page *pg, int pattern, __u64 magic) } LBUG(); - return; } static int -- cgit v1.2.3 From faec8ab42b4a0f119a1cfbceef0c14b7b61059cb Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 1 Apr 2015 11:12:15 +0300 Subject: Staging: lustre: integer overflow in ioctl hdr->ioc_len is a user controlled u32 so the addition can overflow, especially on 32 bit systems. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c index a5effcd9c679..e962f89683a6 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c @@ -57,7 +57,7 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg) return -EINVAL; } - if (hdr->ioc_len + buf >= end) { + if (hdr->ioc_len >= end - buf) { CERROR("PORTALS: user buffer exceeds kernel buffer\n"); return -EINVAL; } -- cgit v1.2.3 From 005b23d6b6e7e798b6799bedffc60f33494058ea Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 1 Apr 2015 11:13:03 +0300 Subject: staging: lustre: prevent underflows in lnet_parse_reply() I don't know if "hdr->payload_length;" can really be negative, but if so then we shouldn't allow it. Do the comparison as an unsigned. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/lib-move.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 0f53c761f1a9..c2fb70e5fc4e 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -1530,7 +1530,7 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg) LASSERT(md->md_offset == 0); rlength = hdr->payload_length; - mlength = min_t(int, rlength, md->md_length); + mlength = min_t(uint, rlength, md->md_length); if (mlength < rlength && (md->md_options & LNET_MD_TRUNCATE) == 0) { -- cgit v1.2.3 From ecfd2267311ebe3fb2fe5e173dfd8f84f981ba0f Mon Sep 17 00:00:00 2001 From: Charlie Wong Super <1213charlie@gmail.com> Date: Thu, 2 Apr 2015 18:10:04 +0800 Subject: Staging: comedi: addi_apci_1564: Delete a tap Fix the checkpatch.pl WARNING: line over 80 characters Signed-off-by: Charlie Wong Super <1213charlie@gmail.com> Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1564.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index c481c48cdbde..c1d00212d9b7 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -106,12 +106,12 @@ #define APCI1564_COUNTER(x) ((x) * 0x20) struct apci1564_private { - unsigned long eeprom; /* base address of EEPROM register */ - unsigned long timer; /* base address of 12-bit timer */ - unsigned long counters; /* base address of 32-bit counters */ - unsigned int mode1; /* riding-edge/high level channels */ - unsigned int mode2; /* falling-edge/low level channels */ - unsigned int ctrl; /* interrupt mode OR (edge) . AND (level) */ + unsigned long eeprom; /* base address of EEPROM register */ + unsigned long timer; /* base address of 12-bit timer */ + unsigned long counters; /* base address of 32-bit counters */ + unsigned int mode1; /* riding-edge/high level channels */ + unsigned int mode2; /* falling-edge/low level channels */ + unsigned int ctrl; /* interrupt mode OR (edge) . AND (level) */ struct task_struct *tsk_current; }; -- cgit v1.2.3 From 6ad6b5ed3e2472b399b567a2f036006bf25df467 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 2 Apr 2015 22:55:18 +0530 Subject: Staging: sm750fb: Fix C99 Comments Used C89 instead of C99 Comment and removed C99 comments performing prints only. Problem found using checkpatch.pl ERROR: do not use C99 // comments Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index c8a8b3ffcc74..70d65d10b484 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -17,7 +17,7 @@ logical_chip_type_t getChipType(void) char physicalRev; logical_chip_type_t chip; - physicalID = devId750;//either 0x718 or 0x750 + physicalID = devId750; /* either 0x718 or 0x750 */ physicalRev = revId750; if (physicalID == 0x718) @@ -256,7 +256,7 @@ int ddk750_initHw(initchip_param_t *pInitParam) unsigned int ulReg; #if 0 - //move the code to map regiter function. + /* move the code to map regiter function. */ if (getChipType() == SM718) { /* turn on big endian bit*/ ulReg = PEEK32(0x74); @@ -487,7 +487,6 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) } } - //printk("Finally: pll->n[%lu],m[%lu],od[%lu],pod[%lu]\n",pll->N,pll->M,pll->OD,pll->POD); return ret; } @@ -579,14 +578,9 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ } /* Restore input frequency from Khz to hz unit */ -// pPLL->inputFreq *= 1000; ulRequestClk *= 1000; pPLL->inputFreq = DEFAULT_INPUT_CLOCK; /* Default reference clock */ - /* Output debug information */ - //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Requested Frequency = %d\n", ulRequestClk)); - //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Input CLK = %dHz, M=%d, N=%d, OD=%d, POD=%d\n", pPLL->inputFreq, pPLL->M, pPLL->N, pPLL->OD, pPLL->POD)); - /* Return actual frequency that the PLL can set */ ret = calcPLL(pPLL); return ret; -- cgit v1.2.3 From e261e69e2d16b69eb712123b9e73bac50282b6a7 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 2 Apr 2015 22:57:55 +0530 Subject: Staging: sm750fb: Fixed indent of switch-case Fixed indent of switch-case by adding space using tabs. Problem found using checkpatch.pl ERROR: space required after that ';' (ctx:VxV) Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 70d65d10b484..cd1508a35fc2 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -245,7 +245,8 @@ unsigned int ddk750_getVMSize(void) case MISC_CTRL_LOCALMEM_SIZE_64M: data = MB(64); break; /* 64 Mega byte */ default: - data = 0;break; + data = 0; + break; } return data; -- cgit v1.2.3 From 59f084070c96f777f977ebd58dc934b9d2a1d95b Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 2 Apr 2015 23:01:04 +0530 Subject: Staging: sm750fb: Remove zero testing pointer typed value Removes variable comparison with 0. Done using following coccinelle script. @ disable is_zero,isnt_zero @ expression *E; expression E1,f; @@ E = f(...) <... ( - E == 0 + !E | - E != 0 + E | - 0 == E + !E | - 0 != E + E ) ...> ?E = E1 @ disable is_zero,isnt_zero @ expression *E; @@ ( E == - 0 + NULL | E != - 0 + NULL | - 0 + NULL == E | - 0 + NULL != E ) Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index cd1508a35fc2..9b5bb7eba279 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -110,7 +110,7 @@ void setChipClock(unsigned int frequency) return; #endif - if (frequency != 0) { + if (frequency) { /* * Set up PLL, a structure to hold the value to be set in clocks. */ @@ -139,7 +139,7 @@ void setMemoryClock(unsigned int frequency) if (getChipType() == SM750LE) return; #endif - if (frequency != 0) { + if (frequency) { /* Set the frequency to the maximum frequency that the DDR Memory can take which is 336MHz. */ if (frequency > MHz(336)) @@ -187,7 +187,7 @@ void setMasterClock(unsigned int frequency) if (getChipType() == SM750LE) return; #endif - if (frequency != 0) { + if (frequency) { /* Set the frequency to the maximum frequency that the SM750 engine can run, which is about 190 MHz. */ if (frequency > MHz(190)) -- cgit v1.2.3 From c209069e9b81b1d2a9f344c1da102f3256460c16 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 2 Apr 2015 16:28:12 +0200 Subject: Staging: lustre: module.c: remove unneeded return statement Remove an unneeded return statement in this file as reported by checkpatch.pl. Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/module.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/module.c b/drivers/staging/lustre/lnet/selftest/module.c index faf409802372..7ad62f167cea 100644 --- a/drivers/staging/lustre/lnet/selftest/module.c +++ b/drivers/staging/lustre/lnet/selftest/module.c @@ -87,7 +87,6 @@ lnet_selftest_fini(void) default: LBUG(); } - return; } static int -- cgit v1.2.3 From a18dd4702c923167e98acbb0c9d94463ce19546f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9otime=20Grohens?= Date: Thu, 2 Apr 2015 16:24:36 +0200 Subject: Staging: lustre: lnet: selftest: lconctl.c: fixed indentation of the switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Théotime Grohens Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/conctl.c | 112 +++++++++++++------------- 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 371a54df4f2f..045fe295ad54 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -857,62 +857,62 @@ lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_data *data) memset(&console_session.ses_trans_stat, 0, sizeof(lstcon_trans_stat_t)); switch (opc) { - case LSTIO_SESSION_NEW: - rc = lst_session_new_ioctl((lstio_session_new_args_t *)buf); - break; - case LSTIO_SESSION_END: - rc = lst_session_end_ioctl((lstio_session_end_args_t *)buf); - break; - case LSTIO_SESSION_INFO: - rc = lst_session_info_ioctl((lstio_session_info_args_t *)buf); - break; - case LSTIO_DEBUG: - rc = lst_debug_ioctl((lstio_debug_args_t *)buf); - break; - case LSTIO_GROUP_ADD: - rc = lst_group_add_ioctl((lstio_group_add_args_t *)buf); - break; - case LSTIO_GROUP_DEL: - rc = lst_group_del_ioctl((lstio_group_del_args_t *)buf); - break; - case LSTIO_GROUP_UPDATE: - rc = lst_group_update_ioctl((lstio_group_update_args_t *)buf); - break; - case LSTIO_NODES_ADD: - rc = lst_nodes_add_ioctl((lstio_group_nodes_args_t *)buf); - break; - case LSTIO_GROUP_LIST: - rc = lst_group_list_ioctl((lstio_group_list_args_t *)buf); - break; - case LSTIO_GROUP_INFO: - rc = lst_group_info_ioctl((lstio_group_info_args_t *)buf); - break; - case LSTIO_BATCH_ADD: - rc = lst_batch_add_ioctl((lstio_batch_add_args_t *)buf); - break; - case LSTIO_BATCH_START: - rc = lst_batch_run_ioctl((lstio_batch_run_args_t *)buf); - break; - case LSTIO_BATCH_STOP: - rc = lst_batch_stop_ioctl((lstio_batch_stop_args_t *)buf); - break; - case LSTIO_BATCH_QUERY: - rc = lst_batch_query_ioctl((lstio_batch_query_args_t *)buf); - break; - case LSTIO_BATCH_LIST: - rc = lst_batch_list_ioctl((lstio_batch_list_args_t *)buf); - break; - case LSTIO_BATCH_INFO: - rc = lst_batch_info_ioctl((lstio_batch_info_args_t *)buf); - break; - case LSTIO_TEST_ADD: - rc = lst_test_add_ioctl((lstio_test_args_t *)buf); - break; - case LSTIO_STAT_QUERY: - rc = lst_stat_query_ioctl((lstio_stat_args_t *)buf); - break; - default: - rc = -EINVAL; + case LSTIO_SESSION_NEW: + rc = lst_session_new_ioctl((lstio_session_new_args_t *)buf); + break; + case LSTIO_SESSION_END: + rc = lst_session_end_ioctl((lstio_session_end_args_t *)buf); + break; + case LSTIO_SESSION_INFO: + rc = lst_session_info_ioctl((lstio_session_info_args_t *)buf); + break; + case LSTIO_DEBUG: + rc = lst_debug_ioctl((lstio_debug_args_t *)buf); + break; + case LSTIO_GROUP_ADD: + rc = lst_group_add_ioctl((lstio_group_add_args_t *)buf); + break; + case LSTIO_GROUP_DEL: + rc = lst_group_del_ioctl((lstio_group_del_args_t *)buf); + break; + case LSTIO_GROUP_UPDATE: + rc = lst_group_update_ioctl((lstio_group_update_args_t *)buf); + break; + case LSTIO_NODES_ADD: + rc = lst_nodes_add_ioctl((lstio_group_nodes_args_t *)buf); + break; + case LSTIO_GROUP_LIST: + rc = lst_group_list_ioctl((lstio_group_list_args_t *)buf); + break; + case LSTIO_GROUP_INFO: + rc = lst_group_info_ioctl((lstio_group_info_args_t *)buf); + break; + case LSTIO_BATCH_ADD: + rc = lst_batch_add_ioctl((lstio_batch_add_args_t *)buf); + break; + case LSTIO_BATCH_START: + rc = lst_batch_run_ioctl((lstio_batch_run_args_t *)buf); + break; + case LSTIO_BATCH_STOP: + rc = lst_batch_stop_ioctl((lstio_batch_stop_args_t *)buf); + break; + case LSTIO_BATCH_QUERY: + rc = lst_batch_query_ioctl((lstio_batch_query_args_t *)buf); + break; + case LSTIO_BATCH_LIST: + rc = lst_batch_list_ioctl((lstio_batch_list_args_t *)buf); + break; + case LSTIO_BATCH_INFO: + rc = lst_batch_info_ioctl((lstio_batch_info_args_t *)buf); + break; + case LSTIO_TEST_ADD: + rc = lst_test_add_ioctl((lstio_test_args_t *)buf); + break; + case LSTIO_STAT_QUERY: + rc = lst_stat_query_ioctl((lstio_stat_args_t *)buf); + break; + default: + rc = -EINVAL; } if (copy_to_user(data->ioc_pbuf2, &console_session.ses_trans_stat, -- cgit v1.2.3 From 4ca1b8fbe609b7c52aeaa78a5f4678efcc9b8d73 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 2 Apr 2015 19:59:15 +0200 Subject: staging: lustre: include: replace OBD_CHECK_DEV by obd_check_dev Static inline functions are preferred over macros. Hence, the function obd_check_dev was introduced. obd_check_dev replaces the macro OBD_CHECK_DEV. All functions that call obd_check_dev store the return values and return them if they represent an error code. Some of the changes were carried out manually while others were done using coccinelle. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd_class.h | 31 +++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 5314f6f3dd43..9167164c5a75 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -341,6 +341,15 @@ do { \ } \ } while (0) +static inline int obd_check_dev(struct obd_device *obd) +{ + if (!obd) { + CERROR("NULL device\n"); + return -ENODEV; + } + return 0; +} + /* ensure obd_setup and !obd_stopping */ #define OBD_CHECK_DEV_ACTIVE(obd) \ do { \ @@ -594,7 +603,9 @@ static inline int obd_precleanup(struct obd_device *obd, int rc; DECLARE_LU_VARS(ldt, d); - OBD_CHECK_DEV(obd); + rc = obd_check_dev(obd); + if (rc) + return rc; ldt = obd->obd_type->typ_lu; d = obd->obd_lu_dev; if (ldt != NULL && d != NULL) { @@ -620,7 +631,9 @@ static inline int obd_cleanup(struct obd_device *obd) int rc; DECLARE_LU_VARS(ldt, d); - OBD_CHECK_DEV(obd); + rc = obd_check_dev(obd); + if (rc) + return rc; ldt = obd->obd_type->typ_lu; d = obd->obd_lu_dev; @@ -668,7 +681,9 @@ obd_process_config(struct obd_device *obd, int datalen, void *data) int rc; DECLARE_LU_VARS(ldt, d); - OBD_CHECK_DEV(obd); + rc = obd_check_dev(obd); + if (rc) + return rc; obd->obd_process_conf = 1; ldt = obd->obd_type->typ_lu; @@ -1280,7 +1295,9 @@ static inline int obd_notify(struct obd_device *obd, { int rc; - OBD_CHECK_DEV(obd); + rc = obd_check_dev(obd); + if (rc) + return rc; /* the check for async_recov is a complete hack - I'm hereby overloading the meaning to also mean "this was called from @@ -1381,7 +1398,11 @@ static inline int obd_health_check(const struct lu_env *env, static inline int obd_register_observer(struct obd_device *obd, struct obd_device *observer) { - OBD_CHECK_DEV(obd); + int rc; + + rc = obd_check_dev(obd); + if (rc) + return rc; down_write(&obd->obd_observer_link_sem); if (obd->obd_observer && observer) { up_write(&obd->obd_observer_link_sem); -- cgit v1.2.3 From f36b6553e0ffe2c06ffc025b23c13967754ce7f4 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 2 Apr 2015 20:00:24 +0200 Subject: staging: lustre: include: replace OBD_CHECK_DEV_ACTIVE by obd_check_dev_active Static inline functions are preferred over macros. The inline function obd_check_dev_active is introduced to replace OBD_CHECK_DEV_ACTIVE. All functions that call obd_check_dev_active store the return values and return them if they represent an error code. Some of the changes were carried out manually while others were done using coccinelle. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd_class.h | 29 +++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 9167164c5a75..e533cfff9ac3 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -361,6 +361,19 @@ do { \ } \ } while (0) +static inline int obd_check_dev_active(struct obd_device *obd) +{ + int rc; + + rc = obd_check_dev(obd); + if (rc) + return rc; + if (!obd->obd_set_up || obd->obd_stopping) { + CERROR("Device %d not setup\n", obd->obd_minor); + return -ENODEV; + } + return rc; +} #if defined (CONFIG_PROC_FS) #define OBD_COUNTER_OFFSET(op) \ @@ -901,7 +914,9 @@ static inline int obd_add_conn(struct obd_import *imp, struct obd_uuid *uuid, struct obd_device *obd = imp->imp_obd; int rc; - OBD_CHECK_DEV_ACTIVE(obd); + rc = obd_check_dev_active(obd); + if (rc) + return rc; OBD_CHECK_DT_OP(obd, add_conn, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, add_conn); @@ -914,7 +929,9 @@ static inline int obd_del_conn(struct obd_import *imp, struct obd_uuid *uuid) struct obd_device *obd = imp->imp_obd; int rc; - OBD_CHECK_DEV_ACTIVE(obd); + rc = obd_check_dev_active(obd); + if (rc) + return rc; OBD_CHECK_DT_OP(obd, del_conn, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, del_conn); @@ -948,7 +965,9 @@ static inline int obd_connect(const struct lu_env *env, __u64 ocf = data ? data->ocd_connect_flags : 0; /* for post-condition * check */ - OBD_CHECK_DEV_ACTIVE(obd); + rc = obd_check_dev_active(obd); + if (rc) + return rc; OBD_CHECK_DT_OP(obd, connect, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, connect); @@ -970,7 +989,9 @@ static inline int obd_reconnect(const struct lu_env *env, __u64 ocf = d ? d->ocd_connect_flags : 0; /* for post-condition * check */ - OBD_CHECK_DEV_ACTIVE(obd); + rc = obd_check_dev_active(obd); + if (rc) + return rc; OBD_CHECK_DT_OP(obd, reconnect, 0); OBD_COUNTER_INCREMENT(obd, reconnect); -- cgit v1.2.3 From 659dc3417e8502bf93c189b891d4a048edc10683 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 2 Apr 2015 20:01:15 +0200 Subject: staging: lustre: include: remove unused macros OBD_CHECK_DEV and OBD_CHECK_DEV_ACTIVE have been replaced by static inline functions. They are removed since they are not used anymore. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd_class.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index e533cfff9ac3..34b5fa3f081c 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -333,14 +333,6 @@ void obdo_le_to_cpu(struct obdo *dobdo, struct obdo *sobdo); /* Ensure obd_setup: used for cleanup which must be called while obd is stopping */ -#define OBD_CHECK_DEV(obd) \ -do { \ - if (!(obd)) { \ - CERROR("NULL device\n"); \ - return -ENODEV; \ - } \ -} while (0) - static inline int obd_check_dev(struct obd_device *obd) { if (!obd) { @@ -351,16 +343,6 @@ static inline int obd_check_dev(struct obd_device *obd) } /* ensure obd_setup and !obd_stopping */ -#define OBD_CHECK_DEV_ACTIVE(obd) \ -do { \ - OBD_CHECK_DEV(obd); \ - if (!(obd)->obd_set_up || (obd)->obd_stopping) { \ - CERROR("Device %d not setup\n", \ - (obd)->obd_minor); \ - return -ENODEV; \ - } \ -} while (0) - static inline int obd_check_dev_active(struct obd_device *obd) { int rc; -- cgit v1.2.3 From 07eb422db401fd584801197cff156b585c9ce7a9 Mon Sep 17 00:00:00 2001 From: Martin Vassor Date: Thu, 2 Apr 2015 16:47:39 +0200 Subject: Staging: lustre: lib-md.c format line too long Format comment such that it is under 80 chars Signed-off-by: Martin Vassor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/lib-md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/lib-md.c b/drivers/staging/lustre/lnet/lnet/lib-md.c index 3225c069637d..89d660fefd48 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-md.c +++ b/drivers/staging/lustre/lnet/lnet/lib-md.c @@ -123,7 +123,7 @@ lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink) lmd->md_length = total_length; - if ((umd->options & LNET_MD_MAX_SIZE) != 0 && /* max size used */ + if ((umd->options & LNET_MD_MAX_SIZE) != 0 && /* use max size */ (umd->max_size < 0 || umd->max_size > total_length)) /* illegal max_size */ return -EINVAL; -- cgit v1.2.3 From 3a338e201486897ce7d633dcbb8c43983cb1d237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Bocquet?= Date: Thu, 2 Apr 2015 17:12:33 +0200 Subject: Staging: lustre: config.c: fix lines exceeding 80 characters reported by checkpatch.pl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafaël Bocquet Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/config.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index af171e25a5ec..5f50159e4a8f 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -532,14 +532,18 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str) if (enditem == parsed) /* no empty items */ goto failed; - if (sscanf(parsed, "%d-%d/%d%n", &lo, &hi, &stride, &scanned) < 3) { + if (sscanf(parsed, "%d-%d/%d%n", &lo, &hi, + &stride, &scanned) < 3) { if (sscanf(parsed, "%d-%d%n", &lo, &hi, &scanned) < 2) { /* simple string enumeration */ - if (lnet_expand1tb(&pending, str, sep, sep2, - parsed, (int)(enditem - parsed)) != 0) + if (lnet_expand1tb( + &pending, str, sep, sep2, + parsed, + (int)(enditem - parsed)) != 0) { goto failed; + } continue; } -- cgit v1.2.3 From e416a893210a4b4f17bb7e6670f8cd218080a3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Bocquet?= Date: Thu, 2 Apr 2015 17:12:34 +0200 Subject: Staging: lustre: config.c: fix a "do not add new typedefs" warning reported by checkpatch.pl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafaël Bocquet Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/config.c | 54 ++++++++++++++++--------------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 5f50159e4a8f..2dc4c4a1afd0 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -37,11 +37,11 @@ #define DEBUG_SUBSYSTEM S_LNET #include "../../include/linux/lnet/lib-lnet.h" -typedef struct { /* tmp struct for parsing routes */ +struct lnet_text_buf_t { /* tmp struct for parsing routes */ struct list_head ltb_list; /* stash on lists */ int ltb_size; /* allocated size */ char ltb_text[0]; /* text buffer */ -} lnet_text_buf_t; +}; static int lnet_tbnob; /* track text buf allocation */ #define LNET_MAX_TEXTBUF_NOB (64<<10) /* bound allocation */ @@ -365,14 +365,14 @@ lnet_parse_networks(struct list_head *nilist, char *networks) return -EINVAL; } -static lnet_text_buf_t * +static struct lnet_text_buf_t * lnet_new_text_buf(int str_len) { - lnet_text_buf_t *ltb; + struct lnet_text_buf_t *ltb; int nob; /* NB allocate space for the terminating 0 */ - nob = offsetof(lnet_text_buf_t, ltb_text[str_len + 1]); + nob = offsetof(struct lnet_text_buf_t, ltb_text[str_len + 1]); if (nob > LNET_SINGLE_TEXTBUF_NOB) { /* _way_ conservative for "route net gateway..." */ CERROR("text buffer too big\n"); @@ -395,7 +395,7 @@ lnet_new_text_buf(int str_len) } static void -lnet_free_text_buf(lnet_text_buf_t *ltb) +lnet_free_text_buf(struct lnet_text_buf_t *ltb) { lnet_tbnob -= ltb->ltb_size; LIBCFS_FREE(ltb, ltb->ltb_size); @@ -404,10 +404,10 @@ lnet_free_text_buf(lnet_text_buf_t *ltb) static void lnet_free_text_bufs(struct list_head *tbs) { - lnet_text_buf_t *ltb; + struct lnet_text_buf_t *ltb; while (!list_empty(tbs)) { - ltb = list_entry(tbs->next, lnet_text_buf_t, ltb_list); + ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list); list_del(<b->ltb_list); lnet_free_text_buf(ltb); @@ -421,7 +421,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str) char *sep; int nob; int i; - lnet_text_buf_t *ltb; + struct lnet_text_buf_t *ltb; INIT_LIST_HEAD(&pending); @@ -479,7 +479,7 @@ lnet_expand1tb(struct list_head *list, { int len1 = (int)(sep1 - str); int len2 = strlen(sep2 + 1); - lnet_text_buf_t *ltb; + struct lnet_text_buf_t *ltb; LASSERT(*sep1 == '['); LASSERT(*sep2 == ']'); @@ -636,7 +636,7 @@ lnet_parse_route(char *str, int *im_a_router) struct list_head *tmp2; __u32 net; lnet_nid_t nid; - lnet_text_buf_t *ltb; + struct lnet_text_buf_t *ltb; int rc; char *sep; char *token = str; @@ -692,7 +692,8 @@ lnet_parse_route(char *str, int *im_a_router) list_add_tail(tmp1, tmp2); while (tmp1 != tmp2) { - ltb = list_entry(tmp1, lnet_text_buf_t, ltb_list); + ltb = list_entry(tmp1, struct lnet_text_buf_t, + ltb_list); rc = lnet_str2tbs_expand(tmp1->next, ltb->ltb_text); if (rc < 0) @@ -732,12 +733,13 @@ lnet_parse_route(char *str, int *im_a_router) LASSERT(!list_empty(&gateways)); list_for_each(tmp1, &nets) { - ltb = list_entry(tmp1, lnet_text_buf_t, ltb_list); + ltb = list_entry(tmp1, struct lnet_text_buf_t, ltb_list); net = libcfs_str2net(ltb->ltb_text); LASSERT(net != LNET_NIDNET(LNET_NID_ANY)); list_for_each(tmp2, &gateways) { - ltb = list_entry(tmp2, lnet_text_buf_t, ltb_list); + ltb = list_entry(tmp2, struct lnet_text_buf_t, + ltb_list); nid = libcfs_str2nid(ltb->ltb_text); LASSERT(nid != LNET_NID_ANY); @@ -770,10 +772,10 @@ lnet_parse_route(char *str, int *im_a_router) static int lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router) { - lnet_text_buf_t *ltb; + struct lnet_text_buf_t *ltb; while (!list_empty(tbs)) { - ltb = list_entry(tbs->next, lnet_text_buf_t, ltb_list); + ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list); if (lnet_parse_route(ltb->ltb_text, im_a_router) < 0) { lnet_free_text_bufs(tbs); @@ -907,8 +909,8 @@ lnet_splitnets(char *source, struct list_head *nets) int offset = 0; int offset2; int len; - lnet_text_buf_t *tb; - lnet_text_buf_t *tb2; + struct lnet_text_buf_t *tb; + struct lnet_text_buf_t *tb2; struct list_head *t; char *sep; char *bracket; @@ -917,7 +919,7 @@ lnet_splitnets(char *source, struct list_head *nets) LASSERT(!list_empty(nets)); LASSERT(nets->next == nets->prev); /* single entry */ - tb = list_entry(nets->next, lnet_text_buf_t, ltb_list); + tb = list_entry(nets->next, struct lnet_text_buf_t, ltb_list); for (;;) { sep = strchr(tb->ltb_text, ','); @@ -953,7 +955,7 @@ lnet_splitnets(char *source, struct list_head *nets) } list_for_each(t, nets) { - tb2 = list_entry(t, lnet_text_buf_t, ltb_list); + tb2 = list_entry(t, struct lnet_text_buf_t, ltb_list); if (tb2 == tb) continue; @@ -992,8 +994,8 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) struct list_head current_nets; struct list_head *t; struct list_head *t2; - lnet_text_buf_t *tb; - lnet_text_buf_t *tb2; + struct lnet_text_buf_t *tb; + struct lnet_text_buf_t *tb2; __u32 net1; __u32 net2; int len; @@ -1016,7 +1018,7 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) rc = 0; while (!list_empty(&raw_entries)) { - tb = list_entry(raw_entries.next, lnet_text_buf_t, + tb = list_entry(raw_entries.next, struct lnet_text_buf_t, ltb_list); strncpy(source, tb->ltb_text, sizeof(source)-1); @@ -1043,12 +1045,12 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) dup = 0; list_for_each(t, ¤t_nets) { - tb = list_entry(t, lnet_text_buf_t, ltb_list); + tb = list_entry(t, struct lnet_text_buf_t, ltb_list); net1 = lnet_netspec2net(tb->ltb_text); LASSERT(net1 != LNET_NIDNET(LNET_NID_ANY)); list_for_each(t2, &matched_nets) { - tb2 = list_entry(t2, lnet_text_buf_t, + tb2 = list_entry(t2, struct lnet_text_buf_t, ltb_list); net2 = lnet_netspec2net(tb2->ltb_text); LASSERT(net2 != LNET_NIDNET(LNET_NID_ANY)); @@ -1069,7 +1071,7 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) } list_for_each_safe(t, t2, ¤t_nets) { - tb = list_entry(t, lnet_text_buf_t, ltb_list); + tb = list_entry(t, struct lnet_text_buf_t, ltb_list); list_del(&tb->ltb_list); list_add_tail(&tb->ltb_list, &matched_nets); -- cgit v1.2.3 From af967b29c810bfceb547f312ea62920675094738 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Apr 2015 16:10:15 +0200 Subject: Staging: lustre: o2iblnd_cb.c: Removed a bunch of spaces before parenthesis Fixed warnings as reported by checkpatch.pl Also fixed padding before function arguments when needed Signed-off-by: Guillaume Matheron Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 80 +++++++++++----------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 48d885dc51d9..1bfe06e3164e 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -41,19 +41,19 @@ #include "o2iblnd.h" static void -kiblnd_tx_done (lnet_ni_t *ni, kib_tx_t *tx) +kiblnd_tx_done(lnet_ni_t *ni, kib_tx_t *tx) { lnet_msg_t *lntmsg[2]; kib_net_t *net = ni->ni_data; int rc; int i; - LASSERT (net != NULL); - LASSERT (!in_interrupt()); - LASSERT (!tx->tx_queued); /* mustn't be queued for sending */ - LASSERT (tx->tx_sending == 0); /* mustn't be awaiting sent callback */ - LASSERT (!tx->tx_waiting); /* mustn't be awaiting peer response */ - LASSERT (tx->tx_pool != NULL); + LASSERT(net != NULL); + LASSERT(!in_interrupt()); + LASSERT(!tx->tx_queued); /* mustn't be queued for sending */ + LASSERT(tx->tx_sending == 0); /* mustn't be awaiting sent callback */ + LASSERT(!tx->tx_waiting); /* mustn't be awaiting peer response */ + LASSERT(tx->tx_pool != NULL); kiblnd_unmap_tx(ni, tx); @@ -63,7 +63,7 @@ kiblnd_tx_done (lnet_ni_t *ni, kib_tx_t *tx) rc = tx->tx_status; if (tx->tx_conn != NULL) { - LASSERT (ni == tx->tx_conn->ibc_peer->ibp_ni); + LASSERT(ni == tx->tx_conn->ibc_peer->ibp_ni); kiblnd_conn_decref(tx->tx_conn); tx->tx_conn = NULL; @@ -84,12 +84,12 @@ kiblnd_tx_done (lnet_ni_t *ni, kib_tx_t *tx) } void -kiblnd_txlist_done (lnet_ni_t *ni, struct list_head *txlist, int status) +kiblnd_txlist_done(lnet_ni_t *ni, struct list_head *txlist, int status) { kib_tx_t *tx; - while (!list_empty (txlist)) { - tx = list_entry (txlist->next, kib_tx_t, tx_list); + while(!list_empty (txlist)) { + tx = list_entry(txlist->next, kib_tx_t, tx_list); list_del(&tx->tx_list); /* complete now */ @@ -113,16 +113,16 @@ kiblnd_get_idle_tx(lnet_ni_t *ni, lnet_nid_t target) return NULL; tx = container_of(node, kib_tx_t, tx_list); - LASSERT (tx->tx_nwrq == 0); - LASSERT (!tx->tx_queued); - LASSERT (tx->tx_sending == 0); - LASSERT (!tx->tx_waiting); - LASSERT (tx->tx_status == 0); - LASSERT (tx->tx_conn == NULL); - LASSERT (tx->tx_lntmsg[0] == NULL); - LASSERT (tx->tx_lntmsg[1] == NULL); - LASSERT (tx->tx_u.pmr == NULL); - LASSERT (tx->tx_nfrags == 0); + LASSERT(tx->tx_nwrq == 0); + LASSERT(!tx->tx_queued); + LASSERT(tx->tx_sending == 0); + LASSERT(!tx->tx_waiting); + LASSERT(tx->tx_status == 0); + LASSERT(tx->tx_conn == NULL); + LASSERT(tx->tx_lntmsg[0] == NULL); + LASSERT(tx->tx_lntmsg[1] == NULL); + LASSERT(tx->tx_u.pmr == NULL); + LASSERT(tx->tx_nfrags == 0); return tx; } @@ -143,7 +143,7 @@ kiblnd_drop_rx(kib_rx_t *rx) } int -kiblnd_post_rx (kib_rx_t *rx, int credit) +kiblnd_post_rx(kib_rx_t *rx, int credit) { kib_conn_t *conn = rx->rx_conn; kib_net_t *net = conn->ibc_peer->ibp_ni->ni_data; @@ -151,14 +151,14 @@ kiblnd_post_rx (kib_rx_t *rx, int credit) struct ib_mr *mr; int rc; - LASSERT (net != NULL); - LASSERT (!in_interrupt()); - LASSERT (credit == IBLND_POSTRX_NO_CREDIT || - credit == IBLND_POSTRX_PEER_CREDIT || - credit == IBLND_POSTRX_RSRVD_CREDIT); + LASSERT(net != NULL); + LASSERT(!in_interrupt()); + LASSERT(credit == IBLND_POSTRX_NO_CREDIT || + credit == IBLND_POSTRX_PEER_CREDIT || + credit == IBLND_POSTRX_RSRVD_CREDIT); mr = kiblnd_find_dma_mr(conn->ibc_hdev, rx->rx_msgaddr, IBLND_MSG_SIZE); - LASSERT (mr != NULL); + LASSERT(mr != NULL); rx->rx_sge.lkey = mr->lkey; rx->rx_sge.addr = rx->rx_msgaddr; @@ -169,8 +169,8 @@ kiblnd_post_rx (kib_rx_t *rx, int credit) rx->rx_wrq.num_sge = 1; rx->rx_wrq.wr_id = kiblnd_ptr2wreqid(rx, IBLND_WID_RX); - LASSERT (conn->ibc_state >= IBLND_CONN_INIT); - LASSERT (rx->rx_nob >= 0); /* not posted */ + LASSERT(conn->ibc_state >= IBLND_CONN_INIT); + LASSERT(rx->rx_nob >= 0); /* not posted */ if (conn->ibc_state > IBLND_CONN_ESTABLISHED) { kiblnd_drop_rx(rx); /* No more posts for this rx */ @@ -217,8 +217,8 @@ kiblnd_find_waiting_tx_locked(kib_conn_t *conn, int txtype, __u64 cookie) list_for_each(tmp, &conn->ibc_active_txs) { kib_tx_t *tx = list_entry(tmp, kib_tx_t, tx_list); - LASSERT (!tx->tx_queued); - LASSERT (tx->tx_sending != 0 || tx->tx_waiting); + LASSERT(!tx->tx_queued); + LASSERT(tx->tx_sending != 0 || tx->tx_waiting); if (tx->tx_cookie != cookie) continue; @@ -293,7 +293,7 @@ kiblnd_send_completion(kib_conn_t *conn, int type, int status, __u64 cookie) } static void -kiblnd_handle_rx (kib_rx_t *rx) +kiblnd_handle_rx(kib_rx_t *rx) { kib_msg_t *msg = rx->rx_msg; kib_conn_t *conn = rx->rx_conn; @@ -304,11 +304,11 @@ kiblnd_handle_rx (kib_rx_t *rx) int rc2; int post_credit; - LASSERT (conn->ibc_state >= IBLND_CONN_ESTABLISHED); + LASSERT(conn->ibc_state >= IBLND_CONN_ESTABLISHED); - CDEBUG (D_NET, "Received %x[%d] from %s\n", - msg->ibm_type, credits, - libcfs_nid2str(conn->ibc_peer->ibp_nid)); + CDEBUG(D_NET, "Received %x[%d] from %s\n", + msg->ibm_type, credits, + libcfs_nid2str(conn->ibc_peer->ibp_nid)); if (credits != 0) { /* Have I received credits that will let me send? */ @@ -377,8 +377,8 @@ kiblnd_handle_rx (kib_rx_t *rx) break; case IBLND_MSG_PUT_NAK: - CWARN ("PUT_NACK from %s\n", - libcfs_nid2str(conn->ibc_peer->ibp_nid)); + CWARN("PUT_NACK from %s\n", + libcfs_nid2str(conn->ibc_peer->ibp_nid)); post_credit = IBLND_POSTRX_RSRVD_CREDIT; kiblnd_handle_completion(conn, IBLND_MSG_PUT_REQ, msg->ibm_u.completion.ibcm_status, @@ -402,7 +402,7 @@ kiblnd_handle_rx (kib_rx_t *rx) break; } - LASSERT (tx->tx_waiting); + LASSERT(tx->tx_waiting); /* CAVEAT EMPTOR: I could be racing with tx_complete, but... * (a) I can overwrite tx_msg since my peer has received it! * (b) tx_waiting set tells tx_complete() it's not done. */ -- cgit v1.2.3 From 0b0033a15f6fe79015eea477c4e7b4c2ff4357c5 Mon Sep 17 00:00:00 2001 From: Gwendoline Chouasne-Guillon Date: Thu, 2 Apr 2015 16:11:04 +0200 Subject: Staging: lustre: o2iblnd_modparam.c: remove unneeded space before the arguments of a function Remove unneeded space before the arguments of a function Signed_off_by: Gwendoline Chouasne-guillon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c index 8b4a8e9a29b4..9da0485ebad5 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c @@ -177,7 +177,7 @@ kib_tunables_t kiblnd_tunables = { }; int -kiblnd_tunables_init (void) +kiblnd_tunables_init(void) { if (kiblnd_translate_mtu(*kiblnd_tunables.kib_ib_mtu) < 0) { CERROR("Invalid ib_mtu %d, expected 256/512/1024/2048/4096\n", -- cgit v1.2.3 From 21c25a9ff87502e74130b568c102802b27891f1b Mon Sep 17 00:00:00 2001 From: Luca Wehrstedt Date: Thu, 2 Apr 2015 16:33:34 +0200 Subject: Staging: lustre: lov_io.c: remove useless unary pluses Replace two occurrences of "+1" with simply "1". Signed-off-by: Luca Wehrstedt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index f1f6db3f664a..fcd8bae6d2dc 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -391,7 +391,7 @@ static int lov_io_iter_init(const struct lu_env *env, endpos, &start, &end)) continue; - end = lov_offset_mod(end, +1); + end = lov_offset_mod(end, 1); sub = lov_sub_get(env, lio, stripe); if (!IS_ERR(sub)) { lov_io_sub_inherit(sub->sub_io, lio, stripe, @@ -913,7 +913,7 @@ int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj, break; case CIT_FSYNC: case CIT_SETATTR: - result = +1; + result = 1; break; case CIT_WRITE: result = -EBADF; -- cgit v1.2.3 From acc59a8b93ed4b57598506f30c89275dbb3f7f61 Mon Sep 17 00:00:00 2001 From: Cyrille Ruggero Date: Thu, 2 Apr 2015 16:09:14 +0200 Subject: Staging: lustre: dir.c: adding a blank after a declaration. Adding a blank in this file after a declaration as reported by checkpatch.pl. Signed-off-by: Cyrille Ruggero Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/dir.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index a18201913273..ad2cbc694e50 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1518,6 +1518,7 @@ out_rmdir: lump = (struct lov_user_md *)arg; } else { struct lov_user_mds_data *lmdp; + lmdp = (struct lov_user_mds_data *)arg; lump = &lmdp->lmd_lmm; } -- cgit v1.2.3 From 9fb186cf6907ba4e873d8396d7e5abfa4f22ca4e Mon Sep 17 00:00:00 2001 From: Georges-Axel Jaloyan Date: Thu, 2 Apr 2015 16:10:31 +0200 Subject: Staging: Lustre: rw26.c: include according to checkpatch.pl Signed-off-by: Georges-Axel Jaloyan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/rw26.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 2f21304046aa..91442fab5725 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include -- cgit v1.2.3 From febe73bdab9ab069144d6068248631ce1b5e80cd Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Apr 2015 19:35:45 +0200 Subject: Staging: lustre: o2iblnd.c: Started fixing coding style I focused on function declarations (placed return type on the same line as function name), and spaces between function name and parenthesis Signed-off-by: Guillaume Matheron Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 445 +++++++++------------ 1 file changed, 186 insertions(+), 259 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 651016919669..ae4069ee54ab 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -53,8 +53,7 @@ static lnd_t the_o2iblnd = { kib_data_t kiblnd_data; -static __u32 -kiblnd_cksum(void *ptr, int nob) +static __u32 kiblnd_cksum(void *ptr, int nob) { char *c = ptr; __u32 sum = 0; @@ -66,8 +65,7 @@ kiblnd_cksum(void *ptr, int nob) return (sum == 0) ? 1 : sum; } -static char * -kiblnd_msgtype2str(int type) +static char *kiblnd_msgtype2str(int type) { switch (type) { case IBLND_MSG_CONNREQ: @@ -105,8 +103,7 @@ kiblnd_msgtype2str(int type) } } -static int -kiblnd_msgtype2size(int type) +static int kiblnd_msgtype2size(int type) { const int hdr_size = offsetof(kib_msg_t, ibm_u); @@ -139,15 +136,14 @@ kiblnd_msgtype2size(int type) } } -static int -kiblnd_unpack_rd(kib_msg_t *msg, int flip) +static int kiblnd_unpack_rd(kib_msg_t *msg, int flip) { kib_rdma_desc_t *rd; int nob; int n; int i; - LASSERT (msg->ibm_type == IBLND_MSG_GET_REQ || + LASSERT(msg->ibm_type == IBLND_MSG_GET_REQ || msg->ibm_type == IBLND_MSG_PUT_ACK); rd = msg->ibm_type == IBLND_MSG_GET_REQ ? @@ -167,7 +163,7 @@ kiblnd_unpack_rd(kib_msg_t *msg, int flip) return 1; } - nob = offsetof (kib_msg_t, ibm_u) + + nob = offsetof(kib_msg_t, ibm_u) + kiblnd_rd_msg_size(rd, msg->ibm_type, n); if (msg->ibm_nob < nob) { @@ -187,9 +183,8 @@ kiblnd_unpack_rd(kib_msg_t *msg, int flip) return 0; } -void -kiblnd_pack_msg (lnet_ni_t *ni, kib_msg_t *msg, int version, - int credits, lnet_nid_t dstnid, __u64 dststamp) +void kiblnd_pack_msg(lnet_ni_t *ni, kib_msg_t *msg, int version, + int credits, lnet_nid_t dstnid, __u64 dststamp) { kib_net_t *net = ni->ni_data; @@ -212,8 +207,7 @@ kiblnd_pack_msg (lnet_ni_t *ni, kib_msg_t *msg, int version, } } -int -kiblnd_unpack_msg(kib_msg_t *msg, int nob) +int kiblnd_unpack_msg(kib_msg_t *msg, int nob) { const int hdr_size = offsetof(kib_msg_t, ibm_u); __u32 msg_cksum; @@ -269,8 +263,8 @@ kiblnd_unpack_msg(kib_msg_t *msg, int nob) if (flip) { /* leave magic unflipped as a clue to peer endianness */ msg->ibm_version = version; - CLASSERT (sizeof(msg->ibm_type) == 1); - CLASSERT (sizeof(msg->ibm_credits) == 1); + CLASSERT(sizeof(msg->ibm_type) == 1); + CLASSERT(sizeof(msg->ibm_credits) == 1); msg->ibm_nob = msg_nob; __swab64s(&msg->ibm_srcnid); __swab64s(&msg->ibm_srcstamp); @@ -324,8 +318,7 @@ kiblnd_unpack_msg(kib_msg_t *msg, int nob) return 0; } -int -kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid) +int kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid) { kib_peer_t *peer; kib_net_t *net = ni->ni_data; @@ -356,7 +349,7 @@ kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid) write_lock_irqsave(&kiblnd_data.kib_global_lock, flags); /* always called with a ref on ni, which prevents ni being shutdown */ - LASSERT (net->ibn_shutdown == 0); + LASSERT(net->ibn_shutdown == 0); /* npeers only grows with the global lock held */ atomic_inc(&net->ibn_npeers); @@ -367,18 +360,17 @@ kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid) return 0; } -void -kiblnd_destroy_peer (kib_peer_t *peer) +void kiblnd_destroy_peer(kib_peer_t *peer) { kib_net_t *net = peer->ibp_ni->ni_data; - LASSERT (net != NULL); - LASSERT (atomic_read(&peer->ibp_refcount) == 0); - LASSERT (!kiblnd_peer_active(peer)); - LASSERT (peer->ibp_connecting == 0); - LASSERT (peer->ibp_accepting == 0); - LASSERT (list_empty(&peer->ibp_conns)); - LASSERT (list_empty(&peer->ibp_tx_queue)); + LASSERT(net != NULL); + LASSERT(atomic_read(&peer->ibp_refcount) == 0); + LASSERT(!kiblnd_peer_active(peer)); + LASSERT(peer->ibp_connecting == 0); + LASSERT(peer->ibp_accepting == 0); + LASSERT(list_empty(&peer->ibp_conns)); + LASSERT(list_empty(&peer->ibp_tx_queue)); LIBCFS_FREE(peer, sizeof(*peer)); @@ -389,8 +381,7 @@ kiblnd_destroy_peer (kib_peer_t *peer) atomic_dec(&net->ibn_npeers); } -kib_peer_t * -kiblnd_find_peer_locked (lnet_nid_t nid) +kib_peer_t *kiblnd_find_peer_locked(lnet_nid_t nid) { /* the caller is responsible for accounting the additional reference * that this creates */ @@ -398,11 +389,11 @@ kiblnd_find_peer_locked (lnet_nid_t nid) struct list_head *tmp; kib_peer_t *peer; - list_for_each (tmp, peer_list) { + list_for_each(tmp, peer_list) { peer = list_entry(tmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || /* creating conns */ + LASSERT(peer->ibp_connecting > 0 || /* creating conns */ peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); /* active conn */ @@ -418,20 +409,18 @@ kiblnd_find_peer_locked (lnet_nid_t nid) return NULL; } -void -kiblnd_unlink_peer_locked (kib_peer_t *peer) +void kiblnd_unlink_peer_locked(kib_peer_t *peer) { - LASSERT (list_empty(&peer->ibp_conns)); + LASSERT(list_empty(&peer->ibp_conns)); - LASSERT (kiblnd_peer_active(peer)); + LASSERT(kiblnd_peer_active(peer)); list_del_init(&peer->ibp_list); /* lose peerlist's ref */ kiblnd_peer_decref(peer); } -static int -kiblnd_get_peer_info(lnet_ni_t *ni, int index, - lnet_nid_t *nidp, int *count) +static int kiblnd_get_peer_info(lnet_ni_t *ni, int index, + lnet_nid_t *nidp, int *count) { kib_peer_t *peer; struct list_head *ptmp; @@ -442,10 +431,10 @@ kiblnd_get_peer_info(lnet_ni_t *ni, int index, for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { - list_for_each (ptmp, &kiblnd_data.kib_peers[i]) { + list_for_each(ptmp, &kiblnd_data.kib_peers[i]) { peer = list_entry(ptmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || + LASSERT(peer->ibp_connecting > 0 || peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); @@ -468,8 +457,7 @@ kiblnd_get_peer_info(lnet_ni_t *ni, int index, return -ENOENT; } -static void -kiblnd_del_peer_locked(kib_peer_t *peer) +static void kiblnd_del_peer_locked(kib_peer_t *peer) { struct list_head *ctmp; struct list_head *cnxt; @@ -478,7 +466,7 @@ kiblnd_del_peer_locked(kib_peer_t *peer) if (list_empty(&peer->ibp_conns)) { kiblnd_unlink_peer_locked(peer); } else { - list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { + list_for_each_safe(ctmp, cnxt, &peer->ibp_conns) { conn = list_entry(ctmp, kib_conn_t, ibc_list); kiblnd_close_conn_locked(conn, 0); @@ -489,10 +477,9 @@ kiblnd_del_peer_locked(kib_peer_t *peer) * last ref on it. */ } -static int -kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) +static int kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); struct list_head *ptmp; struct list_head *pnxt; kib_peer_t *peer; @@ -512,9 +499,9 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) } for (i = lo; i <= hi; i++) { - list_for_each_safe (ptmp, pnxt, &kiblnd_data.kib_peers[i]) { + list_for_each_safe(ptmp, pnxt, &kiblnd_data.kib_peers[i]) { peer = list_entry(ptmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || + LASSERT(peer->ibp_connecting > 0 || peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); @@ -525,7 +512,7 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) continue; if (!list_empty(&peer->ibp_tx_queue)) { - LASSERT (list_empty(&peer->ibp_conns)); + LASSERT(list_empty(&peer->ibp_conns)); list_splice_init(&peer->ibp_tx_queue, &zombies); @@ -543,8 +530,7 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) return rc; } -static kib_conn_t * -kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index) +static kib_conn_t *kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index) { kib_peer_t *peer; struct list_head *ptmp; @@ -556,17 +542,17 @@ kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index) read_lock_irqsave(&kiblnd_data.kib_global_lock, flags); for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { - list_for_each (ptmp, &kiblnd_data.kib_peers[i]) { + list_for_each(ptmp, &kiblnd_data.kib_peers[i]) { peer = list_entry(ptmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || + LASSERT(peer->ibp_connecting > 0 || peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); if (peer->ibp_ni != ni) continue; - list_for_each (ctmp, &peer->ibp_conns) { + list_for_each(ctmp, &peer->ibp_conns) { if (index-- > 0) continue; @@ -584,8 +570,7 @@ kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index) return NULL; } -int -kiblnd_translate_mtu(int value) +int kiblnd_translate_mtu(int value) { switch (value) { default: @@ -605,8 +590,7 @@ kiblnd_translate_mtu(int value) } } -static void -kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid) +static void kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid) { int mtu; @@ -615,13 +599,12 @@ kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid) return; mtu = kiblnd_translate_mtu(*kiblnd_tunables.kib_ib_mtu); - LASSERT (mtu >= 0); + LASSERT(mtu >= 0); if (mtu != 0) cmid->route.path_rec->mtu = mtu; } -static int -kiblnd_get_completion_vector(kib_conn_t *conn, int cpt) +static int kiblnd_get_completion_vector(kib_conn_t *conn, int cpt) { cpumask_t *mask; int vectors; @@ -648,9 +631,8 @@ kiblnd_get_completion_vector(kib_conn_t *conn, int cpt) return 1; } -kib_conn_t * -kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, - int state, int version) +kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, + int state, int version) { /* CAVEAT EMPTOR: * If the new conn is created successfully it takes over the caller's @@ -835,7 +817,7 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, } /* Init successful! */ - LASSERT (state == IBLND_CONN_ACTIVE_CONNECT || + LASSERT(state == IBLND_CONN_ACTIVE_CONNECT || state == IBLND_CONN_PASSIVE_WAIT); conn->ibc_state = state; @@ -851,23 +833,22 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, return NULL; } -void -kiblnd_destroy_conn (kib_conn_t *conn) +void kiblnd_destroy_conn(kib_conn_t *conn) { struct rdma_cm_id *cmid = conn->ibc_cmid; kib_peer_t *peer = conn->ibc_peer; int rc; - LASSERT (!in_interrupt()); - LASSERT (atomic_read(&conn->ibc_refcount) == 0); - LASSERT (list_empty(&conn->ibc_early_rxs)); - LASSERT (list_empty(&conn->ibc_tx_noops)); - LASSERT (list_empty(&conn->ibc_tx_queue)); - LASSERT (list_empty(&conn->ibc_tx_queue_rsrvd)); - LASSERT (list_empty(&conn->ibc_tx_queue_nocred)); - LASSERT (list_empty(&conn->ibc_active_txs)); - LASSERT (conn->ibc_noops_posted == 0); - LASSERT (conn->ibc_nsends_posted == 0); + LASSERT(!in_interrupt()); + LASSERT(atomic_read(&conn->ibc_refcount) == 0); + LASSERT(list_empty(&conn->ibc_early_rxs)); + LASSERT(list_empty(&conn->ibc_tx_noops)); + LASSERT(list_empty(&conn->ibc_tx_queue)); + LASSERT(list_empty(&conn->ibc_tx_queue_rsrvd)); + LASSERT(list_empty(&conn->ibc_tx_queue_nocred)); + LASSERT(list_empty(&conn->ibc_active_txs)); + LASSERT(conn->ibc_noops_posted == 0); + LASSERT(conn->ibc_nsends_posted == 0); switch (conn->ibc_state) { default: @@ -876,7 +857,7 @@ kiblnd_destroy_conn (kib_conn_t *conn) case IBLND_CONN_DISCONNECTED: /* connvars should have been freed already */ - LASSERT (conn->ibc_connvars == NULL); + LASSERT(conn->ibc_connvars == NULL); break; case IBLND_CONN_INIT: @@ -919,15 +900,14 @@ kiblnd_destroy_conn (kib_conn_t *conn) LIBCFS_FREE(conn, sizeof(*conn)); } -int -kiblnd_close_peer_conns_locked (kib_peer_t *peer, int why) +int kiblnd_close_peer_conns_locked(kib_peer_t *peer, int why) { kib_conn_t *conn; struct list_head *ctmp; struct list_head *cnxt; int count = 0; - list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { + list_for_each_safe(ctmp, cnxt, &peer->ibp_conns) { conn = list_entry(ctmp, kib_conn_t, ibc_list); CDEBUG(D_NET, "Closing conn -> %s, version: %x, reason: %d\n", @@ -941,16 +921,15 @@ kiblnd_close_peer_conns_locked (kib_peer_t *peer, int why) return count; } -int -kiblnd_close_stale_conns_locked (kib_peer_t *peer, - int version, __u64 incarnation) +int kiblnd_close_stale_conns_locked(kib_peer_t *peer, + int version, __u64 incarnation) { kib_conn_t *conn; struct list_head *ctmp; struct list_head *cnxt; int count = 0; - list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { + list_for_each_safe(ctmp, cnxt, &peer->ibp_conns) { conn = list_entry(ctmp, kib_conn_t, ibc_list); if (conn->ibc_version == version && @@ -969,8 +948,7 @@ kiblnd_close_stale_conns_locked (kib_peer_t *peer, return count; } -static int -kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid) +static int kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid) { kib_peer_t *peer; struct list_head *ptmp; @@ -991,10 +969,10 @@ kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid) } for (i = lo; i <= hi; i++) { - list_for_each_safe (ptmp, pnxt, &kiblnd_data.kib_peers[i]) { + list_for_each_safe(ptmp, pnxt, &kiblnd_data.kib_peers[i]) { peer = list_entry(ptmp, kib_peer_t, ibp_list); - LASSERT (peer->ibp_connecting > 0 || + LASSERT(peer->ibp_connecting > 0 || peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); @@ -1017,8 +995,7 @@ kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid) return (count == 0) ? -ENOENT : 0; } -int -kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) +int kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) { struct libcfs_ioctl_data *data = arg; int rc = -EINVAL; @@ -1049,7 +1026,7 @@ kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) break; } - LASSERT (conn->ibc_cmid != NULL); + LASSERT(conn->ibc_cmid != NULL); data->ioc_nid = conn->ibc_peer->ibp_nid; if (conn->ibc_cmid->route.path_rec == NULL) data->ioc_u32[0] = 0; /* iWarp has no path MTU */ @@ -1071,8 +1048,7 @@ kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) return rc; } -void -kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) +void kiblnd_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) { unsigned long last_alive = 0; unsigned long now = cfs_time_current(); @@ -1084,7 +1060,7 @@ kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) peer = kiblnd_find_peer_locked(nid); if (peer != NULL) { - LASSERT (peer->ibp_connecting > 0 || /* creating conns */ + LASSERT(peer->ibp_connecting > 0 || /* creating conns */ peer->ibp_accepting > 0 || !list_empty(&peer->ibp_conns)); /* active conn */ last_alive = peer->ibp_last_alive; @@ -1106,8 +1082,7 @@ kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) return; } -void -kiblnd_free_pages(kib_pages_t *p) +void kiblnd_free_pages(kib_pages_t *p) { int npages = p->ibp_npages; int i; @@ -1120,8 +1095,7 @@ kiblnd_free_pages(kib_pages_t *p) LIBCFS_FREE(p, offsetof(kib_pages_t, ibp_pages[npages])); } -int -kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages) +int kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages) { kib_pages_t *p; int i; @@ -1151,19 +1125,18 @@ kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages) return 0; } -void -kiblnd_unmap_rx_descs(kib_conn_t *conn) +void kiblnd_unmap_rx_descs(kib_conn_t *conn) { kib_rx_t *rx; int i; - LASSERT (conn->ibc_rxs != NULL); - LASSERT (conn->ibc_hdev != NULL); + LASSERT(conn->ibc_rxs != NULL); + LASSERT(conn->ibc_hdev != NULL); for (i = 0; i < IBLND_RX_MSGS(conn->ibc_version); i++) { rx = &conn->ibc_rxs[i]; - LASSERT (rx->rx_nob >= 0); /* not posted */ + LASSERT(rx->rx_nob >= 0); /* not posted */ kiblnd_dma_unmap_single(conn->ibc_hdev->ibh_ibdev, KIBLND_UNMAP_ADDR(rx, rx_msgunmap, @@ -1176,8 +1149,7 @@ kiblnd_unmap_rx_descs(kib_conn_t *conn) conn->ibc_rx_pages = NULL; } -void -kiblnd_map_rx_descs(kib_conn_t *conn) +void kiblnd_map_rx_descs(kib_conn_t *conn) { kib_rx_t *rx; struct page *pg; @@ -1196,7 +1168,7 @@ kiblnd_map_rx_descs(kib_conn_t *conn) rx->rx_msgaddr = kiblnd_dma_map_single(conn->ibc_hdev->ibh_ibdev, rx->rx_msg, IBLND_MSG_SIZE, DMA_FROM_DEVICE); - LASSERT (!kiblnd_dma_mapping_error(conn->ibc_hdev->ibh_ibdev, + LASSERT(!kiblnd_dma_mapping_error(conn->ibc_hdev->ibh_ibdev, rx->rx_msgaddr)); KIBLND_UNMAP_ADDR_SET(rx, rx_msgunmap, rx->rx_msgaddr); @@ -1205,24 +1177,23 @@ kiblnd_map_rx_descs(kib_conn_t *conn) lnet_page2phys(pg) + pg_off); pg_off += IBLND_MSG_SIZE; - LASSERT (pg_off <= PAGE_SIZE); + LASSERT(pg_off <= PAGE_SIZE); if (pg_off == PAGE_SIZE) { pg_off = 0; ipg++; - LASSERT (ipg <= IBLND_RX_MSG_PAGES(conn->ibc_version)); + LASSERT(ipg <= IBLND_RX_MSG_PAGES(conn->ibc_version)); } } } -static void -kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo) +static void kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo) { kib_hca_dev_t *hdev = tpo->tpo_hdev; kib_tx_t *tx; int i; - LASSERT (tpo->tpo_pool.po_allocated == 0); + LASSERT(tpo->tpo_pool.po_allocated == 0); if (hdev == NULL) return; @@ -1239,8 +1210,7 @@ kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo) tpo->tpo_hdev = NULL; } -static kib_hca_dev_t * -kiblnd_current_hdev(kib_dev_t *dev) +static kib_hca_dev_t *kiblnd_current_hdev(kib_dev_t *dev) { kib_hca_dev_t *hdev; unsigned long flags; @@ -1265,8 +1235,7 @@ kiblnd_current_hdev(kib_dev_t *dev) return hdev; } -static void -kiblnd_map_tx_pool(kib_tx_pool_t *tpo) +static void kiblnd_map_tx_pool(kib_tx_pool_t *tpo) { kib_pages_t *txpgs = tpo->tpo_tx_pages; kib_pool_t *pool = &tpo->tpo_pool; @@ -1278,15 +1247,15 @@ kiblnd_map_tx_pool(kib_tx_pool_t *tpo) int ipage; int i; - LASSERT (net != NULL); + LASSERT(net != NULL); dev = net->ibn_dev; /* pre-mapped messages are not bigger than 1 page */ - CLASSERT (IBLND_MSG_SIZE <= PAGE_SIZE); + CLASSERT(IBLND_MSG_SIZE <= PAGE_SIZE); /* No fancy arithmetic when we do the buffer calculations */ - CLASSERT (PAGE_SIZE % IBLND_MSG_SIZE == 0); + CLASSERT(PAGE_SIZE % IBLND_MSG_SIZE == 0); tpo->tpo_hdev = kiblnd_current_hdev(dev); @@ -1300,29 +1269,28 @@ kiblnd_map_tx_pool(kib_tx_pool_t *tpo) tx->tx_msgaddr = kiblnd_dma_map_single( tpo->tpo_hdev->ibh_ibdev, tx->tx_msg, IBLND_MSG_SIZE, DMA_TO_DEVICE); - LASSERT (!kiblnd_dma_mapping_error(tpo->tpo_hdev->ibh_ibdev, + LASSERT(!kiblnd_dma_mapping_error(tpo->tpo_hdev->ibh_ibdev, tx->tx_msgaddr)); KIBLND_UNMAP_ADDR_SET(tx, tx_msgunmap, tx->tx_msgaddr); list_add(&tx->tx_list, &pool->po_free_list); page_offset += IBLND_MSG_SIZE; - LASSERT (page_offset <= PAGE_SIZE); + LASSERT(page_offset <= PAGE_SIZE); if (page_offset == PAGE_SIZE) { page_offset = 0; ipage++; - LASSERT (ipage <= txpgs->ibp_npages); + LASSERT(ipage <= txpgs->ibp_npages); } } } -struct ib_mr * -kiblnd_find_dma_mr(kib_hca_dev_t *hdev, __u64 addr, __u64 size) +struct ib_mr *kiblnd_find_dma_mr(kib_hca_dev_t *hdev, __u64 addr, __u64 size) { __u64 index; - LASSERT (hdev->ibh_mrs[0] != NULL); + LASSERT(hdev->ibh_mrs[0] != NULL); if (hdev->ibh_nmrs == 1) return hdev->ibh_mrs[0]; @@ -1336,14 +1304,13 @@ kiblnd_find_dma_mr(kib_hca_dev_t *hdev, __u64 addr, __u64 size) return NULL; } -struct ib_mr * -kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd) +struct ib_mr *kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd) { struct ib_mr *prev_mr; struct ib_mr *mr; int i; - LASSERT (hdev->ibh_mrs[0] != NULL); + LASSERT(hdev->ibh_mrs[0] != NULL); if (*kiblnd_tunables.kib_map_on_demand > 0 && *kiblnd_tunables.kib_map_on_demand <= rd->rd_nfrags) @@ -1370,10 +1337,9 @@ kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd) return mr; } -static void -kiblnd_destroy_fmr_pool(kib_fmr_pool_t *pool) +static void kiblnd_destroy_fmr_pool(kib_fmr_pool_t *pool) { - LASSERT (pool->fpo_map_count == 0); + LASSERT(pool->fpo_map_count == 0); if (pool->fpo_fmr_pool != NULL) ib_destroy_fmr_pool(pool->fpo_fmr_pool); @@ -1384,8 +1350,7 @@ kiblnd_destroy_fmr_pool(kib_fmr_pool_t *pool) LIBCFS_FREE(pool, sizeof(kib_fmr_pool_t)); } -static void -kiblnd_destroy_fmr_pool_list(struct list_head *head) +static void kiblnd_destroy_fmr_pool_list(struct list_head *head) { kib_fmr_pool_t *pool; @@ -1410,8 +1375,8 @@ static int kiblnd_fmr_flush_trigger(int ncpts) return max(IBLND_FMR_POOL_FLUSH, size); } -static int -kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t **pp_fpo) +static int kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, + kib_fmr_pool_t **pp_fpo) { /* FMR pool for RDMA */ kib_dev_t *dev = fps->fps_net->ibn_dev; @@ -1451,8 +1416,8 @@ kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t **pp_fpo) return 0; } -static void -kiblnd_fail_fmr_poolset(kib_fmr_poolset_t *fps, struct list_head *zombies) +static void kiblnd_fail_fmr_poolset(kib_fmr_poolset_t *fps, + struct list_head *zombies) { if (fps->fps_net == NULL) /* intialized? */ return; @@ -1473,8 +1438,7 @@ kiblnd_fail_fmr_poolset(kib_fmr_poolset_t *fps, struct list_head *zombies) spin_unlock(&fps->fps_lock); } -static void -kiblnd_fini_fmr_poolset(kib_fmr_poolset_t *fps) +static void kiblnd_fini_fmr_poolset(kib_fmr_poolset_t *fps) { if (fps->fps_net != NULL) { /* initialized? */ kiblnd_destroy_fmr_pool_list(&fps->fps_failed_pool_list); @@ -1482,9 +1446,8 @@ kiblnd_fini_fmr_poolset(kib_fmr_poolset_t *fps) } } -static int -kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, kib_net_t *net, - int pool_size, int flush_trigger) +static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, kib_net_t *net, + int pool_size, int flush_trigger) { kib_fmr_pool_t *fpo; int rc; @@ -1506,8 +1469,7 @@ kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, kib_net_t *net, return rc; } -static int -kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now) +static int kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now) { if (fpo->fpo_map_count != 0) /* still in use */ return 0; @@ -1516,10 +1478,9 @@ kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now) return cfs_time_aftereq(now, fpo->fpo_deadline); } -void -kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status) +void kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); kib_fmr_pool_t *fpo = fmr->fmr_pool; kib_fmr_poolset_t *fps = fpo->fpo_owner; unsigned long now = cfs_time_current(); @@ -1527,11 +1488,11 @@ kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status) int rc; rc = ib_fmr_pool_unmap(fmr->fmr_pfmr); - LASSERT (rc == 0); + LASSERT(rc == 0); if (status != 0) { rc = ib_flush_fmr_pool(fpo->fpo_fmr_pool); - LASSERT (rc == 0); + LASSERT(rc == 0); } fmr->fmr_pool = NULL; @@ -1556,9 +1517,8 @@ kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status) kiblnd_destroy_fmr_pool_list(&zombies); } -int -kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, - __u64 iov, kib_fmr_t *fmr) +int kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, + __u64 iov, kib_fmr_t *fmr) { struct ib_pool_fmr *pfmr; kib_fmr_pool_t *fpo; @@ -1627,17 +1587,15 @@ kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, goto again; } -static void -kiblnd_fini_pool(kib_pool_t *pool) +static void kiblnd_fini_pool(kib_pool_t *pool) { - LASSERT (list_empty(&pool->po_free_list)); - LASSERT (pool->po_allocated == 0); + LASSERT(list_empty(&pool->po_free_list)); + LASSERT(pool->po_allocated == 0); CDEBUG(D_NET, "Finalize %s pool\n", pool->po_owner->ps_name); } -static void -kiblnd_init_pool(kib_poolset_t *ps, kib_pool_t *pool, int size) +static void kiblnd_init_pool(kib_poolset_t *ps, kib_pool_t *pool, int size) { CDEBUG(D_NET, "Initialize %s pool\n", ps->ps_name); @@ -1648,8 +1606,7 @@ kiblnd_init_pool(kib_poolset_t *ps, kib_pool_t *pool, int size) pool->po_size = size; } -static void -kiblnd_destroy_pool_list(struct list_head *head) +static void kiblnd_destroy_pool_list(struct list_head *head) { kib_pool_t *pool; @@ -1657,13 +1614,12 @@ kiblnd_destroy_pool_list(struct list_head *head) pool = list_entry(head->next, kib_pool_t, po_list); list_del(&pool->po_list); - LASSERT (pool->po_owner != NULL); + LASSERT(pool->po_owner != NULL); pool->po_owner->ps_pool_destroy(pool); } } -static void -kiblnd_fail_poolset(kib_poolset_t *ps, struct list_head *zombies) +static void kiblnd_fail_poolset(kib_poolset_t *ps, struct list_head *zombies) { if (ps->ps_net == NULL) /* intialized? */ return; @@ -1682,8 +1638,7 @@ kiblnd_fail_poolset(kib_poolset_t *ps, struct list_head *zombies) spin_unlock(&ps->ps_lock); } -static void -kiblnd_fini_poolset(kib_poolset_t *ps) +static void kiblnd_fini_poolset(kib_poolset_t *ps) { if (ps->ps_net != NULL) { /* initialized? */ kiblnd_destroy_pool_list(&ps->ps_failed_pool_list); @@ -1691,13 +1646,12 @@ kiblnd_fini_poolset(kib_poolset_t *ps) } } -static int -kiblnd_init_poolset(kib_poolset_t *ps, int cpt, - kib_net_t *net, char *name, int size, - kib_ps_pool_create_t po_create, - kib_ps_pool_destroy_t po_destroy, - kib_ps_node_init_t nd_init, - kib_ps_node_fini_t nd_fini) +static int kiblnd_init_poolset(kib_poolset_t *ps, int cpt, + kib_net_t *net, char *name, int size, + kib_ps_pool_create_t po_create, + kib_ps_pool_destroy_t po_destroy, + kib_ps_node_init_t nd_init, + kib_ps_node_fini_t nd_fini) { kib_pool_t *pool; int rc; @@ -1727,8 +1681,7 @@ kiblnd_init_poolset(kib_poolset_t *ps, int cpt, return rc; } -static int -kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now) +static int kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now) { if (pool->po_allocated != 0) /* still in use */ return 0; @@ -1737,10 +1690,9 @@ kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now) return cfs_time_aftereq(now, pool->po_deadline); } -void -kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node) +void kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); kib_poolset_t *ps = pool->po_owner; kib_pool_t *tmp; unsigned long now = cfs_time_current(); @@ -1750,7 +1702,7 @@ kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node) if (ps->ps_node_fini != NULL) ps->ps_node_fini(pool, node); - LASSERT (pool->po_allocated > 0); + LASSERT(pool->po_allocated > 0); list_add(node, &pool->po_free_list); pool->po_allocated--; @@ -1768,8 +1720,7 @@ kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node) kiblnd_destroy_pool_list(&zombies); } -struct list_head * -kiblnd_pool_alloc_node(kib_poolset_t *ps) +struct list_head *kiblnd_pool_alloc_node(kib_poolset_t *ps) { struct list_head *node; kib_pool_t *pool; @@ -1831,8 +1782,7 @@ kiblnd_pool_alloc_node(kib_poolset_t *ps) goto again; } -void -kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr) +void kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr) { kib_pmr_pool_t *ppo = pmr->pmr_pool; struct ib_mr *mr = pmr->pmr_mr; @@ -1843,8 +1793,7 @@ kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr) ib_dereg_mr(mr); } -int -kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, +int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, kib_rdma_desc_t *rd, __u64 *iova, kib_phys_mr_t **pp_pmr) { kib_phys_mr_t *pmr; @@ -1889,19 +1838,18 @@ kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, return rc; } -static void -kiblnd_destroy_pmr_pool(kib_pool_t *pool) +static void kiblnd_destroy_pmr_pool(kib_pool_t *pool) { kib_pmr_pool_t *ppo = container_of(pool, kib_pmr_pool_t, ppo_pool); kib_phys_mr_t *pmr; - LASSERT (pool->po_allocated == 0); + LASSERT(pool->po_allocated == 0); while (!list_empty(&pool->po_free_list)) { pmr = list_entry(pool->po_free_list.next, kib_phys_mr_t, pmr_list); - LASSERT (pmr->pmr_mr == NULL); + LASSERT(pmr->pmr_mr == NULL); list_del(&pmr->pmr_list); if (pmr->pmr_ipb != NULL) { @@ -1927,8 +1875,8 @@ static inline int kiblnd_pmr_pool_size(int ncpts) return max(IBLND_PMR_POOL, size); } -static int -kiblnd_create_pmr_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po) +static int kiblnd_create_pmr_pool(kib_poolset_t *ps, int size, + kib_pool_t **pp_po) { struct kib_pmr_pool *ppo; struct kib_pool *pool; @@ -1970,13 +1918,12 @@ kiblnd_create_pmr_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po) return 0; } -static void -kiblnd_destroy_tx_pool(kib_pool_t *pool) +static void kiblnd_destroy_tx_pool(kib_pool_t *pool) { kib_tx_pool_t *tpo = container_of(pool, kib_tx_pool_t, tpo_pool); int i; - LASSERT (pool->po_allocated == 0); + LASSERT(pool->po_allocated == 0); if (tpo->tpo_tx_pages != NULL) { kiblnd_unmap_tx_pool(tpo); @@ -2026,8 +1973,8 @@ static int kiblnd_tx_pool_size(int ncpts) return max(IBLND_TX_POOL, ntx); } -static int -kiblnd_create_tx_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po) +static int kiblnd_create_tx_pool(kib_poolset_t *ps, int size, + kib_pool_t **pp_po) { int i; int npg; @@ -2110,8 +2057,7 @@ kiblnd_create_tx_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po) return -ENOMEM; } -static void -kiblnd_tx_init(kib_pool_t *pool, struct list_head *node) +static void kiblnd_tx_init(kib_pool_t *pool, struct list_head *node) { kib_tx_poolset_t *tps = container_of(pool->po_owner, kib_tx_poolset_t, tps_poolset); @@ -2120,8 +2066,7 @@ kiblnd_tx_init(kib_pool_t *pool, struct list_head *node) tx->tx_cookie = tps->tps_next_tx_cookie++; } -static void -kiblnd_net_fini_pools(kib_net_t *net) +static void kiblnd_net_fini_pools(kib_net_t *net) { int i; @@ -2162,8 +2107,7 @@ kiblnd_net_fini_pools(kib_net_t *net) } } -static int -kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) +static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) { unsigned long flags; int cpt; @@ -2291,8 +2235,7 @@ kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) return rc; } -static int -kiblnd_hdev_get_attr(kib_hca_dev_t *hdev) +static int kiblnd_hdev_get_attr(kib_hca_dev_t *hdev) { struct ib_device_attr *attr; int rc; @@ -2336,8 +2279,7 @@ kiblnd_hdev_get_attr(kib_hca_dev_t *hdev) return -EINVAL; } -static void -kiblnd_hdev_cleanup_mrs(kib_hca_dev_t *hdev) +static void kiblnd_hdev_cleanup_mrs(kib_hca_dev_t *hdev) { int i; @@ -2356,8 +2298,7 @@ kiblnd_hdev_cleanup_mrs(kib_hca_dev_t *hdev) hdev->ibh_nmrs = 0; } -void -kiblnd_hdev_destroy(kib_hca_dev_t *hdev) +void kiblnd_hdev_destroy(kib_hca_dev_t *hdev) { kiblnd_hdev_cleanup_mrs(hdev); @@ -2370,8 +2311,7 @@ kiblnd_hdev_destroy(kib_hca_dev_t *hdev) LIBCFS_FREE(hdev, sizeof(*hdev)); } -static int -kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) +static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) { struct ib_mr *mr; int i; @@ -2442,7 +2382,7 @@ kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) return PTR_ERR(mr); } - LASSERT (iova == ipb.addr); + LASSERT(iova == ipb.addr); hdev->ibh_mrs[i] = mr; } @@ -2454,14 +2394,13 @@ out: return 0; } -static int -kiblnd_dummy_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) -{ /* DUMMY */ +/* DUMMY */ +static int kiblnd_dummy_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) +{ return 0; } -static int -kiblnd_dev_need_failover(kib_dev_t *dev) +static int kiblnd_dev_need_failover(kib_dev_t *dev) { struct rdma_cm_id *cmid; struct sockaddr_in srcaddr; @@ -2516,12 +2455,11 @@ kiblnd_dev_need_failover(kib_dev_t *dev) return 1; } -int -kiblnd_dev_failover(kib_dev_t *dev) +int kiblnd_dev_failover(kib_dev_t *dev) { - LIST_HEAD (zombie_tpo); - LIST_HEAD (zombie_ppo); - LIST_HEAD (zombie_fpo); + LIST_HEAD(zombie_tpo); + LIST_HEAD(zombie_ppo); + LIST_HEAD(zombie_fpo); struct rdma_cm_id *cmid = NULL; kib_hca_dev_t *hdev = NULL; kib_hca_dev_t *old; @@ -2532,7 +2470,7 @@ kiblnd_dev_failover(kib_dev_t *dev) int rc = 0; int i; - LASSERT (*kiblnd_tunables.kib_dev_failover > 1 || + LASSERT(*kiblnd_tunables.kib_dev_failover > 1 || dev->ibd_can_failover || dev->ibd_hdev == NULL); @@ -2655,11 +2593,10 @@ kiblnd_dev_failover(kib_dev_t *dev) return rc; } -void -kiblnd_destroy_dev (kib_dev_t *dev) +void kiblnd_destroy_dev(kib_dev_t *dev) { - LASSERT (dev->ibd_nnets == 0); - LASSERT (list_empty(&dev->ibd_nets)); + LASSERT(dev->ibd_nnets == 0); + LASSERT(list_empty(&dev->ibd_nets)); list_del(&dev->ibd_fail_list); list_del(&dev->ibd_list); @@ -2670,8 +2607,7 @@ kiblnd_destroy_dev (kib_dev_t *dev) LIBCFS_FREE(dev, sizeof(*dev)); } -static kib_dev_t * -kiblnd_create_dev(char *ifname) +static kib_dev_t *kiblnd_create_dev(char *ifname) { struct net_device *netdev; kib_dev_t *dev; @@ -2723,13 +2659,12 @@ kiblnd_create_dev(char *ifname) return dev; } -static void -kiblnd_base_shutdown(void) +static void kiblnd_base_shutdown(void) { struct kib_sched_info *sched; int i; - LASSERT (list_empty(&kiblnd_data.kib_devs)); + LASSERT(list_empty(&kiblnd_data.kib_devs)); CDEBUG(D_MALLOC, "before LND base cleanup: kmem %d\n", atomic_read(&libcfs_kmemory)); @@ -2740,12 +2675,12 @@ kiblnd_base_shutdown(void) case IBLND_INIT_ALL: case IBLND_INIT_DATA: - LASSERT (kiblnd_data.kib_peers != NULL); + LASSERT(kiblnd_data.kib_peers != NULL); for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { - LASSERT (list_empty(&kiblnd_data.kib_peers[i])); + LASSERT(list_empty(&kiblnd_data.kib_peers[i])); } - LASSERT (list_empty(&kiblnd_data.kib_connd_zombies)); - LASSERT (list_empty(&kiblnd_data.kib_connd_conns)); + LASSERT(list_empty(&kiblnd_data.kib_connd_zombies)); + LASSERT(list_empty(&kiblnd_data.kib_connd_conns)); /* flag threads to terminate; wake and wait for them to die */ kiblnd_data.kib_shutdown = 1; @@ -2791,8 +2726,7 @@ kiblnd_base_shutdown(void) module_put(THIS_MODULE); } -void -kiblnd_shutdown (lnet_ni_t *ni) +void kiblnd_shutdown(lnet_ni_t *ni) { kib_net_t *net = ni->ni_data; rwlock_t *g_lock = &kiblnd_data.kib_global_lock; @@ -2842,7 +2776,7 @@ kiblnd_shutdown (lnet_ni_t *ni) /* fall through */ case IBLND_INIT_NOTHING: - LASSERT (atomic_read(&net->ibn_nconns) == 0); + LASSERT(atomic_read(&net->ibn_nconns) == 0); if (net->ibn_dev != NULL && net->ibn_dev->ibd_nnets == 0) @@ -2865,14 +2799,13 @@ out: return; } -static int -kiblnd_base_startup(void) +static int kiblnd_base_startup(void) { struct kib_sched_info *sched; int rc; int i; - LASSERT (kiblnd_data.kib_init == IBLND_INIT_NOTHING); + LASSERT(kiblnd_data.kib_init == IBLND_INIT_NOTHING); try_module_get(THIS_MODULE); memset(&kiblnd_data, 0, sizeof(kiblnd_data)); /* zero pointers, flags etc */ @@ -2955,8 +2888,7 @@ kiblnd_base_startup(void) return -ENETDOWN; } -static int -kiblnd_start_schedulers(struct kib_sched_info *sched) +static int kiblnd_start_schedulers(struct kib_sched_info *sched) { int rc = 0; int nthrs; @@ -2996,8 +2928,7 @@ kiblnd_start_schedulers(struct kib_sched_info *sched) return rc; } -static int -kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts, int ncpts) +static int kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts, int ncpts) { int cpt; int rc; @@ -3022,8 +2953,7 @@ kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts, int ncpts) return 0; } -static kib_dev_t * -kiblnd_dev_search(char *ifname) +static kib_dev_t *kiblnd_dev_search(char *ifname) { kib_dev_t *alias = NULL; kib_dev_t *dev; @@ -3055,8 +2985,7 @@ kiblnd_dev_search(char *ifname) return alias; } -int -kiblnd_startup (lnet_ni_t *ni) +int kiblnd_startup(lnet_ni_t *ni) { char *ifname; kib_dev_t *ibdev = NULL; @@ -3066,7 +2995,7 @@ kiblnd_startup (lnet_ni_t *ni) int rc; int newdev; - LASSERT (ni->ni_lnd == &the_o2iblnd); + LASSERT(ni->ni_lnd == &the_o2iblnd); if (kiblnd_data.kib_init == IBLND_INIT_NOTHING) { rc = kiblnd_base_startup(); @@ -3090,7 +3019,7 @@ kiblnd_startup (lnet_ni_t *ni) if (ni->ni_interfaces[0] != NULL) { /* Use the IPoIB interface specified in 'networks=' */ - CLASSERT (LNET_MAX_INTERFACES > 1); + CLASSERT(LNET_MAX_INTERFACES > 1); if (ni->ni_interfaces[1] != NULL) { CERROR("Multiple interfaces not supported\n"); goto failed; @@ -3150,21 +3079,19 @@ net_failed: return -ENETDOWN; } -static void __exit -kiblnd_module_fini (void) +static void __exit kiblnd_module_fini(void) { lnet_unregister_lnd(&the_o2iblnd); } -static int __init -kiblnd_module_init (void) +static int __init kiblnd_module_init(void) { int rc; - CLASSERT (sizeof(kib_msg_t) <= IBLND_MSG_SIZE); - CLASSERT (offsetof(kib_msg_t, ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) + CLASSERT(sizeof(kib_msg_t) <= IBLND_MSG_SIZE); + CLASSERT(offsetof(kib_msg_t, ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) <= IBLND_MSG_SIZE); - CLASSERT (offsetof(kib_msg_t, ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) + CLASSERT(offsetof(kib_msg_t, ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) <= IBLND_MSG_SIZE); rc = kiblnd_tunables_init(); -- cgit v1.2.3 From 6fe7f9624d64831c6ebf8845c90c56ae5244a155 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Apr 2015 17:04:55 +0200 Subject: Staging: lustre: o2iblnd_cb.c: Removed the rest of unnecessary spaces before parenthesis I removed all the 'unneeded space' warnings given by checkpatch.pl Signed-off-by: Guillaume Matheron Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 322 ++++++++++----------- 1 file changed, 161 insertions(+), 161 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 1bfe06e3164e..43765a30717d 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -88,7 +88,7 @@ kiblnd_txlist_done(lnet_ni_t *ni, struct list_head *txlist, int status) { kib_tx_t *tx; - while(!list_empty (txlist)) { + while (!list_empty(txlist)) { tx = list_entry(txlist->next, kib_tx_t, tx_list); list_del(&tx->tx_list); @@ -454,7 +454,7 @@ kiblnd_handle_rx(kib_rx_t *rx) } static void -kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) +kiblnd_rx_complete(kib_rx_t *rx, int status, int nob) { kib_msg_t *msg = rx->rx_msg; kib_conn_t *conn = rx->rx_conn; @@ -463,8 +463,8 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) int rc; int err = -EIO; - LASSERT (net != NULL); - LASSERT (rx->rx_nob < 0); /* was posted */ + LASSERT(net != NULL); + LASSERT(rx->rx_nob < 0); /* was posted */ rx->rx_nob = 0; /* isn't now */ if (conn->ibc_state > IBLND_CONN_ESTABLISHED) @@ -476,12 +476,12 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) goto failed; } - LASSERT (nob >= 0); + LASSERT(nob >= 0); rx->rx_nob = nob; rc = kiblnd_unpack_msg(msg, rx->rx_nob); if (rc != 0) { - CERROR ("Error %d unpacking rx from %s\n", + CERROR("Error %d unpacking rx from %s\n", rc, libcfs_nid2str(conn->ibc_peer->ibp_nid)); goto failed; } @@ -490,7 +490,7 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) msg->ibm_dstnid != ni->ni_nid || msg->ibm_srcstamp != conn->ibc_incarnation || msg->ibm_dststamp != net->ibn_incarnation) { - CERROR ("Stale rx from %s\n", + CERROR("Stale rx from %s\n", libcfs_nid2str(conn->ibc_peer->ibp_nid)); err = -ESTALE; goto failed; @@ -525,13 +525,13 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) } static struct page * -kiblnd_kvaddr_to_page (unsigned long vaddr) +kiblnd_kvaddr_to_page(unsigned long vaddr) { struct page *page; if (is_vmalloc_addr((void *)vaddr)) { - page = vmalloc_to_page ((void *)vaddr); - LASSERT (page != NULL); + page = vmalloc_to_page((void *)vaddr); + LASSERT(page != NULL); return page; } #ifdef CONFIG_HIGHMEM @@ -542,8 +542,8 @@ kiblnd_kvaddr_to_page (unsigned long vaddr) LBUG(); } #endif - page = virt_to_page (vaddr); - LASSERT (page != NULL); + page = virt_to_page(vaddr); + LASSERT(page != NULL); return page; } @@ -567,7 +567,7 @@ kiblnd_fmr_map_tx(kib_net_t *net, kib_tx_t *tx, kib_rdma_desc_t *rd, int nob) for (i = 0, npages = 0; i < rd->rd_nfrags; i++) { for (size = 0; size < rd->rd_frags[i].rf_nob; size += hdev->ibh_page_size) { - pages[npages ++] = (rd->rd_frags[i].rf_addr & + pages[npages++] = (rd->rd_frags[i].rf_addr & hdev->ibh_page_mask) + size; } } @@ -577,7 +577,7 @@ kiblnd_fmr_map_tx(kib_net_t *net, kib_tx_t *tx, kib_rdma_desc_t *rd, int nob) fps = net->ibn_fmr_ps[cpt]; rc = kiblnd_fmr_pool_map(fps, pages, npages, 0, &tx->tx_u.fmr); if (rc != 0) { - CERROR ("Can't map %d pages: %d\n", npages, rc); + CERROR("Can't map %d pages: %d\n", npages, rc); return rc; } @@ -706,26 +706,26 @@ kiblnd_setup_rd_iov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, int fragnob; int page_offset; - LASSERT (nob > 0); - LASSERT (niov > 0); - LASSERT (net != NULL); + LASSERT(nob > 0); + LASSERT(niov > 0); + LASSERT(net != NULL); while (offset >= iov->iov_len) { offset -= iov->iov_len; niov--; iov++; - LASSERT (niov > 0); + LASSERT(niov > 0); } sg = tx->tx_frags; do { - LASSERT (niov > 0); + LASSERT(niov > 0); vaddr = ((unsigned long)iov->iov_base) + offset; page_offset = vaddr & (PAGE_SIZE - 1); page = kiblnd_kvaddr_to_page(vaddr); if (page == NULL) { - CERROR ("Can't find page\n"); + CERROR("Can't find page\n"); return -EFAULT; } @@ -749,7 +749,7 @@ kiblnd_setup_rd_iov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, } static int -kiblnd_setup_rd_kiov (lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, +kiblnd_setup_rd_kiov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, int nkiov, lnet_kiov_t *kiov, int offset, int nob) { kib_net_t *net = ni->ni_data; @@ -758,20 +758,20 @@ kiblnd_setup_rd_kiov (lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, CDEBUG(D_NET, "niov %d offset %d nob %d\n", nkiov, offset, nob); - LASSERT (nob > 0); - LASSERT (nkiov > 0); - LASSERT (net != NULL); + LASSERT(nob > 0); + LASSERT(nkiov > 0); + LASSERT(net != NULL); while (offset >= kiov->kiov_len) { offset -= kiov->kiov_len; nkiov--; kiov++; - LASSERT (nkiov > 0); + LASSERT(nkiov > 0); } sg = tx->tx_frags; do { - LASSERT (nkiov > 0); + LASSERT(nkiov > 0); fragnob = min((int)(kiov->kiov_len - offset), nob); @@ -789,7 +789,7 @@ kiblnd_setup_rd_kiov (lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd, } static int -kiblnd_post_tx_locked (kib_conn_t *conn, kib_tx_t *tx, int credit) +kiblnd_post_tx_locked(kib_conn_t *conn, kib_tx_t *tx, int credit) __releases(conn->ibc_lock) __acquires(conn->ibc_lock) { @@ -800,16 +800,16 @@ kiblnd_post_tx_locked (kib_conn_t *conn, kib_tx_t *tx, int credit) int done; struct ib_send_wr *bad_wrq; - LASSERT (tx->tx_queued); + LASSERT(tx->tx_queued); /* We rely on this for QP sizing */ - LASSERT (tx->tx_nwrq > 0); - LASSERT (tx->tx_nwrq <= 1 + IBLND_RDMA_FRAGS(ver)); + LASSERT(tx->tx_nwrq > 0); + LASSERT(tx->tx_nwrq <= 1 + IBLND_RDMA_FRAGS(ver)); - LASSERT (credit == 0 || credit == 1); - LASSERT (conn->ibc_outstanding_credits >= 0); - LASSERT (conn->ibc_outstanding_credits <= IBLND_MSG_QUEUE_SIZE(ver)); - LASSERT (conn->ibc_credits >= 0); - LASSERT (conn->ibc_credits <= IBLND_MSG_QUEUE_SIZE(ver)); + LASSERT(credit == 0 || credit == 1); + LASSERT(conn->ibc_outstanding_credits >= 0); + LASSERT(conn->ibc_outstanding_credits <= IBLND_MSG_QUEUE_SIZE(ver)); + LASSERT(conn->ibc_credits >= 0); + LASSERT(conn->ibc_credits <= IBLND_MSG_QUEUE_SIZE(ver)); if (conn->ibc_nsends_posted == IBLND_CONCURRENT_SENDS(ver)) { /* tx completions outstanding... */ @@ -923,7 +923,7 @@ kiblnd_post_tx_locked (kib_conn_t *conn, kib_tx_t *tx, int credit) } void -kiblnd_check_sends (kib_conn_t *conn) +kiblnd_check_sends(kib_conn_t *conn) { int ver = conn->ibc_version; lnet_ni_t *ni = conn->ibc_peer->ibp_ni; @@ -938,10 +938,10 @@ kiblnd_check_sends (kib_conn_t *conn) spin_lock(&conn->ibc_lock); - LASSERT (conn->ibc_nsends_posted <= IBLND_CONCURRENT_SENDS(ver)); - LASSERT (!IBLND_OOB_CAPABLE(ver) || + LASSERT(conn->ibc_nsends_posted <= IBLND_CONCURRENT_SENDS(ver)); + LASSERT(!IBLND_OOB_CAPABLE(ver) || conn->ibc_noops_posted <= IBLND_OOB_MSGS(ver)); - LASSERT (conn->ibc_reserved_credits >= 0); + LASSERT(conn->ibc_reserved_credits >= 0); while (conn->ibc_reserved_credits > 0 && !list_empty(&conn->ibc_tx_queue_rsrvd)) { @@ -974,7 +974,7 @@ kiblnd_check_sends (kib_conn_t *conn) tx = list_entry(conn->ibc_tx_queue_nocred.next, kib_tx_t, tx_list); } else if (!list_empty(&conn->ibc_tx_noops)) { - LASSERT (!IBLND_OOB_CAPABLE(ver)); + LASSERT(!IBLND_OOB_CAPABLE(ver)); credit = 1; tx = list_entry(conn->ibc_tx_noops.next, kib_tx_t, tx_list); @@ -995,13 +995,13 @@ kiblnd_check_sends (kib_conn_t *conn) } static void -kiblnd_tx_complete (kib_tx_t *tx, int status) +kiblnd_tx_complete(kib_tx_t *tx, int status) { int failed = (status != IB_WC_SUCCESS); kib_conn_t *conn = tx->tx_conn; int idle; - LASSERT (tx->tx_sending > 0); + LASSERT(tx->tx_sending > 0); if (failed) { if (conn->ibc_state == IBLND_CONN_ESTABLISHED) @@ -1049,22 +1049,22 @@ kiblnd_tx_complete (kib_tx_t *tx, int status) } void -kiblnd_init_tx_msg (lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob) +kiblnd_init_tx_msg(lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob) { kib_hca_dev_t *hdev = tx->tx_pool->tpo_hdev; struct ib_sge *sge = &tx->tx_sge[tx->tx_nwrq]; struct ib_send_wr *wrq = &tx->tx_wrq[tx->tx_nwrq]; - int nob = offsetof (kib_msg_t, ibm_u) + body_nob; + int nob = offsetof(kib_msg_t, ibm_u) + body_nob; struct ib_mr *mr; - LASSERT (tx->tx_nwrq >= 0); - LASSERT (tx->tx_nwrq < IBLND_MAX_RDMA_FRAGS + 1); - LASSERT (nob <= IBLND_MSG_SIZE); + LASSERT(tx->tx_nwrq >= 0); + LASSERT(tx->tx_nwrq < IBLND_MAX_RDMA_FRAGS + 1); + LASSERT(nob <= IBLND_MSG_SIZE); kiblnd_init_msg(tx->tx_msg, type, body_nob); mr = kiblnd_find_dma_mr(hdev, tx->tx_msgaddr, nob); - LASSERT (mr != NULL); + LASSERT(mr != NULL); sge->lkey = mr->lkey; sge->addr = tx->tx_msgaddr; @@ -1083,7 +1083,7 @@ kiblnd_init_tx_msg (lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob) } int -kiblnd_init_rdma (kib_conn_t *conn, kib_tx_t *tx, int type, +kiblnd_init_rdma(kib_conn_t *conn, kib_tx_t *tx, int type, int resid, kib_rdma_desc_t *dstrd, __u64 dstcookie) { kib_msg_t *ibmsg = tx->tx_msg; @@ -1095,9 +1095,9 @@ kiblnd_init_rdma (kib_conn_t *conn, kib_tx_t *tx, int type, int dstidx; int wrknob; - LASSERT (!in_interrupt()); - LASSERT (tx->tx_nwrq == 0); - LASSERT (type == IBLND_MSG_GET_DONE || + LASSERT(!in_interrupt()); + LASSERT(tx->tx_nwrq == 0); + LASSERT(type == IBLND_MSG_GET_DONE || type == IBLND_MSG_PUT_DONE); srcidx = dstidx = 0; @@ -1162,19 +1162,19 @@ kiblnd_init_rdma (kib_conn_t *conn, kib_tx_t *tx, int type, ibmsg->ibm_u.completion.ibcm_status = rc; ibmsg->ibm_u.completion.ibcm_cookie = dstcookie; kiblnd_init_tx_msg(conn->ibc_peer->ibp_ni, tx, - type, sizeof (kib_completion_msg_t)); + type, sizeof(kib_completion_msg_t)); return rc; } void -kiblnd_queue_tx_locked (kib_tx_t *tx, kib_conn_t *conn) +kiblnd_queue_tx_locked(kib_tx_t *tx, kib_conn_t *conn) { struct list_head *q; - LASSERT (tx->tx_nwrq > 0); /* work items set up */ - LASSERT (!tx->tx_queued); /* not queued for sending already */ - LASSERT (conn->ibc_state >= IBLND_CONN_ESTABLISHED); + LASSERT(tx->tx_nwrq > 0); /* work items set up */ + LASSERT(!tx->tx_queued); /* not queued for sending already */ + LASSERT(conn->ibc_state >= IBLND_CONN_ESTABLISHED); tx->tx_queued = 1; tx->tx_deadline = jiffies + (*kiblnd_tunables.kib_timeout * HZ); @@ -1182,11 +1182,11 @@ kiblnd_queue_tx_locked (kib_tx_t *tx, kib_conn_t *conn) if (tx->tx_conn == NULL) { kiblnd_conn_addref(conn); tx->tx_conn = conn; - LASSERT (tx->tx_msg->ibm_type != IBLND_MSG_PUT_DONE); + LASSERT(tx->tx_msg->ibm_type != IBLND_MSG_PUT_DONE); } else { /* PUT_DONE first attached to conn as a PUT_REQ */ - LASSERT (tx->tx_conn == conn); - LASSERT (tx->tx_msg->ibm_type == IBLND_MSG_PUT_DONE); + LASSERT(tx->tx_conn == conn); + LASSERT(tx->tx_msg->ibm_type == IBLND_MSG_PUT_DONE); } switch (tx->tx_msg->ibm_type) { @@ -1221,7 +1221,7 @@ kiblnd_queue_tx_locked (kib_tx_t *tx, kib_conn_t *conn) } void -kiblnd_queue_tx (kib_tx_t *tx, kib_conn_t *conn) +kiblnd_queue_tx(kib_tx_t *tx, kib_conn_t *conn) { spin_lock(&conn->ibc_lock); kiblnd_queue_tx_locked(tx, conn); @@ -1268,7 +1268,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, } static void -kiblnd_connect_peer (kib_peer_t *peer) +kiblnd_connect_peer(kib_peer_t *peer) { struct rdma_cm_id *cmid; kib_dev_t *dev; @@ -1277,8 +1277,8 @@ kiblnd_connect_peer (kib_peer_t *peer) struct sockaddr_in dstaddr; int rc; - LASSERT (net != NULL); - LASSERT (peer->ibp_connecting > 0); + LASSERT(net != NULL); + LASSERT(peer->ibp_connecting > 0); cmid = kiblnd_rdma_create_id(kiblnd_cm_callback, peer, RDMA_PS_TCP, IB_QPT_RC); @@ -1318,7 +1318,7 @@ kiblnd_connect_peer (kib_peer_t *peer) goto failed2; } - LASSERT (cmid->device != NULL); + LASSERT(cmid->device != NULL); CDEBUG(D_NET, "%s: connection bound to %s:%pI4h:%s\n", libcfs_nid2str(peer->ibp_nid), dev->ibd_ifname, &dev->ibd_ifip, cmid->device->name); @@ -1333,7 +1333,7 @@ kiblnd_connect_peer (kib_peer_t *peer) } void -kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) +kiblnd_launch_tx(lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) { kib_peer_t *peer; kib_peer_t *peer2; @@ -1345,8 +1345,8 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) /* If I get here, I've committed to send, so I complete the tx with * failure on any problems */ - LASSERT (tx == NULL || tx->tx_conn == NULL); /* only set when assigned a conn */ - LASSERT (tx == NULL || tx->tx_nwrq > 0); /* work items have been set up */ + LASSERT(tx == NULL || tx->tx_conn == NULL); /* only set when assigned a conn */ + LASSERT(tx == NULL || tx->tx_nwrq > 0); /* work items have been set up */ /* First time, just use a read lock since I expect to find my peer * connected */ @@ -1374,7 +1374,7 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) if (peer != NULL) { if (list_empty(&peer->ibp_conns)) { /* found a peer, but it's still connecting... */ - LASSERT (peer->ibp_connecting != 0 || + LASSERT(peer->ibp_connecting != 0 || peer->ibp_accepting != 0); if (tx != NULL) list_add_tail(&tx->tx_list, @@ -1413,7 +1413,7 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) if (peer2 != NULL) { if (list_empty(&peer2->ibp_conns)) { /* found a peer, but it's still connecting... */ - LASSERT (peer2->ibp_connecting != 0 || + LASSERT(peer2->ibp_connecting != 0 || peer2->ibp_accepting != 0); if (tx != NULL) list_add_tail(&tx->tx_list, @@ -1435,11 +1435,11 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) } /* Brand new peer */ - LASSERT (peer->ibp_connecting == 0); + LASSERT(peer->ibp_connecting == 0); peer->ibp_connecting = 1; /* always called with a ref on ni, which prevents ni being shutdown */ - LASSERT (((kib_net_t *)ni->ni_data)->ibn_shutdown == 0); + LASSERT(((kib_net_t *)ni->ni_data)->ibn_shutdown == 0); if (tx != NULL) list_add_tail(&tx->tx_list, &peer->ibp_tx_queue); @@ -1454,7 +1454,7 @@ kiblnd_launch_tx (lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) } int -kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) +kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) { lnet_hdr_t *hdr = &lntmsg->msg_hdr; int type = lntmsg->msg_type; @@ -1476,13 +1476,13 @@ kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) CDEBUG(D_NET, "sending %d bytes in %d frags to %s\n", payload_nob, payload_niov, libcfs_id2str(target)); - LASSERT (payload_nob == 0 || payload_niov > 0); - LASSERT (payload_niov <= LNET_MAX_IOV); + LASSERT(payload_nob == 0 || payload_niov > 0); + LASSERT(payload_niov <= LNET_MAX_IOV); /* Thread context */ - LASSERT (!in_interrupt()); + LASSERT(!in_interrupt()); /* payload is either all vaddrs or all pages */ - LASSERT (!(payload_kiov != NULL && payload_iov != NULL)); + LASSERT(!(payload_kiov != NULL && payload_iov != NULL)); switch (type) { default: @@ -1490,7 +1490,7 @@ kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) return -EIO; case LNET_MSG_ACK: - LASSERT (payload_nob == 0); + LASSERT(payload_nob == 0); break; case LNET_MSG_GET: @@ -1592,12 +1592,12 @@ kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) /* send IMMEDIATE */ - LASSERT (offsetof(kib_msg_t, ibm_u.immediate.ibim_payload[payload_nob]) + LASSERT(offsetof(kib_msg_t, ibm_u.immediate.ibim_payload[payload_nob]) <= IBLND_MSG_SIZE); tx = kiblnd_get_idle_tx(ni, target.nid); if (tx == NULL) { - CERROR ("Can't send %d to %s: tx descs exhausted\n", + CERROR("Can't send %d to %s: tx descs exhausted\n", type, libcfs_nid2str(target.nid)); return -ENOMEM; } @@ -1625,7 +1625,7 @@ kiblnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) } static void -kiblnd_reply (lnet_ni_t *ni, kib_rx_t *rx, lnet_msg_t *lntmsg) +kiblnd_reply(lnet_ni_t *ni, kib_rx_t *rx, lnet_msg_t *lntmsg) { lnet_process_id_t target = lntmsg->msg_target; unsigned int niov = lntmsg->msg_niov; @@ -1687,7 +1687,7 @@ kiblnd_reply (lnet_ni_t *ni, kib_rx_t *rx, lnet_msg_t *lntmsg) } int -kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, +kiblnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen) { @@ -1700,10 +1700,10 @@ kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, int post_credit = IBLND_POSTRX_PEER_CREDIT; int rc = 0; - LASSERT (mlen <= rlen); - LASSERT (!in_interrupt()); + LASSERT(mlen <= rlen); + LASSERT(!in_interrupt()); /* Either all pages or all vaddrs */ - LASSERT (!(kiov != NULL && iov != NULL)); + LASSERT(!(kiov != NULL && iov != NULL)); switch (rxmsg->ibm_type) { default: @@ -1712,7 +1712,7 @@ kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, case IBLND_MSG_IMMEDIATE: nob = offsetof(kib_msg_t, ibm_u.immediate.ibim_payload[rlen]); if (nob > rx->rx_nob) { - CERROR ("Immediate message from %s too big: %d(%d)\n", + CERROR("Immediate message from %s too big: %d(%d)\n", libcfs_nid2str(rxmsg->ibm_u.immediate.ibim_hdr.src_nid), nob, rx->rx_nob); rc = -EPROTO; @@ -1729,7 +1729,7 @@ kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, IBLND_MSG_SIZE, rxmsg, offsetof(kib_msg_t, ibm_u.immediate.ibim_payload), mlen); - lnet_finalize (ni, lntmsg, 0); + lnet_finalize(ni, lntmsg, 0); break; case IBLND_MSG_PUT_REQ: @@ -1812,13 +1812,13 @@ kiblnd_thread_start(int (*fn)(void *arg), void *arg, char *name) } static void -kiblnd_thread_fini (void) +kiblnd_thread_fini(void) { - atomic_dec (&kiblnd_data.kib_nthreads); + atomic_dec(&kiblnd_data.kib_nthreads); } void -kiblnd_peer_alive (kib_peer_t *peer) +kiblnd_peer_alive(kib_peer_t *peer) { /* This is racy, but everyone's only writing cfs_time_current() */ peer->ibp_last_alive = cfs_time_current(); @@ -1826,7 +1826,7 @@ kiblnd_peer_alive (kib_peer_t *peer) } static void -kiblnd_peer_notify (kib_peer_t *peer) +kiblnd_peer_notify(kib_peer_t *peer) { int error = 0; unsigned long last_alive = 0; @@ -1852,7 +1852,7 @@ kiblnd_peer_notify (kib_peer_t *peer) } void -kiblnd_close_conn_locked (kib_conn_t *conn, int error) +kiblnd_close_conn_locked(kib_conn_t *conn, int error) { /* This just does the immediate housekeeping. 'error' is zero for a * normal shutdown which can happen only after the connection has been @@ -1864,7 +1864,7 @@ kiblnd_close_conn_locked (kib_conn_t *conn, int error) kib_dev_t *dev; unsigned long flags; - LASSERT (error != 0 || conn->ibc_state >= IBLND_CONN_ESTABLISHED); + LASSERT(error != 0 || conn->ibc_state >= IBLND_CONN_ESTABLISHED); if (error != 0 && conn->ibc_comms_error == 0) conn->ibc_comms_error = error; @@ -1894,7 +1894,7 @@ kiblnd_close_conn_locked (kib_conn_t *conn, int error) list_del(&conn->ibc_list); /* connd (see below) takes over ibc_list's ref */ - if (list_empty (&peer->ibp_conns) && /* no more conns */ + if (list_empty(&peer->ibp_conns) && /* no more conns */ kiblnd_peer_active(peer)) { /* still in peer table */ kiblnd_unlink_peer_locked(peer); @@ -1957,22 +1957,22 @@ kiblnd_handle_early_rxs(kib_conn_t *conn) static void kiblnd_abort_txs(kib_conn_t *conn, struct list_head *txs) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); struct list_head *tmp; struct list_head *nxt; kib_tx_t *tx; spin_lock(&conn->ibc_lock); - list_for_each_safe (tmp, nxt, txs) { - tx = list_entry (tmp, kib_tx_t, tx_list); + list_for_each_safe(tmp, nxt, txs) { + tx = list_entry(tmp, kib_tx_t, tx_list); if (txs == &conn->ibc_active_txs) { - LASSERT (!tx->tx_queued); - LASSERT (tx->tx_waiting || + LASSERT(!tx->tx_queued); + LASSERT(tx->tx_waiting || tx->tx_sending != 0); } else { - LASSERT (tx->tx_queued); + LASSERT(tx->tx_queued); } tx->tx_status = -ECONNABORTED; @@ -1980,8 +1980,8 @@ kiblnd_abort_txs(kib_conn_t *conn, struct list_head *txs) if (tx->tx_sending == 0) { tx->tx_queued = 0; - list_del (&tx->tx_list); - list_add (&tx->tx_list, &zombies); + list_del(&tx->tx_list); + list_add(&tx->tx_list, &zombies); } } @@ -1991,10 +1991,10 @@ kiblnd_abort_txs(kib_conn_t *conn, struct list_head *txs) } static void -kiblnd_finalise_conn (kib_conn_t *conn) +kiblnd_finalise_conn(kib_conn_t *conn) { - LASSERT (!in_interrupt()); - LASSERT (conn->ibc_state > IBLND_CONN_INIT); + LASSERT(!in_interrupt()); + LASSERT(conn->ibc_state > IBLND_CONN_INIT); kiblnd_set_conn_state(conn, IBLND_CONN_DISCONNECTED); @@ -2016,21 +2016,21 @@ kiblnd_finalise_conn (kib_conn_t *conn) } void -kiblnd_peer_connect_failed (kib_peer_t *peer, int active, int error) +kiblnd_peer_connect_failed(kib_peer_t *peer, int active, int error) { - LIST_HEAD (zombies); + LIST_HEAD(zombies); unsigned long flags; - LASSERT (error != 0); - LASSERT (!in_interrupt()); + LASSERT(error != 0); + LASSERT(!in_interrupt()); write_lock_irqsave(&kiblnd_data.kib_global_lock, flags); if (active) { - LASSERT (peer->ibp_connecting > 0); + LASSERT(peer->ibp_connecting > 0); peer->ibp_connecting--; } else { - LASSERT (peer->ibp_accepting > 0); + LASSERT(peer->ibp_accepting > 0); peer->ibp_accepting--; } @@ -2053,14 +2053,14 @@ kiblnd_peer_connect_failed (kib_peer_t *peer, int active, int error) peer->ibp_error = error; } else { /* Can't have blocked transmits if there are connections */ - LASSERT (list_empty(&peer->ibp_tx_queue)); + LASSERT(list_empty(&peer->ibp_tx_queue)); } write_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags); kiblnd_peer_notify(peer); - if (list_empty (&zombies)) + if (list_empty(&zombies)) return; CNETERR("Deleting messages for %s: connection failed\n", @@ -2084,8 +2084,8 @@ kiblnd_connreq_done(kib_conn_t *conn, int status) libcfs_nid2str(peer->ibp_nid), active, conn->ibc_version, status); - LASSERT (!in_interrupt()); - LASSERT ((conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT && + LASSERT(!in_interrupt()); + LASSERT((conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT && peer->ibp_connecting > 0) || (conn->ibc_state == IBLND_CONN_PASSIVE_WAIT && peer->ibp_accepting > 0)); @@ -2176,7 +2176,7 @@ kiblnd_reject(struct rdma_cm_id *cmid, kib_rej_t *rej) } static int -kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) +kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob) { rwlock_t *g_lock = &kiblnd_data.kib_global_lock; kib_msg_t *reqmsg = priv; @@ -2194,11 +2194,11 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) unsigned long flags; int rc; struct sockaddr_in *peer_addr; - LASSERT (!in_interrupt()); + LASSERT(!in_interrupt()); /* cmid inherits 'context' from the corresponding listener id */ ibdev = (kib_dev_t *)cmid->context; - LASSERT (ibdev != NULL); + LASSERT(ibdev != NULL); memset(&rej, 0, sizeof(rej)); rej.ibr_magic = IBLND_MSG_MAGIC; @@ -2366,8 +2366,8 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) peer = peer2; } else { /* Brand new peer */ - LASSERT (peer->ibp_accepting == 0); - LASSERT (peer->ibp_version == 0 && + LASSERT(peer->ibp_accepting == 0); + LASSERT(peer->ibp_version == 0 && peer->ibp_incarnation == 0); peer->ibp_accepting = 1; @@ -2375,7 +2375,7 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) peer->ibp_incarnation = reqmsg->ibm_srcstamp; /* I have a ref on ni that prevents it being shutdown */ - LASSERT (net->ibn_shutdown == 0); + LASSERT(net->ibn_shutdown == 0); kiblnd_peer_addref(peer); list_add_tail(&peer->ibp_list, kiblnd_nid2peerlist(nid)); @@ -2397,7 +2397,7 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) conn->ibc_incarnation = reqmsg->ibm_srcstamp; conn->ibc_credits = IBLND_MSG_QUEUE_SIZE(version); conn->ibc_reserved_credits = IBLND_MSG_QUEUE_SIZE(version); - LASSERT (conn->ibc_credits + conn->ibc_reserved_credits + IBLND_OOB_MSGS(version) + LASSERT(conn->ibc_credits + conn->ibc_reserved_credits + IBLND_OOB_MSGS(version) <= IBLND_RX_MSGS(version)); ackmsg = &conn->ibc_connvars->cv_msg; @@ -2449,7 +2449,7 @@ kiblnd_passive_connect (struct rdma_cm_id *cmid, void *priv, int priv_nob) } static void -kiblnd_reconnect (kib_conn_t *conn, int version, +kiblnd_reconnect(kib_conn_t *conn, int version, __u64 incarnation, int why, kib_connparams_t *cp) { kib_peer_t *peer = conn->ibc_peer; @@ -2457,8 +2457,8 @@ kiblnd_reconnect (kib_conn_t *conn, int version, int retry = 0; unsigned long flags; - LASSERT (conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT); - LASSERT (peer->ibp_connecting > 0); /* 'conn' at least */ + LASSERT(conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT); + LASSERT(peer->ibp_connecting > 0); /* 'conn' at least */ write_lock_irqsave(&kiblnd_data.kib_global_lock, flags); @@ -2504,20 +2504,20 @@ kiblnd_reconnect (kib_conn_t *conn, int version, CNETERR("%s: retrying (%s), %x, %x, queue_dep: %d, max_frag: %d, msg_size: %d\n", libcfs_nid2str(peer->ibp_nid), reason, IBLND_MSG_VERSION, version, - cp != NULL? cp->ibcp_queue_depth :IBLND_MSG_QUEUE_SIZE(version), - cp != NULL? cp->ibcp_max_frags : IBLND_RDMA_FRAGS(version), - cp != NULL? cp->ibcp_max_msg_size: IBLND_MSG_SIZE); + cp != NULL ? cp->ibcp_queue_depth : IBLND_MSG_QUEUE_SIZE(version), + cp != NULL ? cp->ibcp_max_frags : IBLND_RDMA_FRAGS(version), + cp != NULL ? cp->ibcp_max_msg_size : IBLND_MSG_SIZE); kiblnd_connect_peer(peer); } static void -kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob) +kiblnd_rejected(kib_conn_t *conn, int reason, void *priv, int priv_nob) { kib_peer_t *peer = conn->ibc_peer; - LASSERT (!in_interrupt()); - LASSERT (conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT); + LASSERT(!in_interrupt()); + LASSERT(conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT); switch (reason) { case IB_CM_REJ_STALE_CONN: @@ -2651,7 +2651,7 @@ kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob) } static void -kiblnd_check_connreply (kib_conn_t *conn, void *priv, int priv_nob) +kiblnd_check_connreply(kib_conn_t *conn, void *priv, int priv_nob) { kib_peer_t *peer = conn->ibc_peer; lnet_ni_t *ni = peer->ibp_ni; @@ -2661,7 +2661,7 @@ kiblnd_check_connreply (kib_conn_t *conn, void *priv, int priv_nob) int rc = kiblnd_unpack_msg(msg, priv_nob); unsigned long flags; - LASSERT (net != NULL); + LASSERT(net != NULL); if (rc != 0) { CERROR("Can't unpack connack from %s: %d\n", @@ -2730,7 +2730,7 @@ kiblnd_check_connreply (kib_conn_t *conn, void *priv, int priv_nob) conn->ibc_incarnation = msg->ibm_srcstamp; conn->ibc_credits = conn->ibc_reserved_credits = IBLND_MSG_QUEUE_SIZE(ver); - LASSERT (conn->ibc_credits + conn->ibc_reserved_credits + IBLND_OOB_MSGS(ver) + LASSERT(conn->ibc_credits + conn->ibc_reserved_credits + IBLND_OOB_MSGS(ver) <= IBLND_RX_MSGS(ver)); kiblnd_connreq_done(conn, 0); @@ -2742,13 +2742,13 @@ kiblnd_check_connreply (kib_conn_t *conn, void *priv, int priv_nob) * kiblnd_connreq_done(0) moves the conn state to ESTABLISHED, but then * immediately tears it down. */ - LASSERT (rc != 0); + LASSERT(rc != 0); conn->ibc_comms_error = rc; kiblnd_connreq_done(conn, 0); } static int -kiblnd_active_connect (struct rdma_cm_id *cmid) +kiblnd_active_connect(struct rdma_cm_id *cmid) { kib_peer_t *peer = (kib_peer_t *)cmid->context; kib_conn_t *conn; @@ -2913,7 +2913,7 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) LBUG(); case IBLND_CONN_PASSIVE_WAIT: - CERROR ("%s: REJECTED %d\n", + CERROR("%s: REJECTED %d\n", libcfs_nid2str(conn->ibc_peer->ibp_nid), event->status); kiblnd_connreq_done(conn, -ECONNRESET); @@ -2987,17 +2987,17 @@ kiblnd_check_txs_locked(kib_conn_t *conn, struct list_head *txs) kib_tx_t *tx; struct list_head *ttmp; - list_for_each (ttmp, txs) { - tx = list_entry (ttmp, kib_tx_t, tx_list); + list_for_each(ttmp, txs) { + tx = list_entry(ttmp, kib_tx_t, tx_list); if (txs != &conn->ibc_active_txs) { - LASSERT (tx->tx_queued); + LASSERT(tx->tx_queued); } else { - LASSERT (!tx->tx_queued); - LASSERT (tx->tx_waiting || tx->tx_sending != 0); + LASSERT(!tx->tx_queued); + LASSERT(tx->tx_waiting || tx->tx_sending != 0); } - if (cfs_time_aftereq (jiffies, tx->tx_deadline)) { + if (cfs_time_aftereq(jiffies, tx->tx_deadline)) { CERROR("Timed out tx: %s, %lu seconds\n", kiblnd_queue2str(conn, txs), cfs_duration_sec(jiffies - tx->tx_deadline)); @@ -3019,10 +3019,10 @@ kiblnd_conn_timed_out_locked(kib_conn_t *conn) } static void -kiblnd_check_conns (int idx) +kiblnd_check_conns(int idx) { - LIST_HEAD (closes); - LIST_HEAD (checksends); + LIST_HEAD(closes); + LIST_HEAD(checksends); struct list_head *peers = &kiblnd_data.kib_peers[idx]; struct list_head *ptmp; kib_peer_t *peer; @@ -3035,16 +3035,16 @@ kiblnd_check_conns (int idx) * take a look... */ read_lock_irqsave(&kiblnd_data.kib_global_lock, flags); - list_for_each (ptmp, peers) { - peer = list_entry (ptmp, kib_peer_t, ibp_list); + list_for_each(ptmp, peers) { + peer = list_entry(ptmp, kib_peer_t, ibp_list); - list_for_each (ctmp, &peer->ibp_conns) { + list_for_each(ctmp, &peer->ibp_conns) { int timedout; int sendnoop; conn = list_entry(ctmp, kib_conn_t, ibc_list); - LASSERT (conn->ibc_state == IBLND_CONN_ESTABLISHED); + LASSERT(conn->ibc_state == IBLND_CONN_ESTABLISHED); spin_lock(&conn->ibc_lock); @@ -3101,11 +3101,11 @@ kiblnd_check_conns (int idx) } static void -kiblnd_disconnect_conn (kib_conn_t *conn) +kiblnd_disconnect_conn(kib_conn_t *conn) { - LASSERT (!in_interrupt()); - LASSERT (current == kiblnd_data.kib_connd); - LASSERT (conn->ibc_state == IBLND_CONN_CLOSING); + LASSERT(!in_interrupt()); + LASSERT(current == kiblnd_data.kib_connd); + LASSERT(conn->ibc_state == IBLND_CONN_CLOSING); rdma_disconnect(conn->ibc_cmid); kiblnd_finalise_conn(conn); @@ -3114,7 +3114,7 @@ kiblnd_disconnect_conn (kib_conn_t *conn) } int -kiblnd_connd (void *arg) +kiblnd_connd(void *arg) { wait_queue_t wait; unsigned long flags; @@ -3125,7 +3125,7 @@ kiblnd_connd (void *arg) int peer_index = 0; unsigned long deadline = jiffies; - cfs_block_allsigs (); + cfs_block_allsigs(); init_waitqueue_entry(&wait, current); kiblnd_data.kib_connd = current; @@ -3136,7 +3136,7 @@ kiblnd_connd (void *arg) dropped_lock = 0; - if (!list_empty (&kiblnd_data.kib_connd_zombies)) { + if (!list_empty(&kiblnd_data.kib_connd_zombies)) { conn = list_entry(kiblnd_data. \ kib_connd_zombies.next, kib_conn_t, ibc_list); @@ -3239,7 +3239,7 @@ kiblnd_qp_event(struct ib_event *event, void *arg) } static void -kiblnd_complete (struct ib_wc *wc) +kiblnd_complete(struct ib_wc *wc) { switch (kiblnd_wreqid2type(wc->wr_id)) { default: @@ -3440,9 +3440,9 @@ kiblnd_failover_thread(void *arg) unsigned long flags; int rc; - LASSERT (*kiblnd_tunables.kib_dev_failover != 0); + LASSERT(*kiblnd_tunables.kib_dev_failover != 0); - cfs_block_allsigs (); + cfs_block_allsigs(); init_waitqueue_entry(&wait, current); write_lock_irqsave(glock, flags); @@ -3469,7 +3469,7 @@ kiblnd_failover_thread(void *arg) write_lock_irqsave(glock, flags); - LASSERT (dev->ibd_failover); + LASSERT(dev->ibd_failover); dev->ibd_failover = 0; if (rc >= 0) { /* Device is OK or failover succeed */ dev->ibd_next_failover = cfs_time_shift(3); -- cgit v1.2.3 From 7a3888a3ad15796c834dc6cb00d247d27021f01b Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Apr 2015 19:52:07 +0200 Subject: Staging: lustre: o2iblnd.c: Finished cleaning code style I fixed lines over 80 characters and unnecessary returns Signed-off-by: Guillaume Matheron Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 53 +++++++++++++--------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index ae4069ee54ab..14c1d2b18523 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -559,8 +559,9 @@ static kib_conn_t *kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index) conn = list_entry(ctmp, kib_conn_t, ibc_list); kiblnd_conn_addref(conn); - read_unlock_irqrestore(&kiblnd_data.kib_global_lock, - flags); + read_unlock_irqrestore( + &kiblnd_data.kib_global_lock, + flags); return conn; } } @@ -879,7 +880,8 @@ void kiblnd_destroy_conn(kib_conn_t *conn) if (conn->ibc_rxs != NULL) { LIBCFS_FREE(conn->ibc_rxs, - IBLND_RX_MSGS(conn->ibc_version) * sizeof(kib_rx_t)); + IBLND_RX_MSGS(conn->ibc_version) + * sizeof(kib_rx_t)); } if (conn->ibc_connvars != NULL) @@ -936,7 +938,8 @@ int kiblnd_close_stale_conns_locked(kib_peer_t *peer, conn->ibc_incarnation == incarnation) continue; - CDEBUG(D_NET, "Closing stale conn -> %s version: %x, incarnation:%#llx(%x, %#llx)\n", + CDEBUG(D_NET, + "Closing stale conn -> %s version: %x, incarnation:%#llx(%x, %#llx)\n", libcfs_nid2str(peer->ibp_nid), conn->ibc_version, conn->ibc_incarnation, version, incarnation); @@ -1079,7 +1082,6 @@ void kiblnd_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) CDEBUG(D_NET, "Peer %s %p, alive %ld secs ago\n", libcfs_nid2str(nid), peer, last_alive ? cfs_duration_sec(now - last_alive) : -1); - return; } void kiblnd_free_pages(kib_pages_t *p) @@ -1166,7 +1168,8 @@ void kiblnd_map_rx_descs(kib_conn_t *conn) rx->rx_msg = (kib_msg_t *)(((char *)page_address(pg)) + pg_off); rx->rx_msgaddr = kiblnd_dma_map_single(conn->ibc_hdev->ibh_ibdev, - rx->rx_msg, IBLND_MSG_SIZE, + rx->rx_msg, + IBLND_MSG_SIZE, DMA_FROM_DEVICE); LASSERT(!kiblnd_dma_mapping_error(conn->ibc_hdev->ibh_ibdev, rx->rx_msgaddr)); @@ -1446,8 +1449,9 @@ static void kiblnd_fini_fmr_poolset(kib_fmr_poolset_t *fps) } } -static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, kib_net_t *net, - int pool_size, int flush_trigger) +static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, + kib_net_t *net, int pool_size, + int flush_trigger) { kib_fmr_pool_t *fpo; int rc; @@ -1557,7 +1561,8 @@ int kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, if (fps->fps_increasing) { spin_unlock(&fps->fps_lock); - CDEBUG(D_NET, "Another thread is allocating new FMR pool, waiting for her to complete\n"); + CDEBUG(D_NET, + "Another thread is allocating new FMR pool, waiting for her to complete\n"); schedule(); goto again; @@ -2395,7 +2400,8 @@ out: } /* DUMMY */ -static int kiblnd_dummy_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) +static int kiblnd_dummy_callback(struct rdma_cm_id *cmid, + struct rdma_cm_event *event) { return 0; } @@ -2676,9 +2682,8 @@ static void kiblnd_base_shutdown(void) case IBLND_INIT_ALL: case IBLND_INIT_DATA: LASSERT(kiblnd_data.kib_peers != NULL); - for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { + for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) LASSERT(list_empty(&kiblnd_data.kib_peers[i])); - } LASSERT(list_empty(&kiblnd_data.kib_connd_zombies)); LASSERT(list_empty(&kiblnd_data.kib_connd_conns)); @@ -2697,7 +2702,8 @@ static void kiblnd_base_shutdown(void) i = 2; while (atomic_read(&kiblnd_data.kib_nthreads) != 0) { i++; - CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET, /* power of 2? */ + /* power of 2 ? */ + CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET, "Waiting for %d threads to terminate\n", atomic_read(&kiblnd_data.kib_nthreads)); set_current_state(TASK_UNINTERRUPTIBLE); @@ -2796,7 +2802,6 @@ void kiblnd_shutdown(lnet_ni_t *ni) out: if (list_empty(&kiblnd_data.kib_devs)) kiblnd_base_shutdown(); - return; } static int kiblnd_base_startup(void) @@ -2808,7 +2813,8 @@ static int kiblnd_base_startup(void) LASSERT(kiblnd_data.kib_init == IBLND_INIT_NOTHING); try_module_get(THIS_MODULE); - memset(&kiblnd_data, 0, sizeof(kiblnd_data)); /* zero pointers, flags etc */ + /* zero pointers, flags etc */ + memset(&kiblnd_data, 0, sizeof(kiblnd_data)); rwlock_init(&kiblnd_data.kib_global_lock); @@ -2819,9 +2825,8 @@ static int kiblnd_base_startup(void) LIBCFS_ALLOC(kiblnd_data.kib_peers, sizeof(struct list_head) * kiblnd_data.kib_peer_hash_size); - if (kiblnd_data.kib_peers == NULL) { + if (kiblnd_data.kib_peers == NULL) goto failed; - } for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) INIT_LIST_HEAD(&kiblnd_data.kib_peers[i]); @@ -2912,6 +2917,7 @@ static int kiblnd_start_schedulers(struct kib_sched_info *sched) for (i = 0; i < nthrs; i++) { long id; char name[20]; + id = KIB_THREAD_ID(sched->ibs_cpt, sched->ibs_nthreads + i); snprintf(name, sizeof(name), "kiblnd_sd_%02ld_%02ld", KIB_THREAD_CPT(id), KIB_THREAD_TID(id)); @@ -2928,7 +2934,8 @@ static int kiblnd_start_schedulers(struct kib_sched_info *sched) return rc; } -static int kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts, int ncpts) +static int kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts, + int ncpts) { int cpt; int rc; @@ -3089,10 +3096,12 @@ static int __init kiblnd_module_init(void) int rc; CLASSERT(sizeof(kib_msg_t) <= IBLND_MSG_SIZE); - CLASSERT(offsetof(kib_msg_t, ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) - <= IBLND_MSG_SIZE); - CLASSERT(offsetof(kib_msg_t, ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) - <= IBLND_MSG_SIZE); + CLASSERT(offsetof(kib_msg_t, + ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) + <= IBLND_MSG_SIZE); + CLASSERT(offsetof(kib_msg_t, + ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) + <= IBLND_MSG_SIZE); rc = kiblnd_tunables_init(); if (rc != 0) -- cgit v1.2.3 From cc64ea4239c354d30f88130ecf5aa81a506b57e3 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 15:13:00 +0000 Subject: staging: comedi: comedi_fops: rename comedi_set_subdevice_runflags() `comedi_set_subdevice_runflags()` changes the comedi subdevice's `runflags` member according to a bit-mask and new bit values. It's name might suggest that it only "sets", not "clears". Rename it to `comedi_update_subdevice_runflags()` to avoid confusion. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 8bf57b736659..2b75b7a1cee0 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -601,8 +601,8 @@ static struct attribute *comedi_dev_attrs[] = { }; ATTRIBUTE_GROUPS(comedi_dev); -static void comedi_set_subdevice_runflags(struct comedi_subdevice *s, - unsigned mask, unsigned bits) +static void comedi_update_subdevice_runflags(struct comedi_subdevice *s, + unsigned mask, unsigned bits) { unsigned long flags; @@ -677,7 +677,7 @@ static void do_become_nonbusy(struct comedi_device *dev, { struct comedi_async *async = s->async; - comedi_set_subdevice_runflags(s, COMEDI_SRF_RUNNING, 0); + comedi_update_subdevice_runflags(s, COMEDI_SRF_RUNNING, 0); if (async) { comedi_buf_reset(s); async->inttrig = NULL; @@ -1678,8 +1678,8 @@ static int do_cmd_ioctl(struct comedi_device *dev, if (async->cmd.flags & CMDF_WAKE_EOS) async->cb_mask |= COMEDI_CB_EOS; - comedi_set_subdevice_runflags(s, COMEDI_SRF_BUSY_MASK, - COMEDI_SRF_RUNNING); + comedi_update_subdevice_runflags(s, COMEDI_SRF_BUSY_MASK, + COMEDI_SRF_RUNNING); /* * Set s->busy _after_ setting COMEDI_SRF_RUNNING flag to avoid @@ -2657,10 +2657,10 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) } if (runflags_mask) { /* - * Sets COMEDI_SRF_ERROR and COMEDI_SRF_RUNNING together + * Changes COMEDI_SRF_ERROR and COMEDI_SRF_RUNNING together * atomically. */ - comedi_set_subdevice_runflags(s, runflags_mask, runflags); + comedi_update_subdevice_runflags(s, runflags_mask, runflags); } if (async->cb_mask & s->async->events) { -- cgit v1.2.3 From b183a836fe02a59c2b55273655196ba288f3adb7 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 15:13:01 +0000 Subject: staging: comedi: comedi_fops: eliminate a use of subdevice spin-lock `comedi_is_subdevice_in_error()` is only used by `comedi_read()` and `comedi_write()` and is only called (soon) after `comedi_is_subdevice_running()` returns `false` (with extra conditions in the case of `comedi_write()`). `comedi_is_subdevice_running()` and `comedi_get_subdevice_runflags()` both call `comedi_get_subdevice_runflags()` which uses the subdevice's spin-lock. Eliminate one use of the subdevice's spin-lock in `comedi_read()` and `comedi_write()` by calling `comedi_get_subdevice_runflags()` and checking the runflags directly. Add a couple of inline functions to check the runflags: `comedi_is_runflags_running()` and `comedi_is_runflags_in_error()`. These do the same test on runflags as `comedi_is_subdevice_running()` and `comedi_is_subdevice_in_error()` but get passed the runflags value directly. `comedi_is_subdevice_in_error()` is no longer used, so remove it. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 2b75b7a1cee0..17ac2858205d 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -623,6 +623,16 @@ static unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s) return runflags; } +static bool comedi_is_runflags_running(unsigned runflags) +{ + return runflags & COMEDI_SRF_RUNNING; +} + +static bool comedi_is_runflags_in_error(unsigned runflags) +{ + return runflags & COMEDI_SRF_ERROR; +} + /** * comedi_is_subdevice_running - check if async command running on subdevice * @s: comedi_subdevice struct @@ -634,17 +644,10 @@ bool comedi_is_subdevice_running(struct comedi_subdevice *s) { unsigned runflags = comedi_get_subdevice_runflags(s); - return (runflags & COMEDI_SRF_RUNNING) ? true : false; + return comedi_is_runflags_running(runflags); } EXPORT_SYMBOL_GPL(comedi_is_subdevice_running); -static bool comedi_is_subdevice_in_error(struct comedi_subdevice *s) -{ - unsigned runflags = comedi_get_subdevice_runflags(s); - - return (runflags & COMEDI_SRF_ERROR) ? true : false; -} - static bool comedi_is_subdevice_idle(struct comedi_subdevice *s) { unsigned runflags = comedi_get_subdevice_runflags(s); @@ -2282,13 +2285,16 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, add_wait_queue(&async->wait_head, &wait); on_wait_queue = true; while (nbytes > 0 && !retval) { + unsigned runflags; + set_current_state(TASK_INTERRUPTIBLE); - if (!comedi_is_subdevice_running(s)) { + runflags = comedi_get_subdevice_runflags(s); + if (!comedi_is_runflags_running(runflags)) { if (count == 0) { struct comedi_subdevice *new_s; - if (comedi_is_subdevice_in_error(s)) + if (comedi_is_runflags_in_error(runflags)) retval = -EPIPE; else retval = 0; @@ -2435,8 +2441,10 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, n = m; if (n == 0) { - if (!comedi_is_subdevice_running(s)) { - if (comedi_is_subdevice_in_error(s)) + unsigned runflags = comedi_get_subdevice_runflags(s); + + if (!comedi_is_runflags_running(runflags)) { + if (comedi_is_runflags_in_error(runflags)) retval = -EPIPE; else retval = 0; -- cgit v1.2.3 From 38ee1fd309a629a618c031238c5d681ed4239af4 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 15:13:02 +0000 Subject: staging: comedi: comedi_fops: simplify comedi_is_subdevice_idle() Don't use a conditional operator when a simple "not" will do. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 17ac2858205d..9e49c8ac0cba 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -652,7 +652,7 @@ static bool comedi_is_subdevice_idle(struct comedi_subdevice *s) { unsigned runflags = comedi_get_subdevice_runflags(s); - return (runflags & COMEDI_SRF_BUSY_MASK) ? false : true; + return !(runflags & COMEDI_SRF_BUSY_MASK); } /** -- cgit v1.2.3 From 258c1dd76bf1223a0f67ff8d799b5eb383a3a632 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 15:13:03 +0000 Subject: staging: comedi: comedi_fops: remove unnecessary s->async use In places where the `s->async` value has been stored in a local variable, use the variable instead of repeating `s->async`. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 9e49c8ac0cba..999e7d010c83 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -687,7 +687,7 @@ static void do_become_nonbusy(struct comedi_device *dev, kfree(async->cmd.chanlist); async->cmd.chanlist = NULL; s->busy = NULL; - wake_up_interruptible_all(&s->async->wait_head); + wake_up_interruptible_all(&async->wait_head); } else { dev_err(dev->class_dev, "BUG: (?) do_become_nonbusy called with async=NULL\n"); @@ -2652,14 +2652,14 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) if (!comedi_is_subdevice_running(s)) return; - if (s->async->events & COMEDI_CB_CANCEL_MASK) + if (async->events & COMEDI_CB_CANCEL_MASK) runflags_mask |= COMEDI_SRF_RUNNING; /* * Remember if an error event has occurred, so an error * can be returned the next time the user does a read(). */ - if (s->async->events & COMEDI_CB_ERROR_MASK) { + if (async->events & COMEDI_CB_ERROR_MASK) { runflags_mask |= COMEDI_SRF_ERROR; runflags |= COMEDI_SRF_ERROR; } @@ -2671,14 +2671,14 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) comedi_update_subdevice_runflags(s, runflags_mask, runflags); } - if (async->cb_mask & s->async->events) { + if (async->cb_mask & async->events) { wake_up_interruptible(&async->wait_head); if (s->subdev_flags & SDF_CMD_READ) kill_fasync(&dev->async_queue, SIGIO, POLL_IN); if (s->subdev_flags & SDF_CMD_WRITE) kill_fasync(&dev->async_queue, SIGIO, POLL_OUT); } - s->async->events = 0; + async->events = 0; } EXPORT_SYMBOL_GPL(comedi_event); -- cgit v1.2.3 From 922d9ced718268e464a0884ecee09da436e00d70 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 15:13:04 +0000 Subject: staging: comedi: comedi_fops: always clear events `comedi_event()` is called from low-level drivers to handle asynchronous command event flags that are stored in `s->async->events` for subdevice `s`. It normally clears the event flags as well. As a safety check, it does nothing if no asynchronous command is running, but it leaves `s->async->events` unchanged in this case. For additional safety, change it to always clear the event flags to avoid leaving stale event flags set when another asynchronous command is set up. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 999e7d010c83..68ced20f5ca5 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2648,18 +2648,20 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) struct comedi_async *async = s->async; unsigned runflags = 0; unsigned runflags_mask = 0; + unsigned int events = async->events; + async->events = 0; if (!comedi_is_subdevice_running(s)) return; - if (async->events & COMEDI_CB_CANCEL_MASK) + if (events & COMEDI_CB_CANCEL_MASK) runflags_mask |= COMEDI_SRF_RUNNING; /* * Remember if an error event has occurred, so an error * can be returned the next time the user does a read(). */ - if (async->events & COMEDI_CB_ERROR_MASK) { + if (events & COMEDI_CB_ERROR_MASK) { runflags_mask |= COMEDI_SRF_ERROR; runflags |= COMEDI_SRF_ERROR; } @@ -2671,14 +2673,13 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) comedi_update_subdevice_runflags(s, runflags_mask, runflags); } - if (async->cb_mask & async->events) { + if (async->cb_mask & events) { wake_up_interruptible(&async->wait_head); if (s->subdev_flags & SDF_CMD_READ) kill_fasync(&dev->async_queue, SIGIO, POLL_IN); if (s->subdev_flags & SDF_CMD_WRITE) kill_fasync(&dev->async_queue, SIGIO, POLL_OUT); } - async->events = 0; } EXPORT_SYMBOL_GPL(comedi_event); -- cgit v1.2.3 From aa33122f005069cb3408acf609b78b9a62f58021 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 15:13:05 +0000 Subject: staging: comedi: comedi_fops: send SIGIO according to command direction `comedi_event()` is called from low-level drivers to handle comedi asynchronous command event flags. Some events cause waiting tasks to be woken up, and a `SIGIO` signal to be sent via `kill_fasync()`. The signal code is `POLL_OUT` if the subdevice supports commands in the "write" direction, or `POLL_IN` for the "read" direction. If the subdevice supports commands in either direction, it sends two `SIGIO` signals, one with each code. Change that latter case to only send one `SIGIO` signal, using the direction of the current command to determine the signal code. If the `CMDF_WRITE` flag is set in the current command, it's in the "write" direction, otherwise it's in the "read" direction. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 68ced20f5ca5..7ae605f6bbb6 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2674,11 +2674,11 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) } if (async->cb_mask & events) { + int si_code; + wake_up_interruptible(&async->wait_head); - if (s->subdev_flags & SDF_CMD_READ) - kill_fasync(&dev->async_queue, SIGIO, POLL_IN); - if (s->subdev_flags & SDF_CMD_WRITE) - kill_fasync(&dev->async_queue, SIGIO, POLL_OUT); + si_code = async->cmd.flags & CMDF_WRITE ? POLL_OUT : POLL_IN; + kill_fasync(&dev->async_queue, SIGIO, si_code); } } EXPORT_SYMBOL_GPL(comedi_event); -- cgit v1.2.3 From ef4b4b274cf96a857dd78b49558509b55d75163a Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 15:13:06 +0000 Subject: staging: comedi: comedi_fops: extend spin-lock scope in comedi_event() `comedi_event()` is called from low-level drivers to handle comedi asynchronous command event flags. As a safety check, it checks the subdevice's "run" flags to make sure an asynchronous command is running. It can also change the run flags to mark the command as no longer running (possibly also marking it as terminated with an error). Checking the runflags and modifying them involves two uses of the subdevice's spin-lock. It seems better to do it with a single use of the spin-lock. This also avoids possible interactions with `do_become_nonbusy()`. Acquire the subdevice's spin-lock at the start of `comedi_event()` and release it near the end, before a possible call to `kill_fasync()` (but after it's parameter values have been determined). Add and make use of few new inline helper functions: * `__comedi_clear_subdevice_runflags()` -- clears some run flags without using the spin-lock * `__comedi_set_subdevice_runflags()` -- sets some run flags without using the spin-lock * `__comedi_get_subdevice_runflags()` -- a spin-lockless version of `comedi_get_subdevice_runflags() * `__comedi_is_subdevice_running()` -- a spin-lockless version of * `comedi_is_subdevice_running()` Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 70 +++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 24 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 7ae605f6bbb6..e78ddbe5a954 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -601,24 +601,41 @@ static struct attribute *comedi_dev_attrs[] = { }; ATTRIBUTE_GROUPS(comedi_dev); +static void __comedi_clear_subdevice_runflags(struct comedi_subdevice *s, + unsigned bits) +{ + s->runflags &= ~bits; +} + +static void __comedi_set_subdevice_runflags(struct comedi_subdevice *s, + unsigned bits) +{ + s->runflags |= bits; +} + static void comedi_update_subdevice_runflags(struct comedi_subdevice *s, unsigned mask, unsigned bits) { unsigned long flags; spin_lock_irqsave(&s->spin_lock, flags); - s->runflags &= ~mask; - s->runflags |= (bits & mask); + __comedi_clear_subdevice_runflags(s, mask); + __comedi_set_subdevice_runflags(s, bits & mask); spin_unlock_irqrestore(&s->spin_lock, flags); } +static unsigned __comedi_get_subdevice_runflags(struct comedi_subdevice *s) +{ + return s->runflags; +} + static unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s) { unsigned long flags; unsigned runflags; spin_lock_irqsave(&s->spin_lock, flags); - runflags = s->runflags; + runflags = __comedi_get_subdevice_runflags(s); spin_unlock_irqrestore(&s->spin_lock, flags); return runflags; } @@ -648,6 +665,13 @@ bool comedi_is_subdevice_running(struct comedi_subdevice *s) } EXPORT_SYMBOL_GPL(comedi_is_subdevice_running); +static bool __comedi_is_subdevice_running(struct comedi_subdevice *s) +{ + unsigned runflags = __comedi_get_subdevice_runflags(s); + + return comedi_is_runflags_running(runflags); +} + static bool comedi_is_subdevice_idle(struct comedi_subdevice *s) { unsigned runflags = comedi_get_subdevice_runflags(s); @@ -2646,40 +2670,38 @@ static const struct file_operations comedi_fops = { void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) { struct comedi_async *async = s->async; - unsigned runflags = 0; - unsigned runflags_mask = 0; - unsigned int events = async->events; + unsigned int events; + int si_code = 0; + unsigned long flags; + + spin_lock_irqsave(&s->spin_lock, flags); + events = async->events; async->events = 0; - if (!comedi_is_subdevice_running(s)) + if (!__comedi_is_subdevice_running(s)) { + spin_unlock_irqrestore(&s->spin_lock, flags); return; + } if (events & COMEDI_CB_CANCEL_MASK) - runflags_mask |= COMEDI_SRF_RUNNING; + __comedi_clear_subdevice_runflags(s, COMEDI_SRF_RUNNING); /* - * Remember if an error event has occurred, so an error - * can be returned the next time the user does a read(). + * Remember if an error event has occurred, so an error can be + * returned the next time the user does a read() or write(). */ - if (events & COMEDI_CB_ERROR_MASK) { - runflags_mask |= COMEDI_SRF_ERROR; - runflags |= COMEDI_SRF_ERROR; - } - if (runflags_mask) { - /* - * Changes COMEDI_SRF_ERROR and COMEDI_SRF_RUNNING together - * atomically. - */ - comedi_update_subdevice_runflags(s, runflags_mask, runflags); - } + if (events & COMEDI_CB_ERROR_MASK) + __comedi_set_subdevice_runflags(s, COMEDI_SRF_ERROR); if (async->cb_mask & events) { - int si_code; - wake_up_interruptible(&async->wait_head); si_code = async->cmd.flags & CMDF_WRITE ? POLL_OUT : POLL_IN; - kill_fasync(&dev->async_queue, SIGIO, si_code); } + + spin_unlock_irqrestore(&s->spin_lock, flags); + + if (si_code) + kill_fasync(&dev->async_queue, SIGIO, si_code); } EXPORT_SYMBOL_GPL(comedi_event); -- cgit v1.2.3 From 78cff59e88eb0f3ae81f50741a8ce2e38f890139 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 15:58:19 +0000 Subject: staging: comedi: make comedi_internal.h self-reliant Add `#include`s and declare incomplete types to "comedi_internal.h" so that .c files still compile when it is the first file included. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_internal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h index d57817c19aea..3b918538847e 100644 --- a/drivers/staging/comedi/comedi_internal.h +++ b/drivers/staging/comedi/comedi_internal.h @@ -1,11 +1,21 @@ #ifndef _COMEDI_INTERNAL_H #define _COMEDI_INTERNAL_H +#include #include /* * various internal comedi stuff */ + +struct comedi_buf_map; +struct comedi_devconfig; +struct comedi_device; +struct comedi_insn; +struct comedi_rangeinfo; +struct comedi_subdevice; +struct device; + int do_rangeinfo_ioctl(struct comedi_device *dev, struct comedi_rangeinfo __user *arg); struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device); -- cgit v1.2.3 From 5e1a61928eb9622d2bc8eec2a354616281c0e475 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:41 +0000 Subject: staging: comedi: comedi_fc.h: begin migration to comedidev.h "comedi_fc.h" contains a few inline functions used by the `do_cmdtest` handler functions for comedi subdevices in several low-level comedi drivers for checking asynchronous command trigger sources and arguments. They all use the prefix `cfc_check_trigger_arg`. Copy them over to "../comedidev.h", but change the `cfc_` prefix to `comedi_`. Change the original functions in "comedi_fc.h" into simple wrappers for their replacements. Once the drivers have been changed to call the replacement functions, "comedi_fc.h" can be removed. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedidev.h | 78 ++++++++++++++++++++++++++++++ drivers/staging/comedi/drivers/comedi_fc.h | 62 ++++-------------------- 2 files changed, 87 insertions(+), 53 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 4720dbcd0b38..dfab5a84b011 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -464,6 +464,84 @@ static inline unsigned int comedi_samples_to_bytes(struct comedi_subdevice *s, return nsamples << comedi_sample_shift(s); } +/** + * comedi_check_trigger_src() - trivially validate a comedi_cmd trigger source + * @src: pointer to the trigger source to validate + * @flags: bitmask of valid TRIG_* for the trigger + * + * This is used in "step 1" of the do_cmdtest functions of comedi drivers + * to vaildate the comedi_cmd triggers. The mask of the @src against the + * @flags allows the userspace comedilib to pass all the comedi_cmd + * triggers as TRIG_ANY and get back a bitmask of the valid trigger sources. + */ +static inline int comedi_check_trigger_src(unsigned int *src, + unsigned int flags) +{ + unsigned int orig_src = *src; + + *src = orig_src & flags; + if (*src == TRIG_INVALID || *src != orig_src) + return -EINVAL; + return 0; +} + +/** + * comedi_check_trigger_is_unique() - make sure a trigger source is unique + * @src: the trigger source to check + */ +static inline int comedi_check_trigger_is_unique(unsigned int src) +{ + /* this test is true if more than one _src bit is set */ + if ((src & (src - 1)) != 0) + return -EINVAL; + return 0; +} + +/** + * comedi_check_trigger_arg_is() - trivially validate a trigger argument + * @arg: pointer to the trigger arg to validate + * @val: the value the argument should be + */ +static inline int comedi_check_trigger_arg_is(unsigned int *arg, + unsigned int val) +{ + if (*arg != val) { + *arg = val; + return -EINVAL; + } + return 0; +} + +/** + * comedi_check_trigger_arg_min() - trivially validate a trigger argument + * @arg: pointer to the trigger arg to validate + * @val: the minimum value the argument should be + */ +static inline int comedi_check_trigger_arg_min(unsigned int *arg, + unsigned int val) +{ + if (*arg < val) { + *arg = val; + return -EINVAL; + } + return 0; +} + +/** + * comedi_check_trigger_arg_max() - trivially validate a trigger argument + * @arg: pointer to the trigger arg to validate + * @val: the maximum value the argument should be + */ +static inline int comedi_check_trigger_arg_max(unsigned int *arg, + unsigned int val) +{ + if (*arg > val) { + *arg = val; + return -EINVAL; + } + return 0; +} + /* * Must set dev->hw_dev if you wish to dma directly into comedi's buffer. * Also useful for retrieving a previously configured hardware device of diff --git a/drivers/staging/comedi/drivers/comedi_fc.h b/drivers/staging/comedi/drivers/comedi_fc.h index 756be931c1a4..5765c61f3ca6 100644 --- a/drivers/staging/comedi/drivers/comedi_fc.h +++ b/drivers/staging/comedi/drivers/comedi_fc.h @@ -23,80 +23,36 @@ #include "../comedidev.h" -/** - * cfc_check_trigger_src() - trivially validate a comedi_cmd trigger source - * @src: pointer to the trigger source to validate - * @flags: bitmask of valid TRIG_* for the trigger - * - * This is used in "step 1" of the do_cmdtest functions of comedi drivers - * to vaildate the comedi_cmd triggers. The mask of the @src against the - * @flags allows the userspace comedilib to pass all the comedi_cmd - * triggers as TRIG_ANY and get back a bitmask of the valid trigger sources. +/* + * This file will be removed once drivers have migrated to using the + * replacement functions in "comedidev.h". */ + static inline int cfc_check_trigger_src(unsigned int *src, unsigned int flags) { - unsigned int orig_src = *src; - - *src = orig_src & flags; - if (*src == TRIG_INVALID || *src != orig_src) - return -EINVAL; - return 0; + return comedi_check_trigger_src(src, flags); } -/** - * cfc_check_trigger_is_unique() - make sure a trigger source is unique - * @src: the trigger source to check - */ static inline int cfc_check_trigger_is_unique(unsigned int src) { - /* this test is true if more than one _src bit is set */ - if ((src & (src - 1)) != 0) - return -EINVAL; - return 0; + return comedi_check_trigger_is_unique(src); } -/** - * cfc_check_trigger_arg_is() - trivially validate a trigger argument - * @arg: pointer to the trigger arg to validate - * @val: the value the argument should be - */ static inline int cfc_check_trigger_arg_is(unsigned int *arg, unsigned int val) { - if (*arg != val) { - *arg = val; - return -EINVAL; - } - return 0; + return comedi_check_trigger_arg_is(arg, val); } -/** - * cfc_check_trigger_arg_min() - trivially validate a trigger argument - * @arg: pointer to the trigger arg to validate - * @val: the minimum value the argument should be - */ static inline int cfc_check_trigger_arg_min(unsigned int *arg, unsigned int val) { - if (*arg < val) { - *arg = val; - return -EINVAL; - } - return 0; + return comedi_check_trigger_arg_min(arg, val); } -/** - * cfc_check_trigger_arg_max() - trivially validate a trigger argument - * @arg: pointer to the trigger arg to validate - * @val: the maximum value the argument should be - */ static inline int cfc_check_trigger_arg_max(unsigned int *arg, unsigned int val) { - if (*arg > val) { - *arg = val; - return -EINVAL; - } - return 0; + return comedi_check_trigger_arg_max(arg, val); } #endif /* _COMEDI_FC_H */ -- cgit v1.2.3 From 39d9333eaa75c25d7a9b597d53b2db449e703108 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:42 +0000 Subject: staging: comedi: 8255: remove #include "comedi_fc.h" "8255.c" doesn't use anything from "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index c2f15de6a547..ba89321df65d 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -51,7 +51,6 @@ #include #include "../comedidev.h" -#include "comedi_fc.h" #include "8255.h" struct subdev_8255_private { -- cgit v1.2.3 From 782658427b89a0beaf891eeac98e9ebc211bb057 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:43 +0000 Subject: staging: comedi: addi_apci_1516: remove #include "comedi_fc.h" "addi_apci_1516.c" doesn't use anything from "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1516.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1516.c b/drivers/staging/comedi/drivers/addi_apci_1516.c index c3505a52cdc2..9c516d1fe896 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1516.c +++ b/drivers/staging/comedi/drivers/addi_apci_1516.c @@ -26,7 +26,6 @@ #include "../comedi_pci.h" #include "addi_watchdog.h" -#include "comedi_fc.h" /* * PCI bar 1 I/O Register map - Digital input/output -- cgit v1.2.3 From 49da482e691e921e51967e71f7b639cf3789c5e7 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:44 +0000 Subject: staging: comedi: addi_apci_3501: remove #include "comedi_fc.h" "addi_apci_3501.c" doesn't use anything from "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3501.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index 0869f7f66842..73786a3f3df9 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -27,7 +27,6 @@ #include #include "../comedi_pci.h" -#include "comedi_fc.h" #include "amcc_s5933.h" /* -- cgit v1.2.3 From 830c6190466a487ee36d93b451614ab5fe7f907b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:45 +0000 Subject: staging: comedi: cb_das16_cs: remove #include "comedi_fc.h" "cb_das16_cs.c" doesn't use anything from "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_das16_cs.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 9abc2c795479..ae84f2c0cc9c 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -38,7 +38,6 @@ Status: experimental #include "../comedi_pcmcia.h" -#include "comedi_fc.h" #include "comedi_8254.h" #define DAS16CS_ADC_DATA 0 -- cgit v1.2.3 From 8bac7d15718a9703380e8e55ebfe02225fdb00ed Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:46 +0000 Subject: staging: comedi: cb_pcidda: remove #include "comedi_fc.h" "cb_pcidda.c" doesn't use anything from "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidda.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 1e232b1e3194..30c9e27d1ed9 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -39,7 +39,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" #include "8255.h" #define EEPROM_SIZE 128 /* number of entries in eeprom */ -- cgit v1.2.3 From b8044cc3b314d751000fc0fa7e0e15eff9c380fa Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:47 +0000 Subject: staging: comedi: mite: remove #include "comedi_fc.h" "mite.c" doesn't use anything from "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mite.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 4cfe949e4dc5..e43a0c8323c1 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -50,7 +50,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" #include "mite.h" #define TOP_OF_PAGE(x) ((x)|(~(PAGE_MASK))) -- cgit v1.2.3 From e3baeea2848e939c55a6d8ff0c8e2375c52e6e90 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:48 +0000 Subject: staging: comedi: ni_660x: remove #include "comedi_fc.h" "ni_660x.c" doesn't use anything from "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index b913158e5706..46647c64f369 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -39,7 +39,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" #include "mite.h" #include "ni_tio.h" -- cgit v1.2.3 From 557e0c1c6575aaaf190534b291131afb972e6774 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:49 +0000 Subject: staging: comedi: ni_labpc_isadma: remove #include "comedi_fc.h" "ni_labpc_isadma.c" doesn't use anything from "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_isadma.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_labpc_isadma.c b/drivers/staging/comedi/drivers/ni_labpc_isadma.c index 6b4ccd86b3d0..29dbdf5ec25d 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_isadma.c +++ b/drivers/staging/comedi/drivers/ni_labpc_isadma.c @@ -23,7 +23,6 @@ #include "../comedidev.h" #include "comedi_isadma.h" -#include "comedi_fc.h" #include "ni_labpc.h" #include "ni_labpc_regs.h" #include "ni_labpc_isadma.h" -- cgit v1.2.3 From e63db6f775b803bcdc66d28c983b0c1f552dbe29 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:50 +0000 Subject: staging: comedi: addi_apci_1032: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1032.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c b/drivers/staging/comedi/drivers/addi_apci_1032.c index f82cee40c8e6..b37166d57b64 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1032.c +++ b/drivers/staging/comedi/drivers/addi_apci_1032.c @@ -74,7 +74,6 @@ #include #include "../comedi_pci.h" -#include "comedi_fc.h" #include "amcc_s5933.h" /* @@ -195,11 +194,11 @@ static int apci1032_cos_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; @@ -209,11 +208,12 @@ static int apci1032_cos_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 1a7c337c49969d7c842718503e82bccd4b5fda8c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:51 +0000 Subject: staging: comedi: addi_apci_1500: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1500.c | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index c71847eb749b..63991c49ff23 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -25,7 +25,6 @@ #include #include "../comedi_pci.h" -#include "comedi_fc.h" #include "amcc_s5933.h" #include "z8536.h" @@ -385,11 +384,11 @@ static int apci1500_di_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; @@ -414,12 +413,13 @@ static int apci1500_di_cmdtest(struct comedi_device *dev, * 3 OR mode for Port A (digital inputs 0-7) * OR mode for Port B (digital inputs 8-13 and internal signals) */ - err |= cfc_check_trigger_arg_max(&cmd->start_arg, 3); + err |= comedi_check_trigger_arg_max(&cmd->start_arg, 3); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -513,11 +513,11 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev, src = pt & 0xff; if (src) - ret |= cfc_check_trigger_is_unique(src); + ret |= comedi_check_trigger_is_unique(src); src = (pt >> 8) & 0xff; if (src) - ret |= cfc_check_trigger_is_unique(src); + ret |= comedi_check_trigger_is_unique(src); if (ret) { dev_dbg(dev->class_dev, -- cgit v1.2.3 From 39a89e14697a82678ecfd68155ad2494b21d8d04 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:52 +0000 Subject: staging: comedi: addi_apci_1564: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1564.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index c1d00212d9b7..33e58b9a21b2 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -26,7 +26,6 @@ #include #include "../comedi_pci.h" -#include "comedi_fc.h" #include "addi_tcw.h" #include "addi_watchdog.h" @@ -364,11 +363,11 @@ static int apci1564_cos_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; @@ -378,11 +377,12 @@ static int apci1564_cos_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From ea7040e6364fc69291a0a3d5ded5948d66ceaa09 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:53 +0000 Subject: staging: comedi: addi_apci_2032: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_2032.c | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c index 86abb7201698..ad715253bdcc 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2032.c +++ b/drivers/staging/comedi/drivers/addi_apci_2032.c @@ -28,7 +28,6 @@ #include "../comedi_pci.h" #include "addi_watchdog.h" -#include "comedi_fc.h" /* * PCI bar 1 I/O Register map @@ -92,17 +91,17 @@ static int apci2032_int_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -111,14 +110,15 @@ static int apci2032_int_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 25e8046478c7755319eea0a77734bdf97139555d Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:54 +0000 Subject: staging: comedi: addi_apci_3120: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3120.c | 38 +++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 5822f1fe359a..95dc64bfec73 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -25,7 +25,6 @@ #include #include "../comedi_pci.h" -#include "comedi_fc.h" #include "amcc_s5933.h" /* @@ -611,21 +610,21 @@ static int apci3120_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -634,21 +633,24 @@ static int apci3120_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->scan_begin_src == TRIG_TIMER) /* Test Delay timing */ - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, 100000); + if (cmd->scan_begin_src == TRIG_TIMER) { /* Test Delay timing */ + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + 100000); + } /* minimum conversion time per sample is 10us */ - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 10000); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 10000); - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -658,7 +660,7 @@ static int apci3120_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { /* scan begin must be larger than the scan time */ arg = cmd->convert_arg * cmd->scan_end_arg; - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, arg); } if (err) -- cgit v1.2.3 From c0618689e58d08b27c99c1f0acb472bff65e4586 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:55 +0000 Subject: staging: comedi: addi_apci_3xxx: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3xxx.c | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/addi_apci_3xxx.c b/drivers/staging/comedi/drivers/addi_apci_3xxx.c index 8dadab8b3e09..bef6efc84efd 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3xxx.c +++ b/drivers/staging/comedi/drivers/addi_apci_3xxx.c @@ -27,8 +27,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" - #define CONV_UNIT_NS (1 << 0) #define CONV_UNIT_US (1 << 1) #define CONV_UNIT_MS (1 << 2) @@ -528,18 +526,18 @@ static int apci3xxx_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -548,16 +546,17 @@ static int apci3xxx_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - board->ai_min_acq_ns); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + board->ai_min_acq_ns); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -566,7 +565,7 @@ static int apci3xxx_ai_cmdtest(struct comedi_device *dev, arg = cmd->convert_arg; err |= apci3xxx_ai_ns_to_timer(dev, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); if (err) return 4; -- cgit v1.2.3 From 1a4888c18fe0e2331087bcb690191036eea3b187 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:56 +0000 Subject: staging: comedi: adl_pci9111: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9111.c | 48 +++++++++++++++------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index 5ca7c6e45d93..c9df3afe97f6 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -71,7 +71,6 @@ TODO: #include "../comedi_pci.h" #include "plx9052.h" -#include "comedi_fc.h" #include "comedi_8254.h" #define PCI9111_FIFO_HALF_SIZE 512 @@ -267,13 +266,13 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_FOLLOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) @@ -281,9 +280,9 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -297,26 +296,29 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, PCI9111_AI_ACQUISITION_PERIOD_MIN_NS); - else /* TRIG_EXT */ - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + } else { /* TRIG_EXT */ + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + } - if (cmd->scan_begin_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, + if (cmd->scan_begin_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, PCI9111_AI_ACQUISITION_PERIOD_MIN_NS); - else /* TRIG_FOLLOW || TRIG_EXT */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + } else { /* TRIG_FOLLOW || TRIG_EXT */ + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -326,7 +328,7 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } /* @@ -339,7 +341,7 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, if (arg < cmd->scan_begin_arg) arg *= (cmd->scan_begin_arg / arg); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (err) -- cgit v1.2.3 From 94fff03def69fa26b85057f2a57e186ea7310946 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:57 +0000 Subject: staging: comedi: adl_pci9118: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 65 +++++++++++++++------------- 1 file changed, 34 insertions(+), 31 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index eb4a528b6431..fb3043dcfff1 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -82,7 +82,6 @@ #include "amcc_s5933.h" #include "comedi_8254.h" -#include "comedi_fc.h" #define IORANGE_9118 64 /* I hope */ #define PCI9118_CHANLEN 255 /* @@ -1174,21 +1173,21 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT | TRIG_INT); flags = TRIG_FOLLOW; if (devpriv->master) flags |= TRIG_TIMER | TRIG_EXT; - err |= cfc_check_trigger_src(&cmd->scan_begin_src, flags); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, flags); flags = TRIG_TIMER | TRIG_EXT; if (devpriv->master) flags |= TRIG_NOW; - err |= cfc_check_trigger_src(&cmd->convert_src, flags); + err |= comedi_check_trigger_src(&cmd->convert_src, flags); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE | TRIG_EXT); if (err) @@ -1196,10 +1195,10 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -1228,7 +1227,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, switch (cmd->start_src) { case TRIG_NOW: case TRIG_EXT: - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); break; case TRIG_INT: /* start_arg is the internal trigger (any value) */ @@ -1236,7 +1235,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, } if (cmd->scan_begin_src & (TRIG_FOLLOW | TRIG_EXT)) - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); if ((cmd->scan_begin_src == TRIG_TIMER) && (cmd->convert_src == TRIG_TIMER) && (cmd->scan_end_arg == 1)) { @@ -1245,34 +1244,37 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, cmd->scan_begin_arg = 0; } - if (cmd->scan_begin_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - devpriv->ai_ns_min); + if (cmd->scan_begin_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + devpriv->ai_ns_min); + } - if (cmd->scan_begin_src == TRIG_EXT) + if (cmd->scan_begin_src == TRIG_EXT) { if (cmd->scan_begin_arg) { cmd->scan_begin_arg = 0; err |= -EINVAL; - err |= cfc_check_trigger_arg_max(&cmd->scan_end_arg, - 65535); + err |= comedi_check_trigger_arg_max(&cmd->scan_end_arg, + 65535); } + } - if (cmd->convert_src & (TRIG_TIMER | TRIG_NOW)) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - devpriv->ai_ns_min); + if (cmd->convert_src & (TRIG_TIMER | TRIG_NOW)) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + devpriv->ai_ns_min); + } if (cmd->convert_src == TRIG_EXT) - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_min(&cmd->scan_end_arg, - cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->scan_end_arg, + cmd->chanlist_len); if ((cmd->scan_end_arg % cmd->chanlist_len)) { cmd->scan_end_arg = @@ -1288,13 +1290,13 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src & (TRIG_TIMER | TRIG_NOW)) { arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); if (cmd->scan_begin_src == TRIG_TIMER && cmd->convert_src == TRIG_NOW) { @@ -1304,8 +1306,9 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, } else { arg = cmd->convert_arg * cmd->chanlist_len; } - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - arg); + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + arg); } } -- cgit v1.2.3 From 3087f440c226c014e2461e909e5669a53db7fb03 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:58 +0000 Subject: staging: comedi: adv_pci1710: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 35 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index f71750bb4304..0c6aa964c884 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -46,7 +46,6 @@ Configuration options: #include "../comedi_pci.h" -#include "comedi_fc.h" #include "comedi_8254.h" #include "amcc_s5933.h" @@ -708,20 +707,21 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* step 2a: make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* step 2b: and mutually compatible */ @@ -730,20 +730,21 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 10000); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 10000); else /* TRIG_FOLLOW */ - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -754,7 +755,7 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, unsigned int arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) -- cgit v1.2.3 From f900aec97b52ce875d97b566c3882ff825c53c95 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:13:59 +0000 Subject: staging: comedi: aio_iiro_16: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/aio_iiro_16.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c b/drivers/staging/comedi/drivers/aio_iiro_16.c index 1c7b325a373c..35b2f98f0de9 100644 --- a/drivers/staging/comedi/drivers/aio_iiro_16.c +++ b/drivers/staging/comedi/drivers/aio_iiro_16.c @@ -42,8 +42,6 @@ #include "../comedidev.h" -#include "comedi_fc.h" - #define AIO_IIRO_16_RELAY_0_7 0x00 #define AIO_IIRO_16_INPUT_0_7 0x01 #define AIO_IIRO_16_IRQ 0x02 @@ -116,11 +114,11 @@ static int aio_iiro_16_cos_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; @@ -130,11 +128,12 @@ static int aio_iiro_16_cos_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From f95354325eee75d67d632a60c3b91aa83254028a Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:00 +0000 Subject: staging: comedi: amplc_dio200_common: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- .../staging/comedi/drivers/amplc_dio200_common.c | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 0101e92667a1..d15a3dc1216a 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -25,7 +25,6 @@ #include "../comedidev.h" #include "amplc_dio200.h" -#include "comedi_fc.h" #include "comedi_8254.h" #include "8255.h" /* only for register defines */ @@ -373,19 +372,19 @@ static int dio200_subdev_intr_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -394,15 +393,16 @@ static int dio200_subdev_intr_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 29d9edd0d0e03211b4b6c2e8057a043eb94a91a5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:01 +0000 Subject: staging: comedi: amplc_pc236_common: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- .../staging/comedi/drivers/amplc_pc236_common.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_pc236_common.c b/drivers/staging/comedi/drivers/amplc_pc236_common.c index cc26b9d04d66..245f932a75a8 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236_common.c +++ b/drivers/staging/comedi/drivers/amplc_pc236_common.c @@ -24,7 +24,6 @@ #include "../comedidev.h" #include "amplc_pc236.h" -#include "comedi_fc.h" #include "8255.h" static void pc236_intr_update(struct comedi_device *dev, bool enable) @@ -82,11 +81,11 @@ static int pc236_intr_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; @@ -96,11 +95,12 @@ static int pc236_intr_cmdtest(struct comedi_device *dev, /* Step 3: check it arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From e0703e09e719819da1cc5e380c70a56f9c248663 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:02 +0000 Subject: staging: comedi: amplc_pci224: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci224.c | 40 +++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 6c9fa4ab4fcd..08a91854837a 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -108,7 +108,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" #include "comedi_8254.h" /* @@ -666,22 +665,22 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_INT | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, - TRIG_EXT | TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, - TRIG_COUNT | TRIG_EXT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, + TRIG_EXT | TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, + TRIG_COUNT | TRIG_EXT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -706,7 +705,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, switch (cmd->start_src) { case TRIG_INT: - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); break; case TRIG_EXT: /* Force to external trigger 0. */ @@ -726,13 +725,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, switch (cmd->scan_begin_src) { case TRIG_TIMER: - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, - MAX_SCAN_PERIOD); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, + MAX_SCAN_PERIOD); arg = cmd->chanlist_len * CONVERT_PERIOD; if (arg < MIN_SCAN_PERIOD) arg = MIN_SCAN_PERIOD; - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, arg); break; case TRIG_EXT: /* Force to external trigger 0. */ @@ -752,12 +751,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, break; } - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); switch (cmd->stop_src) { case TRIG_COUNT: - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); break; case TRIG_EXT: /* Force to external trigger 0. */ @@ -773,7 +773,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, } break; case TRIG_NONE: - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); break; } @@ -786,7 +786,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, arg = cmd->scan_begin_arg; /* Use two timers. */ comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (err) -- cgit v1.2.3 From a716811441368c90efd55955d1404c3f51aac391 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:03 +0000 Subject: staging: comedi: amplc_pci230: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci230.c | 76 ++++++++++++++------------- 1 file changed, 39 insertions(+), 37 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index a145f39682f4..20d592002557 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -186,7 +186,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" #include "comedi_8254.h" #include "8255.h" @@ -885,7 +884,7 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_INT); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT); tmp = TRIG_TIMER | TRIG_INT; if (thisboard->min_hwver > 0 && devpriv->hwver >= 2) { @@ -905,19 +904,19 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, */ tmp |= TRIG_EXT; } - err |= cfc_check_trigger_src(&cmd->scan_begin_src, tmp); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, tmp); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -926,7 +925,7 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); #define MAX_SPEED_AO 8000 /* 8000 ns => 125 kHz */ /* @@ -937,10 +936,10 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, switch (cmd->scan_begin_src) { case TRIG_TIMER: - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - MAX_SPEED_AO); - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, - MIN_SPEED_AO); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + MAX_SPEED_AO); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, + MIN_SPEED_AO); break; case TRIG_EXT: /* @@ -965,16 +964,17 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, } break; default: - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); break; } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -1507,7 +1507,7 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); tmp = TRIG_FOLLOW | TRIG_TIMER | TRIG_INT; if (thisboard->have_dio || thisboard->min_hwver > 0) { @@ -1519,21 +1519,21 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, */ tmp |= TRIG_EXT; } - err |= cfc_check_trigger_src(&cmd->scan_begin_src, tmp); - err |= cfc_check_trigger_src(&cmd->convert_src, + err |= comedi_check_trigger_src(&cmd->scan_begin_src, tmp); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_INT | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -1550,7 +1550,7 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); #define MAX_SPEED_AI_SE 3200 /* PCI230 SE: 3200 ns => 312.5 kHz */ #define MAX_SPEED_AI_DIFF 8000 /* PCI230 DIFF: 8000 ns => 125 kHz */ @@ -1585,10 +1585,10 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, max_speed_ai = MAX_SPEED_AI_PLUS; } - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - max_speed_ai); - err |= cfc_check_trigger_arg_max(&cmd->convert_arg, - MIN_SPEED_AI); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + max_speed_ai); + err |= comedi_check_trigger_arg_max(&cmd->convert_arg, + MIN_SPEED_AI); } else if (cmd->convert_src == TRIG_EXT) { /* * external trigger @@ -1623,18 +1623,20 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, * convert_arg == 0 => trigger on -ve edge. * convert_arg == 1 => trigger on +ve edge. */ - err |= cfc_check_trigger_arg_max(&cmd->convert_arg, 1); + err |= comedi_check_trigger_arg_max(&cmd->convert_arg, + 1); } } else { - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (cmd->scan_begin_src == TRIG_EXT) { /* @@ -1659,7 +1661,7 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, err |= -EINVAL; } else { - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); } if (err) -- cgit v1.2.3 From 571cea09014711d801f8a6a81a8cb18aa78eba14 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:04 +0000 Subject: staging: comedi: cb_pcidas64: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 77 +++++++++++++++------------- 1 file changed, 42 insertions(+), 35 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 15106d0a38b2..a94c33c3d962 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -88,7 +88,6 @@ TODO: #include "8255.h" #include "plx9080.h" -#include "comedi_fc.h" #define TIMER_BASE 25 /* 40MHz master clock */ /* 100kHz 'prescaled' clock for slow acquisition, @@ -2086,34 +2085,34 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); triggers = TRIG_TIMER; if (thisboard->layout == LAYOUT_4020) triggers |= TRIG_OTHER; else triggers |= TRIG_FOLLOW; - err |= cfc_check_trigger_src(&cmd->scan_begin_src, triggers); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, triggers); triggers = TRIG_TIMER; if (thisboard->layout == LAYOUT_4020) triggers |= TRIG_NOW; else triggers |= TRIG_EXT; - err |= cfc_check_trigger_src(&cmd->convert_src, triggers); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, - TRIG_COUNT | TRIG_EXT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, triggers); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, + TRIG_COUNT | TRIG_EXT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -2127,7 +2126,7 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, switch (cmd->start_src) { case TRIG_NOW: - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); break; case TRIG_EXT: /* @@ -2139,30 +2138,37 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->convert_src == TRIG_TIMER) { if (thisboard->layout == LAYOUT_4020) { - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, + 0); } else { - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - thisboard->ai_speed); - /* if scans are timed faster than conversion rate allows */ - if (cmd->scan_begin_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min( + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + thisboard-> + ai_speed); + /* + * if scans are timed faster than conversion rate + * allows + */ + if (cmd->scan_begin_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min( &cmd->scan_begin_arg, cmd->convert_arg * cmd->chanlist_len); + } } } - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); switch (cmd->stop_src) { case TRIG_EXT: break; case TRIG_COUNT: - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); break; case TRIG_NONE: - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); break; default: break; @@ -3306,20 +3312,20 @@ static int ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_INT | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, - TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); /* Step 2b : and mutually compatible */ @@ -3334,11 +3340,11 @@ static int ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_TIMER) { - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - thisboard->ao_scan_speed); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + thisboard->ao_scan_speed); if (get_ao_divisor(cmd->scan_begin_arg, cmd->flags) > max_counter_value) { cmd->scan_begin_arg = (max_counter_value + 2) * @@ -3347,8 +3353,9 @@ static int ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, } } - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (err) return 3; -- cgit v1.2.3 From 3b339d322b279e234533a98cbc644e95e8077198 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:05 +0000 Subject: staging: comedi: cb_pcidas: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas.c | 79 ++++++++++++++++-------------- 1 file changed, 42 insertions(+), 37 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index bad04d99190b..e3591a5824fe 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -70,7 +70,6 @@ analog triggering on 1602 series #include "comedi_8254.h" #include "8255.h" #include "amcc_s5933.h" -#include "comedi_fc.h" #define AI_BUFFER_SIZE 1024 /* max ai fifo size */ #define AO_BUFFER_SIZE 1024 /* max ao fifo size */ @@ -777,23 +776,23 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW | TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -812,7 +811,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, switch (cmd->start_src) { case TRIG_NOW: - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); break; case TRIG_EXT: /* External trigger, only CR_EDGE and CR_INVERT flags allowed */ @@ -829,20 +828,24 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, break; } - if (cmd->scan_begin_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - thisboard->ai_speed * cmd->chanlist_len); + if (cmd->scan_begin_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + thisboard->ai_speed * + cmd->chanlist_len); + } - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - thisboard->ai_speed); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + thisboard->ai_speed); + } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -852,12 +855,12 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) @@ -985,20 +988,20 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -1007,18 +1010,20 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->scan_begin_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - thisboard->ao_scan_speed); + if (cmd->scan_begin_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + thisboard->ao_scan_speed); + } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -1030,7 +1035,7 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, comedi_8254_cascade_ns_to_timer(devpriv->ao_pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (err) -- cgit v1.2.3 From 070c8e167bec5fba8ea020eb615c583062f8f9b0 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:06 +0000 Subject: staging: comedi: comedi_parport: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index ceef6931edbe..15a4093efda1 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -69,8 +69,6 @@ #include "../comedidev.h" -#include "comedi_fc.h" - /* * Register map */ @@ -161,11 +159,11 @@ static int parport_intr_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; @@ -175,11 +173,12 @@ static int parport_intr_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 61f7697033bff3a1696ff1434d84aeda269e505b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:07 +0000 Subject: staging: comedi: comedi_test: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_test.c | 46 +++++++++++++++------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index fbc43420f698..80d613c0fbc6 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -50,7 +50,6 @@ zero volts). #include -#include "comedi_fc.h" #include #include @@ -225,19 +224,20 @@ static int waveform_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW | TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_NOW | TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -246,26 +246,30 @@ static int waveform_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->convert_src == TRIG_NOW) - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); if (cmd->scan_begin_src == TRIG_TIMER) { - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - nano_per_micro); - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - cmd->convert_arg * cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + nano_per_micro); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + cmd->convert_arg * + cmd->chanlist_len); + } } - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -277,14 +281,14 @@ static int waveform_ai_cmdtest(struct comedi_device *dev, /* round to nearest microsec */ arg = nano_per_micro * ((arg + (nano_per_micro / 2)) / nano_per_micro); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; /* round to nearest microsec */ arg = nano_per_micro * ((arg + (nano_per_micro / 2)) / nano_per_micro); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) -- cgit v1.2.3 From d8cfb3fb9b22d38214791789565e4ecf0bc7337e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:08 +0000 Subject: staging: comedi: das16: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das16.c | 47 ++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index f66db97b9d4f..d7cf4b153f7c 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -76,7 +76,6 @@ #include "../comedidev.h" #include "comedi_isadma.h" -#include "comedi_fc.h" #include "comedi_8254.h" #include "8255.h" @@ -599,29 +598,29 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); trig_mask = TRIG_FOLLOW; if (devpriv->can_burst) trig_mask |= TRIG_TIMER | TRIG_EXT; - err |= cfc_check_trigger_src(&cmd->scan_begin_src, trig_mask); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, trig_mask); trig_mask = TRIG_TIMER | TRIG_EXT; if (devpriv->can_burst) trig_mask |= TRIG_NOW; - err |= cfc_check_trigger_src(&cmd->convert_src, trig_mask); + err |= comedi_check_trigger_src(&cmd->convert_src, trig_mask); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -636,26 +635,30 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); /* check against maximum frequency */ - if (cmd->scan_begin_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - board->ai_speed * cmd->chanlist_len); + if (cmd->scan_begin_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + board->ai_speed * + cmd->chanlist_len); + } - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - board->ai_speed); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + board->ai_speed); + } if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -664,12 +667,12 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) return 4; -- cgit v1.2.3 From dedb59fc69f72f5af8cee8ca6e3c646a2e0b83cb Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:09 +0000 Subject: staging: comedi: das16m1: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das16m1.c | 33 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index cdef03d09738..1adf6a71a9f3 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -59,7 +59,6 @@ irq can be omitted, although the cmd interface will not work without it. #include "8255.h" #include "comedi_8254.h" -#include "comedi_fc.h" #define DAS16M1_SIZE2 8 @@ -182,20 +181,21 @@ static int das16m1_cmd_test(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -204,20 +204,21 @@ static int das16m1_cmd_test(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 1000); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 1000); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -228,7 +229,7 @@ static int das16m1_cmd_test(struct comedi_device *dev, unsigned int arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) -- cgit v1.2.3 From 05e07db18552de231f0a62172c2f7715a58c46cd Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:10 +0000 Subject: staging: comedi: das1800: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das1800.c | 51 +++++++++++++++++--------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 0a93ae93da93..53baf37cd21a 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -102,7 +102,6 @@ TODO: #include "../comedidev.h" #include "comedi_isadma.h" -#include "comedi_fc.h" #include "comedi_8254.h" /* misc. defines */ @@ -732,12 +731,13 @@ static int das1800_ai_do_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW | TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_EXT | TRIG_NONE); if (err) @@ -745,10 +745,10 @@ static int das1800_ai_do_cmdtest(struct comedi_device *dev, /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -761,21 +761,23 @@ static int das1800_ai_do_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - thisboard->ai_speed); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + thisboard->ai_speed); + } - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); switch (cmd->stop_src) { case TRIG_COUNT: - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); break; case TRIG_NONE: - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); break; default: break; @@ -791,22 +793,23 @@ static int das1800_ai_do_cmdtest(struct comedi_device *dev, /* we are not in burst mode */ arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } else if (cmd->convert_src == TRIG_TIMER) { /* we are in burst mode */ arg = burst_convert_arg(cmd->convert_arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->convert_arg * cmd->chanlist_len; - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, - arg); + err |= comedi_check_trigger_arg_max(&cmd-> + scan_begin_arg, + arg); arg = cmd->scan_begin_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, - arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, + arg); } } -- cgit v1.2.3 From e70d6377525618f4b206bf3614865d3ab9617dea Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:11 +0000 Subject: staging: comedi: das6402: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das6402.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c index 3aa6b13894bf..1701294b79cd 100644 --- a/drivers/staging/comedi/drivers/das6402.c +++ b/drivers/staging/comedi/drivers/das6402.c @@ -36,7 +36,6 @@ #include "../comedidev.h" -#include "comedi_fc.h" #include "comedi_8254.h" /* @@ -303,18 +302,18 @@ static int das6402_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -323,16 +322,17 @@ static int das6402_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 10000); - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 10000); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -341,7 +341,7 @@ static int das6402_ai_cmdtest(struct comedi_device *dev, arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); if (err) return 4; -- cgit v1.2.3 From 5519108b114e7a5bc012d51e33a2d651efe4047a Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:12 +0000 Subject: staging: comedi: das800: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das800.c | 38 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index ece3e56a72bb..39d304a1259f 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -58,7 +58,6 @@ cmd triggers supported: #include "../comedidev.h" -#include "comedi_fc.h" #include "comedi_8254.h" #define N_CHAN_AI 8 /* number of analog input channels */ @@ -309,20 +308,21 @@ static int das800_ai_do_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -331,19 +331,21 @@ static int das800_ai_do_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - thisboard->ai_speed); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + thisboard->ai_speed); + } - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -354,7 +356,7 @@ static int das800_ai_do_cmdtest(struct comedi_device *dev, unsigned int arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) -- cgit v1.2.3 From b504252a768c3d939f017f2c9044e3f7309be51e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:13 +0000 Subject: staging: comedi: dmm32at: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dmm32at.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 094422f81d4c..bb2883c83afa 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -41,7 +41,6 @@ #include "../comedidev.h" #include "8255.h" -#include "comedi_fc.h" /* Board register addresses */ #define DMM32AT_AI_START_CONV_REG 0x00 @@ -274,18 +273,18 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -294,10 +293,10 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, 1000000); - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, 1000000000); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, 1000000); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, 1000000000); if (cmd->convert_arg >= 17500) cmd->convert_arg = 20000; @@ -308,12 +307,13 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev, else cmd->convert_arg = 5000; - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -321,7 +321,7 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev, /* Step 4: fix up any arguments */ arg = cmd->convert_arg * cmd->scan_end_arg; - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, arg); if (err) return 4; -- cgit v1.2.3 From 71bb49d055e510a8c0ff0bb02529b5859d587b84 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:14 +0000 Subject: staging: comedi: dt2814: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2814.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index 5a20be569011..66705f9a0621 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -40,8 +40,6 @@ addition, the clock does not seem to be very accurate. #include -#include "comedi_fc.h" - #define DT2814_CSR 0 #define DT2814_DATA 1 @@ -129,18 +127,18 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -149,18 +147,19 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, 1000000000); - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - DT2814_MAX_SPEED); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, 1000000000); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + DT2814_MAX_SPEED); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 2); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 2); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -169,7 +168,7 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev, arg = cmd->scan_begin_arg; dt2814_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); if (err) return 4; -- cgit v1.2.3 From 34e444c8581866a32e7f3ed3229909c732c621f5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:15 +0000 Subject: staging: comedi: dt282x: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt282x.c | 61 +++++++++++++++++---------------- 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 52a50bc3343a..5a536a00066f 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -64,7 +64,6 @@ #include "../comedidev.h" #include "comedi_isadma.h" -#include "comedi_fc.h" /* * Register map @@ -661,20 +660,20 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -683,21 +682,22 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 4000); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 4000); #define SLOWEST_TIMER (250*(1<<15)*255) - err |= cfc_check_trigger_arg_max(&cmd->convert_arg, SLOWEST_TIMER); - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, board->ai_speed); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_max(&cmd->convert_arg, SLOWEST_TIMER); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, board->ai_speed); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_EXT | TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -706,7 +706,7 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, arg = cmd->convert_arg; devpriv->divisor = dt282x_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); if (err) return 4; @@ -831,18 +831,18 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -851,15 +851,16 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, 5000); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, 5000); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_EXT | TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -868,7 +869,7 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, arg = cmd->scan_begin_arg; devpriv->divisor = dt282x_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); if (err) return 4; -- cgit v1.2.3 From e9a3c4317b96b794ea013f512adbf1aab4121185 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:16 +0000 Subject: staging: comedi: dt3000: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt3000.c | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 1b8ac9999477..031282c82f43 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -54,8 +54,6 @@ AO commands are not supported. #include "../comedi_pci.h" -#include "comedi_fc.h" - static const struct comedi_lrange range_dt3000_ai = { 4, { BIP_RANGE(10), @@ -408,11 +406,11 @@ static int dt3k_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT); if (err) return 1; @@ -422,28 +420,29 @@ static int dt3k_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_TIMER) { - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - this_board->ai_speed); - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, - 100 * 16 * 65535); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + this_board->ai_speed); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, + 100 * 16 * 65535); } if (cmd->convert_src == TRIG_TIMER) { - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - this_board->ai_speed); - err |= cfc_check_trigger_arg_max(&cmd->convert_arg, - 50 * 16 * 65535); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + this_board->ai_speed); + err |= comedi_check_trigger_arg_max(&cmd->convert_arg, + 50 * 16 * 65535); } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff); + err |= comedi_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -453,18 +452,19 @@ static int dt3k_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; dt3k_ns_to_timer(100, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; dt3k_ns_to_timer(50, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->convert_arg * cmd->scan_end_arg; - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - arg); + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + arg); } } -- cgit v1.2.3 From 86ca1cdda3e8e4aa76dd9289f302349f96414fc5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:17 +0000 Subject: staging: comedi: gsc_hpdi: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/gsc_hpdi.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 8b7c475903ec..3cb6409c4f01 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -47,7 +47,6 @@ #include "../comedi_pci.h" #include "plx9080.h" -#include "comedi_fc.h" /* * PCI BAR2 Register map (dev->mmio) @@ -385,18 +384,18 @@ static int gsc_hpdi_cmd_test(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -405,18 +404,19 @@ static int gsc_hpdi_cmd_test(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (!cmd->chanlist_len || !cmd->chanlist) { cmd->chanlist_len = 32; err |= -EINVAL; } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 51ec1db9d93422b1bbe536bd93e0589bafafd336 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:18 +0000 Subject: staging: comedi: me4000: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 2502ac67bd4e..7a8c27dd7154 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -46,7 +46,6 @@ broken. #include "../comedi_pci.h" -#include "comedi_fc.h" #include "comedi_8254.h" #include "plx9052.h" @@ -833,24 +832,25 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW | TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_NONE | TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE | TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE | TRIG_COUNT); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->scan_end_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->scan_end_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -881,7 +881,7 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->chanlist_len < 1) { cmd->chanlist_len = 1; @@ -901,9 +901,9 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, } if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 6664e2efa2e643975c6eba712fd0c1034681410c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:19 +0000 Subject: staging: comedi: ni_6527: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_6527.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index dc87114727a2..62a817e4cd64 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -32,8 +32,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" - /* * PCI BAR1 - Register memory map * @@ -223,11 +221,11 @@ static int ni6527_intr_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_OTHER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_OTHER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT); if (err) return 1; @@ -237,11 +235,12 @@ static int ni6527_intr_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 4e9782c1c20412f535b10f62dce5d525a2fd4e41 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:20 +0000 Subject: staging: comedi: ni_65xx: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_65xx.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index b158bfb292bf..800d57426070 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -61,8 +61,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" - /* * PCI BAR1 Register Map */ @@ -507,11 +505,11 @@ static int ni_65xx_intr_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_OTHER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_OTHER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT); if (err) return 1; @@ -521,11 +519,12 @@ static int ni_65xx_intr_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From ded2468314ea8f81be3ee16f398ee8206fe22f37 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:21 +0000 Subject: staging: comedi: ni_at_a2150: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_at_a2150.c | 35 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c index 66c0e65a953a..3a972d1538ab 100644 --- a/drivers/staging/comedi/drivers/ni_at_a2150.c +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c @@ -67,7 +67,6 @@ TRIG_WAKE_EOS #include "../comedidev.h" #include "comedi_isadma.h" -#include "comedi_fc.h" #include "comedi_8254.h" #define A2150_DMA_BUFFER_SIZE 0xff00 /* size in bytes of dma buffer */ @@ -420,19 +419,19 @@ static int a2150_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -441,19 +440,21 @@ static int a2150_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - thisboard->ai_speed); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + thisboard->ai_speed); + } - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -463,7 +464,7 @@ static int a2150_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; a2150_get_timing(dev, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (err) -- cgit v1.2.3 From 2684a5e94a3b126a46d14ab438769db228112d79 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:22 +0000 Subject: staging: comedi: ni_atmio16d: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_atmio16d.c | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 73e580243795..c3eb54622bc3 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -34,7 +34,6 @@ Devices: [National Instruments] AT-MIO-16 (atmio16), AT-MIO-16D (atmio16d) #include #include "../comedidev.h" -#include "comedi_fc.h" #include "8255.h" /* Configuration and Status Registers */ @@ -233,20 +232,20 @@ static int atmio16d_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW | TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -255,30 +254,31 @@ static int atmio16d_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_FOLLOW) { /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); } else { #if 0 /* external trigger */ /* should be level/edge, hi/lo specification here */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); #endif } - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 10000); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 10000); #if 0 - err |= cfc_check_trigger_arg_max(&cmd->convert_arg, SLOWEST_TIMER); + err |= comedi_check_trigger_arg_max(&cmd->convert_arg, SLOWEST_TIMER); #endif - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 4179164e9f9e3fd6d2d8be6eb37df8135f106354 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:23 +0000 Subject: staging: comedi: ni_labpc_common: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_common.c | 64 +++++++++++++----------- 1 file changed, 36 insertions(+), 28 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_labpc_common.c b/drivers/staging/comedi/drivers/ni_labpc_common.c index 0dac8cf312b2..863afb28ee28 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_common.c +++ b/drivers/staging/comedi/drivers/ni_labpc_common.c @@ -26,7 +26,6 @@ #include "comedi_8254.h" #include "8255.h" -#include "comedi_fc.h" #include "ni_labpc.h" #include "ni_labpc_regs.h" #include "ni_labpc_isadma.h" @@ -360,8 +359,9 @@ static void labpc_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd, pacer->next_div1 = (scan_period - 1) / (pacer->osc_base * I8254_MAX_COUNT) + 1; - cfc_check_trigger_arg_min(&pacer->next_div1, 2); - cfc_check_trigger_arg_max(&pacer->next_div1, I8254_MAX_COUNT); + comedi_check_trigger_arg_min(&pacer->next_div1, 2); + comedi_check_trigger_arg_max(&pacer->next_div1, + I8254_MAX_COUNT); base_period = pacer->osc_base * pacer->next_div1; @@ -386,10 +386,11 @@ static void labpc_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd, break; } /* make sure a0 and b1 values are acceptable */ - cfc_check_trigger_arg_min(&pacer->next_div, 2); - cfc_check_trigger_arg_max(&pacer->next_div, I8254_MAX_COUNT); - cfc_check_trigger_arg_min(&pacer->next_div2, 2); - cfc_check_trigger_arg_max(&pacer->next_div2, I8254_MAX_COUNT); + comedi_check_trigger_arg_min(&pacer->next_div, 2); + comedi_check_trigger_arg_max(&pacer->next_div, I8254_MAX_COUNT); + comedi_check_trigger_arg_min(&pacer->next_div2, 2); + comedi_check_trigger_arg_max(&pacer->next_div2, + I8254_MAX_COUNT); /* write corrected timings to command */ labpc_set_ai_convert_period(cmd, mode, @@ -511,26 +512,27 @@ static int labpc_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_FOLLOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); stop_mask = TRIG_COUNT | TRIG_NONE; if (board->is_labpc1200) stop_mask |= TRIG_EXT; - err |= cfc_check_trigger_src(&cmd->stop_src, stop_mask); + err |= comedi_check_trigger_src(&cmd->stop_src, stop_mask); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -545,7 +547,7 @@ static int labpc_ai_cmdtest(struct comedi_device *dev, switch (cmd->start_src) { case TRIG_NOW: - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); break; case TRIG_EXT: /* start_arg value is ignored */ @@ -554,27 +556,33 @@ static int labpc_ai_cmdtest(struct comedi_device *dev, if (!cmd->chanlist_len) err |= -EINVAL; - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - board->ai_speed); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + board->ai_speed); + } /* make sure scan timing is not too fast */ if (cmd->scan_begin_src == TRIG_TIMER) { - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - cmd->convert_arg * cmd->chanlist_len); - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - board->ai_speed * cmd->chanlist_len); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + cmd->convert_arg * + cmd->chanlist_len); + } + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + board->ai_speed * + cmd->chanlist_len); } switch (cmd->stop_src) { case TRIG_COUNT: - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); break; case TRIG_NONE: - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); break; /* * TRIG_EXT doesn't care since it doesn't -- cgit v1.2.3 From 311fd9b2e59fee401c884bb4eca8897a25d5e6d2 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:24 +0000 Subject: staging: comedi: ni_mio_common: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 116 +++++++++++++------------ 1 file changed, 61 insertions(+), 55 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index ada050eb359c..c66affd993aa 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -57,7 +57,6 @@ #include #include "8255.h" #include "mite.h" -#include "comedi_fc.h" /* A timeout count */ #define NI_TIMEOUT 1000 @@ -2225,28 +2224,28 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_EXT); sources = TRIG_TIMER | TRIG_EXT; if (devpriv->is_611x || devpriv->is_6143) sources |= TRIG_NOW; - err |= cfc_check_trigger_src(&cmd->convert_src, sources); + err |= comedi_check_trigger_src(&cmd->convert_src, sources); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -2258,7 +2257,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, switch (cmd->start_src) { case TRIG_NOW: case TRIG_INT: - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); break; case TRIG_EXT: tmp = CR_CHAN(cmd->start_arg); @@ -2266,15 +2265,16 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (tmp > 16) tmp = 16; tmp |= (cmd->start_arg & (CR_INVERT | CR_EDGE)); - err |= cfc_check_trigger_arg_is(&cmd->start_arg, tmp); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, tmp); break; } if (cmd->scan_begin_src == TRIG_TIMER) { - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, ni_min_ai_scan_period_ns(dev, cmd->chanlist_len)); - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, - devpriv->clock_ns * 0xffffff); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, + devpriv->clock_ns * + 0xffffff); } else if (cmd->scan_begin_src == TRIG_EXT) { /* external trigger */ unsigned int tmp = CR_CHAN(cmd->scan_begin_arg); @@ -2282,19 +2282,21 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (tmp > 16) tmp = 16; tmp |= (cmd->scan_begin_arg & (CR_INVERT | CR_EDGE)); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, tmp); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp); } else { /* TRIG_OTHER */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); } if (cmd->convert_src == TRIG_TIMER) { if (devpriv->is_611x || devpriv->is_6143) { - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, + 0); } else { - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - board->ai_speed); - err |= cfc_check_trigger_arg_max(&cmd->convert_arg, - devpriv->clock_ns * 0xffff); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + board->ai_speed); + err |= comedi_check_trigger_arg_max(&cmd->convert_arg, + devpriv->clock_ns * + 0xffff); } } else if (cmd->convert_src == TRIG_EXT) { /* external trigger */ @@ -2303,23 +2305,24 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (tmp > 16) tmp = 16; tmp |= (cmd->convert_arg & (CR_ALT_FILTER | CR_INVERT)); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, tmp); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, tmp); } else if (cmd->convert_src == TRIG_NOW) { - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) { unsigned int max_count = 0x01000000; if (devpriv->is_611x) max_count -= num_adc_stages_611x; - err |= cfc_check_trigger_arg_max(&cmd->stop_arg, max_count); - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_max(&cmd->stop_arg, max_count); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); } else { /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); } if (err) @@ -3257,21 +3260,21 @@ static int ni_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_INT | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -3282,7 +3285,7 @@ static int ni_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, switch (cmd->start_src) { case TRIG_INT: - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); break; case TRIG_EXT: tmp = CR_CHAN(cmd->start_arg); @@ -3290,24 +3293,26 @@ static int ni_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (tmp > 18) tmp = 18; tmp |= (cmd->start_arg & (CR_INVERT | CR_EDGE)); - err |= cfc_check_trigger_arg_is(&cmd->start_arg, tmp); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, tmp); break; } if (cmd->scan_begin_src == TRIG_TIMER) { - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - board->ao_speed); - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, - devpriv->clock_ns * 0xffffff); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + board->ao_speed); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, + devpriv->clock_ns * + 0xffffff); } - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff); + err |= comedi_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -3469,11 +3474,11 @@ static int ni_cdio_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; @@ -3483,16 +3488,17 @@ static int ni_cdio_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); tmp = cmd->scan_begin_arg; tmp &= CR_PACK_FLAGS(CDO_Sample_Source_Select_Mask, 0, 0, CR_INVERT); if (tmp != cmd->scan_begin_arg) err |= -EINVAL; - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 21ebbb1473fa5b148c77a218a77e008179643309 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:25 +0000 Subject: staging: comedi: ni_pcidio: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcidio.c | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 9e01f8d85994..ac79099bc23e 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -55,7 +55,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org #include "../comedi_pci.h" -#include "comedi_fc.h" #include "mite.h" /* defines for the PCI-DIO-32HS */ @@ -548,21 +547,21 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -571,13 +570,13 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); #define MAX_SPEED (TIMER_BASE) /* in nanoseconds */ if (cmd->scan_begin_src == TRIG_TIMER) { - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - MAX_SPEED); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + MAX_SPEED); /* no minimum speed */ } else { /* TRIG_EXT */ @@ -588,13 +587,14 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, } } - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -604,7 +604,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; ni_pcidio_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (err) -- cgit v1.2.3 From eeae1cc974a711478cf7b229dec7f69321f999ad Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:26 +0000 Subject: staging: comedi: ni_tiocmd: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_tiocmd.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c index 2a1f8b26c407..9b124b09e914 100644 --- a/drivers/staging/comedi/drivers/ni_tiocmd.c +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c @@ -44,7 +44,6 @@ TODO: */ #include -#include "comedi_fc.h" #include "ni_tio_internal.h" #include "mite.h" @@ -234,23 +233,23 @@ int ni_tio_cmdtest(struct comedi_device *dev, sources = TRIG_NOW | TRIG_INT | TRIG_OTHER; if (ni_tio_counting_mode_registers_present(counter->counter_dev)) sources |= TRIG_EXT; - err |= cfc_check_trigger_src(&cmd->start_src, sources); + err |= comedi_check_trigger_src(&cmd->start_src, sources); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW | TRIG_EXT | TRIG_OTHER); - err |= cfc_check_trigger_src(&cmd->convert_src, + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW | TRIG_EXT | TRIG_OTHER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); /* Step 2b : and mutually compatible */ @@ -266,7 +265,7 @@ int ni_tio_cmdtest(struct comedi_device *dev, case TRIG_NOW: case TRIG_INT: case TRIG_OTHER: - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); break; case TRIG_EXT: /* start_arg is the start_trigger passed to ni_tio_arm() */ @@ -274,13 +273,14 @@ int ni_tio_cmdtest(struct comedi_device *dev, } if (cmd->scan_begin_src != TRIG_EXT) - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); if (cmd->convert_src != TRIG_EXT) - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 1efa78f6bcbbde6437ac487411dcc1ca672b4e77 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:27 +0000 Subject: staging: comedi: pcl711: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl711.c | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index ef7db1261739..cfc3a627d0ca 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -41,7 +41,6 @@ #include "../comedidev.h" -#include "comedi_fc.h" #include "comedi_8254.h" /* @@ -286,20 +285,20 @@ static int pcl711_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -308,23 +307,24 @@ static int pcl711_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_EXT) { - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); } else { #define MAX_SPEED 1000 - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - MAX_SPEED); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + MAX_SPEED); } - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -335,7 +335,7 @@ static int pcl711_ai_cmdtest(struct comedi_device *dev, unsigned int arg = cmd->scan_begin_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (err) -- cgit v1.2.3 From bdd62d8dde7dd13f6640b3de89613a70aa68ed0e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:28 +0000 Subject: staging: comedi: pcl726: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl726.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index 40798150cfd8..256850ccb6fa 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -62,8 +62,6 @@ #include "../comedidev.h" -#include "comedi_fc.h" - #define PCL726_AO_MSB_REG(x) (0x00 + ((x) * 2)) #define PCL726_AO_LSB_REG(x) (0x01 + ((x) * 2)) #define PCL726_DO_MSB_REG 0x0c @@ -173,11 +171,11 @@ static int pcl726_intr_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_NONE); if (err) return 1; @@ -187,11 +185,12 @@ static int pcl726_intr_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 75ebc7fe7a55bc19f6c56742aa34cccb42c754b7 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:29 +0000 Subject: staging: comedi: pcl812: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl812.c | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 1bb67aadff59..03a3fd6cd918 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -117,7 +117,6 @@ #include "../comedidev.h" #include "comedi_isadma.h" -#include "comedi_fc.h" #include "comedi_8254.h" /* hardware types of the cards */ @@ -636,24 +635,24 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); if (devpriv->use_ext_trg) flags = TRIG_EXT; else flags = TRIG_TIMER; - err |= cfc_check_trigger_src(&cmd->convert_src, flags); + err |= comedi_check_trigger_src(&cmd->convert_src, flags); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -662,22 +661,24 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - board->ai_ns_min); - else /* TRIG_EXT */ - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + board->ai_ns_min); + } else { /* TRIG_EXT */ + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + } - err |= cfc_check_trigger_arg_min(&cmd->chanlist_len, 1); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -688,7 +689,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, unsigned int arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) -- cgit v1.2.3 From 5cf36bd747a631afa78e59518f65368ab3f6708f Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:30 +0000 Subject: staging: comedi: pcl816: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl816.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 992a38c81d0f..1ccb2f19f4be 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -41,7 +41,6 @@ Configuration Options: #include "../comedidev.h" #include "comedi_isadma.h" -#include "comedi_fc.h" #include "comedi_8254.h" /* @@ -350,19 +349,20 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_EXT | TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_EXT | TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -371,20 +371,21 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 10000); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 10000); else /* TRIG_EXT */ - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -394,7 +395,7 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, unsigned int arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) -- cgit v1.2.3 From 95373ceb1e236c0d9ca298b7db028a11115b5297 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:31 +0000 Subject: staging: comedi: pcl818: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl818.c | 40 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 8d933dcad533..e1bdde977302 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -100,7 +100,6 @@ #include "../comedidev.h" #include "comedi_isadma.h" -#include "comedi_fc.h" #include "comedi_8254.h" /* boards constants */ @@ -649,19 +648,20 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -670,21 +670,23 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - board->ns_min); - else /* TRIG_EXT */ - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + board->ns_min); + } else { /* TRIG_EXT */ + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -695,7 +697,7 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int arg = cmd->convert_arg; comedi_8254_cascade_ns_to_timer(dev->pacer, &arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) -- cgit v1.2.3 From b21a766f7c5476db7730653bee2915ff0a9e40a8 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:32 +0000 Subject: staging: comedi: pcmmio: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcmmio.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 2c0e7ecbf494..10472e6dd002 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -78,8 +78,6 @@ #include "../comedidev.h" -#include "comedi_fc.h" - /* * Register I/O map */ @@ -483,19 +481,19 @@ static int pcmmio_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -504,15 +502,16 @@ static int pcmmio_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 21de3b8d84dd8ec0e129c7d2909e135e8af6f58e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:33 +0000 Subject: staging: comedi: pcmuio: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcmuio.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 213457286031..7ea813022ff6 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -77,8 +77,6 @@ #include "../comedidev.h" -#include "comedi_fc.h" - /* * Register I/O map * @@ -486,19 +484,19 @@ static int pcmuio_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -507,15 +505,16 @@ static int pcmuio_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 75a12586cb717fb57197d3b3a9467ebab216c984 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:34 +0000 Subject: staging: comedi: quatech_daqp_cs: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 43 +++++++++++++----------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index aa8653465771..152cb146fc16 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -52,7 +52,6 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 #include #include "../comedi_pcmcia.h" -#include "comedi_fc.h" struct daqp_private { int stop; @@ -365,22 +364,22 @@ static int daqp_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -389,13 +388,14 @@ static int daqp_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); #define MAX_SPEED 10000 /* 100 kHz - in nanoseconds */ - if (cmd->scan_begin_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - MAX_SPEED); + if (cmd->scan_begin_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + MAX_SPEED); + } /* If both scan_begin and convert are both timer values, the only * way that can make sense is if the scan time is the number of @@ -407,15 +407,18 @@ static int daqp_ai_cmdtest(struct comedi_device *dev, err |= -EINVAL; } - if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, MAX_SPEED); + if (cmd->convert_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + MAX_SPEED); + } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff); + err |= comedi_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -425,13 +428,13 @@ static int daqp_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; daqp_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; daqp_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); } if (err) -- cgit v1.2.3 From 57fab5a22edc3841ae2b9be189a756afd92fe29d Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:35 +0000 Subject: staging: comedi: rtd520: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/rtd520.c | 72 +++++++++++++++++---------------- 1 file changed, 37 insertions(+), 35 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index d1ecb518b97c..4c13f5eb0c84 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -99,7 +99,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" #include "plx9080.h" /* @@ -733,21 +732,22 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -756,32 +756,32 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_TIMER) { /* Note: these are time periods, not actual rates */ if (1 == cmd->chanlist_len) { /* no scanning */ - if (cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - RTD_MAX_SPEED_1)) { + if (comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + RTD_MAX_SPEED_1)) { rtd_ns_to_timer(&cmd->scan_begin_arg, CMDF_ROUND_UP); err |= -EINVAL; } - if (cfc_check_trigger_arg_max(&cmd->scan_begin_arg, - RTD_MIN_SPEED_1)) { + if (comedi_check_trigger_arg_max(&cmd->scan_begin_arg, + RTD_MIN_SPEED_1)) { rtd_ns_to_timer(&cmd->scan_begin_arg, CMDF_ROUND_DOWN); err |= -EINVAL; } } else { - if (cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - RTD_MAX_SPEED)) { + if (comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + RTD_MAX_SPEED)) { rtd_ns_to_timer(&cmd->scan_begin_arg, CMDF_ROUND_UP); err |= -EINVAL; } - if (cfc_check_trigger_arg_max(&cmd->scan_begin_arg, - RTD_MIN_SPEED)) { + if (comedi_check_trigger_arg_max(&cmd->scan_begin_arg, + RTD_MIN_SPEED)) { rtd_ns_to_timer(&cmd->scan_begin_arg, CMDF_ROUND_DOWN); err |= -EINVAL; @@ -791,32 +791,32 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, /* external trigger */ /* should be level/edge, hi/lo specification here */ /* should specify multiple external triggers */ - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, 9); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, 9); } if (cmd->convert_src == TRIG_TIMER) { if (1 == cmd->chanlist_len) { /* no scanning */ - if (cfc_check_trigger_arg_min(&cmd->convert_arg, - RTD_MAX_SPEED_1)) { + if (comedi_check_trigger_arg_min(&cmd->convert_arg, + RTD_MAX_SPEED_1)) { rtd_ns_to_timer(&cmd->convert_arg, CMDF_ROUND_UP); err |= -EINVAL; } - if (cfc_check_trigger_arg_max(&cmd->convert_arg, - RTD_MIN_SPEED_1)) { + if (comedi_check_trigger_arg_max(&cmd->convert_arg, + RTD_MIN_SPEED_1)) { rtd_ns_to_timer(&cmd->convert_arg, CMDF_ROUND_DOWN); err |= -EINVAL; } } else { - if (cfc_check_trigger_arg_min(&cmd->convert_arg, - RTD_MAX_SPEED)) { + if (comedi_check_trigger_arg_min(&cmd->convert_arg, + RTD_MAX_SPEED)) { rtd_ns_to_timer(&cmd->convert_arg, CMDF_ROUND_UP); err |= -EINVAL; } - if (cfc_check_trigger_arg_max(&cmd->convert_arg, - RTD_MIN_SPEED)) { + if (comedi_check_trigger_arg_max(&cmd->convert_arg, + RTD_MIN_SPEED)) { rtd_ns_to_timer(&cmd->convert_arg, CMDF_ROUND_DOWN); err |= -EINVAL; @@ -825,15 +825,16 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, } else { /* external trigger */ /* see above */ - err |= cfc_check_trigger_arg_max(&cmd->convert_arg, 9); + err |= comedi_check_trigger_arg_max(&cmd->convert_arg, 9); } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -843,18 +844,19 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; rtd_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; rtd_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->convert_arg * cmd->scan_end_arg; - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - arg); + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + arg); } } -- cgit v1.2.3 From d044e28f38dcc5b9de460eb0ce8a68df5cc2707b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:36 +0000 Subject: staging: comedi: s626: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/s626.c | 82 ++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 39 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 53a248bc9d80..781918d8d85f 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -67,7 +67,6 @@ #include "../comedi_pci.h" -#include "comedi_fc.h" #include "s626.h" struct s626_buffer_dma { @@ -2115,24 +2114,24 @@ static int s626_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, - TRIG_NOW | TRIG_INT | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, - TRIG_TIMER | TRIG_EXT | TRIG_FOLLOW); - err |= cfc_check_trigger_src(&cmd->convert_src, - TRIG_TIMER | TRIG_EXT | TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, + TRIG_NOW | TRIG_INT | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, + TRIG_TIMER | TRIG_EXT | TRIG_FOLLOW); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT | TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -2144,49 +2143,53 @@ static int s626_ai_cmdtest(struct comedi_device *dev, switch (cmd->start_src) { case TRIG_NOW: case TRIG_INT: - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); break; case TRIG_EXT: - err |= cfc_check_trigger_arg_max(&cmd->start_arg, 39); + err |= comedi_check_trigger_arg_max(&cmd->start_arg, 39); break; } if (cmd->scan_begin_src == TRIG_EXT) - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, 39); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, 39); if (cmd->convert_src == TRIG_EXT) - err |= cfc_check_trigger_arg_max(&cmd->convert_arg, 39); + err |= comedi_check_trigger_arg_max(&cmd->convert_arg, 39); #define S626_MAX_SPEED 200000 /* in nanoseconds */ #define S626_MIN_SPEED 2000000000 /* in nanoseconds */ if (cmd->scan_begin_src == TRIG_TIMER) { - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - S626_MAX_SPEED); - err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, - S626_MIN_SPEED); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + S626_MAX_SPEED); + err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, + S626_MIN_SPEED); } else { - /* external trigger */ - /* should be level/edge, hi/lo specification here */ - /* should specify multiple external triggers */ - /* err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, 9); */ + /* + * external trigger + * should be level/edge, hi/lo specification here + * should specify multiple external triggers + * err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, 9); + */ } if (cmd->convert_src == TRIG_TIMER) { - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, - S626_MAX_SPEED); - err |= cfc_check_trigger_arg_max(&cmd->convert_arg, - S626_MIN_SPEED); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, + S626_MAX_SPEED); + err |= comedi_check_trigger_arg_max(&cmd->convert_arg, + S626_MIN_SPEED); } else { - /* external trigger */ - /* see above */ - /* err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, 9); */ + /* + * external trigger - see above + * err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, 9); + */ } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -2196,18 +2199,19 @@ static int s626_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; s626_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } if (cmd->convert_src == TRIG_TIMER) { arg = cmd->convert_arg; s626_ns_to_timer(&arg, cmd->flags); - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->convert_arg * cmd->scan_end_arg; - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - arg); + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + arg); } } -- cgit v1.2.3 From 2b012d948c00f1c74c7e70ab7444ff3f3944778f Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:37 +0000 Subject: staging: comedi: usbdux: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbdux.c | 75 +++++++++++++++++---------------- 1 file changed, 39 insertions(+), 36 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index a6403d2d2c08..ced05e581620 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -85,8 +85,6 @@ #include "../comedi_usb.h" -#include "comedi_fc.h" - /* constants for firmware upload and download */ #define USBDUX_FIRMWARE "usbdux_firmware.bin" #define USBDUX_FIRMWARE_MAX_LEN 0x2000 @@ -524,19 +522,19 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -545,10 +543,10 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); if (cmd->scan_begin_src == TRIG_TIMER) { if (this_usbduxsub->high_speed) { @@ -563,8 +561,9 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev, while (i < (cmd->chanlist_len)) i = i * 2; - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - 1000000 / 8 * i); + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + 1000000 / 8 * i); /* now calc the real sampling rate with all the * rounding errors */ tmp_timer = @@ -573,24 +572,26 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev, } else { /* full speed */ /* 1kHz scans every USB frame */ - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - 1000000); + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + 1000000); /* * calc the real sampling rate with the rounding errors */ tmp_timer = ((unsigned int)(cmd->scan_begin_arg / 1000000)) * 1000000; } - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, - tmp_timer); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, + tmp_timer); } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -895,7 +896,7 @@ static int usbdux_ao_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); if (0) { /* (this_usbduxsub->high_speed) */ /* the sampling rate is set by the coversion rate */ @@ -904,7 +905,7 @@ static int usbdux_ao_cmdtest(struct comedi_device *dev, /* start a new scan (output at once) with a timer */ flags = TRIG_TIMER; } - err |= cfc_check_trigger_src(&cmd->scan_begin_src, flags); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, flags); if (0) { /* (this_usbduxsub->high_speed) */ /* @@ -919,18 +920,18 @@ static int usbdux_ao_cmdtest(struct comedi_device *dev, */ flags = TRIG_NOW; } - err |= cfc_check_trigger_src(&cmd->convert_src, flags); + err |= comedi_check_trigger_src(&cmd->convert_src, flags); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -939,25 +940,27 @@ static int usbdux_ao_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - if (cmd->scan_begin_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - 1000000); + if (cmd->scan_begin_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + 1000000); + } /* not used now, is for later use */ if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 125000); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 125000); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From f53398ebde69e7f554cdb7ab3d7e34f855557701 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:38 +0000 Subject: staging: comedi: usbduxfast: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxfast.c | 31 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 50c47af5f0ac..d90dc59982be 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -48,7 +48,6 @@ #include #include #include -#include "comedi_fc.h" #include "../comedi_usb.h" /* @@ -343,23 +342,24 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT | TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, + TRIG_TIMER | TRIG_EXT); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->scan_begin_src); - err |= cfc_check_trigger_is_unique(cmd->convert_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->scan_begin_src); + err |= comedi_check_trigger_is_unique(cmd->convert_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -372,12 +372,13 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (!cmd->chanlist_len) err |= -EINVAL; - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->chanlist_len == 1) min_sample_period = 1; @@ -394,16 +395,16 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev, /* calc arg again */ tmp = steps / 30; - err |= cfc_check_trigger_arg_is(&cmd->convert_arg, tmp); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, tmp); } /* stop source */ switch (cmd->stop_src) { case TRIG_COUNT: - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); break; case TRIG_NONE: - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); break; /* * TRIG_EXT doesn't care since it doesn't trigger -- cgit v1.2.3 From 8a8626b4f83a66bd219964127b1bfad75ff55615 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:39 +0000 Subject: staging: comedi: usbduxsigma: remove #include "comedi_fc.h" As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 73 +++++++++++++++------------- 1 file changed, 39 insertions(+), 34 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index f50cf8a8dada..eaa9add491df 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -49,7 +49,6 @@ #include #include -#include "comedi_fc.h" #include "../comedi_usb.h" /* timeout for the USB-transfer in ms*/ @@ -486,19 +485,19 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); - err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -507,10 +506,10 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); if (cmd->scan_begin_src == TRIG_TIMER) { unsigned int tmp; @@ -522,27 +521,31 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, * sample two channels. Thus, the more channels * are in the channel list the more time we need. */ - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - (1000000 / 8 * interval)); + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + (1000000 / 8 * + interval)); tmp = (cmd->scan_begin_arg / 125000) * 125000; } else { /* full speed */ /* 1kHz scans every USB frame */ - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - 1000000); + err |= comedi_check_trigger_arg_min(&cmd-> + scan_begin_arg, + 1000000); tmp = (cmd->scan_begin_arg / 1000000) * 1000000; } - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, tmp); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp); } - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; @@ -854,7 +857,7 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, /* Step 1 : check if triggers are trivially valid */ - err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); + err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT); if (high_speed) { /* @@ -866,11 +869,11 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, /* start a new scan (output at once) with a timer */ flags = TRIG_TIMER; } - err |= cfc_check_trigger_src(&cmd->scan_begin_src, flags); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, flags); - err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW); - err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW); + err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) { up(&devpriv->sem); @@ -879,8 +882,8 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, /* Step 2a : make sure trigger sources are unique */ - err |= cfc_check_trigger_is_unique(cmd->start_src); - err |= cfc_check_trigger_is_unique(cmd->stop_src); + err |= comedi_check_trigger_is_unique(cmd->start_src); + err |= comedi_check_trigger_is_unique(cmd->stop_src); /* Step 2b : and mutually compatible */ @@ -889,25 +892,27 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, /* Step 3: check if arguments are trivially valid */ - err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - if (cmd->scan_begin_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, - 1000000); + if (cmd->scan_begin_src == TRIG_TIMER) { + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + 1000000); + } /* not used now, is for later use */ if (cmd->convert_src == TRIG_TIMER) - err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 125000); + err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 125000); - err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) - err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1); + err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); else /* TRIG_NONE */ - err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) return 3; -- cgit v1.2.3 From 4c97b37a8447976f95493afc45dfdcb160dae4bf Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Mar 2015 19:14:40 +0000 Subject: staging: comedi: remove "comedi_fc.h" None of the comedi low-level drivers include "comedi_fc.h" any longer, so remove it. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_fc.h | 58 ------------------------------ 1 file changed, 58 deletions(-) delete mode 100644 drivers/staging/comedi/drivers/comedi_fc.h (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/comedi_fc.h b/drivers/staging/comedi/drivers/comedi_fc.h deleted file mode 100644 index 5765c61f3ca6..000000000000 --- a/drivers/staging/comedi/drivers/comedi_fc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * comedi_fc.h - * This is a place for code driver writers wish to share between - * two or more drivers. These functions are meant to be used only - * by drivers, they are NOT part of the kcomedilib API! - * - * Author: Frank Mori Hess - * Copyright (C) 2002 Frank Mori Hess - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _COMEDI_FC_H -#define _COMEDI_FC_H - -#include "../comedidev.h" - -/* - * This file will be removed once drivers have migrated to using the - * replacement functions in "comedidev.h". - */ - -static inline int cfc_check_trigger_src(unsigned int *src, unsigned int flags) -{ - return comedi_check_trigger_src(src, flags); -} - -static inline int cfc_check_trigger_is_unique(unsigned int src) -{ - return comedi_check_trigger_is_unique(src); -} - -static inline int cfc_check_trigger_arg_is(unsigned int *arg, unsigned int val) -{ - return comedi_check_trigger_arg_is(arg, val); -} - -static inline int cfc_check_trigger_arg_min(unsigned int *arg, - unsigned int val) -{ - return comedi_check_trigger_arg_min(arg, val); -} - -static inline int cfc_check_trigger_arg_max(unsigned int *arg, - unsigned int val) -{ - return comedi_check_trigger_arg_max(arg, val); -} - -#endif /* _COMEDI_FC_H */ -- cgit v1.2.3 From c52c3700d8a603dace184aed453c5e635645c523 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:24:32 +0100 Subject: staging: sm750: Reindent The reindent fixes the "WARNING: please, no spaces at the start of a line", "ERROR: code indent should use tabs where possible" and some other small checkpatch.pl warnings and errors. Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 985 ++++++++++++++++++++-------------------- 1 file changed, 491 insertions(+), 494 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 4074375441c8..87b50fce5dd9 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -31,12 +31,12 @@ int smi_indent = 0; /* -#ifdef __BIG_ENDIAN -ssize_t lynxfb_ops_write(struct fb_info *info, const char __user *buf, - size_t count, loff_t *ppos); -ssize_t lynxfb_ops_read(struct fb_info *info, char __user *buf, - size_t count, loff_t *ppos); -#endif + * #ifdef __BIG_ENDIAN + * ssize_t lynxfb_ops_write(struct fb_info *info, const char __user *buf, + * size_t count, loff_t *ppos); + * ssize_t lynxfb_ops_read(struct fb_info *info, char __user *buf, + * size_t count, loff_t *ppos); + * #endif */ typedef void (*PROC_SPEC_SETUP)(struct lynx_share*,char *); @@ -57,56 +57,56 @@ static int g_dualview; static char * g_option = NULL; static const struct fb_videomode lynx750_ext[] = { - /* 1024x600-60 VESA [1.71:1] */ + /* 1024x600-60 VESA [1.71:1] */ {NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1024x600-70 VESA */ + /* 1024x600-70 VESA */ {NULL, 70, 1024, 600, 17211, 152, 48, 21, 1, 104, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1024x600-75 VESA */ + /* 1024x600-75 VESA */ {NULL, 75, 1024, 600, 15822, 160, 56, 23, 1, 104, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1024x600-85 VESA */ + /* 1024x600-85 VESA */ {NULL, 85, 1024, 600, 13730, 168, 56, 26, 1, 112, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, /* 720x480 */ {NULL, 60, 720, 480, 37427, 88, 16, 13, 1, 72, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, /* 1280x720 [1.78:1] */ {NULL, 60, 1280, 720, 13426, 162, 86, 22, 1, 136, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, - /* 1280x768@60 */ + /* 1280x768@60 */ {NULL,60,1280,768,12579,192,64,20,3,128,7, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, {NULL,60,1360,768,11804,208,64,23,1,144,3, - FB_SYNC_HOR_HIGH_ACT|FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT|FB_VMODE_NONINTERLACED}, /* 1360 x 768 [1.77083:1] */ {NULL, 60, 1360, 768, 11804, 208, 64, 23, 1, 144, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, /* 1368 x 768 [1.78:1] */ {NULL, 60, 1368, 768, 11647, 216, 72, 23, 1, 144, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1440 x 900 [16:10] */ + /* 1440 x 900 [16:10] */ {NULL, 60, 1440, 900, 9392, 232, 80, 28, 1, 152, 3, - FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, /* 1440x960 [15:10] */ {NULL, 60, 1440, 960, 8733, 240, 88, 30, 1, 152, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, /* 1920x1080 [16:9] */ {NULL, 60, 1920, 1080, 6734, 148, 88, 41, 1, 44, 3, - FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, }; @@ -124,8 +124,8 @@ static int lynxfb_ops_cursor(struct fb_info* info,struct fb_cursor* fbcursor) cursor = &crtc->cursor; if(fbcursor->image.width > cursor->maxW || - fbcursor->image.height > cursor->maxH || - fbcursor->image.depth > 1){ + fbcursor->image.height > cursor->maxH || + fbcursor->image.depth > 1){ return -ENXIO; } @@ -136,19 +136,19 @@ static int lynxfb_ops_cursor(struct fb_info* info,struct fb_cursor* fbcursor) if(fbcursor->set & FB_CUR_SETPOS){ cursor->setPos(cursor,fbcursor->image.dx - info->var.xoffset, - fbcursor->image.dy - info->var.yoffset); + fbcursor->image.dy - info->var.yoffset); } if(fbcursor->set & FB_CUR_SETCMAP){ /* get the 16bit color of kernel means */ u16 fg,bg; fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800))| - ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5)| - ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11); + ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5)| + ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11); bg = ((info->cmap.red[fbcursor->image.bg_color] & 0xf800))| - ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5)| - ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11); + ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5)| + ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11); cursor->setColor(cursor,fg,bg); } @@ -157,9 +157,9 @@ static int lynxfb_ops_cursor(struct fb_info* info,struct fb_cursor* fbcursor) if(fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) { cursor->setData(cursor, - fbcursor->rop, - fbcursor->image.data, - fbcursor->mask); + fbcursor->rop, + fbcursor->image.data, + fbcursor->mask); } if(fbcursor->enable){ @@ -200,11 +200,10 @@ static void lynxfb_ops_fillrect(struct fb_info* info,const struct fb_fillrect* r spin_lock(&share->slock); share->accel.de_fillrect(&share->accel, - base,pitch,Bpp, - region->dx,region->dy, - region->width,region->height, - color,rop); - + base,pitch,Bpp, + region->dx,region->dy, + region->width,region->height, + color,rop); if (share->dual) spin_unlock(&share->slock); } @@ -232,10 +231,9 @@ static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea * spin_lock(&share->slock); share->accel.de_copyarea(&share->accel, - base,pitch,region->sx,region->sy, - base,pitch,Bpp,region->dx,region->dy, - region->width,region->height,HW_ROP2_COPY); - + base,pitch,region->sx,region->sy, + base,pitch,Bpp,region->dx,region->dy, + region->width,region->height,HW_ROP2_COPY); if (share->dual) spin_unlock(&share->slock); } @@ -257,7 +255,7 @@ static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* imag if(image->depth == 1){ if(info->fix.visual == FB_VISUAL_TRUECOLOR || - info->fix.visual == FB_VISUAL_DIRECTCOLOR) + info->fix.visual == FB_VISUAL_DIRECTCOLOR) { fgcol = ((u32*)info->pseudo_palette)[image->fg_color]; bgcol = ((u32*)info->pseudo_palette)[image->bg_color]; @@ -279,33 +277,32 @@ _do_work: spin_lock(&share->slock); share->accel.de_imageblit(&share->accel, - image->data,image->width>>3,0, - base,pitch,Bpp, - image->dx,image->dy, - image->width,image->height, - fgcol,bgcol,HW_ROP2_COPY); - + image->data,image->width>>3,0, + base,pitch,Bpp, + image->dx,image->dy, + image->width,image->height, + fgcol,bgcol,HW_ROP2_COPY); if (share->dual) spin_unlock(&share->slock); } static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, - struct fb_info *info) + struct fb_info *info) { - struct lynxfb_par * par; - struct lynxfb_crtc * crtc; - int ret; - + struct lynxfb_par * par; + struct lynxfb_crtc * crtc; + int ret; - if(!info) - return -EINVAL; - ret = 0; - par = info->par; - crtc = &par->crtc; - ret = crtc->proc_panDisplay(crtc, var, info); + if(!info) + return -EINVAL; - return ret; + ret = 0; + par = info->par; + crtc = &par->crtc; + ret = crtc->proc_panDisplay(crtc, var, info); + + return ret; } static int lynxfb_ops_set_par(struct fb_info * info) @@ -460,7 +457,7 @@ static int lynxfb_resume(struct pci_dev* pdev) struct lynx_cursor * cursor; int ret; - + ret = 0; share = pci_get_drvdata(pdev); @@ -526,7 +523,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* in int ret; resource_size_t request; - + par = info->par; crtc = &par->crtc; output = &par->output; @@ -534,9 +531,9 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* in ret = 0; pr_debug("check var:%dx%d-%d\n", - var->xres, - var->yres, - var->bits_per_pixel); + var->xres, + var->yres, + var->bits_per_pixel); switch(var->bits_per_pixel){ @@ -611,64 +608,64 @@ exit: static int lynxfb_ops_setcolreg(unsigned regno,unsigned red, - unsigned green,unsigned blue, - unsigned transp,struct fb_info * info) + unsigned green,unsigned blue, + unsigned transp,struct fb_info * info) { - struct lynxfb_par * par; - struct lynxfb_crtc * crtc; - struct fb_var_screeninfo * var; - int ret; - - par = info->par; - crtc = &par->crtc; - var = &info->var; - ret = 0; - - //pr_debug("regno=%d,red=%d,green=%d,blue=%d\n",regno,red,green,blue); - if(regno > 256){ - pr_err("regno = %d\n",regno); - return -EINVAL; - } - - if(info->var.grayscale) - red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; - - if(var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR) - { - red >>= 8; - green >>= 8; - blue >>= 8; - ret = crtc->proc_setColReg(crtc,regno,red,green,blue); - goto exit; - } - - - if(info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 ) - { - u32 val; - if(var->bits_per_pixel == 16 || - var->bits_per_pixel == 32 || - var->bits_per_pixel == 24) - { - val = chan_to_field(red,&var->red); - val |= chan_to_field(green,&var->green); - val |= chan_to_field(blue,&var->blue); - par->pseudo_palette[regno] = val; - goto exit; - } - } - - ret = -EINVAL; + struct lynxfb_par * par; + struct lynxfb_crtc * crtc; + struct fb_var_screeninfo * var; + int ret; + + par = info->par; + crtc = &par->crtc; + var = &info->var; + ret = 0; + + //pr_debug("regno=%d,red=%d,green=%d,blue=%d\n",regno,red,green,blue); + if(regno > 256){ + pr_err("regno = %d\n",regno); + return -EINVAL; + } + + if(info->var.grayscale) + red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; + + if(var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR) + { + red >>= 8; + green >>= 8; + blue >>= 8; + ret = crtc->proc_setColReg(crtc,regno,red,green,blue); + goto exit; + } + + + if(info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 ) + { + u32 val; + if(var->bits_per_pixel == 16 || + var->bits_per_pixel == 32 || + var->bits_per_pixel == 24) + { + val = chan_to_field(red,&var->red); + val |= chan_to_field(green,&var->green); + val |= chan_to_field(blue,&var->blue); + par->pseudo_palette[regno] = val; + goto exit; + } + } + + ret = -EINVAL; exit: - return ret; + return ret; } static int lynxfb_ops_blank(int blank,struct fb_info* info) { struct lynxfb_par * par; struct lynxfb_output * output; - + pr_debug("blank = %d.\n",blank); par = info->par; output = &par->output; @@ -677,89 +674,89 @@ static int lynxfb_ops_blank(int blank,struct fb_info* info) static int sm750fb_set_drv(struct lynxfb_par * par) { - int ret; - struct lynx_share * share; - struct sm750_share * spec_share; - struct lynxfb_output * output; - struct lynxfb_crtc * crtc; - - ret = 0; - - share = par->share; - spec_share = container_of(share,struct sm750_share,share); - output = &par->output; - crtc = &par->crtc; - - crtc->vidmem_size = (share->dual)?share->vidmem_size>>1:share->vidmem_size; - /* setup crtc and output member */ - spec_share->hwCursor = g_hwcursor; - - crtc->proc_setMode = hw_sm750_crtc_setMode; - crtc->proc_checkMode = hw_sm750_crtc_checkMode; - crtc->proc_setColReg = hw_sm750_setColReg; - crtc->proc_panDisplay = hw_sm750_pan_display; - crtc->clear = hw_sm750_crtc_clear; - crtc->line_pad = 16; - //crtc->xpanstep = crtc->ypanstep = crtc->ywrapstep = 0; - crtc->xpanstep = 8; - crtc->ypanstep = 1; - crtc->ywrapstep = 0; - - output->proc_setMode = hw_sm750_output_setMode; - output->proc_checkMode = hw_sm750_output_checkMode; - - output->proc_setBLANK = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_setBLANK:hw_sm750_setBLANK; - output->clear = hw_sm750_output_clear; - /* chip specific phase */ - share->accel.de_wait = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_deWait: hw_sm750_deWait; - switch (spec_share->state.dataflow) - { - case sm750_simul_pri: - output->paths = sm750_pnc; - crtc->channel = sm750_primary; - crtc->oScreen = 0; - crtc->vScreen = share->pvMem; - pr_info("use simul primary mode\n"); - break; - case sm750_simul_sec: - output->paths = sm750_pnc; - crtc->channel = sm750_secondary; - crtc->oScreen = 0; - crtc->vScreen = share->pvMem; - break; - case sm750_dual_normal: - if(par->index == 0){ - output->paths = sm750_panel; - crtc->channel = sm750_primary; - crtc->oScreen = 0; - crtc->vScreen = share->pvMem; - }else{ - output->paths = sm750_crt; - crtc->channel = sm750_secondary; - /* not consider of padding stuffs for oScreen,need fix*/ - crtc->oScreen = (share->vidmem_size >> 1); - crtc->vScreen = share->pvMem + crtc->oScreen; - } - break; - case sm750_dual_swap: - if(par->index == 0){ - output->paths = sm750_panel; - crtc->channel = sm750_secondary; - crtc->oScreen = 0; - crtc->vScreen = share->pvMem; - }else{ - output->paths = sm750_crt; - crtc->channel = sm750_primary; - /* not consider of padding stuffs for oScreen,need fix*/ - crtc->oScreen = (share->vidmem_size >> 1); - crtc->vScreen = share->pvMem + crtc->oScreen; - } - break; - default: - ret = -EINVAL; - } - - return ret; + int ret; + struct lynx_share * share; + struct sm750_share * spec_share; + struct lynxfb_output * output; + struct lynxfb_crtc * crtc; + + ret = 0; + + share = par->share; + spec_share = container_of(share,struct sm750_share,share); + output = &par->output; + crtc = &par->crtc; + + crtc->vidmem_size = (share->dual)?share->vidmem_size>>1:share->vidmem_size; + /* setup crtc and output member */ + spec_share->hwCursor = g_hwcursor; + + crtc->proc_setMode = hw_sm750_crtc_setMode; + crtc->proc_checkMode = hw_sm750_crtc_checkMode; + crtc->proc_setColReg = hw_sm750_setColReg; + crtc->proc_panDisplay = hw_sm750_pan_display; + crtc->clear = hw_sm750_crtc_clear; + crtc->line_pad = 16; + //crtc->xpanstep = crtc->ypanstep = crtc->ywrapstep = 0; + crtc->xpanstep = 8; + crtc->ypanstep = 1; + crtc->ywrapstep = 0; + + output->proc_setMode = hw_sm750_output_setMode; + output->proc_checkMode = hw_sm750_output_checkMode; + + output->proc_setBLANK = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_setBLANK:hw_sm750_setBLANK; + output->clear = hw_sm750_output_clear; + /* chip specific phase */ + share->accel.de_wait = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_deWait: hw_sm750_deWait; + switch (spec_share->state.dataflow) + { + case sm750_simul_pri: + output->paths = sm750_pnc; + crtc->channel = sm750_primary; + crtc->oScreen = 0; + crtc->vScreen = share->pvMem; + pr_info("use simul primary mode\n"); + break; + case sm750_simul_sec: + output->paths = sm750_pnc; + crtc->channel = sm750_secondary; + crtc->oScreen = 0; + crtc->vScreen = share->pvMem; + break; + case sm750_dual_normal: + if(par->index == 0){ + output->paths = sm750_panel; + crtc->channel = sm750_primary; + crtc->oScreen = 0; + crtc->vScreen = share->pvMem; + }else{ + output->paths = sm750_crt; + crtc->channel = sm750_secondary; + /* not consider of padding stuffs for oScreen,need fix*/ + crtc->oScreen = (share->vidmem_size >> 1); + crtc->vScreen = share->pvMem + crtc->oScreen; + } + break; + case sm750_dual_swap: + if(par->index == 0){ + output->paths = sm750_panel; + crtc->channel = sm750_secondary; + crtc->oScreen = 0; + crtc->vScreen = share->pvMem; + }else{ + output->paths = sm750_crt; + crtc->channel = sm750_primary; + /* not consider of padding stuffs for oScreen,need fix*/ + crtc->oScreen = (share->vidmem_size >> 1); + crtc->vScreen = share->pvMem + crtc->oScreen; + } + break; + default: + ret = -EINVAL; + } + + return ret; } static struct fb_ops lynxfb_ops={ @@ -778,106 +775,106 @@ static struct fb_ops lynxfb_ops={ static int lynxfb_set_fbinfo(struct fb_info* info,int index) { - int i; - struct lynxfb_par * par; - struct lynx_share * share; - struct lynxfb_crtc * crtc; - struct lynxfb_output * output; - struct fb_var_screeninfo * var; - struct fb_fix_screeninfo * fix; - - const struct fb_videomode * pdb[] = { - lynx750_ext, NULL,vesa_modes, - }; - int cdb[] = {ARRAY_SIZE(lynx750_ext),0,VESA_MODEDB_SIZE}; - static const char * mdb_desc[] ={ - "driver prepared modes", - "kernel prepared default modedb", - "kernel HELPERS prepared vesa_modes", - }; - - - static const char * fixId[2]= - { - "sm750_fb1","sm750_fb2", - }; - - int ret,line_length; - - ret = 0; - par = (struct lynxfb_par *)info->par; - share = par->share; - crtc = &par->crtc; - output = &par->output; - var = &info->var; - fix = &info->fix; - - /* set index */ - par->index = index; - output->channel = &crtc->channel; + int i; + struct lynxfb_par * par; + struct lynx_share * share; + struct lynxfb_crtc * crtc; + struct lynxfb_output * output; + struct fb_var_screeninfo * var; + struct fb_fix_screeninfo * fix; + + const struct fb_videomode * pdb[] = { + lynx750_ext, NULL,vesa_modes, + }; + int cdb[] = {ARRAY_SIZE(lynx750_ext),0,VESA_MODEDB_SIZE}; + static const char * mdb_desc[] ={ + "driver prepared modes", + "kernel prepared default modedb", + "kernel HELPERS prepared vesa_modes", + }; + + + static const char * fixId[2]= + { + "sm750_fb1","sm750_fb2", + }; + + int ret,line_length; + + ret = 0; + par = (struct lynxfb_par *)info->par; + share = par->share; + crtc = &par->crtc; + output = &par->output; + var = &info->var; + fix = &info->fix; + + /* set index */ + par->index = index; + output->channel = &crtc->channel; sm750fb_set_drv(par); - lynxfb_ops.fb_pan_display = lynxfb_ops_pan_display; - - - /* set current cursor variable and proc pointer, - * must be set after crtc member initialized */ - crtc->cursor.offset = crtc->oScreen + crtc->vidmem_size - 1024; - crtc->cursor.mmio = share->pvReg + 0x800f0 + (int)crtc->channel * 0x140; - - pr_info("crtc->cursor.mmio = %p\n",crtc->cursor.mmio); - crtc->cursor.maxH = crtc->cursor.maxW = 64; - crtc->cursor.size = crtc->cursor.maxH*crtc->cursor.maxW*2/8; - crtc->cursor.disable = hw_cursor_disable; - crtc->cursor.enable = hw_cursor_enable; - crtc->cursor.setColor = hw_cursor_setColor; - crtc->cursor.setPos = hw_cursor_setPos; - crtc->cursor.setSize = hw_cursor_setSize; - crtc->cursor.setData = hw_cursor_setData; - crtc->cursor.vstart = share->pvMem + crtc->cursor.offset; - - - crtc->cursor.share = share; - memset_io(crtc->cursor.vstart, 0, crtc->cursor.size); - if(!g_hwcursor){ - lynxfb_ops.fb_cursor = NULL; - crtc->cursor.disable(&crtc->cursor); - } - - - /* set info->fbops, must be set before fb_find_mode */ - if(!share->accel_off){ - /* use 2d acceleration */ - lynxfb_ops.fb_fillrect = lynxfb_ops_fillrect; - lynxfb_ops.fb_copyarea = lynxfb_ops_copyarea; - lynxfb_ops.fb_imageblit = lynxfb_ops_imageblit; - } - info->fbops = &lynxfb_ops; - - if(!g_fbmode[index]){ - g_fbmode[index] = g_def_fbmode; - if(index) - g_fbmode[index] = g_fbmode[0]; - } + lynxfb_ops.fb_pan_display = lynxfb_ops_pan_display; + + + /* set current cursor variable and proc pointer, + * must be set after crtc member initialized */ + crtc->cursor.offset = crtc->oScreen + crtc->vidmem_size - 1024; + crtc->cursor.mmio = share->pvReg + 0x800f0 + (int)crtc->channel * 0x140; + + pr_info("crtc->cursor.mmio = %p\n",crtc->cursor.mmio); + crtc->cursor.maxH = crtc->cursor.maxW = 64; + crtc->cursor.size = crtc->cursor.maxH*crtc->cursor.maxW*2/8; + crtc->cursor.disable = hw_cursor_disable; + crtc->cursor.enable = hw_cursor_enable; + crtc->cursor.setColor = hw_cursor_setColor; + crtc->cursor.setPos = hw_cursor_setPos; + crtc->cursor.setSize = hw_cursor_setSize; + crtc->cursor.setData = hw_cursor_setData; + crtc->cursor.vstart = share->pvMem + crtc->cursor.offset; + + + crtc->cursor.share = share; + memset_io(crtc->cursor.vstart, 0, crtc->cursor.size); + if(!g_hwcursor){ + lynxfb_ops.fb_cursor = NULL; + crtc->cursor.disable(&crtc->cursor); + } + + + /* set info->fbops, must be set before fb_find_mode */ + if(!share->accel_off){ + /* use 2d acceleration */ + lynxfb_ops.fb_fillrect = lynxfb_ops_fillrect; + lynxfb_ops.fb_copyarea = lynxfb_ops_copyarea; + lynxfb_ops.fb_imageblit = lynxfb_ops_imageblit; + } + info->fbops = &lynxfb_ops; + + if(!g_fbmode[index]){ + g_fbmode[index] = g_def_fbmode; + if(index) + g_fbmode[index] = g_fbmode[0]; + } for(i=0;i<3;i++){ ret = fb_find_mode(var,info,g_fbmode[index], - pdb[i],cdb[i],NULL,8); + pdb[i],cdb[i],NULL,8); if(ret == 1){ pr_info("success! use specified mode:%s in %s\n", - g_fbmode[index], - mdb_desc[i]); + g_fbmode[index], + mdb_desc[i]); break; }else if(ret == 2){ pr_warn("use specified mode:%s in %s,with an ignored refresh rate\n", - g_fbmode[index], - mdb_desc[i]); + g_fbmode[index], + mdb_desc[i]); break; }else if(ret == 3){ pr_warn("wanna use default mode\n"); -// break; + // break; }else if(ret == 4){ pr_warn("fall back to any valid mode\n"); }else{ @@ -885,97 +882,97 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) } } - /* some member of info->var had been set by fb_find_mode */ - - pr_info("Member of info->var is :\n\ - xres=%d\n\ - yres=%d\n\ - xres_virtual=%d\n\ - yres_virtual=%d\n\ - xoffset=%d\n\ - yoffset=%d\n\ - bits_per_pixel=%d\n \ - ...\n",var->xres,var->yres,var->xres_virtual,var->yres_virtual, - var->xoffset,var->yoffset,var->bits_per_pixel); - - /* set par */ - par->info = info; - - /* set info */ - line_length = PADDING(crtc->line_pad, - (var->xres_virtual * var->bits_per_pixel/8)); - - info->pseudo_palette = &par->pseudo_palette[0]; - info->screen_base = crtc->vScreen; - pr_debug("screen_base vaddr = %p\n",info->screen_base); + /* some member of info->var had been set by fb_find_mode */ + + pr_info("Member of info->var is :\n\ + xres=%d\n\ + yres=%d\n\ + xres_virtual=%d\n\ + yres_virtual=%d\n\ + xoffset=%d\n\ + yoffset=%d\n\ + bits_per_pixel=%d\n \ + ...\n",var->xres,var->yres,var->xres_virtual,var->yres_virtual, + var->xoffset,var->yoffset,var->bits_per_pixel); + + /* set par */ + par->info = info; + + /* set info */ + line_length = PADDING(crtc->line_pad, + (var->xres_virtual * var->bits_per_pixel/8)); + + info->pseudo_palette = &par->pseudo_palette[0]; + info->screen_base = crtc->vScreen; + pr_debug("screen_base vaddr = %p\n",info->screen_base); info->screen_size = line_length * var->yres_virtual; info->flags = FBINFO_FLAG_DEFAULT|0; - /* set info->fix */ - fix->type = FB_TYPE_PACKED_PIXELS; - fix->type_aux = 0; - fix->xpanstep = crtc->xpanstep; - fix->ypanstep = crtc->ypanstep; - fix->ywrapstep = crtc->ywrapstep; - fix->accel = FB_ACCEL_SMI; + /* set info->fix */ + fix->type = FB_TYPE_PACKED_PIXELS; + fix->type_aux = 0; + fix->xpanstep = crtc->xpanstep; + fix->ypanstep = crtc->ypanstep; + fix->ywrapstep = crtc->ywrapstep; + fix->accel = FB_ACCEL_SMI; - strlcpy(fix->id,fixId[index],sizeof(fix->id)); + strlcpy(fix->id,fixId[index],sizeof(fix->id)); fix->smem_start = crtc->oScreen + share->vidmem_start; pr_info("fix->smem_start = %lx\n",fix->smem_start); - /* according to mmap experiment from user space application, - * fix->mmio_len should not larger than virtual size - * (xres_virtual x yres_virtual x ByPP) - * Below line maybe buggy when user mmap fb dev node and write - * data into the bound over virtual size - * */ - fix->smem_len = crtc->vidmem_size; - pr_info("fix->smem_len = %x\n",fix->smem_len); - info->screen_size = fix->smem_len; - fix->line_length = line_length; - fix->mmio_start = share->vidreg_start; - pr_info("fix->mmio_start = %lx\n",fix->mmio_start); - fix->mmio_len = share->vidreg_size; - pr_info("fix->mmio_len = %x\n",fix->mmio_len); - switch(var->bits_per_pixel) - { - case 8: - fix->visual = FB_VISUAL_PSEUDOCOLOR; - break; - case 16: - case 32: - fix->visual = FB_VISUAL_TRUECOLOR; - break; - } - - /* set var */ - var->activate = FB_ACTIVATE_NOW; - var->accel_flags = 0; - var->vmode = FB_VMODE_NONINTERLACED; - - pr_debug("#1 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", - info->cmap.start,info->cmap.len, - info->cmap.red,info->cmap.green,info->cmap.blue, - info->cmap.transp); - - if((ret = fb_alloc_cmap(&info->cmap,256,0)) < 0){ - pr_err("Could not allcate memory for cmap.\n"); - goto exit; - } - - pr_debug("#2 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", - info->cmap.start,info->cmap.len, - info->cmap.red,info->cmap.green,info->cmap.blue, - info->cmap.transp); + /* according to mmap experiment from user space application, + * fix->mmio_len should not larger than virtual size + * (xres_virtual x yres_virtual x ByPP) + * Below line maybe buggy when user mmap fb dev node and write + * data into the bound over virtual size + * */ + fix->smem_len = crtc->vidmem_size; + pr_info("fix->smem_len = %x\n",fix->smem_len); + info->screen_size = fix->smem_len; + fix->line_length = line_length; + fix->mmio_start = share->vidreg_start; + pr_info("fix->mmio_start = %lx\n",fix->mmio_start); + fix->mmio_len = share->vidreg_size; + pr_info("fix->mmio_len = %x\n",fix->mmio_len); + switch(var->bits_per_pixel) + { + case 8: + fix->visual = FB_VISUAL_PSEUDOCOLOR; + break; + case 16: + case 32: + fix->visual = FB_VISUAL_TRUECOLOR; + break; + } + + /* set var */ + var->activate = FB_ACTIVATE_NOW; + var->accel_flags = 0; + var->vmode = FB_VMODE_NONINTERLACED; + + pr_debug("#1 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", + info->cmap.start,info->cmap.len, + info->cmap.red,info->cmap.green,info->cmap.blue, + info->cmap.transp); + + if((ret = fb_alloc_cmap(&info->cmap,256,0)) < 0){ + pr_err("Could not allcate memory for cmap.\n"); + goto exit; + } + + pr_debug("#2 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", + info->cmap.start,info->cmap.len, + info->cmap.red,info->cmap.green,info->cmap.blue, + info->cmap.transp); exit: lynxfb_ops_check_var(var,info); -// lynxfb_ops_set_par(info); - return ret; + // lynxfb_ops_set_par(info); + return ret; } -/* chip specific g_option configuration routine */ +/* chip specific g_option configuration routine */ static void sm750fb_setup(struct lynx_share * share,char * src) { struct sm750_share * spec_share; @@ -984,98 +981,98 @@ static void sm750fb_setup(struct lynx_share * share,char * src) char * exp_res; #endif int swap; - + spec_share = container_of(share,struct sm750_share,share); #ifdef CAP_EXPENSIION - exp_res = NULL; + exp_res = NULL; #endif - swap = 0; - - spec_share->state.initParm.chip_clk = 0; - spec_share->state.initParm.mem_clk = 0; - spec_share->state.initParm.master_clk = 0; - spec_share->state.initParm.powerMode = 0; - spec_share->state.initParm.setAllEngOff = 0; - spec_share->state.initParm.resetMemory = 1; - - /*defaultly turn g_hwcursor on for both view */ - g_hwcursor = 3; - - if(!src || !*src){ - pr_warn("no specific g_option.\n"); - goto NO_PARAM; - } - - while((opt = strsep(&src,":")) != NULL && *opt != 0){ - pr_err("opt=%s\n",opt); - pr_err("src=%s\n",src); - - if(!strncmp(opt,"swap",strlen("swap"))) - swap = 1; - else if(!strncmp(opt,"nocrt",strlen("nocrt"))) - spec_share->state.nocrt = 1; - else if(!strncmp(opt,"36bit",strlen("36bit"))) - spec_share->state.pnltype = sm750_doubleTFT; - else if(!strncmp(opt,"18bit",strlen("18bit"))) - spec_share->state.pnltype = sm750_dualTFT; - else if(!strncmp(opt,"24bit",strlen("24bit"))) - spec_share->state.pnltype = sm750_24TFT; + swap = 0; + + spec_share->state.initParm.chip_clk = 0; + spec_share->state.initParm.mem_clk = 0; + spec_share->state.initParm.master_clk = 0; + spec_share->state.initParm.powerMode = 0; + spec_share->state.initParm.setAllEngOff = 0; + spec_share->state.initParm.resetMemory = 1; + + /*defaultly turn g_hwcursor on for both view */ + g_hwcursor = 3; + + if(!src || !*src){ + pr_warn("no specific g_option.\n"); + goto NO_PARAM; + } + + while((opt = strsep(&src,":")) != NULL && *opt != 0){ + pr_err("opt=%s\n",opt); + pr_err("src=%s\n",src); + + if(!strncmp(opt,"swap",strlen("swap"))) + swap = 1; + else if(!strncmp(opt,"nocrt",strlen("nocrt"))) + spec_share->state.nocrt = 1; + else if(!strncmp(opt,"36bit",strlen("36bit"))) + spec_share->state.pnltype = sm750_doubleTFT; + else if(!strncmp(opt,"18bit",strlen("18bit"))) + spec_share->state.pnltype = sm750_dualTFT; + else if(!strncmp(opt,"24bit",strlen("24bit"))) + spec_share->state.pnltype = sm750_24TFT; #ifdef CAP_EXPANSION - else if(!strncmp(opt,"exp:",strlen("exp:"))) - exp_res = opt + strlen("exp:"); + else if(!strncmp(opt,"exp:",strlen("exp:"))) + exp_res = opt + strlen("exp:"); #endif - else if(!strncmp(opt,"nohwc0",strlen("nohwc0"))) - g_hwcursor &= ~0x1; - else if(!strncmp(opt,"nohwc1",strlen("nohwc1"))) - g_hwcursor &= ~0x2; - else if(!strncmp(opt,"nohwc",strlen("nohwc"))) - g_hwcursor = 0; - else - { - if(!g_fbmode[0]){ - g_fbmode[0] = opt; - pr_info("find fbmode0 : %s\n",g_fbmode[0]); - }else if(!g_fbmode[1]){ - g_fbmode[1] = opt; - pr_info("find fbmode1 : %s\n",g_fbmode[1]); - }else{ - pr_warn("How many view you wann set?\n"); - } - } - } + else if(!strncmp(opt,"nohwc0",strlen("nohwc0"))) + g_hwcursor &= ~0x1; + else if(!strncmp(opt,"nohwc1",strlen("nohwc1"))) + g_hwcursor &= ~0x2; + else if(!strncmp(opt,"nohwc",strlen("nohwc"))) + g_hwcursor = 0; + else + { + if(!g_fbmode[0]){ + g_fbmode[0] = opt; + pr_info("find fbmode0 : %s\n",g_fbmode[0]); + }else if(!g_fbmode[1]){ + g_fbmode[1] = opt; + pr_info("find fbmode1 : %s\n",g_fbmode[1]); + }else{ + pr_warn("How many view you wann set?\n"); + } + } + } #ifdef CAP_EXPANSION - if(getExpRes(exp_res,&spec_share->state.xLCD,&spec_share->state.yLCD)) - { - /* seems exp_res is not valid*/ - spec_share->state.xLCD = spec_share->state.yLCD = 0; - } + if(getExpRes(exp_res,&spec_share->state.xLCD,&spec_share->state.yLCD)) + { + /* seems exp_res is not valid*/ + spec_share->state.xLCD = spec_share->state.yLCD = 0; + } #endif NO_PARAM: - if(share->revid != SM750LE_REVISION_ID){ - if(share->dual) - { - if(swap) - spec_share->state.dataflow = sm750_dual_swap; - else - spec_share->state.dataflow = sm750_dual_normal; - }else{ - if(swap) - spec_share->state.dataflow = sm750_simul_sec; - else - spec_share->state.dataflow = sm750_simul_pri; - } - }else{ - /* SM750LE only have one crt channel */ - spec_share->state.dataflow = sm750_simul_sec; - /* sm750le do not have complex attributes*/ - spec_share->state.nocrt = 0; - } + if(share->revid != SM750LE_REVISION_ID){ + if(share->dual) + { + if(swap) + spec_share->state.dataflow = sm750_dual_swap; + else + spec_share->state.dataflow = sm750_dual_normal; + }else{ + if(swap) + spec_share->state.dataflow = sm750_simul_sec; + else + spec_share->state.dataflow = sm750_simul_pri; + } + }else{ + /* SM750LE only have one crt channel */ + spec_share->state.dataflow = sm750_simul_sec; + /* sm750le do not have complex attributes*/ + spec_share->state.nocrt = 0; + } } static int lynxfb_pci_probe(struct pci_dev * pdev, - const struct pci_device_id * ent) + const struct pci_device_id * ent) { struct fb_info * info[] = {NULL,NULL}; struct lynx_share * share = NULL; @@ -1083,7 +1080,7 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, struct sm750_share *spec_share = NULL; size_t spec_offset = 0; int fbidx; - + /* enable device */ if(pci_enable_device(pdev)){ @@ -1145,8 +1142,8 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, if(!share->mtrr_off){ pr_info("enable mtrr\n"); share->mtrr.vram = mtrr_add(share->vidmem_start, - share->vidmem_size, - MTRR_TYPE_WRCOMB,1); + share->vidmem_size, + MTRR_TYPE_WRCOMB,1); if(share->mtrr.vram < 0){ /* don't block driver with the failure of MTRR */ @@ -1168,52 +1165,52 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, hw_sm750_inithw(share,pdev); /* allocate frame buffer info structor according to g_dualview */ - fbidx = 0; + fbidx = 0; ALLOC_FB: - info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par),&pdev->dev); - if(!info[fbidx]) - { - pr_err("Could not allocate framebuffer #%d.\n",fbidx); + info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par),&pdev->dev); + if(!info[fbidx]) + { + pr_err("Could not allocate framebuffer #%d.\n",fbidx); + if(fbidx == 0) + goto err_info0_alloc; + else + goto err_info1_alloc; + } + else + { + struct lynxfb_par * par; + int errno; + pr_info("framebuffer #%d alloc okay\n",fbidx); + share->fbinfo[fbidx] = info[fbidx]; + par = info[fbidx]->par; + par->share = share; + + /* set fb_info structure */ + if(lynxfb_set_fbinfo(info[fbidx],fbidx)){ + pr_err("Failed to initial fb_info #%d.\n",fbidx); if(fbidx == 0) - goto err_info0_alloc; + goto err_info0_set; else - goto err_info1_alloc; + goto err_info1_set; } - else - { - struct lynxfb_par * par; - int errno; - pr_info("framebuffer #%d alloc okay\n",fbidx); - share->fbinfo[fbidx] = info[fbidx]; - par = info[fbidx]->par; - par->share = share; - - /* set fb_info structure */ - if(lynxfb_set_fbinfo(info[fbidx],fbidx)){ - pr_err("Failed to initial fb_info #%d.\n",fbidx); - if(fbidx == 0) - goto err_info0_set; - else - goto err_info1_set; - } - /* register frame buffer*/ - pr_info("Ready to register framebuffer #%d.\n",fbidx); - errno = register_framebuffer(info[fbidx]); - if (errno < 0) { - pr_err("Failed to register fb_info #%d. err %d\n",fbidx, errno); - if(fbidx == 0) - goto err_register0; - else - goto err_register1; - } - pr_info("Accomplished register framebuffer #%d.\n",fbidx); + /* register frame buffer*/ + pr_info("Ready to register framebuffer #%d.\n",fbidx); + errno = register_framebuffer(info[fbidx]); + if (errno < 0) { + pr_err("Failed to register fb_info #%d. err %d\n",fbidx, errno); + if(fbidx == 0) + goto err_register0; + else + goto err_register1; } + pr_info("Accomplished register framebuffer #%d.\n",fbidx); + } - /* no dual view by far */ - fbidx++; - if(share->dual && fbidx < 2) - goto ALLOC_FB; + /* no dual view by far */ + fbidx++; + if(share->dual && fbidx < 2) + goto ALLOC_FB; return 0; @@ -1275,7 +1272,7 @@ static int __init lynxfb_setup(char * options) { int len; char * opt,*tmp; - + if(!options || !*options){ pr_warn("no options.\n"); @@ -1291,7 +1288,7 @@ static int __init lynxfb_setup(char * options) tmp = g_settings; - /* Notes: + /* Notes: char * strsep(char **s,const char * ct); @s: the string to be searched @ct :the characters to search for @@ -1372,14 +1369,14 @@ module_exit(lynxfb_exit); module_param(g_option,charp,S_IRUGO); MODULE_PARM_DESC(g_option, - "\n\t\tCommon options:\n" - "\t\tnoaccel:disable 2d capabilities\n" - "\t\tnomtrr:disable MTRR attribute for video memory\n" - "\t\tdualview:dual frame buffer feature enabled\n" - "\t\tnohwc:disable hardware cursor\n" - "\t\tUsual example:\n" - "\t\tinsmod ./sm750fb.ko g_option=\"noaccel,nohwc,1280x1024-8@60\"\n" - ); + "\n\t\tCommon options:\n" + "\t\tnoaccel:disable 2d capabilities\n" + "\t\tnomtrr:disable MTRR attribute for video memory\n" + "\t\tdualview:dual frame buffer feature enabled\n" + "\t\tnohwc:disable hardware cursor\n" + "\t\tUsual example:\n" + "\t\tinsmod ./sm750fb.ko g_option=\"noaccel,nohwc,1280x1024-8@60\"\n" + ); MODULE_AUTHOR("monk liu "); MODULE_AUTHOR("Sudip Mukherjee "); -- cgit v1.2.3 From 45e3b3da820ae612268294caac44776beb5ab885 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:24:53 +0100 Subject: staging: sm750: add missing spaces after ',' Fixes checkpatch.pl error: "ERROR: space required after that ',' (ctx:VxV)" Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 264 ++++++++++++++++++++-------------------- 1 file changed, 132 insertions(+), 132 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 87b50fce5dd9..e98eefcf3309 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -50,26 +50,26 @@ static int g_noaccel; #ifdef CONFIG_MTRR static int g_nomtrr; #endif -static const char * g_fbmode[] = {NULL,NULL}; +static const char * g_fbmode[] = {NULL, NULL}; static const char * g_def_fbmode = "800x600-16@60"; static char * g_settings = NULL; static int g_dualview; static char * g_option = NULL; static const struct fb_videomode lynx750_ext[] = { - /* 1024x600-60 VESA [1.71:1] */ + /* 1024x600-60 VESA [1.71:1] */ {NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1024x600-70 VESA */ + /* 1024x600-70 VESA */ {NULL, 70, 1024, 600, 17211, 152, 48, 21, 1, 104, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1024x600-75 VESA */ + /* 1024x600-75 VESA */ {NULL, 75, 1024, 600, 15822, 160, 56, 23, 1, 104, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1024x600-85 VESA */ + /* 1024x600-85 VESA */ {NULL, 85, 1024, 600, 13730, 168, 56, 26, 1, 112, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, @@ -79,13 +79,13 @@ static const struct fb_videomode lynx750_ext[] = { /* 1280x720 [1.78:1] */ {NULL, 60, 1280, 720, 13426, 162, 86, 22, 1, 136, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1280x768@60 */ - {NULL,60,1280,768,12579,192,64,20,3,128,7, + /* 1280x768@60 */ + {NULL, 60, 1280, 768, 12579, 192, 64, 20, 3, 128, 7, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, - {NULL,60,1360,768,11804,208,64,23,1,144,3, + {NULL, 60, 1360, 768, 11804, 208, 64, 23, 1, 144, 3, FB_SYNC_HOR_HIGH_ACT|FB_VMODE_NONINTERLACED}, /* 1360 x 768 [1.77083:1] */ @@ -96,9 +96,9 @@ static const struct fb_videomode lynx750_ext[] = { {NULL, 60, 1368, 768, 11647, 216, 72, 23, 1, 144, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1440 x 900 [16:10] */ + /* 1440 x 900 [16:10] */ {NULL, 60, 1440, 900, 9392, 232, 80, 28, 1, 152, 3, - FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, /* 1440x960 [15:10] */ {NULL, 60, 1440, 960, 8733, 240, 88, 30, 1, 152, 3, @@ -106,14 +106,14 @@ static const struct fb_videomode lynx750_ext[] = { /* 1920x1080 [16:9] */ {NULL, 60, 1920, 1080, 6734, 148, 88, 41, 1, 44, 3, - FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, }; /* no hardware cursor supported under version 2.6.10, kernel bug */ -static int lynxfb_ops_cursor(struct fb_info* info,struct fb_cursor* fbcursor) +static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor) { struct lynxfb_par * par; struct lynxfb_crtc * crtc; @@ -131,17 +131,17 @@ static int lynxfb_ops_cursor(struct fb_info* info,struct fb_cursor* fbcursor) cursor->disable(cursor); if(fbcursor->set & FB_CUR_SETSIZE){ - cursor->setSize(cursor,fbcursor->image.width,fbcursor->image.height); + cursor->setSize(cursor, fbcursor->image.width, fbcursor->image.height); } if(fbcursor->set & FB_CUR_SETPOS){ - cursor->setPos(cursor,fbcursor->image.dx - info->var.xoffset, + cursor->setPos(cursor, fbcursor->image.dx - info->var.xoffset, fbcursor->image.dy - info->var.yoffset); } if(fbcursor->set & FB_CUR_SETCMAP){ /* get the 16bit color of kernel means */ - u16 fg,bg; + u16 fg, bg; fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800))| ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5)| ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11); @@ -150,7 +150,7 @@ static int lynxfb_ops_cursor(struct fb_info* info,struct fb_cursor* fbcursor) ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5)| ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11); - cursor->setColor(cursor,fg,bg); + cursor->setColor(cursor, fg, bg); } @@ -169,11 +169,11 @@ static int lynxfb_ops_cursor(struct fb_info* info,struct fb_cursor* fbcursor) return 0; } -static void lynxfb_ops_fillrect(struct fb_info* info,const struct fb_fillrect* region) +static void lynxfb_ops_fillrect(struct fb_info* info, const struct fb_fillrect* region) { struct lynxfb_par * par; struct lynx_share * share; - unsigned int base,pitch,Bpp,rop; + unsigned int base, pitch, Bpp, rop; u32 color; if(info->state != FBINFO_STATE_RUNNING){ @@ -200,19 +200,19 @@ static void lynxfb_ops_fillrect(struct fb_info* info,const struct fb_fillrect* r spin_lock(&share->slock); share->accel.de_fillrect(&share->accel, - base,pitch,Bpp, - region->dx,region->dy, - region->width,region->height, - color,rop); + base, pitch, Bpp, + region->dx, region->dy, + region->width, region->height, + color, rop); if (share->dual) spin_unlock(&share->slock); } -static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea * region) +static void lynxfb_ops_copyarea(struct fb_info * info, const struct fb_copyarea * region) { struct lynxfb_par * par; struct lynx_share * share; - unsigned int base,pitch,Bpp; + unsigned int base, pitch, Bpp; par = info->par; share = par->share; @@ -231,17 +231,17 @@ static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea * spin_lock(&share->slock); share->accel.de_copyarea(&share->accel, - base,pitch,region->sx,region->sy, - base,pitch,Bpp,region->dx,region->dy, - region->width,region->height,HW_ROP2_COPY); + base, pitch, region->sx, region->sy, + base, pitch, Bpp, region->dx, region->dy, + region->width, region->height, HW_ROP2_COPY); if (share->dual) spin_unlock(&share->slock); } -static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* image) +static void lynxfb_ops_imageblit(struct fb_info*info, const struct fb_image* image) { - unsigned int base,pitch,Bpp; - unsigned int fgcol,bgcol; + unsigned int base, pitch, Bpp; + unsigned int fgcol, bgcol; struct lynxfb_par * par; struct lynx_share * share; @@ -277,11 +277,11 @@ _do_work: spin_lock(&share->slock); share->accel.de_imageblit(&share->accel, - image->data,image->width>>3,0, - base,pitch,Bpp, - image->dx,image->dy, - image->width,image->height, - fgcol,bgcol,HW_ROP2_COPY); + image->data, image->width>>3, 0, + base, pitch, Bpp, + image->dx, image->dy, + image->width, image->height, + fgcol, bgcol, HW_ROP2_COPY); if (share->dual) spin_unlock(&share->slock); } @@ -329,9 +329,9 @@ static int lynxfb_ops_set_par(struct fb_info * info) /* fix structur is not so FIX ... */ line_length = var->xres_virtual * var->bits_per_pixel / 8; - line_length = PADDING(crtc->line_pad,line_length); + line_length = PADDING(crtc->line_pad, line_length); fix->line_length = line_length; - pr_err("fix->line_length = %d\n",fix->line_length); + pr_err("fix->line_length = %d\n", fix->line_length); /* var->red,green,blue,transp are need to be set by driver * and these data should be set before setcolreg routine @@ -381,13 +381,13 @@ static int lynxfb_ops_set_par(struct fb_info * info) pr_err("pixel bpp format not satisfied\n."); return ret; } - ret = crtc->proc_setMode(crtc,var,fix); + ret = crtc->proc_setMode(crtc, var, fix); if(!ret) - ret = output->proc_setMode(output,var,fix); + ret = output->proc_setMode(output, var, fix); return ret; } -static inline unsigned int chan_to_field(unsigned int chan,struct fb_bitfield * bf) +static inline unsigned int chan_to_field(unsigned int chan, struct fb_bitfield * bf) { chan &= 0xffff; chan >>= 16 - bf->length; @@ -465,7 +465,7 @@ static int lynxfb_resume(struct pci_dev* pdev) console_lock(); if((ret = pci_set_power_state(pdev, PCI_D0)) != 0){ - pr_err("error:%d occured in pci_set_power_state\n",ret); + pr_err("error:%d occured in pci_set_power_state\n", ret); return ret; } @@ -473,7 +473,7 @@ static int lynxfb_resume(struct pci_dev* pdev) if(pdev->dev.power.power_state.event != PM_EVENT_FREEZE){ pci_restore_state(pdev); if ((ret = pci_enable_device(pdev)) != 0){ - pr_err("error:%d occured in pci_enable_device\n",ret); + pr_err("error:%d occured in pci_enable_device\n", ret); return ret; } pci_set_master(pdev); @@ -481,7 +481,7 @@ static int lynxfb_resume(struct pci_dev* pdev) if(share->resume) (*share->resume)(share); - hw_sm750_inithw(share,pdev); + hw_sm750_inithw(share, pdev); info = share->fbinfo[0]; @@ -514,7 +514,7 @@ static int lynxfb_resume(struct pci_dev* pdev) } #endif -static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* info) +static int lynxfb_ops_check_var(struct fb_var_screeninfo* var, struct fb_info* info) { struct lynxfb_par * par; struct lynxfb_crtc * crtc; @@ -543,7 +543,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* in case 32: break; default: - pr_err("bpp %d not supported\n",var->bits_per_pixel); + pr_err("bpp %d not supported\n", var->bits_per_pixel); ret = -EINVAL; goto exit; } @@ -592,24 +592,24 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* in request = var->xres_virtual * (var->bits_per_pixel >> 3); /* defaulty crtc->channel go with par->index */ - request = PADDING(crtc->line_pad,request); + request = PADDING(crtc->line_pad, request); request = request * var->yres_virtual; if(crtc->vidmem_size < request){ pr_err("not enough video memory for mode\n"); return -ENOMEM; } - ret = output->proc_checkMode(output,var); + ret = output->proc_checkMode(output, var); if(!ret) - ret = crtc->proc_checkMode(crtc,var); + ret = crtc->proc_checkMode(crtc, var); exit: return ret; } -static int lynxfb_ops_setcolreg(unsigned regno,unsigned red, - unsigned green,unsigned blue, - unsigned transp,struct fb_info * info) +static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, + unsigned green, unsigned blue, + unsigned transp, struct fb_info * info) { struct lynxfb_par * par; struct lynxfb_crtc * crtc; @@ -623,7 +623,7 @@ static int lynxfb_ops_setcolreg(unsigned regno,unsigned red, //pr_debug("regno=%d,red=%d,green=%d,blue=%d\n",regno,red,green,blue); if(regno > 256){ - pr_err("regno = %d\n",regno); + pr_err("regno = %d\n", regno); return -EINVAL; } @@ -635,7 +635,7 @@ static int lynxfb_ops_setcolreg(unsigned regno,unsigned red, red >>= 8; green >>= 8; blue >>= 8; - ret = crtc->proc_setColReg(crtc,regno,red,green,blue); + ret = crtc->proc_setColReg(crtc, regno, red, green, blue); goto exit; } @@ -647,9 +647,9 @@ static int lynxfb_ops_setcolreg(unsigned regno,unsigned red, var->bits_per_pixel == 32 || var->bits_per_pixel == 24) { - val = chan_to_field(red,&var->red); - val |= chan_to_field(green,&var->green); - val |= chan_to_field(blue,&var->blue); + val = chan_to_field(red, &var->red); + val |= chan_to_field(green, &var->green); + val |= chan_to_field(blue, &var->blue); par->pseudo_palette[regno] = val; goto exit; } @@ -661,15 +661,15 @@ exit: return ret; } -static int lynxfb_ops_blank(int blank,struct fb_info* info) +static int lynxfb_ops_blank(int blank, struct fb_info* info) { struct lynxfb_par * par; struct lynxfb_output * output; - pr_debug("blank = %d.\n",blank); + pr_debug("blank = %d.\n", blank); par = info->par; output = &par->output; - return output->proc_setBLANK(output,blank); + return output->proc_setBLANK(output, blank); } static int sm750fb_set_drv(struct lynxfb_par * par) @@ -683,7 +683,7 @@ static int sm750fb_set_drv(struct lynxfb_par * par) ret = 0; share = par->share; - spec_share = container_of(share,struct sm750_share,share); + spec_share = container_of(share, struct sm750_share, share); output = &par->output; crtc = &par->crtc; @@ -773,7 +773,7 @@ static struct fb_ops lynxfb_ops={ }; -static int lynxfb_set_fbinfo(struct fb_info* info,int index) +static int lynxfb_set_fbinfo(struct fb_info* info, int index) { int i; struct lynxfb_par * par; @@ -784,9 +784,9 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) struct fb_fix_screeninfo * fix; const struct fb_videomode * pdb[] = { - lynx750_ext, NULL,vesa_modes, + lynx750_ext, NULL, vesa_modes, }; - int cdb[] = {ARRAY_SIZE(lynx750_ext),0,VESA_MODEDB_SIZE}; + int cdb[] = {ARRAY_SIZE(lynx750_ext), 0, VESA_MODEDB_SIZE}; static const char * mdb_desc[] ={ "driver prepared modes", "kernel prepared default modedb", @@ -796,10 +796,10 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) static const char * fixId[2]= { - "sm750_fb1","sm750_fb2", + "sm750_fb1", "sm750_fb2", }; - int ret,line_length; + int ret, line_length; ret = 0; par = (struct lynxfb_par *)info->par; @@ -821,7 +821,7 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) crtc->cursor.offset = crtc->oScreen + crtc->vidmem_size - 1024; crtc->cursor.mmio = share->pvReg + 0x800f0 + (int)crtc->channel * 0x140; - pr_info("crtc->cursor.mmio = %p\n",crtc->cursor.mmio); + pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio); crtc->cursor.maxH = crtc->cursor.maxW = 64; crtc->cursor.size = crtc->cursor.maxH*crtc->cursor.maxW*2/8; crtc->cursor.disable = hw_cursor_disable; @@ -859,8 +859,8 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) for(i=0;i<3;i++){ - ret = fb_find_mode(var,info,g_fbmode[index], - pdb[i],cdb[i],NULL,8); + ret = fb_find_mode(var, info, g_fbmode[index], + pdb[i], cdb[i], NULL, 8); if(ret == 1){ pr_info("success! use specified mode:%s in %s\n", @@ -878,7 +878,7 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) }else if(ret == 4){ pr_warn("fall back to any valid mode\n"); }else{ - pr_warn("ret = %d,fb_find_mode failed,with %s\n",ret,mdb_desc[i]); + pr_warn("ret = %d,fb_find_mode failed,with %s\n", ret, mdb_desc[i]); } } @@ -892,8 +892,8 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) xoffset=%d\n\ yoffset=%d\n\ bits_per_pixel=%d\n \ - ...\n",var->xres,var->yres,var->xres_virtual,var->yres_virtual, - var->xoffset,var->yoffset,var->bits_per_pixel); + ...\n", var->xres, var->yres, var->xres_virtual, var->yres_virtual, + var->xoffset, var->yoffset, var->bits_per_pixel); /* set par */ par->info = info; @@ -904,7 +904,7 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) info->pseudo_palette = &par->pseudo_palette[0]; info->screen_base = crtc->vScreen; - pr_debug("screen_base vaddr = %p\n",info->screen_base); + pr_debug("screen_base vaddr = %p\n", info->screen_base); info->screen_size = line_length * var->yres_virtual; info->flags = FBINFO_FLAG_DEFAULT|0; @@ -916,11 +916,11 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) fix->ywrapstep = crtc->ywrapstep; fix->accel = FB_ACCEL_SMI; - strlcpy(fix->id,fixId[index],sizeof(fix->id)); + strlcpy(fix->id, fixId[index], sizeof(fix->id)); fix->smem_start = crtc->oScreen + share->vidmem_start; - pr_info("fix->smem_start = %lx\n",fix->smem_start); + pr_info("fix->smem_start = %lx\n", fix->smem_start); /* according to mmap experiment from user space application, * fix->mmio_len should not larger than virtual size * (xres_virtual x yres_virtual x ByPP) @@ -928,13 +928,13 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) * data into the bound over virtual size * */ fix->smem_len = crtc->vidmem_size; - pr_info("fix->smem_len = %x\n",fix->smem_len); + pr_info("fix->smem_len = %x\n", fix->smem_len); info->screen_size = fix->smem_len; fix->line_length = line_length; fix->mmio_start = share->vidreg_start; - pr_info("fix->mmio_start = %lx\n",fix->mmio_start); + pr_info("fix->mmio_start = %lx\n", fix->mmio_start); fix->mmio_len = share->vidreg_size; - pr_info("fix->mmio_len = %x\n",fix->mmio_len); + pr_info("fix->mmio_len = %x\n", fix->mmio_len); switch(var->bits_per_pixel) { case 8: @@ -952,28 +952,28 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index) var->vmode = FB_VMODE_NONINTERLACED; pr_debug("#1 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", - info->cmap.start,info->cmap.len, - info->cmap.red,info->cmap.green,info->cmap.blue, + info->cmap.start, info->cmap.len, + info->cmap.red, info->cmap.green, info->cmap.blue, info->cmap.transp); - if((ret = fb_alloc_cmap(&info->cmap,256,0)) < 0){ + if((ret = fb_alloc_cmap(&info->cmap, 256, 0)) < 0){ pr_err("Could not allcate memory for cmap.\n"); goto exit; } pr_debug("#2 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", - info->cmap.start,info->cmap.len, - info->cmap.red,info->cmap.green,info->cmap.blue, + info->cmap.start, info->cmap.len, + info->cmap.red, info->cmap.green, info->cmap.blue, info->cmap.transp); exit: - lynxfb_ops_check_var(var,info); + lynxfb_ops_check_var(var, info); // lynxfb_ops_set_par(info); return ret; } /* chip specific g_option configuration routine */ -static void sm750fb_setup(struct lynx_share * share,char * src) +static void sm750fb_setup(struct lynx_share * share, char * src) { struct sm750_share * spec_share; char * opt; @@ -983,7 +983,7 @@ static void sm750fb_setup(struct lynx_share * share,char * src) int swap; - spec_share = container_of(share,struct sm750_share,share); + spec_share = container_of(share, struct sm750_share, share); #ifdef CAP_EXPENSIION exp_res = NULL; #endif @@ -1004,45 +1004,45 @@ static void sm750fb_setup(struct lynx_share * share,char * src) goto NO_PARAM; } - while((opt = strsep(&src,":")) != NULL && *opt != 0){ - pr_err("opt=%s\n",opt); - pr_err("src=%s\n",src); + while((opt = strsep(&src, ":")) != NULL && *opt != 0){ + pr_err("opt=%s\n", opt); + pr_err("src=%s\n", src); - if(!strncmp(opt,"swap",strlen("swap"))) + if(!strncmp(opt, "swap", strlen("swap"))) swap = 1; - else if(!strncmp(opt,"nocrt",strlen("nocrt"))) + else if(!strncmp(opt, "nocrt", strlen("nocrt"))) spec_share->state.nocrt = 1; - else if(!strncmp(opt,"36bit",strlen("36bit"))) + else if(!strncmp(opt, "36bit", strlen("36bit"))) spec_share->state.pnltype = sm750_doubleTFT; - else if(!strncmp(opt,"18bit",strlen("18bit"))) + else if(!strncmp(opt, "18bit", strlen("18bit"))) spec_share->state.pnltype = sm750_dualTFT; - else if(!strncmp(opt,"24bit",strlen("24bit"))) + else if(!strncmp(opt, "24bit", strlen("24bit"))) spec_share->state.pnltype = sm750_24TFT; #ifdef CAP_EXPANSION - else if(!strncmp(opt,"exp:",strlen("exp:"))) + else if(!strncmp(opt, "exp:", strlen("exp:"))) exp_res = opt + strlen("exp:"); #endif - else if(!strncmp(opt,"nohwc0",strlen("nohwc0"))) + else if(!strncmp(opt, "nohwc0", strlen("nohwc0"))) g_hwcursor &= ~0x1; - else if(!strncmp(opt,"nohwc1",strlen("nohwc1"))) + else if(!strncmp(opt, "nohwc1", strlen("nohwc1"))) g_hwcursor &= ~0x2; - else if(!strncmp(opt,"nohwc",strlen("nohwc"))) + else if(!strncmp(opt, "nohwc", strlen("nohwc"))) g_hwcursor = 0; else { if(!g_fbmode[0]){ g_fbmode[0] = opt; - pr_info("find fbmode0 : %s\n",g_fbmode[0]); + pr_info("find fbmode0 : %s\n", g_fbmode[0]); }else if(!g_fbmode[1]){ g_fbmode[1] = opt; - pr_info("find fbmode1 : %s\n",g_fbmode[1]); + pr_info("find fbmode1 : %s\n", g_fbmode[1]); }else{ pr_warn("How many view you wann set?\n"); } } } #ifdef CAP_EXPANSION - if(getExpRes(exp_res,&spec_share->state.xLCD,&spec_share->state.yLCD)) + if(getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) { /* seems exp_res is not valid*/ spec_share->state.xLCD = spec_share->state.yLCD = 0; @@ -1074,7 +1074,7 @@ NO_PARAM: static int lynxfb_pci_probe(struct pci_dev * pdev, const struct pci_device_id * ent) { - struct fb_info * info[] = {NULL,NULL}; + struct fb_info * info[] = {NULL, NULL}; struct lynx_share * share = NULL; struct sm750_share *spec_share = NULL; @@ -1090,9 +1090,9 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, /* though offset of share in sm750_share is 0, * we use this marcro as the same */ - spec_offset = offsetof(struct sm750_share,share); + spec_offset = offsetof(struct sm750_share, share); - spec_share = kzalloc(sizeof(*spec_share),GFP_KERNEL); + spec_share = kzalloc(sizeof(*spec_share), GFP_KERNEL); if(!spec_share){ pr_err("Could not allocate memory for share.\n"); goto err_share; @@ -1104,7 +1104,7 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, share->devid = pdev->device; share->revid = pdev->revision; - pr_info("share->revid = %02x\n",share->revid); + pr_info("share->revid = %02x\n", share->revid); share->pdev = pdev; #ifdef CONFIG_MTRR share->mtrr_off = g_nomtrr; @@ -1130,10 +1130,10 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, } /* call chip specific setup routine */ - sm750fb_setup(share,g_settings); + sm750fb_setup(share, g_settings); /* call chip specific mmap routine */ - if(hw_sm750_map(share,pdev)){ + if(hw_sm750_map(share, pdev)){ pr_err("Memory map failed\n"); goto err_map; } @@ -1143,7 +1143,7 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, pr_info("enable mtrr\n"); share->mtrr.vram = mtrr_add(share->vidmem_start, share->vidmem_size, - MTRR_TYPE_WRCOMB,1); + MTRR_TYPE_WRCOMB, 1); if(share->mtrr.vram < 0){ /* don't block driver with the failure of MTRR */ @@ -1157,20 +1157,20 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, memset_io(share->pvMem, 0, share->vidmem_size); - pr_info("sm%3x mmio address = %p\n",share->devid,share->pvReg); + pr_info("sm%3x mmio address = %p\n", share->devid, share->pvReg); - pci_set_drvdata(pdev,share); + pci_set_drvdata(pdev, share); /* call chipInit routine */ - hw_sm750_inithw(share,pdev); + hw_sm750_inithw(share, pdev); /* allocate frame buffer info structor according to g_dualview */ fbidx = 0; ALLOC_FB: - info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par),&pdev->dev); + info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par), &pdev->dev); if(!info[fbidx]) { - pr_err("Could not allocate framebuffer #%d.\n",fbidx); + pr_err("Could not allocate framebuffer #%d.\n", fbidx); if(fbidx == 0) goto err_info0_alloc; else @@ -1180,14 +1180,14 @@ ALLOC_FB: { struct lynxfb_par * par; int errno; - pr_info("framebuffer #%d alloc okay\n",fbidx); + pr_info("framebuffer #%d alloc okay\n", fbidx); share->fbinfo[fbidx] = info[fbidx]; par = info[fbidx]->par; par->share = share; /* set fb_info structure */ - if(lynxfb_set_fbinfo(info[fbidx],fbidx)){ - pr_err("Failed to initial fb_info #%d.\n",fbidx); + if(lynxfb_set_fbinfo(info[fbidx], fbidx)){ + pr_err("Failed to initial fb_info #%d.\n", fbidx); if(fbidx == 0) goto err_info0_set; else @@ -1195,16 +1195,16 @@ ALLOC_FB: } /* register frame buffer*/ - pr_info("Ready to register framebuffer #%d.\n",fbidx); + pr_info("Ready to register framebuffer #%d.\n", fbidx); errno = register_framebuffer(info[fbidx]); if (errno < 0) { - pr_err("Failed to register fb_info #%d. err %d\n",fbidx, errno); + pr_err("Failed to register fb_info #%d. err %d\n", fbidx, errno); if(fbidx == 0) goto err_register0; else goto err_register1; } - pr_info("Accomplished register framebuffer #%d.\n",fbidx); + pr_info("Accomplished register framebuffer #%d.\n", fbidx); } /* no dual view by far */ @@ -1256,16 +1256,16 @@ static void __exit lynxfb_pci_remove(struct pci_dev * pdev) } #ifdef CONFIG_MTRR if(share->mtrr.vram_added) - mtrr_del(share->mtrr.vram,share->vidmem_start,share->vidmem_size); + mtrr_del(share->mtrr.vram, share->vidmem_start, share->vidmem_size); #endif // pci_release_regions(pdev); iounmap(share->pvReg); iounmap(share->pvMem); - spec_share = container_of(share,struct sm750_share,share); + spec_share = container_of(share, struct sm750_share, share); kfree(g_settings); kfree(spec_share); - pci_set_drvdata(pdev,NULL); + pci_set_drvdata(pdev, NULL); } static int __init lynxfb_setup(char * options) @@ -1279,7 +1279,7 @@ static int __init lynxfb_setup(char * options) return 0; } - pr_info("options:%s\n",options); + pr_info("options:%s\n", options); len = strlen(options) + 1; g_settings = kzalloc(len, GFP_KERNEL); @@ -1296,20 +1296,20 @@ static int __init lynxfb_setup(char * options) strsep() updates @options to pointer after the first found token it also returns the pointer ahead the token. */ - while((opt = strsep(&options,":"))!=NULL) + while((opt = strsep(&options, ":"))!=NULL) { /* options that mean for any lynx chips are configured here */ - if(!strncmp(opt,"noaccel",strlen("noaccel"))) + if(!strncmp(opt, "noaccel", strlen("noaccel"))) g_noaccel = 1; #ifdef CONFIG_MTRR - else if(!strncmp(opt,"nomtrr",strlen("nomtrr"))) + else if(!strncmp(opt, "nomtrr", strlen("nomtrr"))) g_nomtrr = 1; #endif - else if(!strncmp(opt,"dual",strlen("dual"))) + else if(!strncmp(opt, "dual", strlen("dual"))) g_dualview = 1; else { - strcat(tmp,opt); + strcat(tmp, opt); tmp += strlen(opt); if(options != NULL) *tmp++ = ':'; @@ -1319,7 +1319,7 @@ static int __init lynxfb_setup(char * options) } /* misc g_settings are transport to chip specific routines */ - pr_info("parameter left for chip specific analysis:%s\n",g_settings); + pr_info("parameter left for chip specific analysis:%s\n", g_settings); return 0; } @@ -1328,7 +1328,7 @@ static struct pci_device_id smi_pci_table[] = { {0,} }; -MODULE_DEVICE_TABLE(pci,smi_pci_table); +MODULE_DEVICE_TABLE(pci, smi_pci_table); static struct pci_driver lynxfb_driver = { .name = "sm750fb", @@ -1350,7 +1350,7 @@ static int __init lynxfb_init(void) #ifdef MODULE option = g_option; #else - if(fb_get_options("sm750fb",&option)) + if(fb_get_options("sm750fb", &option)) return -ENODEV; #endif @@ -1366,7 +1366,7 @@ static void __exit lynxfb_exit(void) } module_exit(lynxfb_exit); -module_param(g_option,charp,S_IRUGO); +module_param(g_option, charp, S_IRUGO); MODULE_PARM_DESC(g_option, "\n\t\tCommon options:\n" -- cgit v1.2.3 From 70407df77665c0e6bb6f6dea5e1561670fbadf18 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:25:08 +0100 Subject: staging: sm750: move '{' to previous line Fix checkpatch.pl error: "ERROR: that open brace { should be on the previous line" Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 50 +++++++++++++---------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index e98eefcf3309..bc2986d9fee6 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -154,8 +154,7 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor) } - if(fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) - { + if(fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) { cursor->setData(cursor, fbcursor->rop, fbcursor->image.data, @@ -255,13 +254,10 @@ static void lynxfb_ops_imageblit(struct fb_info*info, const struct fb_image* ima if(image->depth == 1){ if(info->fix.visual == FB_VISUAL_TRUECOLOR || - info->fix.visual == FB_VISUAL_DIRECTCOLOR) - { + info->fix.visual == FB_VISUAL_DIRECTCOLOR) { fgcol = ((u32*)info->pseudo_palette)[image->fg_color]; bgcol = ((u32*)info->pseudo_palette)[image->bg_color]; - } - else - { + } else { fgcol = image->fg_color; bgcol = image->bg_color; } @@ -630,8 +626,7 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, if(info->var.grayscale) red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; - if(var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR) - { + if(var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { red >>= 8; green >>= 8; blue >>= 8; @@ -640,13 +635,11 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, } - if(info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 ) - { + if(info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 ) { u32 val; if(var->bits_per_pixel == 16 || var->bits_per_pixel == 32 || - var->bits_per_pixel == 24) - { + var->bits_per_pixel == 24) { val = chan_to_field(red, &var->red); val |= chan_to_field(green, &var->green); val |= chan_to_field(blue, &var->blue); @@ -709,8 +702,7 @@ static int sm750fb_set_drv(struct lynxfb_par * par) output->clear = hw_sm750_output_clear; /* chip specific phase */ share->accel.de_wait = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_deWait: hw_sm750_deWait; - switch (spec_share->state.dataflow) - { + switch (spec_share->state.dataflow) { case sm750_simul_pri: output->paths = sm750_pnc; crtc->channel = sm750_primary; @@ -794,8 +786,7 @@ static int lynxfb_set_fbinfo(struct fb_info* info, int index) }; - static const char * fixId[2]= - { + static const char * fixId[2] = { "sm750_fb1", "sm750_fb2", }; @@ -935,8 +926,7 @@ static int lynxfb_set_fbinfo(struct fb_info* info, int index) pr_info("fix->mmio_start = %lx\n", fix->mmio_start); fix->mmio_len = share->vidreg_size; pr_info("fix->mmio_len = %x\n", fix->mmio_len); - switch(var->bits_per_pixel) - { + switch(var->bits_per_pixel) { case 8: fix->visual = FB_VISUAL_PSEUDOCOLOR; break; @@ -1028,8 +1018,7 @@ static void sm750fb_setup(struct lynx_share * share, char * src) g_hwcursor &= ~0x2; else if(!strncmp(opt, "nohwc", strlen("nohwc"))) g_hwcursor = 0; - else - { + else { if(!g_fbmode[0]){ g_fbmode[0] = opt; pr_info("find fbmode0 : %s\n", g_fbmode[0]); @@ -1042,8 +1031,7 @@ static void sm750fb_setup(struct lynx_share * share, char * src) } } #ifdef CAP_EXPANSION - if(getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) - { + if(getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) { /* seems exp_res is not valid*/ spec_share->state.xLCD = spec_share->state.yLCD = 0; } @@ -1051,8 +1039,7 @@ static void sm750fb_setup(struct lynx_share * share, char * src) NO_PARAM: if(share->revid != SM750LE_REVISION_ID){ - if(share->dual) - { + if(share->dual) { if(swap) spec_share->state.dataflow = sm750_dual_swap; else @@ -1168,16 +1155,13 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, fbidx = 0; ALLOC_FB: info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par), &pdev->dev); - if(!info[fbidx]) - { + if(!info[fbidx]) { pr_err("Could not allocate framebuffer #%d.\n", fbidx); if(fbidx == 0) goto err_info0_alloc; else goto err_info1_alloc; - } - else - { + } else { struct lynxfb_par * par; int errno; pr_info("framebuffer #%d alloc okay\n", fbidx); @@ -1296,8 +1280,7 @@ static int __init lynxfb_setup(char * options) strsep() updates @options to pointer after the first found token it also returns the pointer ahead the token. */ - while((opt = strsep(&options, ":"))!=NULL) - { + while((opt = strsep(&options, ":"))!=NULL) { /* options that mean for any lynx chips are configured here */ if(!strncmp(opt, "noaccel", strlen("noaccel"))) g_noaccel = 1; @@ -1307,8 +1290,7 @@ static int __init lynxfb_setup(char * options) #endif else if(!strncmp(opt, "dual", strlen("dual"))) g_dualview = 1; - else - { + else { strcat(tmp, opt); tmp += strlen(opt); if(options != NULL) -- cgit v1.2.3 From 5ace4e10c1cf7c8e9069b1299582899a61c9994f Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:25:22 +0100 Subject: staging: sm750: fix whitespace around braces Fix multiple similar checkpatch.pl errors: - "ERROR: space required before the open parenthesis '('" - "ERROR: space required before the open brace '{'" - "ERROR: space prohibited after that open parenthesis '('" - "ERROR: space prohibited before that close parenthesis ')'" Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 194 ++++++++++++++++++++-------------------- 1 file changed, 97 insertions(+), 97 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index bc2986d9fee6..6d148a550d12 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -39,9 +39,9 @@ int smi_indent = 0; * #endif */ -typedef void (*PROC_SPEC_SETUP)(struct lynx_share*,char *); -typedef int (*PROC_SPEC_MAP)(struct lynx_share*,struct pci_dev*); -typedef int (*PROC_SPEC_INITHW)(struct lynx_share*,struct pci_dev*); +typedef void (*PROC_SPEC_SETUP)(struct lynx_share*, char *); +typedef int (*PROC_SPEC_MAP)(struct lynx_share*, struct pci_dev*); +typedef int (*PROC_SPEC_INITHW)(struct lynx_share*, struct pci_dev*); /* common var for all device */ @@ -123,23 +123,23 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor) crtc = &par->crtc; cursor = &crtc->cursor; - if(fbcursor->image.width > cursor->maxW || + if (fbcursor->image.width > cursor->maxW || fbcursor->image.height > cursor->maxH || - fbcursor->image.depth > 1){ + fbcursor->image.depth > 1) { return -ENXIO; } cursor->disable(cursor); - if(fbcursor->set & FB_CUR_SETSIZE){ + if (fbcursor->set & FB_CUR_SETSIZE) { cursor->setSize(cursor, fbcursor->image.width, fbcursor->image.height); } - if(fbcursor->set & FB_CUR_SETPOS){ + if (fbcursor->set & FB_CUR_SETPOS) { cursor->setPos(cursor, fbcursor->image.dx - info->var.xoffset, fbcursor->image.dy - info->var.yoffset); } - if(fbcursor->set & FB_CUR_SETCMAP){ + if (fbcursor->set & FB_CUR_SETCMAP) { /* get the 16bit color of kernel means */ u16 fg, bg; fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800))| @@ -154,14 +154,14 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor) } - if(fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) { + if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) { cursor->setData(cursor, fbcursor->rop, fbcursor->image.data, fbcursor->mask); } - if(fbcursor->enable){ + if (fbcursor->enable) { cursor->enable(cursor); } @@ -175,7 +175,7 @@ static void lynxfb_ops_fillrect(struct fb_info* info, const struct fb_fillrect* unsigned int base, pitch, Bpp, rop; u32 color; - if(info->state != FBINFO_STATE_RUNNING){ + if (info->state != FBINFO_STATE_RUNNING) { return; } @@ -189,7 +189,7 @@ static void lynxfb_ops_fillrect(struct fb_info* info, const struct fb_fillrect* Bpp = info->var.bits_per_pixel >> 3; color = (Bpp == 1)?region->color:((u32*)info->pseudo_palette)[region->color]; - rop = ( region->rop != ROP_COPY ) ? HW_ROP2_XOR:HW_ROP2_COPY; + rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR:HW_ROP2_COPY; /* * If not use spin_lock,system will die if user load driver @@ -252,8 +252,8 @@ static void lynxfb_ops_imageblit(struct fb_info*info, const struct fb_image* ima pitch = info->fix.line_length; Bpp = info->var.bits_per_pixel >> 3; - if(image->depth == 1){ - if(info->fix.visual == FB_VISUAL_TRUECOLOR || + if (image->depth == 1) { + if (info->fix.visual == FB_VISUAL_TRUECOLOR || info->fix.visual == FB_VISUAL_DIRECTCOLOR) { fgcol = ((u32*)info->pseudo_palette)[image->fg_color]; bgcol = ((u32*)info->pseudo_palette)[image->bg_color]; @@ -290,7 +290,7 @@ static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, int ret; - if(!info) + if (!info) return -EINVAL; ret = 0; @@ -312,7 +312,7 @@ static int lynxfb_ops_set_par(struct fb_info * info) int ret; unsigned int line_length; - if(!info) + if (!info) return -EINVAL; ret = 0; @@ -333,7 +333,7 @@ static int lynxfb_ops_set_par(struct fb_info * info) * and these data should be set before setcolreg routine * */ - switch(var->bits_per_pixel){ + switch (var->bits_per_pixel) { case 8: fix->visual = FB_VISUAL_PSEUDOCOLOR; var->red.offset = 0; @@ -373,12 +373,12 @@ static int lynxfb_ops_set_par(struct fb_info * info) var->height = var->width = -1; var->accel_flags = 0;/*FB_ACCELF_TEXT;*/ - if(ret){ + if (ret) { pr_err("pixel bpp format not satisfied\n."); return ret; } ret = crtc->proc_setMode(crtc, var, fix); - if(!ret) + if (!ret) ret = output->proc_setMode(output, var, fix); return ret; } @@ -460,21 +460,21 @@ static int lynxfb_resume(struct pci_dev* pdev) console_lock(); - if((ret = pci_set_power_state(pdev, PCI_D0)) != 0){ + if ((ret = pci_set_power_state(pdev, PCI_D0)) != 0) { pr_err("error:%d occured in pci_set_power_state\n", ret); return ret; } - if(pdev->dev.power.power_state.event != PM_EVENT_FREEZE){ + if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) { pci_restore_state(pdev); - if ((ret = pci_enable_device(pdev)) != 0){ + if ((ret = pci_enable_device(pdev)) != 0) { pr_err("error:%d occured in pci_enable_device\n", ret); return ret; } pci_set_master(pdev); } - if(share->resume) + if (share->resume) (*share->resume)(share); hw_sm750_inithw(share, pdev); @@ -482,7 +482,7 @@ static int lynxfb_resume(struct pci_dev* pdev) info = share->fbinfo[0]; - if(info){ + if (info) { par = info->par; crtc = &par->crtc; cursor = &crtc->cursor; @@ -494,7 +494,7 @@ static int lynxfb_resume(struct pci_dev* pdev) info = share->fbinfo[1]; - if(info){ + if (info) { par = info->par; crtc = &par->crtc; cursor = &crtc->cursor; @@ -532,7 +532,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var, struct fb_info* i var->bits_per_pixel); - switch(var->bits_per_pixel){ + switch (var->bits_per_pixel) { case 8: case 16: case 24: /* support 24 bpp for only lynx712/722/720 */ @@ -544,7 +544,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var, struct fb_info* i goto exit; } - switch(var->bits_per_pixel){ + switch (var->bits_per_pixel) { case 8: info->fix.visual = FB_VISUAL_PSEUDOCOLOR; var->red.offset = 0; @@ -590,13 +590,13 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var, struct fb_info* i request = PADDING(crtc->line_pad, request); request = request * var->yres_virtual; - if(crtc->vidmem_size < request){ + if (crtc->vidmem_size < request) { pr_err("not enough video memory for mode\n"); return -ENOMEM; } ret = output->proc_checkMode(output, var); - if(!ret) + if (!ret) ret = crtc->proc_checkMode(crtc, var); exit: return ret; @@ -618,15 +618,15 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, ret = 0; //pr_debug("regno=%d,red=%d,green=%d,blue=%d\n",regno,red,green,blue); - if(regno > 256){ + if (regno > 256) { pr_err("regno = %d\n", regno); return -EINVAL; } - if(info->var.grayscale) + if (info->var.grayscale) red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; - if(var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { + if (var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { red >>= 8; green >>= 8; blue >>= 8; @@ -635,9 +635,9 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, } - if(info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 ) { + if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256) { u32 val; - if(var->bits_per_pixel == 16 || + if (var->bits_per_pixel == 16 || var->bits_per_pixel == 32 || var->bits_per_pixel == 24) { val = chan_to_field(red, &var->red); @@ -717,12 +717,12 @@ static int sm750fb_set_drv(struct lynxfb_par * par) crtc->vScreen = share->pvMem; break; case sm750_dual_normal: - if(par->index == 0){ + if (par->index == 0) { output->paths = sm750_panel; crtc->channel = sm750_primary; crtc->oScreen = 0; crtc->vScreen = share->pvMem; - }else{ + } else { output->paths = sm750_crt; crtc->channel = sm750_secondary; /* not consider of padding stuffs for oScreen,need fix*/ @@ -731,12 +731,12 @@ static int sm750fb_set_drv(struct lynxfb_par * par) } break; case sm750_dual_swap: - if(par->index == 0){ + if (par->index == 0) { output->paths = sm750_panel; crtc->channel = sm750_secondary; crtc->oScreen = 0; crtc->vScreen = share->pvMem; - }else{ + } else { output->paths = sm750_crt; crtc->channel = sm750_primary; /* not consider of padding stuffs for oScreen,need fix*/ @@ -826,14 +826,14 @@ static int lynxfb_set_fbinfo(struct fb_info* info, int index) crtc->cursor.share = share; memset_io(crtc->cursor.vstart, 0, crtc->cursor.size); - if(!g_hwcursor){ + if (!g_hwcursor) { lynxfb_ops.fb_cursor = NULL; crtc->cursor.disable(&crtc->cursor); } /* set info->fbops, must be set before fb_find_mode */ - if(!share->accel_off){ + if (!share->accel_off) { /* use 2d acceleration */ lynxfb_ops.fb_fillrect = lynxfb_ops_fillrect; lynxfb_ops.fb_copyarea = lynxfb_ops_copyarea; @@ -841,34 +841,34 @@ static int lynxfb_set_fbinfo(struct fb_info* info, int index) } info->fbops = &lynxfb_ops; - if(!g_fbmode[index]){ + if (!g_fbmode[index]) { g_fbmode[index] = g_def_fbmode; - if(index) + if (index) g_fbmode[index] = g_fbmode[0]; } - for(i=0;i<3;i++){ + for (i=0;i<3;i++) { ret = fb_find_mode(var, info, g_fbmode[index], pdb[i], cdb[i], NULL, 8); - if(ret == 1){ + if (ret == 1) { pr_info("success! use specified mode:%s in %s\n", g_fbmode[index], mdb_desc[i]); break; - }else if(ret == 2){ + } else if (ret == 2) { pr_warn("use specified mode:%s in %s,with an ignored refresh rate\n", g_fbmode[index], mdb_desc[i]); break; - }else if(ret == 3){ + } else if (ret == 3) { pr_warn("wanna use default mode\n"); // break; - }else if(ret == 4){ + } else if (ret == 4) { pr_warn("fall back to any valid mode\n"); - }else{ + } else { pr_warn("ret = %d,fb_find_mode failed,with %s\n", ret, mdb_desc[i]); } } @@ -926,7 +926,7 @@ static int lynxfb_set_fbinfo(struct fb_info* info, int index) pr_info("fix->mmio_start = %lx\n", fix->mmio_start); fix->mmio_len = share->vidreg_size; pr_info("fix->mmio_len = %x\n", fix->mmio_len); - switch(var->bits_per_pixel) { + switch (var->bits_per_pixel) { case 8: fix->visual = FB_VISUAL_PSEUDOCOLOR; break; @@ -946,7 +946,7 @@ static int lynxfb_set_fbinfo(struct fb_info* info, int index) info->cmap.red, info->cmap.green, info->cmap.blue, info->cmap.transp); - if((ret = fb_alloc_cmap(&info->cmap, 256, 0)) < 0){ + if ((ret = fb_alloc_cmap(&info->cmap, 256, 0)) < 0) { pr_err("Could not allcate memory for cmap.\n"); goto exit; } @@ -989,68 +989,68 @@ static void sm750fb_setup(struct lynx_share * share, char * src) /*defaultly turn g_hwcursor on for both view */ g_hwcursor = 3; - if(!src || !*src){ + if (!src || !*src) { pr_warn("no specific g_option.\n"); goto NO_PARAM; } - while((opt = strsep(&src, ":")) != NULL && *opt != 0){ + while ((opt = strsep(&src, ":")) != NULL && *opt != 0) { pr_err("opt=%s\n", opt); pr_err("src=%s\n", src); - if(!strncmp(opt, "swap", strlen("swap"))) + if (!strncmp(opt, "swap", strlen("swap"))) swap = 1; - else if(!strncmp(opt, "nocrt", strlen("nocrt"))) + else if (!strncmp(opt, "nocrt", strlen("nocrt"))) spec_share->state.nocrt = 1; - else if(!strncmp(opt, "36bit", strlen("36bit"))) + else if (!strncmp(opt, "36bit", strlen("36bit"))) spec_share->state.pnltype = sm750_doubleTFT; - else if(!strncmp(opt, "18bit", strlen("18bit"))) + else if (!strncmp(opt, "18bit", strlen("18bit"))) spec_share->state.pnltype = sm750_dualTFT; - else if(!strncmp(opt, "24bit", strlen("24bit"))) + else if (!strncmp(opt, "24bit", strlen("24bit"))) spec_share->state.pnltype = sm750_24TFT; #ifdef CAP_EXPANSION - else if(!strncmp(opt, "exp:", strlen("exp:"))) + else if (!strncmp(opt, "exp:", strlen("exp:"))) exp_res = opt + strlen("exp:"); #endif - else if(!strncmp(opt, "nohwc0", strlen("nohwc0"))) + else if (!strncmp(opt, "nohwc0", strlen("nohwc0"))) g_hwcursor &= ~0x1; - else if(!strncmp(opt, "nohwc1", strlen("nohwc1"))) + else if (!strncmp(opt, "nohwc1", strlen("nohwc1"))) g_hwcursor &= ~0x2; - else if(!strncmp(opt, "nohwc", strlen("nohwc"))) + else if (!strncmp(opt, "nohwc", strlen("nohwc"))) g_hwcursor = 0; else { - if(!g_fbmode[0]){ + if (!g_fbmode[0]) { g_fbmode[0] = opt; pr_info("find fbmode0 : %s\n", g_fbmode[0]); - }else if(!g_fbmode[1]){ + } else if (!g_fbmode[1]) { g_fbmode[1] = opt; pr_info("find fbmode1 : %s\n", g_fbmode[1]); - }else{ + } else { pr_warn("How many view you wann set?\n"); } } } #ifdef CAP_EXPANSION - if(getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) { + if (getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) { /* seems exp_res is not valid*/ spec_share->state.xLCD = spec_share->state.yLCD = 0; } #endif NO_PARAM: - if(share->revid != SM750LE_REVISION_ID){ - if(share->dual) { - if(swap) + if (share->revid != SM750LE_REVISION_ID) { + if (share->dual) { + if (swap) spec_share->state.dataflow = sm750_dual_swap; else spec_share->state.dataflow = sm750_dual_normal; - }else{ - if(swap) + } else { + if (swap) spec_share->state.dataflow = sm750_simul_sec; else spec_share->state.dataflow = sm750_simul_pri; } - }else{ + } else { /* SM750LE only have one crt channel */ spec_share->state.dataflow = sm750_simul_sec; /* sm750le do not have complex attributes*/ @@ -1070,7 +1070,7 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, /* enable device */ - if(pci_enable_device(pdev)){ + if (pci_enable_device(pdev)) { pr_err("can not enable device.\n"); goto err_enable; } @@ -1080,13 +1080,13 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, spec_offset = offsetof(struct sm750_share, share); spec_share = kzalloc(sizeof(*spec_share), GFP_KERNEL); - if(!spec_share){ + if (!spec_share) { pr_err("Could not allocate memory for share.\n"); goto err_share; } /* setting share structure */ - share = (struct lynx_share * )(&(spec_share->share)); + share = (struct lynx_share *)(&(spec_share->share)); share->fbinfo[0] = share->fbinfo[1] = NULL; share->devid = pdev->device; share->revid = pdev->revision; @@ -1102,7 +1102,7 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, share->dual = g_dualview; spin_lock_init(&share->slock); - if(!share->accel_off){ + if (!share->accel_off) { /* hook deInit and 2d routines, notes that below hw_xxx * routine can work on most of lynx chips * if some chip need specific function,please hook it in smXXX_set_drv @@ -1112,7 +1112,7 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, share->accel.de_copyarea = hw_copyarea; share->accel.de_imageblit = hw_imageblit; pr_info("enable 2d acceleration\n"); - }else{ + } else { pr_info("disable 2d acceleration\n"); } @@ -1120,22 +1120,22 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, sm750fb_setup(share, g_settings); /* call chip specific mmap routine */ - if(hw_sm750_map(share, pdev)){ + if (hw_sm750_map(share, pdev)) { pr_err("Memory map failed\n"); goto err_map; } #ifdef CONFIG_MTRR - if(!share->mtrr_off){ + if (!share->mtrr_off) { pr_info("enable mtrr\n"); share->mtrr.vram = mtrr_add(share->vidmem_start, share->vidmem_size, MTRR_TYPE_WRCOMB, 1); - if(share->mtrr.vram < 0){ + if (share->mtrr.vram < 0) { /* don't block driver with the failure of MTRR */ pr_err("Unable to setup MTRR.\n"); - }else{ + } else { share->mtrr.vram_added = 1; pr_info("MTRR added succesfully\n"); } @@ -1155,9 +1155,9 @@ static int lynxfb_pci_probe(struct pci_dev * pdev, fbidx = 0; ALLOC_FB: info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par), &pdev->dev); - if(!info[fbidx]) { + if (!info[fbidx]) { pr_err("Could not allocate framebuffer #%d.\n", fbidx); - if(fbidx == 0) + if (fbidx == 0) goto err_info0_alloc; else goto err_info1_alloc; @@ -1170,9 +1170,9 @@ ALLOC_FB: par->share = share; /* set fb_info structure */ - if(lynxfb_set_fbinfo(info[fbidx], fbidx)){ + if (lynxfb_set_fbinfo(info[fbidx], fbidx)) { pr_err("Failed to initial fb_info #%d.\n", fbidx); - if(fbidx == 0) + if (fbidx == 0) goto err_info0_set; else goto err_info1_set; @@ -1183,7 +1183,7 @@ ALLOC_FB: errno = register_framebuffer(info[fbidx]); if (errno < 0) { pr_err("Failed to register fb_info #%d. err %d\n", fbidx, errno); - if(fbidx == 0) + if (fbidx == 0) goto err_register0; else goto err_register1; @@ -1193,7 +1193,7 @@ ALLOC_FB: /* no dual view by far */ fbidx++; - if(share->dual && fbidx < 2) + if (share->dual && fbidx < 2) goto ALLOC_FB; return 0; @@ -1225,9 +1225,9 @@ static void __exit lynxfb_pci_remove(struct pci_dev * pdev) cnt = 2; share = pci_get_drvdata(pdev); - while(cnt-- > 0){ + while (cnt-- > 0) { info = share->fbinfo[cnt]; - if(!info) + if (!info) continue; par = info->par; @@ -1239,7 +1239,7 @@ static void __exit lynxfb_pci_remove(struct pci_dev * pdev) framebuffer_release(info); } #ifdef CONFIG_MTRR - if(share->mtrr.vram_added) + if (share->mtrr.vram_added) mtrr_del(share->mtrr.vram, share->vidmem_start, share->vidmem_size); #endif // pci_release_regions(pdev); @@ -1258,7 +1258,7 @@ static int __init lynxfb_setup(char * options) char * opt,*tmp; - if(!options || !*options){ + if (!options || !*options) { pr_warn("no options.\n"); return 0; } @@ -1267,7 +1267,7 @@ static int __init lynxfb_setup(char * options) len = strlen(options) + 1; g_settings = kzalloc(len, GFP_KERNEL); - if(!g_settings) + if (!g_settings) return -ENOMEM; tmp = g_settings; @@ -1280,20 +1280,20 @@ static int __init lynxfb_setup(char * options) strsep() updates @options to pointer after the first found token it also returns the pointer ahead the token. */ - while((opt = strsep(&options, ":"))!=NULL) { + while ((opt = strsep(&options, ":"))!=NULL) { /* options that mean for any lynx chips are configured here */ - if(!strncmp(opt, "noaccel", strlen("noaccel"))) + if (!strncmp(opt, "noaccel", strlen("noaccel"))) g_noaccel = 1; #ifdef CONFIG_MTRR - else if(!strncmp(opt, "nomtrr", strlen("nomtrr"))) + else if (!strncmp(opt, "nomtrr", strlen("nomtrr"))) g_nomtrr = 1; #endif - else if(!strncmp(opt, "dual", strlen("dual"))) + else if (!strncmp(opt, "dual", strlen("dual"))) g_dualview = 1; else { strcat(tmp, opt); tmp += strlen(opt); - if(options != NULL) + if (options != NULL) *tmp++ = ':'; else *tmp++ = 0; @@ -1332,7 +1332,7 @@ static int __init lynxfb_init(void) #ifdef MODULE option = g_option; #else - if(fb_get_options("sm750fb", &option)) + if (fb_get_options("sm750fb", &option)) return -ENODEV; #endif -- cgit v1.2.3 From 27fa159bd2958ed2146d794c295c32e4fe4dd055 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:25:37 +0100 Subject: staging: sm750: fix whitespaces around pointers This patch fixes checkpatch.pl errors: - ERROR: "foo * bar" should be "foo *bar" - ERROR: "foo* bar" should be "foo *bar" Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 153 ++++++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 76 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 6d148a550d12..d9a94d75aed4 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -50,11 +50,12 @@ static int g_noaccel; #ifdef CONFIG_MTRR static int g_nomtrr; #endif -static const char * g_fbmode[] = {NULL, NULL}; -static const char * g_def_fbmode = "800x600-16@60"; -static char * g_settings = NULL; +static const char *g_fbmode[] = {NULL, NULL}; +static const char *g_def_fbmode = "800x600-16@60"; +static char *g_settings = NULL; static int g_dualview; -static char * g_option = NULL; +static char *g_option = NULL; + static const struct fb_videomode lynx750_ext[] = { /* 1024x600-60 VESA [1.71:1] */ @@ -113,11 +114,11 @@ static const struct fb_videomode lynx750_ext[] = { /* no hardware cursor supported under version 2.6.10, kernel bug */ -static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor) +static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) { - struct lynxfb_par * par; - struct lynxfb_crtc * crtc; - struct lynx_cursor * cursor; + struct lynxfb_par *par; + struct lynxfb_crtc *crtc; + struct lynx_cursor *cursor; par = info->par; crtc = &par->crtc; @@ -168,10 +169,10 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor) return 0; } -static void lynxfb_ops_fillrect(struct fb_info* info, const struct fb_fillrect* region) +static void lynxfb_ops_fillrect(struct fb_info *info, const struct fb_fillrect *region) { - struct lynxfb_par * par; - struct lynx_share * share; + struct lynxfb_par *par; + struct lynx_share *share; unsigned int base, pitch, Bpp, rop; u32 color; @@ -207,10 +208,10 @@ static void lynxfb_ops_fillrect(struct fb_info* info, const struct fb_fillrect* spin_unlock(&share->slock); } -static void lynxfb_ops_copyarea(struct fb_info * info, const struct fb_copyarea * region) +static void lynxfb_ops_copyarea(struct fb_info *info, const struct fb_copyarea *region) { - struct lynxfb_par * par; - struct lynx_share * share; + struct lynxfb_par *par; + struct lynx_share *share; unsigned int base, pitch, Bpp; par = info->par; @@ -237,12 +238,12 @@ static void lynxfb_ops_copyarea(struct fb_info * info, const struct fb_copyarea spin_unlock(&share->slock); } -static void lynxfb_ops_imageblit(struct fb_info*info, const struct fb_image* image) +static void lynxfb_ops_imageblit(struct fb_info *info, const struct fb_image *image) { unsigned int base, pitch, Bpp; unsigned int fgcol, bgcol; - struct lynxfb_par * par; - struct lynx_share * share; + struct lynxfb_par *par; + struct lynx_share *share; par = info->par; share = par->share; @@ -285,8 +286,8 @@ _do_work: static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { - struct lynxfb_par * par; - struct lynxfb_crtc * crtc; + struct lynxfb_par *par; + struct lynxfb_crtc *crtc; int ret; @@ -301,14 +302,14 @@ static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var, return ret; } -static int lynxfb_ops_set_par(struct fb_info * info) +static int lynxfb_ops_set_par(struct fb_info *info) { - struct lynxfb_par * par; - struct lynx_share * share; - struct lynxfb_crtc * crtc; - struct lynxfb_output * output; - struct fb_var_screeninfo * var; - struct fb_fix_screeninfo * fix; + struct lynxfb_par *par; + struct lynx_share *share; + struct lynxfb_crtc *crtc; + struct lynxfb_output *output; + struct fb_var_screeninfo *var; + struct fb_fix_screeninfo *fix; int ret; unsigned int line_length; @@ -383,7 +384,7 @@ static int lynxfb_ops_set_par(struct fb_info * info) return ret; } -static inline unsigned int chan_to_field(unsigned int chan, struct fb_bitfield * bf) +static inline unsigned int chan_to_field(unsigned int chan, struct fb_bitfield *bf) { chan &= 0xffff; chan >>= 16 - bf->length; @@ -443,14 +444,14 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg) return ret; } -static int lynxfb_resume(struct pci_dev* pdev) +static int lynxfb_resume(struct pci_dev *pdev) { - struct fb_info * info; - struct lynx_share * share; + struct fb_info *info; + struct lynx_share *share; - struct lynxfb_par * par; - struct lynxfb_crtc * crtc; - struct lynx_cursor * cursor; + struct lynxfb_par *par; + struct lynxfb_crtc *crtc; + struct lynx_cursor *cursor; int ret; @@ -510,12 +511,12 @@ static int lynxfb_resume(struct pci_dev* pdev) } #endif -static int lynxfb_ops_check_var(struct fb_var_screeninfo* var, struct fb_info* info) +static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { - struct lynxfb_par * par; - struct lynxfb_crtc * crtc; - struct lynxfb_output * output; - struct lynx_share * share; + struct lynxfb_par *par; + struct lynxfb_crtc *crtc; + struct lynxfb_output *output; + struct lynx_share *share; int ret; resource_size_t request; @@ -605,11 +606,11 @@ exit: static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, - unsigned transp, struct fb_info * info) + unsigned transp, struct fb_info *info) { - struct lynxfb_par * par; - struct lynxfb_crtc * crtc; - struct fb_var_screeninfo * var; + struct lynxfb_par *par; + struct lynxfb_crtc *crtc; + struct fb_var_screeninfo *var; int ret; par = info->par; @@ -654,10 +655,10 @@ exit: return ret; } -static int lynxfb_ops_blank(int blank, struct fb_info* info) +static int lynxfb_ops_blank(int blank, struct fb_info *info) { - struct lynxfb_par * par; - struct lynxfb_output * output; + struct lynxfb_par *par; + struct lynxfb_output *output; pr_debug("blank = %d.\n", blank); par = info->par; @@ -665,13 +666,13 @@ static int lynxfb_ops_blank(int blank, struct fb_info* info) return output->proc_setBLANK(output, blank); } -static int sm750fb_set_drv(struct lynxfb_par * par) +static int sm750fb_set_drv(struct lynxfb_par *par) { int ret; - struct lynx_share * share; - struct sm750_share * spec_share; - struct lynxfb_output * output; - struct lynxfb_crtc * crtc; + struct lynx_share *share; + struct sm750_share *spec_share; + struct lynxfb_output *output; + struct lynxfb_crtc *crtc; ret = 0; @@ -765,28 +766,28 @@ static struct fb_ops lynxfb_ops={ }; -static int lynxfb_set_fbinfo(struct fb_info* info, int index) +static int lynxfb_set_fbinfo(struct fb_info *info, int index) { int i; - struct lynxfb_par * par; - struct lynx_share * share; - struct lynxfb_crtc * crtc; - struct lynxfb_output * output; - struct fb_var_screeninfo * var; - struct fb_fix_screeninfo * fix; - - const struct fb_videomode * pdb[] = { + struct lynxfb_par *par; + struct lynx_share *share; + struct lynxfb_crtc *crtc; + struct lynxfb_output *output; + struct fb_var_screeninfo *var; + struct fb_fix_screeninfo *fix; + + const struct fb_videomode *pdb[] = { lynx750_ext, NULL, vesa_modes, }; int cdb[] = {ARRAY_SIZE(lynx750_ext), 0, VESA_MODEDB_SIZE}; - static const char * mdb_desc[] ={ + static const char *mdb_desc[] ={ "driver prepared modes", "kernel prepared default modedb", "kernel HELPERS prepared vesa_modes", }; - static const char * fixId[2] = { + static const char *fixId[2] = { "sm750_fb1", "sm750_fb2", }; @@ -963,12 +964,12 @@ exit: } /* chip specific g_option configuration routine */ -static void sm750fb_setup(struct lynx_share * share, char * src) +static void sm750fb_setup(struct lynx_share *share, char *src) { - struct sm750_share * spec_share; - char * opt; + struct sm750_share *spec_share; + char *opt; #ifdef CAP_EXPENSION - char * exp_res; + char *exp_res; #endif int swap; @@ -1058,11 +1059,11 @@ NO_PARAM: } } -static int lynxfb_pci_probe(struct pci_dev * pdev, +static int lynxfb_pci_probe(struct pci_dev *pdev, const struct pci_device_id * ent) { - struct fb_info * info[] = {NULL, NULL}; - struct lynx_share * share = NULL; + struct fb_info *info[] = {NULL, NULL}; + struct lynx_share *share = NULL; struct sm750_share *spec_share = NULL; size_t spec_offset = 0; @@ -1162,7 +1163,7 @@ ALLOC_FB: else goto err_info1_alloc; } else { - struct lynxfb_par * par; + struct lynxfb_par *par; int errno; pr_info("framebuffer #%d alloc okay\n", fbidx); share->fbinfo[fbidx] = info[fbidx]; @@ -1214,12 +1215,12 @@ err_enable: return -ENODEV; } -static void __exit lynxfb_pci_remove(struct pci_dev * pdev) +static void __exit lynxfb_pci_remove(struct pci_dev *pdev) { - struct fb_info * info; - struct lynx_share * share; - void * spec_share; - struct lynxfb_par * par; + struct fb_info *info; + struct lynx_share *share; + void *spec_share; + struct lynxfb_par *par; int cnt; cnt = 2; @@ -1252,10 +1253,10 @@ static void __exit lynxfb_pci_remove(struct pci_dev * pdev) pci_set_drvdata(pdev, NULL); } -static int __init lynxfb_setup(char * options) +static int __init lynxfb_setup(char *options) { int len; - char * opt,*tmp; + char *opt, *tmp; if (!options || !*options) { -- cgit v1.2.3 From f46a04c75605fd55879c797fd7f349f8cb32bb88 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Fri, 27 Mar 2015 19:42:48 +0100 Subject: staging: sm750: no braces for single stmt if blocks This patches fixes checkpatch.pl warning: "WARNING: braces {} are not necessary for single statement blocks" Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index d9a94d75aed4..786679d0f6be 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -131,9 +131,8 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) } cursor->disable(cursor); - if (fbcursor->set & FB_CUR_SETSIZE) { + if (fbcursor->set & FB_CUR_SETSIZE) cursor->setSize(cursor, fbcursor->image.width, fbcursor->image.height); - } if (fbcursor->set & FB_CUR_SETPOS) { cursor->setPos(cursor, fbcursor->image.dx - info->var.xoffset, @@ -162,9 +161,8 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) fbcursor->mask); } - if (fbcursor->enable) { + if (fbcursor->enable) cursor->enable(cursor); - } return 0; } @@ -176,9 +174,8 @@ static void lynxfb_ops_fillrect(struct fb_info *info, const struct fb_fillrect * unsigned int base, pitch, Bpp, rop; u32 color; - if (info->state != FBINFO_STATE_RUNNING) { + if (info->state != FBINFO_STATE_RUNNING) return; - } par = info->par; share = par->share; -- cgit v1.2.3 From 4bd9503d0becdb6f825fc13b3f4f5a194a91f7be Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:26:04 +0100 Subject: staging: sm750: comment formating This patch fixes checkpatch.pl warnings / errors: - "WARNING: please, no space before tabs" - "ERROR: do not use C99 // comments" Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 42 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 786679d0f6be..2f8a6b232774 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -58,19 +58,19 @@ static char *g_option = NULL; static const struct fb_videomode lynx750_ext[] = { - /* 1024x600-60 VESA [1.71:1] */ + /* 1024x600-60 VESA [1.71:1] */ {NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1024x600-70 VESA */ + /* 1024x600-70 VESA */ {NULL, 70, 1024, 600, 17211, 152, 48, 21, 1, 104, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1024x600-75 VESA */ + /* 1024x600-75 VESA */ {NULL, 75, 1024, 600, 15822, 160, 56, 23, 1, 104, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1024x600-85 VESA */ + /* 1024x600-85 VESA */ {NULL, 85, 1024, 600, 13730, 168, 56, 26, 1, 112, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, @@ -82,7 +82,7 @@ static const struct fb_videomode lynx750_ext[] = { {NULL, 60, 1280, 720, 13426, 162, 86, 22, 1, 136, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1280x768@60 */ + /* 1280x768@60 */ {NULL, 60, 1280, 768, 12579, 192, 64, 20, 3, 128, 7, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, @@ -97,7 +97,7 @@ static const struct fb_videomode lynx750_ext[] = { {NULL, 60, 1368, 768, 11647, 216, 72, 23, 1, 144, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, - /* 1440 x 900 [16:10] */ + /* 1440 x 900 [16:10] */ {NULL, 60, 1440, 900, 9392, 232, 80, 28, 1, 152, 3, FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, @@ -411,11 +411,11 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg) if (mesg.event & PM_EVENT_SLEEP) { info = share->fbinfo[0]; if (info) - /* 1 means do suspend*/ + /* 1 means do suspend */ fb_set_suspend(info, 1); info = share->fbinfo[1]; if (info) - /* 1 means do suspend*/ + /* 1 means do suspend */ fb_set_suspend(info, 1); ret = pci_save_state(pdev); @@ -424,7 +424,7 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg) return ret; } - /* set chip to sleep mode*/ + /* set chip to sleep mode */ if (share->suspend) (*share->suspend)(share); @@ -580,7 +580,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i break; } var->height = var->width = -1; - var->accel_flags = 0;/*FB_ACCELF_TEXT;*/ + var->accel_flags = 0;/* FB_ACCELF_TEXT; */ /* check if current fb's video memory big enought to hold the onscreen */ request = var->xres_virtual * (var->bits_per_pixel >> 3); @@ -615,7 +615,6 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, var = &info->var; ret = 0; - //pr_debug("regno=%d,red=%d,green=%d,blue=%d\n",regno,red,green,blue); if (regno > 256) { pr_err("regno = %d\n", regno); return -EINVAL; @@ -688,7 +687,6 @@ static int sm750fb_set_drv(struct lynxfb_par *par) crtc->proc_panDisplay = hw_sm750_pan_display; crtc->clear = hw_sm750_crtc_clear; crtc->line_pad = 16; - //crtc->xpanstep = crtc->ypanstep = crtc->ywrapstep = 0; crtc->xpanstep = 8; crtc->ypanstep = 1; crtc->ywrapstep = 0; @@ -723,7 +721,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par) } else { output->paths = sm750_crt; crtc->channel = sm750_secondary; - /* not consider of padding stuffs for oScreen,need fix*/ + /* not consider of padding stuffs for oScreen,need fix */ crtc->oScreen = (share->vidmem_size >> 1); crtc->vScreen = share->pvMem + crtc->oScreen; } @@ -737,7 +735,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par) } else { output->paths = sm750_crt; crtc->channel = sm750_primary; - /* not consider of padding stuffs for oScreen,need fix*/ + /* not consider of padding stuffs for oScreen,need fix */ crtc->oScreen = (share->vidmem_size >> 1); crtc->vScreen = share->pvMem + crtc->oScreen; } @@ -863,7 +861,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) break; } else if (ret == 3) { pr_warn("wanna use default mode\n"); - // break; + /*break;*/ } else if (ret == 4) { pr_warn("fall back to any valid mode\n"); } else { @@ -956,7 +954,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) exit: lynxfb_ops_check_var(var, info); - // lynxfb_ops_set_par(info); return ret; } @@ -984,7 +981,7 @@ static void sm750fb_setup(struct lynx_share *share, char *src) spec_share->state.initParm.setAllEngOff = 0; spec_share->state.initParm.resetMemory = 1; - /*defaultly turn g_hwcursor on for both view */ + /* defaultly turn g_hwcursor on for both view */ g_hwcursor = 3; if (!src || !*src) { @@ -1030,7 +1027,7 @@ static void sm750fb_setup(struct lynx_share *share, char *src) } #ifdef CAP_EXPANSION if (getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) { - /* seems exp_res is not valid*/ + /* seems exp_res is not valid */ spec_share->state.xLCD = spec_share->state.yLCD = 0; } #endif @@ -1051,7 +1048,7 @@ NO_PARAM: } else { /* SM750LE only have one crt channel */ spec_share->state.dataflow = sm750_simul_sec; - /* sm750le do not have complex attributes*/ + /* sm750le do not have complex attributes */ spec_share->state.nocrt = 0; } } @@ -1176,7 +1173,7 @@ ALLOC_FB: goto err_info1_set; } - /* register frame buffer*/ + /* register frame buffer */ pr_info("Ready to register framebuffer #%d.\n", fbidx); errno = register_framebuffer(info[fbidx]); if (errno < 0) { @@ -1230,17 +1227,16 @@ static void __exit lynxfb_pci_remove(struct pci_dev *pdev) par = info->par; unregister_framebuffer(info); - /* clean crtc & output allocations*/ + /* clean crtc & output allocations */ par->crtc.clear(&par->crtc); par->output.clear(&par->output); - /* release frame buffer*/ + /* release frame buffer */ framebuffer_release(info); } #ifdef CONFIG_MTRR if (share->mtrr.vram_added) mtrr_del(share->mtrr.vram, share->vidmem_start, share->vidmem_size); #endif - // pci_release_regions(pdev); iounmap(share->pvReg); iounmap(share->pvMem); -- cgit v1.2.3 From 3318bb5e945f7007842fef4b6c69e559bc6a0e79 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:26:23 +0100 Subject: staging: sm750: 80 characters per line This patch inserts line breaks to make lines fit into 80 characters and increase readability. Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 110 ++++++++++++++++++++++++++-------------- 1 file changed, 72 insertions(+), 38 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 2f8a6b232774..92668112fdeb 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -60,54 +60,66 @@ static char *g_option = NULL; static const struct fb_videomode lynx750_ext[] = { /* 1024x600-60 VESA [1.71:1] */ {NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 1024x600-70 VESA */ {NULL, 70, 1024, 600, 17211, 152, 48, 21, 1, 104, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 1024x600-75 VESA */ {NULL, 75, 1024, 600, 15822, 160, 56, 23, 1, 104, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 1024x600-85 VESA */ {NULL, 85, 1024, 600, 13730, 168, 56, 26, 1, 112, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 720x480 */ {NULL, 60, 720, 480, 37427, 88, 16, 13, 1, 72, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 1280x720 [1.78:1] */ {NULL, 60, 1280, 720, 13426, 162, 86, 22, 1, 136, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 1280x768@60 */ {NULL, 60, 1280, 768, 12579, 192, 64, 20, 3, 128, 7, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, {NULL, 60, 1360, 768, 11804, 208, 64, 23, 1, 144, 3, FB_SYNC_HOR_HIGH_ACT|FB_VMODE_NONINTERLACED}, /* 1360 x 768 [1.77083:1] */ {NULL, 60, 1360, 768, 11804, 208, 64, 23, 1, 144, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 1368 x 768 [1.78:1] */ {NULL, 60, 1368, 768, 11647, 216, 72, 23, 1, 144, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 1440 x 900 [16:10] */ {NULL, 60, 1440, 900, 9392, 232, 80, 28, 1, 152, 3, - FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 1440x960 [15:10] */ {NULL, 60, 1440, 960, 8733, 240, 88, 30, 1, 152, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, /* 1920x1080 [16:9] */ {NULL, 60, 1920, 1080, 6734, 148, 88, 41, 1, 44, 3, - FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED}, + FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED}, }; @@ -132,12 +144,14 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) cursor->disable(cursor); if (fbcursor->set & FB_CUR_SETSIZE) - cursor->setSize(cursor, fbcursor->image.width, fbcursor->image.height); + cursor->setSize(cursor, + fbcursor->image.width, + fbcursor->image.height); - if (fbcursor->set & FB_CUR_SETPOS) { - cursor->setPos(cursor, fbcursor->image.dx - info->var.xoffset, + if (fbcursor->set & FB_CUR_SETPOS) + cursor->setPos(cursor, + fbcursor->image.dx - info->var.xoffset, fbcursor->image.dy - info->var.yoffset); - } if (fbcursor->set & FB_CUR_SETCMAP) { /* get the 16bit color of kernel means */ @@ -167,7 +181,8 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) return 0; } -static void lynxfb_ops_fillrect(struct fb_info *info, const struct fb_fillrect *region) +static void lynxfb_ops_fillrect(struct fb_info *info, + const struct fb_fillrect *region) { struct lynxfb_par *par; struct lynx_share *share; @@ -205,7 +220,8 @@ static void lynxfb_ops_fillrect(struct fb_info *info, const struct fb_fillrect * spin_unlock(&share->slock); } -static void lynxfb_ops_copyarea(struct fb_info *info, const struct fb_copyarea *region) +static void lynxfb_ops_copyarea(struct fb_info *info, + const struct fb_copyarea *region) { struct lynxfb_par *par; struct lynx_share *share; @@ -235,7 +251,8 @@ static void lynxfb_ops_copyarea(struct fb_info *info, const struct fb_copyarea * spin_unlock(&share->slock); } -static void lynxfb_ops_imageblit(struct fb_info *info, const struct fb_image *image) +static void lynxfb_ops_imageblit(struct fb_info *info, + const struct fb_image *image) { unsigned int base, pitch, Bpp; unsigned int fgcol, bgcol; @@ -381,7 +398,8 @@ static int lynxfb_ops_set_par(struct fb_info *info) return ret; } -static inline unsigned int chan_to_field(unsigned int chan, struct fb_bitfield *bf) +static inline unsigned int chan_to_field(unsigned int chan, + struct fb_bitfield *bf) { chan &= 0xffff; chan >>= 16 - bf->length; @@ -508,7 +526,8 @@ static int lynxfb_resume(struct pci_dev *pdev) } #endif -static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *info) +static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, + struct fb_info *info) { struct lynxfb_par *par; struct lynxfb_crtc *crtc; @@ -582,7 +601,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i var->height = var->width = -1; var->accel_flags = 0;/* FB_ACCELF_TEXT; */ - /* check if current fb's video memory big enought to hold the onscreen */ + /* check if current fb's video memory big enought to hold the onscreen*/ request = var->xres_virtual * (var->bits_per_pixel >> 3); /* defaulty crtc->channel go with par->index */ @@ -623,7 +642,8 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, if (info->var.grayscale) red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; - if (var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { + if (var->bits_per_pixel == 8 && + info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { red >>= 8; green >>= 8; blue >>= 8; @@ -865,22 +885,30 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) } else if (ret == 4) { pr_warn("fall back to any valid mode\n"); } else { - pr_warn("ret = %d,fb_find_mode failed,with %s\n", ret, mdb_desc[i]); + pr_warn("ret = %d,fb_find_mode failed,with %s\n", + ret, + mdb_desc[i]); } } /* some member of info->var had been set by fb_find_mode */ pr_info("Member of info->var is :\n\ - xres=%d\n\ - yres=%d\n\ - xres_virtual=%d\n\ - yres_virtual=%d\n\ - xoffset=%d\n\ - yoffset=%d\n\ - bits_per_pixel=%d\n \ - ...\n", var->xres, var->yres, var->xres_virtual, var->yres_virtual, - var->xoffset, var->yoffset, var->bits_per_pixel); + xres=%d\n\ + yres=%d\n\ + xres_virtual=%d\n\ + yres_virtual=%d\n\ + xoffset=%d\n\ + yoffset=%d\n\ + bits_per_pixel=%d\n \ + ...\n", + var->xres, + var->yres, + var->xres_virtual, + var->yres_virtual, + var->xoffset, + var->yoffset, + var->bits_per_pixel); /* set par */ par->info = info; @@ -1026,7 +1054,9 @@ static void sm750fb_setup(struct lynx_share *share, char *src) } } #ifdef CAP_EXPANSION - if (getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) { + if (getExpRes(exp_res, + &spec_share->state.xLCD, + &spec_share->state.yLCD)) { /* seems exp_res is not valid */ spec_share->state.xLCD = spec_share->state.yLCD = 0; } @@ -1100,8 +1130,8 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, if (!share->accel_off) { /* hook deInit and 2d routines, notes that below hw_xxx * routine can work on most of lynx chips - * if some chip need specific function,please hook it in smXXX_set_drv - * routine */ + * if some chip need specific function, + * please hook it in smXXX_set_drv routine */ share->accel.de_init = hw_de_init; share->accel.de_fillrect = hw_fillrect; share->accel.de_copyarea = hw_copyarea; @@ -1177,7 +1207,9 @@ ALLOC_FB: pr_info("Ready to register framebuffer #%d.\n", fbidx); errno = register_framebuffer(info[fbidx]); if (errno < 0) { - pr_err("Failed to register fb_info #%d. err %d\n", fbidx, errno); + pr_err("Failed to register fb_info #%d. err %d\n", + fbidx, + errno); if (fbidx == 0) goto err_register0; else @@ -1235,7 +1267,9 @@ static void __exit lynxfb_pci_remove(struct pci_dev *pdev) } #ifdef CONFIG_MTRR if (share->mtrr.vram_added) - mtrr_del(share->mtrr.vram, share->vidmem_start, share->vidmem_size); + mtrr_del(share->mtrr.vram, + share->vidmem_start, + share->vidmem_size); #endif iounmap(share->pvReg); -- cgit v1.2.3 From 876e5a701f17e447ca6a828b9eda320f1cd835d7 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:26:37 +0100 Subject: staging: sm750: blank line after declaration This patch fixes "WARNING: Missing a blank line after declaration" checkpatch.pl warnings. Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 92668112fdeb..832a4a1782d9 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -156,6 +156,7 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor) if (fbcursor->set & FB_CUR_SETCMAP) { /* get the 16bit color of kernel means */ u16 fg, bg; + fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800))| ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5)| ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11); @@ -269,7 +270,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info, if (image->depth == 1) { if (info->fix.visual == FB_VISUAL_TRUECOLOR || - info->fix.visual == FB_VISUAL_DIRECTCOLOR) { + info->fix.visual == FB_VISUAL_DIRECTCOLOR) { fgcol = ((u32*)info->pseudo_palette)[image->fg_color]; bgcol = ((u32*)info->pseudo_palette)[image->bg_color]; } else { @@ -620,9 +621,12 @@ exit: } -static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, - unsigned green, unsigned blue, - unsigned transp, struct fb_info *info) +static int lynxfb_ops_setcolreg(unsigned regno, + unsigned red, + unsigned green, + unsigned blue, + unsigned transp, + struct fb_info *info) { struct lynxfb_par *par; struct lynxfb_crtc *crtc; @@ -654,9 +658,10 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red, if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256) { u32 val; + if (var->bits_per_pixel == 16 || - var->bits_per_pixel == 32 || - var->bits_per_pixel == 24) { + var->bits_per_pixel == 32 || + var->bits_per_pixel == 24) { val = chan_to_field(red, &var->red); val |= chan_to_field(green, &var->green); val |= chan_to_field(blue, &var->blue); @@ -1189,6 +1194,7 @@ ALLOC_FB: } else { struct lynxfb_par *par; int errno; + pr_info("framebuffer #%d alloc okay\n", fbidx); share->fbinfo[fbidx] = info[fbidx]; par = info[fbidx]->par; @@ -1208,8 +1214,8 @@ ALLOC_FB: errno = register_framebuffer(info[fbidx]); if (errno < 0) { pr_err("Failed to register fb_info #%d. err %d\n", - fbidx, - errno); + fbidx, + errno); if (fbidx == 0) goto err_register0; else -- cgit v1.2.3 From a0c838f10a18982a02f1a46904637748d066a6b9 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:26:52 +0100 Subject: staging: sm750: fix whitespace This patch fixes whitespace checkpatch.pl warnings and errors. Mainly whitespaces around operators. - ERROR: spaces required around that ':' (ctx:VxW) - ERROR: space required after that ';' (ctx:VxV) - ERROR: spaces required around that '<' (ctx:VxV) - ERROR: spaces required around that '!=' (ctx:VxV) And some small warnings around whitespace: - ERROR: trailing whitespace - WARNING: space prohibited before semicolon - WARNING: unnecessary whitespace before a quoted newline Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 832a4a1782d9..edd7d1d7edb3 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -378,7 +378,7 @@ static int lynxfb_ops_set_par(struct fb_info *info) var->red.length = 8; var->green.offset = 8; var->green.length = 8; - var->blue.offset = 0 ; + var->blue.offset = 0; var->blue.length = 8; fix->visual = FB_VISUAL_TRUECOLOR; break; @@ -591,7 +591,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, var->red.length = 8; var->green.offset = 8; var->green.length = 8; - var->blue.offset = 0 ; + var->blue.offset = 0; var->blue.length = 8; info->fix.visual = FB_VISUAL_TRUECOLOR; break; @@ -722,7 +722,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par) output->proc_setBLANK = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_setBLANK:hw_sm750_setBLANK; output->clear = hw_sm750_output_clear; /* chip specific phase */ - share->accel.de_wait = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_deWait: hw_sm750_deWait; + share->accel.de_wait = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_deWait : hw_sm750_deWait; switch (spec_share->state.dataflow) { case sm750_simul_pri: output->paths = sm750_pnc; @@ -772,7 +772,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par) return ret; } -static struct fb_ops lynxfb_ops={ +static struct fb_ops lynxfb_ops = { .owner = THIS_MODULE, .fb_check_var = lynxfb_ops_check_var, .fb_set_par = lynxfb_ops_set_par, @@ -800,7 +800,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) lynx750_ext, NULL, vesa_modes, }; int cdb[] = {ARRAY_SIZE(lynx750_ext), 0, VESA_MODEDB_SIZE}; - static const char *mdb_desc[] ={ + static const char *mdb_desc[] = { "driver prepared modes", "kernel prepared default modedb", "kernel HELPERS prepared vesa_modes", @@ -869,7 +869,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) } - for (i=0;i<3;i++) { + for (i = 0; i < 3; i++) { ret = fb_find_mode(var, info, g_fbmode[index], pdb[i], cdb[i], NULL, 8); @@ -980,7 +980,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) goto exit; } - pr_debug("#2 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", + pr_debug("#2 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", info->cmap.start, info->cmap.len, info->cmap.red, info->cmap.green, info->cmap.blue, info->cmap.transp); @@ -1314,7 +1314,7 @@ static int __init lynxfb_setup(char *options) strsep() updates @options to pointer after the first found token it also returns the pointer ahead the token. */ - while ((opt = strsep(&options, ":"))!=NULL) { + while ((opt = strsep(&options, ":")) != NULL) { /* options that mean for any lynx chips are configured here */ if (!strncmp(opt, "noaccel", strlen("noaccel"))) g_noaccel = 1; @@ -1360,7 +1360,7 @@ static struct pci_driver lynxfb_driver = { static int __init lynxfb_init(void) { - char *option ; + char *option; int ret; #ifdef MODULE -- cgit v1.2.3 From eb1167a36cdb48ae6328132ad68bf1bdc29339cf Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:27:09 +0100 Subject: staging: sm750: fix whitspace for cast to pointer This patch fixes the checkpatch.pl warning: 'ERROR: "(foo*)" should be "(foo *)"' Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index edd7d1d7edb3..f300df4f8e87 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -202,7 +202,7 @@ static void lynxfb_ops_fillrect(struct fb_info *info, pitch = info->fix.line_length; Bpp = info->var.bits_per_pixel >> 3; - color = (Bpp == 1)?region->color:((u32*)info->pseudo_palette)[region->color]; + color = (Bpp == 1)?region->color:((u32 *)info->pseudo_palette)[region->color]; rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR:HW_ROP2_COPY; /* @@ -271,8 +271,8 @@ static void lynxfb_ops_imageblit(struct fb_info *info, if (image->depth == 1) { if (info->fix.visual == FB_VISUAL_TRUECOLOR || info->fix.visual == FB_VISUAL_DIRECTCOLOR) { - fgcol = ((u32*)info->pseudo_palette)[image->fg_color]; - bgcol = ((u32*)info->pseudo_palette)[image->bg_color]; + fgcol = ((u32 *)info->pseudo_palette)[image->fg_color]; + bgcol = ((u32 *)info->pseudo_palette)[image->bg_color]; } else { fgcol = image->fg_color; bgcol = image->bg_color; -- cgit v1.2.3 From 61c507cf652da1bc8436bdb909343f33175fd566 Mon Sep 17 00:00:00 2001 From: Michel von Czettritz Date: Thu, 26 Mar 2015 23:27:25 +0100 Subject: staging: sm750: move assignment out of if cond This patch moves the assignments from the if conditions to the line before the condition. The 3 occurrence are return values and the checks for errors. Signed-off-by: Michel von Czettritz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/sm750.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index f300df4f8e87..3c7ea95dd9f9 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -477,7 +477,8 @@ static int lynxfb_resume(struct pci_dev *pdev) console_lock(); - if ((ret = pci_set_power_state(pdev, PCI_D0)) != 0) { + ret = pci_set_power_state(pdev, PCI_D0); + if (ret) { pr_err("error:%d occured in pci_set_power_state\n", ret); return ret; } @@ -485,7 +486,8 @@ static int lynxfb_resume(struct pci_dev *pdev) if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) { pci_restore_state(pdev); - if ((ret = pci_enable_device(pdev)) != 0) { + ret = pci_enable_device(pdev); + if (ret) { pr_err("error:%d occured in pci_enable_device\n", ret); return ret; } @@ -975,7 +977,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) info->cmap.red, info->cmap.green, info->cmap.blue, info->cmap.transp); - if ((ret = fb_alloc_cmap(&info->cmap, 256, 0)) < 0) { + ret = fb_alloc_cmap(&info->cmap, 256, 0); + if (ret < 0) { pr_err("Could not allcate memory for cmap.\n"); goto exit; } -- cgit v1.2.3 From 6bdb610142fc0433077e24bb36f90e7c52bcaded Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 27 Mar 2015 15:26:09 +0530 Subject: staging: unisys: unregister chardev on error after registering the major numbers if the cdev_add fails then we were not releasing the major numbers. now we are doing that. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 39b19afa5169..5c5d35f10471 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -65,8 +65,10 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) return -1; } rc = cdev_add(&file_cdev, MKDEV(MAJOR(major_dev), 0), 1); - if (rc < 0) + if (rc < 0) { + unregister_chrdev_region(major_dev, 1); return -1; + } return 0; } -- cgit v1.2.3 From 2e71c9e42799ad5a7ece815a14cd8467eaa3be26 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 27 Mar 2015 15:26:10 +0530 Subject: staging: unisys: use error codes we were just returning -1 to the calling function which was again returning that if the module failed to load. Now we are returning the actual error codes. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/file.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 5c5d35f10471..8bea8a9f9edf 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -56,18 +56,20 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) cdev_init(&file_cdev, &visorchipset_fops); file_cdev.owner = THIS_MODULE; if (MAJOR(major_dev) == 0) { + rc = alloc_chrdev_region(&major_dev, 0, 1, MYDRVNAME); /* dynamic major device number registration required */ - if (alloc_chrdev_region(&major_dev, 0, 1, MYDRVNAME) < 0) - return -1; + if (rc < 0) + return rc; } else { /* static major device number registration required */ - if (register_chrdev_region(major_dev, 1, MYDRVNAME) < 0) - return -1; + rc = register_chrdev_region(major_dev, 1, MYDRVNAME); + if (rc < 0) + return rc; } rc = cdev_add(&file_cdev, MKDEV(MAJOR(major_dev), 0), 1); if (rc < 0) { unregister_chrdev_region(major_dev, 1); - return -1; + return rc; } return 0; } -- cgit v1.2.3 From 7f688833662dac4c48dcc18198a1a3a35fcbf0cd Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Fri, 27 Mar 2015 15:26:11 +0530 Subject: staging: unisys: remove forward declaration rearranged the functions to get rid of the forward declarations. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorchipset/file.c | 80 ++++++++++++++---------------- 1 file changed, 37 insertions(+), 43 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 8bea8a9f9edf..203de0b5f607 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -31,49 +31,6 @@ static struct cdev file_cdev; static struct visorchannel **file_controlvm_channel; -static int visorchipset_open(struct inode *inode, struct file *file); -static int visorchipset_release(struct inode *inode, struct file *file); -static int visorchipset_mmap(struct file *file, struct vm_area_struct *vma); -static long visorchipset_ioctl(struct file *file, unsigned int cmd, - unsigned long arg); - -static const struct file_operations visorchipset_fops = { - .owner = THIS_MODULE, - .open = visorchipset_open, - .read = NULL, - .write = NULL, - .unlocked_ioctl = visorchipset_ioctl, - .release = visorchipset_release, - .mmap = visorchipset_mmap, -}; - -int -visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) -{ - int rc = 0; - - file_controlvm_channel = controlvm_channel; - cdev_init(&file_cdev, &visorchipset_fops); - file_cdev.owner = THIS_MODULE; - if (MAJOR(major_dev) == 0) { - rc = alloc_chrdev_region(&major_dev, 0, 1, MYDRVNAME); - /* dynamic major device number registration required */ - if (rc < 0) - return rc; - } else { - /* static major device number registration required */ - rc = register_chrdev_region(major_dev, 1, MYDRVNAME); - if (rc < 0) - return rc; - } - rc = cdev_add(&file_cdev, MKDEV(MAJOR(major_dev), 0), 1); - if (rc < 0) { - unregister_chrdev_region(major_dev, 1); - return rc; - } - return 0; -} - void visorchipset_file_cleanup(dev_t major_dev) { @@ -164,3 +121,40 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd, return -EFAULT; } } + +static const struct file_operations visorchipset_fops = { + .owner = THIS_MODULE, + .open = visorchipset_open, + .read = NULL, + .write = NULL, + .unlocked_ioctl = visorchipset_ioctl, + .release = visorchipset_release, + .mmap = visorchipset_mmap, +}; + +int +visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) +{ + int rc = 0; + + file_controlvm_channel = controlvm_channel; + cdev_init(&file_cdev, &visorchipset_fops); + file_cdev.owner = THIS_MODULE; + if (MAJOR(major_dev) == 0) { + rc = alloc_chrdev_region(&major_dev, 0, 1, MYDRVNAME); + /* dynamic major device number registration required */ + if (rc < 0) + return rc; + } else { + /* static major device number registration required */ + rc = register_chrdev_region(major_dev, 1, MYDRVNAME); + if (rc < 0) + return rc; + } + rc = cdev_add(&file_cdev, MKDEV(MAJOR(major_dev), 0), 1); + if (rc < 0) { + unregister_chrdev_region(major_dev, 1); + return rc; + } + return 0; +} -- cgit v1.2.3 From 63b8ebe44ab6bc812f849818250e49e9157c309c Mon Sep 17 00:00:00 2001 From: Shirish Gajera Date: Sat, 28 Mar 2015 13:21:39 -0700 Subject: staging: speakup: Fix warning of line over 80 characters. This patch fixes the checkpatch.pl warning: WARNING: line over 80 characters All line over 80 characters in driver/staging/speakup/* are fixed. Signed-off-by: Shirish Gajera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/main.c | 9 ++++++--- drivers/staging/speakup/serialio.h | 3 ++- drivers/staging/speakup/speakup.h | 6 ++++-- drivers/staging/speakup/speakup_decext.c | 6 ++++-- drivers/staging/speakup/speakup_decpc.c | 6 ++++-- drivers/staging/speakup/spk_types.h | 3 ++- 6 files changed, 22 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index 1249f910aed1..c955976414ee 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -423,7 +423,8 @@ static void announce_edge(struct vc_data *vc, int msg_id) if (spk_bleeps & 1) bleep(spk_y); if ((spk_bleeps & 2) && (msg_id < edge_quiet)) - synth_printf("%s\n", spk_msg_get(MSG_EDGE_MSGS_START + msg_id - 1)); + synth_printf("%s\n", + spk_msg_get(MSG_EDGE_MSGS_START + msg_id - 1)); } static void speak_char(u_char ch) @@ -1131,7 +1132,8 @@ static void spkup_write(const char *in_buf, int count) if (in_count > 2 && rep_count > 2) { if (last_type & CH_RPT) { synth_printf(" "); - synth_printf(spk_msg_get(MSG_REPEAT_DESC2), ++rep_count); + synth_printf(spk_msg_get(MSG_REPEAT_DESC2), + ++rep_count); synth_printf(" "); } rep_count = 0; @@ -1847,7 +1849,8 @@ static void speakup_win_set(struct vc_data *vc) win_right = spk_x; } snprintf(info, sizeof(info), spk_msg_get(MSG_WINDOW_BOUNDARY), - (win_start) ? spk_msg_get(MSG_END) : spk_msg_get(MSG_START), + (win_start) ? + spk_msg_get(MSG_END) : spk_msg_get(MSG_START), (int)spk_y + 1, (int)spk_x + 1); } synth_printf("%s\n", info); diff --git a/drivers/staging/speakup/serialio.h b/drivers/staging/speakup/serialio.h index 317bb8432a04..1b399214ecf7 100644 --- a/drivers/staging/speakup/serialio.h +++ b/drivers/staging/speakup/serialio.h @@ -34,6 +34,7 @@ struct old_serial_port { #define SPK_TIMEOUT 100 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) -#define spk_serial_tx_busy() ((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY) +#define spk_serial_tx_busy() \ + ((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY) #endif diff --git a/drivers/staging/speakup/speakup.h b/drivers/staging/speakup/speakup.h index 898dce5e1243..a7f4962427f3 100644 --- a/drivers/staging/speakup/speakup.h +++ b/drivers/staging/speakup/speakup.h @@ -61,10 +61,12 @@ extern struct st_var_header *spk_get_var_header(enum var_id_t var_id); extern struct st_var_header *spk_var_header_by_name(const char *name); extern struct punc_var_t *spk_get_punc_var(enum var_id_t var_id); extern int spk_set_num_var(int val, struct st_var_header *var, int how); -extern int spk_set_string_var(const char *page, struct st_var_header *var, int len); +extern int spk_set_string_var(const char *page, struct st_var_header *var, + int len); extern int spk_set_mask_bits(const char *input, const int which, const int how); extern special_func spk_special_handler; -extern int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key); +extern int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, + u_short key); extern int synth_init(char *name); extern void synth_release(void); diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c index 2b772f8522f1..e0b5db9bb46e 100644 --- a/drivers/staging/speakup/speakup_decext.c +++ b/drivers/staging/speakup/speakup_decext.c @@ -207,10 +207,12 @@ static void do_catch_up(struct spk_synth *synth) if (time_after_eq(jiffies, jiff_max)) { if (!in_escape) spk_serial_out(PROCSPEECH); - spin_lock_irqsave(&speakup_info.spinlock, flags); + spin_lock_irqsave(&speakup_info.spinlock, + flags); jiffy_delta_val = jiffy_delta->u.n.value; delay_time_val = delay_time->u.n.value; - spin_unlock_irqrestore(&speakup_info.spinlock, flags); + spin_unlock_irqrestore(&speakup_info.spinlock, + flags); schedule_timeout(msecs_to_jiffies (delay_time_val)); jiff_max = jiffies + jiffy_delta_val; diff --git a/drivers/staging/speakup/speakup_decpc.c b/drivers/staging/speakup/speakup_decpc.c index f7b9c8a3a1a5..437e13a85943 100644 --- a/drivers/staging/speakup/speakup_decpc.c +++ b/drivers/staging/speakup/speakup_decpc.c @@ -423,10 +423,12 @@ static void do_catch_up(struct spk_synth *synth) if (time_after_eq(jiffies, jiff_max)) { if (!in_escape) dt_sendchar(PROCSPEECH); - spin_lock_irqsave(&speakup_info.spinlock, flags); + spin_lock_irqsave(&speakup_info.spinlock, + flags); jiffy_delta_val = jiffy_delta->u.n.value; delay_time_val = delay_time->u.n.value; - spin_unlock_irqrestore(&speakup_info.spinlock, flags); + spin_unlock_irqrestore(&speakup_info.spinlock, + flags); schedule_timeout(msecs_to_jiffies (delay_time_val)); jiff_max = jiffies + jiffy_delta_val; diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h index 55d6c9b3b472..e8ff5d7d6419 100644 --- a/drivers/staging/speakup/spk_types.h +++ b/drivers/staging/speakup/spk_types.h @@ -168,7 +168,8 @@ struct spk_synth { int *default_vol; int (*probe)(struct spk_synth *synth); void (*release)(void); - const char *(*synth_immediate)(struct spk_synth *synth, const char *buff); + const char *(*synth_immediate)(struct spk_synth *synth, + const char *buff); void (*catch_up)(struct spk_synth *synth); void (*flush)(struct spk_synth *synth); int (*is_alive)(struct spk_synth *synth); -- cgit v1.2.3 From f30a746bec5507d9781e876626d4bba7f5ab0c8e Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Sat, 28 Mar 2015 14:33:40 +0530 Subject: staging: sm7xxfb: reserve PCI resource before starting to access any address inside the PCI region we should reserve the resource and release the resource when the module exits. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xxfb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 5b3e6143a0ba..149286efda5d 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -776,6 +776,12 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, if (err) return err; + err = pci_request_region(pdev, 0, "sm7xxfb"); + if (err < 0) { + dev_err(&pdev->dev, "cannot reserve framebuffer region\n"); + goto failed_regions; + } + sprintf(smtcfb_fix.id, "sm%Xfb", ent->device); sfb = smtc_alloc_fb_info(pdev); @@ -905,6 +911,9 @@ failed_fb: smtc_free_fb_info(sfb); failed_free: + pci_release_region(pdev, 0); + +failed_regions: pci_disable_device(pdev); return err; @@ -933,6 +942,7 @@ static void smtcfb_pci_remove(struct pci_dev *pdev) smtc_unmap_mmio(sfb); unregister_framebuffer(&sfb->fb); smtc_free_fb_info(sfb); + pci_release_region(pdev, 0); } #ifdef CONFIG_PM -- cgit v1.2.3 From 77371fbd440f482bc6f092d8a33d141f45dc3b70 Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Fri, 27 Mar 2015 16:01:04 -0500 Subject: staging: fsl-mc: Name MC object devices using decimal numbers MC object devices were being named using hexadecimaal numbers. This was not consistent with the object naming conventions used by MC DPLs and the MC restool. Signed-off-by: J. German Rivera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/mc-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index b4e90221a802..de15fa9b4ba7 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -333,7 +333,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc, device_initialize(&mc_dev->dev); mc_dev->dev.parent = parent_dev; mc_dev->dev.bus = &fsl_mc_bus_type; - dev_set_name(&mc_dev->dev, "%s.%x", obj_desc->type, obj_desc->id); + dev_set_name(&mc_dev->dev, "%s.%d", obj_desc->type, obj_desc->id); if (strcmp(obj_desc->type, "dprc") == 0) { struct fsl_mc_io *mc_io2; -- cgit v1.2.3 From f83e775d6ef55ea4edbe2740b8a56a94f97158b5 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Sat, 28 Mar 2015 14:33:41 +0530 Subject: staging: sm7xxfb: disable pci device disable the pci device when the module exits. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm7xxfb/sm7xxfb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 149286efda5d..77f51a075004 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -943,6 +943,7 @@ static void smtcfb_pci_remove(struct pci_dev *pdev) unregister_framebuffer(&sfb->fb); smtc_free_fb_info(sfb); pci_release_region(pdev, 0); + pci_disable_device(pdev); } #ifdef CONFIG_PM -- cgit v1.2.3 From 0b528775948d9224c0eb26ed1c0fab973e6b2502 Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Fri, 27 Mar 2015 16:01:05 -0500 Subject: staging: fsl-mc: Removed reordering of MC objects during bus scan MC objects discovered during an MC bus scan were being reordered to ensure that all allocatable objects are probed before all non-allocatable objects. However, this is not necessary, as drivers of non-allocatable objects, that allocate allocatable objects in their probe function, can return -EPROBE_DEFER if such allocations fail. Signed-off-by: J. German Rivera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 65de1d758a56..f02e5e4d23a5 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -205,36 +205,6 @@ static void dprc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev) dprc_cleanup_resource_pool(mc_bus_dev, pool_type); } -static void reorder_obj_desc_array(struct dprc_obj_desc *obj_desc_array, - int num_devs) -{ - struct dprc_obj_desc tmp; - struct dprc_obj_desc *top_cursor = &obj_desc_array[0]; - struct dprc_obj_desc *bottom_cursor = &obj_desc_array[num_devs - 1]; - - /* - * Reorder entries in obj_desc_array so that all allocatable devices - * are placed before all non-allocatable devices: - * - * Loop Invariant: everything before top_cursor is allocatable and - * everything after bottom_cursor is non-allocatable. - */ - while (top_cursor < bottom_cursor) { - if (FSL_MC_IS_ALLOCATABLE(top_cursor->type)) { - top_cursor++; - } else { - if (FSL_MC_IS_ALLOCATABLE(bottom_cursor->type)) { - tmp = *bottom_cursor; - *bottom_cursor = *top_cursor; - *top_cursor = tmp; - top_cursor++; - } - - bottom_cursor--; - } - } -} - /** * dprc_scan_objects - Discover objects in a DPRC * @@ -313,8 +283,6 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev) "%d out of %d devices could not be retrieved\n", dprc_get_obj_failures, num_child_objects); } - - reorder_obj_desc_array(child_obj_desc_array, num_child_objects); } dprc_remove_devices(mc_bus_dev, child_obj_desc_array, -- cgit v1.2.3 From 1663e80982eef51892576cb2e3d4978af787ca4d Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Fri, 27 Mar 2015 16:01:06 -0500 Subject: staging: fsl-mc: Bind/unbind driver when MC object is plugged/unplugged Signed-off-by: J. German Rivera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 39 +++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index f02e5e4d23a5..9568eeac75b0 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -111,6 +111,41 @@ static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc return dev ? to_fsl_mc_device(dev) : NULL; } +/** + * check_plugged_state_change - Check change in an MC object's plugged state + * + * @mc_dev: pointer to the fsl-mc device for a given MC object + * @obj_desc: pointer to the MC object's descriptor in the MC + * + * If the plugged state has changed from unplugged to plugged, the fsl-mc + * device is bound to the corresponding device driver. + * If the plugged state has changed from plugged to unplugged, the fsl-mc + * device is unbound from the corresponding device driver. + */ +static void check_plugged_state_change(struct fsl_mc_device *mc_dev, + struct dprc_obj_desc *obj_desc) +{ + int error; + uint32_t plugged_flag_at_mc = + (obj_desc->state & DPRC_OBJ_STATE_PLUGGED); + + if (plugged_flag_at_mc != + (mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED)) { + if (plugged_flag_at_mc) { + mc_dev->obj_desc.state |= DPRC_OBJ_STATE_PLUGGED; + error = device_attach(&mc_dev->dev); + if (error < 0) { + dev_err(&mc_dev->dev, + "device_attach() failed: %d\n", + error); + } + } else { + mc_dev->obj_desc.state &= ~DPRC_OBJ_STATE_PLUGGED; + device_release_driver(&mc_dev->dev); + } + } +} + /** * dprc_add_new_devices - Adds devices to the logical bus for a DPRC * @@ -142,8 +177,10 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, * Check if device is already known to Linux: */ child_dev = fsl_mc_device_lookup(obj_desc, mc_bus_dev); - if (child_dev) + if (child_dev) { + check_plugged_state_change(child_dev, obj_desc); continue; + } error = fsl_mc_device_add(obj_desc, mc_io, &mc_bus_dev->dev, &child_dev); -- cgit v1.2.3 From 2bdc55d94fef59296f9f1aeda2a503d4c64cad86 Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Fri, 27 Mar 2015 16:01:07 -0500 Subject: staging: fsl-mc: Fix crash in fsl_mc_device_remove() Only call fsl_mc_io_destroy() if the DPRC being removed actually had an mc_io object associated with. Child DPRCs that have not been bound to the DPRC driver or the VFIO driver will not have an mc_io associated with them. Signed-off-by: J. German Rivera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/dprc-driver.c | 9 ++------- drivers/staging/fsl-mc/bus/mc-bus.c | 9 +++++---- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 9568eeac75b0..35c06cff1a06 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -167,7 +167,6 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, for (i = 0; i < num_child_objects_in_mc; i++) { struct fsl_mc_device *child_dev; - struct fsl_mc_io *mc_io = NULL; struct dprc_obj_desc *obj_desc = &obj_desc_array[i]; if (strlen(obj_desc->type) == 0) @@ -182,14 +181,10 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, continue; } - error = fsl_mc_device_add(obj_desc, mc_io, &mc_bus_dev->dev, + error = fsl_mc_device_add(obj_desc, NULL, &mc_bus_dev->dev, &child_dev); - if (error < 0) { - if (mc_io) - fsl_destroy_mc_io(mc_io); - + if (error < 0) continue; - } } } diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index de15fa9b4ba7..d943d99ba992 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -444,15 +444,16 @@ void fsl_mc_device_remove(struct fsl_mc_device *mc_dev) put_device(&mc_dev->dev); if (strcmp(mc_dev->obj_desc.type, "dprc") == 0) { - struct fsl_mc_io *mc_io = mc_dev->mc_io; - mc_bus = to_fsl_mc_bus(mc_dev); - fsl_destroy_mc_io(mc_io); + if (mc_dev->mc_io) { + fsl_destroy_mc_io(mc_dev->mc_io); + mc_dev->mc_io = NULL; + } + if (&mc_dev->dev == fsl_mc_bus_type.dev_root) fsl_mc_bus_type.dev_root = NULL; } - mc_dev->mc_io = NULL; if (mc_bus) devm_kfree(mc_dev->dev.parent, mc_bus); else -- cgit v1.2.3 From e91ffa9ec18e79214eef9bafc400f5d3b8d4aa98 Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Fri, 27 Mar 2015 16:01:08 -0500 Subject: staging: fsl-mc: Refactored fsl_mc_object_allocator driver init/exit The fsl_mc_allocator driver does not need to be its own module as it is tightly integrated into the MC bus main driver. It is really just a sub-component of the MC bus driver. By not making fsl_mc_allocator its own module, we can have more control of when its initialization happens and we want it to happen before any driver that depends on the MC bus driver gets initialized. Signed-off-by: J. German Rivera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/Makefile | 12 +++++------- drivers/staging/fsl-mc/bus/mc-allocator.c | 12 ++++++++---- drivers/staging/fsl-mc/bus/mc-bus.c | 8 ++++++++ drivers/staging/fsl-mc/include/mc-private.h | 4 ++++ 4 files changed, 25 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/Makefile b/drivers/staging/fsl-mc/bus/Makefile index bd09fc8cf650..25433a998478 100644 --- a/drivers/staging/fsl-mc/bus/Makefile +++ b/drivers/staging/fsl-mc/bus/Makefile @@ -5,15 +5,13 @@ # # This file is released under the GPLv2 # -obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o \ - mc-allocator-driver.o +obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o mc-bus-driver-objs := mc-bus.o \ mc-sys.o \ dprc.o \ dpmng.o \ - dprc-driver.o - -mc-allocator-driver-objs := mc-allocator.o \ - dpmcp.o \ - dpbp.o + dprc-driver.o \ + mc-allocator.o \ + dpmcp.o \ + dpbp.o diff --git a/drivers/staging/fsl-mc/bus/mc-allocator.c b/drivers/staging/fsl-mc/bus/mc-allocator.c index cc4a7d316990..e36235ddbe3e 100644 --- a/drivers/staging/fsl-mc/bus/mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/mc-allocator.c @@ -562,8 +562,12 @@ static struct fsl_mc_driver fsl_mc_allocator_driver = { .remove = fsl_mc_allocator_remove, }; -module_fsl_mc_driver(fsl_mc_allocator_driver); +int __init fsl_mc_allocator_driver_init(void) +{ + return fsl_mc_driver_register(&fsl_mc_allocator_driver); +} -MODULE_AUTHOR("Freescale Semiconductor Inc."); -MODULE_DESCRIPTION("Freescale's MC object device allocator"); -MODULE_LICENSE("GPL"); +void __exit fsl_mc_allocator_driver_exit(void) +{ + fsl_mc_driver_unregister(&fsl_mc_allocator_driver); +} diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index d943d99ba992..b347db927484 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -730,8 +730,15 @@ static int __init fsl_mc_bus_driver_init(void) if (error < 0) goto error_cleanup_driver; + error = fsl_mc_allocator_driver_init(); + if (error < 0) + goto error_cleanup_dprc_driver; + return 0; +error_cleanup_dprc_driver: + dprc_driver_exit(); + error_cleanup_driver: platform_driver_unregister(&fsl_mc_bus_driver); @@ -750,6 +757,7 @@ static void __exit fsl_mc_bus_driver_exit(void) if (WARN_ON(!mc_dev_cache)) return; + fsl_mc_allocator_driver_exit(); dprc_driver_exit(); platform_driver_unregister(&fsl_mc_bus_driver); bus_unregister(&fsl_mc_bus_type); diff --git a/drivers/staging/fsl-mc/include/mc-private.h b/drivers/staging/fsl-mc/include/mc-private.h index 8e67075f43b2..c045f49f227e 100644 --- a/drivers/staging/fsl-mc/include/mc-private.h +++ b/drivers/staging/fsl-mc/include/mc-private.h @@ -102,6 +102,10 @@ int __init dprc_driver_init(void); void __exit dprc_driver_exit(void); +int __init fsl_mc_allocator_driver_init(void); + +void __exit fsl_mc_allocator_driver_exit(void); + int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, enum fsl_mc_pool_type pool_type, struct fsl_mc_resource -- cgit v1.2.3 From 3b0a9b10378d25b9ecb11ed85a983a82d3b7799e Mon Sep 17 00:00:00 2001 From: "J. German Rivera" Date: Fri, 27 Mar 2015 16:01:09 -0500 Subject: staging: fsl-mc: Changed version matching rules for MC object drivers Before this change, we were requiring a complete version match (major and minor version numbers) between MC objects and corresponding drivers, to allow MC objects to be bound to their drivers. We realized that a mismatch in minor version numbers should be tolerated, as long as the major version numbers match. This allows the driver to decide what to do in the minor version mismatch case. For example, a driver may decide to run with downgraded functionality if the MC firmware object has older minor version number than the driver. Also, a driver with older minor version than the MC firmware object may decide to run even though it cannot use newer functionality of the MC object. As part of this change, the dpmng Flib version was also updated to match the latest MC firmware version. Signed-off-by: J. German Rivera Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fsl-mc/bus/mc-bus.c | 29 +++++++++++++++++++++++++---- drivers/staging/fsl-mc/include/dpmng.h | 2 +- 2 files changed, 26 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index b347db927484..23512d096427 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -36,6 +36,8 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv) struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(drv); bool found = false; + bool major_version_mismatch = false; + bool minor_version_mismatch = false; if (WARN_ON(!fsl_mc_bus_type.dev_root)) goto out; @@ -57,14 +59,33 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv) */ for (id = mc_drv->match_id_table; id->vendor != 0x0; id++) { if (id->vendor == mc_dev->obj_desc.vendor && - strcmp(id->obj_type, mc_dev->obj_desc.type) == 0 && - id->ver_major == mc_dev->obj_desc.ver_major && - id->ver_minor == mc_dev->obj_desc.ver_minor) { - found = true; + strcmp(id->obj_type, mc_dev->obj_desc.type) == 0) { + if (id->ver_major == mc_dev->obj_desc.ver_major) { + found = true; + if (id->ver_minor != mc_dev->obj_desc.ver_minor) + minor_version_mismatch = true; + } else { + major_version_mismatch = true; + } + break; } } + if (major_version_mismatch) { + dev_warn(dev, + "Major version mismatch: driver version %u.%u, MC object version %u.%u\n", + id->ver_major, id->ver_minor, + mc_dev->obj_desc.ver_major, + mc_dev->obj_desc.ver_minor); + } else if (minor_version_mismatch) { + dev_warn(dev, + "Minor version mismatch: driver version %u.%u, MC object version %u.%u\n", + id->ver_major, id->ver_minor, + mc_dev->obj_desc.ver_major, + mc_dev->obj_desc.ver_minor); + } + out: dev_dbg(dev, "%smatched\n", found ? "" : "not "); return found; diff --git a/drivers/staging/fsl-mc/include/dpmng.h b/drivers/staging/fsl-mc/include/dpmng.h index 0fc0a57490bb..1b052b830993 100644 --- a/drivers/staging/fsl-mc/include/dpmng.h +++ b/drivers/staging/fsl-mc/include/dpmng.h @@ -41,7 +41,7 @@ struct fsl_mc_io; /** * Management Complex firmware version information */ -#define MC_VER_MAJOR 5 +#define MC_VER_MAJOR 6 #define MC_VER_MINOR 0 /** -- cgit v1.2.3 From a227437e860d3b7d5584a14b60953992b0634f7f Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Mon, 30 Mar 2015 12:59:49 +0200 Subject: staging/olpc: drop pci dependencies This file does not use any pci APIs, drop pci header includes. Signed-off-by: Michael S. Tsirkin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/olpc_dcon/olpc_dcon.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c index bc7e664cc8a7..d115f5c0e341 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/drivers/staging/olpc_dcon/olpc_dcon.c @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include #include #include -- cgit v1.2.3 From a3d3390d1ee4a7e30cc48402c434eca82c16cb38 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sat, 28 Mar 2015 21:24:31 +0200 Subject: staging: octeon-usb: make cvmx_fifo_setup void Make cvmx_fifo_setup void, it does not return any value. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index feaaafc30976..ca8be66b65ab 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -608,7 +608,7 @@ static inline int cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe) return 0; /* Data0 */ } -static int cvmx_fifo_setup(struct cvmx_usb_state *usb) +static void cvmx_fifo_setup(struct cvmx_usb_state *usb) { union cvmx_usbcx_ghwcfg3 usbcx_ghwcfg3; union cvmx_usbcx_gnptxfsiz npsiz; -- cgit v1.2.3 From 9a02e8d211d54d2e8f6a3b22cff72f2a4b2933e1 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sat, 28 Mar 2015 21:24:32 +0200 Subject: staging: octeon-usb: octeon_usb_probe: delete unused variable "flags" is not used, delete it. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index ca8be66b65ab..731259703deb 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -3581,7 +3581,6 @@ static int octeon_usb_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct octeon_hcd *priv; struct usb_hcd *hcd; - unsigned long flags; u32 clock_rate = 48000000; bool is_crystal_clock = false; const char *clock_type; -- cgit v1.2.3 From 6068e81879c81f83b1e3dcaa02746b20be2af0c0 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sat, 28 Mar 2015 21:24:33 +0200 Subject: staging: octeon-usb: assume union type for FIELD32 macros Assume union type for FIELD32 macros to simplify usage. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 79 +++++++++++++++------------------ 1 file changed, 36 insertions(+), 43 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 731259703deb..3e89265d10d8 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -394,12 +394,13 @@ struct octeon_hcd { }; /* This macro spins on a field waiting for it to reach a value */ -#define CVMX_WAIT_FOR_FIELD32(address, type, field, op, value, timeout_usec)\ +#define CVMX_WAIT_FOR_FIELD32(address, _union, field, op, value, timeout_usec)\ ({int result; \ do { \ uint64_t done = cvmx_get_cycle() + (uint64_t)timeout_usec * \ octeon_get_clock_rate() / 1000000; \ - type c; \ + union _union c; \ + \ while (1) { \ c.u32 = cvmx_usb_read_csr32(usb, address); \ if (c.s.field op (value)) { \ @@ -418,9 +419,10 @@ struct octeon_hcd { * This macro logically sets a single field in a CSR. It does the sequence * read, modify, and write */ -#define USB_SET_FIELD32(address, type, field, value) \ +#define USB_SET_FIELD32(address, _union, field, value) \ do { \ - type c; \ + union _union c; \ + \ c.u32 = cvmx_usb_read_csr32(usb, address); \ c.s.field = value; \ cvmx_usb_write_csr32(usb, address, c.u32); \ @@ -621,9 +623,8 @@ static void cvmx_fifo_setup(struct cvmx_usb_state *usb) * Program the USBC_GRXFSIZ register to select the size of the receive * FIFO (25%). */ - USB_SET_FIELD32(CVMX_USBCX_GRXFSIZ(usb->index), - union cvmx_usbcx_grxfsiz, rxfdep, - usbcx_ghwcfg3.s.dfifodepth / 4); + USB_SET_FIELD32(CVMX_USBCX_GRXFSIZ(usb->index), cvmx_usbcx_grxfsiz, + rxfdep, usbcx_ghwcfg3.s.dfifodepth / 4); /* * Program the USBC_GNPTXFSIZ register to select the size and the start @@ -647,17 +648,15 @@ static void cvmx_fifo_setup(struct cvmx_usb_state *usb) /* Flush all FIFOs */ USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, txfnum, 0x10); + cvmx_usbcx_grstctl, txfnum, 0x10); USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, txfflsh, 1); + cvmx_usbcx_grstctl, txfflsh, 1); CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, - txfflsh, ==, 0, 100); + cvmx_usbcx_grstctl, txfflsh, ==, 0, 100); USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, rxfflsh, 1); + cvmx_usbcx_grstctl, rxfflsh, 1); CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - union cvmx_usbcx_grstctl, - rxfflsh, ==, 0, 100); + cvmx_usbcx_grstctl, rxfflsh, ==, 0, 100); } /** @@ -926,9 +925,9 @@ retry: * USBC_GINTMSK[PRTINT] = 1 */ USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), - union cvmx_usbcx_gintmsk, prtintmsk, 1); + cvmx_usbcx_gintmsk, prtintmsk, 1); USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), - union cvmx_usbcx_gintmsk, disconnintmsk, 1); + cvmx_usbcx_gintmsk, disconnintmsk, 1); /* * 2. Program the USBC_HCFG register to select full-speed host @@ -975,7 +974,7 @@ static void cvmx_usb_reset_port(struct cvmx_usb_state *usb) CVMX_USBCX_HPRT(usb->index)); /* Program the port reset bit to start the reset process */ - USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), union cvmx_usbcx_hprt, + USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt, prtrst, 1); /* @@ -985,7 +984,7 @@ static void cvmx_usb_reset_port(struct cvmx_usb_state *usb) mdelay(50); /* Program the port reset bit to 0, USBC_HPRT[PRTRST] = 0 */ - USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), union cvmx_usbcx_hprt, + USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt, prtrst, 0); /* @@ -1010,7 +1009,7 @@ static void cvmx_usb_reset_port(struct cvmx_usb_state *usb) static int cvmx_usb_disable(struct cvmx_usb_state *usb) { /* Disable the port */ - USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), union cvmx_usbcx_hprt, + USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt, prtena, 1); return 0; } @@ -1285,12 +1284,10 @@ static void cvmx_usb_poll_tx_fifo(struct cvmx_usb_state *usb) if (cvmx_usb_fill_tx_hw(usb, &usb->periodic, tx_status.s.ptxfspcavail)) USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), - union cvmx_usbcx_gintmsk, - ptxfempmsk, 1); + cvmx_usbcx_gintmsk, ptxfempmsk, 1); else USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), - union cvmx_usbcx_gintmsk, - ptxfempmsk, 0); + cvmx_usbcx_gintmsk, ptxfempmsk, 0); } if (usb->nonperiodic.head != usb->nonperiodic.tail) { @@ -1301,12 +1298,10 @@ static void cvmx_usb_poll_tx_fifo(struct cvmx_usb_state *usb) if (cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic, tx_status.s.nptxfspcavail)) USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), - union cvmx_usbcx_gintmsk, - nptxfempmsk, 1); + cvmx_usbcx_gintmsk, nptxfempmsk, 1); else USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), - union cvmx_usbcx_gintmsk, - nptxfempmsk, 0); + cvmx_usbcx_gintmsk, nptxfempmsk, 0); } } @@ -1401,7 +1396,7 @@ static void cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, bytes_to_transfer = sizeof(*header); /* All Control operations start with a setup going OUT */ USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), - union cvmx_usbcx_hccharx, epdir, + cvmx_usbcx_hccharx, epdir, CVMX_USB_DIRECTION_OUT); /* * Setup send the control header instead of the buffer data. The @@ -1416,11 +1411,11 @@ static void cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, bytes_to_transfer = 0; /* All Control operations start with a setup going OUT */ USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), - union cvmx_usbcx_hccharx, epdir, + cvmx_usbcx_hccharx, epdir, CVMX_USB_DIRECTION_OUT); USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index), - union cvmx_usbcx_hcspltx, compsplt, 1); + cvmx_usbcx_hcspltx, compsplt, 1); break; case CVMX_USB_STAGE_DATA: usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe); @@ -1431,7 +1426,7 @@ static void cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, bytes_to_transfer = pipe->max_packet; } USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), - union cvmx_usbcx_hccharx, epdir, + cvmx_usbcx_hccharx, epdir, ((header->bRequestType & USB_DIR_IN) ? CVMX_USB_DIRECTION_IN : CVMX_USB_DIRECTION_OUT)); @@ -1441,18 +1436,18 @@ static void cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, if (!(header->bRequestType & USB_DIR_IN)) bytes_to_transfer = 0; USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), - union cvmx_usbcx_hccharx, epdir, + cvmx_usbcx_hccharx, epdir, ((header->bRequestType & USB_DIR_IN) ? CVMX_USB_DIRECTION_IN : CVMX_USB_DIRECTION_OUT)); USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index), - union cvmx_usbcx_hcspltx, compsplt, 1); + cvmx_usbcx_hcspltx, compsplt, 1); break; case CVMX_USB_STAGE_STATUS: usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe); bytes_to_transfer = 0; USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), - union cvmx_usbcx_hccharx, epdir, + cvmx_usbcx_hccharx, epdir, ((header->bRequestType & USB_DIR_IN) ? CVMX_USB_DIRECTION_OUT : CVMX_USB_DIRECTION_IN)); @@ -1461,12 +1456,12 @@ static void cvmx_usb_start_channel_control(struct cvmx_usb_state *usb, usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe); bytes_to_transfer = 0; USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), - union cvmx_usbcx_hccharx, epdir, + cvmx_usbcx_hccharx, epdir, ((header->bRequestType & USB_DIR_IN) ? CVMX_USB_DIRECTION_OUT : CVMX_USB_DIRECTION_IN)); USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index), - union cvmx_usbcx_hcspltx, compsplt, 1); + cvmx_usbcx_hcspltx, compsplt, 1); break; } @@ -1830,14 +1825,12 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state *usb, int channel, USB_SET_FIELD32( CVMX_USBCX_HCTSIZX(channel, usb->index), - union cvmx_usbcx_hctsizx, - pid, 0); + cvmx_usbcx_hctsizx, pid, 0); else /* Need MDATA */ USB_SET_FIELD32( CVMX_USBCX_HCTSIZX(channel, usb->index), - union cvmx_usbcx_hctsizx, - pid, 3); + cvmx_usbcx_hctsizx, pid, 3); } } break; @@ -1853,7 +1846,7 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state *usb, int channel, if (cvmx_usb_pipe_needs_split(usb, pipe)) usb->active_split = transaction; USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), - union cvmx_usbcx_hccharx, chena, 1); + cvmx_usbcx_hccharx, chena, 1); if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) cvmx_usb_fill_tx_fifo(usb, channel); } @@ -1983,7 +1976,7 @@ done: } } USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), - union cvmx_usbcx_gintmsk, sofmsk, need_sof); + cvmx_usbcx_gintmsk, sofmsk, need_sof); } static void octeon_usb_urb_complete_callback(struct cvmx_usb_state *usb, @@ -3527,7 +3520,7 @@ static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, */ spin_lock_irqsave(&priv->lock, flags); USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), - union cvmx_usbcx_hprt, prtpwr, 1); + cvmx_usbcx_hprt, prtpwr, 1); spin_unlock_irqrestore(&priv->lock, flags); return 0; case USB_PORT_FEAT_RESET: -- cgit v1.2.3 From 203d77621405345c1f3ffc4c1db3f7ff89571b58 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sat, 28 Mar 2015 21:24:34 +0200 Subject: staging: octeon-usb: make CVMX_WAIT_FOR_FIELD32 to take condition expression Make CVMX_WAIT_FOR_FIELD32 to take full condition expression. This should make the usage simpler, and the macro more readable. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 3e89265d10d8..9e5476e352b4 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -393,8 +393,8 @@ struct octeon_hcd { struct cvmx_usb_state usb; }; -/* This macro spins on a field waiting for it to reach a value */ -#define CVMX_WAIT_FOR_FIELD32(address, _union, field, op, value, timeout_usec)\ +/* This macro spins on a register waiting for it to reach a condition. */ +#define CVMX_WAIT_FOR_FIELD32(address, _union, cond, timeout_usec) \ ({int result; \ do { \ uint64_t done = cvmx_get_cycle() + (uint64_t)timeout_usec * \ @@ -403,7 +403,8 @@ struct octeon_hcd { \ while (1) { \ c.u32 = cvmx_usb_read_csr32(usb, address); \ - if (c.s.field op (value)) { \ + \ + if (cond) { \ result = 0; \ break; \ } else if (cvmx_get_cycle() > done) { \ @@ -652,11 +653,11 @@ static void cvmx_fifo_setup(struct cvmx_usb_state *usb) USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), cvmx_usbcx_grstctl, txfflsh, 1); CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - cvmx_usbcx_grstctl, txfflsh, ==, 0, 100); + cvmx_usbcx_grstctl, c.s.txfflsh == 0, 100); USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), cvmx_usbcx_grstctl, rxfflsh, 1); CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), - cvmx_usbcx_grstctl, rxfflsh, ==, 0, 100); + cvmx_usbcx_grstctl, c.s.rxfflsh == 0, 100); } /** -- cgit v1.2.3 From 528a5691ad2f687d8f59ce1f3d058507a00927b6 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sat, 28 Mar 2015 21:46:29 +0200 Subject: staging: octeon-ethernet: delete cvm_oct_set_carrier() Delete unused function cvm_oct_set_carrier(). Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-mdio.c | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index ebfa9c9e71b1..40dab11e5333 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -130,19 +130,6 @@ static void cvm_oct_note_carrier(struct octeon_ethernet *priv, } } -void cvm_oct_set_carrier(struct octeon_ethernet *priv, - cvmx_helper_link_info_t link_info) -{ - cvm_oct_note_carrier(priv, link_info); - if (link_info.s.link_up) { - if (!netif_carrier_ok(priv->netdev)) - netif_carrier_on(priv->netdev); - } else { - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); - } -} - void cvm_oct_adjust_link(struct net_device *dev) { struct octeon_ethernet *priv = netdev_priv(dev); -- cgit v1.2.3 From a4820acfaf179982a86783ee0c0d5d39a9c5ab20 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 29 Mar 2015 14:54:14 +0200 Subject: staging: ft1000: Drop unneeded cast on netdev_priv The result of netdev_priv is already implicitly cast to the type of the left side of the assignment. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ type T; T *x; @@ x = - (T *) netdev_priv(...) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c index ddb74665fae9..83683e9a1451 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c @@ -116,7 +116,7 @@ struct dsp_image_info { void card_bootload(struct net_device *dev) { - struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); + struct ft1000_info *info = netdev_priv(dev); unsigned long flags; u32 *pdata; u32 size; @@ -148,7 +148,7 @@ void card_bootload(struct net_device *dev) u16 get_handshake(struct net_device *dev, u16 expected_value) { - struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); + struct ft1000_info *info = netdev_priv(dev); u16 handshake; u32 tempx; int loopcnt; @@ -182,7 +182,7 @@ u16 get_handshake(struct net_device *dev, u16 expected_value) void put_handshake(struct net_device *dev, u16 handshake_value) { - struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); + struct ft1000_info *info = netdev_priv(dev); u32 tempx; if (info->AsicID == ELECTRABUZZ_ID) { @@ -198,7 +198,7 @@ void put_handshake(struct net_device *dev, u16 handshake_value) u16 get_request_type(struct net_device *dev) { - struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); + struct ft1000_info *info = netdev_priv(dev); u16 request_type; u32 tempx; @@ -217,7 +217,7 @@ u16 get_request_type(struct net_device *dev) long get_request_value(struct net_device *dev) { - struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); + struct ft1000_info *info = netdev_priv(dev); long value; u16 w_val; @@ -246,7 +246,7 @@ long get_request_value(struct net_device *dev) void put_request_value(struct net_device *dev, long lvalue) { - struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); + struct ft1000_info *info = netdev_priv(dev); u16 size; u32 tempx; @@ -285,7 +285,7 @@ u16 hdr_checksum(struct pseudo_hdr *pHdr) int card_download(struct net_device *dev, const u8 *pFileStart, size_t FileLength) { - struct ft1000_info *info = (struct ft1000_info *)netdev_priv(dev); + struct ft1000_info *info = netdev_priv(dev); int Status = SUCCESS; u32 uiState; u16 handshake; -- cgit v1.2.3 From d049c7f8191440d881bf2224af8ed0de74d8d9a3 Mon Sep 17 00:00:00 2001 From: Piotr Witoslawski Date: Thu, 2 Apr 2015 15:37:30 +0200 Subject: drivers: staging: rtl8723au: fix "warning: cast to restricted __le16" This patch fixes the sparse warning: "cast to restricted __le16" reported for rtl8723au/hal/rtl8723au_xmit.c Signed-off-by: Piotr Witoslawski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/rtl8723au_xmit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c b/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c index 41ac843b9260..6bf87fe86644 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c +++ b/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c @@ -42,7 +42,7 @@ static int urb_zero_packet_chk(struct rtw_adapter *padapter, int sz) static void rtl8192cu_cal_txdesc_chksum(struct tx_desc *ptxdesc) { - u16 *usPtr = (u16 *)ptxdesc; + __le16 *usPtr = (__le16 *)ptxdesc; u32 count = 16; /* (32 bytes / 2 bytes per XOR) => 16 times */ u32 index; u16 checksum = 0; -- cgit v1.2.3 From df18480650df1d9dc94188bc7dd7e47b5c888d05 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 1 Apr 2015 22:32:51 +0100 Subject: staging: vt6655: s_vGenerateTxParameter Replace PSTxBufHead with struct vnt_tx_fifo_head With endian correction on fifo_ctl and current_rate. Removing pTxBufHead, pFifoHead and wFifoCtl Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rxtx.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 5b869d1f9e40..195dcc9b471c 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -116,7 +116,7 @@ void s_vGenerateTxParameter( struct vnt_private *pDevice, unsigned char byPktType, - void *pTxBufHead, + struct vnt_tx_fifo_head *, void *pvRrvTime, void *pvRTS, void *pvCTS, @@ -944,7 +944,7 @@ void s_vGenerateTxParameter( struct vnt_private *pDevice, unsigned char byPktType, - void *pTxBufHead, + struct vnt_tx_fifo_head *tx_buffer_head, void *pvRrvTime, void *pvRTS, void *pvCTS, @@ -955,21 +955,18 @@ s_vGenerateTxParameter( unsigned short wCurrentRate ) { - unsigned short wFifoCtl; + u16 fifo_ctl = le16_to_cpu(tx_buffer_head->fifo_ctl); bool bDisCRC = false; unsigned char byFBOption = AUTO_FB_NONE; - PSTxBufHead pFifoHead = (PSTxBufHead)pTxBufHead; - - pFifoHead->wReserved = wCurrentRate; - wFifoCtl = pFifoHead->wFIFOCtl; + tx_buffer_head->current_rate = cpu_to_le16(wCurrentRate); - if (wFifoCtl & FIFOCTL_CRCDIS) + if (fifo_ctl & FIFOCTL_CRCDIS) bDisCRC = true; - if (wFifoCtl & FIFOCTL_AUTO_FB_0) + if (fifo_ctl & FIFOCTL_AUTO_FB_0) byFBOption = AUTO_FB_0; - else if (wFifoCtl & FIFOCTL_AUTO_FB_1) + else if (fifo_ctl & FIFOCTL_AUTO_FB_1) byFBOption = AUTO_FB_1; if (!pvRrvTime) -- cgit v1.2.3 From a6388e68321a1e0a0f408379c2a36396807745b3 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Wed, 1 Apr 2015 22:32:52 +0100 Subject: staging: vt6655: use ieee80211_tx_info to select packet type. Information for packet type is in ieee80211_tx_info band IEEE80211_BAND_5GHZ for PK_TYPE_11A. IEEE80211_TX_RC_USE_CTS_PROTECT via tx_rate flags selects PK_TYPE_11GB This ensures that the packet is always the right type. Signed-off-by: Malcolm Priestley Cc: # v3.19+ Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rxtx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 195dcc9b471c..74687761bd2e 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -1305,10 +1305,18 @@ int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx, priv->hw->conf.chandef.chan->hw_value); } - if (current_rate > RATE_11M) - pkt_type = (u8)priv->byPacketType; - else + if (current_rate > RATE_11M) { + if (info->band == IEEE80211_BAND_5GHZ) { + pkt_type = PK_TYPE_11A; + } else { + if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) + pkt_type = PK_TYPE_11GB; + else + pkt_type = PK_TYPE_11GA; + } + } else { pkt_type = PK_TYPE_11B; + } /*Set fifo controls */ if (pkt_type == PK_TYPE_11A) -- cgit v1.2.3 From 86d7b29e12b3bfba9b46761448476c878cf6e8b1 Mon Sep 17 00:00:00 2001 From: Phong Tran Date: Thu, 2 Apr 2015 21:36:05 +0700 Subject: staging: android: ion_test: Add the MODULE_LICENSE macro Base on the file comment should define GPL v2 for ion test driver Signed-off-by: Phong Tran Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion_test.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c index 654acb5c8eba..3bc461cbbfa3 100644 --- a/drivers/staging/android/ion/ion_test.c +++ b/drivers/staging/android/ion/ion_test.c @@ -280,3 +280,4 @@ static void __exit ion_test_exit(void) module_init(ion_test_init); module_exit(ion_test_exit); +MODULE_LICENSE("GPL v2"); -- cgit v1.2.3 From 8f47c28b5a0346728259291d9e4a1de90a5d3624 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 29 Mar 2015 14:54:12 +0200 Subject: staging: rtl8712: Drop unneeded cast on netdev_priv The result of netdev_priv is already implicitly cast to the type of the left side of the assignment. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ type T; T *x; @@ x = - (T *) netdev_priv(...) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/os_intfs.c | 10 ++-- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 70 +++++++++++++-------------- drivers/staging/rtl8712/xmit_linux.c | 2 +- 3 files changed, 41 insertions(+), 41 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index 78815b6170c7..6e776e5433f6 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -177,7 +177,7 @@ static uint loadparam(struct _adapter *padapter, struct net_device *pnetdev) static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(pnetdev); + struct _adapter *padapter = netdev_priv(pnetdev); struct sockaddr *addr = p; if (padapter->bup == false) @@ -187,7 +187,7 @@ static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p) static struct net_device_stats *r871x_net_get_stats(struct net_device *pnetdev) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(pnetdev); + struct _adapter *padapter = netdev_priv(pnetdev); struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct recv_priv *precvpriv = &(padapter->recvpriv); @@ -221,7 +221,7 @@ struct net_device *r8712_init_netdev(void) strcpy(ifname, "wlan%d"); dev_alloc_name(pnetdev, ifname); } - padapter = (struct _adapter *) netdev_priv(pnetdev); + padapter = netdev_priv(pnetdev); padapter->pnetdev = pnetdev; pr_info("r8712u: register rtl8712_netdev_ops to netdev_ops\n"); pnetdev->netdev_ops = &rtl8712_netdev_ops; @@ -384,7 +384,7 @@ static void enable_video_mode(struct _adapter *padapter, int cbw40_value) */ static int netdev_open(struct net_device *pnetdev) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(pnetdev); + struct _adapter *padapter = netdev_priv(pnetdev); mutex_lock(&padapter->mutex_start); if (padapter->bup == false) { @@ -452,7 +452,7 @@ netdev_open_error: */ static int netdev_close(struct net_device *pnetdev) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(pnetdev); + struct _adapter *padapter = netdev_priv(pnetdev); /* Close LED*/ padapter->ledpriv.LedControlHandler(padapter, LED_CTL_POWER_OFF); diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index c39d031c4aa6..42fba3f5b593 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -363,7 +363,7 @@ static inline char *translate_scan(struct _adapter *padapter, static int wpa_set_auth_algs(struct net_device *dev, u32 value) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); int ret = 0; if ((value & AUTH_ALG_SHARED_KEY) && (value & AUTH_ALG_OPEN_SYSTEM)) { @@ -395,7 +395,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, int ret = 0; u32 wep_key_idx, wep_key_len = 0; struct NDIS_802_11_WEP *pwep = NULL; - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; @@ -629,7 +629,7 @@ static int r8711_wx_get_name(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); u32 ht_ielen = 0; char *p; u8 ht_cap = false; @@ -685,7 +685,7 @@ static int r8711_wx_set_freq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct iw_freq *fwrq = &wrqu->freq; int rc = 0; @@ -721,7 +721,7 @@ static int r8711_wx_get_freq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; @@ -740,7 +740,7 @@ static int r8711_wx_set_mode(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); enum NDIS_802_11_NETWORK_INFRASTRUCTURE networkType; switch (wrqu->mode) { @@ -771,7 +771,7 @@ static int r8711_wx_set_mode(struct net_device *dev, static int r8711_wx_get_mode(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) @@ -790,7 +790,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct security_priv *psecuritypriv = &padapter->securitypriv; struct iw_pmksa *pPMK = (struct iw_pmksa *) extra; u8 strZeroMacAddress[ETH_ALEN] = {0x00}; @@ -1061,7 +1061,7 @@ static int r8711_wx_set_wap(struct net_device *dev, char *extra) { int ret = -EINPROGRESS; - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct __queue *queue = &pmlmepriv->scanned_queue; struct sockaddr *temp = (struct sockaddr *)awrq; @@ -1110,7 +1110,7 @@ static int r8711_wx_get_wap(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; @@ -1128,7 +1128,7 @@ static int r871x_wx_set_mlme(struct net_device *dev, union iwreq_data *wrqu, char *extra) { int ret = 0; - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct iw_mlme *mlme = (struct iw_mlme *) extra; if (mlme == NULL) @@ -1160,7 +1160,7 @@ static int r8711_wx_set_scan(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; u8 status = true; @@ -1209,7 +1209,7 @@ static int r8711_wx_get_scan(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct __queue *queue = &pmlmepriv->scanned_queue; struct wlan_network *pnetwork = NULL; @@ -1263,7 +1263,7 @@ static int r8711_wx_set_essid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct __queue *queue = &pmlmepriv->scanned_queue; struct wlan_network *pnetwork = NULL; @@ -1326,7 +1326,7 @@ static int r8711_wx_get_essid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; u32 len, ret = 0; @@ -1346,7 +1346,7 @@ static int r8711_wx_set_rate(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); u32 target_rate = wrqu->bitrate.value; u32 fixed = wrqu->bitrate.fixed; u32 ratevalue = 0; @@ -1418,7 +1418,7 @@ static int r8711_wx_get_rate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; struct ieee80211_ht_cap *pht_capie; @@ -1475,7 +1475,7 @@ static int r8711_wx_get_rts(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); wrqu->rts.value = padapter->registrypriv.rts_thresh; wrqu->rts.fixed = 0; /* no auto select */ @@ -1486,7 +1486,7 @@ static int r8711_wx_set_frag(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); if (wrqu->frag.disabled) padapter->xmitpriv.frag_len = MAX_FRAG_THRESHOLD; @@ -1503,7 +1503,7 @@ static int r8711_wx_get_frag(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); wrqu->frag.value = padapter->xmitpriv.frag_len; wrqu->frag.fixed = 0; /* no auto select */ @@ -1529,7 +1529,7 @@ static int r8711_wx_set_enc(struct net_device *dev, struct NDIS_802_11_WEP wep; enum NDIS_802_11_AUTHENTICATION_MODE authmode; struct iw_point *erq = &(wrqu->encoding); - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); key = erq->flags & IW_ENCODE_INDEX; memset(&wep, 0, sizeof(struct NDIS_802_11_WEP)); @@ -1621,7 +1621,7 @@ static int r8711_wx_get_enc(struct net_device *dev, union iwreq_data *wrqu, char *keybuf) { uint key, ret = 0; - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct iw_point *erq = &(wrqu->encoding); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -1693,7 +1693,7 @@ static int r871x_wx_set_gen_ie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); return r871x_set_wpa_ie(padapter, extra, wrqu->data.length); } @@ -1702,7 +1702,7 @@ static int r871x_wx_set_auth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct iw_param *param = (struct iw_param *)&(wrqu->param); int paramid; int paramval; @@ -1849,7 +1849,7 @@ static int r8711_wx_read32(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *keybuf) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); u32 addr; u32 data32; @@ -1866,7 +1866,7 @@ static int r8711_wx_write32(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *keybuf) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); u32 addr; u32 data32; @@ -1894,7 +1894,7 @@ static int r871x_mp_ioctl_hdl(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct iw_point *p = &wrqu->data; struct oid_par_priv oid_par; struct mp_ioctl_handler *phandler; @@ -1973,7 +1973,7 @@ static int r871x_get_ap_info(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct __queue *queue = &pmlmepriv->scanned_queue; struct iw_point *pdata = &wrqu->data; @@ -2044,7 +2044,7 @@ static int r871x_set_pid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct iw_point *pdata = &wrqu->data; if ((padapter->bDriverStopped) || (pdata == NULL)) @@ -2059,7 +2059,7 @@ static int r871x_set_chplan(struct net_device *dev, union iwreq_data *wrqu, char *extra) { int ret = 0; - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct iw_point *pdata = &wrqu->data; int ch_plan = -1; @@ -2079,7 +2079,7 @@ static int r871x_wps_start(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct _adapter *padapter = (struct _adapter *)netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct iw_point *pdata = &wrqu->data; u32 u32wps_start = 0; @@ -2103,7 +2103,7 @@ static int r871x_wps_start(struct net_device *dev, static int wpa_set_param(struct net_device *dev, u8 name, u32 value) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); switch (name) { case IEEE_PARAM_WPA_ENABLED: @@ -2155,7 +2155,7 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); switch (command) { case IEEE_MLME_STA_DEAUTH: @@ -2176,7 +2176,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) { struct ieee_param *param; int ret = 0; - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); if (p->length < sizeof(struct ieee_param) || !p->pointer) return -EINVAL; @@ -2329,7 +2329,7 @@ static iw_handler r8711_private_handler[] = { static struct iw_statistics *r871x_get_wireless_stats(struct net_device *dev) { - struct _adapter *padapter = (struct _adapter *) netdev_priv(dev); + struct _adapter *padapter = netdev_priv(dev); struct iw_statistics *piwstats = &padapter->iwstats; int tmp_level = 0; int tmp_qual = 0; diff --git a/drivers/staging/rtl8712/xmit_linux.c b/drivers/staging/rtl8712/xmit_linux.c index 039b598152bc..d15fb1ad45b9 100644 --- a/drivers/staging/rtl8712/xmit_linux.c +++ b/drivers/staging/rtl8712/xmit_linux.c @@ -162,7 +162,7 @@ void r8712_xmit_complete(struct _adapter *padapter, struct xmit_frame *pxframe) int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev) { struct xmit_frame *pxmitframe = NULL; - struct _adapter *padapter = (struct _adapter *)netdev_priv(pnetdev); + struct _adapter *padapter = netdev_priv(pnetdev); struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); int ret = 0; -- cgit v1.2.3 From f5d8bde742a5dbea11eed35a026bc4d968001119 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:44 -0400 Subject: staging: rtl8723au: Reformat whitespace to increase readability Adjust the whitespace in the signature, local variable declaration and initialization parts of a number of functions to increase readability in rtl8723au's rtw_security.c. Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 79 +++++++++++++-------------- 1 file changed, 38 insertions(+), 41 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index ea670afcc212..92882f60bc0e 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -31,11 +31,11 @@ struct arc4context { static void arcfour_init(struct arc4context *parc4ctx, u8 *key, u32 key_len) { - u32 t, u; - u32 keyindex; - u32 stateindex; + u32 t, u; + u32 keyindex; + u32 stateindex; u8 *state; - u32 counter; + u32 counter; state = parc4ctx->state; parc4ctx->x = 0; @@ -55,7 +55,8 @@ static void arcfour_init(struct arc4context *parc4ctx, u8 *key, u32 key_len) } } -static u32 arcfour_byte( struct arc4context *parc4ctx) + +static u32 arcfour_byte(struct arc4context *parc4ctx) { u32 x; u32 y; @@ -75,16 +76,13 @@ static u32 arcfour_byte( struct arc4context *parc4ctx) return state[(sx + sy) & 0xff]; } -static void arcfour_encrypt( struct arc4context *parc4ctx, - u8 *dest, - u8 *src, - u32 len) +static void arcfour_encrypt(struct arc4context *parc4ctx, u8 *dest, + u8 *src, u32 len) { - u32 i; + u32 i; for (i = 0; i < len; i++) dest[i] = src[i] ^ (unsigned char)arcfour_byte(parc4ctx); - } static int bcrc32initialized; @@ -365,7 +363,7 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_code, u8 pri) { - struct mic_data micdata; + struct mic_data micdata; u8 priority[4]={0x0, 0x0, 0x0, 0x0}; rtw_secmicsetkey23a(&micdata, key); @@ -601,21 +599,21 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe) { - u16 pnl; - u32 pnh; - u8 rc4key[16]; - u8 ttkey[16]; - u8 crc[4]; - u8 hw_hdr_offset = 0; + u16 pnl; + u32 pnh; + u8 rc4key[16]; + u8 ttkey[16]; + u8 crc[4]; + u8 hw_hdr_offset = 0; struct arc4context mycontext; - int curfragnum, length; - u32 prwskeylen; - u8 *pframe, *payload, *iv, *prwskey; + int curfragnum, length; + u32 prwskeylen; + u8 *pframe, *payload, *iv, *prwskey; union pn48 dot11txpn; - struct sta_info *stainfo; - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + struct sta_info *stainfo; + struct pkt_attrib *pattrib = &pxmitframe->attrib; + struct security_priv *psecuritypriv = &padapter->securitypriv; + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; int res = _SUCCESS; if (!pxmitframe->buf_addr) @@ -708,17 +706,17 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, { u16 pnl; u32 pnh; - u8 rc4key[16]; - u8 ttkey[16]; - u8 crc[4]; + u8 rc4key[16]; + u8 ttkey[16]; + u8 crc[4]; struct arc4context mycontext; - int length; - u32 prwskeylen; - u8 *pframe, *payload, *iv, *prwskey; + int length; + u32 prwskeylen; + u8 *pframe, *payload, *iv, *prwskey; union pn48 dot11txpn; - struct sta_info *stainfo; - struct rx_pkt_attrib *prxattrib = &precvframe->attrib; - struct security_priv *psecuritypriv = &padapter->securitypriv; + struct sta_info *stainfo; + struct rx_pkt_attrib *prxattrib = &precvframe->attrib; + struct security_priv *psecuritypriv = &padapter->securitypriv; struct sk_buff *skb = precvframe->pkt; int res = _SUCCESS; @@ -1136,8 +1134,8 @@ static void bitwise_xor(u8 *ina, u8 *inb, u8 *out) static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) { - uint qc_exists, a4_exists, i, j, payload_remainder, - num_blocks, payload_index; + uint qc_exists, a4_exists, i, j, payload_remainder, + num_blocks, payload_index; u8 pn_vector[6]; u8 mic_iv[16]; u8 mic_header1[16]; @@ -1353,12 +1351,11 @@ out: return res; } -static int aes_decipher(u8 *key, uint hdrlen, - u8 *pframe, uint plen) +static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) { - static u8 message[MAX_MSG_SIZE]; - uint qc_exists, a4_exists, i, j, payload_remainder, - num_blocks, payload_index; + static u8 message[MAX_MSG_SIZE]; + uint qc_exists, a4_exists, i, j, payload_remainder, + num_blocks, payload_index; int res = _SUCCESS; u8 pn_vector[6]; u8 mic_iv[16]; -- cgit v1.2.3 From 9c0cfd4b6f51af9a935dbec680a60a4521b5f2b8 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:45 -0400 Subject: staging: rtl8723au: Fix "before/around/after" whitespace issues Correct a number of "space(s) required before/around/after" checkpatch.pl issues in a number of functions in rtl8723au's rtw_security.c. Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 219 +++++++++++++------------- 1 file changed, 113 insertions(+), 106 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 92882f60bc0e..572fcf3f936d 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -129,14 +129,14 @@ static void crc32_init(void) static u32 getcrc32(u8 *buf, int len) { u8 *p; - u32 crc; + u32 crc; if (bcrc32initialized == 0) crc32_init(); crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ for (p = buf; len > 0; ++p, --len) - crc = crc32_table[ (crc ^ *p) & 0xff] ^ (crc >> 8); + crc = crc32_table[(crc ^ *p) & 0xff] ^ (crc >> 8); return ~crc; /* transmit complement, per CRC-32 spec */ } @@ -182,7 +182,7 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter, if ((curfragnum + 1) == pattrib->nr_frags) { /* the last fragment */ length = pattrib->last_txcmdsz - pattrib->hdrlen - - pattrib->iv_len- pattrib->icv_len; + pattrib->iv_len - pattrib->icv_len; *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); @@ -262,8 +262,8 @@ static u32 secmicgetuint32(u8 *p) s32 i; u32 res = 0; - for (i = 0; i<4; i++) { - res |= ((u32)(*p++)) << (8*i); + for (i = 0; i < 4; i++) { + res |= ((u32)(*p++)) << (8 * i); } return res; @@ -274,7 +274,7 @@ static void secmicputuint32(u8 *p, u32 val) { long i; - for (i = 0; i<4; i++) { + for (i = 0; i < 4; i++) { *p++ = (u8) (val & 0xff); val >>= 8; } @@ -307,7 +307,7 @@ void rtw_secmicappend23abyte23a(struct mic_data *pmicdata, u8 b) { /* Append the byte to our word-sized buffer */ - pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM); + pmicdata->M |= ((unsigned long)b) << (8 * pmicdata->nBytesInM); pmicdata->nBytesInM++; /* Process the word if it is full. */ if (pmicdata->nBytesInM >= 4) { @@ -331,7 +331,7 @@ void rtw_secmicappend23a(struct mic_data *pmicdata, u8 *src, u32 nbytes) { /* This is simple */ - while(nbytes > 0) { + while (nbytes > 0) { rtw_secmicappend23abyte23a(pmicdata, *src++); nbytes--; } @@ -348,12 +348,12 @@ void rtw_secgetmic23a(struct mic_data *pmicdata, u8 *dst) rtw_secmicappend23abyte23a(pmicdata, 0); rtw_secmicappend23abyte23a(pmicdata, 0); /* and then zeroes until the length is a multiple of 4 */ - while(pmicdata->nBytesInM != 0) { + while (pmicdata->nBytesInM != 0) { rtw_secmicappend23abyte23a(pmicdata, 0); } /* The appendByte function has already computed the result. */ secmicputuint32(dst, pmicdata->L); - secmicputuint32(dst+4, pmicdata->R); + secmicputuint32(dst + 4, pmicdata->R); /* Reset to the empty message. */ secmicclear(pmicdata); @@ -364,10 +364,10 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, { struct mic_data micdata; - u8 priority[4]={0x0, 0x0, 0x0, 0x0}; + u8 priority[4] = {0x0, 0x0, 0x0, 0x0}; rtw_secmicsetkey23a(&micdata, key); - priority[0]= pri; + priority[0] = pri; /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ if (header[1]&1) { /* ToDS == 1 */ @@ -398,11 +398,11 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, #define Lo8(v16) ((u8)((v16) & 0x00FF)) #define Hi8(v16) ((u8)(((v16) >> 8) & 0x00FF)) #define Lo16(v32) ((u16)((v32) & 0xFFFF)) -#define Hi16(v32) ((u16)(((v32) >>16) & 0xFFFF)) +#define Hi16(v32) ((u16)(((v32) >> 16) & 0xFFFF)) #define Mk16(hi, lo) ((lo) ^ (((u16)(hi)) << 8)) /* select the Nth 16-bit word of the temporal key unsigned char array TK[] */ -#define TK16(N) Mk16(tk[2*(N)+1], tk[2*(N)]) +#define TK16(N) Mk16(tk[2 * (N) + 1], tk[2 * (N)]) /* S-box lookup: 16 bits --> 16 bits */ #define _S_(v16) (Sbox1[0][Lo8(v16)] ^ Sbox1[1][Hi8(v16)]) @@ -415,7 +415,7 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, #define RC4_KEY_SIZE 16 /* 128-bit RC4KEY (104 bits unknown) */ /* 2-unsigned char by 2-unsigned char subset of the full AES S-box table */ -static const unsigned short Sbox1[2][256]= /* Sbox for hash (can be in ROM) */ +static const unsigned short Sbox1[2][256] = /* Sbox for hash (can be in ROM) */ { { 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, @@ -517,13 +517,13 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) /* Now compute an unbalanced Feistel cipher with 80-bit block */ /* size on the 80-bit block P1K[], using the 128-bit key TK[] */ - for (i = 0; i < PHASE1_LOOP_CNT ;i++) { + for (i = 0; i < PHASE1_LOOP_CNT; i++) { /* Each add operation here is mod 2**16 */ - p1k[0] += _S_(p1k[4] ^ TK16((i&1)+0)); - p1k[1] += _S_(p1k[0] ^ TK16((i&1)+2)); - p1k[2] += _S_(p1k[1] ^ TK16((i&1)+4)); - p1k[3] += _S_(p1k[2] ^ TK16((i&1)+6)); - p1k[4] += _S_(p1k[3] ^ TK16((i&1)+0)); + p1k[0] += _S_(p1k[4] ^ TK16((i & 1) + 0)); + p1k[1] += _S_(p1k[0] ^ TK16((i & 1) + 2)); + p1k[2] += _S_(p1k[1] ^ TK16((i & 1) + 4)); + p1k[3] += _S_(p1k[2] ^ TK16((i & 1) + 6)); + p1k[4] += _S_(p1k[3] ^ TK16((i & 1) + 0)); p1k[4] += (unsigned short)i; /* avoid "slide attacks" */ } @@ -558,8 +558,8 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) u16 PPK[6]; /* temporary key for mixing */ /* Note: all adds in the PPK[] equations below are mod 2**16 */ - for (i = 0;i<5;i++) PPK[i]= p1k[i]; /* first, copy P1K to PPK */ - PPK[5] = p1k[4] +iv16; /* next, add in IV16 */ + for (i = 0; i < 5; i++) PPK[i] = p1k[i]; /* first, copy P1K to PPK */ + PPK[5] = p1k[4] + iv16; /* next, add in IV16 */ /* Bijective non-linear mixing of the 96 bits of PPK[0..5] */ PPK[0] += _S_(PPK[5] ^ TK16(0)); /* Mix key in each "round" */ @@ -588,9 +588,9 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) rc4key[3] = Lo8((PPK[5] ^ TK16(0)) >> 1); /* Copy 96 bits of PPK[0..5] to RC4KEY[4..15] (little-endian) */ - for (i = 0;i<6;i++) { - rc4key[4+2*i] = Lo8(PPK[i]); - rc4key[5+2*i] = Hi8(PPK[i]); + for (i = 0; i < 6; i++) { + rc4key[4 + 2 * i] = Lo8(PPK[i]); + rc4key[5 + 2 * i] = Hi8(PPK[i]); } } @@ -632,9 +632,9 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, &pattrib->ra[0]); } - if (stainfo!= NULL) { + if (stainfo != NULL) { - if (!(stainfo->state &_FW_LINKED)) { + if (!(stainfo->state & _FW_LINKED)) { DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); return _FAIL; } @@ -649,21 +649,25 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, prwskeylen = 16; - for (curfragnum = 0;curfragnumnr_frags;curfragnum++) { - iv = pframe+pattrib->hdrlen; - payload = pframe+pattrib->iv_len+pattrib->hdrlen; + for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { + iv = pframe + pattrib->hdrlen; + payload = pframe + pattrib->iv_len + pattrib->hdrlen; GET_TKIP_PN(iv, dot11txpn); pnl = (u16)(dot11txpn.val); pnh = (u32)(dot11txpn.val>>16); - phase1((u16 *)&ttkey[0], prwskey,&pattrib->ta[0], pnh); + phase1((u16 *)&ttkey[0], prwskey, &pattrib->ta[0], pnh); phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0], pnl); - if ((curfragnum+1) == pattrib->nr_frags) { /* 4 the last fragment */ - length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; + if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */ + length = (pattrib->last_txcmdsz - + pattrib->hdrlen - + pattrib->iv_len - + pattrib->icv_len); + RT_TRACE(_module_rtl871x_security_c_, _drv_info_, "pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len, @@ -672,23 +676,27 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload+length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, crc, 4); } - else{ - length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; + else { + length = (pxmitpriv->frag_len - + pattrib->hdrlen - + pattrib->iv_len - + pattrib->icv_len); + *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload+length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, crc, 4); - pframe+= pxmitpriv->frag_len; - pframe = PTR_ALIGN(pframe, 4); + pframe += pxmitpriv->frag_len; + pframe = PTR_ALIGN(pframe, 4); } } } - else{ + else { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, "rtw_tkip_encrypt23a: stainfo == NULL!!!\n"); DBG_8723A("%s, psta == NUL\n", __func__); @@ -727,7 +735,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, stainfo = rtw_get_stainfo23a(&padapter->stapriv, &prxattrib->ta[0]); - if (stainfo!= NULL) { + if (stainfo != NULL) { if (is_multicast_ether_addr(prxattrib->ra)) { if (psecuritypriv->binstallGrpkey == 0) { @@ -744,32 +752,32 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, prwskeylen = 16; } - iv = pframe+prxattrib->hdrlen; - payload = pframe+prxattrib->iv_len+prxattrib->hdrlen; - length = skb->len - prxattrib->hdrlen-prxattrib->iv_len; + iv = pframe + prxattrib->hdrlen; + payload = pframe + prxattrib->iv_len + prxattrib->hdrlen; + length = skb->len - prxattrib->hdrlen - prxattrib->iv_len; GET_TKIP_PN(iv, dot11txpn); pnl = (u16)(dot11txpn.val); pnh = (u32)(dot11txpn.val>>16); - phase1((u16 *)&ttkey[0], prwskey,&prxattrib->ta[0], pnh); + phase1((u16 *)&ttkey[0], prwskey, &prxattrib->ta[0], pnh); phase2(&rc4key[0], prwskey, (unsigned short *)&ttkey[0], pnl); /* 4 decrypt payload include icv */ arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - *((u32 *)crc) = le32_to_cpu(getcrc32(payload, length-4)); + *((u32 *)crc) = le32_to_cpu(getcrc32(payload, length - 4)); - if (crc[3]!= payload[length-1] || crc[2]!= payload[length-2] || crc[1]!= payload[length-3] || crc[0]!= payload[length-4]) + if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] || crc[1] != payload[length - 3] || crc[0] != payload[length - 4]) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, "rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n", - crc[3], payload[length-1], - crc[2], payload[length-2], - crc[1], payload[length-3], - crc[0], payload[length-4]); + crc[3], payload[length - 1], + crc[2], payload[length - 2], + crc[1], payload[length - 3], + crc[0], payload[length - 4]); res = _FAIL; } } else { @@ -835,7 +843,7 @@ static void xor_128(u8 *a, u8 *b, u8 *out) { int i; - for (i = 0;i<16; i++) + for (i = 0; i < 16; i++) out[i] = a[i] ^ b[i]; } @@ -882,7 +890,7 @@ static void byte_sub(u8 *in, u8 *out) { int i; - for (i = 0; i< 16; i++) { + for (i = 0; i < 16; i++) { out[i] = sbox(in[i]); } @@ -922,7 +930,7 @@ static void mix_column(u8 *in, u8 *out) u8 temp[4]; u8 tempb[4]; - for (i = 0 ; i<4; i++) { + for (i = 0; i < 4; i++) { if ((in[i] & 0x80) == 0x80) add1b[i] = 0x1b; else @@ -944,10 +952,10 @@ static void mix_column(u8 *in, u8 *out) andf7[2] = in[2] & 0x7f; andf7[3] = in[3] & 0x7f; - for (i = 3; i>0; i--) { /* logical shift left 1 bit */ + for (i = 3; i > 0; i--) { /* logical shift left 1 bit */ andf7[i] = andf7[i] << 1; - if ((andf7[i-1] & 0x80) == 0x80) { - andf7[i] = (andf7[i] | 0x01); + if ((andf7[i - 1] & 0x80) == 0x80) { + andf7[i] = (andf7[i] | 0x01); } } andf7[0] = andf7[0] << 1; @@ -977,7 +985,7 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) u8 intermediateb[16]; u8 round_key[16]; - for (i = 0; i<16; i++) round_key[i] = key[i]; + for (i = 0; i < 16; i++) round_key[i] = key[i]; for (round = 0; round < 11; round++) { if (round == 0) { @@ -1061,7 +1069,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, { int i; - for (i = 0; i<16; i++) mic_header2[i]= 0x00; + for (i = 0; i < 16; i++) mic_header2[i] = 0x00; mic_header2[0] = mpdu[16]; /* A3 */ mic_header2[1] = mpdu[17]; @@ -1074,8 +1082,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, mic_header2[7] = 0x00; /* mpdu[23]; */ if (!qc_exists && a4_exists) { - for (i = 0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ - + for (i = 0; i < 6; i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ } if (qc_exists && !a4_exists) { @@ -1084,7 +1091,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, } if (qc_exists && a4_exists) { - for (i = 0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ + for (i = 0; i < 6; i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ mic_header2[14] = mpdu[30] & 0x0f; mic_header2[15] = mpdu[31] & 0x00; @@ -1102,7 +1109,7 @@ static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int qc_exists, { int i = 0; - for (i = 0; i<16; i++) ctr_preload[i] = 0x00; + for (i = 0; i < 16; i++) ctr_preload[i] = 0x00; i = 0; ctr_preload[0] = 0x01; /* flag */ @@ -1183,12 +1190,12 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) } else { qc_exists = 0; } - pn_vector[0]= pframe[hdrlen]; - pn_vector[1]= pframe[hdrlen+1]; - pn_vector[2]= pframe[hdrlen+4]; - pn_vector[3]= pframe[hdrlen+5]; - pn_vector[4]= pframe[hdrlen+6]; - pn_vector[5]= pframe[hdrlen+7]; + pn_vector[0] = pframe[hdrlen]; + pn_vector[1] = pframe[hdrlen + 1]; + pn_vector[2] = pframe[hdrlen + 4]; + pn_vector[3] = pframe[hdrlen + 5]; + pn_vector[4] = pframe[hdrlen + 6]; + pn_vector[5] = pframe[hdrlen + 7]; construct_mic_iv(mic_iv, qc_exists, a4_exists, pframe, plen, pn_vector); @@ -1230,12 +1237,12 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) /* Insert MIC into payload */ for (j = 0; j < 8; j++) - pframe[payload_index+j] = mic[j]; + pframe[payload_index + j] = mic[j]; payload_index = hdrlen + 8; for (i = 0; i < num_blocks; i++) { construct_ctr_preload(ctr_preload, a4_exists, qc_exists, - pframe, pn_vector, i+1); + pframe, pn_vector, i + 1); aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, &pframe[payload_index], chain_buffer); for (j = 0; j < 16; j++) @@ -1247,15 +1254,15 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) * encrypt it and copy the unpadded part back */ construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pframe, - pn_vector, num_blocks+1); + pn_vector, num_blocks + 1); for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) - padded_buffer[j] = pframe[payload_index+j]; + padded_buffer[j] = pframe[payload_index + j]; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); - for (j = 0; j < payload_remainder;j++) + for (j = 0; j < payload_remainder; j++) pframe[payload_index++] = chain_buffer[j]; } @@ -1266,11 +1273,11 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 8; j++) - padded_buffer[j] = pframe[j+hdrlen+8+plen]; + padded_buffer[j] = pframe[j + hdrlen + 8 + plen]; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); - for (j = 0; j < 8;j++) + for (j = 0; j < 8; j++) pframe[payload_index++] = chain_buffer[j]; return _SUCCESS; @@ -1315,7 +1322,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter, res = _FAIL; goto out; } - if (!(stainfo->state &_FW_LINKED)) { + if (!(stainfo->state & _FW_LINKED)) { DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); return _FAIL; @@ -1380,16 +1387,16 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) /* start to decrypt the payload */ - num_blocks = (plen-8) / 16; /* plen including llc, payload_length and mic) */ + num_blocks = (plen - 8) / 16; /* plen including llc, payload_length and mic) */ - payload_remainder = (plen-8) % 16; + payload_remainder = (plen - 8) % 16; pn_vector[0] = pframe[hdrlen]; - pn_vector[1] = pframe[hdrlen+1]; - pn_vector[2] = pframe[hdrlen+4]; - pn_vector[3] = pframe[hdrlen+5]; - pn_vector[4] = pframe[hdrlen+6]; - pn_vector[5] = pframe[hdrlen+7]; + pn_vector[1] = pframe[hdrlen + 1]; + pn_vector[2] = pframe[hdrlen + 4]; + pn_vector[3] = pframe[hdrlen + 5]; + pn_vector[4] = pframe[hdrlen + 6]; + pn_vector[5] = pframe[hdrlen + 7]; if ((hdrlen == sizeof(struct ieee80211_hdr_3addr) || (hdrlen == sizeof(struct ieee80211_qos_hdr)))) @@ -1424,7 +1431,7 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) for (i = 0; i < num_blocks; i++) { construct_ctr_preload(ctr_preload, a4_exists, qc_exists, - pframe, pn_vector, i+1); + pframe, pn_vector, i + 1); aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, &pframe[payload_index], chain_buffer); @@ -1438,12 +1445,12 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) * encrypt it and copy the unpadded part back */ construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pframe, - pn_vector, num_blocks+1); + pn_vector, num_blocks + 1); for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) - padded_buffer[j] = pframe[payload_index+j]; + padded_buffer[j] = pframe[payload_index + j]; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < payload_remainder; j++) @@ -1451,24 +1458,24 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) } /* start to calculate the mic */ - if ((hdrlen +plen+8) <= MAX_MSG_SIZE) - memcpy(message, pframe, (hdrlen+plen+8)); /* 8 is for ext iv len */ + if ((hdrlen + plen + 8) <= MAX_MSG_SIZE) + memcpy(message, pframe, (hdrlen + plen + 8)); /* 8 is for ext iv len */ pn_vector[0] = pframe[hdrlen]; - pn_vector[1] = pframe[hdrlen+1]; - pn_vector[2] = pframe[hdrlen+4]; - pn_vector[3] = pframe[hdrlen+5]; - pn_vector[4] = pframe[hdrlen+6]; - pn_vector[5] = pframe[hdrlen+7]; + pn_vector[1] = pframe[hdrlen + 1]; + pn_vector[2] = pframe[hdrlen + 4]; + pn_vector[3] = pframe[hdrlen + 5]; + pn_vector[4] = pframe[hdrlen + 6]; + pn_vector[5] = pframe[hdrlen + 7]; construct_mic_iv(mic_iv, qc_exists, a4_exists, message, - plen-8, pn_vector); + plen - 8, pn_vector); construct_mic_header1(mic_header1, hdrlen, message); construct_mic_header2(mic_header2, message, a4_exists, qc_exists); - payload_remainder = (plen-8) % 16; - num_blocks = (plen-8) / 16; + payload_remainder = (plen - 8) % 16; + num_blocks = (plen - 8) / 16; /* Find start of payload */ payload_index = hdrlen + 8; @@ -1502,12 +1509,12 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) /* Insert MIC into payload */ for (j = 0; j < 8; j++) - message[payload_index+j] = mic[j]; + message[payload_index + j] = mic[j]; payload_index = hdrlen + 8; - for (i = 0; i< num_blocks; i++) { + for (i = 0; i < num_blocks; i++) { construct_ctr_preload(ctr_preload, a4_exists, qc_exists, - message, pn_vector, i+1); + message, pn_vector, i + 1); aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, &message[payload_index], chain_buffer); for (j = 0; j < 16; j++) @@ -1519,12 +1526,12 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) * encrypt it and copy the unpadded part back */ construct_ctr_preload(ctr_preload, a4_exists, qc_exists, - message, pn_vector, num_blocks+1); + message, pn_vector, num_blocks + 1); for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) - padded_buffer[j] = message[payload_index+j]; + padded_buffer[j] = message[payload_index + j]; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < payload_remainder; j++) @@ -1538,7 +1545,7 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 8; j++) - padded_buffer[j] = message[j+hdrlen+8+plen-8]; + padded_buffer[j] = message[j + hdrlen + 8 + plen - 8]; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); @@ -1547,13 +1554,13 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) /* compare the mic */ for (i = 0; i < 8; i++) { - if (pframe[hdrlen+8+plen-8+i] != message[hdrlen+8+plen-8+i]) { + if (pframe[hdrlen + 8 + plen - 8 + i] != message[hdrlen + 8 + plen - 8 + i]) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, "aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n", i, pframe[hdrlen + 8 + plen - 8 + i], message[hdrlen + 8 + plen - 8 + i]); DBG_8723A("aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n", - i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]); + i, pframe[hdrlen + 8 + plen - 8 + i], message[hdrlen + 8 + plen - 8 + i]); res = _FAIL; } } -- cgit v1.2.3 From 2d7b3a7bb81fb585a4f794667297406438605090 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:46 -0400 Subject: staging: rtl8723au: else should follow close brace Correct checkpatch.pl errors in rtl8723au's rtw_security.c indicating that an else statement should follow the closing brace of the previous if/else if code block: ERROR: else should follow close brace '}' Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 572fcf3f936d..9faf78bf23d8 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -376,8 +376,7 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, rtw_secmicappend23a(&micdata, &header[24], 6); else rtw_secmicappend23a(&micdata, &header[10], 6); - } - else{ /* ToDS == 0 */ + } else { /* ToDS == 0 */ rtw_secmicappend23a(&micdata, &header[4], 6); /* DA */ if (header[1]&2) /* From Ds == 1 */ rtw_secmicappend23a(&micdata, &header[16], 6); @@ -678,8 +677,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload + length, crc, 4); - } - else { + } else { length = (pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - @@ -695,8 +693,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, } } - } - else { + } else { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, "rtw_tkip_encrypt23a: stainfo == NULL!!!\n"); DBG_8723A("%s, psta == NUL\n", __func__); -- cgit v1.2.3 From a2390239582fbb16564bed93e37ca4cf8d219c79 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:47 -0400 Subject: staging: rtl8723au: Fix the indentation of two lines Correct the indentation of two lines in rtw_tkip_encrypt23a function in rtl8723au's rtw_security.c. Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 9faf78bf23d8..3e79b66d0897 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -688,8 +688,8 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload + length, crc, 4); - pframe += pxmitpriv->frag_len; - pframe = PTR_ALIGN(pframe, 4); + pframe += pxmitpriv->frag_len; + pframe = PTR_ALIGN(pframe, 4); } } -- cgit v1.2.3 From c3cc7593ecaf1c2b84e36fccccd81b6d3a8dd104 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:48 -0400 Subject: staging: rtl8723au: Reorganize a few functions to remove indentation Prior to this commit, functions rtw_tkip_encrypt23a and rtw_tkip_decrypt23a had large if blocks which contained the majority of the logic in the functions. Rework these functions so that if the negated version of the aforementioned if blocks' conditions are true, we return from the function with _FAIL, as expected by the calling code. This lets us remove two levels of indentation from the functions in question, making them more readable. Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 215 +++++++++++++------------- 1 file changed, 107 insertions(+), 108 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 3e79b66d0897..df7261c045fe 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -615,91 +615,90 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, struct xmit_priv *pxmitpriv = &padapter->xmitpriv; int res = _SUCCESS; + if (pattrib->encrypt != WLAN_CIPHER_SUITE_TKIP) + return _FAIL; + if (!pxmitframe->buf_addr) return _FAIL; hw_hdr_offset = TXDESC_OFFSET; pframe = pxmitframe->buf_addr + hw_hdr_offset; - /* 4 start to encrypt each fragment */ - if (pattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) { - if (pattrib->psta) - stainfo = pattrib->psta; - else { - DBG_8723A("%s, call rtw_get_stainfo()\n", __func__); - stainfo = rtw_get_stainfo23a(&padapter->stapriv, - &pattrib->ra[0]); - } - if (stainfo != NULL) { + if (pattrib->psta) + stainfo = pattrib->psta; + else { + DBG_8723A("%s, call rtw_get_stainfo()\n", __func__); + stainfo = rtw_get_stainfo23a(&padapter->stapriv, + &pattrib->ra[0]); + } - if (!(stainfo->state & _FW_LINKED)) { - DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); - return _FAIL; - } + if (stainfo == NULL) { + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_tkip_encrypt23a: stainfo == NULL!!!\n"); + DBG_8723A("%s, psta == NUL\n", __func__); + return _FAIL; + } - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_tkip_encrypt23a: stainfo!= NULL!!!\n"); + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_tkip_encrypt23a: stainfo!= NULL!!!\n"); - if (is_multicast_ether_addr(pattrib->ra)) - prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; - else - prwskey = &stainfo->dot118021x_UncstKey.skey[0]; + if (!(stainfo->state & _FW_LINKED)) { + DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); + return _FAIL; + } - prwskeylen = 16; + if (is_multicast_ether_addr(pattrib->ra)) + prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; + else + prwskey = &stainfo->dot118021x_UncstKey.skey[0]; - for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { - iv = pframe + pattrib->hdrlen; - payload = pframe + pattrib->iv_len + pattrib->hdrlen; + prwskeylen = 16; - GET_TKIP_PN(iv, dot11txpn); + /* 4 start to encrypt each fragment */ + for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { + iv = pframe + pattrib->hdrlen; + payload = pframe + pattrib->iv_len + pattrib->hdrlen; - pnl = (u16)(dot11txpn.val); - pnh = (u32)(dot11txpn.val>>16); + GET_TKIP_PN(iv, dot11txpn); - phase1((u16 *)&ttkey[0], prwskey, &pattrib->ta[0], pnh); + pnl = (u16)(dot11txpn.val); + pnh = (u32)(dot11txpn.val>>16); - phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0], pnl); + phase1((u16 *)&ttkey[0], prwskey, &pattrib->ta[0], pnh); - if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */ - length = (pattrib->last_txcmdsz - - pattrib->hdrlen - - pattrib->iv_len - - pattrib->icv_len); + phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0], pnl); - RT_TRACE(_module_rtl871x_security_c_, _drv_info_, - "pattrib->iv_len =%x, pattrib->icv_len =%x\n", - pattrib->iv_len, - pattrib->icv_len); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ + if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */ + length = (pattrib->last_txcmdsz - + pattrib->hdrlen - + pattrib->iv_len - + pattrib->icv_len); - arcfour_init(&mycontext, rc4key, 16); - arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + RT_TRACE(_module_rtl871x_security_c_, _drv_info_, + "pattrib->iv_len =%x, pattrib->icv_len =%x\n", + pattrib->iv_len, + pattrib->icv_len); + *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ - } else { - length = (pxmitpriv->frag_len - - pattrib->hdrlen - - pattrib->iv_len - - pattrib->icv_len); + arcfour_init(&mycontext, rc4key, 16); + arcfour_encrypt(&mycontext, payload, payload, length); + arcfour_encrypt(&mycontext, payload + length, crc, 4); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ - arcfour_init(&mycontext, rc4key, 16); - arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + } else { + length = (pxmitpriv->frag_len - + pattrib->hdrlen - + pattrib->iv_len - + pattrib->icv_len); - pframe += pxmitpriv->frag_len; - pframe = PTR_ALIGN(pframe, 4); - } - } + *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ + arcfour_init(&mycontext, rc4key, 16); + arcfour_encrypt(&mycontext, payload, payload, length); + arcfour_encrypt(&mycontext, payload + length, crc, 4); - } else { - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_tkip_encrypt23a: stainfo == NULL!!!\n"); - DBG_8723A("%s, psta == NUL\n", __func__); - res = _FAIL; + pframe += pxmitpriv->frag_len; + pframe = PTR_ALIGN(pframe, 4); } - } return res; @@ -725,64 +724,64 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, struct sk_buff *skb = precvframe->pkt; int res = _SUCCESS; + if (prxattrib->encrypt != WLAN_CIPHER_SUITE_TKIP) + return _FAIL; + pframe = skb->data; + stainfo = rtw_get_stainfo23a(&padapter->stapriv, + &prxattrib->ta[0]); + if (stainfo == NULL) { + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_tkip_decrypt23a: stainfo == NULL!!!\n"); + return _FAIL; + } + /* 4 start to decrypt recvframe */ - if (prxattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) { + if (is_multicast_ether_addr(prxattrib->ra)) { + if (psecuritypriv->binstallGrpkey == 0) { + res = _FAIL; + DBG_8723A("%s:rx bc/mc packets, but didn't install group key!!!!!!!!!!\n", __func__); + goto exit; + } + prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey; + prwskeylen = 16; + } else { + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_tkip_decrypt23a: stainfo!= NULL!!!\n"); + prwskey = &stainfo->dot118021x_UncstKey.skey[0]; + prwskeylen = 16; + } - stainfo = rtw_get_stainfo23a(&padapter->stapriv, - &prxattrib->ta[0]); - if (stainfo != NULL) { - - if (is_multicast_ether_addr(prxattrib->ra)) { - if (psecuritypriv->binstallGrpkey == 0) { - res = _FAIL; - DBG_8723A("%s:rx bc/mc packets, but didn't install group key!!!!!!!!!!\n", __func__); - goto exit; - } - prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey; - prwskeylen = 16; - } else { - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_tkip_decrypt23a: stainfo!= NULL!!!\n"); - prwskey = &stainfo->dot118021x_UncstKey.skey[0]; - prwskeylen = 16; - } + iv = pframe + prxattrib->hdrlen; + payload = pframe + prxattrib->iv_len + prxattrib->hdrlen; + length = skb->len - prxattrib->hdrlen - prxattrib->iv_len; - iv = pframe + prxattrib->hdrlen; - payload = pframe + prxattrib->iv_len + prxattrib->hdrlen; - length = skb->len - prxattrib->hdrlen - prxattrib->iv_len; + GET_TKIP_PN(iv, dot11txpn); - GET_TKIP_PN(iv, dot11txpn); + pnl = (u16)(dot11txpn.val); + pnh = (u32)(dot11txpn.val>>16); - pnl = (u16)(dot11txpn.val); - pnh = (u32)(dot11txpn.val>>16); + phase1((u16 *)&ttkey[0], prwskey, &prxattrib->ta[0], pnh); + phase2(&rc4key[0], prwskey, (unsigned short *)&ttkey[0], pnl); - phase1((u16 *)&ttkey[0], prwskey, &prxattrib->ta[0], pnh); - phase2(&rc4key[0], prwskey, (unsigned short *)&ttkey[0], pnl); + /* 4 decrypt payload include icv */ + arcfour_init(&mycontext, rc4key, 16); + arcfour_encrypt(&mycontext, payload, payload, length); - /* 4 decrypt payload include icv */ - arcfour_init(&mycontext, rc4key, 16); - arcfour_encrypt(&mycontext, payload, payload, length); + *((u32 *)crc) = le32_to_cpu(getcrc32(payload, length - 4)); - *((u32 *)crc) = le32_to_cpu(getcrc32(payload, length - 4)); - - if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] || crc[1] != payload[length - 3] || crc[0] != payload[length - 4]) - { - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n", - crc[3], payload[length - 1], - crc[2], payload[length - 2], - crc[1], payload[length - 3], - crc[0], payload[length - 4]); - res = _FAIL; - } - } else { - RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_tkip_decrypt23a: stainfo == NULL!!!\n"); - res = _FAIL; - } + if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] || crc[1] != payload[length - 3] || crc[0] != payload[length - 4]) + { + RT_TRACE(_module_rtl871x_security_c_, _drv_err_, + "rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n", + crc[3], payload[length - 1], + crc[2], payload[length - 2], + crc[1], payload[length - 3], + crc[0], payload[length - 4]); + res = _FAIL; } + exit: return res; } -- cgit v1.2.3 From 444c704321a6e97efbc16d252cbecb5897749221 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:49 -0400 Subject: staging: rtl8723au: else is not generally useful after a return Correct a checkpatch.pl warning regarding rtl8723au's rtw_security.c::crc32_init pointing out that having an else statement after a break or a return is not useful. drivers/staging/rtl8723au/core/rtw_security.c:105: WARNING: else is not generally useful after a break or return Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 42 ++++++++++++++------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index df7261c045fe..b85e5de5f136 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -99,31 +99,33 @@ static u8 crc32_reverseBit(u8 data) static void crc32_init(void) { + int i, j; + u32 c; + u8 *p, *p1; + u8 k; if (bcrc32initialized == 1) return; - else{ - int i, j; - u32 c; - u8 *p = (u8 *)&c, *p1; - u8 k; - - c = 0x12340000; - - for (i = 0; i < 256; ++i) { - k = crc32_reverseBit((u8)i); - for (c = ((u32)k) << 24, j = 8; j > 0; --j) { - c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : (c << 1); - } - p1 = (u8 *)&crc32_table[i]; - - p1[0] = crc32_reverseBit(p[3]); - p1[1] = crc32_reverseBit(p[2]); - p1[2] = crc32_reverseBit(p[1]); - p1[3] = crc32_reverseBit(p[0]); + + p = (u8 *) &c; + c = 0x12340000; + + for (i = 0; i < 256; ++i) { + k = crc32_reverseBit((u8)i); + + for (c = ((u32)k) << 24, j = 8; j > 0; --j) { + c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : (c << 1); } - bcrc32initialized = 1; + + p1 = (u8 *)&crc32_table[i]; + + p1[0] = crc32_reverseBit(p[3]); + p1[1] = crc32_reverseBit(p[2]); + p1[2] = crc32_reverseBit(p[1]); + p1[3] = crc32_reverseBit(p[0]); } + + bcrc32initialized = 1; } static u32 getcrc32(u8 *buf, int len) -- cgit v1.2.3 From 47b720a16cff11ba822000104bac7dcf6fa1cfbb Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:50 -0400 Subject: staging: rtl8723au: Remove unneeded curly braces Correct a number of checkpatch.pl warnings in rtl8723au's rtw_security.c related to the existence of unnecessary curly braces around single statement blocks: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index b85e5de5f136..e8efdcd06329 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -113,9 +113,8 @@ static void crc32_init(void) for (i = 0; i < 256; ++i) { k = crc32_reverseBit((u8)i); - for (c = ((u32)k) << 24, j = 8; j > 0; --j) { + for (c = ((u32)k) << 24, j = 8; j > 0; --j) c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : (c << 1); - } p1 = (u8 *)&crc32_table[i]; @@ -264,9 +263,8 @@ static u32 secmicgetuint32(u8 *p) s32 i; u32 res = 0; - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) res |= ((u32)(*p++)) << (8 * i); - } return res; } @@ -350,9 +348,8 @@ void rtw_secgetmic23a(struct mic_data *pmicdata, u8 *dst) rtw_secmicappend23abyte23a(pmicdata, 0); rtw_secmicappend23abyte23a(pmicdata, 0); /* and then zeroes until the length is a multiple of 4 */ - while (pmicdata->nBytesInM != 0) { + while (pmicdata->nBytesInM != 0) rtw_secmicappend23abyte23a(pmicdata, 0); - } /* The appendByte function has already computed the result. */ secmicputuint32(dst, pmicdata->L); secmicputuint32(dst + 4, pmicdata->R); @@ -888,10 +885,8 @@ static void byte_sub(u8 *in, u8 *out) { int i; - for (i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) out[i] = sbox(in[i]); - } - } static void shift_row(u8 *in, u8 *out) @@ -952,9 +947,8 @@ static void mix_column(u8 *in, u8 *out) for (i = 3; i > 0; i--) { /* logical shift left 1 bit */ andf7[i] = andf7[i] << 1; - if ((andf7[i - 1] & 0x80) == 0x80) { + if ((andf7[i - 1] & 0x80) == 0x80) andf7[i] = (andf7[i] | 0x01); - } } andf7[0] = andf7[0] << 1; andf7[0] = andf7[0] & 0xfe; -- cgit v1.2.3 From 06641b2a38447c2c446af5e6b1a15b06f7535433 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:51 -0400 Subject: staging: rtl8723au: trailing statements should be on next line Correct a number of checkpatch.pl errors in rtl8723au's rtw_security.c related to trailing statements: ERROR: trailing statements should be on next line Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index e8efdcd06329..63591ddeb628 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -132,7 +132,8 @@ static u32 getcrc32(u8 *buf, int len) u8 *p; u32 crc; - if (bcrc32initialized == 0) crc32_init(); + if (bcrc32initialized == 0) + crc32_init(); crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ @@ -556,8 +557,10 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) u16 PPK[6]; /* temporary key for mixing */ /* Note: all adds in the PPK[] equations below are mod 2**16 */ - for (i = 0; i < 5; i++) PPK[i] = p1k[i]; /* first, copy P1K to PPK */ - PPK[5] = p1k[4] + iv16; /* next, add in IV16 */ + for (i = 0; i < 5; i++) + PPK[i] = p1k[i]; /* first, copy P1K to PPK */ + + PPK[5] = p1k[4] + iv16; /* next, add in IV16 */ /* Bijective non-linear mixing of the 96 bits of PPK[0..5] */ PPK[0] += _S_(PPK[5] ^ TK16(0)); /* Mix key in each "round" */ @@ -977,7 +980,8 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) u8 intermediateb[16]; u8 round_key[16]; - for (i = 0; i < 16; i++) round_key[i] = key[i]; + for (i = 0; i < 16; i++) + round_key[i] = key[i]; for (round = 0; round < 11; round++) { if (round == 0) { @@ -1061,7 +1065,8 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, { int i; - for (i = 0; i < 16; i++) mic_header2[i] = 0x00; + for (i = 0; i < 16; i++) + mic_header2[i] = 0x00; mic_header2[0] = mpdu[16]; /* A3 */ mic_header2[1] = mpdu[17]; @@ -1074,7 +1079,8 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, mic_header2[7] = 0x00; /* mpdu[23]; */ if (!qc_exists && a4_exists) { - for (i = 0; i < 6; i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ + for (i = 0; i < 6; i++) + mic_header2[8+i] = mpdu[24+i]; /* A4 */ } if (qc_exists && !a4_exists) { @@ -1083,7 +1089,8 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, } if (qc_exists && a4_exists) { - for (i = 0; i < 6; i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ + for (i = 0; i < 6; i++) + mic_header2[8+i] = mpdu[24+i]; /* A4 */ mic_header2[14] = mpdu[30] & 0x0f; mic_header2[15] = mpdu[31] & 0x00; @@ -1101,7 +1108,9 @@ static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int qc_exists, { int i = 0; - for (i = 0; i < 16; i++) ctr_preload[i] = 0x00; + for (i = 0; i < 16; i++) + ctr_preload[i] = 0x00; + i = 0; ctr_preload[0] = 0x01; /* flag */ -- cgit v1.2.3 From 3104ebad91c15b9b3b17d28837b67f0a74088dbe Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:52 -0400 Subject: staging: rtl8723au: that open brace should be on the previous line Correct two instances of the checkpatch.pl error indicating that the opening curly braces should not be on new lines: ERROR: that open brace { should be on the previous line Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 63591ddeb628..2d50777b88fb 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -773,8 +773,10 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, *((u32 *)crc) = le32_to_cpu(getcrc32(payload, length - 4)); - if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] || crc[1] != payload[length - 3] || crc[0] != payload[length - 4]) - { + if (crc[3] != payload[length - 1] || + crc[2] != payload[length - 2] || + crc[1] != payload[length - 3] || + crc[0] != payload[length - 4]) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, "rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n", crc[3], payload[length - 1], @@ -862,8 +864,7 @@ static void next_key(u8 *key, int round) { u8 rcon; u8 sbox_key[4]; - u8 rcon_table[12] = - { + u8 rcon_table[12] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x36, 0x36 }; -- cgit v1.2.3 From 268523aa6a408f9b9ea04fdd8b344c2b5fbcf2e4 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:53 -0400 Subject: staging: rtl8723au: No spaces at the start of a line Prior to this commit, a large block of constants used to represent an AES S-box table were indented with spaces in rtl8723au's rtw_security.c. Correct the checkpatch.pl warnings indicating that spaces should not be used to indent lines: WARNING: please, no spaces at the start of a line Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 140 +++++++++++++------------- 1 file changed, 70 insertions(+), 70 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 2d50777b88fb..31ef1bce1e2a 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -414,76 +414,76 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, #define RC4_KEY_SIZE 16 /* 128-bit RC4KEY (104 bits unknown) */ /* 2-unsigned char by 2-unsigned char subset of the full AES S-box table */ -static const unsigned short Sbox1[2][256] = /* Sbox for hash (can be in ROM) */ -{ { - 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, - 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, - 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, - 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, - 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, - 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, - 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, - 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, - 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, - 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, - 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, - 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, - 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, - 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, - 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, - 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, - 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, - 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, - 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, - 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, - 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, - 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, - 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, - 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, - 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, - 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, - 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, - 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, - 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, - 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, - 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, - 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, - }, - - { /* second half of table is unsigned char-reversed version of first! */ - 0xA5C6, 0x84F8, 0x99EE, 0x8DF6, 0x0DFF, 0xBDD6, 0xB1DE, 0x5491, - 0x5060, 0x0302, 0xA9CE, 0x7D56, 0x19E7, 0x62B5, 0xE64D, 0x9AEC, - 0x458F, 0x9D1F, 0x4089, 0x87FA, 0x15EF, 0xEBB2, 0xC98E, 0x0BFB, - 0xEC41, 0x67B3, 0xFD5F, 0xEA45, 0xBF23, 0xF753, 0x96E4, 0x5B9B, - 0xC275, 0x1CE1, 0xAE3D, 0x6A4C, 0x5A6C, 0x417E, 0x02F5, 0x4F83, - 0x5C68, 0xF451, 0x34D1, 0x08F9, 0x93E2, 0x73AB, 0x5362, 0x3F2A, - 0x0C08, 0x5295, 0x6546, 0x5E9D, 0x2830, 0xA137, 0x0F0A, 0xB52F, - 0x090E, 0x3624, 0x9B1B, 0x3DDF, 0x26CD, 0x694E, 0xCD7F, 0x9FEA, - 0x1B12, 0x9E1D, 0x7458, 0x2E34, 0x2D36, 0xB2DC, 0xEEB4, 0xFB5B, - 0xF6A4, 0x4D76, 0x61B7, 0xCE7D, 0x7B52, 0x3EDD, 0x715E, 0x9713, - 0xF5A6, 0x68B9, 0x0000, 0x2CC1, 0x6040, 0x1FE3, 0xC879, 0xEDB6, - 0xBED4, 0x468D, 0xD967, 0x4B72, 0xDE94, 0xD498, 0xE8B0, 0x4A85, - 0x6BBB, 0x2AC5, 0xE54F, 0x16ED, 0xC586, 0xD79A, 0x5566, 0x9411, - 0xCF8A, 0x10E9, 0x0604, 0x81FE, 0xF0A0, 0x4478, 0xBA25, 0xE34B, - 0xF3A2, 0xFE5D, 0xC080, 0x8A05, 0xAD3F, 0xBC21, 0x4870, 0x04F1, - 0xDF63, 0xC177, 0x75AF, 0x6342, 0x3020, 0x1AE5, 0x0EFD, 0x6DBF, - 0x4C81, 0x1418, 0x3526, 0x2FC3, 0xE1BE, 0xA235, 0xCC88, 0x392E, - 0x5793, 0xF255, 0x82FC, 0x477A, 0xACC8, 0xE7BA, 0x2B32, 0x95E6, - 0xA0C0, 0x9819, 0xD19E, 0x7FA3, 0x6644, 0x7E54, 0xAB3B, 0x830B, - 0xCA8C, 0x29C7, 0xD36B, 0x3C28, 0x79A7, 0xE2BC, 0x1D16, 0x76AD, - 0x3BDB, 0x5664, 0x4E74, 0x1E14, 0xDB92, 0x0A0C, 0x6C48, 0xE4B8, - 0x5D9F, 0x6EBD, 0xEF43, 0xA6C4, 0xA839, 0xA431, 0x37D3, 0x8BF2, - 0x32D5, 0x438B, 0x596E, 0xB7DA, 0x8C01, 0x64B1, 0xD29C, 0xE049, - 0xB4D8, 0xFAAC, 0x07F3, 0x25CF, 0xAFCA, 0x8EF4, 0xE947, 0x1810, - 0xD56F, 0x88F0, 0x6F4A, 0x725C, 0x2438, 0xF157, 0xC773, 0x5197, - 0x23CB, 0x7CA1, 0x9CE8, 0x213E, 0xDD96, 0xDC61, 0x860D, 0x850F, - 0x90E0, 0x427C, 0xC471, 0xAACC, 0xD890, 0x0506, 0x01F7, 0x121C, - 0xA3C2, 0x5F6A, 0xF9AE, 0xD069, 0x9117, 0x5899, 0x273A, 0xB927, - 0x38D9, 0x13EB, 0xB32B, 0x3322, 0xBBD2, 0x70A9, 0x8907, 0xA733, - 0xB62D, 0x223C, 0x9215, 0x20C9, 0x4987, 0xFFAA, 0x7850, 0x7AA5, - 0x8F03, 0xF859, 0x8009, 0x171A, 0xDA65, 0x31D7, 0xC684, 0xB8D0, - 0xC382, 0xB029, 0x775A, 0x111E, 0xCB7B, 0xFCA8, 0xD66D, 0x3A2C, - } +static const unsigned short Sbox1[2][256] = { + /* Sbox for hash (can be in ROM) */ + { + 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, + 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, + 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, + 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, + 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, + 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, + 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, + 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, + 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, + 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, + 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, + 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, + 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, + 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, + 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, + 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, + 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, + 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, + 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, + 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, + 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, + 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, + 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, + 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, + 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, + 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, + 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, + 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, + 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, + 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, + 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, + 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, + }, + { /* second half of table is unsigned char-reversed version of first! */ + 0xA5C6, 0x84F8, 0x99EE, 0x8DF6, 0x0DFF, 0xBDD6, 0xB1DE, 0x5491, + 0x5060, 0x0302, 0xA9CE, 0x7D56, 0x19E7, 0x62B5, 0xE64D, 0x9AEC, + 0x458F, 0x9D1F, 0x4089, 0x87FA, 0x15EF, 0xEBB2, 0xC98E, 0x0BFB, + 0xEC41, 0x67B3, 0xFD5F, 0xEA45, 0xBF23, 0xF753, 0x96E4, 0x5B9B, + 0xC275, 0x1CE1, 0xAE3D, 0x6A4C, 0x5A6C, 0x417E, 0x02F5, 0x4F83, + 0x5C68, 0xF451, 0x34D1, 0x08F9, 0x93E2, 0x73AB, 0x5362, 0x3F2A, + 0x0C08, 0x5295, 0x6546, 0x5E9D, 0x2830, 0xA137, 0x0F0A, 0xB52F, + 0x090E, 0x3624, 0x9B1B, 0x3DDF, 0x26CD, 0x694E, 0xCD7F, 0x9FEA, + 0x1B12, 0x9E1D, 0x7458, 0x2E34, 0x2D36, 0xB2DC, 0xEEB4, 0xFB5B, + 0xF6A4, 0x4D76, 0x61B7, 0xCE7D, 0x7B52, 0x3EDD, 0x715E, 0x9713, + 0xF5A6, 0x68B9, 0x0000, 0x2CC1, 0x6040, 0x1FE3, 0xC879, 0xEDB6, + 0xBED4, 0x468D, 0xD967, 0x4B72, 0xDE94, 0xD498, 0xE8B0, 0x4A85, + 0x6BBB, 0x2AC5, 0xE54F, 0x16ED, 0xC586, 0xD79A, 0x5566, 0x9411, + 0xCF8A, 0x10E9, 0x0604, 0x81FE, 0xF0A0, 0x4478, 0xBA25, 0xE34B, + 0xF3A2, 0xFE5D, 0xC080, 0x8A05, 0xAD3F, 0xBC21, 0x4870, 0x04F1, + 0xDF63, 0xC177, 0x75AF, 0x6342, 0x3020, 0x1AE5, 0x0EFD, 0x6DBF, + 0x4C81, 0x1418, 0x3526, 0x2FC3, 0xE1BE, 0xA235, 0xCC88, 0x392E, + 0x5793, 0xF255, 0x82FC, 0x477A, 0xACC8, 0xE7BA, 0x2B32, 0x95E6, + 0xA0C0, 0x9819, 0xD19E, 0x7FA3, 0x6644, 0x7E54, 0xAB3B, 0x830B, + 0xCA8C, 0x29C7, 0xD36B, 0x3C28, 0x79A7, 0xE2BC, 0x1D16, 0x76AD, + 0x3BDB, 0x5664, 0x4E74, 0x1E14, 0xDB92, 0x0A0C, 0x6C48, 0xE4B8, + 0x5D9F, 0x6EBD, 0xEF43, 0xA6C4, 0xA839, 0xA431, 0x37D3, 0x8BF2, + 0x32D5, 0x438B, 0x596E, 0xB7DA, 0x8C01, 0x64B1, 0xD29C, 0xE049, + 0xB4D8, 0xFAAC, 0x07F3, 0x25CF, 0xAFCA, 0x8EF4, 0xE947, 0x1810, + 0xD56F, 0x88F0, 0x6F4A, 0x725C, 0x2438, 0xF157, 0xC773, 0x5197, + 0x23CB, 0x7CA1, 0x9CE8, 0x213E, 0xDD96, 0xDC61, 0x860D, 0x850F, + 0x90E0, 0x427C, 0xC471, 0xAACC, 0xD890, 0x0506, 0x01F7, 0x121C, + 0xA3C2, 0x5F6A, 0xF9AE, 0xD069, 0x9117, 0x5899, 0x273A, 0xB927, + 0x38D9, 0x13EB, 0xB32B, 0x3322, 0xBBD2, 0x70A9, 0x8907, 0xA733, + 0xB62D, 0x223C, 0x9215, 0x20C9, 0x4987, 0xFFAA, 0x7850, 0x7AA5, + 0x8F03, 0xF859, 0x8009, 0x171A, 0xDA65, 0x31D7, 0xC684, 0xB8D0, + 0xC382, 0xB029, 0x775A, 0x111E, 0xCB7B, 0xFCA8, 0xD66D, 0x3A2C, + } }; /* -- cgit v1.2.3 From 1d6b1ac0b654e5d94b6f92292a7047d33af44d2e Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:54 -0400 Subject: staging: rtl8723au: Adjust whitespace in and around comments As the subject indicates, adjust whitespace in and around comments in rtl8723au's rtw_security.c. Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 113 +++++++++++++------------- 1 file changed, 57 insertions(+), 56 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 31ef1bce1e2a..8e0e9fa0efdc 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -135,12 +135,12 @@ static u32 getcrc32(u8 *buf, int len) if (bcrc32initialized == 0) crc32_init(); - crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ + crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ for (p = buf; len > 0; ++p, --len) crc = crc32_table[(crc ^ *p) & 0xff] ^ (crc >> 8); - return ~crc; /* transmit complement, per CRC-32 spec */ + return ~crc; /* transmit complement, per CRC-32 spec */ } /* Need to consider the fragment situation */ @@ -152,7 +152,7 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter, struct arc4context mycontext; int curfragnum, length, index; u32 keylength; - u8 *pframe, *payload, *iv; /* wepkey */ + u8 *pframe, *payload, *iv; /* wepkey */ u8 wepkey[16]; u8 hw_hdr_offset = 0; struct pkt_attrib *pattrib = &pxmitframe->attrib; @@ -370,15 +370,15 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, priority[0] = pri; /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ - if (header[1]&1) { /* ToDS == 1 */ - rtw_secmicappend23a(&micdata, &header[16], 6); /* DA */ - if (header[1]&2) /* From Ds == 1 */ + if (header[1]&1) { /* ToDS == 1 */ + rtw_secmicappend23a(&micdata, &header[16], 6); /* DA */ + if (header[1]&2) /* From Ds == 1 */ rtw_secmicappend23a(&micdata, &header[24], 6); else rtw_secmicappend23a(&micdata, &header[10], 6); - } else { /* ToDS == 0 */ - rtw_secmicappend23a(&micdata, &header[4], 6); /* DA */ - if (header[1]&2) /* From Ds == 1 */ + } else { /* ToDS == 0 */ + rtw_secmicappend23a(&micdata, &header[4], 6); /* DA */ + if (header[1]&2) /* From Ds == 1 */ rtw_secmicappend23a(&micdata, &header[16], 6); else rtw_secmicappend23a(&micdata, &header[10], 6); @@ -400,7 +400,7 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, #define Hi16(v32) ((u16)(((v32) >> 16) & 0xFFFF)) #define Mk16(hi, lo) ((lo) ^ (((u16)(hi)) << 8)) -/* select the Nth 16-bit word of the temporal key unsigned char array TK[] */ +/* select the Nth 16-bit word of the temporal key unsigned char array TK[] */ #define TK16(N) Mk16(tk[2 * (N) + 1], tk[2 * (N)]) /* S-box lookup: 16 bits --> 16 bits */ @@ -507,7 +507,7 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) { int i; - /* Initialize the 80 bits of P1K[] from IV32 and TA[0..5] */ + /* Initialize the 80 bits of P1K[] from IV32 and TA[0..5] */ p1k[0] = Lo16(iv32); p1k[1] = Hi16(iv32); p1k[2] = Mk16(ta[1], ta[0]); /* use TA[] as little-endian */ @@ -523,7 +523,7 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) p1k[2] += _S_(p1k[1] ^ TK16((i & 1) + 4)); p1k[3] += _S_(p1k[2] ^ TK16((i & 1) + 6)); p1k[4] += _S_(p1k[3] ^ TK16((i & 1) + 0)); - p1k[4] += (unsigned short)i; /* avoid "slide attacks" */ + p1k[4] += (unsigned short) i; /* avoid "slide attacks" */ } } @@ -554,41 +554,41 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) { int i; - u16 PPK[6]; /* temporary key for mixing */ + u16 PPK[6]; /* temporary key for mixing */ - /* Note: all adds in the PPK[] equations below are mod 2**16 */ + /* Note: all adds in the PPK[] equations below are mod 2**16 */ for (i = 0; i < 5; i++) - PPK[i] = p1k[i]; /* first, copy P1K to PPK */ + PPK[i] = p1k[i]; /* first, copy P1K to PPK */ - PPK[5] = p1k[4] + iv16; /* next, add in IV16 */ + PPK[5] = p1k[4] + iv16; /* next, add in IV16 */ - /* Bijective non-linear mixing of the 96 bits of PPK[0..5] */ - PPK[0] += _S_(PPK[5] ^ TK16(0)); /* Mix key in each "round" */ - PPK[1] += _S_(PPK[0] ^ TK16(1)); - PPK[2] += _S_(PPK[1] ^ TK16(2)); - PPK[3] += _S_(PPK[2] ^ TK16(3)); - PPK[4] += _S_(PPK[3] ^ TK16(4)); - PPK[5] += _S_(PPK[4] ^ TK16(5)); /* Total # S-box lookups == 6 */ + /* Bijective non-linear mixing of the 96 bits of PPK[0..5] */ + PPK[0] += _S_(PPK[5] ^ TK16(0)); /* Mix key in each "round" */ + PPK[1] += _S_(PPK[0] ^ TK16(1)); + PPK[2] += _S_(PPK[1] ^ TK16(2)); + PPK[3] += _S_(PPK[2] ^ TK16(3)); + PPK[4] += _S_(PPK[3] ^ TK16(4)); + PPK[5] += _S_(PPK[4] ^ TK16(5)); /* Total # S-box lookups == 6 */ - /* Final sweep: bijective, "linear". Rotates kill LSB correlations */ + /* Final sweep: bijective, "linear". Rotates kill LSB correlations */ PPK[0] += RotR1(PPK[5] ^ TK16(6)); - PPK[1] += RotR1(PPK[0] ^ TK16(7)); /* Use all of TK[] in Phase2 */ + PPK[1] += RotR1(PPK[0] ^ TK16(7)); /* Use all of TK[] in Phase2 */ PPK[2] += RotR1(PPK[1]); PPK[3] += RotR1(PPK[2]); PPK[4] += RotR1(PPK[3]); PPK[5] += RotR1(PPK[4]); /* Note: At this point, for a given key TK[0..15], the 96-bit output */ /* value PPK[0..5] is guaranteed to be unique, as a function */ - /* of the 96-bit "input" value {TA, IV32, IV16}. That is, P1K */ - /* is now a keyed permutation of {TA, IV32, IV16}. */ + /* of the 96-bit "input" value {TA, IV32, IV16}. That is, */ + /* P1K is now a keyed permutation of {TA, IV32, IV16}. */ /* Set RC4KEY[0..3], which includes "cleartext" portion of RC4 key */ - rc4key[0] = Hi8(iv16); /* RC4KEY[0..2] is the WEP IV */ - rc4key[1] = (Hi8(iv16) | 0x20) & 0x7F; /* Help avoid weak (FMS) keys */ + rc4key[0] = Hi8(iv16); /* RC4KEY[0..2] is the WEP IV */ + rc4key[1] = (Hi8(iv16) | 0x20) & 0x7F; /* Help avoid weak (FMS) keys */ rc4key[2] = Lo8(iv16); rc4key[3] = Lo8((PPK[5] ^ TK16(0)) >> 1); - /* Copy 96 bits of PPK[0..5] to RC4KEY[4..15] (little-endian) */ + /* Copy 96 bits of PPK[0..5] to RC4KEY[4..15] (little-endian) */ for (i = 0; i < 6; i++) { rc4key[4 + 2 * i] = Lo8(PPK[i]); rc4key[5 + 2 * i] = Hi8(PPK[i]); @@ -671,7 +671,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0], pnl); - if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */ + if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */ length = (pattrib->last_txcmdsz - pattrib->hdrlen - pattrib->iv_len - @@ -681,7 +681,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, "pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len, pattrib->icv_len); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ + *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); /* modified by Amy */ arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); @@ -693,7 +693,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, pattrib->iv_len - pattrib->icv_len); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ + *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); /* modified by Amy */ arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload + length, crc, 4); @@ -934,12 +934,12 @@ static void mix_column(u8 *in, u8 *out) add1b[i] = 0x00; } - swap_halfs[0] = in[2]; /* Swap halfs */ + swap_halfs[0] = in[2]; /* Swap halfs */ swap_halfs[1] = in[3]; swap_halfs[2] = in[0]; swap_halfs[3] = in[1]; - rotl[0] = in[3]; /* Rotate left 8 bits */ + rotl[0] = in[3]; /* Rotate left 8 bits */ rotl[1] = in[0]; rotl[2] = in[1]; rotl[3] = in[2]; @@ -961,7 +961,7 @@ static void mix_column(u8 *in, u8 *out) xor_32(in, add1bf7, rotr); - temp[0] = rotr[0]; /* Rotate right 8 bits */ + temp[0] = rotr[0]; /* Rotate right 8 bits */ rotr[0] = rotr[1]; rotr[1] = rotr[2]; rotr[2] = rotr[3]; @@ -1017,9 +1017,9 @@ static void construct_mic_iv(u8 *mic_iv, int qc_exists, int a4_exists, u8 *mpdu, mic_iv[0] = 0x59; if (qc_exists && a4_exists) - mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ + mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ if (qc_exists && !a4_exists) - mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ + mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ if (!qc_exists) mic_iv[1] = 0x00; for (i = 2; i < 8; i++) @@ -1039,15 +1039,15 @@ static void construct_mic_header1(u8 *mic_header1, int header_length, u8 *mpdu) { mic_header1[0] = (u8)((header_length - 2) / 256); mic_header1[1] = (u8)((header_length - 2) % 256); - mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ - mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ - mic_header1[4] = mpdu[4]; /* A1 */ + mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ + mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ + mic_header1[4] = mpdu[4]; /* A1 */ mic_header1[5] = mpdu[5]; mic_header1[6] = mpdu[6]; mic_header1[7] = mpdu[7]; mic_header1[8] = mpdu[8]; mic_header1[9] = mpdu[9]; - mic_header1[10] = mpdu[10]; /* A2 */ + mic_header1[10] = mpdu[10]; /* A2 */ mic_header1[11] = mpdu[11]; mic_header1[12] = mpdu[12]; mic_header1[13] = mpdu[13]; @@ -1057,7 +1057,7 @@ static void construct_mic_header1(u8 *mic_header1, int header_length, u8 *mpdu) } /************************************************/ - /* construct_mic_header2() */ +/* construct_mic_header2() */ /* Builds the last MIC header block from */ /* header fields. */ /************************************************/ @@ -1069,7 +1069,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, for (i = 0; i < 16; i++) mic_header2[i] = 0x00; - mic_header2[0] = mpdu[16]; /* A3 */ + mic_header2[0] = mpdu[16]; /* A3 */ mic_header2[1] = mpdu[17]; mic_header2[2] = mpdu[18]; mic_header2[3] = mpdu[19]; @@ -1081,7 +1081,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, if (!qc_exists && a4_exists) { for (i = 0; i < 6; i++) - mic_header2[8+i] = mpdu[24+i]; /* A4 */ + mic_header2[8+i] = mpdu[24+i]; /* A4 */ } if (qc_exists && !a4_exists) { @@ -1091,7 +1091,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, if (qc_exists && a4_exists) { for (i = 0; i < 6; i++) - mic_header2[8+i] = mpdu[24+i]; /* A4 */ + mic_header2[8+i] = mpdu[24+i]; /* A4 */ mic_header2[14] = mpdu[30] & 0x0f; mic_header2[15] = mpdu[31] & 0x00; @@ -1114,16 +1114,16 @@ static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int qc_exists, i = 0; - ctr_preload[0] = 0x01; /* flag */ + ctr_preload[0] = 0x01; /* flag */ if (qc_exists && a4_exists) - ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ + ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ if (qc_exists && !a4_exists) ctr_preload[1] = mpdu[24] & 0x0f; for (i = 2; i < 8; i++) - ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ + ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ for (i = 8; i < 14; i++) - ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ + ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */ ctr_preload[15] = (unsigned char) (c % 256); @@ -1287,11 +1287,11 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) int rtw_aes_encrypt23a(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe) -{ /* exclude ICV */ +{ /* exclude ICV */ /* Intermediate Buffers */ int curfragnum, length; u32 prwskeylen; - u8 *pframe, *prwskey; /* *payload,*iv */ + u8 *pframe, *prwskey; /* *payload, *iv */ u8 hw_hdr_offset = 0; struct sta_info *stainfo; struct pkt_attrib *pattrib = &pxmitframe->attrib; @@ -1427,7 +1427,7 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) qc_exists = 0; } - /* now, decrypt pframe with hdrlen offset and plen long */ + /* now, decrypt pframe with hdrlen offset and plen long */ payload_index = hdrlen + 8; /* 8 is for extiv */ @@ -1577,7 +1577,7 @@ int rtw_aes_decrypt23a(struct rtw_adapter *padapter, struct security_priv *psecuritypriv = &padapter->securitypriv; struct sk_buff *skb = precvframe->pkt; int length; - u8 *pframe, *prwskey; /* *payload,*iv */ + u8 *pframe, *prwskey; /* *payload, *iv */ int res = _SUCCESS; pframe = skb->data; @@ -1597,8 +1597,9 @@ int rtw_aes_decrypt23a(struct rtw_adapter *padapter, "rtw_aes_decrypt23a: stainfo!= NULL!!!\n"); if (is_multicast_ether_addr(prxattrib->ra)) { - /* in concurrent we should use sw decrypt in group key, - so we remove this message */ + /* in concurrent we should use sw decrypt in + * group key, so we remove this message + */ if (!psecuritypriv->binstallGrpkey) { res = _FAIL; DBG_8723A("%s:rx bc/mc packets, but didn't install " -- cgit v1.2.3 From 046ca5f7e10c476a6fd762c1561cc07f259f97a8 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:55 -0400 Subject: staging: rtl8723au: suspect code indent for conditional statements Correct a number of indentation-with-spaces-and-tabs issues in rtl8723au's rtw_security.c, according to checkpatch.pl: WARNING: suspect code indent for conditional statements Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 8e0e9fa0efdc..bcb5ea68acbe 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -929,9 +929,9 @@ static void mix_column(u8 *in, u8 *out) for (i = 0; i < 4; i++) { if ((in[i] & 0x80) == 0x80) - add1b[i] = 0x1b; + add1b[i] = 0x1b; else - add1b[i] = 0x00; + add1b[i] = 0x00; } swap_halfs[0] = in[2]; /* Swap halfs */ @@ -986,21 +986,21 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) for (round = 0; round < 11; round++) { if (round == 0) { - xor_128(round_key, data, ciphertext); - next_key(round_key, round); + xor_128(round_key, data, ciphertext); + next_key(round_key, round); } else if (round == 10) { - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - xor_128(intermediateb, round_key, ciphertext); + byte_sub(ciphertext, intermediatea); + shift_row(intermediatea, intermediateb); + xor_128(intermediateb, round_key, ciphertext); } else { /* 1 - 9 */ - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - mix_column(&intermediateb[0], &intermediatea[0]); - mix_column(&intermediateb[4], &intermediatea[4]); - mix_column(&intermediateb[8], &intermediatea[8]); - mix_column(&intermediateb[12], &intermediatea[12]); - xor_128(intermediatea, round_key, ciphertext); - next_key(round_key, round); + byte_sub(ciphertext, intermediatea); + shift_row(intermediatea, intermediateb); + mix_column(&intermediateb[0], &intermediatea[0]); + mix_column(&intermediateb[4], &intermediatea[4]); + mix_column(&intermediateb[8], &intermediatea[8]); + mix_column(&intermediateb[12], &intermediatea[12]); + xor_128(intermediatea, round_key, ciphertext); + next_key(round_key, round); } } @@ -1501,7 +1501,7 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) - padded_buffer[j] = message[payload_index++]; + padded_buffer[j] = message[payload_index++]; bitwise_xor(aes_out, padded_buffer, chain_buffer); aes128k128d(key, chain_buffer, aes_out); } @@ -1531,7 +1531,7 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) message, pn_vector, num_blocks + 1); for (j = 0; j < 16; j++) - padded_buffer[j] = 0x00; + padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) padded_buffer[j] = message[payload_index + j]; aes128k128d(key, ctr_preload, aes_out); -- cgit v1.2.3 From 87a432944f13b408167208dc509a8af62c66312c Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:56 -0400 Subject: staging: rtl8723au: Rework two byte array comparisons Prior to this commit, rtl8723au's rtw_security.c had two instances of byte array comparisons (for CRC checks) where the individual elements of the byte arrays were compared one by one and an error trace would be output if the byte arrays were determined to be different. This commit improves the readability of the CRC verification by placing the individual 4 bytes of each byte array into an 32-bit unsigned integer and comparing the two resulting integers. Thanks to Larry Finger for spotting the code style issues in the previous version of this commit, and thanks to Joe Perches for suggesting the use of 32-bit integer comparisons instead of byte array comparisons. Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 34 +++++++++++---------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index bcb5ea68acbe..0ed048fcb36f 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -210,7 +210,7 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter, struct recv_frame *precvframe) { /* exclude ICV */ - u8 crc[4]; + u32 actual_crc, expected_crc; struct arc4context mycontext; int length; u32 keylength; @@ -243,16 +243,14 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter, arcfour_encrypt(&mycontext, payload, payload, length); /* calculate icv and compare the icv */ - *((u32 *)crc) = le32_to_cpu(getcrc32(payload, length - 4)); + actual_crc = le32_to_cpu(getcrc32(payload, length - 4)); + expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4])); - if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] || - crc[1] != payload[length - 3] || crc[0] != payload[length - 4]) { + if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n", - crc[3], payload[length - 1], - crc[2], payload[length - 2], - crc[1], payload[length - 3], - crc[0], payload[length - 4]); + "rtw_wep_decrypt23a:icv CRC mismatch: " + "actual: %08x, expected: %08x\n", + actual_crc, expected_crc); } } @@ -714,7 +712,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, u32 pnh; u8 rc4key[16]; u8 ttkey[16]; - u8 crc[4]; + u32 actual_crc, expected_crc; struct arc4context mycontext; int length; u32 prwskeylen; @@ -771,18 +769,14 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - *((u32 *)crc) = le32_to_cpu(getcrc32(payload, length - 4)); + actual_crc = le32_to_cpu(getcrc32(payload, length - 4)); + expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4])); - if (crc[3] != payload[length - 1] || - crc[2] != payload[length - 2] || - crc[1] != payload[length - 3] || - crc[0] != payload[length - 4]) { + if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n", - crc[3], payload[length - 1], - crc[2], payload[length - 2], - crc[1], payload[length - 3], - crc[0], payload[length - 4]); + "rtw_wep_decrypt23a:icv CRC mismatch: " + "actual: %08x, expected: %08x\n", + actual_crc, expected_crc); res = _FAIL; } -- cgit v1.2.3 From 58b39a90977c3ac067895c87c3940132f6adc1c4 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:57 -0400 Subject: staging: rtl8723au: Use __func__ in trace logs Rework the trace log-related lines in rtl8723au's rtw_security.c to use the __func__ GCC magic variable instead of hardcoding the function names into the trace log strings. This also corrects a copy-paste-related typo in the function named rtw_tkip_decrypt23a. Thanks to Jes Sorensen for the suggestion to use __func__. Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 41 ++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 0ed048fcb36f..5ef16bb30dc4 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -248,9 +248,9 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter, if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_wep_decrypt23a:icv CRC mismatch: " + "%s:icv CRC mismatch: " "actual: %08x, expected: %08x\n", - actual_crc, expected_crc); + __func__, actual_crc, expected_crc); } } @@ -635,13 +635,13 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, if (stainfo == NULL) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_tkip_encrypt23a: stainfo == NULL!!!\n"); + "%s: stainfo == NULL!!!\n", __func__); DBG_8723A("%s, psta == NUL\n", __func__); return _FAIL; } RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_tkip_encrypt23a: stainfo!= NULL!!!\n"); + "%s: stainfo!= NULL!!!\n", __func__); if (!(stainfo->state & _FW_LINKED)) { DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); @@ -733,7 +733,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, &prxattrib->ta[0]); if (stainfo == NULL) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_tkip_decrypt23a: stainfo == NULL!!!\n"); + "%s: stainfo == NULL!!!\n", __func__); return _FAIL; } @@ -748,7 +748,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, prwskeylen = 16; } else { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_tkip_decrypt23a: stainfo!= NULL!!!\n"); + "%s: stainfo!= NULL!!!\n", __func__); prwskey = &stainfo->dot118021x_UncstKey.skey[0]; prwskeylen = 16; } @@ -774,9 +774,9 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_wep_decrypt23a:icv CRC mismatch: " + "%s:icv CRC mismatch: " "actual: %08x, expected: %08x\n", - actual_crc, expected_crc); + __func__, actual_crc, expected_crc); res = _FAIL; } @@ -1313,7 +1313,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter, if (!stainfo) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_aes_encrypt23a: stainfo == NULL!!!\n"); + "%s: stainfo == NULL!!!\n", __func__); DBG_8723A("%s, psta == NUL\n", __func__); res = _FAIL; goto out; @@ -1324,7 +1324,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter, return _FAIL; } RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_aes_encrypt23a: stainfo!= NULL!!!\n"); + "%s: stainfo!= NULL!!!\n", __func__); if (is_multicast_ether_addr(pattrib->ra)) prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; @@ -1552,11 +1552,14 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) for (i = 0; i < 8; i++) { if (pframe[hdrlen + 8 + plen - 8 + i] != message[hdrlen + 8 + plen - 8 + i]) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n", - i, pframe[hdrlen + 8 + plen - 8 + i], + "%s:mic check error mic[%d]: pframe(%x) != message(%x)\n", + __func__, i, + pframe[hdrlen + 8 + plen - 8 + i], message[hdrlen + 8 + plen - 8 + i]); - DBG_8723A("aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n", - i, pframe[hdrlen + 8 + plen - 8 + i], message[hdrlen + 8 + plen - 8 + i]); + DBG_8723A("%s:mic check error mic[%d]: pframe(%x) != message(%x)\n", + __func__, i, + pframe[hdrlen + 8 + plen - 8 + i], + message[hdrlen + 8 + plen - 8 + i]); res = _FAIL; } } @@ -1582,13 +1585,13 @@ int rtw_aes_decrypt23a(struct rtw_adapter *padapter, stainfo = rtw_get_stainfo23a(&padapter->stapriv, &prxattrib->ta[0]); if (!stainfo) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_aes_encrypt23a: stainfo == NULL!!!\n"); + "%s: stainfo == NULL!!!\n", __func__); res = _FAIL; goto exit; } RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "rtw_aes_decrypt23a: stainfo!= NULL!!!\n"); + "%s: stainfo!= NULL!!!\n", __func__); if (is_multicast_ether_addr(prxattrib->ra)) { /* in concurrent we should use sw decrypt in @@ -1624,9 +1627,9 @@ void rtw_use_tkipkey_handler23a(void *FunctionContext) struct rtw_adapter *padapter = (struct rtw_adapter *)FunctionContext; RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "^^^rtw_use_tkipkey_handler23a ^^^\n"); + "^^^%s ^^^\n", __func__); padapter->securitypriv.busetkipkey = 1; RT_TRACE(_module_rtl871x_security_c_, _drv_err_, - "^^^rtw_use_tkipkey_handler23a padapter->securitypriv.busetkipkey =%d^^^\n", - padapter->securitypriv.busetkipkey); + "^^^%s padapter->securitypriv.busetkipkey =%d^^^\n", + __func__, padapter->securitypriv.busetkipkey); } -- cgit v1.2.3 From 28eb1f3b640f793371a7cac599f3ac0f89f63b54 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Sat, 28 Mar 2015 21:07:58 -0400 Subject: staging: rtl8723au: Remove unneeded comments This commit removes a number of unneeded comments. Two of the aforementioned comments were most likely meant to aid with version control, whereas the remaining two comments relate to (now unused) local variable names. Signed-off-by: M. Vefa Bicakci Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_security.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 5ef16bb30dc4..af53c92fc3a2 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -679,7 +679,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, "pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len, pattrib->icv_len); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); /* modified by Amy */ + *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); @@ -691,7 +691,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, pattrib->iv_len - pattrib->icv_len); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); /* modified by Amy */ + *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload + length, crc, 4); @@ -1285,7 +1285,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter, /* Intermediate Buffers */ int curfragnum, length; u32 prwskeylen; - u8 *pframe, *prwskey; /* *payload, *iv */ + u8 *pframe, *prwskey; u8 hw_hdr_offset = 0; struct sta_info *stainfo; struct pkt_attrib *pattrib = &pxmitframe->attrib; @@ -1574,7 +1574,7 @@ int rtw_aes_decrypt23a(struct rtw_adapter *padapter, struct security_priv *psecuritypriv = &padapter->securitypriv; struct sk_buff *skb = precvframe->pkt; int length; - u8 *pframe, *prwskey; /* *payload, *iv */ + u8 *pframe, *prwskey; int res = _SUCCESS; pframe = skb->data; -- cgit v1.2.3 From 285b7c00e06b4fdd6e9ac63b9b8082508340f1ab Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:26 +0200 Subject: staging: rtl8192e: Fix UNNECESSARY_ELSE warning Fix checkpatch warnings 'else is not generally useful after a break or return' Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 72 +++--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 10 +- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 7 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 213 ++++++++--------- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 307 ++++++++++++------------- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 9 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 24 +- drivers/staging/rtl8192e/rtl819x_HTProc.c | 31 ++- drivers/staging/rtl8192e/rtl819x_TSProc.c | 120 +++++----- drivers/staging/rtl8192e/rtllib_rx.c | 118 +++++----- drivers/staging/rtl8192e/rtllib_softmac.c | 11 +- drivers/staging/rtl8192e/rtllib_tx.c | 78 ++++--- 12 files changed, 482 insertions(+), 518 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 170ff12c450a..9222e421f123 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2025,6 +2025,7 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); + struct rx_fwinfo *pDrvInfo = NULL; stats->bICV = pdesc->ICV; stats->bCRC = pdesc->CRC32; @@ -2046,51 +2047,49 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev, priv->stats.rxcrcerrmid++; } return false; - } else { - struct rx_fwinfo *pDrvInfo = NULL; + } - stats->RxDrvInfoSize = pdesc->RxDrvInfoSize; - stats->RxBufShift = ((pdesc->Shift)&0x03); - stats->Decrypted = !pdesc->SWDec; + stats->RxDrvInfoSize = pdesc->RxDrvInfoSize; + stats->RxBufShift = ((pdesc->Shift)&0x03); + stats->Decrypted = !pdesc->SWDec; - pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift); + pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift); - stats->rate = HwRateToMRate90((bool)pDrvInfo->RxHT, - (u8)pDrvInfo->RxRate); - stats->bShortPreamble = pDrvInfo->SPLCP; + stats->rate = HwRateToMRate90((bool)pDrvInfo->RxHT, + (u8)pDrvInfo->RxRate); + stats->bShortPreamble = pDrvInfo->SPLCP; - rtl8192_UpdateReceivedRateHistogramStatistics(dev, stats); + rtl8192_UpdateReceivedRateHistogramStatistics(dev, stats); - stats->bIsAMPDU = (pDrvInfo->PartAggr == 1); - stats->bFirstMPDU = (pDrvInfo->PartAggr == 1) && - (pDrvInfo->FirstAGGR == 1); + stats->bIsAMPDU = (pDrvInfo->PartAggr == 1); + stats->bFirstMPDU = (pDrvInfo->PartAggr == 1) && + (pDrvInfo->FirstAGGR == 1); - stats->TimeStampLow = pDrvInfo->TSFL; - stats->TimeStampHigh = read_nic_dword(dev, TSFR+4); + stats->TimeStampLow = pDrvInfo->TSFL; + stats->TimeStampHigh = read_nic_dword(dev, TSFR+4); - rtl819x_UpdateRxPktTimeStamp(dev, stats); + rtl819x_UpdateRxPktTimeStamp(dev, stats); - if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0) - stats->bShift = 1; + if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0) + stats->bShift = 1; - stats->RxIs40MHzPacket = pDrvInfo->BW; + stats->RxIs40MHzPacket = pDrvInfo->BW; - rtl8192_TranslateRxSignalStuff(dev, skb, stats, pdesc, - pDrvInfo); + rtl8192_TranslateRxSignalStuff(dev, skb, stats, pdesc, + pDrvInfo); - if (pDrvInfo->FirstAGGR == 1 || pDrvInfo->PartAggr == 1) - RT_TRACE(COMP_RXDESC, - "pDrvInfo->FirstAGGR = %d, pDrvInfo->PartAggr = %d\n", - pDrvInfo->FirstAGGR, pDrvInfo->PartAggr); - skb_trim(skb, skb->len - 4/*sCrcLng*/); + if (pDrvInfo->FirstAGGR == 1 || pDrvInfo->PartAggr == 1) + RT_TRACE(COMP_RXDESC, + "pDrvInfo->FirstAGGR = %d, pDrvInfo->PartAggr = %d\n", + pDrvInfo->FirstAGGR, pDrvInfo->PartAggr); + skb_trim(skb, skb->len - 4/*sCrcLng*/); - stats->packetlength = stats->Length-4; - stats->fraglength = stats->packetlength; - stats->fragoffset = 0; - stats->ntotalfrag = 1; - return true; - } + stats->packetlength = stats->Length-4; + stats->fraglength = stats->packetlength; + stats->fragoffset = 0; + stats->ntotalfrag = 1; + return true; } void rtl8192_halt_adapter(struct net_device *dev, bool reset) @@ -2314,8 +2313,7 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev) (priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_20M)))) { if (rx_chk_cnt < 2) return bStuck; - else - rx_chk_cnt = 0; + rx_chk_cnt = 0; } else if ((((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) && (priv->undecorated_smoothed_pwdb < RateAdaptiveTH_Low_40M)) || ((priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) && @@ -2323,13 +2321,11 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev) priv->undecorated_smoothed_pwdb >= VeryLowRSSI) { if (rx_chk_cnt < 4) return bStuck; - else - rx_chk_cnt = 0; + rx_chk_cnt = 0; } else { if (rx_chk_cnt < 8) return bStuck; - else - rx_chk_cnt = 0; + rx_chk_cnt = 0; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 1d9b7a17cbde..312979f8fd7e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -940,13 +940,11 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, } if (CurrentCmd && CurrentCmd->CmdID == CmdID_End) { - if ((*stage) == 2) { + if ((*stage) == 2) return true; - } else { - (*stage)++; - (*step) = 0; - continue; - } + (*stage)++; + (*step) = 0; + continue; } if (!CurrentCmd) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 8b5f6085697e..41b025e250fe 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -116,11 +116,10 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", __func__); return; - } else { - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); } + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); } } priv->rtllib->is_set_key = true; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index bcf7a9d822e2..5f3e28b22d7c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -204,19 +204,18 @@ u8 read_nic_io_byte(struct net_device *dev, int x) bool bIsLegalPage = false; u8 Data = 0; - if (u4bPage == 0) { + if (u4bPage == 0) return 0xff&inb(dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_byte(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - } + bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, + &u1PageMask); + if (bIsLegalPage) { + u8 u1bPsr = read_nic_io_byte(dev, PSR); + + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); + Data = read_nic_io_byte(dev, (x & 0xff)); + write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); } return Data; @@ -229,20 +228,17 @@ u16 read_nic_io_word(struct net_device *dev, int x) bool bIsLegalPage = false; u16 Data = 0; - if (u4bPage == 0) { + if (u4bPage == 0) return inw(dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); + bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, + &u1PageMask); + if (bIsLegalPage) { + u8 u1bPsr = read_nic_io_byte(dev, PSR); - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_word(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - - } + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); + Data = read_nic_io_word(dev, (x & 0xff)); + write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); } return Data; @@ -255,20 +251,17 @@ u32 read_nic_io_dword(struct net_device *dev, int x) bool bIsLegalPage = false; u32 Data = 0; - if (u4bPage == 0) { + if (u4bPage == 0) return inl(dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_dword(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); + bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, + &u1PageMask); + if (bIsLegalPage) { + u8 u1bPsr = read_nic_io_byte(dev, PSR); - } + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); + Data = read_nic_io_dword(dev, (x & 0xff)); + write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); } return Data; @@ -1331,11 +1324,11 @@ static short rtl8192_init(struct net_device *dev) dev->name, dev)) { netdev_err(dev, "Error allocating IRQ %d", dev->irq); return -1; - } else { - priv->irq = dev->irq; - RT_TRACE(COMP_INIT, "IRQ %d\n", dev->irq); } + priv->irq = dev->irq; + RT_TRACE(COMP_INIT, "IRQ %d\n", dev->irq); + if (rtl8192_pci_initdescring(dev) != 0) { netdev_err(dev, "Endopoints initialization failed"); free_irq(dev->irq, dev); @@ -1932,17 +1925,16 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (queue_index == TXCMD_QUEUE) { rtl8192_tx_cmd(dev, skb); return 0; - } else { - tcb_desc->RATRIndex = 7; - tcb_desc->bTxDisableRateFallBack = 1; - tcb_desc->bTxUseDriverAssingedRate = 1; - tcb_desc->bTxEnableFwCalcDur = 1; - skb_push(skb, priv->rtllib->tx_headroom); - ret = rtl8192_tx(dev, skb); - if (ret != 0) - kfree_skb(skb); } + tcb_desc->RATRIndex = 7; + tcb_desc->bTxDisableRateFallBack = 1; + tcb_desc->bTxUseDriverAssingedRate = 1; + tcb_desc->bTxEnableFwCalcDur = 1; + skb_push(skb, priv->rtllib->tx_headroom); + ret = rtl8192_tx(dev, skb); + if (ret != 0) + kfree_skb(skb); return ret; } @@ -2338,76 +2330,73 @@ static void rtl8192_rx_normal(struct net_device *dev) [priv->rx_idx[rx_queue_idx]]; struct sk_buff *skb = priv->rx_buf[rx_queue_idx] [priv->rx_idx[rx_queue_idx]]; + struct sk_buff *new_skb; - if (pdesc->OWN) { + if (pdesc->OWN) return; - } else { - struct sk_buff *new_skb; - - if (!priv->ops->rx_query_status_descriptor(dev, &stats, - pdesc, skb)) - goto done; - new_skb = dev_alloc_skb(priv->rxbuffersize); - /* if allocation of new skb failed - drop current packet - * and reuse skb */ - if (unlikely(!new_skb)) - goto done; - - pci_unmap_single(priv->pdev, - *((dma_addr_t *)skb->cb), - priv->rxbuffersize, - PCI_DMA_FROMDEVICE); - - skb_put(skb, pdesc->Length); - skb_reserve(skb, stats.RxDrvInfoSize + - stats.RxBufShift); - skb_trim(skb, skb->len - 4/*sCrcLng*/); - rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data; - if (!is_multicast_ether_addr(rtllib_hdr->addr1)) { - /* unicast packet */ - unicast_packet = true; - } - fc = le16_to_cpu(rtllib_hdr->frame_ctl); - type = WLAN_FC_GET_TYPE(fc); - if (type == RTLLIB_FTYPE_MGMT) - bLedBlinking = false; - - if (bLedBlinking) - if (priv->rtllib->LedControlHandler) - priv->rtllib->LedControlHandler(dev, - LED_CTL_RX); - - if (stats.bCRC) { - if (type != RTLLIB_FTYPE_MGMT) - priv->stats.rxdatacrcerr++; - else - priv->stats.rxmgmtcrcerr++; - } - - skb_len = skb->len; + if (!priv->ops->rx_query_status_descriptor(dev, &stats, + pdesc, skb)) + goto done; + new_skb = dev_alloc_skb(priv->rxbuffersize); + /* if allocation of new skb failed - drop current packet + * and reuse skb */ + if (unlikely(!new_skb)) + goto done; + + pci_unmap_single(priv->pdev, + *((dma_addr_t *)skb->cb), + priv->rxbuffersize, + PCI_DMA_FROMDEVICE); + + skb_put(skb, pdesc->Length); + skb_reserve(skb, stats.RxDrvInfoSize + + stats.RxBufShift); + skb_trim(skb, skb->len - 4/*sCrcLng*/); + rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data; + if (!is_multicast_ether_addr(rtllib_hdr->addr1)) { + /* unicast packet */ + unicast_packet = true; + } + fc = le16_to_cpu(rtllib_hdr->frame_ctl); + type = WLAN_FC_GET_TYPE(fc); + if (type == RTLLIB_FTYPE_MGMT) + bLedBlinking = false; + + if (bLedBlinking) + if (priv->rtllib->LedControlHandler) + priv->rtllib->LedControlHandler(dev, + LED_CTL_RX); + + if (stats.bCRC) { + if (type != RTLLIB_FTYPE_MGMT) + priv->stats.rxdatacrcerr++; + else + priv->stats.rxmgmtcrcerr++; + } - if (!rtllib_rx(priv->rtllib, skb, &stats)) { - dev_kfree_skb_any(skb); - } else { - priv->stats.rxok++; - if (unicast_packet) - priv->stats.rxbytesunicast += skb_len; - } + skb_len = skb->len; - skb = new_skb; - skb->dev = dev; + if (!rtllib_rx(priv->rtllib, skb, &stats)) { + dev_kfree_skb_any(skb); + } else { + priv->stats.rxok++; + if (unicast_packet) + priv->stats.rxbytesunicast += skb_len; + } - priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = - skb; - *((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev, - skb_tail_pointer_rsl(skb), - priv->rxbuffersize, - PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(priv->pdev, - *((dma_addr_t *)skb->cb))) { - dev_kfree_skb_any(skb); - return; - } + skb = new_skb; + skb->dev = dev; + + priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = + skb; + *((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev, + skb_tail_pointer_rsl(skb), + priv->rxbuffersize, + PCI_DMA_FROMDEVICE); + if (pci_dma_mapping_error(priv->pdev, + *((dma_addr_t *)skb->cb))) { + dev_kfree_skb_any(skb); + return; } done: pdesc->BufferAddress = *((dma_addr_t *)skb->cb); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index aa95e88a6931..b26dfcbc3e3b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -378,19 +378,16 @@ static void dm_bandwidth_autoswitch(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 || - !priv->rtllib->bandwidth_auto_switch.bautoswitch_enable) { + !priv->rtllib->bandwidth_auto_switch.bautoswitch_enable) return; + if (priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz == false) { + if (priv->undecorated_smoothed_pwdb <= + priv->rtllib->bandwidth_auto_switch.threshold_40Mhzto20Mhz) + priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = true; } else { - if (priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz == false) { - if (priv->undecorated_smoothed_pwdb <= - priv->rtllib->bandwidth_auto_switch.threshold_40Mhzto20Mhz) - priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = true; - } else { - if (priv->undecorated_smoothed_pwdb >= - priv->rtllib->bandwidth_auto_switch.threshold_20Mhzto40Mhz) - priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = false; - - } + if (priv->undecorated_smoothed_pwdb >= + priv->rtllib->bandwidth_auto_switch.threshold_20Mhzto40Mhz) + priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = false; } } @@ -581,148 +578,148 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) "priv->CCKPresentAttentuation = %d\n", priv->CCKPresentAttentuation); return; - } else { - if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) { - if (RF_Type == RF_2T4R) { - - if ((priv->rfa_txpowertrackingindex > 0) && - (priv->rfc_txpowertrackingindex > 0)) { - priv->rfa_txpowertrackingindex--; - if (priv->rfa_txpowertrackingindex_real > 4) { - priv->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); - } - - priv->rfc_txpowertrackingindex--; - if (priv->rfc_txpowertrackingindex_real > 4) { - priv->rfc_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, - priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); - } - } else { - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[4].txbbgain_value); - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, priv->txbbgain_table[4].txbbgain_value); - } - } else { - if (priv->rfa_txpowertrackingindex > 0) { - priv->rfa_txpowertrackingindex--; - if (priv->rfa_txpowertrackingindex_real > 4) { - priv->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); - } - } else - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, priv->txbbgain_table[4].txbbgain_value); + } + if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) { + if (RF_Type == RF_2T4R) { - } - } else { - if (RF_Type == RF_2T4R) { - if ((priv->rfa_txpowertrackingindex < - TxBBGainTableLength - 1) && - (priv->rfc_txpowertrackingindex < - TxBBGainTableLength - 1)) { - priv->rfa_txpowertrackingindex++; - priv->rfa_txpowertrackingindex_real++; + if ((priv->rfa_txpowertrackingindex > 0) && + (priv->rfc_txpowertrackingindex > 0)) { + priv->rfa_txpowertrackingindex--; + if (priv->rfa_txpowertrackingindex_real > 4) { + priv->rfa_txpowertrackingindex_real--; rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, - priv->txbbgain_table - [priv->rfa_txpowertrackingindex_real].txbbgain_value); - priv->rfc_txpowertrackingindex++; - priv->rfc_txpowertrackingindex_real++; + priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); + } + + priv->rfc_txpowertrackingindex--; + if (priv->rfc_txpowertrackingindex_real > 4) { + priv->rfc_txpowertrackingindex_real--; rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); - } else { - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); } } else { - if (priv->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) { - priv->rfa_txpowertrackingindex++; - priv->rfa_txpowertrackingindex_real++; - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[4].txbbgain_value); + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, priv->txbbgain_table[4].txbbgain_value); + } + } else { + if (priv->rfa_txpowertrackingindex > 0) { + priv->rfa_txpowertrackingindex--; + if (priv->rfa_txpowertrackingindex_real > 4) { + priv->rfa_txpowertrackingindex_real--; + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); - } else - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); - } + } + } else + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, priv->txbbgain_table[4].txbbgain_value); + } + } else { if (RF_Type == RF_2T4R) { - priv->CCKPresentAttentuation_difference - = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default; + if ((priv->rfa_txpowertrackingindex < + TxBBGainTableLength - 1) && + (priv->rfc_txpowertrackingindex < + TxBBGainTableLength - 1)) { + priv->rfa_txpowertrackingindex++; + priv->rfa_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table + [priv->rfa_txpowertrackingindex_real].txbbgain_value); + priv->rfc_txpowertrackingindex++; + priv->rfc_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, + priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); + } else { + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); + } } else { - priv->CCKPresentAttentuation_difference - = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default; - } - - if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) - priv->CCKPresentAttentuation = - priv->CCKPresentAttentuation_20Mdefault + - priv->CCKPresentAttentuation_difference; - else - priv->CCKPresentAttentuation = - priv->CCKPresentAttentuation_40Mdefault + - priv->CCKPresentAttentuation_difference; - - if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength-1)) - priv->CCKPresentAttentuation = CCKTxBBGainTableLength-1; - if (priv->CCKPresentAttentuation < 0) - priv->CCKPresentAttentuation = 0; - - if (priv->CCKPresentAttentuation > -1 && - priv->CCKPresentAttentuation < CCKTxBBGainTableLength) { - if (priv->rtllib->current_network.channel == 14 && - !priv->bcck_in_ch14) { - priv->bcck_in_ch14 = true; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); - } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) { - priv->bcck_in_ch14 = false; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + if (priv->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) { + priv->rfa_txpowertrackingindex++; + priv->rfa_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); } else - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); } - RT_TRACE(COMP_POWER_TRACKING, - "priv->rfa_txpowertrackingindex = %d\n", - priv->rfa_txpowertrackingindex); - RT_TRACE(COMP_POWER_TRACKING, - "priv->rfa_txpowertrackingindex_real = %d\n", - priv->rfa_txpowertrackingindex_real); - RT_TRACE(COMP_POWER_TRACKING, - "priv->CCKPresentAttentuation_difference = %d\n", - priv->CCKPresentAttentuation_difference); - RT_TRACE(COMP_POWER_TRACKING, - "priv->CCKPresentAttentuation = %d\n", - priv->CCKPresentAttentuation); + } + if (RF_Type == RF_2T4R) { + priv->CCKPresentAttentuation_difference + = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default; + } else { + priv->CCKPresentAttentuation_difference + = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default; + } - if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) { - priv->rtllib->bdynamic_txpower_enable = true; - write_nic_byte(dev, Pw_Track_Flag, 0); - write_nic_byte(dev, FW_Busy_Flag, 0); - RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); - return; - } + if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + priv->CCKPresentAttentuation = + priv->CCKPresentAttentuation_20Mdefault + + priv->CCKPresentAttentuation_difference; + else + priv->CCKPresentAttentuation = + priv->CCKPresentAttentuation_40Mdefault + + priv->CCKPresentAttentuation_difference; + + if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength-1)) + priv->CCKPresentAttentuation = CCKTxBBGainTableLength-1; + if (priv->CCKPresentAttentuation < 0) + priv->CCKPresentAttentuation = 0; + + if (priv->CCKPresentAttentuation > -1 && + priv->CCKPresentAttentuation < CCKTxBBGainTableLength) { + if (priv->rtllib->current_network.channel == 14 && + !priv->bcck_in_ch14) { + priv->bcck_in_ch14 = true; + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) { + priv->bcck_in_ch14 = false; + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } else + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex = %d\n", + priv->rfa_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex_real = %d\n", + priv->rfa_txpowertrackingindex_real); + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation_difference = %d\n", + priv->CCKPresentAttentuation_difference); + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation = %d\n", + priv->CCKPresentAttentuation); + + if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) { + priv->rtllib->bdynamic_txpower_enable = true; + write_nic_byte(dev, Pw_Track_Flag, 0); + write_nic_byte(dev, FW_Busy_Flag, 0); + RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); + return; } + write_nic_byte(dev, Pw_Track_Flag, 0); Avg_TSSI_Meas_from_driver = 0; for (k = 0; k < 5; k++) @@ -1401,13 +1398,12 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) TxPowerCheckCnt = 5; else TxPowerCheckCnt = 2; - if (!priv->btxpower_tracking) { + if (!priv->btxpower_tracking) + return; + + if (priv->txpower_count <= TxPowerCheckCnt) { + priv->txpower_count++; return; - } else { - if (priv->txpower_count <= TxPowerCheckCnt) { - priv->txpower_count++; - return; - } } if (!TM_Trigger) { @@ -1419,15 +1415,12 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) } TM_Trigger = 1; return; - } else { - netdev_info(dev, - "===============>Schedule TxPowerTrackingWorkItem\n"); - - queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0); - TM_Trigger = 0; - } - } + netdev_info(dev, "===============>Schedule TxPowerTrackingWorkItem\n"); + queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0); + TM_Trigger = 0; + +} static void dm_check_txpower_tracking(struct net_device *dev) { @@ -1835,8 +1828,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( if (dm_digtable.dig_state == DM_STA_DIG_OFF && (priv->reset_count == reset_cnt)) return; - else - reset_cnt = priv->reset_count; + reset_cnt = priv->reset_count; dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX; dm_digtable.dig_state = DM_STA_DIG_OFF; @@ -1865,12 +1857,11 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( (priv->reset_count == reset_cnt)) { dm_ctrl_initgain_byrssi_highpwr(dev); return; - } else { - if (priv->reset_count != reset_cnt) - reset_flag = 1; - - reset_cnt = priv->reset_count; } + if (priv->reset_count != reset_cnt) + reset_flag = 1; + + reset_cnt = priv->reset_count; dm_digtable.dig_state = DM_STA_DIG_ON; @@ -1912,8 +1903,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev) if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON && (priv->reset_count == reset_cnt_highpwr)) return; - else - dm_digtable.dig_highpwr_state = DM_STA_DIG_ON; + dm_digtable.dig_highpwr_state = DM_STA_DIG_ON; if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); @@ -1923,8 +1913,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev) if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF && (priv->reset_count == reset_cnt_highpwr)) return; - else - dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF; + dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF; if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh && priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 40c3be9a5e54..0bbffec0c2ae 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -202,12 +202,11 @@ void rtllib_ips_leave_wq(struct net_device *dev) RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", __func__); return; - } else { - netdev_info(dev, "=========>%s(): IPSLeave\n", - __func__); - queue_work_rsl(priv->rtllib->wq, - &priv->rtllib->ips_leave_wq); } + netdev_info(dev, "=========>%s(): IPSLeave\n", + __func__); + queue_work_rsl(priv->rtllib->wq, + &priv->rtllib->ips_leave_wq); } } } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index d074f974fe11..04f1f26b83c5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -346,14 +346,12 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, __func__); up(&priv->wx_sem); return -1; - } else { - netdev_info(dev, - "=========>%s(): IPSLeave\n", - __func__); - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); } + netdev_info(dev, "=========>%s(): IPSLeave\n", + __func__); + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); } } } @@ -509,14 +507,12 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, __func__); up(&priv->wx_sem); return -1; - } else { - RT_TRACE(COMP_PS, - "=========>%s(): IPSLeave\n", - __func__); - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); } + RT_TRACE(COMP_PS, "=========>%s(): IPSLeave\n", + __func__); + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); } } rtllib_stop_scan(priv->rtllib); diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 9820dd2df5f3..573325cbd2e1 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -135,25 +135,22 @@ u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate) u8 is40MHz = 0; u8 isShortGI = 0; - if (nDataRate < 12) { + if (nDataRate < 12) return CCKOFDMRate[nDataRate]; - } else { - if (nDataRate >= 0x10 && nDataRate <= 0x1f) { - is40MHz = 0; - isShortGI = 0; - } else if (nDataRate >= 0x20 && nDataRate <= 0x2f) { - is40MHz = 1; - isShortGI = 0; - - } else if (nDataRate >= 0x30 && nDataRate <= 0x3f) { - is40MHz = 0; - isShortGI = 1; - } else if (nDataRate >= 0x40 && nDataRate <= 0x4f) { - is40MHz = 1; - isShortGI = 1; - } - return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf]; + if (nDataRate >= 0x10 && nDataRate <= 0x1f) { + is40MHz = 0; + isShortGI = 0; + } else if (nDataRate >= 0x20 && nDataRate <= 0x2f) { + is40MHz = 1; + isShortGI = 0; + } else if (nDataRate >= 0x30 && nDataRate <= 0x3f) { + is40MHz = 0; + isShortGI = 1; + } else if (nDataRate >= 0x40 && nDataRate <= 0x4f) { + is40MHz = 1; + isShortGI = 1; } + return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf]; } bool IsHTHalfNmodeAPs(struct rtllib_device *ieee) diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 735ae60e5740..7d77d056228d 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -311,6 +311,11 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *Addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs) { u8 UP = 0; + union tspec_body TSpec; + union qos_tsinfo *pTSInfo = &TSpec.f.TSInfo; + struct list_head *pUnusedList; + struct list_head *pAddmitList; + enum direction_value Dir; if (is_multicast_ether_addr(Addr)) { RTLLIB_DEBUG(RTLLIB_DL_ERR, @@ -348,75 +353,70 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, } *ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect); - if (*ppTS != NULL) { + if (*ppTS != NULL) return true; - } else { - if (!bAddNewTs) { - RTLLIB_DEBUG(RTLLIB_DL_TS, - "add new TS failed(tid:%d)\n", UP); - return false; - } else { - union tspec_body TSpec; - union qos_tsinfo *pTSInfo = &TSpec.f.TSInfo; - struct list_head *pUnusedList = - (TxRxSelect == TX_DIR) ? + + if (!bAddNewTs) { + RTLLIB_DEBUG(RTLLIB_DL_TS, + "add new TS failed(tid:%d)\n", UP); + return false; + } + + pUnusedList = (TxRxSelect == TX_DIR) ? (&ieee->Tx_TS_Unused_List) : (&ieee->Rx_TS_Unused_List); - struct list_head *pAddmitList = - (TxRxSelect == TX_DIR) ? + pAddmitList = (TxRxSelect == TX_DIR) ? (&ieee->Tx_TS_Admit_List) : (&ieee->Rx_TS_Admit_List); - enum direction_value Dir = - (ieee->iw_mode == IW_MODE_MASTER) ? - ((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) : - ((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN); - RTLLIB_DEBUG(RTLLIB_DL_TS, "to add Ts\n"); - if (!list_empty(pUnusedList)) { - (*ppTS) = list_entry(pUnusedList->next, - struct ts_common_info, List); - list_del_init(&(*ppTS)->List); - if (TxRxSelect == TX_DIR) { - struct tx_ts_record *tmp = - container_of(*ppTS, - struct tx_ts_record, - TsCommonInfo); - ResetTxTsEntry(tmp); - } else { - struct rx_ts_record *tmp = - container_of(*ppTS, - struct rx_ts_record, - TsCommonInfo); - ResetRxTsEntry(tmp); - } - - RTLLIB_DEBUG(RTLLIB_DL_TS, - "to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n", - UP, Dir, Addr, *ppTS); - pTSInfo->field.ucTrafficType = 0; - pTSInfo->field.ucTSID = UP; - pTSInfo->field.ucDirection = Dir; - pTSInfo->field.ucAccessPolicy = 1; - pTSInfo->field.ucAggregation = 0; - pTSInfo->field.ucPSB = 0; - pTSInfo->field.ucUP = UP; - pTSInfo->field.ucTSInfoAckPolicy = 0; - pTSInfo->field.ucSchedule = 0; - - MakeTSEntry(*ppTS, Addr, &TSpec, NULL, 0, 0); - AdmitTS(ieee, *ppTS, 0); - list_add_tail(&((*ppTS)->List), pAddmitList); - - return true; - } else { - RTLLIB_DEBUG(RTLLIB_DL_ERR, - "ERR!!in function %s() There is not enough dir=%d(0=up down=1) TS record to be used!!", - __func__, Dir); - return false; - } + Dir = (ieee->iw_mode == IW_MODE_MASTER) ? + ((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) : + ((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN); + + RTLLIB_DEBUG(RTLLIB_DL_TS, "to add Ts\n"); + if (!list_empty(pUnusedList)) { + (*ppTS) = list_entry(pUnusedList->next, + struct ts_common_info, List); + list_del_init(&(*ppTS)->List); + if (TxRxSelect == TX_DIR) { + struct tx_ts_record *tmp = + container_of(*ppTS, + struct tx_ts_record, + TsCommonInfo); + ResetTxTsEntry(tmp); + } else { + struct rx_ts_record *tmp = + container_of(*ppTS, + struct rx_ts_record, + TsCommonInfo); + ResetRxTsEntry(tmp); } + + RTLLIB_DEBUG(RTLLIB_DL_TS, + "to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n", + UP, Dir, Addr, *ppTS); + pTSInfo->field.ucTrafficType = 0; + pTSInfo->field.ucTSID = UP; + pTSInfo->field.ucDirection = Dir; + pTSInfo->field.ucAccessPolicy = 1; + pTSInfo->field.ucAggregation = 0; + pTSInfo->field.ucPSB = 0; + pTSInfo->field.ucUP = UP; + pTSInfo->field.ucTSInfoAckPolicy = 0; + pTSInfo->field.ucSchedule = 0; + + MakeTSEntry(*ppTS, Addr, &TSpec, NULL, 0, 0); + AdmitTS(ieee, *ppTS, 0); + list_add_tail(&((*ppTS)->List), pAddmitList); + + return true; } + + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "ERR!!in function %s() There is not enough dir=%d(0=up down=1) TS record to be used!!", + __func__, Dir); + return false; } static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs, diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 9fc635395ca5..2592bd19054b 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -783,74 +783,74 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, memcpy(rxb->dst, dst, ETH_ALEN); rxb->subframes[0]->dev = ieee->dev; return 1; - } else { - rxb->nr_subframes = 0; - memcpy(rxb->src, src, ETH_ALEN); - memcpy(rxb->dst, dst, ETH_ALEN); - while (skb->len > ETHERNET_HEADER_SIZE) { - /* Offset 12 denote 2 mac address */ - nSubframe_Length = *((u16 *)(skb->data + 12)); - nSubframe_Length = (nSubframe_Length >> 8) + - (nSubframe_Length << 8); - - if (skb->len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { - netdev_info(ieee->dev, - "%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n", - __func__, rxb->nr_subframes); - netdev_info(ieee->dev, - "%s: A-MSDU parse error!! Subframe Length: %d\n", - __func__, nSubframe_Length); - netdev_info(ieee->dev, - "nRemain_Length is %d and nSubframe_Length is : %d\n", - skb->len, nSubframe_Length); - netdev_info(ieee->dev, - "The Packet SeqNum is %d\n", - SeqNum); - return 0; - } + } - /* move the data point to data content */ - skb_pull(skb, ETHERNET_HEADER_SIZE); + rxb->nr_subframes = 0; + memcpy(rxb->src, src, ETH_ALEN); + memcpy(rxb->dst, dst, ETH_ALEN); + while (skb->len > ETHERNET_HEADER_SIZE) { + /* Offset 12 denote 2 mac address */ + nSubframe_Length = *((u16 *)(skb->data + 12)); + nSubframe_Length = (nSubframe_Length >> 8) + + (nSubframe_Length << 8); - /* altered by clark 3/30/2010 - * The struct buffer size of the skb indicated to upper layer - * must be less than 5000, or the defraged IP datagram - * in the IP layer will exceed "ipfrag_high_tresh" and be - * discarded. so there must not use the function - * "skb_copy" and "skb_clone" for "skb". - */ + if (skb->len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { + netdev_info(ieee->dev, + "%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n", + __func__, rxb->nr_subframes); + netdev_info(ieee->dev, + "%s: A-MSDU parse error!! Subframe Length: %d\n", + __func__, nSubframe_Length); + netdev_info(ieee->dev, + "nRemain_Length is %d and nSubframe_Length is : %d\n", + skb->len, nSubframe_Length); + netdev_info(ieee->dev, + "The Packet SeqNum is %d\n", + SeqNum); + return 0; + } - /* Allocate new skb for releasing to upper layer */ - sub_skb = dev_alloc_skb(nSubframe_Length + 12); - if (!sub_skb) - return 0; - skb_reserve(sub_skb, 12); - data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); - memcpy(data_ptr, skb->data, nSubframe_Length); - - sub_skb->dev = ieee->dev; - rxb->subframes[rxb->nr_subframes++] = sub_skb; - if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { - RTLLIB_DEBUG_RX("ParseSubframe(): Too many Subframes! Packets dropped!\n"); - break; - } - skb_pull(skb, nSubframe_Length); + /* move the data point to data content */ + skb_pull(skb, ETHERNET_HEADER_SIZE); - if (skb->len != 0) { - nPadding_Length = 4 - ((nSubframe_Length + - ETHERNET_HEADER_SIZE) % 4); - if (nPadding_Length == 4) - nPadding_Length = 0; + /* altered by clark 3/30/2010 + * The struct buffer size of the skb indicated to upper layer + * must be less than 5000, or the defraged IP datagram + * in the IP layer will exceed "ipfrag_high_tresh" and be + * discarded. so there must not use the function + * "skb_copy" and "skb_clone" for "skb". + */ - if (skb->len < nPadding_Length) - return 0; + /* Allocate new skb for releasing to upper layer */ + sub_skb = dev_alloc_skb(nSubframe_Length + 12); + if (!sub_skb) + return 0; + skb_reserve(sub_skb, 12); + data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); + memcpy(data_ptr, skb->data, nSubframe_Length); - skb_pull(skb, nPadding_Length); - } + sub_skb->dev = ieee->dev; + rxb->subframes[rxb->nr_subframes++] = sub_skb; + if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { + RTLLIB_DEBUG_RX("ParseSubframe(): Too many Subframes! Packets dropped!\n"); + break; } + skb_pull(skb, nSubframe_Length); + + if (skb->len != 0) { + nPadding_Length = 4 - ((nSubframe_Length + + ETHERNET_HEADER_SIZE) % 4); + if (nPadding_Length == 4) + nPadding_Length = 0; - return rxb->nr_subframes; + if (skb->len < nPadding_Length) + return 0; + + skb_pull(skb, nPadding_Length); + } } + + return rxb->nr_subframes; } diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index f1f19fc2305c..70bdf1fe91a4 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2540,13 +2540,12 @@ static void rtllib_resume_tx(struct rtllib_device *ieee) if (ieee->queue_stop) { ieee->tx_pending.frag = i; return; - } else { - - ieee->softmac_data_hard_start_xmit( - ieee->tx_pending.txb->fragments[i], - ieee->dev, ieee->rate); - ieee->stats.tx_packets++; } + + ieee->softmac_data_hard_start_xmit( + ieee->tx_pending.txb->fragments[i], + ieee->dev, ieee->rate); + ieee->stats.tx_packets++; } rtllib_txb_free(ieee->tx_pending.txb); diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index f6d0257e4c9b..2e1aab1230c5 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -413,6 +413,8 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee, struct cb_desc *tcb_desc, struct sk_buff *skb) { + struct rt_hi_throughput *pHTInfo; + tcb_desc->bRTSSTBC = false; tcb_desc->bRTSUseShortGI = false; tcb_desc->bCTSEnable = false; @@ -435,50 +437,50 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee, tcb_desc->rts_rate = MGN_24M; } return; - } else { - struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; + } - while (true) { - if (pHTInfo->IOTAction & HT_IOT_ACT_FORCED_CTS2SELF) { - tcb_desc->bCTSEnable = true; - tcb_desc->rts_rate = MGN_24M; - tcb_desc->bRTSEnable = true; - break; - } else if (pHTInfo->IOTAction & (HT_IOT_ACT_FORCED_RTS | - HT_IOT_ACT_PURE_N_MODE)) { - tcb_desc->bRTSEnable = true; - tcb_desc->rts_rate = MGN_24M; - break; - } - if (ieee->current_network.buseprotection) { - tcb_desc->bRTSEnable = true; - tcb_desc->bCTSEnable = true; - tcb_desc->rts_rate = MGN_24M; - break; - } - if (pHTInfo->bCurrentHTSupport && pHTInfo->bEnableHT) { - u8 HTOpMode = pHTInfo->CurrentOpMode; - - if ((pHTInfo->bCurBW40MHz && (HTOpMode == 2 || - HTOpMode == 3)) || - (!pHTInfo->bCurBW40MHz && HTOpMode == 3)) { - tcb_desc->rts_rate = MGN_24M; - tcb_desc->bRTSEnable = true; - break; - } - } - if (skb->len > ieee->rts) { + pHTInfo = ieee->pHTInfo; + + while (true) { + if (pHTInfo->IOTAction & HT_IOT_ACT_FORCED_CTS2SELF) { + tcb_desc->bCTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + tcb_desc->bRTSEnable = true; + break; + } else if (pHTInfo->IOTAction & (HT_IOT_ACT_FORCED_RTS | + HT_IOT_ACT_PURE_N_MODE)) { + tcb_desc->bRTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + break; + } + if (ieee->current_network.buseprotection) { + tcb_desc->bRTSEnable = true; + tcb_desc->bCTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + break; + } + if (pHTInfo->bCurrentHTSupport && pHTInfo->bEnableHT) { + u8 HTOpMode = pHTInfo->CurrentOpMode; + + if ((pHTInfo->bCurBW40MHz && (HTOpMode == 2 || + HTOpMode == 3)) || + (!pHTInfo->bCurBW40MHz && HTOpMode == 3)) { tcb_desc->rts_rate = MGN_24M; tcb_desc->bRTSEnable = true; break; } - if (tcb_desc->bAMPDUEnable) { - tcb_desc->rts_rate = MGN_24M; - tcb_desc->bRTSEnable = false; - break; - } - goto NO_PROTECTION; } + if (skb->len > ieee->rts) { + tcb_desc->rts_rate = MGN_24M; + tcb_desc->bRTSEnable = true; + break; + } + if (tcb_desc->bAMPDUEnable) { + tcb_desc->rts_rate = MGN_24M; + tcb_desc->bRTSEnable = false; + break; + } + goto NO_PROTECTION; } if (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE) tcb_desc->bUseShortPreamble = true; -- cgit v1.2.3 From 0f0688b3ced6cf085a1bce52fb9984ecc8f39a45 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:27 +0200 Subject: staging: rtl8192e: Fix RETURN_VOID warnings Fix 'void function return statements are not generally useful' checkpatch.pl warnings Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 8 -------- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 7 ------- drivers/staging/rtl8192e/rtllib_rx.c | 1 - drivers/staging/rtl8192e/rtllib_softmac.c | 1 - 5 files changed, 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 9222e421f123..cb74e55b20d2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2137,7 +2137,6 @@ void rtl8192_halt_adapter(struct net_device *dev, bool reset) skb_queue_purge(&priv->rtllib->skb_aggQ[i]); skb_queue_purge(&priv->skb_queue); - return; } void rtl8192_update_ratr_table(struct net_device *dev) @@ -2415,5 +2414,4 @@ void ActUpdateChannelAccessSetting(struct net_device *dev, enum wireless_mode WirelessMode, struct channel_access_setting *ChnlAccessSetting) { - return; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 312979f8fd7e..28b44c9f1339 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -94,7 +94,6 @@ void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, write_nic_dword(dev, dwRegAddr, NewValue); } else write_nic_dword(dev, dwRegAddr, dwData); - return; } u32 rtl8192_QueryBBReg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask) @@ -215,7 +214,6 @@ static void rtl8192_phy_RFSerialWrite(struct net_device *dev, } rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); } - return; } void rtl8192_phy_SetRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, @@ -256,7 +254,6 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, } else rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, Data); } - return; } u32 rtl8192_phy_QueryRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, @@ -399,7 +396,6 @@ void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType) Rtl819XAGCTAB_Array_Table[i+1]); } } - return; } static void rtl8192_InitBBRFRegDef(struct net_device *dev) @@ -640,7 +636,6 @@ void rtl8192_phy_getTxPower(struct net_device *dev) RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x\n", rOFDM0_RxDetector3, priv->framesync); priv->SifsTime = read_nic_word(dev, SIFS); - return; } void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel) @@ -694,7 +689,6 @@ void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel) __func__); break; } - return; } bool rtl8192_phy_RFConfig(struct net_device *dev) @@ -723,7 +717,6 @@ bool rtl8192_phy_RFConfig(struct net_device *dev) void rtl8192_phy_updateInitGain(struct net_device *dev) { - return; } u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev, @@ -813,7 +806,6 @@ static void rtl8192_SetTxPowerLevel(struct net_device *dev, u8 channel) "unknown rf chip ID in rtl8192_SetTxPowerLevel()\n"); break; } - return; } static u8 rtl8192_phy_SetSwChnlCmdArray(struct sw_chnl_cmd *CmdTable, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 5f3e28b22d7c..3308b0d0f042 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -741,8 +741,6 @@ static void rtl8192_prepare_beacon(struct r8192_priv *priv) priv->ops->tx_fill_descriptor(dev, pdesc, tcb_desc, pnewskb); __skb_queue_tail(&ring->queue, pnewskb); pdesc->OWN = 1; - - return; } static void rtl8192_stop_beacon(struct net_device *dev) @@ -856,7 +854,6 @@ static void rtl8192_refresh_supportrate(struct r8192_priv *priv) } else { memset(ieee->Regdot11HTOperationalRateSet, 0, 16); } - return; } static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev) @@ -1901,8 +1898,6 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, priv->rtllib->tx_headroom); priv->rtllib->stats.tx_packets++; } - - return; } int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) @@ -1985,8 +1980,6 @@ void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb) __skb_queue_tail(&ring->queue, skb); spin_unlock_irqrestore(&priv->irq_th_lock, flags); - - return; } short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 2592bd19054b..e2a748bdb396 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -2623,7 +2623,6 @@ static inline void rtllib_process_probe_response( } free_network: kfree(network); - return; } void rtllib_rx_mgt(struct rtllib_device *ieee, diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 70bdf1fe91a4..0f2ae3557bc8 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2228,7 +2228,6 @@ static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *sk default: break; } - return; } inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, -- cgit v1.2.3 From b2e70746e9ae42620a5790926736864c03ac5245 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:28 +0200 Subject: staging: rtl8192e: remove unused EXPORT_SYMBOL_RSL macro This macro caused checkpatch.pl warning and is not used. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index dc9f675150e7..5363b6f955b0 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -68,9 +68,6 @@ #define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb) -#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x) - - #define queue_delayed_work_rsl(x, y, z) queue_delayed_work(x, y, z) #define INIT_DELAYED_WORK_RSL(x, y, z) INIT_DELAYED_WORK(x, y) -- cgit v1.2.3 From 025b8bbe49939dfd68a57cc94bca65c39a5409b8 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:29 +0200 Subject: staging: rtl8192e: Fix UNNECESSARY_PARENTHESES warnings Fix 'Unnecessary parentheses' checkpatch.pl warning Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 12 ++++++------ drivers/staging/rtl8192e/rtllib_rx.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 3308b0d0f042..fb3cb01e67e8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -608,7 +608,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, if (priv->rtllib->state != RTLLIB_LINKED) return ret; - if ((priv->rtllib->iw_mode != IW_MODE_INFRA)) + if (priv->rtllib->iw_mode != IW_MODE_INFRA) return ret; if (network->flags & NETWORK_HAS_QOS_MASK) { @@ -669,7 +669,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, if (priv->rtllib->state != RTLLIB_LINKED) return 0; - if ((priv->rtllib->iw_mode != IW_MODE_INFRA)) + if (priv->rtllib->iw_mode != IW_MODE_INFRA) return 0; spin_lock_irqsave(&priv->rtllib->lock, flags); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index b26dfcbc3e3b..df4bbcf38bae 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -498,7 +498,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) write_nic_byte(dev, FW_Busy_Flag, 0); return; } - if ((priv->rtllib->eRFPowerState != eRfOn)) { + if (priv->rtllib->eRFPowerState != eRfOn) { RT_TRACE(COMP_POWER_TRACKING, "we are in power save, so return\n"); write_nic_byte(dev, Pw_Track_Flag, 0); @@ -1824,7 +1824,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_low_thresh) && (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_thresh)) return; - if ((priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh)) { + if (priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh) { if (dm_digtable.dig_state == DM_STA_DIG_OFF && (priv->reset_count == reset_cnt)) return; @@ -1850,7 +1850,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( return; } - if ((priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh)) { + if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) { u8 reset_flag = 0; if (dm_digtable.dig_state == DM_STA_DIG_ON && @@ -1998,7 +1998,7 @@ static void dm_pd_th(struct net_device *dev) if (dm_digtable.CurSTAConnectState == DIG_STA_CONNECT) { if (dm_digtable.rssi_val >= dm_digtable.rssi_high_power_highthresh) dm_digtable.curpd_thstate = DIG_PD_AT_HIGH_POWER; - else if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh)) + else if (dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh) dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER; else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh) && (dm_digtable.rssi_val < dm_digtable.rssi_high_power_lowthresh)) @@ -2055,9 +2055,9 @@ static void dm_cs_ratio(struct net_device *dev) if (dm_digtable.PreSTAConnectState == dm_digtable.CurSTAConnectState) { if (dm_digtable.CurSTAConnectState == DIG_STA_CONNECT) { - if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh)) + if (dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh) dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER; - else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh)) + else if (dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh) dm_digtable.curcs_ratio_state = DIG_CS_RATIO_HIGHER; else dm_digtable.curcs_ratio_state = dm_digtable.precs_ratio_state; diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index e2a748bdb396..c17112396d45 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1166,7 +1166,7 @@ static void rtllib_rx_check_leave_lps(struct rtllib_device *ieee, u8 unicast, u8 { if (unicast) { - if ((ieee->state == RTLLIB_LINKED)) { + if (ieee->state == RTLLIB_LINKED) { if (((ieee->LinkDetectInfo.NumRxUnicastOkInPeriod + ieee->LinkDetectInfo.NumTxOkInPeriod) > 8) || (ieee->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) { -- cgit v1.2.3 From e2ac043118eed826444972bd81ab0bf70461a0fe Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:30 +0200 Subject: staging: rtl8192e: Fix LINE_CONTINUATIONS warning Fix 'Avoid unnecessary line continuations' checkpatch.pl warning Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 0f2ae3557bc8..d3fc5a45dbbc 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2503,7 +2503,7 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee) * the wait queue */ for (i = 0; i < txb->nr_frags; i++) { queue_len = skb_queue_len(&ieee->skb_waitQ[queue_index]); - if ((queue_len != 0) ||\ + if ((queue_len != 0) || (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) || (ieee->queue_stop)) { /* insert the skb packet to the wait queue */ -- cgit v1.2.3 From bec027ea3845058bf8e7cf2c00626374963c3ca5 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:31 +0200 Subject: staging: rtl8192e: Fix BRACES warning Fix 'braces {} are not necessary for single statement blocks' checkpatch.pl warning Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 1f7077d3966c..c465f8749acd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -301,13 +301,11 @@ bool init_firmware(struct net_device *dev) file_length = pfirmware->firmware_buf_size[init_step]; rt_status = fw_download_code(dev, mapped_file, file_length); - if (!rt_status) { + if (!rt_status) goto download_firmware_fail; - } - if (!firmware_check_ready(dev, init_step)) { + if (!firmware_check_ready(dev, init_step)) goto download_firmware_fail; - } } RT_TRACE(COMP_FIRMWARE, "Firmware Download Success\n"); -- cgit v1.2.3 From ff28b74c1c1d2fdb899dc646fc1e536365794af4 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:32 +0200 Subject: staging: rtl8192e: Fix DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON warning Fix 'do {} while (0) macros should not be semicolon terminated' checkpatch.pl warning Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_debug.h b/drivers/staging/rtl8192e/rtllib_debug.h index 90cffab4287e..119729d31c74 100644 --- a/drivers/staging/rtl8192e/rtllib_debug.h +++ b/drivers/staging/rtl8192e/rtllib_debug.h @@ -83,6 +83,6 @@ do { \ pr_info("Assertion failed! %s,%s,%s,line=%d\n", \ #expr, __FILE__, __func__, __LINE__); \ } \ -} while (0); +} while (0) #endif -- cgit v1.2.3 From 61dbdf36f2f1083a0b224afbb0feb13ad44792a5 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:33 +0200 Subject: staging: rtl8192e: Fix PRINTK_WITHOUT_KERN_LEVEL warnings Replace custom hex dumping function with print_hex_dump_bytes() to make checkpatch.pl happy Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 5363b6f955b0..c7487772f21d 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -690,15 +690,9 @@ do { \ #define RTLLIB_DEBUG_DATA(level, data, datalen) \ do { \ if ((rtllib_debug_level & (level)) == (level)) { \ - int i; \ - u8 *pdata = (u8 *)data; \ printk(KERN_DEBUG "rtllib: %s()\n", __func__); \ - for (i = 0; i < (int)(datalen); i++) { \ - printk("%2.2x ", pdata[i]); \ - if ((i+1)%16 == 0) \ - printk("\n"); \ - } \ - printk("\n"); \ + print_hex_dump_bytes(KERN_DEBUG, DUMP_PREFIX_NONE, \ + data, datalen); \ } \ } while (0) -- cgit v1.2.3 From e8f05b0b01ea1593c8cc6311704c227fb0d08b04 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:34 +0200 Subject: staging: rtl8192e: Divide rtllib_rx_auth() Move authentication response processing to rtllib_rx_auth_resp() function. No logic is affected. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 112 ++++++++++++++++-------------- 1 file changed, 58 insertions(+), 54 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index d3fc5a45dbbc..9266bc647bc4 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2314,73 +2314,77 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, return 0; } -inline int rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, - struct rtllib_rx_stats *rx_stats) +static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) { u16 errcode; u8 *challenge; int chlen = 0; bool bSupportNmode = true, bHalfSupportNmode = false; - if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) { - if (ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATING && - (ieee->iw_mode == IW_MODE_INFRA)) { - RTLLIB_DEBUG_MGMT("Received authentication response"); - - errcode = auth_parse(skb, &challenge, &chlen); - if (0 == errcode) { - if (ieee->open_wep || !challenge) { - ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATED; - ieee->softmac_stats.rx_auth_rs_ok++; - if (!(ieee->pHTInfo->IOTAction & - HT_IOT_ACT_PURE_N_MODE)) { - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { - if (IsHTHalfNmodeAPs(ieee)) { - bSupportNmode = true; - bHalfSupportNmode = true; - } else { - bSupportNmode = false; - bHalfSupportNmode = false; - } - } - } - /* Dummy wirless mode setting to avoid - * encryption issue */ - if (bSupportNmode) { - ieee->SetWirelessMode(ieee->dev, - ieee->current_network.mode); + errcode = auth_parse(skb, &challenge, &chlen); + if (0 == errcode) { + if (ieee->open_wep || !challenge) { + ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATED; + ieee->softmac_stats.rx_auth_rs_ok++; + if (!(ieee->pHTInfo->IOTAction & + HT_IOT_ACT_PURE_N_MODE)) { + if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { + if (IsHTHalfNmodeAPs(ieee)) { + bSupportNmode = true; + bHalfSupportNmode = true; } else { - /*TODO*/ - ieee->SetWirelessMode(ieee->dev, - IEEE_G); + bSupportNmode = false; + bHalfSupportNmode = false; } - - if (ieee->current_network.mode == - IEEE_N_24G && bHalfSupportNmode) { - netdev_info(ieee->dev, - "======>enter half N mode\n"); - ieee->bHalfWirelessN24GMode = - true; - } else - ieee->bHalfWirelessN24GMode = - false; - - rtllib_associate_step2(ieee); - } else { - rtllib_auth_challenge(ieee, challenge, - chlen); } + } + /* Dummy wirless mode setting to avoid + * encryption issue */ + if (bSupportNmode) { + ieee->SetWirelessMode(ieee->dev, + ieee->current_network.mode); } else { - ieee->softmac_stats.rx_auth_rs_err++; - RTLLIB_DEBUG_MGMT("Authentication respose status code 0x%x", - errcode); + /*TODO*/ + ieee->SetWirelessMode(ieee->dev, + IEEE_G); + } + if (ieee->current_network.mode == + IEEE_N_24G && bHalfSupportNmode) { netdev_info(ieee->dev, - "Authentication respose status code 0x%x", - errcode); - rtllib_associate_abort(ieee); - } + "======>enter half N mode\n"); + ieee->bHalfWirelessN24GMode = + true; + } else + ieee->bHalfWirelessN24GMode = + false; + + rtllib_associate_step2(ieee); + } else { + rtllib_auth_challenge(ieee, challenge, + chlen); + } + } else { + ieee->softmac_stats.rx_auth_rs_err++; + RTLLIB_DEBUG_MGMT("Authentication respose status code 0x%x", + errcode); + + netdev_info(ieee->dev, + "Authentication respose status code 0x%x", + errcode); + rtllib_associate_abort(ieee); + } +} +inline int rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, + struct rtllib_rx_stats *rx_stats) +{ + + if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) { + if (ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATING && + (ieee->iw_mode == IW_MODE_INFRA)) { + RTLLIB_DEBUG_MGMT("Received authentication response"); + rtllib_rx_auth_resp(ieee, skb); } else if (ieee->iw_mode == IW_MODE_MASTER) { rtllib_rx_auth_rq(ieee, skb); } -- cgit v1.2.3 From f7567e20708ed4129ccec1a21c4c55b9725b66d0 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:35 +0200 Subject: staging: rtl8192e: Decrease nesting of rtllib_rx_auth_resp() Return from rtllib_rx_auth_resp() if auth_parse() fails. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 89 ++++++++++++++++--------------- 1 file changed, 45 insertions(+), 44 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 9266bc647bc4..9a4179cb926c 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2322,57 +2322,58 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) bool bSupportNmode = true, bHalfSupportNmode = false; errcode = auth_parse(skb, &challenge, &chlen); - if (0 == errcode) { - if (ieee->open_wep || !challenge) { - ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATED; - ieee->softmac_stats.rx_auth_rs_ok++; - if (!(ieee->pHTInfo->IOTAction & - HT_IOT_ACT_PURE_N_MODE)) { - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { - if (IsHTHalfNmodeAPs(ieee)) { - bSupportNmode = true; - bHalfSupportNmode = true; - } else { - bSupportNmode = false; - bHalfSupportNmode = false; - } - } - } - /* Dummy wirless mode setting to avoid - * encryption issue */ - if (bSupportNmode) { - ieee->SetWirelessMode(ieee->dev, - ieee->current_network.mode); - } else { - /*TODO*/ - ieee->SetWirelessMode(ieee->dev, - IEEE_G); - } - if (ieee->current_network.mode == - IEEE_N_24G && bHalfSupportNmode) { - netdev_info(ieee->dev, - "======>enter half N mode\n"); - ieee->bHalfWirelessN24GMode = - true; - } else - ieee->bHalfWirelessN24GMode = - false; - - rtllib_associate_step2(ieee); - } else { - rtllib_auth_challenge(ieee, challenge, - chlen); - } - } else { + if (errcode) { ieee->softmac_stats.rx_auth_rs_err++; RTLLIB_DEBUG_MGMT("Authentication respose status code 0x%x", errcode); netdev_info(ieee->dev, - "Authentication respose status code 0x%x", - errcode); + "Authentication respose status code 0x%x", errcode); rtllib_associate_abort(ieee); + return; + } + + if (ieee->open_wep || !challenge) { + ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATED; + ieee->softmac_stats.rx_auth_rs_ok++; + if (!(ieee->pHTInfo->IOTAction & + HT_IOT_ACT_PURE_N_MODE)) { + if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { + if (IsHTHalfNmodeAPs(ieee)) { + bSupportNmode = true; + bHalfSupportNmode = true; + } else { + bSupportNmode = false; + bHalfSupportNmode = false; + } + } + } + /* Dummy wirless mode setting to avoid + * encryption issue */ + if (bSupportNmode) { + ieee->SetWirelessMode(ieee->dev, + ieee->current_network.mode); + } else { + /*TODO*/ + ieee->SetWirelessMode(ieee->dev, + IEEE_G); + } + + if (ieee->current_network.mode == + IEEE_N_24G && bHalfSupportNmode) { + netdev_info(ieee->dev, + "======>enter half N mode\n"); + ieee->bHalfWirelessN24GMode = + true; + } else + ieee->bHalfWirelessN24GMode = + false; + + rtllib_associate_step2(ieee); + } else { + rtllib_auth_challenge(ieee, challenge, + chlen); } } -- cgit v1.2.3 From e725fb6f814b290fbf967e475f2a136efca66986 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:36 +0200 Subject: staging: rtl8192e: Fix indentation in rtllib_rx_auth_resp() Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 9a4179cb926c..c043d8cb6c8a 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2329,7 +2329,7 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) errcode); netdev_info(ieee->dev, - "Authentication respose status code 0x%x", errcode); + "Authentication respose status code 0x%x", errcode); rtllib_associate_abort(ieee); return; } @@ -2337,8 +2337,7 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) if (ieee->open_wep || !challenge) { ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATED; ieee->softmac_stats.rx_auth_rs_ok++; - if (!(ieee->pHTInfo->IOTAction & - HT_IOT_ACT_PURE_N_MODE)) { + if (!(ieee->pHTInfo->IOTAction & HT_IOT_ACT_PURE_N_MODE)) { if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { if (IsHTHalfNmodeAPs(ieee)) { bSupportNmode = true; @@ -2353,27 +2352,22 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) * encryption issue */ if (bSupportNmode) { ieee->SetWirelessMode(ieee->dev, - ieee->current_network.mode); + ieee->current_network.mode); } else { /*TODO*/ - ieee->SetWirelessMode(ieee->dev, - IEEE_G); + ieee->SetWirelessMode(ieee->dev, IEEE_G); } - if (ieee->current_network.mode == - IEEE_N_24G && bHalfSupportNmode) { - netdev_info(ieee->dev, - "======>enter half N mode\n"); - ieee->bHalfWirelessN24GMode = - true; - } else - ieee->bHalfWirelessN24GMode = - false; - + if ((ieee->current_network.mode == IEEE_N_24G) && + bHalfSupportNmode) { + netdev_info(ieee->dev, "======>enter half N mode\n"); + ieee->bHalfWirelessN24GMode = true; + } else { + ieee->bHalfWirelessN24GMode = false; + } rtllib_associate_step2(ieee); } else { - rtllib_auth_challenge(ieee, challenge, - chlen); + rtllib_auth_challenge(ieee, challenge, chlen); } } -- cgit v1.2.3 From 14b40d92881533dca8b25647f105b9546433cda2 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:37 +0200 Subject: staging: rtl8192e: Comment cleanup (style/format) - Multiline comments use "network subsystem comment style" - Merge short multiline comments - Remove empty comments - Remove function name comment at the end of small (<1 screen) functions - Reformat 802.11 data frame format to use spaces and network format Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h | 30 +-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 5 +- drivers/staging/rtl8192e/rtl819x_HTProc.c | 3 +- drivers/staging/rtl8192e/rtllib.h | 96 ++++----- drivers/staging/rtl8192e/rtllib_crypt.c | 3 +- drivers/staging/rtl8192e/rtllib_crypt.h | 3 +- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 3 +- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 15 +- drivers/staging/rtl8192e/rtllib_crypt_wep.c | 3 +- drivers/staging/rtl8192e/rtllib_rx.c | 101 +++++----- drivers/staging/rtl8192e/rtllib_softmac.c | 90 +++++---- drivers/staging/rtl8192e/rtllib_tx.c | 225 +++++++++++----------- drivers/staging/rtl8192e/rtllib_wx.c | 21 +- 16 files changed, 318 insertions(+), 289 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c index e2ef0a3fcb83..ecdd2e5c6bac 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c @@ -165,7 +165,7 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev) static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) { - struct cmpk_intr_sta rx_intr_status; /* */ + struct cmpk_intr_sta rx_intr_status; struct r8192_priv *priv = rtllib_priv(dev); DMESG("---> cmpk_Handle_Interrupt_Status()\n"); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h index 23219e17e5a1..2693682644df 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h @@ -33,28 +33,28 @@ struct cmpk_txfb { u8 element_id; u8 length; - u8 TID:4; /* */ - u8 fail_reason:3; /* */ + u8 TID:4; + u8 fail_reason:3; u8 tok:1; - u8 reserve1:4; /* */ - u8 pkt_type:2; /* */ - u8 bandwidth:1; /* */ - u8 qos_pkt:1; /* */ + u8 reserve1:4; + u8 pkt_type:2; + u8 bandwidth:1; + u8 qos_pkt:1; - u8 reserve2; /* */ - u8 retry_cnt; /* */ - u16 pkt_id; /* */ + u8 reserve2; + u8 retry_cnt; + u16 pkt_id; - u16 seq_num; /* */ + u16 seq_num; u8 s_rate; u8 f_rate; - u8 s_rts_rate; /* */ - u8 f_rts_rate; /* */ - u16 pkt_length; /* */ + u8 s_rts_rate; + u8 f_rts_rate; + u16 pkt_length; - u16 reserve3; /* */ - u16 duration; /* */ + u16 reserve3; + u16 duration; }; struct cmpk_intr_sta { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 28b44c9f1339..4664a4fd1e48 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -304,7 +304,7 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, } return read_nic_dword(dev, RF_DATA); -} /* phy_FwRFSerialRead */ +} static void phy_FwRFSerialWrite(struct net_device *dev, enum rf90_radio_path eRFPath, @@ -325,7 +325,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev, } write_nic_dword(dev, QPNR, Data); -} /* phy_FwRFSerialWrite */ +} void rtl8192_phy_configmac(struct net_device *dev) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index fb3cb01e67e8..352d381b7c4a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2332,7 +2332,8 @@ static void rtl8192_rx_normal(struct net_device *dev) goto done; new_skb = dev_alloc_skb(priv->rxbuffersize); /* if allocation of new skb failed - drop current packet - * and reuse skb */ + * and reuse skb + */ if (unlikely(!new_skb)) goto done; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 04f1f26b83c5..8d6a109e023b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -1221,11 +1221,10 @@ static iw_handler r8192_wx_handlers[] = { IW_IOCTL(SIOCSIWENCODEEXT) = r8192_wx_set_enc_ext, }; -/* - * the following rule need to be following, +/* the following rule need to be following, * Odd : get (world access), * even : set (root access) - * */ + */ static const struct iw_priv_args r8192_private_args[] = { { SIOCIWFIRSTPRIV + 0x0, diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 573325cbd2e1..7f103114d5d2 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -719,7 +719,8 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee, RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__); /* unmark bEnableHT flag here is the same reason why unmarked in - * function rtllib_softmac_new_net. WB 2008.09.10*/ + * function rtllib_softmac_new_net. WB 2008.09.10 + */ if (pNetwork->bssht.bdSupportHT) { pHTInfo->bCurrentHTSupport = true; pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer; diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index c7487772f21d..3c8b708df5c3 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -509,12 +509,13 @@ struct ieee_param { #define RTLLIB_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section - 6.2.1.1.2. - - The figure in section 7.1.2 suggests a body size of up to 2312 - bytes is allowed, which is a bit confusing, I suspect this - represents the 2304 bytes of real data, plus a possible 8 bytes of - WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ + * 6.2.1.1.2. + * + * The figure in section 7.1.2 suggests a body size of up to 2312 + * bytes is allowed, which is a bit confusing, I suspect this + * represents the 2304 bytes of real data, plus a possible 8 bytes of + * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) + */ #define RTLLIB_1ADDR_LEN 10 #define RTLLIB_2ADDR_LEN 16 #define RTLLIB_3ADDR_LEN 24 @@ -696,8 +697,7 @@ do { \ } \ } while (0) -/* - * To use the debug system; +/* To use the debug system; * * If you are defining a new debug classification, simply add it to the #define * list here in the form of: @@ -716,8 +716,6 @@ do { \ * % cat /proc/net/ipw/debug_level * * you simply need to add your entry to the ipw_debug_levels array. - * - * */ #define RTLLIB_DL_INFO (1<<0) @@ -975,7 +973,8 @@ struct rtllib_rx_stats { /* IEEE 802.11 requires that STA supports concurrent reception of at least * three fragmented frames. This define can be increased to support more * concurrent frames, but it should be noted that each entry can consume about - * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ + * 2 kB of RAM and increasing cache size will slow down frame reassembly. + */ #define RTLLIB_FRAG_CACHE_LEN 4 struct rtllib_frag_entry { @@ -1053,16 +1052,15 @@ struct rtllib_security { } __packed; -/* - 802.11 data frame from AP - ,-------------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `-------------------------------------------------------------------' -Total: 28-2340 bytes -*/ +/* 802.11 data frame from AP + * ,-------------------------------------------------------------------. + * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + * |------|------|---------|---------|---------|------|---------|------| + * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | + * | | tion | (BSSID) | | | ence | data | | + * `-------------------------------------------------------------------' + * Total: 28-2340 bytes + */ /* Management Frame Information Element Types */ enum rtllib_mfie { @@ -1100,7 +1098,8 @@ enum rtllib_mfie { /* Minimal header; can be used for passing 802.11 frames with sufficient * information to determine what type of underlying data type is actually - * stored in the data. */ + * stored in the data. + */ struct rtllib_pspoll_hdr { __le16 frame_ctl; __le16 aid; @@ -1210,7 +1209,8 @@ struct rtllib_probe_response { __le16 beacon_interval; __le16 capability; /* SSID, supported rates, FH params, DS params, - * CF params, IBSS params, TIM (if beacon), RSN */ + * CF params, IBSS params, TIM (if beacon), RSN + */ struct rtllib_info_element info_element[0]; } __packed; @@ -1285,7 +1285,8 @@ union frameqos { /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs * only use 8, and then use extended rates for the remaining supported * rates. Other APs, however, stick all of their supported rates on the - * main rates information element... */ + * main rates information element... + */ #define MAX_RATES_LENGTH ((u8)12) #define MAX_RATES_EX_LENGTH ((u8)16) #define MAX_NETWORK_COUNT 96 @@ -1472,22 +1473,21 @@ struct rtllib_info_element_hdr { u8 len; } __packed; -/* - * These are the data types that can make up management packets +/* These are the data types that can make up management packets * - u16 auth_algorithm; - u16 auth_sequence; - u16 beacon_interval; - u16 capability; - u8 current_ap[ETH_ALEN]; - u16 listen_interval; - struct { - u16 association_id:14, reserved:2; - } __packed; - u32 time_stamp[2]; - u16 reason; - u16 status; -*/ + * u16 auth_algorithm; + * u16 auth_sequence; + * u16 beacon_interval; + * u16 capability; + * u8 current_ap[ETH_ALEN]; + * u16 listen_interval; + * struct { + * u16 association_id:14, reserved:2; + * } __packed; + * u32 time_stamp[2]; + * u16 reason; + * u16 status; + */ #define RTLLIB_DEFAULT_TX_ESSID "Penguin" #define RTLLIB_DEFAULT_BASIC_RATE 2 @@ -2085,14 +2085,16 @@ struct rtllib_device { spinlock_t wpax_suitlist_lock; int tx_headroom; /* Set to size of any additional room needed at front - * of allocated Tx SKBs */ + * of allocated Tx SKBs + */ u32 config; /* WEP and other encryption related settings at the device level */ int open_wep; /* Set to 1 to allow unencrypted frames */ int auth_mode; int reset_on_keychange; /* Set to 1 if the HW needs to be reset on - * WEP key changes */ + * WEP key changes + */ /* If the host performs {en,de}cryption, then set to 1 */ int host_encrypt; @@ -2362,7 +2364,7 @@ struct rtllib_device { /* OK this is complementing to data_poll_hard_stop */ void (*data_hard_resume)(struct net_device *dev); - /* ask to the driver to retune the radio . + /* ask to the driver to retune the radio. * This function can sleep. the driver should ensure * the radio has been switched before return. */ @@ -2456,7 +2458,8 @@ struct rtllib_device { void (*rtllib_rfkill_poll)(struct net_device *dev); /* This must be the last item so that it points to the data - * allocated beyond this structure by alloc_rtllib */ + * allocated beyond this structure by alloc_rtllib + */ u8 priv[0]; }; @@ -2485,7 +2488,8 @@ struct rtllib_device { /* The ieee802.11 stack will manage the netif queue * wake/stop for the driver, taking care of 802.11 - * fragmentation. See softmac.c for details. */ + * fragmentation. See softmac.c for details. + */ #define IEEE_SOFTMAC_TX_QUEUE (1<<7) /* Uses only the softmac_data_hard_start_xmit @@ -2522,11 +2526,9 @@ static inline int rtllib_is_empty_essid(const char *essid, int essid_len) static inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode) { - /* - * It is possible for both access points and our device to support + /* It is possible for both access points and our device to support * combinations of modes, so as long as there is one valid combination * of ap/device supported modes, then return success - * */ if ((mode & IEEE_A) && (ieee->modulation & RTLLIB_OFDM_MODULATION) && diff --git a/drivers/staging/rtl8192e/rtllib_crypt.c b/drivers/staging/rtl8192e/rtllib_crypt.c index 807ba1b92447..1e6ae9bead23 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.c +++ b/drivers/staging/rtl8192e/rtllib_crypt.c @@ -87,7 +87,8 @@ void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info, /* must not run ops->deinit() while there may be pending encrypt or * decrypt operations. Use a list of delayed deinits to avoid needing - * locking. */ + * locking. + */ spin_lock_irqsave(info->lock, flags); list_add(&tmp->list, &info->crypt_deinit_list); diff --git a/drivers/staging/rtl8192e/rtllib_crypt.h b/drivers/staging/rtl8192e/rtllib_crypt.h index e177c9287b44..b8cf59f39a60 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.h +++ b/drivers/staging/rtl8192e/rtllib_crypt.h @@ -17,8 +17,7 @@ * more details. */ -/* - * This file defines the interface to the rtllib crypto module. +/* This file defines the interface to the rtllib crypto module. */ #ifndef RTLLIB_CRYPT_H #define RTLLIB_CRYPT_H diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index c0b8bb289e7d..505d466a6a8d 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -140,7 +140,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, * Flag (Include authentication header, M=3 (8-octet MIC), * L=1 (2-octet Dlen)) * Nonce: 0x00 | A2 | PN - * Dlen */ + * Dlen + */ b0[0] = 0x59; b0[1] = qc; memcpy(b0 + 2, hdr->addr2, ETH_ALEN); diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index ccf85309b4b6..656b4b359c50 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -249,7 +249,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, u16 IV16) { /* Make temporary area overlap WEP seed so that the final copy can be - * avoided on little endian hosts. */ + * avoided on little endian hosts. + */ u16 *PPK = (u16 *) &WEPSeed[4]; /* Step 1 - make copy of TTAK and bring in TSC */ @@ -276,7 +277,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, PPK[5] += RotR1(PPK[4]); /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value - * WEPSeed[0..2] is transmitted as WEP IV */ + * WEPSeed[0..2] is transmitted as WEP IV + */ WEPSeed[0] = Hi8(IV16); WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; WEPSeed[2] = Lo8(IV16); @@ -470,7 +472,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) if (iv32 != tkey->rx_iv32) { /* Previously cached Phase1 result was already * lost, so it needs to be recalculated for the - * next packet. */ + * next packet. + */ tkey->rx_phase1_done = 0; } if (net_ratelimit()) { @@ -485,7 +488,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) } /* Update real counters only after Michael MIC verification has - * completed */ + * completed + */ tkey->rx_iv32_new = iv32; tkey->rx_iv16_new = iv16; @@ -639,7 +643,8 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, } /* Update TSC counters for RX now that the packet verification has - * completed. */ + * completed. + */ tkey->rx_iv32 = tkey->rx_iv32_new; tkey->rx_iv16 = tkey->rx_iv16_new; diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c index 06c79fabdcd3..21d7eee4c9a9 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c @@ -121,7 +121,8 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key * scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N) - * can be used to speedup attacks, so avoid using them. */ + * can be used to speedup attacks, so avoid using them. + */ if ((wep->iv & 0xff00) == 0xff00) { u8 B = (wep->iv >> 16) & 0xff; diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index c17112396d45..c1418b457a45 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -143,7 +143,8 @@ rtllib_frag_cache_get(struct rtllib_device *ieee, memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); } else { /* received a fragment of a frame for which the head fragment - * should have already been received */ + * should have already been received + */ entry = rtllib_frag_cache_find(ieee, seq, frag, tid, hdr->addr2, hdr->addr1); if (entry != NULL) { @@ -199,7 +200,8 @@ static int rtllib_frag_cache_invalidate(struct rtllib_device *ieee, * * Responsible for handling management control frames * - * Called by rtllib_rx */ + * Called by rtllib_rx + */ static inline int rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats, u16 type, @@ -224,8 +226,9 @@ rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb, return 0; } -/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ -/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ +/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation + * Ethernet-II snap header (RFC1042 for most EtherTypes) + */ static unsigned char rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; @@ -482,7 +485,8 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { /* remove RFC1042 or Bridge-Tunnel encapsulation - * and replace EtherType */ + * and replace EtherType + */ skb_pull(sub_skb, SNAP_SIZE); memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN); @@ -582,8 +586,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, return; } - /* - * Sliding window manipulation. Conditions includes: + /* Sliding window manipulation. Conditions includes: * 1. Incoming SeqNum is equal to WinStart =>Window shift 1 * 2. Incoming SeqNum is larger than the WinEnd => Window shift N */ @@ -598,13 +601,12 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, RTLLIB_DEBUG(RTLLIB_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum); } - /* - * Indication process. + /* Indication process. * After Packet dropping and Sliding Window shifting as above, we can * now just indicate the packets with the SeqNum smaller than latest * WinStart and struct buffer other packets. - */ - /* For Rx Reorder condition: + * + * For Rx Reorder condition: * 1. All packets with SeqNum smaller than WinStart => Indicate * 2. All packets with SeqNum larger than or equal to * WinStart => Buffer it. @@ -647,8 +649,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, pTS->RxIndicateSeq, SeqNum); } } else { - /* - * Packets are dropped if there are not enough reorder + /* Packets are dropped if there are not enough reorder * entries. This part should be modified!! We can just * indicate all the packets in struct buffer and get * reorder entries. @@ -698,7 +699,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, } /* Handling pending timer. Set this timer to prevent from long time - * Rx buffering.*/ + * Rx buffering. + */ if (index > 0) { if (timer_pending(&pTS->RxPktPendingTimer)) del_timer_sync(&pTS->RxPktPendingTimer); @@ -973,7 +975,8 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc, } /* Nullfunc frames may have PS-bit set, so they must be passed to - * hostap_handle_sta_rx() before being dropped here. */ + * hostap_handle_sta_rx() before being dropped here. + */ if (!ieee->IntelPromiscuousModeInfo.bPromiscuousOn) { if (stype != RTLLIB_STYPE_DATA && stype != RTLLIB_STYPE_DATA_CFACK && @@ -1015,7 +1018,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, *crypt = ieee->crypt_info.crypt[idx]; /* allow NULL decrypt to indicate an station specific override - * for default encryption */ + * for default encryption + */ if (*crypt && ((*crypt)->ops == NULL || (*crypt)->ops->decrypt_mpdu == NULL)) *crypt = NULL; @@ -1024,7 +1028,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, /* This seems to be triggered by some (multicast?) * frames from other than current BSS, so just drop the * frames silently instead of filling system log with - * these reports. */ + * these reports. + */ RTLLIB_DEBUG_DROP("Decryption failed (not set) (SA= %pM)\n", hdr->addr2); ieee->ieee_stats.rx_discards_undecryptable++; @@ -1088,11 +1093,13 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, if (frag == 0) { /* copy first fragment (including full headers) into - * beginning of the fragment cache skb */ + * beginning of the fragment cache skb + */ memcpy(skb_put(frag_skb, flen), skb->data, flen); } else { /* append frame payload to the end of the fragment - * cache skb */ + * cache skb + */ memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, flen); } @@ -1102,19 +1109,22 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, if (fc & RTLLIB_FCTL_MOREFRAGS) { /* more fragments expected - leave the skb in fragment * cache for now; it will be delivered to upper layers - * after all fragments have been received */ + * after all fragments have been received + */ return -2; } /* this was the last fragment and the frame will be - * delivered, so remove skb from fragment cache */ + * delivered, so remove skb from fragment cache + */ skb = frag_skb; hdr = (struct rtllib_hdr_4addr *) skb->data; rtllib_frag_cache_invalidate(ieee, hdr); } /* skb: hdr + (possible reassembled) full MSDU payload; possibly still - * encrypted/authenticated */ + * encrypted/authenticated + */ if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) { netdev_info(ieee->dev, "%s: ==>decrypt msdu error\n", __func__); @@ -1127,7 +1137,8 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, rtllib_is_eapol_frame(ieee, skb, hdrlen)) { /* pass unencrypted EAPOL frames even if encryption is - * configured */ + * configured + */ struct eapol *eap = (struct eapol *)(skb->data + 24); RTLLIB_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", @@ -1204,7 +1215,8 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { /* remove RFC1042 or Bridge-Tunnel encapsulation and - * replace EtherType */ + * replace EtherType + */ skb_pull(sub_skb, SNAP_SIZE); memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); @@ -1396,7 +1408,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /* Returning 0 indicates to caller that we have not handled the SKB-- * so it is still allocated and can be used again by underlying - * hardware as a DMA target */ + * hardware as a DMA target + */ return 0; } @@ -1442,7 +1455,8 @@ static int rtllib_rx_Mesh(struct rtllib_device *ieee, struct sk_buff *skb, /* All received frames are sent to this function. @skb contains the frame in * IEEE 802.11 format, i.e., in the format it was sent over air. - * This function is called only as a tasklet (software IRQ). */ + * This function is called only as a tasklet (software IRQ). + */ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats) { @@ -1488,10 +1502,7 @@ EXPORT_SYMBOL(rtllib_rx); static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; -/* -* Make ther structure we read from the beacon packet has -* the right values -*/ +/* Make ther structure we read from the beacon packet has the right values */ static int rtllib_verify_qos_info(struct rtllib_qos_information_element *info_element, int sub_type) { @@ -1509,9 +1520,7 @@ static int rtllib_verify_qos_info(struct rtllib_qos_information_element } -/* - * Parse a QoS parameter element - */ +/* Parse a QoS parameter element */ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info *element_param, struct rtllib_info_element *info_element) @@ -1535,9 +1544,7 @@ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info return ret; } -/* - * Parse a QoS information element - */ +/* Parse a QoS information element */ static int rtllib_read_qos_info_element(struct rtllib_qos_information_element *element_info, struct rtllib_info_element @@ -1566,9 +1573,7 @@ static int rtllib_read_qos_info_element(struct } -/* - * Write QoS parameters from the ac parameters. - */ +/* Write QoS parameters from the ac parameters. */ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info *param_elm, struct rtllib_qos_data *qos_data) { @@ -1627,8 +1632,7 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info return 0; } -/* - * we have a generic data element which it may contain QoS information or +/* we have a generic data element which it may contain QoS information or * parameters element. check the information element length to decide * which type to read */ @@ -1750,7 +1754,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, length, info_element->id); /* We stop processing but don't return an error here * because some misbehaviour APs break this rule. ie. - * Orinoco AP1000. */ + * Orinoco AP1000. + */ break; } @@ -2302,7 +2307,8 @@ static inline int is_same_network(struct rtllib_network *src, /* A network is only a duplicate if the channel, BSSID, ESSID * and the capability field (in particular IBSS and BSS) all match. * We treat all with the same BSSID and channel - * as one network */ + * as one network + */ return (((src->ssid_len == dst->ssid_len) || (!ssidbroad)) && (src->channel == dst->channel) && !memcmp(src->bssid, dst->bssid, ETH_ALEN) && @@ -2524,10 +2530,12 @@ static inline void rtllib_process_probe_response( * * NOTE: This search is definitely not optimized. Once its doing * the "right thing" we'll optimize it for efficiency if - * necessary */ + * necessary + */ /* Search for this entry in the list and update it if it is - * already there. */ + * already there. + */ spin_lock_irqsave(&ieee->lock, flags); if (is_same_network(&ieee->current_network, network, @@ -2556,7 +2564,8 @@ static inline void rtllib_process_probe_response( } /* If we didn't find a match, then get a new network slot to initialize - * with this beacon's information */ + * with this beacon's information + */ if (&target->list == &ieee->network_list) { if (list_empty(&ieee->network_free_list)) { /* If there are no more slots, expire the oldest */ diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index c043d8cb6c8a..23b7a4c3b699 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -68,7 +68,8 @@ static void rtllib_MFIE_Brate(struct rtllib_device *ieee, u8 **tag_p) } /* We may add an option for custom rates that specific HW - * might support */ + * might support + */ *tag_p = tag; } @@ -89,7 +90,8 @@ static void rtllib_MFIE_Grate(struct rtllib_device *ieee, u8 **tag_p) *tag++ = RTLLIB_BASIC_RATE_MASK | RTLLIB_OFDM_RATE_54MB; } /* We may add an option for custom rates that specific HW might - * support */ + * support + */ *tag_p = tag; } @@ -133,8 +135,7 @@ static void enqueue_mgmt(struct rtllib_device *ieee, struct sk_buff *skb) nh = (ieee->mgmt_queue_head + 1) % MGMT_QUEUE_NUM; -/* - * if the queue is full but we have newer frames then +/* if the queue is full but we have newer frames then * just overwrites the oldest. * * if (nh == ieee->mgmt_queue_tail) @@ -273,10 +274,11 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee) if (!ieee->check_nic_enough_desc(ieee->dev, tcb_desc->queue_index) || (skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) || (ieee->queue_stop)) { - /* insert the skb packet to the management queue */ - /* as for the completion function, it does not need + /* insert the skb packet to the management queue + * + * as for the completion function, it does not need * to check it any more. - * */ + */ netdev_info(ieee->dev, "%s():insert to waitqueue, queue_index:%d!\n", __func__, tcb_desc->queue_index); @@ -417,10 +419,7 @@ static void rtllib_send_beacon_cb(unsigned long _ieee) spin_unlock_irqrestore(&ieee->beacon_lock, flags); } -/* - * Description: - * Enable network monitor mode, all rx packets will be received. - */ +/* Enables network monitor mode, all rx packets will be received. */ void rtllib_EnableNetMonitorMode(struct net_device *dev, bool bInitState) { @@ -432,10 +431,8 @@ void rtllib_EnableNetMonitorMode(struct net_device *dev, } -/* - * Description: - * Disable network network monitor mode, only packets destinated to - * us will be received. +/* Disables network monitor mode. Only packets destinated to + * us will be received. */ void rtllib_DisableNetMonitorMode(struct net_device *dev, bool bInitState) @@ -448,9 +445,7 @@ void rtllib_DisableNetMonitorMode(struct net_device *dev, } -/* - * Description: - * This enables the specialized promiscuous mode required by Intel. +/* Enables the specialized promiscuous mode required by Intel. * In this mode, Intel intends to hear traffics from/to other STAs in the * same BSS. Therefore we don't have to disable checking BSSID and we only need * to allow all dest. BUT: if we enable checking BSSID then we can't recv @@ -474,10 +469,8 @@ void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, EXPORT_SYMBOL(rtllib_EnableIntelPromiscuousMode); -/* - * Description: - * This disables the specialized promiscuous mode required by Intel. - * See MgntEnableIntelPromiscuousMode for detail. +/* Disables the specialized promiscuous mode required by Intel. + * See MgntEnableIntelPromiscuousMode for detail. */ void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, bool bInitState) @@ -1709,8 +1702,8 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, (!apset && ssidset && ssidbroad && ssidmatch) || (ieee->is_roaming && ssidset && ssidbroad && ssidmatch)) { /* if the essid is hidden replace it with the - * essid provided by the user. - */ + * essid provided by the user. + */ if (!ssidbroad) { strncpy(tmp_ssid, ieee->current_network.ssid, IW_ESSID_MAX_SIZE); @@ -2008,7 +2001,8 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) timeout = ieee->current_network.beacon_interval; ieee->current_network.dtim_data = RTLLIB_DTIM_INVALID; /* there's no need to nofity AP that I find you buffered - * with broadcast packet */ + * with broadcast packet + */ if (dtim & (RTLLIB_DTIM_UCAST & ieee->ps)) return 2; @@ -2348,8 +2342,7 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) } } } - /* Dummy wirless mode setting to avoid - * encryption issue */ + /* Dummy wirless mode setting to avoid encryption issue */ if (bSupportNmode) { ieee->SetWirelessMode(ieee->dev, ieee->current_network.mode); @@ -2395,8 +2388,8 @@ inline int rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb) return 0; /* FIXME for now repeat all the association procedure - * both for disassociation and deauthentication - */ + * both for disassociation and deauthentication + */ if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && ieee->state == RTLLIB_LINKED && (ieee->iw_mode == IW_MODE_INFRA)) { @@ -2499,16 +2492,17 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee) ieee->stats.multicast++; /* if xmit available, just xmit it immediately, else just insert it to - * the wait queue */ + * the wait queue + */ for (i = 0; i < txb->nr_frags; i++) { queue_len = skb_queue_len(&ieee->skb_waitQ[queue_index]); if ((queue_len != 0) || (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) || (ieee->queue_stop)) { - /* insert the skb packet to the wait queue */ - /* as for the completion function, it does not need + /* insert the skb packet to the wait queue + * as for the completion function, it does not need * to check it any more. - * */ + */ if (queue_len < 200) skb_queue_tail(&ieee->skb_waitQ[queue_index], txb->fragments[i]); @@ -2886,18 +2880,18 @@ static void rtllib_associate_retry_wq(void *data) goto exit; /* until we do not set the state to RTLLIB_NOLINK - * there are no possibility to have someone else trying - * to start an association procedure (we get here with - * ieee->state = RTLLIB_ASSOCIATING). - * When we set the state to RTLLIB_NOLINK it is possible - * that the RX path run an attempt to associate, but - * both rtllib_softmac_check_all_nets and the - * RX path works with ieee->lock held so there are no - * problems. If we are still disassociated then start a scan. - * the lock here is necessary to ensure no one try to start - * an association procedure when we have just checked the - * state and we are going to start the scan. - */ + * there are no possibility to have someone else trying + * to start an association procedure (we get here with + * ieee->state = RTLLIB_ASSOCIATING). + * When we set the state to RTLLIB_NOLINK it is possible + * that the RX path run an attempt to associate, but + * both rtllib_softmac_check_all_nets and the + * RX path works with ieee->lock held so there are no + * problems. If we are still disassociated then start a scan. + * the lock here is necessary to ensure no one try to start + * an association procedure when we have just checked the + * state and we are going to start the scan. + */ ieee->beinretry = true; ieee->state = RTLLIB_NOLINK; @@ -3185,7 +3179,8 @@ void rtllib_softmac_free(struct rtllib_device *ieee) static int rtllib_wpa_enable(struct rtllib_device *ieee, int value) { /* This is called when wpa_supplicant loads and closes the driver - * interface. */ + * interface. + */ netdev_info(ieee->dev, "%s WPA\n", value ? "enabling" : "disabling"); ieee->wpa_enabled = value; memset(ieee->ap_mac_addr, 0, 6); @@ -3490,7 +3485,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, * generate new IEEE 802.11 authentication which may end up in looping * with IEEE 802.1X. If your hardware requires a reset after WEP * configuration (for example... Prism2), implement the reset_port in - * the callbacks structures used to initialize the 802.11 stack. */ + * the callbacks structures used to initialize the 802.11 stack. + */ if (ieee->reset_on_keychange && ieee->iw_mode != IW_MODE_INFRA && ieee->reset_port && diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 2e1aab1230c5..3b159638bba2 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -53,102 +53,99 @@ #include "rtllib.h" -/* - - -802.11 Data Frame - - -802.11 frame_control for data frames - 2 bytes - ,-----------------------------------------------------------------------------------------. -bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | - |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | - |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | - | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | - '-----------------------------------------------------------------------------------------' - /\ - | -802.11 Data Frame | - ,--------- 'ctrl' expands to >-----------' - | - ,--'---,-------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `--------------------------------------------------| |------' -Total: 28 non-data bytes `----.----' - | - .- 'Frame data' expands to <---------------------------' - | - V - ,---------------------------------------------------. -Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | - |------|------|---------|----------|------|---------| -Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | - | DSAP | SSAP | | | | Packet | - | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | - `-----------------------------------------| | -Total: 8 non-data bytes `----.----' - | - .- 'IP Packet' expands, if WEP enabled, to <--' - | - V - ,-----------------------. -Bytes | 4 | 0-2296 | 4 | - |-----|-----------|-----| -Desc. | IV | Encrypted | ICV | - | | IP Packet | | - `-----------------------' -Total: 8 non-data bytes - - -802.3 Ethernet Data Frame - - ,-----------------------------------------. -Bytes | 6 | 6 | 2 | Variable | 4 | - |-------|-------|------|-----------|------| -Desc. | Dest. | Source| Type | IP Packet | fcs | - | MAC | MAC | | | | - `-----------------------------------------' -Total: 18 non-data bytes - -In the event that fragmentation is required, the incoming payload is split into -N parts of size ieee->fts. The first fragment contains the SNAP header and the -remaining packets are just data. - -If encryption is enabled, each fragment payload size is reduced by enough space -to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) -So if you have 1500 bytes of payload with ieee->fts set to 500 without -encryption it will take 3 frames. With WEP it will take 4 frames as the -payload of each frame is reduced to 492 bytes. - -* SKB visualization -* -* ,- skb->data -* | -* | ETHERNET HEADER ,-<-- PAYLOAD -* | | 14 bytes from skb->data -* | 2 bytes for Type --> ,T. | (sizeof ethhdr) -* | | | | -* |,-Dest.--. ,--Src.---. | | | -* | 6 bytes| | 6 bytes | | | | -* v | | | | | | -* 0 | v 1 | v | v 2 -* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 -* ^ | ^ | ^ | -* | | | | | | -* | | | | `T' <---- 2 bytes for Type -* | | | | -* | | '---SNAP--' <-------- 6 bytes for SNAP -* | | -* `-IV--' <-------------------- 4 bytes for IV (WEP) -* -* SNAP HEADER -* -*/ +/* 802.11 Data Frame + * + * + * 802.11 frame_control for data frames - 2 bytes + * ,-----------------------------------------------------------------------------------------. + * bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | + * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| + * val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | + * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| + * desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | + * | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | + * '-----------------------------------------------------------------------------------------' + * /\ + * | + * 802.11 Data Frame | + * ,--------- 'ctrl' expands to >-----------' + * | + * ,--'---,-------------------------------------------------------------. + * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + * |------|------|---------|---------|---------|------|---------|------| + * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | + * | | tion | (BSSID) | | | ence | data | | + * `--------------------------------------------------| |------' + * Total: 28 non-data bytes `----.----' + * | + * .- 'Frame data' expands to <---------------------------' + * | + * V + * ,---------------------------------------------------. + * Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | + * |------|------|---------|----------|------|---------| + * Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | + * | DSAP | SSAP | | | | Packet | + * | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | + * `-----------------------------------------| | + * Total: 8 non-data bytes `----.----' + * | + * .- 'IP Packet' expands, if WEP enabled, to <--' + * | + * V + * ,-----------------------. + * Bytes | 4 | 0-2296 | 4 | + * |-----|-----------|-----| + * Desc. | IV | Encrypted | ICV | + * | | IP Packet | | + * `-----------------------' + * Total: 8 non-data bytes + * + * + * 802.3 Ethernet Data Frame + * + * ,-----------------------------------------. + * Bytes | 6 | 6 | 2 | Variable | 4 | + * |-------|-------|------|-----------|------| + * Desc. | Dest. | Source| Type | IP Packet | fcs | + * | MAC | MAC | | | | + * `-----------------------------------------' + * Total: 18 non-data bytes + * + * In the event that fragmentation is required, the incoming payload is split into + * N parts of size ieee->fts. The first fragment contains the SNAP header and the + * remaining packets are just data. + * + * If encryption is enabled, each fragment payload size is reduced by enough space + * to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) + * So if you have 1500 bytes of payload with ieee->fts set to 500 without + * encryption it will take 3 frames. With WEP it will take 4 frames as the + * payload of each frame is reduced to 492 bytes. + * + * SKB visualization + * + * ,- skb->data + * | + * | ETHERNET HEADER ,-<-- PAYLOAD + * | | 14 bytes from skb->data + * | 2 bytes for Type --> ,T. | (sizeof ethhdr) + * | | | | + * |,-Dest.--. ,--Src.---. | | | + * | 6 bytes| | 6 bytes | | | | + * v | | | | | | + * 0 | v 1 | v | v 2 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + * ^ | ^ | ^ | + * | | | | | | + * | | | | `T' <---- 2 bytes for Type + * | | | | + * | | '---SNAP--' <-------- 6 bytes for SNAP + * | | + * `-IV--' <-------------------- 4 bytes for IV (WEP) + * + * SNAP HEADER + * + */ static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; @@ -190,10 +187,12 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, return -1; } /* To encrypt, frame format is: - * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ + * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) + */ /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so - * call both MSDU and MPDU encryption functions from here. */ + * call both MSDU and MPDU encryption functions from here. + */ atomic_inc(&crypt->refcnt); res = 0; if (crypt->ops->encrypt_msdu) @@ -591,7 +590,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) spin_lock_irqsave(&ieee->lock, flags); /* If there is no driver handler to take the TXB, don't bother - * creating it... */ + * creating it... + */ if ((!ieee->hard_start_xmit && !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)) || ((!ieee->softmac_data_hard_start_xmit && @@ -692,7 +692,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) if (ieee->iw_mode == IW_MODE_INFRA) { fc |= RTLLIB_FCTL_TODS; /* To DS: Addr1 = BSSID, Addr2 = SA, - Addr3 = DA */ + * Addr3 = DA + */ memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN); memcpy(&header.addr2, &src, ETH_ALEN); @@ -703,7 +704,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) memcpy(&header.addr3, &dest, ETH_ALEN); } else if (ieee->iw_mode == IW_MODE_ADHOC) { /* not From/To DS: Addr1 = DA, Addr2 = SA, - Addr3 = BSSID */ + * Addr3 = BSSID + */ memcpy(&header.addr1, dest, ETH_ALEN); memcpy(&header.addr2, src, ETH_ALEN); memcpy(&header.addr3, ieee->current_network.bssid, @@ -715,7 +717,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) header.frame_ctl = cpu_to_le16(fc); /* Determine fragmentation size based on destination (multicast - * and broadcast are not fragmented) */ + * and broadcast are not fragmented) + */ if (bIsMulticast) { frag_size = MAX_FRAG_THRESHOLD; qos_ctl |= QOS_CTL_NOTCONTAIN_ACK; @@ -744,14 +747,16 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* Determine amount of payload per fragment. Regardless of if * this stack is providing the full 802.11 header, one will * eventually be affixed to this fragment -- so we must account - * for it when determining the amount of payload space. */ + * for it when determining the amount of payload space. + */ bytes_per_frag = frag_size - hdr_len; if (ieee->config & (CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS)) bytes_per_frag -= RTLLIB_FCS_LEN; /* Each fragment may need to have room for encrypting - * pre/postfix */ + * pre/postfix + */ if (encrypt) { bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len + crypt->ops->extra_mpdu_postfix_len + @@ -759,7 +764,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) crypt->ops->extra_msdu_postfix_len; } /* Number of fragments is the total bytes_per_frag / - * payload_per_fragment */ + * payload_per_fragment + */ nr_frags = bytes / bytes_per_frag; bytes_last_frag = bytes % bytes_per_frag; if (bytes_last_frag) @@ -769,7 +775,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* When we allocate the TXB we allocate enough space for the * reserve and full fragment bytes (bytes_per_frag doesn't - * include prefix, postfix, header, FCS, etc.) */ + * include prefix, postfix, header, FCS, etc.) + */ txb = rtllib_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC); if (unlikely(!txb)) { @@ -813,7 +820,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) memcpy(frag_hdr, &header, hdr_len); /* If this is not the last fragment, then add the - * MOREFRAGS bit to the frame control */ + * MOREFRAGS bit to the frame control + */ if (i != nr_frags - 1) { frag_hdr->frame_ctl = cpu_to_le16( fc | RTLLIB_FCTL_MOREFRAGS); @@ -848,7 +856,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* Encryption routine will move the header forward in * order to insert the IV between the header and the - * payload */ + * payload + */ if (encrypt) rtllib_encrypt_fragment(ieee, skb_frag, hdr_len); diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index a1cae3748ae6..64709decb57e 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -241,7 +241,8 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, } /* Add EXTRA: Age to display seconds since last beacon/probe response - * for given network. */ + * for given network. + */ iwe.cmd = IWEVCUSTOM; p = custom; p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), @@ -337,7 +338,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, RTLLIB_DEBUG_WX("Disabling encryption.\n"); /* Check all the keys to see if any are still configured, - * and if no key index was provided, de-init them all */ + * and if no key index was provided, de-init them all + */ for (i = 0; i < NUM_WEP_KEYS; i++) { if (ieee->crypt_info.crypt[i] != NULL) { if (key_provided) @@ -364,7 +366,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, if (*crypt != NULL && (*crypt)->ops != NULL && strcmp((*crypt)->ops->name, "R-WEP") != 0) { /* changing to use WEP; deinit previously used algorithm - * on this key */ + * on this key + */ lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); } @@ -412,7 +415,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, (*crypt)->priv); sec.flags |= (1 << key); /* This ensures a key will be activated if no key is - * explicitly set */ + * explicitly set + */ if (key == sec.active_key) sec.flags |= SEC_ACTIVE_KEY; ieee->crypt_info.tx_keyidx = key; @@ -451,7 +455,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, "OPEN" : "SHARED KEY"); /* For now we just support WEP, so only set that security level... - * TODO: When WPA is added this is one place that needs to change */ + * TODO: When WPA is added this is one place that needs to change + */ sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ @@ -462,7 +467,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, * generate new IEEE 802.11 authentication which may end up in looping * with IEEE 802.1X. If your hardware requires a reset after WEP * configuration (for example... Prism2), implement the reset_port in - * the callbacks structures used to initialize the 802.11 stack. */ + * the callbacks structures used to initialize the 802.11 stack. + */ if (ieee->reset_on_keychange && ieee->iw_mode != IW_MODE_INFRA && ieee->reset_port && ieee->reset_port(dev)) { @@ -791,8 +797,7 @@ int rtllib_wx_set_auth(struct rtllib_device *ieee, case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_GROUP: case IW_AUTH_KEY_MGMT: - /* - * Host AP driver does not use these parameters and allows + /* Host AP driver does not use these parameters and allows * wpa_supplicant to control them internally. */ break; -- cgit v1.2.3 From 8852112e1c23a27e41f1b6b401c254c2de0f82b5 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Wed, 1 Apr 2015 00:24:38 +0200 Subject: staging: rtl8192e: Remove dead code Remove commented-out code Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h | 7 ------- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 5 +---- drivers/staging/rtl8192e/rtllib_rx.c | 7 ------- drivers/staging/rtl8192e/rtllib_wx.c | 2 -- 5 files changed, 2 insertions(+), 22 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index cb74e55b20d2..2869602436ef 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2195,8 +2195,7 @@ rtl8192_InitializeVariables(struct net_device *dev) priv->rtllib->softmac_features = IEEE_SOFTMAC_SCAN | IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | - IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE /* | - IEEE_SOFTMAC_BEACONS*/; + IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE; priv->rtllib->tx_headroom = sizeof(struct tx_fwinfo_8190pci); diff --git a/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h index 970298b07af7..03eee3d059c6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h @@ -888,13 +888,6 @@ #define bOFDMPHY0_End 0xcff #define bOFDMPHY1_End 0xdff -/*#define max debug item in each debug page -#define bMaxItem_FPGA_PHY0 0x9 -#define bMaxItem_FPGA_PHY1 0x3 -#define bMaxItem_PHY_11B 0x16 -#define bMaxItem_OFDM_PHY0 0x29 -#define bMaxItem_OFDM_PHY1 0x0 */ - #define bPMACControl 0x0 #define bWMACControl 0x1 #define bWNICControl 0x2 diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index 505d466a6a8d..7d486e8887f8 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -120,10 +120,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, fc = le16_to_cpu(hdr->frame_ctl); a4_included = ((fc & (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS)) == (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS)); - /* - qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) && - (WLAN_FC_GET_STYPE(fc) & 0x08)); - */ + qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x80)); aad_len = 22; diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index c1418b457a45..fe3e7e1273ff 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -2208,13 +2208,6 @@ static inline int rtllib_network_init( struct rtllib_network *network, struct rtllib_rx_stats *stats) { - - /* - network->qos_data.active = 0; - network->qos_data.supported = 0; - network->qos_data.param_count = 0; - network->qos_data.old_param_count = 0; - */ memset(&network->qos_data, 0, sizeof(struct rtllib_qos_data)); /* Pull out fixed field data */ diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 64709decb57e..6234aae5b069 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -113,8 +113,6 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, /* Add frequency/channel */ iwe.cmd = SIOCGIWFREQ; -/* iwe.u.freq.m = rtllib_frequency(network->channel, network->mode); - iwe.u.freq.e = 3; */ iwe.u.freq.m = network->channel; iwe.u.freq.e = 0; iwe.u.freq.i = 0; -- cgit v1.2.3 From c4151700bbf661d0f73c1beffb35b2039f5306fd Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 31 Mar 2015 11:58:55 +0300 Subject: Staging: rtl8192u: use correct array for debug output This is supposed to be ->rates_ex[] instead of ->rates[]. I found this because static checkers complain than ->rates is too small so we're reading beyond the end of the array. It has 12 elements instead of 15. This bug was apparently copy and pasted from ipw2x00. I fixed it before in that driver 428e3cf5f98c ('ipw2x00: printing the wrong array in debug code') Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index b4d09b21f8ec..9fbb53d8c6bf 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -1704,7 +1704,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, #ifdef CONFIG_IEEE80211_DEBUG p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", - network->rates[i]); + network->rates_ex[i]); #endif if (ieee80211_is_ofdm_rate (info_element->data[i])) { -- cgit v1.2.3 From 97498bb5764b8ddb3e14f7699c50e6bacbc4581c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 4 Apr 2015 12:00:25 +0200 Subject: Revert "Staging: sm750fb: Fix C99 Comments" This reverts commit 6ad6b5ed3e2472b399b567a2f036006bf25df467. It added a file that should not be in the kernel source tree. Cc: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_chip.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 9b5bb7eba279..7b28328c92f8 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -17,7 +17,7 @@ logical_chip_type_t getChipType(void) char physicalRev; logical_chip_type_t chip; - physicalID = devId750; /* either 0x718 or 0x750 */ + physicalID = devId750;//either 0x718 or 0x750 physicalRev = revId750; if (physicalID == 0x718) @@ -257,7 +257,7 @@ int ddk750_initHw(initchip_param_t *pInitParam) unsigned int ulReg; #if 0 - /* move the code to map regiter function. */ + //move the code to map regiter function. if (getChipType() == SM718) { /* turn on big endian bit*/ ulReg = PEEK32(0x74); @@ -488,6 +488,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) } } + //printk("Finally: pll->n[%lu],m[%lu],od[%lu],pod[%lu]\n",pll->N,pll->M,pll->OD,pll->POD); return ret; } @@ -579,9 +580,14 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ } /* Restore input frequency from Khz to hz unit */ +// pPLL->inputFreq *= 1000; ulRequestClk *= 1000; pPLL->inputFreq = DEFAULT_INPUT_CLOCK; /* Default reference clock */ + /* Output debug information */ + //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Requested Frequency = %d\n", ulRequestClk)); + //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Input CLK = %dHz, M=%d, N=%d, OD=%d, POD=%d\n", pPLL->inputFreq, pPLL->M, pPLL->N, pPLL->OD, pPLL->POD)); + /* Return actual frequency that the PLL can set */ ret = calcPLL(pPLL); return ret; -- cgit v1.2.3 From b183c11217e10c274720795daed5703c2186a459 Mon Sep 17 00:00:00 2001 From: Tal Shorer Date: Sun, 5 Apr 2015 13:54:09 +0300 Subject: staging: lustre: fix sparse warning Sparse reports: drivers/staging/lustre/lustre/obdclass/obd_mount.c:1284:6: warning: symbol 'lustre_kill_super' was not declared. Should it be static? Fix this warning by making lustre_kill_super static. It is not used outside this file. Signed-off-by: Tal Shorer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 3a7404148308..3437b2ecfc02 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -1286,7 +1286,7 @@ struct dentry *lustre_mount(struct file_system_type *fs_type, int flags, return mount_nodev(fs_type, flags, &lmd2, lustre_fill_super); } -void lustre_kill_super(struct super_block *sb) +static void lustre_kill_super(struct super_block *sb) { struct lustre_sb_info *lsi = s2lsi(sb); -- cgit v1.2.3 From a18ac314ebff427b972a0bb5ddfc205b8145e04e Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 5 Apr 2015 14:06:35 +0200 Subject: staging: lustre: lnet: lnet: fix error return code Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/api-ni.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index faceb9505d84..4a14e5109821 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -650,15 +650,19 @@ lnet_prepare(lnet_pid_t requested_pid) recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME, LNET_FL_MAX_MES, sizeof(lnet_me_t)); - if (recs == NULL) + if (recs == NULL) { + rc = -ENOMEM; goto failed; + } the_lnet.ln_me_containers = recs; recs = lnet_res_containers_create(LNET_COOKIE_TYPE_MD, LNET_FL_MAX_MDS, sizeof(lnet_libmd_t)); - if (recs == NULL) + if (recs == NULL) { + rc = -ENOMEM; goto failed; + } the_lnet.ln_md_containers = recs; -- cgit v1.2.3 From f9541f8239a5765595543b021b2dce6a8d6653ab Mon Sep 17 00:00:00 2001 From: "Amaury.Bouchra.Pilet@ENS.fr" Date: Sun, 5 Apr 2015 00:58:16 +0200 Subject: staging: lustre: orthography & coding style Orthography and coding style corrections. Signed-off-by: Amaury Bouchra Pilet Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/peer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c index c93ae8510530..45b5742f1bd2 100644 --- a/drivers/staging/lustre/lnet/lnet/peer.c +++ b/drivers/staging/lustre/lnet/lnet/peer.c @@ -87,7 +87,7 @@ lnet_peer_tables_destroy(void) cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) { hash = ptable->pt_hash; - if (hash == NULL) /* not intialized */ + if (hash == NULL) /* not initialized */ break; LASSERT(list_empty(&ptable->pt_deathrow)); @@ -132,7 +132,7 @@ lnet_peer_tables_cleanup(void) } cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) { - LIST_HEAD (deathrow); + LIST_HEAD(deathrow); lnet_peer_t *lp; lnet_net_lock(i); -- cgit v1.2.3 From 23602adfee71894d04ce2b69cbd6d29ab2e77d6d Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 30 Mar 2015 23:39:16 -0400 Subject: lustre: kill unused members of struct vvp_thread_info Signed-off-by: Al Viro --- drivers/staging/lustre/lustre/llite/llite_internal.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 2af1d7286250..e7422f5c9c6f 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -938,10 +938,8 @@ struct ll_cl_context { }; struct vvp_thread_info { - struct iovec vti_local_iov; struct vvp_io_args vti_args; struct ra_io_arg vti_ria; - struct kiocb vti_kiocb; struct ll_cl_context vti_io_ctx; }; -- cgit v1.2.3 From e145286685fe6a9eb3f984832b0667d0407081b1 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 3 Apr 2015 15:09:38 -0400 Subject: ashmem: use __vfs_read() Signed-off-by: Al Viro --- drivers/staging/android/ashmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index d140b733940c..c5c037ccf32c 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -310,7 +310,7 @@ static ssize_t ashmem_read(struct file *file, char __user *buf, * be destroyed until all references to the file are dropped and * ashmem_release is called. */ - ret = asma->file->f_op->read(asma->file, buf, len, pos); + ret = __vfs_read(asma->file, buf, len, pos); if (ret >= 0) { /** Update backing file pos, since f_ops->read() doesn't */ asma->file->f_pos = *pos; -- cgit v1.2.3 From 79ff50c09eee690985e178417b36d7128ece8b68 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 3 Apr 2015 15:14:42 -0400 Subject: serial2002: switch to __vfs_read/__vfs_write Signed-off-by: Al Viro --- drivers/staging/comedi/drivers/serial2002.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index 71226ee9064e..a7f170e60633 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -110,24 +110,16 @@ static int serial2002_tty_write(struct file *f, unsigned char *buf, int count) { const char __user *p = (__force const char __user *)buf; int result; + loff_t offset = 0; mm_segment_t oldfs; oldfs = get_fs(); set_fs(KERNEL_DS); - f->f_pos = 0; - result = f->f_op->write(f, p, count, &f->f_pos); + result = __vfs_write(f, p, count, &offset); set_fs(oldfs); return result; } -static int serial2002_tty_readb(struct file *f, unsigned char *buf) -{ - char __user *p = (__force char __user *)buf; - - f->f_pos = 0; - return f->f_op->read(f, p, 1, &f->f_pos); -} - static void serial2002_tty_read_poll_wait(struct file *f, int timeout) { struct poll_wqueues table; @@ -163,13 +155,15 @@ static int serial2002_tty_read(struct file *f, int timeout) result = -1; if (!IS_ERR(f)) { mm_segment_t oldfs; + char __user *p = (__force char __user *)&ch; + loff_t offset = 0; oldfs = get_fs(); set_fs(KERNEL_DS); if (f->f_op->poll) { serial2002_tty_read_poll_wait(f, timeout); - if (serial2002_tty_readb(f, &ch) == 1) + if (__vfs_read(f, p, 1, &offset) == 1) result = ch; } else { /* Device does not support poll, busy wait */ @@ -180,7 +174,7 @@ static int serial2002_tty_read(struct file *f, int timeout) if (retries >= timeout) break; - if (serial2002_tty_readb(f, &ch) == 1) { + if (__vfs_read(f, p, 1, &offset) == 1) { result = ch; break; } -- cgit v1.2.3 From 5d5d568975307877e9195f5305f4240e506a2807 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 3 Apr 2015 15:41:18 -0400 Subject: make new_sync_{read,write}() static All places outside of core VFS that checked ->read and ->write for being NULL or called the methods directly are gone now, so NULL {read,write} with non-NULL {read,write}_iter will do the right thing in all cases. Signed-off-by: Al Viro --- drivers/staging/lustre/lustre/llite/file.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 5ebee6ca0a10..d73111ef949e 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3128,9 +3128,7 @@ int ll_inode_permission(struct inode *inode, int mask) /* -o localflock - only provides locally consistent flock locks */ struct file_operations ll_file_operations = { - .read = new_sync_read, .read_iter = ll_file_read_iter, - .write = new_sync_write, .write_iter = ll_file_write_iter, .unlocked_ioctl = ll_file_ioctl, .open = ll_file_open, @@ -3143,9 +3141,7 @@ struct file_operations ll_file_operations = { }; struct file_operations ll_file_operations_flock = { - .read = new_sync_read, .read_iter = ll_file_read_iter, - .write = new_sync_write, .write_iter = ll_file_write_iter, .unlocked_ioctl = ll_file_ioctl, .open = ll_file_open, @@ -3161,9 +3157,7 @@ struct file_operations ll_file_operations_flock = { /* These are for -o noflock - to return ENOSYS on flock calls */ struct file_operations ll_file_operations_noflock = { - .read = new_sync_read, .read_iter = ll_file_read_iter, - .write = new_sync_write, .write_iter = ll_file_write_iter, .unlocked_ioctl = ll_file_ioctl, .open = ll_file_open, -- cgit v1.2.3 From 6f67376318abea58589ebe6d69dffeabb6f6c26a Mon Sep 17 00:00:00 2001 From: Omar Sandoval Date: Mon, 16 Mar 2015 04:33:52 -0700 Subject: direct_IO: use iov_iter_rw() instead of rw everywhere The rw parameter to direct_IO is redundant with iov_iter->type, and treated slightly differently just about everywhere it's used: some users do rw & WRITE, and others do rw == WRITE where they should be doing a bitwise check. Simplify this with the new iov_iter_rw() helper, which always returns either READ or WRITE. Signed-off-by: Omar Sandoval Signed-off-by: Al Viro --- drivers/staging/lustre/lustre/llite/rw26.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 2f21304046aa..3aa9de6bcc40 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -399,7 +399,7 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb, * size changing by concurrent truncates and writes. * 1. Need inode mutex to operate transient pages. */ - if (rw == READ) + if (iov_iter_rw(iter) == READ) mutex_lock(&inode->i_mutex); LASSERT(obj->cob_transient_pages == 0); @@ -408,7 +408,7 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb, size_t offs; count = min_t(size_t, iov_iter_count(iter), size); - if (rw == READ) { + if (iov_iter_rw(iter) == READ) { if (file_offset >= i_size_read(inode)) break; if (file_offset + count > i_size_read(inode)) @@ -418,11 +418,11 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb, result = iov_iter_get_pages_alloc(iter, &pages, count, &offs); if (likely(result > 0)) { int n = DIV_ROUND_UP(result + offs, PAGE_SIZE); - result = ll_direct_IO_26_seg(env, io, rw, inode, - file->f_mapping, - result, file_offset, - pages, n); - ll_free_user_pages(pages, n, rw==READ); + result = ll_direct_IO_26_seg(env, io, iov_iter_rw(iter), + inode, file->f_mapping, + result, file_offset, pages, + n); + ll_free_user_pages(pages, n, iov_iter_rw(iter) == READ); } if (unlikely(result <= 0)) { /* If we can't allocate a large enough buffer @@ -449,11 +449,11 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb, } out: LASSERT(obj->cob_transient_pages == 0); - if (rw == READ) + if (iov_iter_rw(iter) == READ) mutex_unlock(&inode->i_mutex); if (tot_bytes > 0) { - if (rw == WRITE) { + if (iov_iter_rw(iter) == WRITE) { struct lov_stripe_md *lsm; lsm = ccc_inode_lsm_get(inode); -- cgit v1.2.3 From 22c6186ecea0be9eff1c399298ad36e94a59995f Mon Sep 17 00:00:00 2001 From: Omar Sandoval Date: Mon, 16 Mar 2015 04:33:53 -0700 Subject: direct_IO: remove rw from a_ops->direct_IO() Now that no one is using rw, remove it completely. Signed-off-by: Omar Sandoval Signed-off-by: Al Viro --- drivers/staging/lustre/lustre/llite/rw26.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 3aa9de6bcc40..0d7ce6b0e23c 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -359,8 +359,8 @@ static ssize_t ll_direct_IO_26_seg(const struct lu_env *env, struct cl_io *io, * up to 22MB for 128kB kmalloc and up to 682MB for 4MB kmalloc. */ #define MAX_DIO_SIZE ((MAX_MALLOC / sizeof(struct brw_page) * PAGE_CACHE_SIZE) & \ ~(DT_MAX_BRW_SIZE - 1)) -static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb, - struct iov_iter *iter, loff_t file_offset) +static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter, + loff_t file_offset) { struct lu_env *env; struct cl_io *io; -- cgit v1.2.3 From b9ea25152e56365ce149b9a39637cd7a16eec556 Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Tue, 14 Apr 2015 15:45:27 -0700 Subject: page_writeback: clean up mess around cancel_dirty_page() This patch replaces cancel_dirty_page() with a helper function account_page_cleaned() which only updates counters. It's called from truncate_complete_page() and from try_to_free_buffers() (hack for ext3). Page is locked in both cases, page-lock protects against concurrent dirtiers: see commit 2d6d7f982846 ("mm: protect set_page_dirty() from ongoing truncation"). Delete_from_page_cache() shouldn't be called for dirty pages, they must be handled by caller (either written or truncated). This patch treats final dirty accounting fixup at the end of __delete_from_page_cache() as a debug check and adds WARN_ON_ONCE() around it. If something removes dirty pages without proper handling that might be a bug and unwritten data might be lost. Hugetlbfs has no dirty pages accounting, ClearPageDirty() is enough here. cancel_dirty_page() in nfs_wb_page_cancel() is redundant. This is helper for nfs_invalidate_page() and it's called only in case complete invalidation. The mess was started in v2.6.20 after commits 46d2277c796f ("Clean up and make try_to_free_buffers() not race with dirty pages") and 3e67c0987d75 ("truncate: clear page dirtiness before running try_to_free_buffers()") first was reverted right in v2.6.20 in commit ecdfc9787fe5 ("Resurrect 'try_to_free_buffers()' VM hackery"), second in v2.6.25 commit a2b345642f53 ("Fix dirty page accounting leak with ext3 data=journal"). Custom fixes were introduced between these points. NFS in v2.6.23, commit 1b3b4a1a2deb ("NFS: Fix a write request leak in nfs_invalidate_page()"). Kludge in __delete_from_page_cache() in v2.6.24, commit 3a6927906f1b ("Do dirty page accounting when removing a page from the page cache"). Since v2.6.25 all of them are redundant. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Konstantin Khlebnikov Cc: Tejun Heo Cc: Jan Kara Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h index a260e99a4447..d72605864b0a 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h @@ -55,7 +55,9 @@ truncate_complete_page(struct address_space *mapping, struct page *page) if (PagePrivate(page)) page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE); - cancel_dirty_page(page, PAGE_SIZE); + if (TestClearPageDirty(page)) + account_page_cleaned(page, mapping); + ClearPageMappedToDisk(page); ll_delete_from_page_cache(page); } -- cgit v1.2.3 From 2813893f8b197a14f1e1ddb04d99bce46817c84a Mon Sep 17 00:00:00 2001 From: Iulia Manda Date: Wed, 15 Apr 2015 16:16:41 -0700 Subject: kernel: conditionally support non-root users, groups and capabilities There are a lot of embedded systems that run most or all of their functionality in init, running as root:root. For these systems, supporting multiple users is not necessary. This patch adds a new symbol, CONFIG_MULTIUSER, that makes support for non-root users, non-root groups, and capabilities optional. It is enabled under CONFIG_EXPERT menu. When this symbol is not defined, UID and GID are zero in any possible case and processes always have all capabilities. The following syscalls are compiled out: setuid, setregid, setgid, setreuid, setresuid, getresuid, setresgid, getresgid, setgroups, getgroups, setfsuid, setfsgid, capget, capset. Also, groups.c is compiled out completely. In kernel/capability.c, capable function was moved in order to avoid adding two ifdef blocks. This change saves about 25 KB on a defconfig build. The most minimal kernels have total text sizes in the high hundreds of kB rather than low MB. (The 25k goes down a bit with allnoconfig, but not that much. The kernel was booted in Qemu. All the common functionalities work. Adding users/groups is not possible, failing with -ENOSYS. Bloat-o-meter output: add/remove: 7/87 grow/shrink: 19/397 up/down: 1675/-26325 (-24650) [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Iulia Manda Reviewed-by: Josh Triplett Acked-by: Geert Uytterhoeven Tested-by: Paul E. McKenney Reviewed-by: Paul E. McKenney Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/staging/lustre/lustre/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/lustre/lustre/Kconfig b/drivers/staging/lustre/lustre/Kconfig index 6725467ef4d0..62c7bba75274 100644 --- a/drivers/staging/lustre/lustre/Kconfig +++ b/drivers/staging/lustre/lustre/Kconfig @@ -10,6 +10,7 @@ config LUSTRE_FS select CRYPTO_SHA1 select CRYPTO_SHA256 select CRYPTO_SHA512 + depends on MULTIUSER help This option enables Lustre file system client support. Choose Y here if you want to access a Lustre file system cluster. To compile -- cgit v1.2.3