* Re: Clone data inconsistency in hammer
From: Bartłomiej Święcki @ 2016-12-22 12:33 UTC (permalink / raw)
To: dillaman-H+wXaHxf7aLQT0dZR+AlfA; +Cc: ceph-devel, ceph-users
In-Reply-To: <20161222101009.32e14565-Q8zpDM2kqfNz3UrvHfEF4cXErentcBXJSavXxUIaH7I@public.gmane.org>
Hi,
I have problems runnign Kraken tools on Hammer/Jewel cluster (official 11.1.0 debs),
it asserts:
/build/ceph-11.1.0/src/mon/MonMap.cc: In function 'void MonMap::sanitize_mons(std::map<std::basic_string<char>, entity_addr_t>&)' thread 7fffd37fe700 time 2016-12-22 12:26:23.457058
/build/ceph-11.1.0/src/mon/MonMap.cc: 70: FAILED assert(mon_info.count(p.first))
I tried to debug it a bit and it looks like mon_info has temporary mon names:
(gdb) p mon_info
$1 = std::map with 3 elements = {["noname-a"] = {name = "noname-a", .....
while it checks for a correct one:
(gdb) p p
$2 = {first = "mon-01-690d38c0-2567-447b-bdfb-0edd137183db", ....
Anyway, I was thinking about the missing image problem - maybe it would be easier
to recreate removed image? Would restoring rbd_header object be enough?
P.S. Adding ceph-devel
On Thu, 22 Dec 2016 10:10:09 +0100
Bartłomiej Święcki <bartlomiej.swiecki@corp.ovh.com> wrote:
> Hi Jason,
>
> I'll test kraken tools since it happened on production, everything works there
> since the clone is flattened after being created and the production equivalent
> of "test" user can access the image only after it has been flattened.
>
> The issue happened when someone accidentally removed not-yet-flattened image
> using the user with weaker permissions. Good to hear this has been spotted
> already.
>
> Thanks for help,
> Bartek
>
>
>
> On Wed, 21 Dec 2016 11:53:57 -0500
> Jason Dillaman <jdillama@redhat.com> wrote:
>
> > You are unfortunately the second person today to hit an issue where
> > "rbd remove" incorrectly proceeds when it hits a corner-case error.
> >
> > First things first, when you configure your new user, you needed to
> > give it "rx" permissions to the parent image's pool. If you attempted
> > the clone operation using the "test" user, the clone would have
> > immediately failed due to this issue.
> >
> > Second, unless this is a test cluster where you can delete the
> > "rbd_children" object in the "rbd" pool (i.e. you don't have any
> > additional clones in the rbd pool) via the rados CLI, you will need to
> > use the Kraken release candidate (or master branch) version of the
> > rados CLI to manually manipulate the "rbd_children" object to remove
> > the dangling reference to the deleted image.
> >
> > On Wed, Dec 21, 2016 at 6:57 AM, Bartłomiej Święcki
> > <bartlomiej.swiecki@corp.ovh.com> wrote:
> > > Hi,
> > >
> > > I'm currently investigating a case where Ceph cluster ended up with inconsistent clone information.
> > >
> > > Here's a what I did to quickly reproduce:
> > > * Created new cluster (tested in hammer 0.94.6 and jewel 10.2.3)
> > > * Created two pools: test and rbd
> > > * Created base image in pool test, created snapshot, protected it and created clone of this snapshot in pool rbd:
> > > # rbd -p test create --size 10 --image-format 2 base
> > > # rbd -p test snap create base@base
> > > # rbd -p test snap protect base@base
> > > # rbd clone test/base@base rbd/destination
> > > * Created new user called "test" with rwx permissions to rbd pool only:
> > > caps: [mon] allow r
> > > caps: [osd] allow class-read object_prefix rbd_children, allow rwx pool=rbd
> > > * Using this newly creted user I removed the cloned image in rbd pool, had errors but finally removed the image:
> > > # rbd --id test -p rbd rm destination
> > > 2016-12-21 11:50:03.758221 7f32b7459700 -1 librbd::image::OpenRequest: failed to retreive name: (1) Operation not permitted
> > > 2016-12-21 11:50:03.758288 7f32b6c58700 -1 librbd::image::RefreshParentRequest: failed to open parent image: (1) Operation not permitted
> > > 2016-12-21 11:50:03.758312 7f32b6c58700 -1 librbd::image::RefreshRequest: failed to refresh parent image: (1) Operation not permitted
> > > 2016-12-21 11:50:03.758333 7f32b6c58700 -1 librbd::image::OpenRequest: failed to refresh image: (1) Operation not permitted
> > > 2016-12-21 11:50:03.759366 7f32b6c58700 -1 librbd::ImageState: failed to open image: (1) Operation not permitted
> > > Removing image: 100% complete...done.
> > >
> > > At this point there's no cloned image but the original snapshot still has reference to it:
> > >
> > > # rbd -p test snap unprotect base@base
> > > 2016-12-21 11:53:47.359060 7fee037fe700 -1 librbd::SnapshotUnprotectRequest: cannot unprotect: at least 1 child(ren) [29b0238e1f29] in pool 'rbd'
> > > 2016-12-21 11:53:47.359678 7fee037fe700 -1 librbd::SnapshotUnprotectRequest: encountered error: (16) Device or resource busy
> > > 2016-12-21 11:53:47.359691 7fee037fe700 -1 librbd::SnapshotUnprotectRequest: 0x7fee39ae9340 should_complete_error: ret_val=-16
> > > 2016-12-21 11:53:47.360627 7fee037fe700 -1 librbd::SnapshotUnprotectRequest: 0x7fee39ae9340 should_complete_error: ret_val=-16
> > > rbd: unprotecting snap failed: (16) Device or resource busy
> > >
> > > # rbd -p test children base@base
> > > rbd: listing children failed: (2) No such file or directory2016-12-21
> > > 11:53:08.716987 7ff2b2eaad80 -1 librbd: Error looking up name for image
> > > id 29b0238e1f29 in pool rbd
> > >
> > >
> > > Any ideas on how this could be fixed?
> > >
> > >
> > > Thanks,
> > > Bartek
> > > _______________________________________________
> > > ceph-users mailing list
> > > ceph-users@lists.ceph.com
> > > http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
> >
> >
> >
> > --
> > Jason
_______________________________________________
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
^ permalink raw reply
* [PATCH net] net/mlx4_en: Fix user prio field in XDP forward
From: Tariq Toukan @ 2016-12-22 12:32 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Eran Ben Elisha, Saeed Mahameed, Martin KaFai Lau,
Tariq Toukan
The user prio field is wrong (and overflows) in the XDP forward
flow.
This is a result of a bad value for num_tx_rings_p_up, which should
account all XDP TX rings, as they operate for the same user prio.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reported-by: Martin KaFai Lau <kafai@fb.com>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index bcd955339058..edbe200ac2fa 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1638,7 +1638,8 @@ int mlx4_en_start_port(struct net_device *dev)
/* Configure tx cq's and rings */
for (t = 0 ; t < MLX4_EN_NUM_TX_TYPES; t++) {
- u8 num_tx_rings_p_up = t == TX ? priv->num_tx_rings_p_up : 1;
+ u8 num_tx_rings_p_up = t == TX ?
+ priv->num_tx_rings_p_up : priv->tx_ring_num[t];
for (i = 0; i < priv->tx_ring_num[t]; i++) {
/* Configure cq */
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] stmmac: CSR clock configuration fix
From: Joao Pinto @ 2016-12-22 12:23 UTC (permalink / raw)
To: David Miller, Joao.Pinto
Cc: peppe.cavallaro, hock.leong.kweh, niklas.cassel, pavel,
linux-kernel, netdev
In-Reply-To: <41c56a6a-b7ce-6305-5dbb-02a023df5642@synopsys.com>
Hi David,
Às 10:15 AM de 12/22/2016, Joao Pinto escreveu:
> Às 6:21 PM de 12/21/2016, David Miller escreveu:
>> From: Joao Pinto <Joao.Pinto@synopsys.com>
>> Date: Tue, 20 Dec 2016 11:21:47 +0000
>>
>>> When testing stmmac with my QoS reference design I checked a problem in the
>>> CSR clock configuration that was impossibilitating the phy discovery, since
>>> every read operation returned 0x0000ffff. This patch fixes the issue.
>>>
>>> Signed-off-by: Joao Pinto <jpinto@synopsys.com>
>>
>> This isn't enough.
>>
>> It looks like various parts of this driver set the mask field
>> differently.
>>
>> dwmac1000_core.c and dwmac100_core.c set the mask to be the low bits.
>>
>> But dwmac4_core.c uses GENMASK(11, 8) which means the mask is a value
>> which is shifted up already.
>>
>> So your patch will break chips driven by dwmac4_core.c.
>
> I am using a GMAC4 reference design to test the patches. The clock configuration
> as is, does not work, resulting in the phy discovery failure. By applying this
> patch I am able to set the clock value properly.
>
> I am going to check in the Databook of GMAC4 and older versions in order to
> justify better.
So from the 4.20 Databook:
Bits
11:8 CR parameter
0000: CSR clock = 60-100 MHz; MDC clock = CSR
0001: CSR clock = 100-150 MHz; MDC clock = CSR
0010: CSR clock = 20-35 MHz; MDC clock = CSR
0011: CSR clock = 35-60 MHz; MDC clock = CSR
0100: CSR clock = 150-250 MHz; MDC clock = CSR
0101: CSR clock = 250-300 MHz; MDC clock = CSR
0110, 0111: Reserved
For example, if you want configure the CSR clock to 250-300MHZ (my case), you
will set the parameter CR to 0x5. The current mechanism simply messes the value.
With this fix, the 0x5 is shifted to 11:8 like the databook specifies and
applies a GENMASK(11:8) on top, causing the reset of every bit outside the 11:8
which is an assurance.
For older cores like 4.10 and 4.00 the logic is the same. The information was
confirmed by R&D.
Thanks.
>
>>
>> In order for your change to be correct you must consolidate all of
>> these various pieces to use the same convention.
>>
>
> Thanks.
>
^ permalink raw reply
* Re: [Qemu-devel] [PATCH for-2.9 10/10] memhp: move DIMM devices into dedicated scope with related common methods
From: Marcel Apfelbaum @ 2016-12-22 12:31 UTC (permalink / raw)
To: Igor Mammedov, qemu-devel; +Cc: Michael S. Tsirkin, Eduardo Habkost
In-Reply-To: <1480980749-182204-11-git-send-email-imammedo@redhat.com>
On 12/06/2016 01:32 AM, Igor Mammedov wrote:
> Move DIMM devices from global _SB scope to a new \_SB.MHPC
> container along with common methods used by DIMMs:
> MCRS, MRST, MPXM, MOST, MEJ00, MSCN, MTFY
>
> this reduces AML size on 12 * #slots bytes,
> i.e. up to 3072 bytes for 265 slots.
>
Can you please explain how the bytes number are reduced?
Is it because the devices path is now relative to the new container?
If so, can you give an example of before/after?
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> hw/acpi/memory_hotplug.c | 190 ++++++++++++++++++++++++-----------------------
> 1 file changed, 97 insertions(+), 93 deletions(-)
>
> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> index fb04d24..210073d 100644
> --- a/hw/acpi/memory_hotplug.c
> +++ b/hw/acpi/memory_hotplug.c
> @@ -31,6 +31,7 @@
> #define MEMORY_SLOT_SCAN_METHOD "MSCN"
> #define MEMORY_HOTPLUG_DEVICE "MHPD"
> #define MEMORY_HOTPLUG_IO_LEN 24
> +#define MEMORY_DEVICES_CONTAINER "\\_SB.MHPC"
>
> static uint16_t memhp_io_base;
>
> @@ -343,9 +344,8 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> int i;
> Aml *ifctx;
> Aml *method;
> - Aml *sb_scope;
> + Aml *dev_container;
> Aml *mem_ctrl_dev;
> - char *scan_path;
> char *mhp_res_path;
>
> if (!memhp_io_base) {
> @@ -356,24 +356,11 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> mem_ctrl_dev = aml_device("%s", mhp_res_path);
> {
> Aml *crs;
> - Aml *field;
> - Aml *one = aml_int(1);
> - Aml *zero = aml_int(0);
> - Aml *ret_val = aml_local(0);
> - Aml *slot_arg0 = aml_arg(0);
> - Aml *slots_nr = aml_name(MEMORY_SLOTS_NUMBER);
> - Aml *ctrl_lock = aml_name(MEMORY_SLOT_LOCK);
> - Aml *slot_selector = aml_name(MEMORY_SLOT_SLECTOR);
>
> aml_append(mem_ctrl_dev, aml_name_decl("_HID", aml_string("PNP0A06")));
Do we need the above declaration twice? Here is the first occurrence.
> aml_append(mem_ctrl_dev,
> aml_name_decl("_UID", aml_string("Memory hotplug resources")));
>
> - assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
> - aml_append(mem_ctrl_dev,
> - aml_name_decl(MEMORY_SLOTS_NUMBER, aml_int(nr_mem))
> - );
> -
> crs = aml_resource_template();
> aml_append(crs,
> aml_io(AML_DECODE16, memhp_io_base, memhp_io_base, 0,
> @@ -386,7 +373,32 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_int(memhp_io_base), MEMORY_HOTPLUG_IO_LEN)
> );
>
> - field = aml_field(MEMORY_HOTPLUG_IO_REGION, AML_DWORD_ACC,
> + }
> + aml_append(table, mem_ctrl_dev);
> +
> + dev_container = aml_device(MEMORY_DEVICES_CONTAINER);
> + {
> + Aml *field;
> + Aml *one = aml_int(1);
> + Aml *zero = aml_int(0);
> + Aml *ret_val = aml_local(0);
> + Aml *slot_arg0 = aml_arg(0);
> + Aml *slots_nr = aml_name(MEMORY_SLOTS_NUMBER);
> + Aml *ctrl_lock = aml_name(MEMORY_SLOT_LOCK);
> + Aml *slot_selector = aml_name(MEMORY_SLOT_SLECTOR);
> + char *mmio_path = g_strdup_printf("%s." MEMORY_HOTPLUG_IO_REGION,
> + mhp_res_path);
> +
> + aml_append(dev_container, aml_name_decl("_HID", aml_string("PNP0A06")));
And here is the second occurrence.
Thanks,
Marcel
> + aml_append(dev_container,
> + aml_name_decl("_UID", aml_string("DIMM devices")));
> +
> + assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
> + aml_append(dev_container,
> + aml_name_decl(MEMORY_SLOTS_NUMBER, aml_int(nr_mem))
> + );
> +
> + field = aml_field(mmio_path, AML_DWORD_ACC,
> AML_NOLOCK, AML_PRESERVE);
> aml_append(field, /* read only */
> aml_named_field(MEMORY_SLOT_ADDR_LOW, 32));
> @@ -398,9 +410,9 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_named_field(MEMORY_SLOT_SIZE_HIGH, 32));
> aml_append(field, /* read only */
> aml_named_field(MEMORY_SLOT_PROXIMITY, 32));
> - aml_append(mem_ctrl_dev, field);
> + aml_append(dev_container, field);
>
> - field = aml_field(MEMORY_HOTPLUG_IO_REGION, AML_BYTE_ACC,
> + field = aml_field(mmio_path, AML_BYTE_ACC,
> AML_NOLOCK, AML_WRITE_AS_ZEROS);
> aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
> aml_append(field, /* 1 if enabled, read only */
> @@ -414,9 +426,9 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_append(field,
> /* initiates device eject, write only */
> aml_named_field(MEMORY_SLOT_EJECT, 1));
> - aml_append(mem_ctrl_dev, field);
> + aml_append(dev_container, field);
>
> - field = aml_field(MEMORY_HOTPLUG_IO_REGION, AML_DWORD_ACC,
> + field = aml_field(mmio_path, AML_DWORD_ACC,
> AML_NOLOCK, AML_PRESERVE);
> aml_append(field, /* DIMM selector, write only */
> aml_named_field(MEMORY_SLOT_SLECTOR, 32));
> @@ -424,7 +436,8 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_named_field(MEMORY_SLOT_OST_EVENT, 32));
> aml_append(field, /* _OST status code, write only */
> aml_named_field(MEMORY_SLOT_OST_STATUS, 32));
> - aml_append(mem_ctrl_dev, field);
> + aml_append(dev_container, field);
> + g_free(mmio_path);
>
> method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> ifctx = aml_if(aml_equal(slots_nr, zero));
> @@ -434,9 +447,9 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_append(method, ifctx);
> /* present, functioning, decoding, not shown in UI */
> aml_append(method, aml_return(aml_int(0xB)));
> - aml_append(mem_ctrl_dev, method);
> + aml_append(dev_container, method);
>
> - aml_append(mem_ctrl_dev, aml_mutex(MEMORY_SLOT_LOCK, 0));
> + aml_append(dev_container, aml_mutex(MEMORY_SLOT_LOCK, 0));
>
> method = aml_method(MEMORY_SLOT_SCAN_METHOD, 0, AML_NOTSERIALIZED);
> {
> @@ -492,7 +505,7 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_append(method, aml_release(ctrl_lock));
> aml_append(method, aml_return(one));
> }
> - aml_append(mem_ctrl_dev, method);
> + aml_append(dev_container, method);
>
> method = aml_method(MEMORY_SLOT_STATUS_METHOD, 1, AML_NOTSERIALIZED);
> {
> @@ -512,7 +525,7 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_append(method, aml_release(ctrl_lock));
> aml_append(method, aml_return(ret_val));
> }
> - aml_append(mem_ctrl_dev, method);
> + aml_append(dev_container, method);
>
> method = aml_method(MEMORY_SLOT_CRS_METHOD, 1, AML_SERIALIZED);
> {
> @@ -603,7 +616,7 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_append(method, aml_release(ctrl_lock));
> aml_append(method, aml_return(mr64));
> }
> - aml_append(mem_ctrl_dev, method);
> + aml_append(dev_container, method);
>
> method = aml_method(MEMORY_SLOT_PROXIMITY_METHOD, 1,
> AML_NOTSERIALIZED);
> @@ -617,7 +630,7 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_append(method, aml_release(ctrl_lock));
> aml_append(method, aml_return(ret_val));
> }
> - aml_append(mem_ctrl_dev, method);
> + aml_append(dev_container, method);
>
> method = aml_method(MEMORY_SLOT_OST_METHOD, 4, AML_NOTSERIALIZED);
> {
> @@ -631,7 +644,7 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_append(method, aml_store(aml_arg(2), ost_status));
> aml_append(method, aml_release(ctrl_lock));
> }
> - aml_append(mem_ctrl_dev, method);
> + aml_append(dev_container, method);
>
> method = aml_method(MEMORY_SLOT_EJECT_METHOD, 2, AML_NOTSERIALIZED);
> {
> @@ -643,75 +656,66 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
> aml_append(method, aml_store(one, eject));
> aml_append(method, aml_release(ctrl_lock));
> }
> - aml_append(mem_ctrl_dev, method);
> - }
> - aml_append(table, mem_ctrl_dev);
> -
> - sb_scope = aml_scope("_SB");
> - /* build memory devices */
> - for (i = 0; i < nr_mem; i++) {
> - Aml *dev;
> - char *s;
> -
> - dev = aml_device("MP%02X", i);
> - aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
> - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
> -
> - method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
> - s = g_strdup_printf("%s.%s", mhp_res_path, MEMORY_SLOT_CRS_METHOD);
> - aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> - g_free(s);
> - aml_append(dev, method);
> -
> - method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> - s = g_strdup_printf("%s.%s", mhp_res_path, MEMORY_SLOT_STATUS_METHOD);
> - aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> - g_free(s);
> - aml_append(dev, method);
> -
> - method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
> - s = g_strdup_printf("%s.%s", mhp_res_path,
> - MEMORY_SLOT_PROXIMITY_METHOD);
> - aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> - g_free(s);
> - aml_append(dev, method);
> -
> - method = aml_method("_OST", 3, AML_NOTSERIALIZED);
> - s = g_strdup_printf("%s.%s", mhp_res_path, MEMORY_SLOT_OST_METHOD);
> - aml_append(method, aml_return(aml_call4(
> - s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
> - )));
> - g_free(s);
> - aml_append(dev, method);
> -
> - method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
> - s = g_strdup_printf("%s.%s", mhp_res_path, MEMORY_SLOT_EJECT_METHOD);
> - aml_append(method, aml_return(aml_call2(
> - s, aml_name("_UID"), aml_arg(0))));
> - g_free(s);
> - aml_append(dev, method);
> -
> - aml_append(sb_scope, dev);
> - }
> + aml_append(dev_container, method);
> +
> + /* build memory devices */
> + for (i = 0; i < nr_mem; i++) {
> + Aml *dev;
> + const char *s;
> +
> + dev = aml_device("MP%02X", i);
> + aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
> + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
> +
> + method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
> + s = MEMORY_SLOT_CRS_METHOD;
> + aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> + aml_append(dev, method);
> +
> + method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> + s = MEMORY_SLOT_STATUS_METHOD;
> + aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> + aml_append(dev, method);
> +
> + method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
> + s = MEMORY_SLOT_PROXIMITY_METHOD;
> + aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> + aml_append(dev, method);
> +
> + method = aml_method("_OST", 3, AML_NOTSERIALIZED);
> + s = MEMORY_SLOT_OST_METHOD;
> + aml_append(method, aml_return(aml_call4(
> + s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
> + )));
> + aml_append(dev, method);
> +
> + method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
> + s = MEMORY_SLOT_EJECT_METHOD;
> + aml_append(method, aml_return(aml_call2(
> + s, aml_name("_UID"), aml_arg(0))));
> + aml_append(dev, method);
> +
> + aml_append(dev_container, dev);
> + }
>
> - /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
> - * If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
> - */
> - method = aml_method(MEMORY_SLOT_NOTIFY_METHOD, 2, AML_NOTSERIALIZED);
> - for (i = 0; i < nr_mem; i++) {
> - ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
> - aml_append(ifctx,
> - aml_notify(aml_name("MP%.02X", i), aml_arg(1))
> - );
> - aml_append(method, ifctx);
> + /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
> + * If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
> + */
> + method = aml_method(MEMORY_SLOT_NOTIFY_METHOD, 2, AML_NOTSERIALIZED);
> + for (i = 0; i < nr_mem; i++) {
> + ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
> + aml_append(ifctx,
> + aml_notify(aml_name("MP%.02X", i), aml_arg(1))
> + );
> + aml_append(method, ifctx);
> + }
> + aml_append(dev_container, method);
> }
> - aml_append(sb_scope, method);
> - aml_append(table, sb_scope);
> + aml_append(table, dev_container);
>
> method = aml_method(event_handler_method, 0, AML_NOTSERIALIZED);
> - scan_path = g_strdup_printf("%s.%s", mhp_res_path, MEMORY_SLOT_SCAN_METHOD);
> - aml_append(method, aml_call0(scan_path));
> - g_free(scan_path);
> + aml_append(method,
> + aml_call0(MEMORY_DEVICES_CONTAINER "." MEMORY_SLOT_SCAN_METHOD));
> aml_append(table, method);
>
> g_free(mhp_res_path);
>
^ permalink raw reply
* Re: [PATCH] stmmac: CSR clock configuration fix
From: Joao Pinto @ 2016-12-22 12:28 UTC (permalink / raw)
To: David Miller, Joao.Pinto
Cc: peppe.cavallaro, hock.leong.kweh, niklas.cassel, pavel,
linux-kernel, netdev
In-Reply-To: <db749688-5b91-a7c6-4220-3440a8a689b5@synopsys.com>
Às 12:23 PM de 12/22/2016, Joao Pinto escreveu:
>
> Hi David,
>
> Às 10:15 AM de 12/22/2016, Joao Pinto escreveu:
>> Às 6:21 PM de 12/21/2016, David Miller escreveu:
>>> From: Joao Pinto <Joao.Pinto@synopsys.com>
>>> Date: Tue, 20 Dec 2016 11:21:47 +0000
>>>
>>>> When testing stmmac with my QoS reference design I checked a problem in the
>>>> CSR clock configuration that was impossibilitating the phy discovery, since
>>>> every read operation returned 0x0000ffff. This patch fixes the issue.
>>>>
>>>> Signed-off-by: Joao Pinto <jpinto@synopsys.com>
>>>
>>> This isn't enough.
>>>
>>> It looks like various parts of this driver set the mask field
>>> differently.
>>>
>>> dwmac1000_core.c and dwmac100_core.c set the mask to be the low bits.
>>>
>>> But dwmac4_core.c uses GENMASK(11, 8) which means the mask is a value
>>> which is shifted up already.
>>>
>>> So your patch will break chips driven by dwmac4_core.c.
>>
>> I am using a GMAC4 reference design to test the patches. The clock configuration
>> as is, does not work, resulting in the phy discovery failure. By applying this
>> patch I am able to set the clock value properly.
>>
>> I am going to check in the Databook of GMAC4 and older versions in order to
>> justify better.
>
> So from the 4.20 Databook:
>
> Bits
> 11:8 CR parameter
> 0000: CSR clock = 60-100 MHz; MDC clock = CSR
> 0001: CSR clock = 100-150 MHz; MDC clock = CSR
> 0010: CSR clock = 20-35 MHz; MDC clock = CSR
> 0011: CSR clock = 35-60 MHz; MDC clock = CSR
> 0100: CSR clock = 150-250 MHz; MDC clock = CSR
> 0101: CSR clock = 250-300 MHz; MDC clock = CSR
> 0110, 0111: Reserved
>
> For example, if you want configure the CSR clock to 250-300MHZ (my case), you
> will set the parameter CR to 0x5. The current mechanism simply messes the value.
> With this fix, the 0x5 is shifted to 11:8 like the databook specifies and
> applies a GENMASK(11:8) on top, causing the reset of every bit outside the 11:8
> which is an assurance.
>
> For older cores like 4.10 and 4.00 the logic is the same. The information was
> confirmed by R&D.
>
> Thanks.
Bu checking DWMAC100 and DWMAC1000 I understand your concern now. I am going to
change their masks also in order to put it right. V2 comming soon.
Thanks.
>
>>
>>>
>>> In order for your change to be correct you must consolidate all of
>>> these various pieces to use the same convention.
>>>
>>
>> Thanks.
>>
>
^ permalink raw reply
* [PATCH] fs: Initialize tmp.b_page in generic_block_bmap()
From: Alexander Potapenko @ 2016-12-22 12:30 UTC (permalink / raw)
To: dvyukov, kcc, tytso, viro; +Cc: linux-kernel, linux-fsdevel
KMSAN (KernelMemorySanitizer, a new error detection tool) reports use of
uninitialized memory in ext4_update_bh_state():
==================================================================
BUG: KMSAN: use of unitialized memory
CPU: 3 PID: 1 Comm: swapper/0 Tainted: G B 4.8.0-rc6+ #597
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs
01/01/2011
0000000000000282 ffff88003cc96f68 ffffffff81f30856 0000003000000008
ffff88003cc96f78 0000000000000096 ffffffff8169742a ffff88003cc96ff8
ffffffff812fc1fc 0000000000000008 ffff88003a1980e8 0000000100000000
Call Trace:
[< inline >] __dump_stack lib/dump_stack.c:15
[<ffffffff81f30856>] dump_stack+0xa6/0xc0 lib/dump_stack.c:51
[<ffffffff812fc1fc>] kmsan_report+0x1ec/0x300 mm/kmsan/kmsan.c:?
[<ffffffff812fc33b>] __msan_warning+0x2b/0x40 ??:?
[< inline >] ext4_update_bh_state fs/ext4/inode.c:727
[<ffffffff8169742a>] _ext4_get_block+0x6ca/0x8a0 fs/ext4/inode.c:759
[<ffffffff81696d4c>] ext4_get_block+0x8c/0xa0 fs/ext4/inode.c:769
[<ffffffff814a2d36>] generic_block_bmap+0x246/0x2b0 fs/buffer.c:2991
[<ffffffff816ca30e>] ext4_bmap+0x5ee/0x660 fs/ext4/inode.c:3177
...
origin description: ----tmp@generic_block_bmap
==================================================================
(the line numbers are relative to 4.8-rc6, but the bug persists
upstream)
The local |tmp| is created in generic_block_bmap() and then passed into
ext4_bmap() => ext4_get_block() => _ext4_get_block() =>
ext4_update_bh_state(). Along the way tmp.b_page is never initialized
before ext4_update_bh_state() checks its value.
Signed-off-by: Alexander Potapenko <glider@google.com>
---
fs/buffer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/buffer.c b/fs/buffer.c
index d21771f..3fb104e 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3029,6 +3029,7 @@ sector_t generic_block_bmap(struct address_space *mapping, sector_t block,
tmp.b_state = 0;
tmp.b_blocknr = 0;
tmp.b_size = 1 << inode->i_blkbits;
+ tmp.b_page = NULL;
get_block(inode, block, &tmp, 0);
return tmp.b_blocknr;
}
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related
* Re: [PATCH V6 0/2] Add ACPI support for HiSilicon SoCs Host Controllers
From: Dongdong Liu @ 2016-12-22 12:30 UTC (permalink / raw)
To: Ming Lei
Cc: helgaas, Arnd Bergmann, Rafael J. Wysocki, Lorenzo Pieralisi, tn,
wangzhou1, pratyush.anand, linux-pci@vger.kernel.org, Linux ACPI,
Linux Kernel Mailing List, Jon Masters, gabriele.paoloni,
charles.chenxin, Hanjun Guo, linuxarm
In-Reply-To: <CACVXFVMidDQO-hj6tivv=t2BGTbDXK5TH9ommLES67qFJpTNBg@mail.gmail.com>
Hi Ming
The latest patchset is [PATCH v11 00/15] PCI: ARM64 ECAM quirks
You can get them from https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git (pci/ecam)
Thanks
Dongdong
在 2016/12/22 16:31, Ming Lei 写道:
> Hi Dongdong,
>
> On Tue, Nov 22, 2016 at 8:08 PM, Dongdong Liu <liudongdong3@huawei.com> wrote:
>> This patchset adds ACPI support for the HiSilicon Hip05/Hip06/Hip07 SoC
>> PCIe controllers.
>> The two patches respectively:
>> - provides the common function acpi_get_rc_resources() for ARM64
>> platform.
>> - adds the HiSilicon ACPI specific quirks.
>>
>> This patchset is based on branch pci/ecam-v6
>> It can be found here:
>> https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git(pci/ecam-v6)
>>
>> This patchset has been tested on HiSilicon D03 board.
>> The dmesg log, /proc/iomem, and ACPI table information can be found:
>> https://bugzilla.kernel.org/show_bug.cgi?id=187961
>>
>> v5 -> v6:
>> - change the config option to CONFIG_PCI_ECAM_QUIRKS.
>> - fix some commets about acpi_get_rc_resources().
>
> Could you post out v7 for fixing conflicts against current linus tree?
>
> BTW, I tried to fix the conflicts by myself, but still caues the following
> build failure:
>
> [tom@linux-2.6-vm]$make -j4 CROSS_COMPILE=aarch64-linux-gnu-
> ARCH=arm64 drivers/pci/host/pcie-hisi-acpi.o
> CHK include/config/kernel.release
> CHK include/generated/uapi/linux/version.h
> CHK include/generated/utsrelease.h
> CHK include/generated/timeconst.h
> CHK include/generated/bounds.h
> CHK include/generated/asm-offsets.h
> CALL scripts/checksyscalls.sh
> CC drivers/pci/host/pcie-hisi-acpi.o
> In file included from drivers/pci/host/pcie-hisi-acpi.c:16:0:
> drivers/pci/host/../pci.h:357:18: error: conflicting types for
> ‘acpi_get_rc_resources’
> struct resource *acpi_get_rc_resources(const char *hid, u16 segment);
> ^
> drivers/pci/host/../pci.h:352:5: note: previous declaration of
> ‘acpi_get_rc_resources’ was here
> int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
> ^
> scripts/Makefile.build:293: recipe for target
> 'drivers/pci/host/pcie-hisi-acpi.o' failed
> make[1]: *** [drivers/pci/host/pcie-hisi-acpi.o] Error 1
> Makefile:1640: recipe for target 'drivers/pci/host/pcie-hisi-acpi.o' failed
> make: *** [drivers/pci/host/pcie-hisi-acpi.o] Error 2
>
>
> Thanks,
> Ming
>
>>
>> v4 -> v5:
>> - obtain rc base addresses from PNP0C02 at the root of the ACPI
>> namespace (under \_SB) instead of from sub-device under the RC.
>> - merge the rewrited get rc resources code by Tomasz.
>> - delete unused code.
>> - drop the PATCH V4 1/2, will rework late as a separate patch.
>>
>> v3 -> v4:
>> - rebase on pci/ecam-v6.
>> - delete the unnecessary link_up check code.
>>
>> v2 -> v3:
>> - rebase against 4.9-rc1 and add Tomasz quirks V6 pathcset.
>> - obtain rc base addresses from PNP0C02 as subdevice of PNP0A03 instead of
>> hardcode the addresses.
>> - modify hisi_pcie_acpi_rd_conf/hisi_pcie_acpi_wr_conf() according to
>> Arnd comments.
>>
>> v1 -> v2:
>> - rebase against Tomasz RFC V5 quirk mechanism
>> - add ACPI support for the HiSilicon Hip07 SoC PCIe controllers.
>>
>> Dongdong Liu (2):
>> PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform
>> PCI/ACPI: hisi: Add ACPI support for HiSilicon SoCs Host Controllers
>>
>> MAINTAINERS | 1 +
>> drivers/acpi/pci_mcfg.c | 13 +++++
>> drivers/pci/host/Kconfig | 7 +++
>> drivers/pci/host/Makefile | 1 +
>> drivers/pci/host/pcie-hisi-acpi.c | 119 ++++++++++++++++++++++++++++++++++++++
>> drivers/pci/pci-acpi.c | 69 ++++++++++++++++++++++
>> drivers/pci/pci.h | 4 ++
>> include/linux/pci-ecam.h | 5 ++
>> 8 files changed, 219 insertions(+)
>> create mode 100644 drivers/pci/host/pcie-hisi-acpi.c
>>
>> --
>> 1.9.1
>>
>
>
>
^ permalink raw reply
* Re: [PATCH V6 0/2] Add ACPI support for HiSilicon SoCs Host Controllers
From: Dongdong Liu @ 2016-12-22 12:30 UTC (permalink / raw)
To: Ming Lei
Cc: helgaas, Arnd Bergmann, Rafael J. Wysocki, Lorenzo Pieralisi, tn,
wangzhou1, pratyush.anand, linux-pci@vger.kernel.org, Linux ACPI,
Linux Kernel Mailing List, Jon Masters, gabriele.paoloni,
charles.chenxin, Hanjun Guo, linuxarm
In-Reply-To: <CACVXFVMidDQO-hj6tivv=t2BGTbDXK5TH9ommLES67qFJpTNBg@mail.gmail.com>
Hi Ming
The latest patchset is [PATCH v11 00/15] PCI: ARM64 ECAM quirks
You can get them from https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git (pci/ecam)
Thanks
Dongdong
在 2016/12/22 16:31, Ming Lei 写道:
> Hi Dongdong,
>
> On Tue, Nov 22, 2016 at 8:08 PM, Dongdong Liu <liudongdong3@huawei.com> wrote:
>> This patchset adds ACPI support for the HiSilicon Hip05/Hip06/Hip07 SoC
>> PCIe controllers.
>> The two patches respectively:
>> - provides the common function acpi_get_rc_resources() for ARM64
>> platform.
>> - adds the HiSilicon ACPI specific quirks.
>>
>> This patchset is based on branch pci/ecam-v6
>> It can be found here:
>> https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git(pci/ecam-v6)
>>
>> This patchset has been tested on HiSilicon D03 board.
>> The dmesg log, /proc/iomem, and ACPI table information can be found:
>> https://bugzilla.kernel.org/show_bug.cgi?id=187961
>>
>> v5 -> v6:
>> - change the config option to CONFIG_PCI_ECAM_QUIRKS.
>> - fix some commets about acpi_get_rc_resources().
>
> Could you post out v7 for fixing conflicts against current linus tree?
>
> BTW, I tried to fix the conflicts by myself, but still caues the following
> build failure:
>
> [tom@linux-2.6-vm]$make -j4 CROSS_COMPILE=aarch64-linux-gnu-
> ARCH=arm64 drivers/pci/host/pcie-hisi-acpi.o
> CHK include/config/kernel.release
> CHK include/generated/uapi/linux/version.h
> CHK include/generated/utsrelease.h
> CHK include/generated/timeconst.h
> CHK include/generated/bounds.h
> CHK include/generated/asm-offsets.h
> CALL scripts/checksyscalls.sh
> CC drivers/pci/host/pcie-hisi-acpi.o
> In file included from drivers/pci/host/pcie-hisi-acpi.c:16:0:
> drivers/pci/host/../pci.h:357:18: error: conflicting types for
> ‘acpi_get_rc_resources’
> struct resource *acpi_get_rc_resources(const char *hid, u16 segment);
> ^
> drivers/pci/host/../pci.h:352:5: note: previous declaration of
> ‘acpi_get_rc_resources’ was here
> int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
> ^
> scripts/Makefile.build:293: recipe for target
> 'drivers/pci/host/pcie-hisi-acpi.o' failed
> make[1]: *** [drivers/pci/host/pcie-hisi-acpi.o] Error 1
> Makefile:1640: recipe for target 'drivers/pci/host/pcie-hisi-acpi.o' failed
> make: *** [drivers/pci/host/pcie-hisi-acpi.o] Error 2
>
>
> Thanks,
> Ming
>
>>
>> v4 -> v5:
>> - obtain rc base addresses from PNP0C02 at the root of the ACPI
>> namespace (under \_SB) instead of from sub-device under the RC.
>> - merge the rewrited get rc resources code by Tomasz.
>> - delete unused code.
>> - drop the PATCH V4 1/2, will rework late as a separate patch.
>>
>> v3 -> v4:
>> - rebase on pci/ecam-v6.
>> - delete the unnecessary link_up check code.
>>
>> v2 -> v3:
>> - rebase against 4.9-rc1 and add Tomasz quirks V6 pathcset.
>> - obtain rc base addresses from PNP0C02 as subdevice of PNP0A03 instead of
>> hardcode the addresses.
>> - modify hisi_pcie_acpi_rd_conf/hisi_pcie_acpi_wr_conf() according to
>> Arnd comments.
>>
>> v1 -> v2:
>> - rebase against Tomasz RFC V5 quirk mechanism
>> - add ACPI support for the HiSilicon Hip07 SoC PCIe controllers.
>>
>> Dongdong Liu (2):
>> PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform
>> PCI/ACPI: hisi: Add ACPI support for HiSilicon SoCs Host Controllers
>>
>> MAINTAINERS | 1 +
>> drivers/acpi/pci_mcfg.c | 13 +++++
>> drivers/pci/host/Kconfig | 7 +++
>> drivers/pci/host/Makefile | 1 +
>> drivers/pci/host/pcie-hisi-acpi.c | 119 ++++++++++++++++++++++++++++++++++++++
>> drivers/pci/pci-acpi.c | 69 ++++++++++++++++++++++
>> drivers/pci/pci.h | 4 ++
>> include/linux/pci-ecam.h | 5 ++
>> 8 files changed, 219 insertions(+)
>> create mode 100644 drivers/pci/host/pcie-hisi-acpi.c
>>
>> --
>> 1.9.1
>>
>
>
>
^ permalink raw reply
* Re: Converting DEVICE_ATTR to DEVICE_ATTR_{RO,RW,WO} and changing function names at the same time
From: Julia Lawall @ 2016-12-22 12:29 UTC (permalink / raw)
To: Guenter Roeck; +Cc: cocci, linux-hwmon, linux-kernel
In-Reply-To: <20161221214425.GA2315@roeck-us.net>
On Wed, 21 Dec 2016, Guenter Roeck wrote:
> Hi Julia,
>
> On Wed, Dec 21, 2016 at 08:39:38PM +0100, Julia Lawall wrote:
> >
> >
> > On Wed, 21 Dec 2016, Guenter Roeck wrote:
> >
> > > Hi Julia,
> > >
> > > On Wed, Dec 21, 2016 at 03:05:37PM +0100, Julia Lawall wrote:
> > > > A solution is below: the semantic patch, an explanation of the semantic
> > > > patch, and the results. I have only tried to compile the results (make
> > > > drivers/hwmon/). Two affected files were not considered for compilation:
> > > >
> > > > drivers/hwmon/vexpress-hwmon.o
> > > > drivers/hwmon/jz4740-hwmon.o
>
> I compile tested those two patches. If possible please drop vexpress-hwmon.c
> from the patch series; the changes in that file don't add any value.
>
> I compile tested all files, and reviewed the patch. It all looks good.
> Please submit the series.
>
> Again, thanks a lot for your help!
I have sent the patches. I adjusted the semantic patch so that the
indentation of function parameters/arguments would only change if the
length of the function name changes.
Do you think this could be of more general interest in the Linux kernel?
Since the semantic patch works pretty well, I could add it to the
scripts/coccinelle directory? Previously, however, I got some negative
feedback about this change, because people felt that the new names hid the
actual behavior, so I didn't pursue it.
julia
^ permalink raw reply
* [Cocci] Converting DEVICE_ATTR to DEVICE_ATTR_{RO, RW, WO} and changing function names at the same time
From: Julia Lawall @ 2016-12-22 12:29 UTC (permalink / raw)
To: cocci
In-Reply-To: <20161221214425.GA2315@roeck-us.net>
On Wed, 21 Dec 2016, Guenter Roeck wrote:
> Hi Julia,
>
> On Wed, Dec 21, 2016 at 08:39:38PM +0100, Julia Lawall wrote:
> >
> >
> > On Wed, 21 Dec 2016, Guenter Roeck wrote:
> >
> > > Hi Julia,
> > >
> > > On Wed, Dec 21, 2016 at 03:05:37PM +0100, Julia Lawall wrote:
> > > > A solution is below: the semantic patch, an explanation of the semantic
> > > > patch, and the results. I have only tried to compile the results (make
> > > > drivers/hwmon/). Two affected files were not considered for compilation:
> > > >
> > > > drivers/hwmon/vexpress-hwmon.o
> > > > drivers/hwmon/jz4740-hwmon.o
>
> I compile tested those two patches. If possible please drop vexpress-hwmon.c
> from the patch series; the changes in that file don't add any value.
>
> I compile tested all files, and reviewed the patch. It all looks good.
> Please submit the series.
>
> Again, thanks a lot for your help!
I have sent the patches. I adjusted the semantic patch so that the
indentation of function parameters/arguments would only change if the
length of the function name changes.
Do you think this could be of more general interest in the Linux kernel?
Since the semantic patch works pretty well, I could add it to the
scripts/coccinelle directory? Previously, however, I got some negative
feedback about this change, because people felt that the new names hid the
actual behavior, so I didn't pursue it.
julia
^ permalink raw reply
* Re: [GLK MIPI DSI V2 2/9] drm/i915/glk: Program new MIPI DSI PHY registers for GLK
From: Jani Nikula @ 2016-12-22 12:28 UTC (permalink / raw)
To: Ville Syrjälä, Madhav Chauhan
Cc: Deepak M, ander.conselvan.de.oliveira, intel-gfx, shobhit.kumar
In-Reply-To: <20161222120220.GI31595@intel.com>
On Thu, 22 Dec 2016, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Dec 15, 2016 at 02:31:33PM +0530, Madhav Chauhan wrote:
>> From: Deepak M <m.deepak@intel.com>
>>
>> Program the clk lane and tlpx time count registers
>> to configure DSI PHY.
>>
>> v2: Addressed Jani's Review comments(renamed bit field macros)
>>
>> Signed-off-by: Deepak M <m.deepak@intel.com>
>> Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
>> ---
>> drivers/gpu/drm/i915/i915_reg.h | 18 ++++++++++++++++++
>> drivers/gpu/drm/i915/intel_dsi.c | 15 +++++++++++++++
>> 2 files changed, 33 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
>> index 8e47b59..03858f9 100644
>> --- a/drivers/gpu/drm/i915/i915_reg.h
>> +++ b/drivers/gpu/drm/i915/i915_reg.h
>> @@ -8550,6 +8550,24 @@ enum {
>> #define LP_BYTECLK_SHIFT 0
>> #define LP_BYTECLK_MASK (0xffff << 0)
>>
>> +#define _MIPIA_TLPX_TIME_COUNT (dev_priv->mipi_mmio_base + 0xb0a4)
>> +#define _MIPIC_TLPX_TIME_COUNT (dev_priv->mipi_mmio_base + 0xb8a4)
>> +#define MIPI_TLPX_TIME_COUNT(port) _MMIO_MIPI(port, _MIPIA_TLPX_TIME_COUNT, _MIPIC_TLPX_TIME_COUNT)
>> +#define GLK_DPHY_TLPX_TIME_CNT_SHIFT 0
>> +#define GLK_DPHY_TLPX_TIME_CNT_MASK (0xff << 0)
>> +
>> +#define _MIPIA_CLK_LANE_TIMING (dev_priv->mipi_mmio_base + 0xb098)
>> +#define _MIPIC_CLK_LANE_TIMING (dev_priv->mipi_mmio_base + 0xb898)
>> +#define MIPI_CLK_LANE_TIMING(port) _MMIO_MIPI(port, _MIPIA_CLK_LANE_TIMING, _MIPIC_CLK_LANE_TIMING)
>> +#define GLK_MIPI_CLK_LANE_HS_PREP_SHIFT 0
>> +#define GLK_MIPI_CLK_LANE_HS_PREP_MASK (0xff << 0)
>> +#define GLK_MIPI_CLK_LANE_HS_ZERO_SHIFT 8
>> +#define GLK_MIPI_CLK_LANE_HS_ZERO_MASK (0xff00 << 0)
>> +#define GLK_MIPI_CLK_LANE_HS_TRAIL_SHIFT 16
>> +#define GLK_MIPI_CLK_LANE_HS_TRAIL_MASK (0xff0000 << 0)
>> +#define GLK_MIPI_CLK_LANE_HS_EXIT_SHIFT 24
>> +#define GLK_MIPI_CLK_LANE_HS_EXIT_MASK (0xff000000 << 0)
>> +
>> /* bits 31:0 */
>> #define _MIPIA_LP_GEN_DATA (dev_priv->mipi_mmio_base + 0xb064)
>> #define _MIPIC_LP_GEN_DATA (dev_priv->mipi_mmio_base + 0xb864)
>> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
>> index 6b63355..b78c686 100644
>> --- a/drivers/gpu/drm/i915/intel_dsi.c
>> +++ b/drivers/gpu/drm/i915/intel_dsi.c
>> @@ -1123,6 +1123,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder,
>> struct drm_i915_private *dev_priv = to_i915(dev);
>> struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
>> struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
>> + struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
>> const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
>> enum port port;
>> unsigned int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
>> @@ -1278,6 +1279,20 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder,
>> */
>> I915_WRITE(MIPI_LP_BYTECLK(port), intel_dsi->lp_byte_clk);
>>
>> + if (IS_GEMINILAKE(dev_priv)) {
>> + I915_WRITE(MIPI_TLPX_TIME_COUNT(port),
>> + intel_dsi->lp_byte_clk);
>> + val = ((mipi_config->ths_prepare <<
>> + GLK_MIPI_CLK_LANE_HS_PREP_SHIFT) |
>> + (mipi_config->ths_prepare_hszero <<
>> + GLK_MIPI_CLK_LANE_HS_ZERO_SHIFT) |
>> + (mipi_config->ths_trail <<
>> + GLK_MIPI_CLK_LANE_HS_TRAIL_SHIFT) |
>> + (mipi_config->ths_exit <<
>> + GLK_MIPI_CLK_LANE_HS_EXIT_SHIFT));
>
> I don't think anything else here uses the mipi_config block directly.
> Rather everything gets duplicated in intel_dsi. This here looks
> like the same (or similar) thing to dphy_reg. Probably should
> reuse that, or split it up into its component pieces if we want
> to keep duplicated information between the mipi_config and intel_dsi.
My thoughts exactly. I've just been thinking about Hans' patches, and
whether we should give in and split intel_dsi.c and
intel_dsi_panel_vbt.c differently.
BR,
Jani.
>
>> + I915_WRITE(MIPI_CLK_LANE_TIMING(port), val);
>> + }
>> +
>> /* the bw essential for transmitting 16 long packets containing
>> * 252 bytes meant for dcs write memory command is programmed in
>> * this register in terms of byte clocks. based on dsi transfer
>> --
>> 1.9.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply
* [PATCH net 1/2] net/sched: act_tunnel_key: Fix setting UDP dst port in metadata under IPv6
From: Or Gerlitz @ 2016-12-22 12:28 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Roi Dayan, Hadar Har-Zion, Or Gerlitz
In-Reply-To: <1482409695-27956-1-git-send-email-ogerlitz@mellanox.com>
The UDP dst port was provided to the helper function which sets the
IPv6 IP tunnel meta-data under a wrong param order, fix that.
Fixes: 75bfbca01e48 ('net/sched: act_tunnel_key: Add UDP dst port option')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Hadar Hen Zion <hadarh@mellanox.com>
---
net/sched/act_tunnel_key.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 7af7125..e3a58e0 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -134,8 +134,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
saddr = nla_get_in6_addr(tb[TCA_TUNNEL_KEY_ENC_IPV6_SRC]);
daddr = nla_get_in6_addr(tb[TCA_TUNNEL_KEY_ENC_IPV6_DST]);
- metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, 0,
- dst_port, TUNNEL_KEY,
+ metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, dst_port,
+ 0, TUNNEL_KEY,
key_id, 0);
}
--
2.3.7
^ permalink raw reply related
* [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key
From: Or Gerlitz @ 2016-12-22 12:28 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Roi Dayan, Hadar Har-Zion, Or Gerlitz
Hi Dave,
This small series contain a fix to the matching flags support
in flower and to the tunnel key action MD prep for IPv6.
On a non related note, wishing everyone around here a happy new year,
celebrate and take a rest so we can do lots of good patch work(s) next.
Or.
Or Gerlitz (2):
net/sched: act_tunnel_key: Fix setting UDP dst port in metadata under IPv6
net/sched: cls_flower: Mandate mask when matching on flags
net/sched/act_tunnel_key.c | 4 ++--
net/sched/cls_flower.c | 23 ++++++++++++-----------
2 files changed, 14 insertions(+), 13 deletions(-)
--
2.3.7
^ permalink raw reply
* [PATCH net 2/2] net/sched: cls_flower: Mandate mask when matching on flags
From: Or Gerlitz @ 2016-12-22 12:28 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Roi Dayan, Hadar Har-Zion, Or Gerlitz
In-Reply-To: <1482409695-27956-1-git-send-email-ogerlitz@mellanox.com>
When matching on flags, we should require the user to provide the
mask and avoid using an all-ones mask. Not doing so causes matching
on flags provided w.o mask to hit on the value being unset for all
flags, which may not what the user wanted to happen.
Fixes: faa3ffce7829 ('net/sched: cls_flower: Add support for matching on flags')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reported-by: Paul Blakey <paulb@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
net/sched/cls_flower.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 35ac28d..333f8e2 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -442,32 +442,32 @@ static void fl_set_key_flag(u32 flower_key, u32 flower_mask,
}
}
-static void fl_set_key_flags(struct nlattr **tb,
- u32 *flags_key, u32 *flags_mask)
+static int fl_set_key_flags(struct nlattr **tb,
+ u32 *flags_key, u32 *flags_mask)
{
u32 key, mask;
- if (!tb[TCA_FLOWER_KEY_FLAGS])
- return;
+ /* mask is mandatory for flags */
+ if (!tb[TCA_FLOWER_KEY_FLAGS_MASK])
+ return -EINVAL;
key = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS]));
-
- if (!tb[TCA_FLOWER_KEY_FLAGS_MASK])
- mask = ~0;
- else
- mask = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS_MASK]));
+ mask = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS_MASK]));
*flags_key = 0;
*flags_mask = 0;
fl_set_key_flag(key, mask, flags_key, flags_mask,
TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT, FLOW_DIS_IS_FRAGMENT);
+
+ return 0;
}
static int fl_set_key(struct net *net, struct nlattr **tb,
struct fl_flow_key *key, struct fl_flow_key *mask)
{
__be16 ethertype;
+ int ret = 0;
#ifdef CONFIG_NET_CLS_IND
if (tb[TCA_FLOWER_INDEV]) {
int err = tcf_change_indev(net, tb[TCA_FLOWER_INDEV]);
@@ -614,9 +614,10 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
&mask->enc_tp.dst, TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK,
sizeof(key->enc_tp.dst));
- fl_set_key_flags(tb, &key->control.flags, &mask->control.flags);
+ if (tb[TCA_FLOWER_KEY_FLAGS])
+ ret = fl_set_key_flags(tb, &key->control.flags, &mask->control.flags);
- return 0;
+ return ret;
}
static bool fl_mask_eq(struct fl_flow_mask *mask1,
--
2.3.7
^ permalink raw reply related
* Re: [PATCH v2] drm/i915/ddi: Rely on VBT DDI port info for eDP detection
From: Imre Deak @ 2016-12-22 12:28 UTC (permalink / raw)
To: David Weinehall; +Cc: Jani Nikula, intel-gfx
In-Reply-To: <20161222091220.yvivcpq3cft2zv6a@boom>
On Thu, 2016-12-22 at 11:12 +0200, David Weinehall wrote:
> On Wed, Dec 21, 2016 at 12:17:24PM +0200, Imre Deak wrote:
> > There is at least one APL based system using port A in DP mode
> > (connecting to an on-board DP->VGA adaptor). Atm we'll configure port A
> > unconditionally as eDP which is incorrect in this case. Fix this by
> > relying on the VBT DDI port 'internal port' flag instead on all ports on
> > DDI platforms. For now chicken out from using VBT for port A before
> > GEN9.
> >
> > v2:
> > - Move the DDI port info lookup to intel_bios_is_port_edp() (David, Jani)
> > - Use the DDI port info on all DDI platforms starting for port B.
> >
> > > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > Cc: Jani Nikula <jani.nikula@intel.com>
> > > > Cc: David Weinehall <david.weinehall@linux.intel.com>
> > > > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
>
> Much happier with this one.
>
> Reviewed-by: David Weinehall <david.weinehall@linux.intel.com>
Pushed to -dinq, thanks for the reviews.
> > ---
> > drivers/gpu/drm/i915/i915_drv.h | 1 +
> > drivers/gpu/drm/i915/intel_bios.c | 4 ++++
> > drivers/gpu/drm/i915/intel_dp.c | 2 +-
> > 3 files changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index 77d7a07..1a91409 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -1669,6 +1669,7 @@ struct ddi_vbt_port_info {
> > > > uint8_t supports_dvi:1;
> > > > uint8_t supports_hdmi:1;
> > > > uint8_t supports_dp:1;
> > > > + uint8_t supports_edp:1;
> >
> > > > uint8_t alternate_aux_channel;
> > > > uint8_t alternate_ddc_pin;
> > diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> > index 1cf2fa6..a359def 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.c
> > +++ b/drivers/gpu/drm/i915/intel_bios.c
> > @@ -1161,6 +1161,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
> > > > info->supports_dvi = is_dvi;
> > > > info->supports_hdmi = is_hdmi;
> > > > info->supports_dp = is_dp;
> > > > + info->supports_edp = is_edp;
> >
> > > > DRM_DEBUG_KMS("Port %c VBT info: DP:%d HDMI:%d DVI:%d EDP:%d CRT:%d\n",
> > > > port_name(port), is_dp, is_hdmi, is_dvi, is_edp, is_crt);
> > @@ -1664,6 +1665,9 @@ bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port)
> > > > };
> > > > int i;
> >
> > > > + if (HAS_DDI(dev_priv))
> > > > + return dev_priv->vbt.ddi_port_info[port].supports_edp;
> > +
> > > > if (!dev_priv->vbt.child_dev_num)
> > > > return false;
> >
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 66b5bc8..746c237 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -4975,7 +4975,7 @@ bool intel_dp_is_edp(struct drm_i915_private *dev_priv, enum port port)
> > > > if (INTEL_GEN(dev_priv) < 5)
> > > > return false;
> >
> > > > - if (port == PORT_A)
> > > > + if (INTEL_GEN(dev_priv) < 9 && port == PORT_A)
> > > > return true;
> >
> > > > return intel_bios_is_port_edp(dev_priv, port);
> > --
> > 2.5.0
> >
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply
* Re: [PATCH] drm/i915: moved edid read from _force() to _get_modes()
From: Ville Syrjälä @ 2016-12-22 12:27 UTC (permalink / raw)
To: Anitha Chrisanthus; +Cc: intel-gfx
In-Reply-To: <1482360550-7909-1-git-send-email-anitha.chrisanthus@intel.com>
On Wed, Dec 21, 2016 at 02:49:10PM -0800, Anitha Chrisanthus wrote:
> From: "Chrisanthus, Anitha" <anitha.chrisanthus@intel.com>
>
> When the connector is forced ON and firmware EDID is provided,
> driver still tries to read the EDID from the sink device, this can increase
> the driver's start up time by ~25ms per attempt.
> This change is to fix this problem.
> By moving the point where we attempt to read EDID from the hdmi and dp
> _force functions to the corresponding _get_modes() functions we only
> attempt to read EDID if EDID firmware is not provided or if there is no
> valid EDID.
> This change should have no effect on the general case where the EDID is
> normally read during the hdmi or dp _detect() call.
Someone should just move the EDID override stuff to happen at a
lower level so that _all_ EDID parsing will see the override EDID.
>
> Signed-off-by: Chrisanthus, Anitha <anitha.chrisanthus@intel.com>
> ---
> drivers/gpu/drm/i915/intel_dp.c | 31 +++++++++++++++++++++----------
> drivers/gpu/drm/i915/intel_hdmi.c | 14 ++++++++------
> 2 files changed, 29 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 66b5bc8..0fcecc9 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4563,23 +4563,13 @@ intel_dp_force(struct drm_connector *connector)
> {
> struct intel_dp *intel_dp = intel_attached_dp(connector);
> struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
> - struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
> - enum intel_display_power_domain power_domain;
>
> DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
> connector->base.id, connector->name);
> - intel_dp_unset_edid(intel_dp);
>
> if (connector->status != connector_status_connected)
> return;
>
> - power_domain = intel_display_port_aux_power_domain(intel_encoder);
> - intel_display_power_get(dev_priv, power_domain);
> -
> - intel_dp_set_edid(intel_dp);
> -
> - intel_display_power_put(dev_priv, power_domain);
> -
> if (intel_encoder->type != INTEL_OUTPUT_EDP)
> intel_encoder->type = INTEL_OUTPUT_DP;
> }
> @@ -4588,8 +4578,29 @@ static int intel_dp_get_modes(struct drm_connector *connector)
> {
> struct intel_connector *intel_connector = to_intel_connector(connector);
> struct edid *edid;
> + struct intel_dp *intel_dp = intel_attached_dp(connector);
> + struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
> + struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
> + enum intel_display_power_domain power_domain;
>
> edid = intel_connector->detect_edid;
> + if ((edid == NULL) &&
> + (connector->status == connector_status_connected)) {
> +
> + intel_dp_unset_edid(intel_dp);
> +
> + power_domain =
> + intel_display_port_aux_power_domain(intel_encoder);
> + intel_display_power_get(dev_priv, power_domain);
> +
> + intel_dp_detect_dpcd(intel_dp);
> +
> + intel_dp_set_edid(intel_dp);
> +
> + intel_display_power_put(dev_priv, power_domain);
> +
> + edid = intel_connector->detect_edid;
> + }
> if (edid) {
> int ret = intel_connector_update_modes(connector, edid);
> if (ret)
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 0bcfead..e2f8bde 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1520,12 +1520,9 @@ intel_hdmi_force(struct drm_connector *connector)
> DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
> connector->base.id, connector->name);
>
> - intel_hdmi_unset_edid(connector);
> -
> if (connector->status != connector_status_connected)
> return;
>
> - intel_hdmi_set_edid(connector);
> hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
> }
>
> @@ -1534,9 +1531,14 @@ static int intel_hdmi_get_modes(struct drm_connector *connector)
> struct edid *edid;
>
> edid = to_intel_connector(connector)->detect_edid;
> - if (edid == NULL)
> - return 0;
> -
> + if ((edid == NULL) &&
> + (connector->status == connector_status_connected)) {
> + intel_hdmi_unset_edid(connector);
> + intel_hdmi_set_edid(connector);
> + edid = to_intel_connector(connector)->detect_edid;
> + if (edid == NULL)
> + return 0;
> + }
> return intel_connector_update_modes(connector, edid);
> }
>
> --
> 2.5.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply
* [PATCH 49/66] hwmon: (vt8231) use permission-specific DEVICE_ATTR variants
From: Julia Lawall @ 2016-12-22 12:05 UTC (permalink / raw)
To: Roger Lucas
Cc: kernel-janitors, Jean Delvare, Guenter Roeck, linux-hwmon,
linux-kernel
In-Reply-To: <1482408335-3435-1-git-send-email-Julia.Lawall@lip6.fr>
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch for the RO case, in the case where the show function
already has the expected name, is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/hwmon/vt8231.c | 59 +++++++++++++++++++++++++------------------------
1 file changed, 31 insertions(+), 28 deletions(-)
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index cb69a8c..367b5eb5 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -263,8 +263,8 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
}
/* Special case for input 5 as this has 3.3V scaling built into the chip */
-static ssize_t show_in5(struct device *dev, struct device_attribute *attr,
- char *buf)
+static ssize_t in5_input_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct vt8231_data *data = vt8231_update_device(dev);
@@ -272,7 +272,7 @@ static ssize_t show_in5(struct device *dev, struct device_attribute *attr,
(((data->in[5] - 3) * 10000 * 54) / (958 * 34)));
}
-static ssize_t show_in5_min(struct device *dev, struct device_attribute *attr,
+static ssize_t in5_min_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct vt8231_data *data = vt8231_update_device(dev);
@@ -281,7 +281,7 @@ static ssize_t show_in5_min(struct device *dev, struct device_attribute *attr,
(((data->in_min[5] - 3) * 10000 * 54) / (958 * 34)));
}
-static ssize_t show_in5_max(struct device *dev, struct device_attribute *attr,
+static ssize_t in5_max_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct vt8231_data *data = vt8231_update_device(dev);
@@ -290,8 +290,9 @@ static ssize_t show_in5_max(struct device *dev, struct device_attribute *attr,
(((data->in_max[5] - 3) * 10000 * 54) / (958 * 34)));
}
-static ssize_t set_in5_min(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t in5_min_store(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t count)
{
struct vt8231_data *data = dev_get_drvdata(dev);
unsigned long val;
@@ -309,8 +310,9 @@ static ssize_t set_in5_min(struct device *dev, struct device_attribute *attr,
return count;
}
-static ssize_t set_in5_max(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t in5_max_store(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t count)
{
struct vt8231_data *data = dev_get_drvdata(dev);
unsigned long val;
@@ -342,34 +344,35 @@ static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
define_voltage_sysfs(3);
define_voltage_sysfs(4);
-static DEVICE_ATTR(in5_input, S_IRUGO, show_in5, NULL);
-static DEVICE_ATTR(in5_min, S_IRUGO | S_IWUSR, show_in5_min, set_in5_min);
-static DEVICE_ATTR(in5_max, S_IRUGO | S_IWUSR, show_in5_max, set_in5_max);
+static DEVICE_ATTR_RO(in5_input);
+static DEVICE_ATTR_RW(in5_min);
+static DEVICE_ATTR_RW(in5_max);
/* Temperatures */
-static ssize_t show_temp0(struct device *dev, struct device_attribute *attr,
- char *buf)
+static ssize_t temp1_input_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct vt8231_data *data = vt8231_update_device(dev);
return sprintf(buf, "%d\n", data->temp[0] * 250);
}
-static ssize_t show_temp0_max(struct device *dev, struct device_attribute *attr,
+static ssize_t temp1_max_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct vt8231_data *data = vt8231_update_device(dev);
return sprintf(buf, "%d\n", data->temp_max[0] * 1000);
}
-static ssize_t show_temp0_min(struct device *dev, struct device_attribute *attr,
- char *buf)
+static ssize_t temp1_max_hyst_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct vt8231_data *data = vt8231_update_device(dev);
return sprintf(buf, "%d\n", data->temp_min[0] * 1000);
}
-static ssize_t set_temp0_max(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t temp1_max_store(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t count)
{
struct vt8231_data *data = dev_get_drvdata(dev);
long val;
@@ -385,8 +388,9 @@ static ssize_t set_temp0_max(struct device *dev, struct device_attribute *attr,
mutex_unlock(&data->update_lock);
return count;
}
-static ssize_t set_temp0_min(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t temp1_max_hyst_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct vt8231_data *data = dev_get_drvdata(dev);
long val;
@@ -481,10 +485,9 @@ static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO | S_IWUSR, \
show_temp_min, set_temp_min, offset - 1)
-static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp0, NULL);
-static DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp0_max, set_temp0_max);
-static DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp0_min,
- set_temp0_min);
+static DEVICE_ATTR_RO(temp1_input);
+static DEVICE_ATTR_RW(temp1_max);
+static DEVICE_ATTR_RW(temp1_max_hyst);
define_temperature_sysfs(2);
define_temperature_sysfs(3);
@@ -603,13 +606,13 @@ static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
define_fan_sysfs(2);
/* Alarms */
-static ssize_t show_alarms(struct device *dev, struct device_attribute *attr,
+static ssize_t alarms_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct vt8231_data *data = vt8231_update_device(dev);
return sprintf(buf, "%d\n", data->alarms);
}
-static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
+static DEVICE_ATTR_RO(alarms);
static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
char *buf)
@@ -633,13 +636,13 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6);
static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7);
-static ssize_t show_name(struct device *dev, struct device_attribute
+static ssize_t name_show(struct device *dev, struct device_attribute
*devattr, char *buf)
{
struct vt8231_data *data = dev_get_drvdata(dev);
return sprintf(buf, "%s\n", data->name);
}
-static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+static DEVICE_ATTR_RO(name);
static struct attribute *vt8231_attributes_temps[6][5] = {
{
^ permalink raw reply related
* [PATCH 62/66] hwmon: (max6650) use permission-specific DEVICE_ATTR variants
From: Julia Lawall @ 2016-12-22 12:05 UTC (permalink / raw)
To: Jean Delvare; +Cc: kernel-janitors, Guenter Roeck, linux-hwmon, linux-kernel
In-Reply-To: <1482408335-3435-1-git-send-email-Julia.Lawall@lip6.fr>
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch for the RO case, in the case where the show function
already has the expected name, is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/hwmon/max6650.c | 44 ++++++++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index a993b44..65be4b1 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -270,8 +270,8 @@ static ssize_t get_fan(struct device *dev, struct device_attribute *devattr,
* controlled.
*/
-static ssize_t get_target(struct device *dev, struct device_attribute *devattr,
- char *buf)
+static ssize_t fan1_target_show(struct device *dev,
+ struct device_attribute *devattr, char *buf)
{
struct max6650_data *data = max6650_update_device(dev);
int kscale, ktach, rpm;
@@ -318,8 +318,9 @@ static int max6650_set_target(struct max6650_data *data, unsigned long rpm)
data->speed);
}
-static ssize_t set_target(struct device *dev, struct device_attribute *devattr,
- const char *buf, size_t count)
+static ssize_t fan1_target_store(struct device *dev,
+ struct device_attribute *devattr,
+ const char *buf, size_t count)
{
struct max6650_data *data = dev_get_drvdata(dev);
unsigned long rpm;
@@ -350,8 +351,8 @@ static ssize_t set_target(struct device *dev, struct device_attribute *devattr,
* back exactly the value you have set.
*/
-static ssize_t get_pwm(struct device *dev, struct device_attribute *devattr,
- char *buf)
+static ssize_t pwm1_show(struct device *dev, struct device_attribute *devattr,
+ char *buf)
{
int pwm;
struct max6650_data *data = max6650_update_device(dev);
@@ -371,8 +372,9 @@ static ssize_t get_pwm(struct device *dev, struct device_attribute *devattr,
return sprintf(buf, "%d\n", pwm);
}
-static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr,
- const char *buf, size_t count)
+static ssize_t pwm1_store(struct device *dev,
+ struct device_attribute *devattr, const char *buf,
+ size_t count)
{
struct max6650_data *data = dev_get_drvdata(dev);
struct i2c_client *client = data->client;
@@ -406,8 +408,8 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr,
* 2 = Closed loop, RPM for all fans regulated by fan1 tachometer
* 3 = Fan off
*/
-static ssize_t get_enable(struct device *dev, struct device_attribute *devattr,
- char *buf)
+static ssize_t pwm1_enable_show(struct device *dev,
+ struct device_attribute *devattr, char *buf)
{
struct max6650_data *data = max6650_update_device(dev);
int mode = (data->config & MAX6650_CFG_MODE_MASK) >> 4;
@@ -416,8 +418,9 @@ static ssize_t get_enable(struct device *dev, struct device_attribute *devattr,
return sprintf(buf, "%d\n", sysfs_modes[mode]);
}
-static ssize_t set_enable(struct device *dev, struct device_attribute *devattr,
- const char *buf, size_t count)
+static ssize_t pwm1_enable_store(struct device *dev,
+ struct device_attribute *devattr,
+ const char *buf, size_t count)
{
struct max6650_data *data = dev_get_drvdata(dev);
unsigned long mode;
@@ -458,16 +461,17 @@ static ssize_t set_enable(struct device *dev, struct device_attribute *devattr,
* defined for that. See the data sheet for details.
*/
-static ssize_t get_div(struct device *dev, struct device_attribute *devattr,
- char *buf)
+static ssize_t fan1_div_show(struct device *dev,
+ struct device_attribute *devattr, char *buf)
{
struct max6650_data *data = max6650_update_device(dev);
return sprintf(buf, "%d\n", DIV_FROM_REG(data->count));
}
-static ssize_t set_div(struct device *dev, struct device_attribute *devattr,
- const char *buf, size_t count)
+static ssize_t fan1_div_store(struct device *dev,
+ struct device_attribute *devattr,
+ const char *buf, size_t count)
{
struct max6650_data *data = dev_get_drvdata(dev);
struct i2c_client *client = data->client;
@@ -534,10 +538,10 @@ static ssize_t get_alarm(struct device *dev, struct device_attribute *devattr,
static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, get_fan, NULL, 1);
static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, get_fan, NULL, 2);
static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, get_fan, NULL, 3);
-static DEVICE_ATTR(fan1_target, S_IWUSR | S_IRUGO, get_target, set_target);
-static DEVICE_ATTR(fan1_div, S_IWUSR | S_IRUGO, get_div, set_div);
-static DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, get_enable, set_enable);
-static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, get_pwm, set_pwm);
+static DEVICE_ATTR_RW(fan1_target);
+static DEVICE_ATTR_RW(fan1_div);
+static DEVICE_ATTR_RW(pwm1_enable);
+static DEVICE_ATTR_RW(pwm1);
static SENSOR_DEVICE_ATTR(fan1_max_alarm, S_IRUGO, get_alarm, NULL,
MAX6650_ALRM_MAX);
static SENSOR_DEVICE_ATTR(fan1_min_alarm, S_IRUGO, get_alarm, NULL,
^ permalink raw reply related
* [PATCH 45/66] hwmon: (w83791d) use permission-specific DEVICE_ATTR variants
From: Julia Lawall @ 2016-12-22 12:05 UTC (permalink / raw)
To: Marc Hulsman
Cc: kernel-janitors, Jean Delvare, Guenter Roeck, linux-hwmon,
linux-kernel
In-Reply-To: <1482408335-3435-1-git-send-email-Julia.Lawall@lip6.fr>
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch for the RO case, in the case where the show function
already has the expected name, is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/hwmon/w83791d.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
index 001df85..8af6081 100644
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -1041,14 +1041,14 @@ static ssize_t store_temp23(struct device *dev,
};
/* get realtime status of all sensors items: voltage, temp, fan */
-static ssize_t show_alarms_reg(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t alarms_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
struct w83791d_data *data = w83791d_update_device(dev);
return sprintf(buf, "%u\n", data->alarms);
}
-static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
+static DEVICE_ATTR_RO(alarms);
/* Beep control */
@@ -1147,25 +1147,24 @@ static ssize_t store_beep_enable(struct device *dev,
};
/* cpu voltage regulation information */
-static ssize_t show_vid_reg(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t cpu0_vid_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct w83791d_data *data = w83791d_update_device(dev);
return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm));
}
-static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL);
+static DEVICE_ATTR_RO(cpu0_vid);
-static ssize_t show_vrm_reg(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t vrm_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
struct w83791d_data *data = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", data->vrm);
}
-static ssize_t store_vrm_reg(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t vrm_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct w83791d_data *data = dev_get_drvdata(dev);
unsigned long val;
@@ -1188,7 +1187,7 @@ static ssize_t store_vrm_reg(struct device *dev,
return count;
}
-static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg);
+static DEVICE_ATTR_RW(vrm);
#define IN_UNIT_ATTRS(X) \
&sda_in_input[X].dev_attr.attr, \
^ permalink raw reply related
* [PATCH 61/66] hwmon: (emc2103) use permission-specific DEVICE_ATTR variants
From: Julia Lawall @ 2016-12-22 12:05 UTC (permalink / raw)
To: Steve Glendinning
Cc: kernel-janitors, Jean Delvare, Guenter Roeck, linux-hwmon,
linux-kernel
In-Reply-To: <1482408335-3435-1-git-send-email-Julia.Lawall@lip6.fr>
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch for the RO case, in the case where the show function
already has the expected name, is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/hwmon/emc2103.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c
index 4b870ee..1ed9a7a 100644
--- a/drivers/hwmon/emc2103.c
+++ b/drivers/hwmon/emc2103.c
@@ -284,7 +284,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da,
}
static ssize_t
-show_fan(struct device *dev, struct device_attribute *da, char *buf)
+fan1_input_show(struct device *dev, struct device_attribute *da, char *buf)
{
struct emc2103_data *data = emc2103_update_device(dev);
int rpm = 0;
@@ -294,7 +294,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da,
}
static ssize_t
-show_fan_div(struct device *dev, struct device_attribute *da, char *buf)
+fan1_div_show(struct device *dev, struct device_attribute *da, char *buf)
{
struct emc2103_data *data = emc2103_update_device(dev);
int fan_div = 8 / data->fan_multiplier;
@@ -307,8 +307,8 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da,
* of least surprise; the user doesn't expect the fan target to change just
* because the divider changed.
*/
-static ssize_t set_fan_div(struct device *dev, struct device_attribute *da,
- const char *buf, size_t count)
+static ssize_t fan1_div_store(struct device *dev, struct device_attribute *da,
+ const char *buf, size_t count)
{
struct emc2103_data *data = emc2103_update_device(dev);
struct i2c_client *client = data->client;
@@ -369,7 +369,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *da,
}
static ssize_t
-show_fan_target(struct device *dev, struct device_attribute *da, char *buf)
+fan1_target_show(struct device *dev, struct device_attribute *da, char *buf)
{
struct emc2103_data *data = emc2103_update_device(dev);
int rpm = 0;
@@ -382,8 +382,9 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *da,
return sprintf(buf, "%d\n", rpm);
}
-static ssize_t set_fan_target(struct device *dev, struct device_attribute *da,
- const char *buf, size_t count)
+static ssize_t fan1_target_store(struct device *dev,
+ struct device_attribute *da, const char *buf,
+ size_t count)
{
struct emc2103_data *data = emc2103_update_device(dev);
struct i2c_client *client = data->client;
@@ -412,7 +413,7 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da,
}
static ssize_t
-show_fan_fault(struct device *dev, struct device_attribute *da, char *buf)
+fan1_fault_show(struct device *dev, struct device_attribute *da, char *buf)
{
struct emc2103_data *data = emc2103_update_device(dev);
bool fault = ((data->fan_tach & 0x1fe0) == 0x1fe0);
@@ -420,14 +421,15 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da,
}
static ssize_t
-show_pwm_enable(struct device *dev, struct device_attribute *da, char *buf)
+pwm1_enable_show(struct device *dev, struct device_attribute *da, char *buf)
{
struct emc2103_data *data = emc2103_update_device(dev);
return sprintf(buf, "%d\n", data->fan_rpm_control ? 3 : 0);
}
-static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da,
- const char *buf, size_t count)
+static ssize_t pwm1_enable_store(struct device *dev,
+ struct device_attribute *da, const char *buf,
+ size_t count)
{
struct emc2103_data *data = dev_get_drvdata(dev);
struct i2c_client *client = data->client;
@@ -512,14 +514,12 @@ static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, show_temp_min_alarm,
static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, show_temp_max_alarm,
NULL, 3);
-static DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL);
-static DEVICE_ATTR(fan1_div, S_IRUGO | S_IWUSR, show_fan_div, set_fan_div);
-static DEVICE_ATTR(fan1_target, S_IRUGO | S_IWUSR, show_fan_target,
- set_fan_target);
-static DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL);
+static DEVICE_ATTR_RO(fan1_input);
+static DEVICE_ATTR_RW(fan1_div);
+static DEVICE_ATTR_RW(fan1_target);
+static DEVICE_ATTR_RO(fan1_fault);
-static DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, show_pwm_enable,
- set_pwm_enable);
+static DEVICE_ATTR_RW(pwm1_enable);
/* sensors present on all models */
static struct attribute *emc2103_attributes[] = {
^ permalink raw reply related
* [PATCH 59/66] hwmon: (adm1025) use permission-specific DEVICE_ATTR variants
From: Julia Lawall @ 2016-12-22 12:05 UTC (permalink / raw)
To: Jean Delvare; +Cc: kernel-janitors, Guenter Roeck, linux-hwmon, linux-kernel
In-Reply-To: <1482408335-3435-1-git-send-email-Julia.Lawall@lip6.fr>
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch for the RO case, in the case where the show function
already has the expected name, is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/hwmon/adm1025.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
index 1abb460..1e4dad3 100644
--- a/drivers/hwmon/adm1025.c
+++ b/drivers/hwmon/adm1025.c
@@ -333,12 +333,12 @@ static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \
set_temp(2);
static ssize_t
-show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
+alarms_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct adm1025_data *data = adm1025_update_device(dev);
return sprintf(buf, "%u\n", data->alarms);
}
-static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
+static DEVICE_ATTR_RO(alarms);
static ssize_t
show_alarm(struct device *dev, struct device_attribute *attr, char *buf)
@@ -358,21 +358,21 @@ static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \
static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_alarm, NULL, 14);
static ssize_t
-show_vid(struct device *dev, struct device_attribute *attr, char *buf)
+cpu0_vid_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct adm1025_data *data = adm1025_update_device(dev);
return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm));
}
-static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
+static DEVICE_ATTR_RO(cpu0_vid);
static ssize_t
-show_vrm(struct device *dev, struct device_attribute *attr, char *buf)
+vrm_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct adm1025_data *data = dev_get_drvdata(dev);
return sprintf(buf, "%u\n", data->vrm);
}
-static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t vrm_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct adm1025_data *data = dev_get_drvdata(dev);
unsigned long val;
@@ -388,7 +388,7 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
data->vrm = val;
return count;
}
-static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm);
+static DEVICE_ATTR_RW(vrm);
/*
* Real code
^ permalink raw reply related
* [PATCH 57/66] hwmon: (sch5627) use permission-specific DEVICE_ATTR variants
From: Julia Lawall @ 2016-12-22 12:05 UTC (permalink / raw)
To: Hans de Goede
Cc: kernel-janitors, Jean Delvare, Guenter Roeck, linux-hwmon,
linux-kernel
In-Reply-To: <1482408335-3435-1-git-send-email-Julia.Lawall@lip6.fr>
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch for the RO case, in the case where the show function
already has the expected name, is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/hwmon/sch5627.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c
index 19f85c0..91544f2 100644
--- a/drivers/hwmon/sch5627.c
+++ b/drivers/hwmon/sch5627.c
@@ -205,7 +205,7 @@ static int reg_to_rpm(u16 reg)
return 5400540 / reg;
}
-static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
+static ssize_t name_show(struct device *dev, struct device_attribute *devattr,
char *buf)
{
return snprintf(buf, PAGE_SIZE, "%s\n", DEVNAME);
@@ -326,7 +326,7 @@ static ssize_t show_in_label(struct device *dev, struct device_attribute
SCH5627_IN_LABELS[attr->index]);
}
-static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+static DEVICE_ATTR_RO(name);
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1);
static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);
^ permalink raw reply related
* [PATCH 60/66] hwmon: (lm83) use permission-specific DEVICE_ATTR variants
From: Julia Lawall @ 2016-12-22 12:05 UTC (permalink / raw)
To: Jean Delvare; +Cc: kernel-janitors, Guenter Roeck, linux-hwmon, linux-kernel
In-Reply-To: <1482408335-3435-1-git-send-email-Julia.Lawall@lip6.fr>
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch for the RO case, in the case where the show function
already has the expected name, is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/hwmon/lm83.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c
index 9e4d0e1..cbfd0bb 100644
--- a/drivers/hwmon/lm83.c
+++ b/drivers/hwmon/lm83.c
@@ -188,7 +188,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr,
return count;
}
-static ssize_t show_alarms(struct device *dev, struct device_attribute *dummy,
+static ssize_t alarms_show(struct device *dev, struct device_attribute *dummy,
char *buf)
{
struct lm83_data *data = lm83_update_device(dev);
@@ -236,7 +236,7 @@ static SENSOR_DEVICE_ATTR(temp3_crit, S_IWUSR | S_IRUGO, show_temp,
static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 13);
static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 15);
/* Raw alarm file for compatibility */
-static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
+static DEVICE_ATTR_RO(alarms);
static struct attribute *lm83_attributes[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr,
^ permalink raw reply related
* [PATCH 56/66] hwmon: (lm78) use permission-specific DEVICE_ATTR variants
From: Julia Lawall @ 2016-12-22 12:05 UTC (permalink / raw)
To: Jean Delvare; +Cc: kernel-janitors, Guenter Roeck, linux-hwmon, linux-kernel
In-Reply-To: <1482408335-3435-1-git-send-email-Julia.Lawall@lip6.fr>
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch for the RO case, in the case where the show function
already has the expected name, is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/hwmon/lm78.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index 539efe4..0cb7ff6 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -236,22 +236,23 @@ static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
show_in_offset(6);
/* Temperature */
-static ssize_t show_temp(struct device *dev, struct device_attribute *da,
- char *buf)
+static ssize_t temp1_input_show(struct device *dev,
+ struct device_attribute *da, char *buf)
{
struct lm78_data *data = lm78_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp));
}
-static ssize_t show_temp_over(struct device *dev, struct device_attribute *da,
+static ssize_t temp1_max_show(struct device *dev, struct device_attribute *da,
char *buf)
{
struct lm78_data *data = lm78_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over));
}
-static ssize_t set_temp_over(struct device *dev, struct device_attribute *da,
- const char *buf, size_t count)
+static ssize_t temp1_max_store(struct device *dev,
+ struct device_attribute *da, const char *buf,
+ size_t count)
{
struct lm78_data *data = dev_get_drvdata(dev);
long val;
@@ -268,15 +269,16 @@ static ssize_t set_temp_over(struct device *dev, struct device_attribute *da,
return count;
}
-static ssize_t show_temp_hyst(struct device *dev, struct device_attribute *da,
- char *buf)
+static ssize_t temp1_max_hyst_show(struct device *dev,
+ struct device_attribute *da, char *buf)
{
struct lm78_data *data = lm78_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst));
}
-static ssize_t set_temp_hyst(struct device *dev, struct device_attribute *da,
- const char *buf, size_t count)
+static ssize_t temp1_max_hyst_store(struct device *dev,
+ struct device_attribute *da,
+ const char *buf, size_t count)
{
struct lm78_data *data = dev_get_drvdata(dev);
long val;
@@ -293,11 +295,9 @@ static ssize_t set_temp_hyst(struct device *dev, struct device_attribute *da,
return count;
}
-static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
-static DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR,
- show_temp_over, set_temp_over);
-static DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR,
- show_temp_hyst, set_temp_hyst);
+static DEVICE_ATTR_RO(temp1_input);
+static DEVICE_ATTR_RW(temp1_max);
+static DEVICE_ATTR_RW(temp1_max_hyst);
/* 3 Fans */
static ssize_t show_fan(struct device *dev, struct device_attribute *da,
@@ -431,22 +431,22 @@ static SENSOR_DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR,
static SENSOR_DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_div, NULL, 2);
/* VID */
-static ssize_t show_vid(struct device *dev, struct device_attribute *da,
- char *buf)
+static ssize_t cpu0_vid_show(struct device *dev, struct device_attribute *da,
+ char *buf)
{
struct lm78_data *data = lm78_update_device(dev);
return sprintf(buf, "%d\n", vid_from_reg(data->vid, 82));
}
-static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
+static DEVICE_ATTR_RO(cpu0_vid);
/* Alarms */
-static ssize_t show_alarms(struct device *dev, struct device_attribute *da,
+static ssize_t alarms_show(struct device *dev, struct device_attribute *da,
char *buf)
{
struct lm78_data *data = lm78_update_device(dev);
return sprintf(buf, "%u\n", data->alarms);
}
-static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
+static DEVICE_ATTR_RO(alarms);
static ssize_t show_alarm(struct device *dev, struct device_attribute *da,
char *buf)
^ permalink raw reply related
* [PATCH 50/66] hwmon: (k10temp) use permission-specific DEVICE_ATTR variants
From: Julia Lawall @ 2016-12-22 12:05 UTC (permalink / raw)
To: Clemens Ladisch
Cc: kernel-janitors, Jean Delvare, Guenter Roeck, linux-hwmon,
linux-kernel
In-Reply-To: <1482408335-3435-1-git-send-email-Julia.Lawall@lip6.fr>
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch for the RO case, in the case where the show function
already has the expected name, is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/hwmon/k10temp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
index 9cdfde6..ce3b91f 100644
--- a/drivers/hwmon/k10temp.c
+++ b/drivers/hwmon/k10temp.c
@@ -72,8 +72,8 @@ static void amd_nb_smu_index_read(struct pci_dev *pdev, unsigned int devfn,
mutex_unlock(&nb_smu_ind_mutex);
}
-static ssize_t show_temp(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t temp1_input_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
u32 regval;
struct pci_dev *pdev = dev_get_drvdata(dev);
@@ -88,8 +88,8 @@ static ssize_t show_temp(struct device *dev,
return sprintf(buf, "%u\n", (regval >> 21) * 125);
}
-static ssize_t show_temp_max(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t temp1_max_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", 70 * 1000);
}
@@ -110,8 +110,8 @@ static ssize_t show_temp_crit(struct device *dev,
return sprintf(buf, "%d\n", value);
}
-static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
-static DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL);
+static DEVICE_ATTR_RO(temp1_input);
+static DEVICE_ATTR_RO(temp1_max);
static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0);
static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit, NULL, 1);
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.