tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-testing
head:   874bcba65f9a3a2a304b5f520529c046887c3cdc
commit: 874bcba65f9a3a2a304b5f520529c046887c3cdc [83/83] staging: pi433: New 
driver
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516
reproduce:
        wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 874bcba65f9a3a2a304b5f520529c046887c3cdc
        # save the attached .config to linux build tree
        make.cross ARCH=sh 

All warnings (new ones prefixed by >>):

   drivers/staging//pi433/pi433_if.c: In function 'pi433_tx_thread':
>> drivers/staging//pi433/pi433_if.c:645:1: warning: the frame size of 1036 
>> bytes is larger than 1024 bytes [-Wframe-larger-than=]
    }
    ^

vim +645 drivers/staging//pi433/pi433_if.c

   465  
   466  int
   467  pi433_tx_thread(void *data)
   468  {
   469          struct pi433_device *device = data;
   470          struct spi_device *spi = device->spi; /* needed for SET_CHECKED 
*/
   471          struct pi433_tx_cfg tx_cfg;
   472          u8     buffer[MAX_MSG_SIZE];
   473          size_t size;
   474          bool   rx_interrupted = false;
   475          int    position, repetitions;
   476          int    retval;
   477  
   478          while (1)
   479          {
   480                  /* wait for fifo to be populated or for request to 
terminate*/
   481                  dev_dbg(device->dev, "thread: going to wait for new 
messages");
   482                  wait_event_interruptible(device->tx_wait_queue,
   483                                           ( 
!kfifo_is_empty(&device->tx_fifo) ||
   484                                              kthread_should_stop() ));
   485                  if ( kthread_should_stop() )
   486                          return 0;
   487  
   488                  /* get data from fifo in the following order:
   489                     - tx_cfg
   490                     - size of message
   491                     - message */
   492                  mutex_lock(&device->tx_fifo_lock);
   493  
   494                  retval = kfifo_out(&device->tx_fifo, &tx_cfg, 
sizeof(tx_cfg));
   495                  if (retval != sizeof(tx_cfg))
   496                  {
   497                          dev_dbg(device->dev, "reading tx_cfg from fifo 
failed: got %d byte(s), expected %d", retval, (unsigned int)sizeof(tx_cfg) );
   498                          mutex_unlock(&device->tx_fifo_lock);
   499                          continue;
   500                  }
   501  
   502                  retval = kfifo_out(&device->tx_fifo, &size, 
sizeof(size_t));
   503                  if (retval != sizeof(size_t))
   504                  {
   505                          dev_dbg(device->dev, "reading msg size from 
fifo failed: got %d, expected %d", retval, (unsigned int)sizeof(size_t) );
   506                          mutex_unlock(&device->tx_fifo_lock);
   507                          continue;
   508                  }
   509  
   510                  /* use fixed message length, if requested */
   511                  if (tx_cfg.fixed_message_length != 0)
   512                          size = tx_cfg.fixed_message_length;
   513  
   514                  /* increase size, if len byte is requested */
   515                  if (tx_cfg.enable_length_byte == optionOn)
   516                          size++;
   517  
   518                  /* increase size, if adr byte is requested */
   519                  if (tx_cfg.enable_address_byte == optionOn)
   520                          size++;
   521  
   522                  /* prime buffer */
   523                  memset(buffer, 0, size);
   524                  position = 0;
   525  
   526                  /* add length byte, if requested */
   527                  if (tx_cfg.enable_length_byte  == optionOn)
   528                          buffer[position++] = size-1; /* according to 
spec length byte itself must be excluded from the length calculation */
   529  
   530                  /* add adr byte, if requested */
   531                  if (tx_cfg.enable_address_byte == optionOn)
   532                          buffer[position++] = tx_cfg.address_byte;
   533  
   534                  /* finally get message data from fifo */
   535                  retval = kfifo_out(&device->tx_fifo, &buffer[position], 
sizeof(buffer)-position );
   536                  dev_dbg(device->dev, "read %d message byte(s) from fifo 
queue.", retval);
   537                  mutex_unlock(&device->tx_fifo_lock);
   538  
   539                  /* if rx is active, we need to interrupt the waiting for
   540                     incoming telegrams, to be able to send something.
   541                     We are only allowed, if currently no reception takes
   542                     place otherwise we need to  wait for the incoming 
telegram
   543                     to finish */
   544                  wait_event_interruptible(device->tx_wait_queue,
   545                                           !device->rx_active ||
   546                                            device->interrupt_rx_allowed 
== true);
   547  
   548                  /* prevent race conditions
   549                     irq will be reenabled after tx config is set */
   550                  disable_irq(device->irq_num[DIO0]);
   551                  device->tx_active = true;
   552  
   553                  if (device->rx_active && rx_interrupted == false)
   554                  {
   555                          /* rx is currently waiting for a telegram;
   556                             we need to set the radio module to standby */
   557                          SET_CHECKED(rf69_set_mode(device->spi, 
standby));
   558                          rx_interrupted = true;
   559                  }
   560  
   561                  /* clear fifo, set fifo threshold, set payload length */
   562                  SET_CHECKED(rf69_set_mode(spi, standby)); /* this 
clears the fifo */
   563                  SET_CHECKED(rf69_set_fifo_threshold(spi, 
FIFO_THRESHOLD));
   564                  if (tx_cfg.enable_length_byte == optionOn)
   565                  {
   566                          SET_CHECKED(rf69_set_payload_length(spi, size * 
tx_cfg.repetitions));
   567                  }
   568                  else
   569                  {
   570                          SET_CHECKED(rf69_set_payload_length(spi, 0));
   571                  }
   572  
   573                  /* configure the rf chip */
   574                  rf69_set_tx_cfg(device, &tx_cfg);
   575  
   576                  /* enable fifo level interrupt */
   577                  SET_CHECKED(rf69_set_dio_mapping(spi, DIO1, 
DIO_FifoLevel));
   578                  device->irq_state[DIO1] = DIO_FifoLevel;
   579                  irq_set_irq_type(device->irq_num[DIO1], 
IRQ_TYPE_EDGE_FALLING);
   580  
   581                  /* enable packet sent interrupt */
   582                  SET_CHECKED(rf69_set_dio_mapping(spi, DIO0, 
DIO_PacketSent));
   583                  device->irq_state[DIO0] = DIO_PacketSent;
   584                  irq_set_irq_type(device->irq_num[DIO0], 
IRQ_TYPE_EDGE_RISING);
   585                  enable_irq(device->irq_num[DIO0]); /* was disabled by 
rx active check */
   586  
   587                  /* enable transmission */
   588                  SET_CHECKED(rf69_set_mode(spi, transmit));
   589  
   590                  /* transfer this msg (and repetitions) to chip fifo */
   591                  device->free_in_fifo = FIFO_SIZE;
   592                  position = 0;
   593                  repetitions = tx_cfg.repetitions;
   594                  while( (repetitions > 0) && (size > position) )
   595                  {
   596                          if ( (size - position) > device->free_in_fifo)
   597                          {       /* msg to big for fifo - take a part */
   598                                  int temp = device->free_in_fifo;
   599                                  device->free_in_fifo = 0;
   600                                  rf69_write_fifo(spi,
   601                                                  &buffer[position],
   602                                                  temp);
   603                                  position +=temp;
   604                          }
   605                          else
   606                          {       /* msg fits into fifo - take all */
   607                                  device->free_in_fifo -= size;
   608                                  repetitions--;
   609                                  rf69_write_fifo(spi,
   610                                                  &buffer[position],
   611                                                  (size - position) );
   612                                  position = 0; /* reset for next 
repetition */
   613                          }
   614  
   615                          retval = 
wait_event_interruptible(device->fifo_wait_queue,
   616                                                            
device->free_in_fifo > 0);
   617                          if (retval) { printk("ABORT\n"); goto abort; }
   618                  }
   619  
   620                  /* we are done. Wait for packet to get sent */
   621                  dev_dbg(device->dev, "thread: wiat for packet to get 
sent/fifo to be empty");
   622                  wait_event_interruptible(device->fifo_wait_queue,
   623                                           device->free_in_fifo == 
FIFO_SIZE ||
   624                                           kthread_should_stop() );
   625                  if ( kthread_should_stop() )    printk("ABORT\n");
   626  
   627  
   628                  /* STOP_TRANSMISSION */
   629                  dev_dbg(device->dev, "thread: Packet sent. Set mode to 
stby.");
   630                  SET_CHECKED(rf69_set_mode(spi, standby));
   631  
   632                  /* everything sent? */
   633                  if ( kfifo_is_empty(&device->tx_fifo) )
   634                  {
   635  abort:
   636                          if (rx_interrupted)
   637                          {
   638                                  rx_interrupted = false;
   639                                  pi433_start_rx(device);
   640                          }
   641                          device->tx_active = false;
   642                          wake_up_interruptible(&device->rx_wait_queue);
   643                  }
   644          }
 > 645  }
   646  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to