Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor device structures #23407

Merged
merged 8 commits into from
May 8, 2020

Commits on May 8, 2020

  1. device: Fix tiny indentation issue

    The whole file is perfectly indented everywhere else.
    
    Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
    Tomasz Bursztyka committed May 8, 2020
    Configuration menu
    Copy the full SHA
    9aade5b View commit details
    Browse the repository at this point in the history
  2. init: Fix tiny indentation issue

    The whole file is perfectly indented everywhere else.
    
    Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
    Tomasz Bursztyka committed May 8, 2020
    Configuration menu
    Copy the full SHA
    402b146 View commit details
    Browse the repository at this point in the history
  3. device: Refactor device structures

    When the device driver model got introduced, there were no concept of
    SYS_INIT() which can be seen as software service. These were introduced
    afterwards and reusing the device infrastructure for simplicity.
    However, it meant to allocate a bit too much for something that only
    required an initialization function to be called at right time.
    
    Thus refactoring the devices structures relevantly:
    - introducing struct init_entry which is a generic init end-point
    - struct deviceconfig is removed and struct device owns everything now.
    - SYS_INIT() generates only a struct init_entry via calling
      INIT_ENTRY_DEFINE()
    - DEVICE_AND_API_INIT() generates a struct device and calls
      INIT_ENTRY_DEFINE()
    - init objects sections are in ROM
    - device objects sections are in RAM (but will end up in ROM once they
      will be 'constified')
    
    It also generate a tiny memory gain on both ROM and RAM, which is nice.
    
    Perhaps kernel/device.c could be renamed to something more relevant.
    
    Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
    Tomasz Bursztyka committed May 8, 2020
    Configuration menu
    Copy the full SHA
    960bde1 View commit details
    Browse the repository at this point in the history
  4. device: Fix structure attributes access

    Since struct devconfig was merged earlier into struct device, let's fix
    accessing config_info, name, ... attributes everywhere via:
    
    grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'
    
    Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
    Tomasz Bursztyka committed May 8, 2020
    Configuration menu
    Copy the full SHA
    bafaeb4 View commit details
    Browse the repository at this point in the history
  5. scripts: Fix gen_kobject_list.py to fit with device refactoring

    device_api attribute is not at offset 4 but 8 now as name and
    config_info has been directly imported into struct device.
    
    Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
    Tomasz Bursztyka committed May 8, 2020
    Configuration menu
    Copy the full SHA
    4817771 View commit details
    Browse the repository at this point in the history
  6. usermode: Rework Z_SYSCALL_SPECIFIC_DRIVER to fit with device refacto…

    …ring
    
    init_fn is not anymore part of struct device, so let's test instead the
    driver's API structure pointer which is also unique per device driver.
    
    Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
    Tomasz Bursztyka committed May 8, 2020
    Configuration menu
    Copy the full SHA
    2a2ffc6 View commit details
    Browse the repository at this point in the history
  7. drivers/interrupt_controller: Fix loapic/ioapic header inclusion

    s/init.h/device.h
    
    Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
    Tomasz Bursztyka committed May 8, 2020
    Configuration menu
    Copy the full SHA
    bdfbab6 View commit details
    Browse the repository at this point in the history
  8. drivers/interrupt_controller: Rename ioapic init function

    The '_' is not necessary, plus it makes the sys init object name
    aligning with all others.
    
    Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
    Tomasz Bursztyka committed May 8, 2020
    Configuration menu
    Copy the full SHA
    7798173 View commit details
    Browse the repository at this point in the history