Skip to content

Commit

Permalink
Merge tag 'staging-4.5-rc2' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/gregkh/staging

Pull staging fixes from Greg KH:
 "Here are some small staging driver fixes for 4.5-rc2.

  One of them predated 4.4-final, but I missed that merge window due to
  the holliday.  The others fix reported issues that have come up
  recently.  The tty change is needed for the speakup driver fix and has
  the ack of the tty driver maintainer as well, i.e.  myself :)

  All have been in linux-next with no reported issues"

* tag 'staging-4.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  Staging: speakup: fix read scrolled-back VT
  Staging: speakup: Fix getting port information
  Revert "Staging: panel: usleep_range is preferred over udelay"
  iio: adis_buffer: Fix out-of-bounds memory access
  • Loading branch information
torvalds committed Feb 1, 2016
2 parents f3ca903 + 88867e3 commit 8c4e378
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 29 deletions.
2 changes: 1 addition & 1 deletion drivers/iio/imu/adis_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,
return -ENOMEM;

rx = adis->buffer;
tx = rx + indio_dev->scan_bytes;
tx = rx + scan_count;

spi_message_init(&adis->msg);

Expand Down
34 changes: 15 additions & 19 deletions drivers/staging/panel/panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,7 @@ static void lcd_write_cmd_s(int cmd)
lcd_send_serial(0x1F); /* R/W=W, RS=0 */
lcd_send_serial(cmd & 0x0F);
lcd_send_serial((cmd >> 4) & 0x0F);
/* the shortest command takes at least 40 us */
usleep_range(40, 100);
udelay(40); /* the shortest command takes at least 40 us */
spin_unlock_irq(&pprt_lock);
}

Expand All @@ -837,8 +836,7 @@ static void lcd_write_data_s(int data)
lcd_send_serial(0x5F); /* R/W=W, RS=1 */
lcd_send_serial(data & 0x0F);
lcd_send_serial((data >> 4) & 0x0F);
/* the shortest data takes at least 40 us */
usleep_range(40, 100);
udelay(40); /* the shortest data takes at least 40 us */
spin_unlock_irq(&pprt_lock);
}

Expand All @@ -848,20 +846,19 @@ static void lcd_write_cmd_p8(int cmd)
spin_lock_irq(&pprt_lock);
/* present the data to the data port */
w_dtr(pprt, cmd);
/* maintain the data during 20 us before the strobe */
usleep_range(20, 100);
udelay(20); /* maintain the data during 20 us before the strobe */

bits.e = BIT_SET;
bits.rs = BIT_CLR;
bits.rw = BIT_CLR;
set_ctrl_bits();

usleep_range(40, 100); /* maintain the strobe during 40 us */
udelay(40); /* maintain the strobe during 40 us */

bits.e = BIT_CLR;
set_ctrl_bits();

usleep_range(120, 500); /* the shortest command takes at least 120 us */
udelay(120); /* the shortest command takes at least 120 us */
spin_unlock_irq(&pprt_lock);
}

Expand All @@ -871,20 +868,19 @@ static void lcd_write_data_p8(int data)
spin_lock_irq(&pprt_lock);
/* present the data to the data port */
w_dtr(pprt, data);
/* maintain the data during 20 us before the strobe */
usleep_range(20, 100);
udelay(20); /* maintain the data during 20 us before the strobe */

bits.e = BIT_SET;
bits.rs = BIT_SET;
bits.rw = BIT_CLR;
set_ctrl_bits();

usleep_range(40, 100); /* maintain the strobe during 40 us */
udelay(40); /* maintain the strobe during 40 us */

bits.e = BIT_CLR;
set_ctrl_bits();

usleep_range(45, 100); /* the shortest data takes at least 45 us */
udelay(45); /* the shortest data takes at least 45 us */
spin_unlock_irq(&pprt_lock);
}

Expand All @@ -894,7 +890,7 @@ static void lcd_write_cmd_tilcd(int cmd)
spin_lock_irq(&pprt_lock);
/* present the data to the control port */
w_ctr(pprt, cmd);
usleep_range(60, 120);
udelay(60);
spin_unlock_irq(&pprt_lock);
}

Expand All @@ -904,7 +900,7 @@ static void lcd_write_data_tilcd(int data)
spin_lock_irq(&pprt_lock);
/* present the data to the data port */
w_dtr(pprt, data);
usleep_range(60, 120);
udelay(60);
spin_unlock_irq(&pprt_lock);
}

Expand Down Expand Up @@ -947,7 +943,7 @@ static void lcd_clear_fast_s(void)
lcd_send_serial(0x5F); /* R/W=W, RS=1 */
lcd_send_serial(' ' & 0x0F);
lcd_send_serial((' ' >> 4) & 0x0F);
usleep_range(40, 100); /* the shortest data takes at least 40 us */
udelay(40); /* the shortest data takes at least 40 us */
}
spin_unlock_irq(&pprt_lock);

Expand All @@ -971,21 +967,21 @@ static void lcd_clear_fast_p8(void)
w_dtr(pprt, ' ');

/* maintain the data during 20 us before the strobe */
usleep_range(20, 100);
udelay(20);

bits.e = BIT_SET;
bits.rs = BIT_SET;
bits.rw = BIT_CLR;
set_ctrl_bits();

/* maintain the strobe during 40 us */
usleep_range(40, 100);
udelay(40);

bits.e = BIT_CLR;
set_ctrl_bits();

/* the shortest data takes at least 45 us */
usleep_range(45, 100);
udelay(45);
}
spin_unlock_irq(&pprt_lock);

Expand All @@ -1007,7 +1003,7 @@ static void lcd_clear_fast_tilcd(void)
for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) {
/* present the data to the data port */
w_dtr(pprt, ' ');
usleep_range(60, 120);
udelay(60);
}

spin_unlock_irq(&pprt_lock);
Expand Down
21 changes: 13 additions & 8 deletions drivers/staging/speakup/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,9 @@ static struct notifier_block vt_notifier_block = {
.notifier_call = vt_notifier_call,
};

static unsigned char get_attributes(u16 *pos)
static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
{
pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
return (u_char) (scr_readw(pos) >> 8);
}

Expand All @@ -275,7 +276,7 @@ static void speakup_date(struct vc_data *vc)
spk_y = spk_cy = vc->vc_y;
spk_pos = spk_cp = vc->vc_pos;
spk_old_attr = spk_attr;
spk_attr = get_attributes((u_short *) spk_pos);
spk_attr = get_attributes(vc, (u_short *)spk_pos);
}

static void bleep(u_short val)
Expand Down Expand Up @@ -469,8 +470,12 @@ static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)
u16 ch = ' ';

if (vc && pos) {
u16 w = scr_readw(pos);
u16 c = w & 0xff;
u16 w;
u16 c;

pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
w = scr_readw(pos);
c = w & 0xff;

if (w & vc->vc_hi_font_mask)
c |= 0x100;
Expand Down Expand Up @@ -746,7 +751,7 @@ static int get_line(struct vc_data *vc)
u_char tmp2;

spk_old_attr = spk_attr;
spk_attr = get_attributes((u_short *) spk_pos);
spk_attr = get_attributes(vc, (u_short *)spk_pos);
for (i = 0; i < vc->vc_cols; i++) {
buf[i] = (u_char) get_char(vc, (u_short *) tmp, &tmp2);
tmp += 2;
Expand Down Expand Up @@ -811,7 +816,7 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to,
u_short saved_punc_mask = spk_punc_mask;

spk_old_attr = spk_attr;
spk_attr = get_attributes((u_short *) from);
spk_attr = get_attributes(vc, (u_short *)from);
while (from < to) {
buf[i++] = (char)get_char(vc, (u_short *) from, &tmp);
from += 2;
Expand Down Expand Up @@ -886,7 +891,7 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc)
sentmarks[bn][0] = &sentbuf[bn][0];
i = 0;
spk_old_attr = spk_attr;
spk_attr = get_attributes((u_short *) start);
spk_attr = get_attributes(vc, (u_short *)start);

while (start < end) {
sentbuf[bn][i] = (char)get_char(vc, (u_short *) start, &tmp);
Expand Down Expand Up @@ -1585,7 +1590,7 @@ static int count_highlight_color(struct vc_data *vc)
u16 *ptr;

for (ptr = start; ptr < end; ptr++) {
ch = get_attributes(ptr);
ch = get_attributes(vc, ptr);
bg = (ch & 0x70) >> 4;
speakup_console[vc_num]->ht.bgcount[bg]++;
}
Expand Down
13 changes: 12 additions & 1 deletion drivers/staging/speakup/serialio.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#include "spk_priv.h"
#include "serialio.h"

#include <linux/serial_core.h>
/* WARNING: Do not change this to <linux/serial.h> without testing that
* SERIAL_PORT_DFNS does get defined to the appropriate value. */
#include <asm/serial.h>

#ifndef SERIAL_PORT_DFNS
#define SERIAL_PORT_DFNS
#endif
Expand All @@ -23,9 +28,15 @@ const struct old_serial_port *spk_serial_init(int index)
int baud = 9600, quot = 0;
unsigned int cval = 0;
int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8;
const struct old_serial_port *ser = rs_table + index;
const struct old_serial_port *ser;
int err;

if (index >= ARRAY_SIZE(rs_table)) {
pr_info("no port info for ttyS%d\n", index);
return NULL;
}
ser = rs_table + index;

/* Divisor, bytesize and parity */
quot = ser->baud_base / baud;
cval = cflag & (CSIZE | CSTOPB);
Expand Down
1 change: 1 addition & 0 deletions drivers/tty/vt/vt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4250,6 +4250,7 @@ unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed)
{
return screenpos(vc, 2 * w_offset, viewed);
}
EXPORT_SYMBOL_GPL(screen_pos);

void getconsxy(struct vc_data *vc, unsigned char *p)
{
Expand Down

0 comments on commit 8c4e378

Please sign in to comment.