lkml.org 
[lkml]   [2020]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 06/11] PCI: qcom: introduce qcom_clear_and_set_dword
    On Fri, May 01, 2020 at 12:06:13AM +0200, Ansuel Smith wrote:
    > Use qcom_clear_and_set_dword instead of use the same code many times in
    > the entire driver.
    >
    > Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
    > ---
    > drivers/pci/controller/dwc/pcie-qcom.c | 108 ++++++++++---------------
    > 1 file changed, 41 insertions(+), 67 deletions(-)
    >
    > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
    > index 921030a64bab..a4fd5baada34 100644
    > --- a/drivers/pci/controller/dwc/pcie-qcom.c
    > +++ b/drivers/pci/controller/dwc/pcie-qcom.c
    > @@ -184,6 +184,16 @@ struct qcom_pcie {
    >
    > #define to_qcom_pcie(x) dev_get_drvdata((x)->dev)
    >
    > +static void qcom_clear_and_set_dword(void __iomem *addr, u32 clear_mask,
    > + u32 set_mask)
    > +{
    > + u32 val = readl(addr);
    > +
    > + val &= ~clear_mask;
    > + val |= set_mask;
    > + writel(val, addr);
    > +}

    If we wanted this kind of register accessor in the kernel, then we'd
    have common ones. We don't because it hides the possible need for
    locking on a RMW sequence.

    Also, not a fix. Don't mix refactoring with fixes.

    Rob

    \
     
     \ /
      Last update: 2020-05-07 20:08    [W:4.790 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site