title: Can a single acpi driver work for two devices where one is normal device and another is platform device
body: <p>I want to understand if it is possible to have a single driver shared between following two devices. E.g. from the ACPI tables, the two devices are mapped as follows:</p>
  <pre class="lang-asl prettyprint-override"><code>Scope (\_SB)
  {
      Device (XYZ)
      {
          Name (_HID, &quot;XYZ123&quot;)  // _HID: Hardware ID
          Name (_UID, &quot;XYZ&quot;)  // _UID: Unique ID
          Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
          {
          }
  
          Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
          {
          }
          ...
     }
  }
  
  Scope (\_SB.PCI0.PEG0.ABC)
  {
      OperationRegion (PCIM, SystemMemory,)
  
      Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
      {
      ...
      }
  }
  </code></pre>
  <p>IIUC, device XYZ is platform device and device ABC is discoverable PCI device.</p>
  <p>I need to access _DSM method of Device (XYZ) using the ACPI driver of device ABC (_SB.PCI0.PEG0.ABC). From <a href="https://lwn.net/Articles/367630/" rel="nofollow noreferrer">https://lwn.net/Articles/367630/</a> I understand that in order to write ACPI driver for a device we need to have following</p>
  <pre class="lang-c prettyprint-override"><code>static const struct acpi_device_id bt_device_ids[] = {
    { &quot;TOS6205&quot;, 0},
    { &quot;&quot;, 0},
  };
  MODULE_DEVICE_TABLE(acpi, bt_device_ids);
  
  static struct acpi_driver toshiba_bt_driver = {
      .name =         &quot;Toshiba BT&quot;,
      .class =        &quot;Toshiba&quot;,
      .ids =          bt_device_ids,
      .ops =          {
                              .add =    toshiba_bt_rfkill_add,
                              .remove = toshiba_bt_rfkill_remove,
                      },
      .owner =    THIS_MODULE,
  };
  </code></pre>
  <p>I was wondering if adding a new additional entry in 'acpi_device_id' will help with the same 'acpi_driver'. Also why we add an extra null entry <code>{ &quot;&quot;, 0}</code> for 'acpi_device_id'? I understand that each device has to register itself with ACPI and also register for notifiers to receive any notifications from ACPI, I found <a href="https://www.kernel.org/doc/Documentation/acpi/enumeration.txt" rel="nofollow noreferrer">https://www.kernel.org/doc/Documentation/acpi/enumeration.txt</a> but I could not understand it completely. Is there a way that already existing driver for device ABC can be modified to access <code>_DSM()</code> functions of XYZ device?</p>