Skip to contentSkip to conversation

dw2102.c: quadratic increment intended?

DISCUSSION Igor M. Liplianin 2 participants 3 messages Feb 27, 2011 1 message not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

В сообщении от 27 февраля 2011 16:40:19 автор Török Edwin написал:

Quoted 1 line

Hi,

Hi

Quoted 23 lines

Please see http://llvm.org/bugs/show_bug.cgi?id=9259#c5, is the code intended to do a quadratic increment there?

While looking at this, I wonder if this isn't also a bug in the original code:

        /* read stv0299 register */
        request = 0xb5;
        value = msg[0].buf[0];/* register */
        for (i = 0; i < msg[1].len; i++) {
            value = value + i;
            ret = dw2102_op_rw(d->udev, 0xb5,
                value, buf6, 2, DW2102_READ_MSG);
            msg[1].buf[i] = buf6[0];

        }

I don't know anything about the hardware this driver is written for, but is 'value' really intended to increment quadratically? That seems suspicious. One
wonders if the following is what was intended:

Quoted 8 lines
        [...]
        for (i = 0; i < msg[1].len; i++) {
            ret = dw2102_op_rw(d->udev, 0xb5,
                value + i, buf6, 2, DW2102_READ_MSG);
            msg[1].buf[i] = buf6[0];

        }

Accidentally, this didn't affect driver, as it reads registers by one register at one time. But it should be corrected.

Quoted 2 lines

Best regards,
--Edwin

Signature · 2 lines
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
#2 lore raw
Quoted 33 lines · Igor M. Liplianin

В сообщении от 27 февраля 2011 16:40:19 автор Török Edwin написал:

Quoted 1 line

Hi,

Hi

Quoted 29 lines

Please see http://llvm.org/bugs/show_bug.cgi?id=9259#c5, is the code intended to do a quadratic increment there?

While looking at this, I wonder if this isn't also a bug in the original code:

        /* read stv0299 register */
        request = 0xb5;
        value = msg[0].buf[0];/* register */
        for (i = 0; i < msg[1].len; i++) {
            value = value + i;
            ret = dw2102_op_rw(d->udev, 0xb5,
                value, buf6, 2, DW2102_READ_MSG);
            msg[1].buf[i] = buf6[0];

        }

I don't know anything about the hardware this driver is written for, but is 'value' really intended to increment quadratically? That seems suspicious. One
wonders if the following is what was intended:

        [...]
        for (i = 0; i < msg[1].len; i++) {
            ret = dw2102_op_rw(d->udev, 0xb5,
                value + i, buf6, 2, DW2102_READ_MSG);
            msg[1].buf[i] = buf6[0];
Quoted 4 lines
Quoted 2 lines
        }

Accidentally, this didn't affect driver, as it reads registers by one register at one time. But it should be corrected.

stv0299, along with other stv02xx family members can read and write the entire register map from the start register.

However, there is a limitation, the buffer size of the I2C master hardware.

#3 lore raw

В сообщении от 27 февраля 2011 22:57:50 автор Malcolm Priestley написал:

Quoted 41 lines · Igor M. Liplianin
Quoted 40 lines

В сообщении от 27 февраля 2011 16:40:19 автор Török Edwin написал:

Quoted 1 line

Hi,

Hi

Quoted 35 lines

Please see http://llvm.org/bugs/show_bug.cgi?id=9259#c5, is the code intended to do a quadratic increment there?

While looking at this, I wonder if this isn't also a bug in the original

code:

        /* read stv0299 register */
        request = 0xb5;
        value = msg[0].buf[0];/* register */
        for (i = 0; i < msg[1].len; i++) {
        
            value = value + i;
            ret = dw2102_op_rw(d->udev, 0xb5,
            
                value, buf6, 2, DW2102_READ_MSG);
            
            msg[1].buf[i] = buf6[0];
        
        }

I don't know anything about the hardware this driver is written for, but is 'value' really intended to increment quadratically? That seems suspicious. One

wonders if the following is what was intended:

        [...]
        for (i = 0; i < msg[1].len; i++) {
        
            ret = dw2102_op_rw(d->udev, 0xb5,
            
                value + i, buf6, 2, DW2102_READ_MSG);
            
            msg[1].buf[i] = buf6[0];
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
        }

Accidentally, this didn't affect driver, as it reads registers by one register at one time. But it should be corrected.

stv0299, along with other stv02xx family members can read and write the entire register map from the start register.

You misundestood me. I spoke about driver features, not about stv0299 features. Except that, you are right.

Quoted 3 lines

However, there is a limitation, the buffer size of the I2C master hardware.

Signature · 2 lines
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks