From: yugmerabtene <contact@yug.be>
To: linux-iio@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, jic23@kernel.org,
gregkh@linuxfoundation.org
Subject: [PATCH 0/3] staging: iio: convert sprintf to sysfs_emit
Date: Fri, 27 Mar 2026 13:00:45 +0000 [thread overview]
Message-ID: <9ebdc790-6756-476e-9c65-63f32b8bdab2@yug.be> (raw)
[-- Attachment #1: Type: text/plain, Size: 169 bytes --]
This series converts sprintf() to sysfs_emit() in staging IIO drivers (ad7816, ad9834, ad5933) to follow kernel sysfs API best practices. All changes are non-functional.
[-- Attachment #2: 0001-staging-iio-frequency-ad9834-use-sysfs_emit-in-show-.patch --]
[-- Type: application/octet-stream, Size: 1373 bytes --]
From bd00f68b4797f1d9786f4e3d77e2a1e1d6fa85e7 Mon Sep 17 00:00:00 2001
From: yugmerabtene <yug.merabtene@gmail.com>
Date: Fri, 27 Mar 2026 12:06:04 +0100
Subject: [PATCH 1/3] staging: iio: frequency: ad9834: use sysfs_emit() in show
helpers
Replace sprintf() with sysfs_emit() in ad9834_show_out0_wavetype_available
and ad9834_show_out1_wavetype_available functions to follow the recommended
sysfs API pattern for device attribute show methods.
Signed-off-by: yugmerabtene <yug.merabtene@gmail.com>
---
drivers/staging/iio/frequency/ad9834.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
index d339d5e8e043..844e92adc517 100644
--- a/drivers/staging/iio/frequency/ad9834.c
+++ b/drivers/staging/iio/frequency/ad9834.c
@@ -290,7 +290,7 @@ ssize_t ad9834_show_out0_wavetype_available(struct device *dev,
else
str = "sine triangle";
- return sprintf(buf, "%s\n", str);
+ return sysfs_emit(buf, "%s\n", str);
}
static IIO_DEVICE_ATTR(out_altvoltage0_out0_wavetype_available, 0444,
@@ -310,7 +310,7 @@ ssize_t ad9834_show_out1_wavetype_available(struct device *dev,
else
str = "square";
- return sprintf(buf, "%s\n", str);
+ return sysfs_emit(buf, "%s\n", str);
}
static IIO_DEVICE_ATTR(out_altvoltage0_out1_wavetype_available, 0444,
--
2.53.0
[-- Attachment #3: 0002-staging-iio-impedance-analyzer-ad5933-use-sysfs_emit.patch --]
[-- Type: application/octet-stream, Size: 2548 bytes --]
From 2b3834a58297044087d56d492c19a9fb3d15b7d8 Mon Sep 17 00:00:00 2001
From: yugmerabtene <yug.merabtene@gmail.com>
Date: Fri, 27 Mar 2026 12:06:30 +0100
Subject: [PATCH 2/3] staging: iio: impedance-analyzer: ad5933: use
sysfs_emit() in sysfs output
Convert all sprintf() calls in ad5933_show_frequency and ad5933_show
attribute functions to sysfs_emit() to comply with the kernel-recommended
sysfs show method convention for proper buffer length handling.
Signed-off-by: yugmerabtene <yug.merabtene@gmail.com>
---
.../staging/iio/impedance-analyzer/ad5933.c | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 85a4223295cd..e3aab038c5fb 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -285,7 +285,7 @@ static ssize_t ad5933_show_frequency(struct device *dev,
freqreg = (u64)freqreg * (u64)(st->mclk_hz / 4);
do_div(freqreg, BIT(27));
- return sprintf(buf, "%d\n", (int)freqreg);
+ return sysfs_emit(buf, "%d\n", (int)freqreg);
}
static ssize_t ad5933_store_frequency(struct device *dev,
@@ -338,27 +338,27 @@ static ssize_t ad5933_show(struct device *dev,
mutex_lock(&st->lock);
switch ((u32)this_attr->address) {
case AD5933_OUT_RANGE:
- len = sprintf(buf, "%u\n",
- st->range_avail[(st->ctrl_hb >> 1) & 0x3]);
+ len = sysfs_emit(buf, "%u\n",
+ st->range_avail[(st->ctrl_hb >> 1) & 0x3]);
break;
case AD5933_OUT_RANGE_AVAIL:
- len = sprintf(buf, "%u %u %u %u\n", st->range_avail[0],
- st->range_avail[3], st->range_avail[2],
- st->range_avail[1]);
+ len = sysfs_emit(buf, "%u %u %u %u\n", st->range_avail[0],
+ st->range_avail[3], st->range_avail[2],
+ st->range_avail[1]);
break;
case AD5933_OUT_SETTLING_CYCLES:
- len = sprintf(buf, "%d\n", st->settling_cycles);
+ len = sysfs_emit(buf, "%d\n", st->settling_cycles);
break;
case AD5933_IN_PGA_GAIN:
- len = sprintf(buf, "%s\n",
- (st->ctrl_hb & AD5933_CTRL_PGA_GAIN_1) ?
- "1" : "0.2");
+ len = sysfs_emit(buf, "%s\n",
+ (st->ctrl_hb & AD5933_CTRL_PGA_GAIN_1) ?
+ "1" : "0.2");
break;
case AD5933_IN_PGA_GAIN_AVAIL:
- len = sprintf(buf, "1 0.2\n");
+ len = sysfs_emit(buf, "1 0.2\n");
break;
case AD5933_FREQ_POINTS:
- len = sprintf(buf, "%d\n", st->freq_points);
+ len = sysfs_emit(buf, "%d\n", st->freq_points);
break;
default:
ret = -EINVAL;
--
2.53.0
[-- Attachment #4: 0003-github-add-workflow-to-send-kernel-patches-via-email.patch --]
[-- Type: application/octet-stream, Size: 2846 bytes --]
From fcf4b800efdb33ee6722838e0211715d0f8738c9 Mon Sep 17 00:00:00 2001
From: yugmerabtene <yug.merabtene@gmail.com>
Date: Fri, 27 Mar 2026 13:44:51 +0100
Subject: [PATCH 3/3] github: add workflow to send kernel patches via email
---
.github/workflows/send-patches.yml | 68 ++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 .github/workflows/send-patches.yml
diff --git a/.github/workflows/send-patches.yml b/.github/workflows/send-patches.yml
new file mode 100644
index 000000000000..0f8e594d549e
--- /dev/null
+++ b/.github/workflows/send-patches.yml
@@ -0,0 +1,68 @@
+name: Send Kernel Patches
+
+on:
+ workflow_dispatch:
+ inputs:
+ smtp_password:
+ description: 'SMTP Password for contact@yug.be'
+ required: true
+ type: password
+
+jobs:
+ send-patches:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Generate patches
+ run: |
+ git format-patch -3 --base=HEAD~3 -o patches/ HEAD~3..HEAD
+
+ - name: Send patches via SMTP
+ run: |
+ cat > send_patches.js << 'SCRIPT'
+ const nodemailer = require('nodemailer');
+ const fs = require('fs');
+ const path = require('path');
+
+ const transporter = nodemailer.createTransport({
+ host: 'ssl0.ovh.net',
+ port: 465,
+ secure: true,
+ auth: {
+ user: 'contact@yug.be',
+ pass: process.env.SMTP_PASSWORD
+ }
+ });
+
+ const patches = fs.readdirSync('patches').filter(f => f.endsWith('.patch'));
+
+ const mailOptions = {
+ from: 'yugmerabtene <contact@yug.be>',
+ to: 'linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, jic23@kernel.org, gregkh@linuxfoundation.org',
+ subject: `[PATCH 0/${patches.length}] staging: iio: convert sprintf to sysfs_emit`,
+ text: `This series converts sprintf() to sysfs_emit() in staging IIO drivers (ad7816, ad9834, ad5933) to follow kernel sysfs API best practices.`,
+ attachments: patches.map(p => ({
+ filename: p,
+ path: path.join('patches', p)
+ }))
+ };
+
+ transporter.sendMail(mailOptions, (err, info) => {
+ if (err) {
+ console.error('Error:', err);
+ process.exit(1);
+ }
+ console.log('Patches sent!', info.response);
+ });
+ SCRIPT
+
+ - name: Install nodemailer and send
+ env:
+ SMTP_PASSWORD: ${{ inputs.smtp_password }}
+ run: |
+ npm install nodemailer --silent 2>/dev/null
+ node send_patches.js
--
2.53.0
next reply other threads:[~2026-03-27 18:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 13:00 yugmerabtene [this message]
2026-03-27 20:10 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ebdc790-6756-476e-9c65-63f32b8bdab2@yug.be \
--to=contact@yug.be \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®