lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <564CA396.9010709@huawei.com>
Date:	Wed, 18 Nov 2015 16:13:10 +0000
From:	John Garry <john.garry@...wei.com>
To:	Rob Herring <robh+dt@...nel.org>
CC:	"James E.J. Bottomley" <JBottomley@...n.com>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	"Arnd Bergmann" <arnd@...db.de>, <linux-scsi@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	Linuxarm <linuxarm@...wei.com>,
	John Garry <john.garry2@...l.dcu.ie>, <hare@...e.de>,
	Wei Xu <xuwei5@...ilicon.com>,
	Zhangfei Gao <zhangfei.gao@...aro.org>
Subject: Re: [PATCH v5 20/32] scsi: hisi_sas: add v1 hw interrupt init



On 18/11/2015 15:26, Rob Herring wrote:
> On Tue, Nov 17, 2015 at 10:50 AM, John Garry <john.garry@...wei.com> wrote:
>> Add code to interrupts, so now we can get a phy up
>> interrupt when a disk is connected.
> So I started looking at why you are using of_irq_count which drivers
> shouldn't need to. In patch 5 you use it to allocate memory to store
> the irq names, then use them here...
right
>
>> +static const char phy_int_names[HISI_SAS_PHY_INT_NR][32] = {
>> +       {"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);
> It is also preferred that drivers don't use this either. You should
> use platform_get_irq() instead.
>
>> +                       if (!irq) {
>> +                               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);
> There's no requirement for the name to match the name in the DT or
> even that the name needs to be unique.
It is desirable to be unique as we have so many instances of the same 
types of interrupt sources:
for hip05 chipset with v1 controller we have the following interrupts: 8 
phyup, 8 abnormal, 8 broadcast, 32 completion, 2 fatal
> If you really want the DT names used, then just call
> of_property_read_string_index() on interrupt-names here. There is no
> point to copy the string.
We would not want to add so many strings, no?
> Rob
thanks,
John

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ