alpine 3.6
obsolete weakness #66

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

xf86-video-i128/src/xf86-video-i128-1.3.6/src/i128_driver.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 obsolete weakness.

   unsigned long tmp, ddc;
  unsigned long iobase;

  iobase = pI128->RegRec.iobase;
  ddc = inl(iobase + 0x2C);
  if ((ddc & DDC_MODE_MASK) != DDC_MODE_DDC1) {
      outl(iobase + 0x2C, DDC_MODE_DDC1);
      usleep(40);
  }

  /* wait for Vsync */
  do {
      tmp = inl(iobase + 0x2C);
  } while (tmp & 1);
  do {
      tmp = inl(iobase + 0x2C);
  } while (!(tmp & 1));

  /* Get the result */
  tmp = inl(iobase + 0x2C);
  val = tmp & DDC_SDA_IN_MASK;

  if ((ddc & DDC_MODE_MASK) != DDC_MODE_DDC1) {
      outl(iobase + 0x2C, ~DDC_MODE_MASK & ddc);
      usleep(40);
  }

  return val;
}
#endif

static void
I128I2CGetBits(I2CBusPtr b, int *clock, int *data)
{
  I128Ptr pI128 = I128PTR(xf86Screens[b->scrnIndex]);
  unsigned long ddc;
  unsigned long iobase;
#if 0
  static int lastclock = -1, lastdata = -1;
#endif

  /* Get the result. */
  iobase = pI128->RegRec.iobase;
  ddc = inl(iobase + 0x2C);

  *clock = (ddc & DDC_SCL_IN_MASK) != 0;
  *data  = (ddc & DDC_SDA_IN_MASK) != 0;

#if 0
  if (pI128->Debug && ((lastclock != *clock) || (lastdata != *data))) { 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.