On Tue, Nov 17, 2015 at 10:50 AM, John Garry <john.garry@xxxxxxxxxx> wrote:right
Add code to interrupts, so now we can get a phy upSo I started looking at why you are using of_irq_count which drivers
interrupt when a disk is connected.
shouldn't need to. In patch 5 you use it to allocate memory to store
the irq names, then use them here...
It is desirable to be unique as we have so many instances of the same types of interrupt sources:
+static const char phy_int_names[HISI_SAS_PHY_INT_NR][32] = {It is also preferred that drivers don't use this either. You should
+ {"Phy Up"},
+};
+static irq_handler_t phy_interrupts[HISI_SAS_PHY_INT_NR] = {
+ int_phyup_v1_hw,
+};
+
+static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)
+{
+ struct device *dev = &hisi_hba->pdev->dev;
+ struct device_node *np = dev->of_node;
+ char *int_names = hisi_hba->int_names;
+ int i, j, irq, rc, idx;
+
+ if (!np)
+ return -ENOENT;
+
+ for (i = 0; i < hisi_hba->n_phy; i++) {
+ struct hisi_sas_phy *phy = &hisi_hba->phy[i];
+
+ idx = i * HISI_SAS_PHY_INT_NR;
+ for (j = 0; j < HISI_SAS_PHY_INT_NR; j++, idx++) {
+ irq = irq_of_parse_and_map(np, idx);
use platform_get_irq() instead.
+ if (!irq) {There's no requirement for the name to match the name in the DT or
+ dev_err(dev,
+ "irq init: fail map phy interrupt %d\n",
+ idx);
+ return -ENOENT;
+ }
+
+ (void)snprintf(&int_names[idx * HISI_SAS_NAME_LEN],
+ HISI_SAS_NAME_LEN,
+ "%s %s:%d", dev_name(dev),
+ phy_int_names[j], i);
+ rc = devm_request_irq(dev, irq, phy_interrupts[j], 0,
+ &int_names[idx * HISI_SAS_NAME_LEN],
+ phy);
even that the name needs to be unique.
If you really want the DT names used, then just callWe would not want to add so many strings, no?
of_property_read_string_index() on interrupt-names here. There is no
point to copy the string.
Robthanks,